PageSourceSearch

https://kconect.vercel.app/assets/AttendeeMyTickets-BVs6Mml_.js

js kconect.vercel.app collected 2026-10-03 07:11:48 UTC 27,595 bytes, 15 lines download raw bytes

1import{K as re,j as e,C as b,d as B,e as G,m as $,f as y,B as h,D as ge,w as ve,x as je,y as Ne,z as be,a as ye,c as we,o as ke,r as N,p as ne,k as v,V as ie,g as H,M as X,A as Z,I as A,U as ce,L as Y,S as _e}from"./index-IxvR3ybE.js";import{T as D}from"./ticket-C2j8umZ7.js";import{C as V}from"./circle-check-big-DrZso9hg.js";import{C as W}from"./clock-DaRv8o2j.js";import{P as ee}from"./plus-ByP2IBiw.js";import{Q as de}from"./qr-code-Dq_IS1jX.js";import{T as Te}from"./trash-2-DklbPQfi.js";import{S as oe}from"./shopping-cart-zPUbj8Lc.js";const Ce=({ticket:a,onClose:o})=>{var I,M,R,c;const[j,T]=re.useState("");re.useEffect(()=>{var r,t;const u=JSON.stringify({ticketNumber:a.ticket_number,ticketId:a.id,eventName:((r=a.events)==null?void 0:r.name)||"Unknown Event",ticketType:((t=a.ticket_types)==null?void 0:t.name)||"Unknown Ticket Type",verifyUrl:`${window.location.origin}/admin/verify-ticket/${a.ticket_number}`}),C=300,p=`https://api.qrserver.com/v1/create-qr-code/?size=${C}x${C}&data=${encodeURIComponent(u)}&logo=https://89ffd642-3173-4004-8c28-eb0eea097a15.lovableproject.com/lovable-uploads/cc286065-ca78-4e02-b135-112dfebbebef.png`;T(p)},[a]);const P=async()=>{var u,C,p;try{const r=document.createElement("canvas"),t=r.getContext("2d");if(!t)throw new Error("Could not get canvas context");r.width=600,r.height=400,t.fillStyle="#ffffff",t.fillRect(0,0,r.width,r.height),t.strokeStyle="#e5e5e5",t.lineWidth=2,t.strokeRect(0,0,r.width,r.height),t.strokeStyle="#d1d5db",t.lineWidth=1,t.setLineDash([5,5]),t.strokeRect(10,10,r.width-20,r.height-20),t.setLineDash([]),t.fillStyle="#000000",t.font="bold 24px Arial",t.fillText("Your Ticket",30,50),t.font="bold 20px Arial",t.fillText(((u=a.ticket_types)==null?void 0:u.name)||"General Admission",30,90),t.font="bold 24px Arial",t.fillStyle="#059669";const O=`₦${(a.price/100).toLocaleString("en-NG",{minimumFractionDigits:0,maximumFractionDigits:0})}`,z=t.measureText(O).width;t.fillText(O,r.width-z-30,90),t.fillStyle="#374151",t.font="16px Arial",t.fillText("Ticket Number:",30,130),t.fillStyle="#000000",t.font="bold 16px Arial",t.fillText(a.ticket_number,160,130),t.fillStyle="#374151",t.font="16px Arial",t.fillText("Name:",30,160),t.fillStyle="#000000",t.font="bold 16px Arial",t.fillText(a.guest_name||"Guest",80,160),a.events&&(t.fillStyle="#374151",t.font="14px Arial",t.fillText("Event:",30,200),t.fillStyle="#000000",t.font="bold 14px Arial",t.fillText(a.events.name,80,200),a.events.location&&(t.fillStyle="#374151",t.font="14px Arial",t.fillText("Location:",30,220),t.fillStyle="#000000",t.font="bold 14px Arial",t.fillText(a.events.location,100,220)),t.fillStyle="#374151",t.font="14px Arial",t.fillText("Date:",30,240),t.fillStyle="#000000",t.font="bold 14px Arial",t.fillText(m(a.events.start_time),70,240));const J=JSON.stringify({ticketNumber:a.ticket_number,ticketId:a.id,eventName:((C=a.events)==null?void 0:C.name)||"Unknown Event",ticketType:((p=a.ticket_types)==null?void 0:p.name)||"Unknown Ticket Type",verifyUrl:`${window.location.origin}/admin/verify-ticket/${a.ticket_number}`}),L=120,E=`https://api.qrserver.com/v1/create-qr-code/?size=${L}x${L}&data=${encodeURIComponent(J)}&logo=https://89ffd642-3173-4004-8c28-eb0eea097a15.lovableproject.com/lovable-uploads/cc286065-ca78-4e02-b135-112dfebbebef.png`,f=new Image;f.crossOrigin="anonymous",await new Promise((d,S)=>{f.onload=()=>{t.drawImage(f,r.width-150,r.height-170,120,120),t.fillStyle="#6b7280",t.font="12px Arial";const n="Scan at venue",se=t.measureText(n).width;t.fillText(n,r.width-150+(120-se)/2,r.height-30),d(!0)},f.onerror=S,f.src=E}),r.toBlob(d=>{if(d){const S=URL.createObjectURL(d),n=document.createElement("a");n.href=S,n.download=`ticket-${a.ticket_number}.png`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(S)}},"image/png")}catch(r){console.error("Failed to download ticket card:",r)}},m=u=>new Date(u).toLocaleDateString("en-US",{weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return e.jsxs(b,{className:"w-full border-0 shadow-none",children:[e.jsxs(B,{className:"text-center pb-4",children:[e.jsxs(G,{className:"flex items-center justify-center gap-2 text-lg",children:[e.jsx(D,{className:"h-5 w-5"}),"Ticket QR Code"]}),e.jsx($,{variant:a.check_in_status?"default":"secondary",className:"mx-auto",children:a.check_in_status?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(V,{className:"h-3 w-3"}),"Checked In"]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(W,{className:"h-3 w-3"}),"Not Checked In"]})})]}),e.jsxs(y,{className:"space-y-4 px-2 sm:px-6",children:[e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("h3",{className:"font-semibold text-lg",children:((I=a.events)==null?void 0:I.name)||"Unknown Event"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:((M=a.ticket_types)==null?void 0:M.name)||"Unknown Ticket Type"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["#",a.ticket_number]}),a.guest_name&&e.jsx("p",{className:"text-sm font-medium",children:a.guest_name})]}),e.jsx("div",{className:"flex justify-center",children:j?e.jsx("div",{className:"border rounded-lg p-2 sm:p-4 bg-white",children:e.jsx("img",{src:j,alt:"Ticket QR Code",className:"w-48 h-48 sm:w-64 sm:h-64"})}):e.jsx("div",{className:"w-48 h-48 sm:w-64 sm:h-64 border rounded-lg flex items-center justify-center",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}),e.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Event Date:"})," ",(R=a.events)!=null&&R.start_time?m(a.events.start_time):"Unknown Date"]}),((c=a.events)==null?void 0:c.location)&&e.jsxs("div",{children:[e.jsx("strong",{children:"Location:"})," ",a.events.location]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Purchased:"})," ",m(a.purchase_date)]}),a.checked_in_at&&e.jsxs("div",{children:[e.jsx("strong",{children:"Checked In:"})," ",m(a.checked_in_at)]})]}),e.jsx("div",{className:"bg-purple-50 p-3 rounded-lg text-sm",children:e.jsxs("p",{className:"text-purple-800",children:[e.jsx("strong",{children:"Instructions:"})," Show this QR code to event staff for check-in. The QR code contains your ticket verification information."]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 pt-4",children:[e.jsxs(h,{onClick:P,variant:"outline",className:"w-full sm:flex-1 h-12 text-base",disabled:!j,children:[e.jsx(ge,{className:"h-4 w-4 mr-2"}),"Download"]}),e.jsx(h,{onClick:o,className:"w-full sm:flex-1 h-12 text-base",children:"Close"})]})]})]})},Se=({isOpen:a,onClose:o,ticket:j})=>j?e.jsx(ve,{open:a,onOpenChange:o,children:e.jsxs(je,{className:"max-w-lg w-[95vw] max-h-[95vh] overflow-y-auto p-0",children:[e.jsx(Ne,{className:"p-6 pb-2",children:e.jsx(be,{children:"Your Ticket"})}),e.jsx("div",{className:"p-6 pt-0",children:e.jsx(Ce,{ticket:j,onClose:o})})]})}):null;function Qe(){const{currentUser:a}=ye(),{toast:o}=we(),j=ke(),[T,P]=N.useState(""),[m,I]=N.useState({}),[M,R]=N.useState(!1),[c,u]=N.useState({fullName:"",email:(a==null?void 0:a.email)||"",phone:""}),[C,p]=N.useState(!1),[r,t]=N.useState("all"),[O,z]=N.useState(null),[J,L]=N.useState(!1);N.useEffect(()=>{const s=localStorage.getItem("pendingTicketingUrl");s&&(P(s),localStorage.removeItem("pendingTicketingUrl"),E(s)&&R(!0))},[]);const E=s=>{const l=s.match(/\/buy-tickets\/([^\/\?]+)/);return l?l[1]:null},f=E(T),{data:d=[],isLoading:S}=ne({queryKey:["my-tickets",a==null?void 0:a.id],queryFn:async()=>
1{if(!(a!=null&&a.id))return[];const{data:s,error:l}=await v.from("event_tickets").select(`
2          *,
3          ticket_types (
4            name,
5            description
6          ),
7          events (
8            name,
9            description,
10            start_time,
11            end_time,
12            location,
13            banner_url
14          )
15        `).eq("user_id",a.id).order("purchase_date",{ascending:!1});if(l)throw l;return s||[]},enabled:!!(a!=null&&a.id)}),{data:n,isLoading:se}=ne({queryKey:["purchase-event",f],queryFn:async()=>{if(!f)return null;const{data:s,error:l}=await v.from("events").select("*").eq("event_key",f).single();if(l)throw l;const{data:i,error:g}=await v.from("ticket_types").select("*").eq("event_id",s.id).eq("is_active",!0).gt("available_quantity",0);if(g)throw g;return{event:s,ticketTypes:i}},enabled:!!f}),U=ie({mutationFn:async()=>{if(!(a!=null&&a.id)||!n)throw new Error("User or event data not available");if(!c.fullName.trim()||!c.email.trim()||!c.phone.trim())throw new Error("Please provide your full name, email, and phone number before purchasing.");const l=te()===0,i=[];for(const[x,k]of Object.entries(m))if(k>0){const _=n.ticketTypes.find(q=>q.id===x);if(!_)continue;for(let q=0;q<k;q++){const Q=`TKT-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;i.push({ticket_number:Q,user_id:a.id,ticket_type_id:x,event_id:n.event.id,price:_.price,guest_name:c.fullName.substring(0,100),guest_email:c.email.substring(0,100),guest_phone:c.phone.substring(0,20),qr_code_data:JSON.stringify({ticketNumber:Q,eventId:n.event.id,userId:a.id,ticketTypeId:x}),payment_status:l?"completed":"pending"})}}if(l){const{data:x,error:k}=await v.from("event_tickets").insert(i).select();if(k)throw k;for(const[_,q]of Object.entries(m))if(q>0){const{data:Q}=await v.from("ticket_types").select("available_quantity").eq("id",_).single();Q&&await v.from("ticket_types").update({available_quantity:Q.available_quantity-q}).eq("id",_)}return x}const{data:g,error:w}=await v.from("event_tickets").insert(i).select();if(w)throw w;for(const[x,k]of Object.entries(m))if(k>0){const{data:_}=await v.from("ticket_types").select("available_quantity").eq("id",x).single();_&&await v.from("ticket_types").update({available_quantity:_.available_quantity-k}).eq("id",x)}return g},onSuccess:()=>{o({title:"Tickets Purchased Successfully!",description:`${K()} ticket(s) purchased successfully.`}),I({}),P(""),R(!1),p(!1),j.invalidateQueries({queryKey:["my-tickets"]})},onError:s=>{s.message.includes("full name, email, and phone")&&p(!0),o({title:"Purchase Failed",description:s.message||"Failed to purchase tickets",variant:"destructive"})}}),me=ie({mutationFn:async s=>{const{error:l}=await v.from("event_tickets").delete().eq("id",s);if(l)throw l},onSuccess:()=>{o({title:"Ticket deleted",description:"The ticket has been successfully removed."}),j.invalidateQueries({queryKey:["my-tickets"]})},onError:s=>{console.error("Delete error:",s),o({title:"Error deleting ticket",description:s.message||"Please try again later.",variant:"destructive"})}}),xe=s=>{window.confirm("Are you sure you want to delete this ticket? This action cannot be undone.")&&me.mutate(s)},he=(s,l)=>{I(i=>({...i,[s]:Math.max(0,l)}))},te=()=>n!=null&&n.ticketTypes?n.ticketTypes.reduce((s,l)=>{const i=m[l.id]||0;return s+l.price*i},0):0,K=()=>Object.values(m).reduce((s,l)=>s+l,0),ue=()=>{if(!T.trim()){o({title:"URL Required",description:"Please enter a valid ticket purchase URL",variant:"destructive"});return}const s=E(T);if(!s){o({title:"Invalid URL",description:"Please enter a valid ticket purchase URL",variant:"destructive"});return}window.location.href=`/buy-tickets/${s}`},pe=()=>{if(!c.fullName.trim()||!c.email.trim()||!c.phone.trim()){p(!0);return}U.mutate()},ae=s=>{z(s),L(!0)},fe=()=>{L(!1),z(null)},F=s=>new Date(s).toLocaleDateString("en-US",{weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),le=(()=>{const s=new Date;switch(r){case"upcoming":return d.filter(l=>{var i;return((i=l.events)==null?void 0:i.start_time)&&new Date(l.events.start_time)>s});case"past":return d.filter(l=>{var i;return((i=l.events)==null?void 0:i.end_time)&&new Date(l.events.end_time)<s});case"checked-in":return d.filter(l=>l.check_in_status);default:return d}})();return e.jsx("div",{className:"min-h-screen bg-background",children:e.jsxs("div",{className:"container mx-auto px-4 py-6 max-w-4xl",children:[e.jsxs("div",{className:"flex flex-col space-y-6 mb-8",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"flex items-center justify-center w-12 h-12 bg-primary rounded-2xl",children:e.jsx(D,{className:"h-6 w-6 text-primary-foreground"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold tracking-tight",children:"Tickets"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage and view your event tickets"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-card border rounded-xl p-4",children:[e.jsx("div",{className:"text-2xl font-bold text-foreground",children:d.length}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Total"})]}),e.jsxs("div",{className:"bg-card border rounded-xl p-4",children:[e.jsx("div",{className:"text-2xl font-bold text-green-600",children:d.filter(s=>{var l;return((l=s.events)==null?void 0:l.start_time)&&new Date(s.events.start_time)>new Date}).length}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Upcoming"})]}),e.jsxs("div",{className:"bg-card border rounded-xl p-4",children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600",children:d.filter(s=>s.check_in_status).length}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Checked In"})]}),e.jsxs("div",{className:"bg-card border rounded-xl p-4",children:[e.jsx("div",{className:"text-2xl font-bold text-orange-600",children:d.filter(s=>{var l;return((l=s.events)==null?void 0:l.end_time)&&new Date(s.events.end_time)<new Date}).length}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Past"})]})]}),e.jsx("div",{className:"flex space-x-2 p-1 bg-muted rounded-lg overflow-x-auto",children:[{key:"all",label:"All Tickets"},{key:"upcoming",label:"Upcoming"},{key:"past",label:"Past"},{key:"checked-in",label:"Checked In"}].map(s=>e.jsx("button",{onClick:()=>t(s.key),className:`px-4 py-2 rounded-md text-sm font-medium transition-colors whitespace-nowrap ${r===s.key?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:s.label},s.key))})]}),e.jsx("div",{className:"space-y-4",children:S?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):le.length===0?e.jsxs("div",{className:"text-center py-12 space-y-4",children:[e.jsx("div",{className:"w-16 h-16 bg-muted rounded-full flex items-center justify-center mx-auto",children:e.jsx(D,{className:"h-8 w-8 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No tickets found"}),e.jsx("p",{className:"text-muted-foreground",children:r==="all"?"You haven't purchased any tickets yet.":`No ${r.replace("-"," ")} tickets.`})]}),e.jsxs(h,{onClick:()=>P(""),variant:"outline",className:"mt-4",children:[e.jsx(ee,{className:"h-4 w-4 mr-2"}),"Purchase Tickets"]})]}):le.map(s=>{var l,i,g,w;return e.jsx(b,{className:"border hover:shadow-md transition-shadow",children:e.jsx(y,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between space-y-3 sm:space-y-0",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-lg font-semibold line-clamp-1",children:((l=s.events)==null?void 0:l.name)||"Unknown Event"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx($,{variant:"secondary",children:((i=s.ticket_types)==null?void 0:i.name)||"Unknown Ticket Type"}),e.jsx($,{variant:s.check_in_status?"default":"outline",className:s.check_in_status?"bg-green-100 text-green-800 border-green-200":"",children:s.check_in_status?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(V,{className:"h-3 w-3"}),"Checked In"]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(W,{className:"h-3 w-3"}),"Not Checked In"]})})]})]}),e.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[e.jsxs(h,{onClick:()=>ae(s),size:"sm",className:"flex-1 sm:flex-none",children:[e.jsx(de,{className:"h-4 w-4 mr-2"}),"View QR Code"]}),e.jsx(h,{onClick:()=>xe(s.id),size:"sm",variant:"destructive",className:"px-3",children:e.jsx(Te,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(H,{className:"h-4 w-4"}),e.jsx("span",{children:(g=s.events)!=null&&g.start_time?F(s.events.start_time):"Unknown Date"})]}),((w=s.events)==null?void 0:w.location)&&e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(X,{className:"h-4 w-4"}),e.jsx("span",{className:"line-clamp-1",children:s.events.location})]}),e.jsx("div",{className:"flex items-center gap-2 text-muted-foreground",children:e.jsxs("span",{className:"font-medium",children:["#",s.ticket_number]})})]}),s.guest_name&&e.jsx("div",{className:"bg-muted/30 rounded-lg p-3",children:e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:"Guest:"})," ",s.guest_name]})})]})})},s.id)})}),e.jsxs(b,{className:"mt-8",children:[e.jsxs(B,{children:[e.jsxs(G,{className:"flex items-center gap-2",children:[e.jsx(oe,{className:"h-5 w-5"}),"Purchase New Tickets"]}),e.jsx(Z,{children:"Enter a ticket purchase URL to buy tickets for a new event"})]}),e.jsx(y,{className:"space-y-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsx(A,{placeholder:"Paste event ticket URL here...",value:T,onChange:s=>P(s.target.value),className:"flex-1"}),e.jsxs(h,{onClick:ue,disabled:!T.trim(),className:"w-full sm:w-auto",children:[e.jsx(ee,{className:"h-4 w-4 mr-2"}),"Purchase Tickets"]})]})})]}),C&&e.jsxs(b,{className:"mt-8 border-amber-200 bg-amber-50",children:[e.jsxs(B,{className:"bg-amber-100 rounded-t-lg",children:[e.jsxs(G,{className:"flex items-center gap-2 text-amber-800",children:[e.jsx(ce,{className:"h-5 w-5"}),"Complete Your Information"]}),e.jsx(Z,{className:"text-amber-700",children:"Please provide your information before purchasing tickets."})]}),e.jsxs(y,{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(Y,{htmlFor:"fullName",className:"text-sm font-medium",children:"Full Name *"}),e.jsx(A,{id:"fullName",value:c.fullName,onChange:s=>u(l=>({...l,fullName:s.target.value})),placeholder:"Enter your full name",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx(Y,{htmlFor:"phone",className:"text-sm font-medium",children:"Phone Number *"}),e.jsx(A,{id:"phone",value:c.phone,onChange:s=>u(l=>({...l,phone:s.target.value})),placeholder:"Enter your phone number",className:"mt-1"})]})]}),e.jsxs("div",{children:[e.jsx(Y,{htmlFor:"email",className:"text-sm font-medium",children:"Email *"}),e.jsx(A,{id:"email",type:"email",value:c.email,onChange:s=>u(l=>({...l,email:s.target.value})),placeholder:"Enter your email",className:"mt-1"})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx(h,{onClick:()=>{c.fullName.trim()&&c.email.trim()&&c.phone.trim()?(p(!1),U.mutate()):o({title:"Information Required",description:"Please fill in all required fields.",variant:"destructive"})},disabled:U.isPending,className:"bg-gradient-to-r from-purple-500 to-purple-600 hover:from-purple-600 hover:to-purple-700",children:U.isPending?"Processing...":"Continue with Purchase"}),e.jsx(h,{variant:"outline",onClick:()=>p(!1),children:"Cancel"})]})]})]}),M&&n&&e.jsxs(b,{className:"mb-8 border border-purple-200 shadow-xl overflow-hidden",children:[e.jsx("div",{className:"bg-gradient-to-r from-purple-500 to-purple-600 p-6 text-white",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"bg-white/20 p-3 rounded-xl",children:e.jsx(_e,{className:"h-8 w-8"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:n.event.name}),e.jsx("p",{className:"text-purple-100 mt-1",children:n.event.description})]})]})}),e.jsxs(y,{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 bg-gradient-to-r from-purple-50 to-purple-100 rounded-xl border border-purple-200",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-purple-100 p-2 rounded-lg",children:e.jsx(H,{className:"h-5 w-5 text-purple-600"})}),e.jsx("span",{className:"font-medium",children:F(n.event.start_time)})]}),n.event.location&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-purple-100 p-2 rounded-lg",children:e.jsx(X,{className:"h-5 w-5 text-purple-600"})}),e.jsx("span",{className:"font-medium",children:n.event.location})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"text-xl font-bold text-gray-800 flex items-center gap-2",children:[e.jsx(D,{className:"h-5 w-5 text-purple-600"}),"Available Tickets"]}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:n.ticketTypes.map(s=>e.jsx(b,{className:"border-2 border-purple-100 hover:border-purple-300 transition-all duration-300 hover:shadow-lg",children:e.jsxs(y,{className:"p-5",children:[e.jsxs("div",{className:"flex justify-between items-start mb-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-bold text-lg text-gray-800",children:s.name}),s.description&&e.jsx("p",{className:"text-gray-600 text-sm mt-1",children:s.description})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"text-2xl font-bold text-purple-600",children:["₦",(s.price/100).toLocaleStr
15ing()]}),e.jsxs($,{variant:"outline",className:"mt-1 border-purple-200 text-purple-700",children:[s.available_quantity," left"]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Y,{htmlFor:`quantity-${s.id}`,className:"font-medium",children:"Quantity:"}),e.jsx(A,{id:`quantity-${s.id}`,type:"number",min:"0",max:s.available_quantity,value:m[s.id]||0,onChange:l=>he(s.id,parseInt(l.target.value)||0),className:"w-24 text-center border-purple-200 focus:border-purple-400"})]})]})},s.id))})]}),K()>0&&e.jsx(b,{className:"border-2 border-purple-200 bg-gradient-to-r from-purple-50 to-purple-100",children:e.jsxs(y,{className:"p-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("span",{className:"text-lg font-bold text-purple-900",children:["Total: ",K()," ticket",K()!==1?"s":""]}),e.jsxs("span",{className:"text-2xl font-bold text-purple-600",children:["₦",te().toLocaleString()]})]}),e.jsx(h,{onClick:pe,disabled:U.isPending,className:"w-full h-12 text-lg bg-gradient-to-r from-purple-500 to-purple-600 hover:from-purple-600 hover:to-purple-700 shadow-lg",children:U.isPending?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Processing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"h-5 w-5 mr-2"}),"Purchase Tickets"]})})]})})]})]}),e.jsxs(b,{className:"border border-purple-200 shadow-xl bg-white",children:[e.jsxs(B,{className:"bg-gradient-to-r from-purple-500 to-purple-600 text-white rounded-t-lg",children:[e.jsxs(G,{className:"flex items-center gap-3 text-xl",children:[e.jsx("div",{className:"bg-white/20 p-2 rounded-lg",children:e.jsx(D,{className:"h-6 w-6"})}),"My Ticket Collection (",d.length,")"]}),e.jsx(Z,{className:"text-purple-100",children:"View, manage, and access your event tickets"})]}),e.jsx(y,{className:"p-6",children:S?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-purple-600 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600 text-lg",children:"Loading your amazing tickets..."})]}):d.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"bg-gradient-to-br from-purple-100 to-indigo-100 w-24 h-24 rounded-full flex items-center justify-center mx-auto mb-6",children:e.jsx(D,{className:"h-12 w-12 text-purple-600"})}),e.jsx("h3",{className:"text-xl font-bold text-gray-800 mb-2",children:"No Tickets Yet"}),e.jsx("p",{className:"text-gray-600 mb-6",children:"Start your journey by purchasing tickets to exciting events!"}),e.jsxs(h,{onClick:()=>{var s;return(s=document.querySelector('input[placeholder*="Paste"]'))==null?void 0:s.focus()},className:"bg-gradient-to-r from-purple-500 to-purple-600 hover:from-purple-600 hover:to-purple-700",children:[e.jsx(ee,{className:"h-4 w-4 mr-2"}),"Get Your First Ticket"]})]}):e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:d.map((s,l)=>{var i,g,w,x;return e.jsx(b,{className:"group hover:shadow-xl transition-all duration-300 border-2 border-gray-100 hover:border-purple-200 animate-fade-in",style:{animationDelay:`${l*.1}s`},children:e.jsxs(y,{className:"p-6",children:[e.jsxs("div",{className:"flex justify-between items-start mb-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-bold text-lg text-gray-800 group-hover:text-purple-700 transition-colors",children:(i=s.events)==null?void 0:i.name}),e.jsx("p",{className:"text-purple-600 font-medium",children:((g=s.ticket_types)==null?void 0:g.name)||"Unknown Ticket Type"}),e.jsxs("p",{className:"text-xs text-gray-500 font-mono bg-gray-100 px-2 py-1 rounded mt-1 inline-block",children:["#",s.ticket_number]}),s.guest_name&&e.jsxs("p",{className:"text-sm font-medium text-indigo-700 mt-1 flex items-center gap-1",children:[e.jsx(ce,{className:"h-3 w-3"}),s.guest_name]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"text-xl font-bold text-gray-800",children:["₦",(s.price/100).toLocaleStr
15ing()]}),e.jsx($,{variant:s.check_in_status?"default":"secondary",className:s.check_in_status?"bg-gradient-to-r from-green-500 to-emerald-600 text-white shadow-md":"bg-gray-100 text-gray-600",children:s.check_in_status?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(V,{className:"h-3 w-3"}),"Checked In"]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(W,{className:"h-3 w-3"}),"Pending"]})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-2 text-sm text-gray-600 mb-4 bg-gray-50 p-3 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-4 w-4 text-purple-500"}),e.jsx("span",{className:"font-medium",children:(w=s.events)!=null&&w.start_time?F(s.events.start_time):"Unknown Date"})]}),((x=s.events)==null?void 0:x.location)&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(X,{className:"h-4 w-4 text-indigo-500"}),e.jsx("span",{children:s.events.location})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{className:"h-4 w-4 text-gray-400"}),e.jsxs("span",{children:["Purchased: ",F(s.purchase_date)]})]}),s.checked_in_at&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-4 w-4 text-green-500"}),e.jsxs("span",{children:["Checked in: ",F(s.checked_in_at)]})]})]}),e.jsxs(h,{variant:"outline",onClick:()=>ae(s),className:"w-full border-purple-200 text-purple-700 hover:bg-purple-50 hover:border-purple-300 transition-all duration-300",children:[e.jsx(de,{className:"h-4 w-4 mr-2"}),"View QR Code"]})]})},s.id)})})})]}),e.jsx(Se,{isOpen:J,onClose:fe,ticket:O})]})})}export{Qe 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.