Files
machartaa_admin_dist/dist/assets/index-7d3ad1fa.js
T

2 lines
11 KiB
JavaScript
Raw Normal View History

2026-07-15 17:50:32 +03:30
import{_ as Z}from"./BasicMainCard-b5ec3265.js";import{_ as ee}from"./BasicModal.vue_vue_type_style_index_0_lang-59e3a60f.js";import{_ as te,u as ae}from"./useBaseTable-37cc5c4e.js";import{_ as ne}from"./button.vue_vue_type_style_index_0_lang-f45a0e84.js";import{I as B}from"./Icon-1df01939.js";import{t as oe}from"./useDataTime-d0312d21.js";import{G as A,d as se,g as b,A as ie,o as T,i as le,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-4ed3ac6f.js";import{f as H,a as ce,b as de,c as fe,d as me,e as O}from"./supabaseTableQuery-9069679c.js";import{b as pe}from"./pushNotification-781d8efe.js";import{_ as _e}from"./TextPreview.vue_vue_type_script_setup_true_lang-ca3a87e7.js";import{e as ve,g as he}from"./convert-2ad76038.js";import{M as z}from"./index-11cc1aef.js";import{C as xe}from"./index-da74a8b6.js";import{I as ge}from"./index-9cf626d0.js";import{T as q}from"./isSymbol-affa2e59.js";import{U as ye}from"./index-f8e98698.js";import"./index-793108ce.js";import"./index-e2784e5a.js";import"./_plugin-vue_export-helper-63226944.js";import"./useState-8f767204.js";import"./vnode-89c9e7cb.js";import"./useRefs-68a2914e.js";import"./_flatRest-1f22619a.js";import"./index-a875f6da.js";import"./Col-a5f65985.js";import"./styleChecker-8552d8dc.js";import"./isPlainObject-28bd6686.js";import"./index-59052094.js";import"./updateLocale-bc84b8d6.js";import"./index-a14f73db.js";import"./toArray-7ead3702.js";import"./FormItemContext-2461cbab.js";import"./pickAttrs-5db0ba14.js";import"./lodash-93f7118d.js";import"./BaseSwitch.vue_vue_type_script_setup_true_lang-33c708c4.js";import"./index-634fb851.js";import"./isNumeric-3f69e2aa.js";import"./index-0555c827.js";import"./index-0259cd70.js";import"./textUtils-c37780ad.js";import"./DialogWrap-576e3f01.js";import"./index-23a87c32.js";import"./LeftOutlined-61414320.js";import"./css-aae66f86.js";import"./index-4208692b.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=>oe(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:o,error:v}=await A.from("channel_message").insert([e]).select();if(v)throw v;return o}async function G(e,o){const{data:v,error:k}=await A.from("channel_message").update(o).eq("id",e).select();if(k)throw k;return v}async function Se(e){const{error:o}=await A.from("channel_message").delete().eq("id",e);if(o)throw o}function Ce(e){let o=null;if(e.owner_id){const v=Array.isArray(e.users)?e.users[0]:e.users;v?o=`${v.first_name||""} ${v.last_name||""}`.trim()||v.phone||`کاربر ${e.owner_id}`:o=`کاربر ${e.owner_id}`}return{...e,owner_name:o,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 o={...e};!o.sort&&!o.order&&(o.order="-id");const{limit:v=20,page:k=1,search:S,filters:g}=o;let s=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);s=ce(s,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?s=s.in("owner_id",h):s=s.eq("owner_id","00000000-0000-0000-0000-000000000000")}continue}be.has(p.field)&&(s=de(s,p))}}s=fe(s,o,"-id"