Files
nademitex_admin/dist/assets/BankAccountsView-CjjgU3ea.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
6.5 KiB
JavaScript

import{B as e,O as t,Ot as n,T as ee,V as r,Y as i,Z as a,c as o,d as s,g as te,h as c,j as l,l as u,m as d,r as f,s as p,t as m,u as h}from"./_plugin-vue_export-helper-OaxA6A2f.js";import{F as g,I as ne,K as re,N as _,R as v,W as y,c as b,h as ie,z as ae}from"./index-CXa4EMLW.js";import{t as oe}from"./BaseSwitch-TV5Yvtf7.js";import{t as se}from"./BaseEmptyState-BmO9aDcK.js";import{t as x}from"./ActiveSwitchCell-DJZQHZ-8.js";var ce={class:`accounts-page`},le={class:`admin-page-header`},ue={class:`admin-page-header__title`},de={key:1,class:`accounts-page__table admin-card desktop-only`},fe={class:`admin-table-wrap`},pe={class:`admin-table`},S={class:`status`},C={key:2,class:`compact-only admin-card-list`},w={class:`admin-card-item__header`},T={class:`admin-card-item__title`},E={class:`admin-card-item__meta`},D={key:0},O={key:1,dir:`ltr`},k={key:0,class:`admin-form__error`,role:`alert`},A={class:`admin-form__row`},j={class:`admin-form__field`},M={class:`admin-form__field`},N={class:`admin-form__field`},P={class:`admin-form__row`},F={class:`admin-form__field`},I={class:`admin-form__field`},L={class:`admin-form__field`},me=[`disabled`],R=m(te({__name:`BankAccountsView`,setup(te){let m=g(),R=ne(),z=ae(),B=a(null),V=a([]),H=a(!1),U=a(``),W=a(!1),G=p(()=>String(m.params.companyId)),K=p(()=>V.value),q=()=>({bankName:``,accountNumber:``,accountHolder:B.value?.name??``,cardNumber:``,iban:``,isActive:!0}),J=i(q()),Y=p(()=>J.bankName.trim().length>0&&J.accountNumber.trim().length>0&&J.accountHolder.trim().length>0);async function he(){try{let[e,t]=await Promise.all([ie.get(G.value),b.listByCompany(G.value)]);B.value=e,V.value=t}catch(e){z.error(e instanceof _?e.message:`بارگذاری حساب‌ها انجام نشد.`)}}ee(()=>{he()});function X(){Object.assign(J,q()),U.value=``,H.value=!0}function Z(){H.value=!1,U.value=``}async function Q(){if(!Y.value){U.value=`فیلدهای ستاره‌دار الزامی هستند.`;return}W.value=!0;try{let e=await b.create(G.value,{bankName:J.bankName.trim(),accountNumber:J.accountNumber.trim(),accountHolder:J.accountHolder.trim(),cardNumber:J.cardNumber.trim()||`-`,iban:J.iban.trim()||`-`,isActive:J.isActive,displayOrder:V.value.length+1});V.value.push(e),z.success(`حساب بانکی جدید ثبت شد.`),Z()}catch(e){z.error(e instanceof _?e.message:`ثبت حساب انجام نشد.`)}finally{W.value=!1}}async function $(e,t){await b.setActive(e,t)}function ge(){R.push(`/companies`)}return(ee,i)=>(t(),s(`div`,ce,[o(`div`,le,[o(`div`,null,[o(`h1`,ue,` مدیریت حساب‌های بانکی — `+n(B.value?.name??`…`),1)]),o(`div`,{class:`admin-action-group`},[o(`button`,{type:`button`,class:`admin-btn admin-btn--primary`,onClick:X},` افزودن حساب `),o(`button`,{type:`button`,class:`admin-btn admin-btn--outline admin-btn--sm`,onClick:ge},` بازگشت `)])]),K.value.length?(t(),s(`div`,de,[o(`div`,fe,[o(`table`,pe,[i[6]||=o(`thead`,null,[o(`tr`,null,[o(`th`,null,`بانک`),o(`th`,null,`حساب بانکی`),o(`th`,null,`نام صاحب`),o(`th`,null,`شماره کارت`),o(`th`,null,`شماره شبا`),o(`th`,{class:`status`},`وضعیت`)])],-1),o(`tbody`,null,[(t(!0),s(f,null,l(K.value,e=>(t(),s(`tr`,{key:e.id},[o(`td`,null,n(e.bankName),1),o(`td`,null,n(e.accountNumber),1),o(`td`,null,n(e.accountHolder),1),o(`td`,null,n(e.cardNumber||`—`),1),o(`td`,null,n(e.iban||`—`),1),o(`td`,S,[c(x,{id:e.id,modelValue:e.isActive,"onUpdate:modelValue":t=>e.isActive=t,"entity-name":e.bankName,"entity-type":`حساب بانکی`,persist:$},null,8,[`id`,`modelValue`,`onUpdate:modelValue`,`entity-name`])])]))),128))])])])])):(t(),u(se,{key:0,class:`admin-card`,icon:`wallet`,title:`حساب بانکی ثبت نشده`,description:`برای این شرکت هنوز حساب بانکی ثبت نشده است.`},{default:e(()=>[o(`button`,{type:`button`,class:`admin-btn admin-btn--primary admin-btn--sm`,onClick:X},` افزودن حساب `)]),_:1})),K.value.length?(t(),s(`div`,C,[(t(!0),s(f,null,l(K.value,e=>(t(),s(`article`,{key:e.id,class:`admin-card-item`},[o(`div`,w,[o(`p`,T,`بانک `+n(e.bankName),1),c(x,{id:e.id,modelValue:e.isActive,"onUpdate:modelValue":t=>e.isActive=t,"entity-name":e.bankName,"entity-type":`حساب بانکی`,persist:$},null,8,[`id`,`modelValue`,`onUpdate:modelValue`,`entity-name`])]),o(`div`,E,[o(`span`,null,n(e.accountHolder),1),o(`span`,null,`حساب: `+n(e.accountNumber),1),e.cardNumber?(t(),s(`span`,D,`کارت: `+n(e.cardNumber),1)):h(``,!0),e.iban?(t(),s(`span`,O,n(e.iban),1)):h(``,!0)])]))),128))])):h(``,!0),c(v,{open:H.value,title:`افزودن حساب بانکی`,size:`lg`,onClose:Z},{footer:e(()=>[o(`button`,{type:`button`,class:`admin-btn admin-btn--outline`,onClick:Z},` انصراف `),o(`button`,{type:`button`,class:`admin-btn admin-btn--primary`,disabled:!Y.value||W.value,onClick:Q},` ثبت حساب `,8,me)]),default:e(()=>[o(`form`,{class:`admin-form`,onSubmit:re(Q,[`prevent`])},[U.value?(t(),s(`p`,k,n(U.value),1)):h(``,!0),o(`div`,A,[o(`div`,j,[i[7]||=o(`label`,{for:`bank-name`},[d(`نام بانک `),o(`span`,{class:`admin-form__required`},`*`)],-1),r(o(`input`,{id:`bank-name`,"onUpdate:modelValue":i[0]||=e=>J.bankName=e,type:`text`,class:`admin-input`,placeholder:`مثال: ملت`},null,512),[[y,J.bankName]])]),o(`div`,M,[i[8]||=o(`label`,{for:`account-number`},[d(` شماره حساب `),o(`span`,{class:`admin-form__required`},`*`)],-1),r(o(`input`,{id:`account-number`,"onUpdate:modelValue":i[1]||=e=>J.accountNumber=e,type:`text`,class:`admin-input`,placeholder:`1234567890`,inputmode:`numeric`,dir:`ltr`},null,512),[[y,J.accountNumber]])])]),o(`div`,N,[i[9]||=o(`label`,{for:`account-holder`},[d(` نام صاحب حساب `),o(`span`,{class:`admin-form__required`},`*`)],-1),r(o(`input`,{id:`account-holder`,"onUpdate:modelValue":i[2]||=e=>J.accountHolder=e,type:`text`,class:`admin-input`},null,512),[[y,J.accountHolder]])]),o(`div`,P,[o(`div`,F,[i[10]||=o(`label`,{for:`card-number`},`شماره کارت`,-1),r(o(`input`,{id:`card-number`,"onUpdate:modelValue":i[3]||=e=>J.cardNumber=e,type:`text`,class:`admin-input`,placeholder:`6104 3378 0077 1234`,inputmode:`numeric`,dir:`ltr`},null,512),[[y,J.cardNumber]])]),o(`div`,I,[i[11]||=o(`label`,{for:`iban`},`شماره شبا`,-1),r(o(`input`,{id:`iban`,"onUpdate:modelValue":i[4]||=e=>J.iban=e,type:`text`,class:`admin-input`,placeholder:`IR...`,dir:`ltr`},null,512),[[y,J.iban]])])]),o(`div`,L,[c(oe,{modelValue:J.isActive,"onUpdate:modelValue":i[5]||=e=>J.isActive=e,label:`وضعیت`},null,8,[`modelValue`])])],32)]),_:1},8,[`open`])]))}}),[[`__scopeId`,`data-v-0011826b`]]);export{R as default};