import{r as g,j as a}from"./app-Bup04Qnx.js";import{c as o}from"./format-CisCU4Rs.js";import{W as b}from"./WithModal-CbKxT3eW.js";const N=({id:t,action:h,budget:c,form:x,handleSubmit:m})=>{const r=g.useRef(),{data:s,processing:n}=x,{amount:i}=s,d=c.paid_remaining_amount-i,e=d<0;return a.jsx(b,{type:t,backdrop:!0,modalBoxSize:"max-w-2xl",children:a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsx("h3",{className:"font-bold text-lg",children:"Konfirmasi Purchase Order"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-center my-2",children:[a.jsxs("div",{className:"p-4 rounded border bg-indigo-50 border-indigo-100",children:[a.jsx("div",{className:"text-2xl font-bold text-indigo-600",children:o(i)}),a.jsx("div",{className:"text-xs text-indigo-800",children:"Total PO"})]}),a.jsxs("div",{className:`p-4 rounded border ${e?"bg-red-50 border-red-200":"bg-yellow-50 border-yellow-100"}`,children:[a.jsx("div",{className:`text-2xl font-bold ${e?"text-red-600":"text-yellow-600"}`,children:o(d)}),a.jsx("div",{className:`text-xs ${e?"text-red-800":"text-yellow-800"}`,children:"Sisa Dana Setelah PO"})]})]}),a.jsxs("div",{className:"p-3 rounded-lg border bg-gray-50 border-gray-200",children:[a.jsx("div",{className:"text-xs uppercase text-gray-400 font-bold tracking-wider mb-1",children:"Realisasi Detail Anggaran"}),a.jsx("div",{className:"font-semibold text-gray-800",children:s.name}),s.description&&a.jsx("div",{className:"text-xs text-gray-500 mt-0.5",children:s.description})]}),e&&a.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-red-50 border border-red-200 text-red-700 text-sm",children:[a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 shrink-0 mt-0.5",viewBox:"0 0 20 20",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),a.jsx("span",{children:"Sisa anggaran tidak boleh minus. Silakan kurangi nilai PO atau sesuaikan anggaran."})]}),a.jsx("p",{className:"text-sm text-gray-500",children:"Purchase Order ini akan diajukan dan permintaan pembayaran akan otomatis dibuat. Apakah anda yakin?"}),a.jsxs("div",{className:"modal-action",children:[a.jsx("label",{ref:r,htmlFor:`modal_${t}`,className:"btn btn-sm btn-ghost",children:"Batal"}),a.jsxs("button",{onClick:()=>m(()=>{var l;return(l=r.current)==null?void 0:l.click()}),className:"btn btn-sm btn-primary",disabled:n||e,children:[n&&a.jsx("span",{className:"loading loading-spinner loading-xs"}),"Ya, Ajukan PO"]})]})]})})};export{N as default};
