PageSourceSearch

https://drive4usyd.manus.space/assets/GiftVouchers-k1UvyuhX.js

js drive4usyd.manus.space collected 2026-10-03 05:01:45 UTC 15,882 bytes, 1 lines download raw bytes

1import{u as Y,a as z,r as t,t as V,J as d,j as e,G as h,d as u,S as H,b as G,K as R,O as D,Q as $,c as j,B as w,A as J,e as K,g as q}from"./index-U8D282DB.js";import{I as x}from"./input-DFtjl8GZ.js";import{L as N}from"./label-BdqAIGhN.js";import{S as B}from"./search-C5_ObWCH.js";import{C}from"./circle-x-DRl5_Mg7.js";import"./useComposition-DGvQVl2f.js";const W=[50,100,150,200,250,500],y={pending_payment:{label:"Pending Payment",color:"#f59e0b",icon:K},active:{label:"Active",color:"#16a34a",icon:u},partially_used:{label:"Partially Used",color:"#3b82f6",icon:u},fully_used:{label:"Fully Used",color:"#6b7280",icon:u},expired:{label:"Expired",color:"#ef4444",icon:C},cancelled:{label:"Cancelled",color:"#ef4444",icon:C}};function le(){Y("Gift Vouchers");const{isAuthenticated:i}=z(),[c,v]=t.useState("purchase"),[p,M]=t.useState(100),[o,k]=t.useState(""),[m,T]=t.useState(""),[g,X]=t.useState(""),[A,L]=t.useState(""),[n,I]=t.useState(""),[f,S]=t.useState(!1),l=o?parseFloat(o):p,b=V.giftVouchers.purchase.useMutation({onSuccess:s=>{d.success("Redirecting to checkout...",{description:"Complete your payment to activate the voucher."}),s.checkoutUrl&&window.open(s.checkoutUrl,"_blank")},onError:s=>d.error("Error",{description:s.message})}),{data:a,isLoading:P}=V.giftVouchers.checkBalance.useQuery({code:n},{enabled:f&&n.length>=6}),{data:F=[]}=V.giftVouchers.myVouchers.useQuery(void 0,{enabled:i&&c==="my"}),_=()=>{if(!i){window.location.href=q();return}if(l<25||l>2e3){d.error("Invalid amount",{description:"Gift voucher amount must be between $25 and $2,000"});return}if(!m.trim()||!g.trim()){d.error("Missing details",{description:"Please enter the recipient's name and email"});return}b.mutate({amount:l,recipientName:m.trim(),recipientEmail:g.trim(),personalMessage:A.trim()||void 0})},E=t.useMemo(()=>new URLSearchParams(window.location.search),[]),U=E.get("code"),O=E.get("purchased")==="true";return e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:83",className:"min-h-screen",style:{background:"linear-gradient(135deg, #0f1729 0%, #1B2A4A 50%, #0f1729 100%)"},children:[e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:85",className:"relative overflow-hidden py-16 sm:py-24",children:[e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:86",className:"absolute inset-0 opacity-10",children:[e.jsx("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:87",className:"absolute top-20 left-20 w-64 h-64 rounded-full",style:{background:"radial-gradient(circle, #C8A951 0%, transparent 70%)"}}),e.jsx("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:88",className:"absolute bottom-20 right-20 w-96 h-96 rounded-full",style:{background:"radial-gradient(circle, #C8A951 0%, transparent 70%)"}})]}),e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:90",className:"container relative z-10 text-center",children:[e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:91",className:"inline-flex items-center gap-2 px-4 py-2 rounded-full mb-6",style:{backgroundColor:"rgba(200,169,81,0.15)",border:"1px solid rgba(200,169,81,0.3)"},children:[e.jsx(h,{"data-loc":"client/src/pages/GiftVouchers.tsx:92",className:"h-4 w-4",style:{color:"#C8A951"}}),e.jsx("span",{"data-loc":"client/src/pages/GiftVouchers.tsx:93",className:"text-sm font-medium",style:{color:"#C8A951"},children:"The Perfect Gift"})]}),e.jsx("h1",{"data-loc":"client/src/pages/GiftVouchers.tsx:95",className:"text-4xl sm:text-5xl font-bold text-white mb-4",children:"Drive4u Gift Vouchers"}),e.jsx("p",{"data-loc":"client/src/pages/GiftVouchers.tsx:96",className:"text-lg text-white/60 max-w-xl mx-auto",children:"Give the gift of a great ride. Perfect for birthdays, anniversaries, airport runs, or any special occasion."})]})]}),O&&U&&e.jsx("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:104",className:"container mb-8",children:e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:105",className:"rounded-xl p-6 text-center",style:{backgroundColor:"rgba(22,163,74,0.15)",border:"1px solid rgba(22,163,74,0.3)"},children:[e.jsx(u,{"data-loc":"client/src/pages/GiftVouchers.tsx:106",className:"h-10 w-10 mx-auto mb-3",style:{color:"#16a34a"}}
1),e.jsx("h3",{"data-loc":"client/src/pages/GiftVouchers.tsx:107",className:"text-xl font-bold text-white mb-2",children:"Voucher Purchased Successfully!"}),e.jsx("p",{"data-loc":"client/src/pages/GiftVouchers.tsx:108",className:"text-white/70 mb-2",children:"Your gift voucher code is:"}),e.jsx("p",{"data-loc":"client/src/pages/GiftVouchers.tsx:109",className:"text-2xl font-mono font-bold tracking-wider",style:{color:"#C8A951"},children:U}),e.jsx("p",{"data-loc":"client/src/pages/GiftVouchers.tsx:110",className:"text-sm text-white/50 mt-2",children:"The recipient will receive an email with the voucher details once payment is confirmed."})]})}),e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:116",className:"container pb-20",children:[e.jsx("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:117",className:"flex justify-center gap-2 mb-8",children:[{id:"purchase",label:"Purchase",icon:h},{id:"check",label:"Check Balance",icon:B},...i?[{id:"my",label:"My Vouchers",icon:H}]:[]].map(s=>e.jsxs("button",{"data-loc":"client/src/pages/GiftVouchers.tsx:123",onClick:()=>v(s.id),className:`flex items-center gap-2 px-5 py-2.5 rounded-lg text-sm font-medium transition-all ${c===s.id?"text-white shadow-lg":"text-white/50 hover:text-white/80"}`,style:c===s.id?{backgroundColor:"#C8A951"}:{backgroundColor:"rgba(255,255,255,0.05)"},children:[e.jsx(s.icon,{"data-loc":"client/src/pages/GiftVouchers.tsx:131",className:"h-4 w-4"}),s.label]},s.id))}),c==="purchase"&&e.jsx("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:139",className:"max-w-2xl mx-auto",children:e.jsxs(G,{"data-loc":"client/src/pages/GiftVouchers.tsx:140",className:"border-0 shadow-2xl",style:{backgroundColor:"rgba(255,255,255,0.05)",backdropFilter:"blur(20px)"},children:[e.jsxs(R,{"data-loc":"client/src/pages/GiftVouchers.tsx:141",className:"text-center pb-2",children:[e.jsx(D,{"data-loc":"client/src/pages/GiftVouchers.tsx:142",className:"text-2xl text-white",children:"Create a Gift Voucher"}),e.jsx($,{"data-loc":"client/src/pages/GiftVouchers.tsx:143",className:"text-white/50",children:"Choose an amount and personalise your gift"})]}),e.jsxs(j,{"data-loc":"client/src/pages/GiftVouchers.tsx:145",className:"space-y-6 pt-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:147",children:[e.jsx(N,{"data-loc":"client/src/pages/GiftVouchers.tsx:148",className:"text-white/70 text-sm mb-3 block",children:"Select Amount (AUD)"}),e.jsx("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:149",className:"grid grid-cols-3 gap-2 mb-3",children:W.map(s=>e.jsxs("button",{"data-loc":"client/src/pages/GiftVouchers.tsx:151",onClick:()=>{M(s),k("")},className:`py-3 rounded-lg text-lg font-semibold transition-all ${!o&&p===s?"text-white ring-2":"text-white/70 hover:text-white"}`,style:{backgroundColor:!o&&p===s?"rgba(200,169,81,0.2)":"rgba(255,255,255,0.05)"},children:["$",s]},s))}),e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:166",className:"flex items-center gap-3",children:[e.jsx("span",{"data-loc":"client/src/pages/GiftVouchers.tsx:167",className:"text-white/50 text-sm",children:"or custom:"}),e.jsx(x,{"data-loc":"client/src/pages/GiftVouchers.tsx:168",type:"number",placeholder:"25 - 2000",value:o,onChange:s=>k(s.target.value),className:"bg-white/5 border-white/10 text-white max-w-32",min:25,max:2e3})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:181",className:"space-y-3",children:[e.jsx(N,{"data-loc":"client/src/pages/GiftVouchers.tsx:182",className:"text-white/70 text-sm",children:"Recipient Details"}),e.jsx(x,{"data-loc":"client/src/pages/GiftVouchers.tsx:183",placeholder:"Recipient's name",value:m,onChange:s=>T(s.target.value),className:"bg-white/5 border-white/10 text-white placeholder:text-white/30"}),e.jsx(x,{"data-loc":"client/src/pages/GiftVouchers.tsx:189",type:"email",placeholder:"Recipient's email",value:g,onChange:s=>X(s.target.value),className:"bg-white/5 border-white/10 text-white placeholder:text-white/30"})]}),e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:199",children:[e.jsx(N,{"data-loc":"client/src/pages/GiftVouchers.tsx:200",className:"text-white/70 text-sm mb-2 block",children:"Personal Message (optional)"}),e.jsx("textarea",{"data-loc":"client/src/pages/GiftVouchers.tsx:201",placeholder:"Add a personal message to your gift...",value:A,onChange:s=>L(s.target.value),className:"w-full rounded-lg p-3 text-sm bg-white/5 border border-white/10 text-white placeholder:text-white/30 resize-none focus:outline-none focus:ring-2 focus:ring-[#C8A951]/50",rows:3,maxLength:500})]}),e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:212",className:"rounded-lg p-4",style:{backgroundColor:"rgba(200,169,81,0.1)",border:"1px solid rgba(200,169,81,0.2)"},children:[e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:213",className:"flex items-center justify-between",children:[e.jsx("span",{"data-loc":"client/src/pages/GiftVouchers.tsx:214",className:"text-white/70",children:"Gift Voucher Value"}),e.jsxs("span",{"data-loc":"client/src/pages/GiftVouchers.tsx:215",className:"text-2xl font-bold",style:{color:"#C8A951"},children:["$",l.toFixed(2)]})]}),e.jsx("p",{"data-loc":"client/src/pages/GiftVouchers.tsx:217",className:"text-xs text-white/40 mt-1",children:"Valid for 12 months from purchase. Redeemable on any Drive4u service."})]}),e.jsx(w,{"data-loc":"client/src/pages/GiftVouchers.tsx:220",onClick:_,disabled:b.isPending||l<25||l>2e3,className:"w-full h-12 text-base font-semibold text-white gap-2",style:{backgroundColor:"#C8A951"},children:b.isPending?"Processing...":e.jsxs(e.Fragment,{children:[i?"Purchase Voucher":"Sign In to Purchase",e.jsx(J,{"data-loc":"client/src/pages/GiftVouchers.tsx:229",className:"h-4 w-4"})]})})]})]})}),c==="check"&&e.jsx("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:240",className:"max-w-md mx-auto",children:e.jsxs(G,{"data-loc":"client/src/pages/GiftVouchers.tsx:241",className:"border-0 shadow-2xl",style:{backgroundColor:"rgba(255,255,255,0.05)",backdropFilter:"blur(20px)"},children:[e.jsxs(R,{"data-loc":"client/src/pages/GiftVouchers.tsx:242",className:"text-center pb-2",children:[e.jsx(D,{"data-loc":"client/src/pages/GiftVouchers.tsx:243",className:"text-xl text-white",children:"Check Voucher Balance"}),e.jsx($,{"data-loc":"client/src/pages/GiftVouchers.tsx:244",className:"text-white/50",children:"Enter your voucher co
1de to check the remaining balance"})]}),e.jsxs(j,{"data-loc":"client/src/pages/GiftVouchers.tsx:246",className:"space-y-4 pt-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:247",className:"flex gap-2",children:[e.jsx(x,{"data-loc":"client/src/pages/GiftVouchers.tsx:248",placeholder:"D4U-XXXX-XXXX",value:n,onChange:s=>{I(s.target.value.toUpperCase()),S(!1)},className:"bg-white/5 border-white/10 text-white placeholder:text-white/30 font-mono"}),e.jsx(w,{"data-loc":"client/src/pages/GiftVouchers.tsx:254",onClick:()=>S(!0),disabled:n.length<6||P,style:{backgroundColor:"#C8A951"},className:"text-white shrink-0",children:e.jsx(B,{"data-loc":"client/src/pages/GiftVouchers.tsx:260",className:"h-4 w-4"})})]}),f&&a&&e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:265",className:"rounded-lg p-5 text-center",style:{backgroundColor:"rgba(200,169,81,0.1)",border:"1px solid rgba(200,169,81,0.2)"},children:[e.jsx("p",{"data-loc":"client/src/pages/GiftVouchers.tsx:266",className:"text-sm text-white/50 mb-1",children:"Remaining Balance"}),e.jsxs("p",{"data-loc":"client/src/pages/GiftVouchers.tsx:267",className:"text-3xl font-bold",style:{color:"#C8A951"},children:["$",parseFloat(a.remainingAmount).toFixed(2)]}),e.jsxs("p",{"data-loc":"client/src/pages/GiftVouchers.tsx:268",className:"text-xs text-white/40 mt-2",children:["Original: $",parseFloat(a.originalAmount).toFixed(2)," · For: ",a.recipientName]}),a.expiresAt&&e.jsxs("p",{"data-loc":"client/src/pages/GiftVouchers.tsx:272",className:"text-xs text-white/40 mt-1",children:["Expires: ",new Date(a.expiresAt).toLocaleDateString("en-AU")]}),(()=>{const s=y[a.status];if(!s)return null;const r=s.icon;return e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:281",className:"flex items-center justify-center gap-1.5 mt-3",children:[e.jsx(r,{"data-loc":"client/src/pages/GiftVouchers.tsx:282",className:"h-3.5 w-3.5",style:{color:s.color}}),e.jsx("span",{"data-loc":"client/src/pages/GiftVouchers.tsx:283",className:"text-xs font-medium",style:{color:s.color},children:s.label})]})})()]}),f&&!P&&a===null&&e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:291",className:"rounded-lg p-5 text-center",style:{backgroundColor:"rgba(239,68,68,0.1)",border:"1px solid rgba(239,68,68,0.2)"},children:[e.jsx(C,{"data-loc":"client/src/pages/GiftVouchers.tsx:292",className:"h-8 w-8 mx-auto mb-2",style:{color:"#ef4444"}}),e.jsx("p",{"data-loc":"client/src/pages/GiftVouchers.tsx:293",className:"text-sm text-white/70",children:"No voucher found with this code"})]})]})]})}),c==="my"&&i&&e.jsx("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:303",className:"max-w-2xl mx-auto",children:F.length===0?e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:305",className:"text-center py-16",children:[e.jsx(h,{"data-loc":"client/src/pages/GiftVouchers.tsx:306",className:"h-12 w-12 mx-auto mb-4 opacity-30 text-white"}),e.jsx("p",{"data-loc":"client/src/pages/GiftVouchers.tsx:307",className:"text-white/50",children:"You haven't purchased any gift vouchers yet"}),e.jsx(w,{"data-loc":"client/src/pages/GiftVouchers.tsx:308",onClick:()=>v("purchase"),className:"mt-4 text-white",style:{backgroundColor:"#C8A951"},children:"Purchase Your First Voucher"})]}):e.jsx("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:313",className:"space-y-3",children:F.map(s=>{const r=y[s.status]||y.active,Q=r.icon;return e.jsx(G,{"data-loc":"client/src/pages/GiftVouchers.tsx:318",className:"border-0",style:{backgroundColor:"rgba(255,255,255,0.05)"},children:e.jsxs(j,{"data-loc":"client/src/pages/GiftVouchers.tsx:319",className:"p-4 flex items-center gap-4",children:[e.jsx("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:320",className:"shrink-0 w-12 h-12 rounded-xl flex items-center justify-center",style:{backgroundColor:"rgba(200,169,81,0.15)"},children:e.jsx(h,{"data-loc":"client/src/pages/GiftVouchers.tsx:321",className:"h-6 w-6",style:{color:"#C8A951"}})}),e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:323",className:"flex-1 min-w-0",children:[e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:324",className:"flex items-center gap-2 mb-0.5",children:[e.jsx("span",{"data-loc":"client/src/pages/GiftVouchers.tsx:325",className:"font-mono text-sm font-semibold text-white",children:s.code}),e.jsxs("span",{"data-loc":"client/src/pages/GiftVouchers.tsx:326",className:"flex items-center gap-1 text-xs px-2 py-0.5 rounded-full",style:{backgroundColor:`${r.color}20`,color:r.color},children:[e.jsx(Q,{"data-loc":"client/src/pages/GiftVouchers.tsx:327",className:"h-3 w-3"}),r.label]})]}),e.jsxs("p",{"data-loc":"client/src/pages/GiftVouchers.tsx:331",className:"text-xs text-white/50",children:["For: ",s.recipientName," · ",new Date(s.createdAt).toLocaleDateString("en-AU")]})]}),e.jsxs("div",{"data-loc":"client/src/pages/GiftVouchers.tsx:335",className:"text-right shrink-0",children:[e.jsxs("p",{"data-loc":"client/src/pages/GiftVouchers.tsx:336",className:"text-lg font-bold",style:{color:"#C8A951"}
1,children:["$",parseFloat(s.remainingAmount).toFixed(2)]}),e.jsxs("p",{"data-loc":"client/src/pages/GiftVouchers.tsx:337",className:"text-xs text-white/40",children:["of $",parseFloat(s.amount).toFixed(2)]})]})]})},s.id)})})})]})]})}export{le as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.