import{b as f,c as j,j as e}from"./index-D9pJRAs5.js";import{r as d}from"./vendor-D6aTFYy9.js";import{C as g,bi as w,X as N,u as v,a4 as o}from"./ui-CtYVlq7P.js";import"./pdf-Bz_mU5mG.js";const P=({order:s,isOpen:n,onClose:r,onSuccess:x})=>{const{theme:m}=f(),t=m.mode==="dark",{addJournalEntry:i}=j(),[l,c]=d.useState(!1),[u,b]=d.useState(!1),a=s.totalPrice*.5;if(!n)return null;const h=async()=>{c(!0),setTimeout(async()=>{try{i&&await i(`Website Deposit Received - Order #${s.invoiceNumber}`,new Date,[{accountId:"1000",description:"Stripe Payouts",debit:a,credit:0},{accountId:"2200",description:"Customer Deposits",debit:0,credit:a}]),b(!0),setTimeout(()=>{x()},2e3)}catch(p){console.error(p),alert("Payment processing failed."),c(!1)}},1500)};return u?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"absolute inset-0 bg-slate-900/60 backdrop-blur-sm"}),e.jsxs("div",{className:`relative w-full max-w-md rounded-3xl p-8 text-center shadow-2xl ${t?"bg-slate-900 border-slate-700":"bg-white border-slate-200"} border`,children:[e.jsx("div",{className:"w-20 h-20 rounded-full bg-emerald-500 text-white flex items-center justify-center mx-auto mb-6 shadow-lg shadow-emerald-500/30",children:e.jsx(g,{size:40})}),e.jsx("h2",{className:`text-2xl font-black uppercase tracking-tight mb-2 ${t?"text-white":"text-slate-900"}`,children:"Payment Successful"}),e.jsxs("p",{className:t?"text-slate-400":"text-slate-500",children:["RM ",a.toFixed(2)," has been paid towards Order #",s.invoiceNumber||s.id.slice(0,8),". Your job is now queued for prepress."]})]})]}):e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"absolute inset-0 bg-slate-900/60 backdrop-blur-sm",onClick:r}),e.jsxs("div",{className:`relative w-full max-w-md rounded-3xl overflow-hidden shadow-2xl ${t?"bg-slate-900 border-slate-700":"bg-white border-slate-200"} border`,children:[e.jsxs("div",{className:"p-6 border-b border-slate-100 dark:border-slate-800 flex justify-between items-center bg-slate-50 dark:bg-slate-800/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{className:"text-emerald-500",size:24}),e.jsx("h2",{className:`text-lg font-black uppercase tracking-widest ${t?"text-white":"text-slate-900"}`,children:"Secure Checkout"})]}),e.jsx("button",{onClick:r,className:"text-slate-400 hover:text-slate-600 dark:hover:text-white",children:e.jsx(N,{size:20})})]}),e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-bold text-slate-500 uppercase tracking-widest mb-1",children:"Total Deposit Due"}),e.jsxs("h1",{className:`text-4xl font-black tracking-tight ${t?"text-white":"text-slate-900"}`,children:[e.jsx("span",{className:"text-2xl text-slate-400",children:"RM"})," ",a.toFixed(2)]}),e.jsxs("p",{className:"text-xs text-slate-400 mt-2",children:["50% Deposit for Order #",s.invoiceNumber]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-slate-500 uppercase tracking-widest mb-2",children:"Card Information"}),e.jsxs("div",{className:`flex items-center border rounded-xl overflow-hidden pl-3 ${t?"border-slate-700 bg-slate-800":"border-slate-200 bg-white"}`,children:[e.jsx(v,{size:18,className:"text-slate-400"}),e.jsx("input",{type:"text",placeholder:"4242 4242 4242 4242",className:`w-full p-3 text-sm focus:outline-none bg-transparent ${t?"text-white placeholder-slate-600":"text-slate-900 placeholder-slate-400"}`})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx("div",{children:e.jsx("input",{type:"text",placeholder:"MM/YY",className:`w-full p-3 border rounded-xl flex-1 text-sm focus:outline-none focus:border-indigo-500 ${t?"border-slate-700 bg-slate-800 text-white":"border-slate-200 bg-white text-slate-900"}`})}),e.jsx("div",{children:e.jsx("input",{type:"text",placeholder:"CVC",className:`w-full p-3 border rounded-xl flex-1 text-sm focus:outline-none focus:border-indigo-500 ${t?"border-slate-700 bg-slate-800 text-white":"border-slate-200 bg-white text-slate-900"}`})})]}),e.jsxs("div",{className:"pt-4",children:[e.jsxs("button",{disabled:l,onClick:h,className:"w-full flex items-center justify-center gap-2 py-4 bg-indigo-600 hover:bg-indigo-700 text-white rounded-xl font-black text-sm uppercase tracking-widest transition-all disabled:opacity-50",children:[l?"Processing SECURELY...":`Pay RM ${a.toFixed(2)}`,!l&&e.jsx(o,{size:16})]}),e.jsxs("p",{className:"text-center text-xs text-slate-400 mt-4 flex items-center justify-center gap-1",children:[e.jsx(o,{size:10})," Powered by simulated Stripe Sandbox"]})]})]})]})]})]})};export{P as default};
