Files
machartaa_admin_dist/dist/assets/index-7a059338.js
T

2 lines
11 KiB
JavaScript
Raw Normal View History

2026-07-13 14:00:01 +03:30
import{_ as Z}from"./BasicMainCard-d058ea26.js";import{_ as ee}from"./BasicModal.vue_vue_type_style_index_0_lang-8c7fc182.js";import{_ as te,u as ae}from"./useBaseTable-688b4d09.js";import{_ as ne}from"./button.vue_vue_type_style_index_0_lang-bc528a6c.js";import{I as B}from"./Icon-7fa61099.js";import{t as se}from"./useDataTime-55ab98cb.js";import{G as A,d as oe,g as b,A as le,o as T,i as ie,w as d,a as m,b as u,e as L,c as D,j as C,H as re,k as N,y as ue,t as F,D as f}from"./index-3ab4c2ab.js";import{f as H,a as ce,b as de,c as fe,d as me,e as O}from"./supabaseTableQuery-95762ff3.js";import{b as pe}from"./pushNotification-3a199421.js";import{_ as _e}from"./TextPreview.vue_vue_type_script_setup_true_lang-65de633b.js";import{e as ve,g as he}from"./convert-2ad76038.js";import{M as z}from"./index-4e80ed35.js";import{C as xe}from"./index-765ebcd6.js";import{I as ge}from"./index-5fcc634f.js";import{T as q}from"./isSymbol-953bfa39.js";import{U as ye}from"./index-65d991ef.js";import"./index-1356e41b.js";import"./index-7b086029.js";import"./_plugin-vue_export-helper-82f88acd.js";import"./useState-0f7a6718.js";import"./vnode-f1eea829.js";import"./useRefs-c04c8e88.js";import"./_flatRest-d8dfa8d1.js";import"./index-ac88f3fa.js";import"./Col-8e45347f.js";import"./styleChecker-ad03a940.js";import"./isPlainObject-2051d251.js";import"./index-3bccec6e.js";import"./updateLocale-d9cde3b5.js";import"./toArray-26ac07ab.js";import"./FormItemContext-7dd0ba71.js";import"./pickAttrs-229f702d.js";import"./lodash-69d27177.js";import"./css-a1b47e8e.js";import"./DialogWrap-c941449e.js";import"./textUtils-c37780ad.js";import"./index-7ba10095.js";const we=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:e=>e.record.index+1},{title:"نام ارسال کننده",dataIndex:"owner_name",key:"owner_name",filterField:"owner_name",customRender:e=>e.record.owner_name||"-"},{title:"متن پیام",dataIndex:"text",key:"text",slot:"text"},{title:"فایل",dataIndex:"file",key:"file",align:"center",width:120,slot:"file"},{title:"وضعیت پین",dataIndex:"pined",key:"pined",align:"center",width:100,customRender:e=>e.record.pined?"پین شده":"-"},{title:"زمان ایجاد",dataIndex:"created_at",key:"created_at",customRender:e=>se(e.record.created_at)},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center"}],be=new Set(["text","file","pined","pined_at","created_at","updated_at","owner_id"]),ke=["text"];async function Ie(e){const{data:s,error:v}=await A.from("channel_message").insert([e]).select();if(v)throw v;return s}async function G(e,s){const{data:v,error:k}=await A.from("channel_message").update(s).eq("id",e).select();if(k)throw k;return v}async function Se(e){const{error:s}=await A.from("channel_message").delete().eq("id",e);if(s)throw s}function Ce(e){let s=null;if(e.owner_id){const v=Array.isArray(e.users)?e.users[0]:e.users;v?s=`${v.first_name||""} ${v.last_name||""}`.trim()||v.phone||`کاربر ${e.owner_id}`:s=`کاربر ${e.owner_id}`}return{...e,owner_name:s,text:e.text??"",file:e.file??null,pined:e.pined??!1,pined_at:e.pined_at??null,created_at:e.created_at??"",updated_at:e.updated_at??""}}async function Me(e){const s={...e};!s.sort&&!s.order&&(s.order="-id");const{limit:v=20,page:k=1,search:S,filters:g}=s;let o=A.from("channel_message").select("*, users!owner_id(first_name, last_name, phone)",{count:"exact"});if(S!=null&&S.trim()){const p=await H(A,S);o=ce(o,S,ke,p,"owner_id")}if(g!=null&&g.length){for(const p of g)if(!(p.hidden||!p.field)){if(p.field==="owner_name"){if(["eq","has","like"].includes(p.op)){const h=await H(A,String(p.value));h.length?o=o.in("owner_id",h):o=o.eq("owner_id","00000000-0000-0000-0000-000000000000")}continue}be.has(p.field)&&(o=de(o,p))}}o=fe(o,s,"-id",["id","created_at","updated_at","pined","text"]),o=me(o,k,v);const{data:M,error:y,count:w}=await o;return y?(console.error("[getChannelMessagesTable] Supabase query error:",y),O([],0,s)):O(M,w,s,Ce)}const Te={class:"flex justify-between items-center mb-4"},Ae=m("h2",null,"پ