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

2 lines
11 KiB
JavaScript
Raw Normal View History

2026-07-14 12:58:42 +03:30
import{_ as Z}from"./BasicMainCard-9c458ce7.js";import{_ as ee}from"./BasicModal.vue_vue_type_style_index_0_lang-5bce5515.js";import{_ as te,u as ae}from"./useBaseTable-3b2d0853.js";import{_ as ne}from"./button.vue_vue_type_style_index_0_lang-95946c23.js";import{I as B}from"./Icon-06d3f751.js";import{t as se}from"./useDataTime-c147e135.js";import{G 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,H as re,k as N,y as ue,t as F,D as f}from"./index-20d5dab1.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-00056698.js";import{_ as _e}from"./TextPreview.vue_vue_type_script_setup_true_lang-bacd5482.js";import{e as ve,g as he}from"./convert-2ad76038.js";import{M as z}from"./index-4f6342fa.js";import{C as xe}from"./index-f75dc027.js";import{I as ge}from"./index-f6eb678e.js";import{T as q}from"./isSymbol-f04930e1.js";import{U as ye}from"./index-44ec8c49.js";import"./index-857151a7.js";import"./index-4284a867.js";import"./_plugin-vue_export-helper-26f60d29.js";import"./useState-3cc4a0be.js";import"./vnode-18b1f518.js";import"./useRefs-03151dab.js";import"./_flatRest-12208321.js";import"./index-0d016563.js";import"./Col-6ec89065.js";import"./styleChecker-6ae1ce26.js";import"./isPlainObject-769b8c03.js";import"./index-38a2f111.js";import"./updateLocale-6ea9ed84.js";import"./toArray-fb96c8b9.js";import"./FormItemContext-28b30746.js";import"./pickAttrs-93039156.js";import"./lodash-28ee46da.js";import"./css-0bca533a.js";import"./DialogWrap-a4cda90f.js";import"./textUtils-c37780ad.js";import"./index-84af5005.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,"پ