"use strict";exports.id=99909,exports.ids=[99909],exports.modules={99909:(a,b,c)=>{c.r(b),c.d(b,{default:()=>l});var d=c(48249),e=c(67484);c(74741);var f=c(23971),g=c(60932),h=c(41090),i=c(20524),j=c(66865),k=c(40433);function l(){let[a,b]=(0,e.useState)(null),[c,l]=(0,e.useState)(""),[m,n]=(0,e.useState)(!0),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(null),s=async()=>{p(!0);try{let a=await f.uE.put("/payments/admin/manual-payment-settings",{instructions:c});a.data?.success&&a.data.data&&(b(a.data.data),j.oR.success("Instructions saved"))}catch(b){let a=b&&"object"==typeof b&&"response"in b?b.response?.data?.message:void 0;j.oR.error(a||"Save failed")}finally{p(!1)}},t=async a=>{let c=a.target.files?.[0];if(!c)return;let d=new FormData;d.append("file",c),p(!0);try{let a=await f.uE.post("/payments/admin/manual-payment-settings/qr",d);a.data?.success&&a.data.data&&(b(a.data.data),j.oR.success("QR image updated"))}catch{j.oR.error("QR upload failed")}finally{p(!1),a.target.value=""}};return m?(0,d.jsx)("div",{className:"p-8 text-gray-600",children:"Loading…"}):(0,d.jsxs)("div",{className:"max-w-2xl space-y-6",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsx)("h1",{className:"text-3xl font-bold text-gray-900",children:"QR manual payments"}),(0,d.jsx)(g.u,{href:`${k.bw.ADMIN}/payments`,className:"text-sm font-medium text-[var(--primary-700)] hover:underline",children:"Review pending proofs →"})]}),(0,d.jsxs)(h.Z,{padding:"lg",className:"space-y-4",children:[(0,d.jsxs)("p",{className:"text-sm text-gray-600",children:["Students pay by scanning this QR, then upload a screenshot on checkout or course enrollment. Approve or reject payments from"," ",(0,d.jsx)(g.u,{href:`${k.bw.ADMIN}/payments`,className:"font-medium text-[var(--primary-700)] underline",children:"Payments"}),"."]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium text-gray-900 mb-2",children:"QR image"}),q?(0,d.jsx)("div",{className:"relative mb-3 h-48 w-48 border border-gray-200 bg-gray-50 flex items-center justify-center",children:(0,d.jsx)("img",{src:q,alt:"Payment QR preview",className:"max-h-full max-w-full object-contain p-2"})}):a?.qrImageUrl?(0,d.jsx)("div",{className:"mb-3 h-48 w-48 border border-gray-200 bg-gray-50 animate-pulse","aria-hidden":!0}):(0,d.jsx)("p",{className:"text-sm text-amber-700 mb-3",children:"No QR uploaded yet."}),(0,d.jsx)("input",{type:"file",accept:"image/*",onChange:t,disabled:o,className:"block w-full text-sm text-gray-600 file:mr-4 file:rounded-none file:border file:border-gray-300 file:bg-white file:px-4 file:py-2 file:text-sm file:font-medium"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"manual-instructions",className:"block text-sm font-medium text-gray-900 mb-2",children:"Instructions for students"}),(0,d.jsx)("textarea",{id:"manual-instructions",className:"w-full min-h-[140px] rounded-none border border-gray-300 px-3 py-2 text-sm focus:border-[var(--primary-500)] focus:outline-none focus:ring-1 focus:ring-[var(--primary-500)]",placeholder:"e.g. Bank name, account name, reference to use in transfer…",value:c,onChange:a=>l(a.target.value)})]}),(0,d.jsx)(i.$,{type:"button",variant:"primary",onClick:s,disabled:o,children:o?"Saving…":"Save instructions"})]})]})}}};