2026-10-13 13:23:32 +03:30
|
|
|
import{_ as M}from"./BasicMainCard-e958eff9.js";import{_ as S}from"./BasicModal.vue_vue_type_style_index_0_lang-6969d1dc.js";import{_ as O,u as V}from"./useBaseTable-2f44456a.js";import{_ as U}from"./button.vue_vue_type_style_index_0_lang-c84b0596.js";import{I}from"./Icon-e9d21126.js";import{t as z}from"./useDataTime-c5fd0475.js";import{_ as L,I as N,J as j,K as J,d as q,i as g,E as H,o as K,c as F,e as r,w as s,b as d,f as G,L as Q,l as h,H as p}from"./index-88b436a3.js";import{_ as W}from"./TextPreview.vue_vue_type_script_setup_true_lang-cf9861d3.js";import{M as T}from"./index-801e70c1.js";import{I as X}from"./index-5b1d7174.js";import{T as b}from"./isSymbol-5adcf314.js";import"./Grid-3500d868.js";import"./index-3056cee8.js";import"./_plugin-vue_export-helper-0965689e.js";import"./shallowequal-a265b4c4.js";import"./index-70730f49.js";import"./vnode-4c3cf924.js";import"./index-608635af.js";import"./useState-89585daf.js";import"./useRefs-b589f2c4.js";import"./_flatRest-bfa472d2.js";import"./isMobile-e2e89480.js";import"./omit-c69ba12d.js";import"./index-ab792bfc.js";import"./Col-dbdf0e50.js";import"./styleChecker-e121d19f.js";import"./isPlainObject-6af67cf0.js";import"./index-77cb2497.js";import"./updateLocale-50b6b1dc.js";import"./index-371b21ab.js";import"./useMemo-9783b0bd.js";import"./FormItemContext-0dc63d45.js";import"./lodash-ff1cad4c.js";import"./BaseSwitch.vue_vue_type_script_setup_true_lang-8738a2db.js";import"./index-59dbbd66.js";import"./Badge-b5f795c2.js";import"./isNumeric-3f69e2aa.js";import"./index-e3b71aec.js";import"./index-6971af25.js";import"./index-4ad375f9.js";import"./DialogWrap-540d386d.js";import"./pickAttrs-fd92707c.js";import"./css-aae66f86.js";import"./index-7fdb0173.js";import"./toArray-20aa7010.js";import"./SearchOutlined-a51da12b.js";import"./index-4c23d157.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 N("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 J("comments",t)}async function te(t){const{TableEngineRequest:c}=await L(()=>import("./buildSupabaseQuery-073609fa.js"),["assets/buildSupabaseQuery-073609fa.js","assets/index-88b436a3.js","assets/index-ceed3b68.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=H(),m=g({owner_id:null,text:""});async function w(){var n;x
|