Files
machartaa_admin_dist/dist/assets/index-251e22ee.js
T

2 lines
11 KiB
JavaScript
Raw Normal View History

2026-07-04 21:19:56 +03:30
import{_ as Z}from"./BasicMainCard-12ef539d.js";import{_ as ee}from"./BasicModal.vue_vue_type_style_index_0_lang-d1e6a59e.js";import{_ as te,u as ae}from"./useBaseTable-f680a0e2.js";import{_ as ne}from"./button.vue_vue_type_style_index_0_lang-e0dea8bb.js";import{I as B}from"./Icon-199a922a.js";import{t as se}from"./useDataTime-bbfc6d86.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-caf247db.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-80bea31c.js";import{_ as _e}from"./TextPreview.vue_vue_type_script_setup_true_lang-bf695084.js";import{e as ve,g as he}from"./convert-67c23be8.js";import{M as z}from"./index-688f073d.js";import{C as xe}from"./index-7a128151.js";import{I as ge}from"./index-01e8bf20.js";import{T as q}from"./shallowequal-1ad8252c.js";import{U as ye}from"./index-c1eb3aaf.js";import"./index-de58d7f5.js";import"./index-19e6126e.js";import"./_plugin-vue_export-helper-438caba9.js";import"./styleChecker-477bfa11.js";import"./vnode-20d5d74c.js";import"./useState-74071817.js";import"./useRefs-22b2473f.js";import"./_flatRest-a161204e.js";import"./index-f1bbae53.js";import"./Col-361122c0.js";import"./isPlainObject-16f1bdfa.js";import"./index-70e9e671.js";import"./fa_IR-3fc10d80.js";import"./toArray-ad006c19.js";import"./FormItemContext-d53141ed.js";import"./pickAttrs-d5fdda1c.js";import"./lodash-f5ffd720.js";import"./css-bff3ffda.js";import"./DialogWrap-7b83b14e.js";import"./textUtils-c37780ad.js";import"./index-ec2e4f99.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,"Ù¾ÛŒØ