Files
nademitex_admin/dist/assets/CashPaymentsView-9GpSAf0g.js
T

1 line
5.1 KiB
JavaScript
Raw Normal View History

2026-09-10 16:25:53 +03:30
import{A as e,At as t,I as n,K as r,N as i,Nt as a,a as o,b as s,c,f as l,g as u,h as d,m as f,nt as p,o as m,p as h,t as g,ut as _,x as v}from"./http-WTIyGIuL.js";import{N as ee,P as te,V as y,d as b,i as x,n as S}from"./index-BbGQn55F.js";import{t as C}from"./AdminPageSkeleton-D-u-8bBz.js";import{t as w}from"./AdminSelect-gh27rAsd.js";import{n as T,t as E}from"./adminLabels-Cz9ccm1Z.js";var ne={class:`cash-payments-page`},re={class:`cash-payments-page__filters admin-card`},D={class:`cash-payments-page__search`},O={class:`cash-payments-page__table admin-card desktop-only`},k={class:`admin-table-wrap`},A={class:`admin-table`},j={dir:`ltr`},M={key:0,class:`admin-action-group`},N=[`disabled`,`onClick`],P=[`disabled`,`onClick`],F={key:1},I={class:`compact-only admin-card-list`},L={class:`admin-card-item__header`},R={class:`admin-card-item__title`},z={class:`admin-card-item__meta`},B={key:0},V={dir:`ltr`},H={key:0,class:`admin-card-item__actions`},U=[`disabled`,`onClick`],W=[`disabled`,`onClick`],G=m(v({__name:`CashPaymentsView`,setup(m){let v=te(),G=p([]),K=p(v.query.order??``),q=p(`all`),J=p(!0),Y=o(),X=p(null),ie=[{value:`all`,label:`همه وضعیت‌ها`},{value:`pending_review`,label:`در انتظار تأیید`},{value:`approved`,label:`تأیید شده`},{value:`rejected`,label:`رد شده`},{value:`expired`,label:`منقضی‌شده`}],Z=l(()=>{let e=G.value;q.value!==`all`&&(e=e.filter(e=>e.status===q.value));let t=K.value.trim();return t&&(e=e.filter(e=>e.orderNumber.includes(t)||e.customerName.includes(t)||e.trackingCode.includes(t))),e});async function ae(){J.value=!0;try{G.value=await b.list()}catch(e){Y.error(e instanceof g?e.message:`بارگذاری پرداخت‌ها انجام نشد.`)}finally{J.value=!1}}e(()=>{ae()});async function Q(e){X.value=e.id;try{let t=await b.updateStatus(e.id,{status:`approved`}),n=G.value.findIndex(t=>t.id===e.id);n!==-1&&(G.value[n]={...G.value[n],...t}),Y.success(`پرداخت سفارش ${e.orderNumber} تأیید شد.`)}catch(e){Y.error(e instanceof g?e.message:`تأیید پرداخت انجام نشد.`)}finally{X.value=null}}async function $(e){X.value=e.id;try{let t=await b.updateStatus(e.id,{status:`rejected`}),n=G.value.findIndex(t=>t.id===e.id);n!==-1&&(G.value[n]={...G.value[n],...t}),Y.warning(`پرداخت سفارش ${e.orderNumber} رد شد.`)}catch(e){Y.error(e instanceof g?e.message:`رد پرداخت انجام نشد.`)}finally{X.value=null}}return(e,o)=>(i(),u(`div`,ne,[o[3]||=h(`div`,{class:`admin-page-header`},[h(`div`,null,[h(`h1`,{class:`admin-page-header__title`},`پرداخت‌های نقدی`)])],-1),h(`div`,re,[h(`div`,D,[s(ee,{name:`search`,size:18}),r(h(`input`,{"onUpdate:modelValue":o[0]||=e=>K.value=e,type:`search`,class:`cash-payments-page__search-input`,placeholder:`جستجو در شماره سفارش، مشتری، پیگیری...`},null,512),[[y,K.value]])]),s(w,{modelValue:q.value,"onUpdate:modelValue":o[1]||=e=>q.value=e,class:`cash-payments-page__status-select`,"aria-label":`فیلتر وضعیت پرداخت`,options:ie},null,8,[`modelValue`])]),J.value?(i(),f(C,{key:0,variant:`table`})):(i(),u(c,{key:1},[h(`div`,O,[h(`div`,k,[h(`table`,A,[o[2]||=h(`thead`,null,[h(`tr`,null,[h(`th`,null,`شماره سفارش`),h(`th`,null,`مشتری`),h(`th`,null,`مبلغ فاکتور`),h(`th`,null,`مبلغ واریزی`),h(`th`,null,`تاریخ واریز`),h(`th`,null,`شماره پیگیری`),h(`th`,null,`پایان اعتبار`),h(`th`,null,`وضعیت`),h(`th`,null,`عملیات`)])],-1),h(`tbody`,null,[(i(!0),u(c,null,n(Z.value,e=>(i(),u(`tr`,{key:e.id},[h(`td`,null,a(e.orderNumber),1),h(`td`,null,a(e.customerName),1),h(`td`,null,a(_(S)(e.amount)),1),h(`td`,null,a(e.paidAmount?_(S)(e.paidAmount):`—`),1),h(`td`,null,a(e.transferDate?_(x)(e.transferDate):`—`),1),h(`td`,j,a(e.trackingCode),1),h(`td`,null,a(_(x)(e.expiresAt)),1),h(`td`,null,[h(`span`,{class:t([`admin-badge`,_(E)[e.status]])},a(_(T)[e.status]),3)]),h(`td`,null,[e.status===`pending_review`?(i(),u(`div`,M,[h(`button`,{type:`button`,class:`admin-btn admin-btn--out