1import{E as F,bh as B,r as n,j as e,bj as N,d as b,L as M,I as v,B as P,p as A,U as D,a as _,s as U}from"./index-BCH4IFx8.js";import{u as q}from"./useOrganizationSlug-DcRVJD25.js";import{A as z}from"./arrow-left-CX5CfIFs.js";import{S as k}from"./search-GvbQAZxx.js";import{C as w}from"./circle-x-CCb710d9.js";import{C as I}from"./calendar-BcfRHKCP.js";import{M as O}from"./map-pin-Eqsqtagn.js";import{C as R}from"./credit-card-DWFX6dPl.js";import{P as T}from"./package-DNqMdpAz.js";import{C as X}from"./clock-DEKHqbRJ.js";import{f as h}from"./format-ybceeo2k.js";import"./en-US-CGO0aXMi.js";const re=()=>{const{orgSlug:l}=F(),{data:H,isLoading:C}=q(l),{setOrganizationFromSlug:u,branding:m,contentColors:x}=B(),[c,S]=n.useState(""),[d,L]=n.useState(""),[s,j]=n.useState(null),[g,p]=n.useState(""),[f,y]=n.useState(!1);n.useEffect(()=>{l&&u(l)},[l,u]);const E=async a=>{if(a.preventDefault(),!(!c.trim()||!d.trim())){y(!0),p(""),j(null);try{const{data:r,error:o}=await U.functions.invoke("lookup-registration",{body:{confirmation_number:c.trim(),last_name:d.trim()}});if(o)throw o;r!=null&&r.error?p(r.error):j(r)}catch{p("Unable to look up registration. Please try again.")}finally{y(!1)}}},t=(m==null?void 0:m.primary_color)||"hsl(var(--primary))",i=x?{backgroundColor:x.cardBg,color:x.cardFg}:{},$=a=>{switch(a){case"confirmed":return e.jsx(_,{className:"h-5 w-5 text-green-500"});case"pending":return e.jsx(X,{className:"h-5 w-5 text-yellow-500"});default:return e.jsx(w,{className:"h-5 w-5 text-red-500"})}};return C?e.jsx(N,{children:e.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:e.jsx(b,{className:"h-8 w-8 animate-spin",style:{color:t}})})}):e.jsx(N,{children:e.jsx("div",{className:"min-h-[calc(100vh-5rem)] flex items-center justify-center",children:e.jsx("div",{className:"container px-4 py-16",children:e.jsxs("div",{className:"max-w-xl mx-auto space-y-8",children:[e.jsxs(M,{to:`/org/${l}`,className:"inline-flex items-center gap-2 text-sm opacity-70 hover:opacity-100 transition-opacity",children:[e.jsx(z,{className:"h-4 w-4"}),"Back to Home"]}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx(k,{className:"h-10 w-10 mx-auto",style:{color:t}}),e.jsx("h1",{className:"text-3xl font-display font-bold",children:"Look Up Registration"}),e.jsx("p",{className:"opacity-70",children:"Enter your confirmation number and last name to view your registration details."})]}),e.jsx("form",{onSubmit:E,className:"space-y-4",children:e.jsxs("div",{className:"p-6 rounded-xl border space-y-4",style:{...i,borderColor:"rgba(0,0,0,0.1)"},children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Confirmation Number"}),e.jsx(v,{value:c,onChange:a=>S(a.target.value.toUpperCase()),placeholder:"e.g. MX1A2B3C4D",required:!0,className:"uppercase"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:"Last Name"}),e.jsx(v,{value:d,onChange:a=>L(a.target.value),placeholder:"Enter your last name",required:!0})]}),e.jsx(P,{type:"submit",disabled:f||!c.trim()||!d.trim(),className:"w-full",style:{backgroundColor:t,color:"#fff"},children:f?e.jsxs(e.Fragment,{children:[e.jsx(b,{className:"h-4 w-4 animate-spin mr-2"})," Searching..."]}):e.jsxs(e.Fragment,{children:[e.jsx(k,{className:"h-4 w-4 mr-2"})," Look Up"]})})]})}),g&&e.jsxs("div",{className:"p-4 rounded-xl border text-center",style:{...i,borderColor:"rgba(0,0,0,0.1)"},children:[e.jsx(w,{className:"h-8 w-8 mx-auto mb-2 text-red-500"}),e.jsx("p",{className:"font-medium",children:g})]}),s&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-6 rounded-xl border space-y-3",style:{...i,borderColor:"rgba(0,0,0,0.1)"},children:[e.jsxs("h2",{className:"text-xl font-bold flex items-center gap-2",children:[e.jsx(I,{className:"h-5 w-5",style:{color:t}}),s.registration.events.name]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm opacity-70",children:[e.jsx(O,{className:"h-4 w-4"}),s.registration.events.venue_name?`${s.registration.events.venue_name} â ${s.registration.events.location}`:s.registration.events.location]}),e.jsx("div",{className:"text-sm opacity-70",children:h(A(s.registration.events.event_date),"EEEE, MMMM d, yyyy")})]}),e.jsxs("div",{className:"p-6 rounded-xl border space-y-4",style:{...i,borderColor:"rgba(0,0,0,0.1)"},children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"font-bold text-lg flex items-center gap-2",children:[e.jsx(D,{className:"h-5 w-5",style:{color:t}}),s.registration.first_name," ",s.registration.last_name]}),e.jsx("span",{className:"text-xs font-mono opacity-60",children:s.registration.confirmation_number})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"opacity-60 block",children:"Status"}),e.jsxs("span",{className:"flex items-center gap-1 capitalize font-medium",children:[$(s.registration.status),s.registration.status]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"opacity-60 block",children:"Payment"}),e.jsx("span",{className:"capitalize font-medium",children:s.registration.payment_status||"N/A"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"opacity-60 block",children:"Class"}),e.jsx("span",{className:"font-medium",children:s.registration.racing_class||"N/A"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"opacity-60 block",children:"Registered"}),e.jsx("span",{className:"font-medium",children:h(new Date(s.registration.created_at),"MMM d, yyyy")})]}),s.registration.bike_make&&e.jsxs("div",{className:"col-span-2",children:[e.jsx("span",{className:"opacity-60 block",children:"Bike"}),e.jsx("span",{className:"font-medium",children:[s.registration.bike_make,s.registration.bike_model,s.registration.bike_cc&&`${s.registration.bike_cc}
1cc`].filter(Boolean).join(" ")})]}),s.registration.checked_in&&e.jsx("div",{className:"col-span-2",children:e.jsxs("span",{className:"flex items-center gap-1 text-green-600 font-medium",children:[e.jsx(_,{className:"h-4 w-4"})," Checked In",s.registration.checked_in_at&&` â ${h(new Date(s.registration.checked_in_at),"h:mm a")}`]})})]})]}),s.registration.total_amount>0&&e.jsxs("div",{className:"p-6 rounded-xl border space-y-3",style:{...i,borderColor:"rgba(0,0,0,0.1)"},children:[e.jsxs("h3",{className:"font-bold text-lg flex items-center gap-2",children:[e.jsx(R,{className:"h-5 w-5",style:{color:t}}),"Order Summary"]}),e.jsxs("div",{className:"text-sm space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"opacity-70",children:"Subtotal"}),e.jsxs("span",{children:["$",s.registration.subtotal.toFixed(2)]})]}),(s.registration.fees_total??0)>0&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"opacity-70",children:"Fees"}),e.jsxs("span",{children:["$",(s.registration.fees_total??0).toFixed(2)]})]}),s.registration.tax_total>0&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"opacity-70",children:"Tax"}),e.jsxs("span",{children:["$",s.registration.tax_total.toFixed(2)]})]}),(s.registration.coupon_discount??0)>0&&e.jsxs("div",{className:"flex justify-between text-green-600",children:[e.jsx("span",{children:"Discount"}),e.jsxs("span",{children:["-$",(s.registration.coupon_discount??0).toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between font-bold border-t pt-1 mt-1",style:{borderColor:"rgba(0,0,0,0.1)"},children:[e.jsx("span",{children:"Total"}),e.jsxs("span",{children:["$",s.registration.total_amount.toFixed(2)]})]})]})]}),s.add_ons.length>0&&e.jsxs("div",{className:"p-6 rounded-xl border space-y-3",style:{...i,borderColor:"rgba(0,0,0,0.1)"},children:[e.jsxs("h3",{className:"font-bold text-lg flex items-center gap-2",children:[e.jsx(T,{className:"h-5 w-5",style:{color:t}}),"Add-Ons"]}),e.jsx("div",{className:"text-sm space-y-1",children:s.add_ons.map((a,r)=>{var o;return e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{children:[((o=a.add_ons)==null?void 0:o.name)||"Item",a.quantity>1&&` Ã${a.quantity}`]}),e.jsxs("span",{children:["$",(a.price_at_purchase*a.quantity).toFixed(2)]})]},r)})})]})]})]})})})})};export{re 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.