2 lines
7.0 KiB
JavaScript
2 lines
7.0 KiB
JavaScript
import{_ as M}from"./BasicMainCard-e8fae2e0.js";import{_ as S}from"./BasicModal.vue_vue_type_style_index_0_lang-f76fec1b.js";import{_ as O,u as V}from"./useBaseTable-45427402.js";import{_ as U}from"./button.vue_vue_type_style_index_0_lang-e7cef717.js";import{I}from"./Icon-b8613529.js";import{t as z}from"./useDataTime-7db5a46b.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-166b4ef1.js";import{_ as W}from"./TextPreview.vue_vue_type_script_setup_true_lang-a779e657.js";import{M as T}from"./index-58b86fb2.js";import{I as X}from"./index-7005b758.js";import{T as b}from"./isSymbol-c953ccc2.js";import"./Grid-47180f92.js";import"./index-366f722a.js";import"./_plugin-vue_export-helper-e5be29c6.js";import"./shallowequal-78a96afc.js";import"./index-7f046693.js";import"./vnode-c85f1a09.js";import"./index-011e0893.js";import"./useState-43a565ec.js";import"./useRefs-ca4d56b6.js";import"./_flatRest-ae97161b.js";import"./isMobile-e2e89480.js";import"./omit-55909a9d.js";import"./index-b6f0378e.js";import"./Col-6dc2da7a.js";import"./styleChecker-2eddf97d.js";import"./isPlainObject-ed4c9976.js";import"./index-de862045.js";import"./updateLocale-6eb93789.js";import"./index-08810a1f.js";import"./useMemo-99a24173.js";import"./FormItemContext-0e89b3aa.js";import"./lodash-593efeb6.js";import"./BaseSwitch.vue_vue_type_script_setup_true_lang-6e462f47.js";import"./index-8bcb6210.js";import"./Badge-a3c7a3a7.js";import"./isNumeric-3f69e2aa.js";import"./index-ad625a72.js";import"./index-1465c5c8.js";import"./index-75be736e.js";import"./DialogWrap-88ddfe3e.js";import"./pickAttrs-5cd7ef1f.js";import"./css-aae66f86.js";import"./index-3ad11dd3.js";import"./toArray-cf38ce67.js";import"./SearchOutlined-3d6399d7.js";import"./index-991e4e35.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-ef077dbd.js"),["assets/buildSupabaseQuery-ef077dbd.js","assets/index-166b4ef1.js","assets/index-0643191e.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
|