Pick sessions (frontend), roadmap and handover docs
Event wizard: how people book (whole course / pick sessions), capacity per session and per-option session mode. Session picker on the public registration page, Manual registration and the kiosk; at the door points to Manual registration. Register, tickets and My Events handle picked sessions. Adds docs/ROADMAP-v2.md and docs/HANDOVER.md so work can carry on from another machine, and a pick-sessions e2e test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,7 @@ import { errorMessage } from "@/lib/utils";
|
||||
import { registrationOptionUnitPrice } from "@/lib/pricing";
|
||||
import { BundleSavings } from "@/components/shared/BundleDeals";
|
||||
import { MyCertificates } from "@/components/events/MyCertificates";
|
||||
import { isPickOption } from "@/lib/sessions";
|
||||
import type { Event, EventOption, Payment, Registration, RegistrationOption, Ticket as TicketRecord } from "@/types";
|
||||
|
||||
// Helper formatters
|
||||
@@ -484,8 +485,13 @@ export default function UserDashboardPage() {
|
||||
return !isEventOver(activeReg.event);
|
||||
}, [activeReg]);
|
||||
|
||||
// Picked-session lines can't be edited here (book more by registering), but still count.
|
||||
const pickedLinesTotal = useMemo(() => (activeReg?.registrationOptions || [])
|
||||
.filter(ro => ro.sessionId)
|
||||
.reduce((s, ro) => s + (ro.lineTotal ?? (ro.quantity || 0) * (ro.priceSnapshot || 0)), 0), [activeReg]);
|
||||
|
||||
const editTotal = useMemo(() => {
|
||||
return editEventOptions.reduce((sum, eo) => {
|
||||
return pickedLinesTotal + editEventOptions.reduce((sum, eo) => {
|
||||
if (Array.isArray(eo.variants) && eo.variants.length > 0) {
|
||||
return sum + eo.variants.reduce((vsum, v) => {
|
||||
const qty = editQuantities[`${eo.id}:${v.id}`] || 0;
|
||||
@@ -494,7 +500,7 @@ export default function UserDashboardPage() {
|
||||
}
|
||||
return sum + (editQuantities[eo.id] || 0) * effectiveEventOptionUnitPrice(eo, null);
|
||||
}, 0);
|
||||
}, [editEventOptions, editQuantities]);
|
||||
}, [editEventOptions, editQuantities, pickedLinesTotal]);
|
||||
|
||||
const beginEdit = async () => {
|
||||
if (!activeReg || !token) return;
|
||||
@@ -503,13 +509,13 @@ export default function UserDashboardPage() {
|
||||
try {
|
||||
// Load event options (with variants) for this event
|
||||
const eventData = await apiFetch<Event>(`/api/events/${encodeURIComponent(activeReg.eventId)}`);
|
||||
const eventOptions = eventData?.eventOptions || [];
|
||||
const eventOptions = (eventData?.eventOptions || []).filter((eo) => !isPickOption(eventData, eo));
|
||||
|
||||
const regOptById = new Map<string, RegistrationOption>((activeReg.registrationOptions || []).map((o) => [o.id, o]));
|
||||
|
||||
// Prefill quantities from the current registration
|
||||
const qtyMap: Record<string, number> = {};
|
||||
for (const ro of (activeReg.registrationOptions || [])) {
|
||||
for (const ro of (activeReg.registrationOptions || []).filter(r => !r.sessionId)) {
|
||||
const key = ro.variantId ? `${ro.eventOptionId}:${ro.variantId}` : ro.eventOptionId;
|
||||
qtyMap[key] = (qtyMap[key] || 0) + (ro.quantity || 0);
|
||||
}
|
||||
@@ -519,7 +525,7 @@ export default function UserDashboardPage() {
|
||||
const minQtyMap: Record<string, number> = {};
|
||||
for (const t of tickets) {
|
||||
const ro = t.registrationOptionId ? regOptById.get(t.registrationOptionId) : undefined;
|
||||
if (!ro) continue;
|
||||
if (!ro || ro.sessionId) continue;
|
||||
const key = ro.variantId ? `${ro.eventOptionId}:${ro.variantId}` : ro.eventOptionId;
|
||||
minQtyMap[key] = (minQtyMap[key] || 0) + (t.quantity || 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user