var u=(f,r,a)=>new Promise((o,i)=>{var c=t=>{try{e(a.next(t))}catch(m){i(m)}},s=t=>{try{e(a.throw(t))}catch(m){i(m)}},e=t=>t.done?o(t.value):Promise.resolve(t.value).then(c,s);e((a=a.apply(f,r)).next())});import{u as p}from"./useCreateDrawer-JEzOVO6Z.js";import{b6 as l}from"./bootstrap-Bqxdt4iG.js";import{u as d}from"./data-refresh-BZ1_-6mk.js";import{u as v}from"./invoices-BFW1CUIx.js";import{_}from"./invoice-detail-item-form.vue_vue_type_script_setup_true_lang-0N_0V4uI.js";import{a1 as D,L as x,ai as w,aj as S,ak as h,p as g,a9 as n}from"../jse/index-index-BUJ_4tQs.js";const $=D({__name:"invoice-detail-item-create-drawer",setup(f){const r=v(),a=d(),o=x(""),{Drawer:i,formRef:c,handleSubmit:s}=p({createApi:e=>u(null,null,function*(){const t=yield r.getDetails(o.value);return r.addDetail(o.value,e,t.length)}),invalidateData:()=>a.invalidateInvoices(),title:l("page.invoices.itemDrawer.addTitle"),processOpenData:e=>{e!=null&&e.invoiceId&&(o.value=e.invoiceId)},onClosed:()=>{o.value=""}});return(e,t)=>(S(),w(n(i),{class:"w-[520px]","confirm-text":n(l)("page.common.add"),"cancel-text":n(l)("page.common.cancel")},{default:h(()=>[g(_,{ref_key:"formRef",ref:c,mode:"create",onSubmit:n(s)},null,8,["onSubmit"])]),_:1},8,["confirm-text","cancel-text"]))}});export{$ as _};
