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

2 lines
11 KiB
JavaScript
Raw Normal View History

2026-07-22 17:08:59 +03:30
import{_ as Z}from"./BasicMainCard-abd17be1.js";import{_ as ee}from"./BasicModal.vue_vue_type_style_index_0_lang-a23efd75.js";import{_ as te,u as ae}from"./useBaseTable-eabb6e73.js";import{_ as ne}from"./button.vue_vue_type_style_index_0_lang-58c562e7.js";import{I as B}from"./Icon-2ca0951c.js";import{t as oe}from"./useDataTime-a9a38277.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-02897754.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-e34e81a4.js";import{_ as _e}from"./TextPreview.vue_vue_type_script_setup_true_lang-c7e75dc6.js";import{e as ve,g as he}from"./convert-2ad76038.js";import{M as z}from"./index-4652c849.js";import{C as xe}from"./index-4cf251d4.js";import{I as ge}from"./index-b0c72faa.js";import{T as q}from"./isSymbol-792a2a97.js";import{U as ye}from"./index-fd46be7d.js";import"./index-c1d1bf6d.js";import"./index-9f87c1a7.js";import"./_plugin-vue_export-helper-2dea18d7.js";import"./useState-4419625c.js";import"./vnode-65917850.js";import"./useRefs-44db43e1.js";import"./_flatRest-bac800e2.js";import"./index-a2c53d90.js";import"./Col-880c700f.js";import"./styleChecker-ce90d19e.js";import"./isPlainObject-6a522913.js";import"./index-644e91ea.js";import"./updateLocale-ed1a4c67.js";import"./index-1d9cca6c.js";import"./toArray-b84867a5.js";import"./FormItemContext-0ec501fb.js";import"./pickAttrs-66d27c5c.js";import"./lodash-f280de5a.js";import"./BaseSwitch.vue_vue_type_script_setup_true_lang-2e8a6602.js";import"./index-9a9a9cd2.js";import"./isNumeric-3f69e2aa.js";import"./index-f459a9b9.js";import"./index-066e71ee.js";import"./textUtils-c37780ad.js";import"./DialogWrap-b41f46aa.js";import"./index-834ba08a.js";import"./LeftOutlined-0f3263d7.js";import"./css-aae66f86.js";import"./index-a571a3ce.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"