Archived
Add multi-day events (frontend), attendance register and certificates
Event wizard: one date or multiple sessions with a repeat-pattern builder, and a new Attendance step (late joining and pricing, check-in window, session reminders, certificates with preview). Public pages show the schedule and late prices; the scanner picks today's session; new attendance register page, My Certificates, and a public verify page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,8 @@ import { useAuth } from "@/hooks/useAuth";
|
||||
import { apiFetch } from "@/lib/api";
|
||||
import { CouponCodeField, AppliedCoupon } from "@/components/shared/CouponCodeField";
|
||||
import { BundleBuilder, BundleOffers, BundleSavings, useBundleQuote } from "@/components/shared/BundleDeals";
|
||||
import type { PublicBundle } from "@/types";
|
||||
import type { EventSession, LateJoinInfo, PublicBundle } from "@/types";
|
||||
import { latePrice, registrationClosesAt } from "@/lib/sessions";
|
||||
import { AttendeeNamesEditor, AttendeeEntries, TicketDelivery, attendeesPayload, consentDetailsMissing } from "@/components/shared/AttendeeNamesEditor";
|
||||
import { JoinWaitlistButton } from "@/components/events/JoinWaitlistButton";
|
||||
import { analyticsSessionId } from "@/lib/analytics";
|
||||
@@ -52,8 +53,28 @@ export type RegisterEvent = {
|
||||
collectGender?: boolean;
|
||||
waitlistEnabled?: boolean;
|
||||
bundles?: PublicBundle[];
|
||||
scheduleType?: "single" | "sessions";
|
||||
sessions?: EventSession[];
|
||||
registrationClosesAt?: string;
|
||||
lateJoin?: LateJoinInfo | null;
|
||||
};
|
||||
|
||||
// Late joiners on a multi-day event: show main tickets at the late price (the server
|
||||
// charges the same — see backend utils/sessions.js).
|
||||
function withLatePrices(event: RegisterEvent): RegisterEvent {
|
||||
const late = event.lateJoin?.active ? event.lateJoin : null;
|
||||
if (!late) return event;
|
||||
return {
|
||||
...event,
|
||||
eventOptions: (event.eventOptions || []).map(o => (!o.isMainTicket ? o : {
|
||||
...o,
|
||||
price: latePrice(o.price, late),
|
||||
earlyBirdTiers: (o.earlyBirdTiers || []).map(t => ({ ...t, price: latePrice(t.price, late) })),
|
||||
variants: (o.variants || []).map(v => (v.price === null || v.price === undefined ? v : { ...v, price: latePrice(v.price, late) })),
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
type WaitlistOffer = { eventOptionId: string; variantId: string | null; quantity: number; expiresAt: string; optionName: string; variantName: string | null };
|
||||
|
||||
// Key format: "optionId" for no-variant options, "optionId:variantId" for variant options
|
||||
@@ -350,10 +371,11 @@ export default function RegisterForm({ event: baseEvent }: { event: RegisterEven
|
||||
.catch((e: unknown) => setOfferError(errorMessage(e) || "This waitlist link is not valid."));
|
||||
}, []);
|
||||
const event = useMemo<RegisterEvent>(() => {
|
||||
if (!offer) return baseEvent;
|
||||
const priced = withLatePrices(baseEvent);
|
||||
if (!offer) return priced;
|
||||
return {
|
||||
...baseEvent,
|
||||
eventOptions: (baseEvent.eventOptions || []).map(o => {
|
||||
...priced,
|
||||
eventOptions: (priced.eventOptions || []).map(o => {
|
||||
if (o.id !== offer.eventOptionId) return o;
|
||||
return {
|
||||
...o,
|
||||
@@ -400,11 +422,11 @@ export default function RegisterForm({ event: baseEvent }: { event: RegisterEven
|
||||
const now = new Date();
|
||||
const end = event.endDate ? new Date(event.endDate) : null;
|
||||
const deadline = event.registrationDeadline ? new Date(event.registrationDeadline) : null;
|
||||
if ((deadline && now >= deadline) || (end && now >= end)) {
|
||||
if ((deadline && now >= deadline) || (end && now >= end) || now >= registrationClosesAt(event)) {
|
||||
window.location.replace('/events');
|
||||
}
|
||||
} catch {}
|
||||
}, [event.endDate, event.registrationDeadline]);
|
||||
}, [event]);
|
||||
|
||||
const handleQtyChange = (key: string, val: number) => {
|
||||
setQuantities((q) => ({ ...q, [key]: val }));
|
||||
@@ -672,6 +694,12 @@ export default function RegisterForm({ event: baseEvent }: { event: RegisterEven
|
||||
</div>
|
||||
)}
|
||||
|
||||
{event.lateJoin?.active && (
|
||||
<div className="mt-4 p-3 rounded-lg bg-brand-50 border border-brand-200 text-sm text-brand-900">
|
||||
<strong>Joining late:</strong> {event.lateJoin.sessionsLeft} of {event.lateJoin.totalSessions} sessions are still to come, so main tickets are at the {event.lateJoin.mode === "prorata" ? "price for the sessions left" : "late-joiner price"}.
|
||||
</div>
|
||||
)}
|
||||
|
||||
{(() => {
|
||||
// Collect all upcoming early-bird tiers across all options
|
||||
const now = new Date();
|
||||
|
||||
Reference in New Issue
Block a user