2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
import{_ as Z}from"./BasicMainCard-16037bcb.js";import{_ as ee}from"./BasicModal.vue_vue_type_style_index_0_lang-1f90009d.js";import{_ as te,u as ae}from"./useBaseTable-253c2441.js";import{_ as ne}from"./button.vue_vue_type_style_index_0_lang-3cd9de9f.js";import{I as B}from"./Icon-1c8e1e9a.js";import{t as oe}from"./useDataTime-083dad6f.js";import{G as A,d as ie,g as k,A as se,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-157892ef.js";import{fetchMatchingUserIds as H,applyEmbeddedUserSearch as ce,applySupabaseFilter as de,applySupabaseSort as fe,applySupabasePagination as me,formatTableResult as O}from"./supabaseTableQuery-8ab5665d.js";import{b as pe}from"./pushNotification-c44e3fac.js";import{_ as _e}from"./TextPreview.vue_vue_type_script_setup_true_lang-a1cc9442.js";import{e as ve,g as he}from"./convert-2ad76038.js";import{M as z}from"./index-e60f1d66.js";import{C as xe}from"./index-3631a093.js";import{I as ge}from"./index-2e17d8ae.js";import{T as q}from"./isSymbol-d560f493.js";import{U as ye}from"./index-d38f12f7.js";import"./Grid-938ddf81.js";import"./index-4a70e7da.js";import"./_plugin-vue_export-helper-b335f697.js";import"./index-47a95ccc.js";import"./vnode-4a81629f.js";import"./omit-e1b41de8.js";import"./useState-c3e69ab5.js";import"./useRefs-3fd4fb6c.js";import"./_flatRest-6d155af7.js";import"./index-dc86b1c3.js";import"./Col-b55f55a6.js";import"./styleChecker-a54924f7.js";import"./isPlainObject-86af753d.js";import"./index-d692d775.js";import"./updateLocale-5b074ed4.js";import"./index-bc659f42.js";import"./index-10655c40.js";import"./toArray-0cb2ab82.js";import"./FormItemContext-9d898e7c.js";import"./pickAttrs-99fc3772.js";import"./lodash-b0b4e146.js";import"./BaseSwitch.vue_vue_type_script_setup_true_lang-18d9510e.js";import"./index-db2fbdbd.js";import"./Badge-65e3af71.js";import"./isNumeric-3f69e2aa.js";import"./index-7e24c386.js";import"./index-c3f6f95c.js";import"./textUtils-c37780ad.js";import"./DialogWrap-30578cd1.js";import"./index-d809d721.js";import"./css-aae66f86.js";import"./index-1d294154.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"}],ke=new Set(["text","file","pined","pined_at","created_at","updated_at","owner_id"]),be=["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:b}=await A.from("channel_message").update(o).eq("id",e).select();if(b)throw b;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:b=1,search:S,filters:g}=o;let i=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);i=ce(i,S,be,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"].incl
|