PageSourceSearch

https://eliteweddingsandeventswithcara.com/assets/ExhibitorBooking-D1DDaqFV.js

js eliteweddingsandeventswithcara.com collected 2026-09-30 06:37:09 UTC 12,488 bytes, 1 lines download raw bytes

1import{a0 as ae,a1 as re,r as n,D as N,s as g,j as e,J as ne,N as ie,C as J,d as K,B as w,z as V,e as oe,m as Y,a as le,b as ce,a3 as de,f as me,M as xe,U as ue,L as f,I as v,y as pe,i as he,Y as ge,u as m}from"./index-DaxYHL_c.js";import{B as fe}from"./badge-BgIO1kHT.js";import{T as H}from"./textarea-ClQoQ89_.js";import{C as be}from"./checkbox-rvsf6R6_.js";import{D as je,a as ye,b as Ne,c as we,f as ve}from"./dialog-DeLki9hm.js";import{E as ke}from"./exhibitorTerms-C8WdlFuT.js";import{L as _e}from"./lock-DPqnL3Iu.js";import{C as Ce}from"./clock-1P3HsIwi.js";import"./index-DH87JRKS.js";const Me=()=>{const{user:a,loading:R}=ae(),Q=re(),[l,D]=n.useState(null),[k,L]=n.useState(""),[x,U]=n.useState("book"),[B,_]=n.useState(!1),[b,P]=n.useState(""),[j,W]=n.useState(""),[y,C]=n.useState(""),[S,q]=n.useState(""),[T,G]=n.useState(""),[A,X]=n.useState(""),[E,M]=n.useState(!1),{data:i,isLoading:Z}=N({queryKey:["exhibitor-shows"],queryFn:async()=>{const{data:s,error:t}=await g.from("exhibitor_shows").select("*").eq("is_published",!0).gte("event_date",new Date().toISOString().slice(0,10)).order("event_date",{ascending:!0});if(t)throw t;return s??[]}}),{data:ee}=N({queryKey:["exhibitor-categories"],queryFn:async()=>{const{data:s,error:t}=await g.from("categories").select("name").order("name");if(t)throw t;return(s??[]).map(r=>r.name)}}),{data:F}=N({queryKey:["exhibitor-usage",i==null?void 0:i.map(s=>s.id).join(",")],enabled:!!(i!=null&&i.length),queryFn:async()=>{const s={};for(const t of i){const{data:r}=await g.rpc("get_show_category_usage",{_show_id:t.id});s[t.id]=Object.fromEntries((r??[]).map(c=>[c.category,Number(c.taken)]))}return s}}),{data:o}=N({queryKey:["exhibitor-supplier",a==null?void 0:a.id],enabled:!!a,queryFn:async()=>{const{data:s}=await g.rpc("get_supplier_contacts");return(s??[]).find(r=>r.owner_user_id===a.id)??null}}),u=((o==null?void 0:o.membership_type)??"free").toLowerCase(),p=u==="elite"?20:u==="standard"?10:0;n.useEffect(()=>{o?(P(s=>s||o.name||""),C(s=>s||o.email||(a==null?void 0:a.email)||""),q(s=>s||o.phone||"")):a!=null&&a.email&&C(s=>s||a.email)},[o,a]);const se=s=>{const t=Date.now();return s.booking_closes_at&&new Date(s.booking_closes_at).getTime()<t?{open:!1,reason:"Bookings for this showcase have closed."}:u==="elite"?new Date(s.elite_open_at).getTime()>t?{open:!1,reason:"Elite booking opens soon."}:{open:!0,reason:""}:new Date(s.general_open_at).getTime()>t?{open:!1,reason:`Elite Vow Collective members book first. General booking opens ${new Date(s.general_open_at).toLocaleDateString("en-GB",{weekday:"long",day:"numeric",month:"long"})}.`}:{open:!0,reason:""}},O=(s,t,r)=>{D(s),L(t),U(r),M(!1)},I=()=>{D(null),L("")},$=n.useMemo(()=>l?Math.round(Number(l.fee)*(1-p/100)*100)/100:0,[l,p]),te=async()=>{var s;if(!(!l||!a)){if(b.trim().length<2)return m.error("Please enter your business name.");if(j.trim().length<2)return m.error("Please enter a contact name.");if(!y.trim())return m.error("Please enter an email address.");_(!0);try{if(x==="waitlist"){const{error:c}=await g.from("exhibitor_waitlist").insert({show_id:l.id,category:k,supplier_id:(o==null?void 0:o.id)??null,user_id:a.id,business_name:b.trim(),contact_name:j.trim(),email:y.trim(),phone:S.trim()||null});if(c)if(c.code==="23505")m.success("You're already on the waiting list for this category.");else throw c;else m.success("You're on the waiting list — we'll email you if a space frees up.");I();return}if(!E)return _(!1),m.error("Please tick to agree to the booking terms and conditions.");const{data:t,error:r}=await g.functions.invoke("create-exhibitor-checkout",{body:{showSlug:l.slug,category:k,businessName:b.trim(),contactName:j.trim(),email:y.trim(),phone:S.trim(),specialOffer:T.trim(),notes:A.trim(),termsAccepted:!0}});if(r){const c=typeof((s=r==null?void 0:r.context)==null?void 0:s.text)=="function"?await r.context.text():r.message;let d="We couldn't start your payment. Please try again.";try{const h=JSON.parse(c);h!=null&&h.error&&(d=h.error)}catch{}throw new Error(d)}if(t!=null&&t.url)window.location.href=t.url;else throw new Error("No checkout link was returned.")}catch(t){m.error(t.message??"Something went wrong.")}finally{_(!1),Q.invalidateQueries({queryKey:["exhibitor-usage"]})}}};return e.jsxs(e.Fragment,{children:[e.jsxs(ne,{children:[e.jsx("title",{children:"Book an Exhibitor Space | Elite Weddings & Events"}),e.jsx("meta",{name:"description",content:"Book and pay for your exhibitor space at our venue-led wedding showcases. Just 3 suppliers per category, with priority booking for Elite Vow Collective members."})]}),e.jsx(ie,{}),e.jsxs("main",{className:"min-h-screen bg-gradient-to-b from-background to-muted/30",children:[e.jsx("section",{className:"bg-secondary py-14",children:e.jsxs("div",{className:"container mx-auto px-4 text-center",children:[e.jsx("span",{className:"inline-block bg-gold/15 text-gold text-xs font-bold uppercase tracking-widest px-4 py-1.5 rounded-full mb-4",children:"Exhibitor Booking"}),e.jsx("h1",{className:"font-display text-4xl md:text-5xl text-secondary-foreground mb-3",children:"Book Your Space at a Showcase"}
1),e.jsx("p",{className:"text-secondary-foreground/80 max-w-2xl mx-auto",children:"Venue-led showcases with a maximum of three suppliers per category. Pay online and your space is confirmed straight away — Elite Vow Collective members book first."})]})}),e.jsx("section",{className:"py-12",children:e.jsxs("div",{className:"container max-w-5xl mx-auto px-4",children:[!R&&!a&&e.jsx(J,{className:"mb-8 border-primary/40",children:e.jsxs(K,{className:"py-6 flex flex-col sm:flex-row items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_e,{className:"w-5 h-5 text-primary"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Sign in to your supplier account to book a space — your member discount is applied automatically."})]}),e.jsx(w,{asChild:!0,children:e.jsx(V,{to:"/supplier-auth",children:"Sign in / Register"})})]})}),a&&e.jsxs("div",{className:"mb-8 flex flex-wrap items-center gap-3",children:[e.jsxs(fe,{variant:"outline",className:"border-gold/50 text-foreground",children:[e.jsx(oe,{className:"w-3 h-3 mr-1 text-gold"}),u==="elite"?"Elite Vow Collective — 20% off":u==="standard"?"Standard member — 10% off":"Free member — full price"]}),u==="free"&&e.jsx(V,{to:"/upgrade",className:"text-sm text-primary underline",children:"Upgrade to save on every space"})]}),Z?e.jsx("div",{className:"flex justify-center py-16",children:e.jsx(Y,{className:"w-6 h-6 animate-spin text-primary"})}):i!=null&&i.length?e.jsx("div",{className:"space-y-8",children:i.map(s=>{const t=se(s),r=(F==null?void 0:F[s.id])??{},c=Math.round(Number(s.fee)*(1-p/100)*100)/100;return e.jsxs(J,{id:s.slug,children:[e.jsx(le,{children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(ce,{className:"font-display text-2xl",children:s.name}),e.jsxs(de,{className:"mt-2 flex flex-wrap gap-4 text-sm",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(me,{className:"w-4 h-4 text-primary"}),s.date_label??s.event_date]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Ce,{className:"w-4 h-4 text-primary"}),s.time_label]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(xe,{className:"w-4 h-4 text-primary"}),s.venue,s.location?`, ${s.location}`:""]})]})]}),e.jsxs("div",{className:"text-right",children:[p>0&&e.jsxs("p",{className:"text-sm line-through text-muted-foreground",children:["£",Number(s.fee).toFixed(2).replace(/\.00$/,"")]}),e.jsxs("p",{className:"text-3xl font-bold text-primary",children:["£",c.toFixed(2).replace(/\.00$/,"")]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"per space"})]})]})}),e.jsxs(K,{children:[!t.open&&e.jsx("div",{className:"mb-5 rounded-lg border border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-800 p-3",children:e.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-200 font-medium",children:t.reason})}),e.jsxs("p",{className:"text-sm font-semibold mb-3 flex items-center gap-2",children:[e.jsx(ue,{className:"w-4 h-4 text-primary"}),"Categories"]}),e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-2",children:(ee??[]).map(d=>{const h=r[d]??0,z=Math.max(s.spaces_per_category-h,0)===0;return e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border p-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:d}),z&&e.jsx("p",{className:"text-xs text-destructive",children:"Fully booked"})]}),z?e.jsx(w,{size:"sm",variant:"outline",disabled:!a,onClick:()=>O(s,d,"waitlist"),children:"Waiting list"}):e.jsx(w,{size:"sm",disabled:!a||!t.open,onClick:()=>O(s,d,"book"),children:"Book"})]},d)})})]})]},s.id)})}):e.jsx("p",{className:"text-center text-muted-foreground py-16",children:"No showcases are open for exhibitor bookings just now — check back soon."})]})})]}),e.jsx(je,{open:!!l,onOpenChange:s=>!s&&I(),children:e.jsxs(ye,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsxs(Ne,{children:[e.jsx(we,{children:x==="book"?"Book your space":"Join the waiting list"}),e.jsxs(ve,{children:[k," · ",l==null?void 0:l.name]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"ex_business",children:"Business name *"}),e.jsx(v,{id:"ex_business",value:b,onChange:s=>P(s.target.value),maxLength:120})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"ex_contact",children:"Contact name *"}),e.jsx(v,{id:"ex_contact",value:j,onChange:s=>W(s.target.value),maxLength:120})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"ex_email",children:"Email *"}),e.jsx(v,{id:"ex_email",type:"email",value:y,onChange:s=>C(s.target.value),maxLength:255})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"ex_phone",children:"Phone"}),e.jsx(v,{id:"ex_phone",type:"tel",value:S,onChange:s=>q(s.target.value),maxLength:30})]})]}),x==="book"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"ex_offer",children:"Special offer or prize (optional)"}),e.jsx(H,{id:"ex_offer",value:T,onChange:s=>G(s.target.value),maxLength:500,placeholder:"e.g. 10% off bookings made on the day",className:"min-h-[70px]"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"ex_notes",children:"Anything else we should know? (optional)"}),e.jsx(H,{id:"ex_notes",value:A,onChange:s=>X(s.target.value),maxLength:500,className:"min-h-[70px]"})]}),e.jsxs("div",{className:"rounded-lg border p-3 bg-muted/30",children:[e.jsx("p",{className:"text-sm font-semibold mb-2",children:"Exhibitor terms & conditions"}),e.jsx(pe,{className:"h-40 pr-3",children:e.jsx("div",{className:"space-y-2",children:ke.map(s=>e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-foreground",children:s.heading}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.body})]},s.heading))})}
1),e.jsxs("label",{className:"flex items-start gap-2 mt-3 cursor-pointer",children:[e.jsx(be,{checked:E,onCheckedChange:s=>M(s===!0),className:"mt-0.5"}),e.jsx("span",{className:"text-sm",children:"I have read and agree to the booking terms and conditions."})]})]}),e.jsxs("div",{className:"rounded-lg border-2 border-primary bg-primary/10 p-3 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-sm",children:"Amount to pay today"}),p>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[p,"% member discount applied"]})]}),e.jsxs("p",{className:"text-2xl font-bold text-primary",children:["£",$.toFixed(2).replace(/\.00$/,"")]})]})]}),e.jsx(w,{className:"w-full",size:"lg",disabled:B||x==="book"&&!E,onClick:te,children:B?e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"w-4 h-4 mr-2 animate-spin"}),"Please wait…"]}):x==="book"?e.jsxs(e.Fragment,{children:[e.jsx(he,{className:"w-4 h-4 mr-2"}),"Pay £",$.toFixed(2).replace(/\.00$/,"")," & confirm"]}):"Join the waiting list"}),x==="book"&&e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Your space is held for 20 minutes while you pay. Payment is taken securely by Stripe."})]})]})}),e.jsx(ge,{})]})};export{Me 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.