Files
machartaa_admin_dist/dist/assets/index-e22fc377.js
T

2 lines
11 KiB
JavaScript
Raw Normal View History

2026-07-04 17:32:23 +03:30
import{_ as Z}from"./BasicMainCard-eb9343e9.js";import{_ as ee}from"./BasicModal.vue_vue_type_style_index_0_lang-4effc2b1.js";import{_ as te,u as ae}from"./useBaseTable-c909e392.js";import{_ as ne}from"./button.vue_vue_type_style_index_0_lang-a7c15404.js";import{I as B}from"./Icon-f0620776.js";import{t as se}from"./useDataTime-e4f5bf79.js";import{H 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,G as re,k as N,y as ue,t as F,D as f}from"./index-14c3003c.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-7934841d.js";import{_ as _e}from"./TextPreview.vue_vue_type_script_setup_true_lang-25f62147.js";import{e as ve,g as he}from"./convert-67c23be8.js";import{M as z}from"./index-77af8dcc.js";import{C as xe}from"./index-96a49d7d.js";import{I as ge}from"./index-866e6f6b.js";import{T as q}from"./shallowequal-a5ad9c9b.js";import{U as ye}from"./index-e494544d.js";import"./index-8e611dfd.js";import"./index-031faeaf.js";import"./_plugin-vue_export-helper-9d873422.js";import"./styleChecker-569634cf.js";import"./vnode-0d5a6b01.js";import"./useState-f0d82672.js";import"./useRefs-47c5d0d5.js";import"./_flatRest-3e64feef.js";import"./index-785693d7.js";import"./Col-006339a7.js";import"./isPlainObject-c274713e.js";import"./index-43497ac0.js";import"./fa_IR-245a648a.js";import"./toArray-f191f093.js";import"./FormItemContext-8fd31893.js";import"./pickAttrs-c4f5e9cb.js";import"./lodash-3dfbaf74.js";import"./css-e89e37f1.js";import"./DialogWrap-0c54c10f.js";import"./textUtils-c37780ad.js";import"./index-7e1e4415.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,"Ù¾ÛŒØ