(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,75379,e=>{"use strict";function t(e,t){let n=t.toUpperCase(),a="KES"===n;return new Intl.NumberFormat("en-US",{style:"currency",currency:n,...a?{minimumFractionDigits:0,maximumFractionDigits:0}:{}}).format(e/100)}let n="Africa/Nairobi";e.s(["formatEventDate",0,function(e){return new Intl.DateTimeFormat("en-GB",{timeZone:n,weekday:"short",day:"numeric",month:"short",year:"numeric"}).format(new Date(e))},"formatEventTime",0,function(e){return new Intl.DateTimeFormat("en-GB",{timeZone:n,hour:"numeric",minute:"2-digit",hour12:!0}).format(new Date(e))},"formatPrice",0,t,"formatPriceFrom",0,function(e,n){return null===e?"—":0===e?"FREE":`From ${t(e,n)}`}])},83536,e=>{"use strict";var t=e.i(43476),n=e.i(71645),a=e.i(18566),i=e.i(75379);e.s(["default",0,function({requestId:e,status:r,amountCents:o,currency:c}){let s=(0,a.useRouter)(),[l,m]=(0,n.useState)(!1),[u,d]=(0,n.useState)(null);async function f(e,t){d(null),m(!0);let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),a=await n.json().catch(()=>({}));(m(!1),n.ok)?s.refresh():d(a.error||"Action failed")}async function p(){confirm(`Approve this ${(0,i.formatPrice)(o,c)} advance request?`)&&await f("/api/financing/resolve",{requestId:e,action:"approve"})}async function b(){let t=prompt("Reason for rejecting (optional):")??void 0;await f("/api/financing/resolve",{requestId:e,action:"reject",note:t})}async function h(){let t=prompt(`Record disbursement of ${(0,i.formatPrice)(o,c)}. Enter a reference (M-Pesa code, bank ref, etc.):`);t&&await f("/api/financing/disburse",{requestId:e,reference:t})}return"pending"===r?(0,t.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,t.jsxs)("div",{className:"flex gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:p,disabled:l,className:"be-act be-act-primary",children:"Approve"}),(0,t.jsx)("button",{type:"button",onClick:b,disabled:l,className:"be-act be-act-ghost",children:"Reject"})]}),u&&(0,t.jsx)("span",{className:"text-xs text-[color:var(--pill-danger-fg)]",children:u})]}):"approved"===r?(0,t.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,t.jsx)("button",{type:"button",onClick:h,disabled:l,className:"be-act be-act-primary",children:l?"Working…":"Disburse"}),u&&(0,t.jsx)("span",{className:"text-xs text-[color:var(--pill-danger-fg)]",children:u})]}):null}])}]);