2026-06-27 15:01:03 +03:30
|
|
|
import{_ as Y}from"./BasicMainCard-958ba44a.js";import{_ as Z}from"./BasicModal.vue_vue_type_style_index_0_lang-dbdcf7a8.js";import{_ as ee,u as te}from"./useBaseTable-27f8c4c5.js";import{_ as ae}from"./button.vue_vue_type_style_index_0_lang-77af712b.js";import{I as T}from"./Icon-a2802ec2.js";import{t as ne}from"./useDataTime-0b1c250c.js";import{H as C,d as se,g as b,A as le,o as A,c as D,b as c,w as m,a as d,e as P,G as oe,j as S,y as ie,t as N,k as V,D as p}from"./index-88dc4dc5.js";import{f as F,a as re,b as ue,c as ce,d as de,e as H}from"./supabaseTableQuery-95762ff3.js";import{_ as fe}from"./TextPreview.vue_vue_type_script_setup_true_lang-bda1a01f.js";import{e as me,g as pe}from"./convert-67c23be8.js";import{M as O}from"./index-47f374b2.js";import{I as _e}from"./index-f45c1209.js";import{T as R}from"./shallowequal-3634d17f.js";import{U as ve}from"./index-7c377792.js";import"./index-f92d386a.js";import"./index-b34fee57.js";import"./_plugin-vue_export-helper-45085cdd.js";import"./styleChecker-8c0172bf.js";import"./vnode-0ac755a4.js";import"./useState-bcda3993.js";import"./useRefs-1597afba.js";import"./Col-683db425.js";import"./index-e9421516.js";import"./isPlainObject-d53023a8.js";import"./index-0b4b8a23.js";import"./fa_IR-540ac607.js";import"./toArray-dc7976f8.js";import"./FormItemContext-911b3f35.js";import"./pickAttrs-219ceae4.js";import"./lodash-d215e71f.js";import"./index-89fd85e2.js";import"./index-6d827d52.js";const he=[{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=>ne(e.record.created_at)},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center"}],xe=new Set(["text","file","pined","pined_at","created_at","updated_at","owner_id"]),ge=["text"];async function ye(e){const{data:s,error:_}=await C.from("channel_message").insert([e]).select();if(_)throw _;return s}async function z(e,s){const{data:_,error:w}=await C.from("channel_message").update(s).eq("id",e).select();if(w)throw w;return _}async function we(e){const{error:s}=await C.from("channel_message").delete().eq("id",e);if(s)throw s}function be(e){let s=null;if(e.owner_id){const _=Array.isArray(e.users)?e.users[0]:e.users;_?s=`${_.first_name||""} ${_.last_name||""}`.trim()||_.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 ke(e){const s={...e};!s.sort&&!s.order&&(s.order="-id");const{limit:_=20,page:w=1,search:k,filters:x}=s;let l=C.from("channel_message").select("*, users!owner_id(first_name, last_name, phone)",{count:"exact"});if(k!=null&&k.trim()){const f=await F(C,k);l=re(l,k,ge,f,"owner_id")}if(x!=null&&x.length){for(const f of x)if(!(f.hidden||!f.field)){if(f.field==="owner_name"){if(["eq","has","like"].includes(f.op)){const h=await F(C,String(f.value));h.length?l=l.in("owner_id",h):l=l.eq("owner_id","00000000-0000-0000-0000-000000000000")}continue}xe.has(f.field)&&(l=ue(l,f))}}l=ce(l,s,"-id",["id","created_at","updated_at","pined","text"]),l=de(l,w,_);const{data:I,error:g,count:y}=await l;return g?(console.error("[getChannelMessagesTable] Supabase query error:",g),H([],0,s)):H(I,y,s,be)}const Ie={class:"flex justify-between items-center mb-4"},Se=d("h2",null,"اطلاع رسانی",-1),Ce=["href"],Me={key:1},Te={class:"gap-2 flex justify-center"},Ae=d("span",null,"پین کردن",-1),De=d("span",null,"حذف",-1),$e=d("span",null,"ویرایش",-1),Be={clas
|