import{q as u,r as j,j as a}from"./app-Bup04Qnx.js";import{c as l}from"./format-CisCU4Rs.js";import{W as N}from"./WithModal-CbKxT3eW.js";const k=({id:n,action:d,remaining:m,form:x,handleSubmit:b})=>{const{isDirector:o}=u().props,i=j.useRef(),{data:s,setData:h,processing:c}=x,{amount:r,max_amount:p,payment_percentage:g}=s,e=d==="paid";return a.jsx(N,{type:n,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.jsxs("h3",{className:"font-bold text-lg",children:["Konfirmasi ",o?"Proses":"Pengajuan"," Pembayaran"]}),o?a.jsxs("div",{className:"grid grid-cols-2 gap-2 text-center my-2",children:[a.jsxs("div",{className:`p-4 rounded border ${e?"bg-green-50 border-green-100":"bg-gray-50 border-gray-200 opacity-50"}`,children:[a.jsx("div",{className:`text-2xl font-bold ${e?"text-green-600":"text-gray-400"}`,children:e?l(r):"-"}),a.jsx("div",{className:"text-xs text-green-800",children:e?"Proses Pembayaran":"Disetujui"}),a.jsxs("div",{className:"text-[10px] text-gray-500 mt-1",children:[g,"% dari Max ",l(p)]})]}),a.jsxs("div",{className:`p-4 rounded border ${e?"bg-yellow-50 border-yellow-100":"bg-red-50 border-red-100"}`,children:[a.jsx("div",{className:`text-2xl font-bold ${e?"text-yellow-600":"text-red-600"}`,children:e?l(m-r):l(r)}),a.jsx("div",{className:"text-xs text-red-800",children:e?"Sisa Pembayaran":"Ditolak"})]})]}):null,s.attachment&&e&&a.jsxs("div",{className:"form-control",children:[a.jsx("label",{className:"label",children:a.jsx("span",{className:"label-text font-semibold",children:"Bukti Pembayaran"})}),a.jsx("div",{className:"relative w-full h-48 bg-gray-100 rounded-lg overflow-hidden border border-gray-200",children:a.jsx("img",{src:s.attachment instanceof File?URL.createObjectURL(s.attachment):s.attachment,alt:"Bukti Pembayaran",className:"w-full h-full object-contain"})})]}),a.jsxs("div",{className:"form-control",children:[a.jsx("label",{className:"label",children:a.jsxs("span",{className:"label-text font-semibold",children:["Catatan ",e?"(Opsional)":"(Wajib)"]})}),a.jsx("textarea",{className:"textarea textarea-bordered h-24",placeholder:e?"Tambahkan catatan untuk approval ini...":"Tulis alasan penolakan...",value:s.status_message||"",onChange:t=>h("status_message",t.target.value)})]}),a.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"Apakah anda yakin ingin menyimpan perubahan approval ini?"}),a.jsxs("div",{className:"modal-action",children:[a.jsx("label",{ref:i,htmlFor:`modal_${n}`,className:"btn btn-sm btn-ghost",children:"Batal"}),a.jsxs("button",{onClick:()=>b(()=>{var t;return(t=i.current)==null?void 0:t.click()}),className:`btn btn-sm ${e?"btn-primary":"btn-error text-white"}`,disabled:c||!e&&!s.status_message,children:[c&&a.jsx("span",{className:"loading loading-spinner loading-xs"}),"Ya, Simpan"]})]})]})})};export{k as default};
