2026-08-09 13:07:17 +03:30
|
|
|
import{_ as Z}from"./BasicMainCard-4b9ba85b.js";import{_ as ee}from"./BasicModal.vue_vue_type_style_index_0_lang-661b0a06.js";import{_ as te,u as ae}from"./useBaseTable-3c30fe12.js";import{_ as ne}from"./button.vue_vue_type_style_index_0_lang-f6f5b6a0.js";import{I as B}from"./Icon-889d6eab.js";import{t as oe}from"./useDataTime-5a269444.js";import{G as A,d as se,g as b,A as ie,o as T,i as le,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-f8ee37b9.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-9884eb92.js";import{_ as _e}from"./TextPreview.vue_vue_type_script_setup_true_lang-53f928ef.js";import{e as ve,g as he}from"./convert-2ad76038.js";import{M as z}from"./index-ef1f8a61.js";import{C as xe}from"./index-8bcedf66.js";import{I as ge}from"./index-1ab617ae.js";import{T as q}from"./isSymbol-cdcd460d.js";import{U as ye}from"./index-c0e94d73.js";import"./Grid-30a17a21.js";import"./index-6e8a4b4f.js";import"./_plugin-vue_export-helper-775bc553.js";import"./index-b8cc71e2.js";import"./vnode-b0e810ae.js";import"./omit-bdd3cea5.js";import"./useState-f5985d90.js";import"./useRefs-bff35432.js";import"./_flatRest-6305d35d.js";import"./index-ee1b3469.js";import"./Col-97627e24.js";import"./styleChecker-c1fc9f39.js";import"./isPlainObject-6382de01.js";import"./index-0e72b27c.js";import"./updateLocale-d5a764a4.js";import"./index-bc659f42.js";import"./index-f923b666.js";import"./toArray-53a55fc4.js";import"./FormItemContext-5821e8c8.js";import"./pickAttrs-69f29e9c.js";import"./lodash-7c51d08d.js";import"./BaseSwitch.vue_vue_type_script_setup_true_lang-2e892f80.js";import"./index-78e4e5e0.js";import"./Badge-47d7b0bb.js";import"./isNumeric-3f69e2aa.js";import"./index-89210322.js";import"./index-bf59f845.js";import"./textUtils-c37780ad.js";import"./DialogWrap-192ddaf7.js";import"./index-0441c4fc.js";import"./css-aae66f86.js";import"./index-9594c53b.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=>oe(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:o,error:v}=await A.from("channel_message").insert([e]).select();if(v)throw v;return o}async function G(e,o){const{data:v,error:k}=await A.from("channel_message").update(o).eq("id",e).select();if(k)throw k;return v}async function Se(e){const{error:o}=await A.from("channel_message").delete().eq("id",e);if(o)throw o}function Ce(e){let o=null;if(e.owner_id){const v=Array.isArray(e.users)?e.users[0]:e.users;v?o=`${v.first_name||""} ${v.last_name||""}`.trim()||v.phone||`کاربر ${e.owner_id}`:o=`کاربر ${e.owner_id}`}return{...e,owner_name:o,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 o={...e};!o.sort&&!o.order&&(o.order="-id");const{limit:v=20,page:k=1,search:S,filters:g}=o;let s=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);s=ce(s,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?s=s.in("owner_id",h):s=s.eq("owner_id","00000000-0000-000
|