import{r as p,j as a}from"./app-Bup04Qnx.js";import{c as n}from"./format-CisCU4Rs.js";import{W as u}from"./WithModal-CbKxT3eW.js";const k=({id:t,action:j,budget:x,form:m,handleSubmit:g})=>{const l=p.useRef(),{data:r,setData:b,processing:i}=m,{amount:o,payment_percentage:h}=r,d=x.paid_remaining_amount,c=d-o,e=c<0;return a.jsx(u,{type:t,backdrop:!0,modalBoxSize:"max-w-2xl",boxClassName:"modal-box scrollbar-thin overflow-auto",children:a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsx("h3",{className:"font-bold text-lg",children:"Konfirmasi Pengajuan Pembayaran"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-center my-2",children:[a.jsxs("div",{className:"p-4 rounded border bg-green-50 border-green-100",children:[a.jsx("div",{className:"text-2xl font-bold text-green-600",children:n(o)}),a.jsx("div",{className:"text-xs text-green-800",children:"Diajukan"}),a.jsxs("div",{className:"text-[10px] text-gray-500 mt-1",children:[h,"% dari Max ",n(d)]})]}),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:n(c)}),a.jsx("div",{className:`text-xs ${e?"text-red-800":"text-yellow-800"}`,children:"Sisa Dana"})]})]}),a.jsxs("div",{className:"form-control",children:[a.jsx("label",{className:"label",children:a.jsx("span",{className:"label-text font-semibold",children:"Catatan Pengajuan (Opsional)"})}),a.jsx("textarea",{className:"textarea textarea-bordered h-24",placeholder:"Tambahkan catatan untuk pengajuan ini...",value:r.note||"",onChange:s=>b("note",s.target.value)})]}),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 pembayaran atau sesuaikan anggaran."})]}),a.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"Apakah anda yakin ingin mengajukan permintaan pembayaran ini?"}),a.jsxs("div",{className:"modal-action",children:[a.jsx("label",{ref:l,htmlFor:`modal_${t}`,className:"btn btn-sm btn-ghost",children:"Batal"}),a.jsxs("button",{onClick:()=>g(()=>{var s;return(s=l.current)==null?void 0:s.click()}),className:"btn btn-sm btn-primary",disabled:i||e,children:[i&&a.jsx("span",{className:"loading loading-spinner loading-xs"}),"Ya, Ajukan"]})]})]})})};export{k as default};
