Files

2 lines
7.0 KiB
JavaScript
Raw Permalink Normal View History

2026-10-20 16:52:05 +03:30
import{_ as M}from"./BasicMainCard-33e38576.js";import{_ as O}from"./BasicModal.vue_vue_type_style_index_0_lang-aed8f5e4.js";import{_ as S,u as V}from"./useBaseTable-e7a67916.js";import{_ as U}from"./button.vue_vue_type_style_index_0_lang-f90e25b2.js";import{I}from"./Icon-29e38d16.js";import{t as z}from"./useDataTime-6e234adb.js";import{_ as N,O as j,P as L,Q as q,d as H,i as g,E as J,o as Q,c as F,e as r,w as s,b as d,f as G,R as K,l as h,H as p}from"./index-1ba0f9ec.js";import{_ as W}from"./TextPreview.vue_vue_type_script_setup_true_lang-c3abc1fa.js";import{M as T}from"./index-ec322234.js";import{I as X}from"./index-aafc0fe2.js";import{T as b}from"./isSymbol-355a1404.js";import"./Grid-660f1a55.js";import"./index-f22a4554.js";import"./_plugin-vue_export-helper-31e07528.js";import"./shallowequal-e0d9eafb.js";import"./index-3f6d5caa.js";import"./vnode-c4e67237.js";import"./index-73cafb1e.js";import"./useState-dcd360f8.js";import"./useRefs-5e33302c.js";import"./_flatRest-7877cdf8.js";import"./isMobile-e2e89480.js";import"./omit-f5d28cd3.js";import"./index-c136a321.js";import"./Col-f8806a10.js";import"./styleChecker-19ce40ea.js";import"./isPlainObject-e945bc1f.js";import"./index-4bff02a6.js";import"./updateLocale-a8654270.js";import"./index-8f2b7e91.js";import"./useMemo-ee45fb46.js";import"./FormItemContext-33ef1221.js";import"./lodash-27f814e6.js";import"./BaseSwitch.vue_vue_type_script_setup_true_lang-36a1ea6e.js";import"./index-c8127d4e.js";import"./Badge-8a8eeb58.js";import"./isNumeric-3f69e2aa.js";import"./index-a8579634.js";import"./index-e22339b6.js";import"./index-876da578.js";import"./LeftOutlined-93011b30.js";import"./css-aae66f86.js";import"./DialogWrap-394d7eb0.js";import"./pickAttrs-0ddf9a54.js";import"./index-e0664925.js";import"./toArray-41940180.js";import"./SearchOutlined-95278fe5.js";import"./index-175b83cf.js";import"./textUtils-c37780ad.js";const Y=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:t=>t.record.index+1},{title:"نام کاربر",dataIndex:"owner_id",key:"owner_id",customRender:t=>t.record.owner_name||t.record.owner_id||"-"},{title:"متن نظر یا ایده",dataIndex:"text",key:"text",slot:"text"},{title:"زمان ایجاد",dataIndex:"created_at",key:"created_at",customRender:t=>z(t.record.created_at)},{title:"عملیات",dataIndex:"action",key:"action",slot:"action",filterable:!1,align:"center"},{title:"پین شده",dataIndex:"pined",key:"pined",type:"Boolean",filterable:!0,show:!1}];async function Z(t){const c=await j("comments",t);return Array.isArray(c)?c:[c]}async function A(t,c){const o=await L("comments",t,c);return Array.isArray(o)?o:[o]}async function ee(t){await q("comments",t)}async function te(t){const{TableEngineRequest:c}=await N(()=>import("./buildSupabaseQuery-2323f568.js"),["assets/buildSupabaseQuery-2323f568.js","assets/index-1ba0f9ec.js","assets/index-cb402307.css"]),o={...t};!o.sort&&!o.order&&(o.order="-id"),o.select=["*","users!owner_id(first_name, last_name, phone)"];const l=await c(o,"comments");try{if(Array.isArray(l==null?void 0:l.rows)){const y=o.page||1,_=o.limit||200,x=(y-1)*_,v=l.rows.map((e,m)=>{let w=null;if(e.owner_id){const f=Array.isArray(e.users)?e.users[0]:e.users;f?w=`${f.first_name||""} ${f.last_name||""}`.trim()||f.phone||`کاربر ${e.owner_id}`:w=`کاربر ${e.owner_id}`}return{id:e.id,owner_id:e.owner_id??null,owner_name:w,text:e.text??"",created_at:e.created_at??"",updated_at:e.updated_at??"",index:x+m,...e}});return{...l,rows:v}}}catch(y){console.log("[getCommentsTable] normalize error:",y)}return l}const ne={class:"flex justify-between items-center mb-4"},oe=d("h2",null,"ایده و نظرات",-1),ae={class:"gap-2 flex justify-center"},re=d("span",null,"پین کردن",-1),ie=d("span",null,"حذف",-1),se=d("span",null,"ویرایش",-1),le={class:"space-y-4"},ce=d("div",{class:"mb-1 text-sm text-gray-600"},"متن پیام *",-1),rt=H({__name:"index",setup(t){const{TextArea:c}=X,[o,l]=V(),y=g({columns:Y,api:te,defaultPageLimit:20}),_=g(!1),x=g(!1),v=g(null),e=J(),m=g({owner_id:null,t