import{r as y,j as e,F as o,n as m,m as c,cH as x,q as h,v,e as j}from"./vendor-BKmmeuxg.js";import{A as b,b as w}from"./alert-D9uBQ7fu.js";import{B as D}from"./badge-AQfLLMpR.js";import{B as n}from"./button-BpNwv2aE.js";import{D as _,b as A,c as C,d as M,g as S,e as u}from"./dialog-B2gN9MvT.js";import{L as F}from"./label-HmIcv5Yx.js";import{T as P}from"./textarea-CyndvowL.js";import{e as T}from"./richtor-CRcM6Du2.js";import"./index-WW_1X1qx.js";import"./utils-DxSsnXxD.js";const z=({payment:s,isOpen:f,onClose:t})=>{const i=s.meta??{},a=i.status||"pending",d=i.payment_info,[r,p]=y.useState(""),N=l=>{j.post(route("payment-reports.offline.verify",s.id),{admin_notes:r},{onSuccess:()=>{t()}})},g=l=>{j.post(route("payment-reports.offline.reject",s.id),{admin_notes:r},{onSuccess:()=>{t()}})};return e.jsx(_,{open:f,onOpenChange:t,children:e.jsxs(A,{className:"max-h-[90vh] max-w-3xl overflow-y-auto",children:[e.jsxs(C,{children:[e.jsxs(M,{className:"flex items-center gap-2",children:[e.jsx(o,{className:"h-5 w-5"}),"Offline Payment Details"]}),e.jsx(S,{children:"Review and verify the offline payment submission"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium",children:"Payment Status:"}),e.jsxs(D,{variant:a==="verified"?"default":a==="rejected"?"destructive":"secondary",className:"gap-1",children:[a==="verified"?e.jsx(m,{className:"h-3 w-3"}):a==="rejected"?e.jsx(c,{className:"h-3 w-3"}):e.jsx(x,{className:"h-3 w-3"}),a]})]}),e.jsxs("div",{className:"bg-muted/50 space-y-3 rounded-lg border p-4",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Payment Information"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Transaction ID:"}),e.jsx("p",{className:"font-mono font-medium",children:s.transaction_id})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Amount:"}),e.jsxs("p",{className:"text-lg font-medium",children:["$",Number(s.amount).toFixed(2)]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Payment Date:"}),e.jsx("p",{className:"font-medium",children:i.payment_date?h(new Date(i.payment_date),"MMM dd, yyyy"):"N/A"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Submitted At:"}),e.jsx("p",{className:"font-medium",children:h(new Date(s.created_at),"MMM dd, yyyy HH:mm")})]})]})]}),!!d&&e.jsxs("div",{className:"bg-muted/50 space-y-3 rounded-lg border p-4",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Submitted Payment Details"}),e.jsx(T,{value:d})]}),s.media&&s.media.length>0&&e.jsxs("div",{className:"bg-muted/50 space-y-3 rounded-lg border p-4",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Attachment"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(o,{className:"text-muted-foreground h-8 w-8"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:s.media[0].file_name}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Transaction proof"})]}),e.jsx(n,{size:"sm",variant:"outline",asChild:!0,children:e.jsxs("a",{href:s.media[0].original_url,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(v,{className:"mr-1 h-4 w-4"}),"Download"]})})]})]}),(a==="pending"||a==="rejected")&&e.jsxs(e.Fragment,{children:[e.jsxs(b,{children:[e.jsx(x,{className:"h-4 w-4"}),e.jsx(w,{children:"Verifying this payment will automatically enroll the user in the purchased course/exam."})]}),e.jsxs("form",{onSubmit:N,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(F,{htmlFor:"admin_notes",children:"Admin Notes (Optional)"}),e.jsx(P,{id:"admin_notes",name:"admin_notes",rows:3,placeholder:"Add any notes about this verification...",value:r,onChange:l=>p(l.target.value)})]}),e.jsxs(u,{className:"gap-2",children:[e.jsx(n,{type:"button",variant:"outline",onClick:t,children:"Cancel"}),e.jsxs(n,{type:"button",variant:"destructive",onClick:g,children:[e.jsx(c,{className:"mr-1 h-4 w-4"}),"Reject"]}),e.jsxs(n,{type:"submit",children:[e.jsx(m,{className:"mr-1 h-4 w-4"}),"Verify & Enroll"]})]})]})]}),a!=="pending"&&e.jsx(u,{children:e.jsx(n,{variant:"outline",onClick:t,children:"Close"})})]})]})})};export{z as default};