Files
nademitex_admin/dist/assets/SuggestionsView-SvmEopB3.js
T
mohmdsdgandCopilot 981f4fdaf9 build: refresh admin production assets
Publish the verified admin build output.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-24 20:16:16 +03:30

1 line
3.3 KiB
JavaScript

import{B as e,O as t,Ot as n,T as r,V as i,Y as a,Z as o,c as s,d as c,g as l,h as u,j as d,l as f,m as p,r as m,s as h,t as g}from"./_plugin-vue_export-helper-OaxA6A2f.js";import{D as _,N as v,R as y,S as b,W as x,g as S,z as C}from"./index-CXa4EMLW.js";import{t as w}from"./AdminPageSkeleton-CTgUqaAu.js";import{t as T}from"./BaseEmptyState-BmO9aDcK.js";import{t as E}from"./AdminSelect-9UfEJQzN.js";var D={class:`admin-page`},O={class:`admin-page__head`},k={key:2,class:`admin-table`},A={class:`muted`,dir:`ltr`},j=[`onClick`],M={class:`field`},N={class:`field`},P={class:`field`},F=[`disabled`],I=g(l({__name:`SuggestionsView`,setup(l){let g=o([]),I=o(!0),L=o([]),R=o([]),z=o(!1),B=C(),V=a({customerId:``,productId:``,note:``}),H=h(()=>L.value.map(e=>({value:e.id,label:e.name?.trim()||e.phone}))),U=h(()=>R.value.map(e=>({value:e.id,label:`${e.name} (${e.productCode})`})));async function W(){I.value=!0;try{let[e,t,n]=await Promise.all([_.list(),S.list(),b.list()]);g.value=e,L.value=t,R.value=n}catch(e){B.error(e instanceof v?e.message:`بارگذاری ناموفق بود`)}finally{I.value=!1}}async function G(){try{await _.create({customerId:V.customerId,productId:V.productId,note:V.note.trim()||void 0}),z.value=!1,V.note=``,B.success(`پیشنهاد ثبت شد`),await W()}catch(e){B.error(e instanceof v?e.message:`ثبت ناموفق بود`)}}async function K(e){try{await _.setActive(e.id,!e.isActive),await W()}catch(e){B.error(e instanceof v?e.message:`به‌روزرسانی ناموفق بود`)}}return r(()=>{W()}),(r,a)=>(t(),c(`div`,D,[s(`header`,O,[a[5]||=s(`div`,null,[s(`h1`,null,`پیشنهاد محصول`),s(`p`,null,`پیشنهاد دستی محصول به مشتری`)],-1),s(`button`,{type:`button`,class:`admin-btn admin-btn--primary`,onClick:a[0]||=e=>z.value=!0},`پیشنهاد جدید`)]),I.value?(t(),f(w,{key:0,variant:`table`})):g.value.length?(t(),c(`table`,k,[a[6]||=s(`thead`,null,[s(`tr`,null,[s(`th`,null,`مشتری`),s(`th`,null,`محصول`),s(`th`,null,`یادداشت`),s(`th`,null,`وضعیت`),s(`th`)])],-1),s(`tbody`,null,[(t(!0),c(m,null,d(g.value,e=>(t(),c(`tr`,{key:e.id},[s(`td`,null,n(e.customerName),1),s(`td`,null,[p(n(e.productName)+` `,1),s(`span`,A,`(`+n(e.productCode)+`)`,1)]),s(`td`,null,n(e.note||`—`),1),s(`td`,null,n(e.isActive?`فعال`:`غیرفعال`),1),s(`td`,null,[s(`button`,{type:`button`,class:`link`,onClick:t=>K(e)},n(e.isActive?`غیرفعال`:`فعال`),9,j)])]))),128))])])):(t(),f(T,{key:1,title:`پیشنهادی ثبت نشده`})),u(y,{open:z.value,title:`پیشنهاد محصول`,onClose:a[4]||=e=>z.value=!1},{footer:e(()=>[s(`button`,{type:`button`,class:`admin-btn admin-btn--primary`,disabled:!V.customerId||!V.productId,onClick:G},` ثبت `,8,F)]),default:e(()=>[s(`label`,M,[a[7]||=p(`مشتری `,-1),u(E,{modelValue:V.customerId,"onUpdate:modelValue":a[1]||=e=>V.customerId=e,options:H.value},null,8,[`modelValue`,`options`])]),s(`label`,N,[a[8]||=p(`محصول `,-1),u(E,{modelValue:V.productId,"onUpdate:modelValue":a[2]||=e=>V.productId=e,options:U.value},null,8,[`modelValue`,`options`])]),s(`label`,P,[a[9]||=p(`یادداشت`,-1),i(s(`textarea`,{"onUpdate:modelValue":a[3]||=e=>V.note=e,class:`admin-input`,rows:`3`},null,512),[[x,V.note]])])]),_:1},8,[`open`])]))}}),[[`__scopeId`,`data-v-56e3e728`]]);export{I as default};