2026-09-24 20:14:11 +03:30
|
|
|
import{Ct as e,E as t,J as n,N as r,Q as i,V as a,Z as o,dt as s,et as c,it as l,lt as u,nt as d,st as f,yt as p,z as m}from"./index-B2VD3zy8.js";import{t as h}from"./AdminPageSkeleton-BJpm6oxf.js";import{t as g}from"./BaseEmptyState-DGu6Pfui.js";var _={class:`admin-page`},v={key:2,class:`admin-table`},y={class:`muted`,dir:`ltr`},b={class:`muted`,dir:`ltr`},x=[`onClick`],S=a(l({__name:`StockAlertsView`,setup(a){let l=p([]),S=p(!0),C=m();async function w(){S.value=!0;try{l.value=await t.list()}catch(e){C.error(e instanceof r?e.message:`بارگذاری ناموفق بود`)}finally{S.value=!1}}async function T(e){try{await t.notify(e),C.success(`اعلان موجودی ارسال شد`),await w()}catch(e){C.error(e instanceof r?e.message:`ارسال ناموفق بود`)}}return f(()=>{w()}),(t,r)=>(u(),c(`div`,_,[r[1]||=o(`header`,{class:`admin-page__head`},[o(`div`,null,[o(`h1`,null,`درخواست خبر موجودی`),o(`p`,null,`مشتریانی که برای محصول ناموجود درخواست اطلاع دادهاند`)])],-1),S.value?(u(),i(h,{key:0,variant:`table`})):l.value.length?(u(),c(`table`,v,[r[0]||=o(`thead`,null,[o(`tr`,null,[o(`th`,null,`مشتری`),o(`th`,null,`محصول`),o(`th`,null,`موجودی فعلی`),o(`th`)])],-1),o(`tbody`,null,[(u(!0),c(n,null,s(l.value,t=>(u(),c(`tr`,{key:t.id},[o(`td`,null,[d(e(t.customerName)+` `,1),o(`span`,y,e(t.customerPhone),1)]),o(`td`,null,[d(e(t.productName)+` `,1),o(`span`,b,`(`+e(t.productCode)+`)`,1)]),o(`td`,null,e(t.stock??`—`),1),o(`td`,null,[o(`button`,{type:`button`,class:`admin-btn admin-btn--primary admin-btn--sm`,onClick:e=>T(t.id)},`ارسال اعلان`,8,x)])]))),128))])])):(u(),i(g,{key:1,title:`درخواستی فعال نیست`}))]))}}),[[`__scopeId`,`data-v-61131544`]]);export{S as default};
|