2026-09-16 13:19:24 +03:30
|
|
|
import{_ as U}from"./BasicMainCard-f6ac62ad.js";import{_ as E}from"./BasicModal.vue_vue_type_style_index_0_lang-00ba9225.js";import{_ as N}from"./BasicInput.vue_vue_type_style_index_0_lang-a177b9a9.js";import{_ as L,u as P}from"./useBaseTable-ec30a97d.js";import{_ as V}from"./button.vue_vue_type_style_index_0_lang-ad893796.js";import{I as h}from"./Icon-84f282a9.js";import{e as j,u as A,f as O,h as G}from"./support-f42bd432.js";import{M as K}from"./index-276e15c5.js";import{T as z}from"./updateLocale-4d53ac7e.js";import{C as H}from"./index-750d03f7.js";import{I as J}from"./index-0db924de.js";import{d as Q,i as c,h as W,p as X,o as Y,c as Z,e,w as s,b as o,f as u,K as tt,l as r,t as et,G as p}from"./index-01aa5506.js";import{T as k}from"./isSymbol-89eeb898.js";import{I as ot}from"./index-77ffc3c7.js";import"./Grid-7825d16a.js";import"./index-d4ed5db7.js";import"./_plugin-vue_export-helper-2f0b925e.js";import"./shallowequal-a983431a.js";import"./index-fb8c26e7.js";import"./vnode-386fab8b.js";import"./index-54bdc419.js";import"./useState-074ca9f0.js";import"./useRefs-a26b26b0.js";import"./_flatRest-b81e40db.js";import"./isMobile-e2e89480.js";import"./omit-8a7495a3.js";import"./index-1c2d185c.js";import"./Col-42eabc6c.js";import"./styleChecker-4d07c514.js";import"./isPlainObject-838e96ea.js";import"./index-3370fde6.js";import"./usePrice-bc935b83.js";import"./index-97e46aab.js";import"./useMemo-83211a3c.js";import"./FormItemContext-45e1fa89.js";import"./lodash-0f373afd.js";import"./BaseSwitch.vue_vue_type_script_setup_true_lang-b0105976.js";import"./index-64f7c585.js";import"./Badge-f9f962a5.js";import"./isNumeric-3f69e2aa.js";import"./index-40e1be26.js";import"./index-b91244f4.js";import"./toArray-e14b288d.js";import"./SearchOutlined-dadd531e.js";import"./pickAttrs-841f485e.js";import"./index-e013b18a.js";import"./adminDb-ea1a4f44.js";import"./pushNotification-d5decfb6.js";import"./DialogWrap-784b5f45.js";import"./index-01db740f.js";import"./css-aae66f86.js";const it=[{title:"ردیف",dataIndex:"id",key:"id",filterable:!1,width:70,align:"center",customRender:f=>f.record.index+1},{title:"سوال",dataIndex:"question",key:"question",width:280},{title:"ترتیب",dataIndex:"sort_order",key:"sort_order",width:90,align:"center"},{title:"وضعیت",dataIndex:"is_active",key:"is_active",width:100,align:"center",slot:"is_active",filterable:!1},{title:"عملیات",dataIndex:"action",key:"action",width:120,align:"center",slot:"action",filterable:!1}],st={class:"flex justify-between items-center mb-4 gap-3 flex-wrap"},at=o("div",null,[o("h2",{class:"text-lg font-bold"},"سوالات متداول"),o("p",{class:"text-sm text-gray-500 mt-1"},"این سوالات قبل از ورود به چت در اپ کاربر نمایش داده میشوند.")],-1),nt={class:"flex gap-2"},rt={class:"gap-2 flex justify-center"},lt=o("span",null,"ویرایش",-1),ct=o("span",null,"حذف",-1),ut={class:"space-y-4"},pt=o("div",{class:"mb-1 text-sm text-gray-600"},"سوال *",-1),mt=o("div",{class:"mb-1 text-sm text-gray-600"},"پاسخ *",-1),dt={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},_t=o("div",{class:"mb-1 text-sm text-gray-600"},"ترتیب نمایش",-1),ft={class:"flex items-end"},de=Q({__name:"index",setup(f){const{TextArea:b}=J,y=c(),l=c(!1),m=c(!1),d=c(null),t=W({question:"",answer:"",sort_order:0,is_active:!0}),[q,v]=P(),T=c({columns:it,api:j,defaultPageLimit:20});function x(){t.question="",t.answer="",t.sort_order=0,t.is_active=!0,d.value=null}function C(){m.value=!1,x(),l.value=!0}function I(n){m.value=!0,d.value=n.id,t.question=n.question||"",t.answer=n.answer||"",t.sort_order=n.sort_order??0,t.is_active=n.is_active!==!1,l.value=!0}function g(){l.value=!1,x()}async function B(){if(!t.question.trim()||!t.answer.trim()){p.error("سوال و پاسخ الزامی است");return}try{m.value&&d.value!=null?(await A(d.value,{...t}),p.success("سوال با موفقیت ویرایش شد")):(await O({...t}),p.success("سوال با موفقیت ثبت شد")),g(),await v()}catch{p.error("خطا در ذخیره سوال")}}func
|