import{Dn as e,J as t,Kt as n,M as r,O as i,Q as a,Qt as o,R as s,Tn as c,Y as l,at as u,fr as d,i as f,it as p,o as m,or as h,r as g,st as _}from"./dist-CoD0k1Bd.js";import{t as v}from"./Label-DKn3cyeE.js";import{t as y}from"./arrow-left-GfHRP_1N.js";import{t as b}from"./Input-C3DwKNOf.js";import{t as x}from"./button-mN_poAXs.js";import{t as S}from"./routes-BZ4t1sNs.js";import{t as C}from"./Heading-CCd5Tysh.js";import{t as w}from"./InputError-BY5lDrFd.js";var T={class:`flex flex-col space-y-6`},E={class:`grid gap-2`},D=[`value`],O={class:`grid gap-4 sm:grid-cols-2`},k={class:`grid gap-2`},A={class:`grid gap-2`},j={class:`grid gap-2`},M=[`value`],N={class:`rounded-lg border bg-muted/30 p-4`},P={class:`flex items-center justify-between text-sm`},F={class:`text-lg font-bold tabular-nums`},I={class:`flex justify-end gap-2`},L=_({layout:{breadcrumbs:[{title:`Dashboard`,href:S()},{title:`Billing`,href:`/billings`},{title:`Edit`,href:`/billings`}]},__name:`Edit`,props:{billing:{},banks:{},users:{}},setup(_){let S=_,L=m({jumlah_credit:S.billing.jumlah_credit,rate:S.billing.rate,bank_id:S.billing.bank_id??``,user_id:S.billing.user_id,payment_method:S.billing.payment_method}),R=t(()=>L.jumlah_credit*L.rate),z=()=>L.put(`/billings/${S.billing.id}`);return(t,m)=>(n(),a(s,null,[u(h(g),{title:`Edit Invoice`}),l(`div`,T,[l(`div`,null,[u(h(x),{"as-child":``,variant:`ghost`,size:`sm`,class:`mb-2`},{default:c(()=>[u(h(f),{href:`/billings`},{default:c(()=>[u(h(y),{class:`size-4`}),m[4]||=p(` Kembali`,-1)]),_:1})]),_:1}),u(C,{title:`Edit Invoice ${S.billing.no_invoice}`,description:`Ubah invoice (hanya saat Pending)`},null,8,[`title`])]),l(`form`,{onSubmit:r(z,[`prevent`]),class:`max-w-2xl space-y-6`},[l(`div`,E,[u(h(v),{for:`user_id`},{default:c(()=>[...m[5]||=[p(`Pengguna `,-1),l(`span`,{class:`text-destructive`},`*`,-1)]]),_:1}),e(l(`select`,{id:`user_id`,"onUpdate:modelValue":m[0]||=e=>h(L).user_id=e,required:``,class:`mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm`},[(n(!0),a(s,null,o(S.users,e=>(n(),a(`option`,{key:e.id,value:e.id},d(e.name)+` (`+d(e.email)+`)`,9,D))),128))],512),[[i,h(L).user_id]]),u(w,{message:h(L).errors.user_id},null,8,[`message`])]),l(`div`,O,[l(`div`,k,[u(h(v),{for:`jumlah_credit`},{default:c(()=>[...m[6]||=[p(`Jumlah Credit `,-1),l(`span`,{class:`text-destructive`},`*`,-1)]]),_:1}),u(h(b),{id:`jumlah_credit`,type:`number`,modelValue:h(L).jumlah_credit,"onUpdate:modelValue":m[1]||=e=>h(L).jumlah_credit=e,min:`1`,required:``},null,8,[`modelValue`]),u(w,{message:h(L).errors.jumlah_credit},null,8,[`message`])]),l(`div`,A,[u(h(v),{for:`rate`},{default:c(()=>[...m[7]||=[p(`Rate (Rp/credit) `,-1),l(`span`,{class:`text-destructive`},`*`,-1)]]),_:1}),u(h(b),{id:`rate`,type:`number`,modelValue:h(L).rate,"onUpdate:modelValue":m[2]||=e=>h(L).rate=e,min:`1`,required:``},null,8,[`modelValue`]),u(w,{message:h(L).errors.rate},null,8,[`message`])])]),l(`div`,j,[u(h(v),{for:`bank_id`},{default:c(()=>[...m[8]||=[p(`Bank Tujuan`,-1)]]),_:1}),e(l(`select`,{id:`bank_id`,"onUpdate:modelValue":m[3]||=e=>h(L).bank_id=e,class:`mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm`},[m[9]||=l(`option`,{value:``},`— Pilih Bank —`,-1),(n(!0),a(s,null,o(S.banks,e=>(n(),a(`option`,{key:e.id,value:e.id},d(e.kode)+` — `+d(e.keterangan),9,M))),128))],512),[[i,h(L).bank_id]]),u(w,{message:h(L).errors.bank_id},null,8,[`message`])]),l(`div`,N,[l(`div`,P,[m[10]||=l(`span`,{class:`text-muted-foreground`},`Total Pembayaran`,-1),l(`span`,F,`Rp `+d(R.value.toLocaleString(`id-ID`)),1)])]),l(`div`,I,[u(h(x),{"as-child":``,variant:`outline`,type:`button`},{default:c(()=>[u(h(f),{href:`/billings`},{default:c(()=>[...m[11]||=[p(`Batal`,-1)]]),_:1})]),_:1}),u(h(x),{type:`submit`,disabled:h(L).processing},{default:c(()=>[...m[12]||=[p(`Simpan`,-1)]]),_:1},8,[`disabled`])])],32)])],64))}});export{L as default};