2026-08-25 15:58:39 +03:30
|
|
|
import{_ as M}from"./BasicMainCard-858b87e5.js";import{_ as S}from"./BasicModal.vue_vue_type_style_index_0_lang-5e13aafb.js";import{_ as O,u as V}from"./useBaseTable-fbe43a97.js";import{_ as U}from"./button.vue_vue_type_style_index_0_lang-56e9b09f.js";import{I}from"./Icon-7c626614.js";import{t as z}from"./useDataTime-75033b2a.js";import{_ as N,H as j,I as J,J as L,d as q,i as g,D as G,o as H,c as K,e as r,w as s,b as d,f as F,K as Q,l as h,G as p}from"./index-864e73c5.js";import{_ as W}from"./TextPreview.vue_vue_type_script_setup_true_lang-bf05f802.js";import{M as T}from"./index-e0e66192.js";import{I as X}from"./index-7c172d43.js";import{T as b}from"./isSymbol-cbbd997a.js";import"./Grid-b4a61c99.js";import"./index-846ea911.js";import"./_plugin-vue_export-helper-a65526b0.js";import"./shallowequal-c06f2dba.js";import"./index-e8adaad2.js";import"./vnode-81e10d7c.js";import"./index-e764b6ae.js";import"./useState-85b22590.js";import"./useRefs-d7f22ed1.js";import"./_flatRest-2445814a.js";import"./isMobile-e2e89480.js";import"./omit-ab9263d6.js";import"./index-faaf1291.js";import"./Col-55712802.js";import"./styleChecker-4198f097.js";import"./isPlainObject-13142948.js";import"./index-bd9719ff.js";import"./updateLocale-71589e17.js";import"./index-69195e76.js";import"./useMemo-652a8e82.js";import"./FormItemContext-37273d98.js";import"./lodash-ba10e651.js";import"./BaseSwitch.vue_vue_type_script_setup_true_lang-781130e9.js";import"./index-974d8184.js";import"./Badge-7246b1a5.js";import"./isNumeric-3f69e2aa.js";import"./index-3799ba3b.js";import"./index-01d39c58.js";import"./index-b21b8492.js";import"./DialogWrap-8cebf5f4.js";import"./pickAttrs-bb0043f0.js";import"./css-aae66f86.js";import"./index-72f07d1b.js";import"./toArray-21522b5d.js";import"./SearchOutlined-8ea30c34.js";import"./index-07df2e8f.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 J("comments",t,c);return Array.isArray(o)?o:[o]}async function ee(t){await L("comments",t)}async function te(t){const{TableEngineRequest:c}=await N(()=>import("./buildSupabaseQuery-f6fdad41.js"),["assets/buildSupabaseQuery-f6fdad41.js","assets/index-864e73c5.js","assets/index-71a80eb0.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),at=q({__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=G(),m=g({owner_id:null,text:""});async function w(){var n;x
|