Files
machartaa_admin_dist/dist/assets/index-64195e2a.js
T

2 lines
10 KiB
JavaScript
Raw Normal View History

2026-06-18 17:05:42 +03:30
import{_ as Y}from"./BasicMainCard-cc2ac10d.js";import{_ as Z}from"./BasicModal.vue_vue_type_style_index_0_lang-1ad0fa16.js";import{_ as ee,u as te}from"./useBaseTable-bdecf611.js";import{_ as ae}from"./button.vue_vue_type_style_index_0_lang-f5bd4942.js";import{I as T}from"./Icon-b5c42a34.js";import{t as ne}from"./useDataTime-9a659784.js";import{I 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-1de9461e.js";import{f as F,a as re,b as ue,c as ce,d as de,e as O}from"./supabaseTableQuery-be932edd.js";import{_ as fe}from"./TextPreview.vue_vue_type_script_setup_true_lang-61d3378c.js";import{e as me,g as pe}from"./convert-67c23be8.js";import{M as z}from"./index-25b56c8c.js";import{I as _e}from"./index-5e4c5a75.js";import{T as R}from"./shallowequal-10af2274.js";import{U as ve}from"./index-3ea066a2.js";import"./index-58d23169.js";import"./index-0e4daf27.js";import"./_plugin-vue_export-helper-163b7167.js";import"./Col-1f5eceac.js";import"./vnode-b37b1d96.js";import"./useState-1ccc2601.js";import"./useRefs-2de093d8.js";import"./index-fceb0c55.js";import"./isPlainObject-272cc49f.js";import"./index-52cb59f6.js";import"./fa_IR-d685ac61.js";import"./toArray-1ef5a130.js";import"./FormItemContext-4f390352.js";import"./pickAttrs-7c9ec5a2.js";import"./lodash-6e822df9.js";import"./index-2ebc5026.js";import"./index-57d8a5bc.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 H(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),O([],0,s)):O(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={class:"space-y-4"},Ue=d("div",{class:"m