Session gaps: per-session waitlist, door session picker, all-sessions choice
- Waitlist per session: entries for pick-sessions tickets name a session; offers use that session's free places, never run past its start, and claim links tick it. Held offers count towards session capacity. - At the door: the Select items pop-up has the session picker, with today's session preselected for new attendees. - On pick-sessions events every ticket shows the session list straight away. "All sessions" tickets record the ticked sessions (RegistrationOption.sessionIds) at one price; scanning, attendance, certificates, reminders and capacity follow them. - Fix: per-session stock limits weren't enforced (takenCount filtered WaitlistEntry by a sessionId column that didn't exist, and the error was swallowed), and the public event page lost its stock info. - Fix: editing a door registration with picked sessions couldn't be saved. - Fix: the offline-scanning service worker served /_next/static cache-first forever, so dev browsers that had opened the scanner ran stale code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -46,6 +46,7 @@ export function JoinWaitlistButton({ eventId, lines, guestsAllowed, initialLine,
|
||||
eventId,
|
||||
eventOptionId: line.eventOptionId,
|
||||
...(line.variantId ? { variantId: line.variantId } : {}),
|
||||
...(line.sessionId ? { sessionId: line.sessionId } : {}),
|
||||
quantity: qty,
|
||||
...(!loggedIn ? { guestName: guest.name.trim(), guestEmail: guest.email.trim(), guestPhone: guest.phone.trim() || undefined } : {}),
|
||||
},
|
||||
@@ -124,5 +125,5 @@ export function JoinWaitlistButton({ eventId, lines, guestsAllowed, initialLine,
|
||||
}
|
||||
|
||||
function keyOf(l?: WaitlistLine) {
|
||||
return l ? `${l.eventOptionId}::${l.variantId || ""}` : "";
|
||||
return l ? `${l.eventOptionId}::${l.variantId || ""}::${l.sessionId || ""}` : "";
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
import React from "react";
|
||||
import type { Event } from "@/types";
|
||||
import { bookableSessions, formatSessionWhen, sessionLabel } from "@/lib/sessions";
|
||||
import { JoinWaitlistButton } from "@/components/events/JoinWaitlistButton";
|
||||
|
||||
// Tick boxes for the sessions of a "pick sessions" ticket. Full sessions (or ones with
|
||||
// fewer places than `quantity`) can't be ticked.
|
||||
export function SessionPicker({ event, option, selected, onChange, quantity = 1, staff = false, unitPrice }: {
|
||||
// fewer places than `quantity`) can't be ticked; with `waitlist`, they get a "Join
|
||||
// waitlist" button for that session instead.
|
||||
export function SessionPicker({ event, option, selected, onChange, quantity = 1, staff = false, unitPrice, waitlist }: {
|
||||
event: Pick<Event, "sessions">;
|
||||
option: { id: string; sessionAvailability?: Record<string, number> };
|
||||
selected: string[];
|
||||
@@ -14,6 +16,7 @@ export function SessionPicker({ event, option, selected, onChange, quantity = 1,
|
||||
quantity?: number;
|
||||
staff?: boolean;
|
||||
unitPrice?: number;
|
||||
waitlist?: { eventId: string; guestsAllowed: boolean; variantId?: string | null; label: string } | null;
|
||||
}) {
|
||||
const sessions = bookableSessions(event, option, staff);
|
||||
if (sessions.length === 0) return <p className="text-xs text-gray-500 mt-2">No sessions left to book.</p>;
|
||||
@@ -29,13 +32,20 @@ export function SessionPicker({ event, option, selected, onChange, quantity = 1,
|
||||
</div>
|
||||
{sessions.map(s => {
|
||||
const full = s.left !== null && s.left < Math.max(1, quantity);
|
||||
const name = sessionLabel(s, event.sessions);
|
||||
return (
|
||||
<label key={s.id} className={`flex items-center gap-2 rounded border px-2 py-1.5 text-sm ${full ? "bg-gray-50 text-gray-400" : selected.includes(s.id) ? "border-brand-300 bg-brand-50" : "hover:bg-gray-50"}`}>
|
||||
<input type="checkbox" disabled={full && !selected.includes(s.id)} checked={selected.includes(s.id)} onChange={() => toggle(s.id)} />
|
||||
<span className="font-medium">{sessionLabel(s, event.sessions)}</span>
|
||||
<span className="text-gray-500">{formatSessionWhen(s)}</span>
|
||||
<span className="ml-auto text-xs">{s.left === null ? "" : s.left <= 0 ? "Full" : `${s.left} left`}</span>
|
||||
</label>
|
||||
<div key={s.id} className={`flex items-center gap-2 rounded border px-2 py-1.5 text-sm ${full ? "bg-gray-50 text-gray-400" : selected.includes(s.id) ? "border-brand-300 bg-brand-50" : "hover:bg-gray-50"}`}>
|
||||
<label className="flex items-center gap-2 flex-1 min-w-0">
|
||||
<input type="checkbox" disabled={full && !selected.includes(s.id)} checked={selected.includes(s.id)} onChange={() => toggle(s.id)} />
|
||||
<span className="font-medium">{name}</span>
|
||||
<span className="text-gray-500">{formatSessionWhen(s)}</span>
|
||||
<span className="ml-auto text-xs">{s.left === null ? "" : s.left <= 0 ? "Full" : `${s.left} left`}</span>
|
||||
</label>
|
||||
{full && waitlist && !selected.includes(s.id) && (
|
||||
<JoinWaitlistButton compact eventId={waitlist.eventId} guestsAllowed={waitlist.guestsAllowed}
|
||||
lines={[{ eventOptionId: option.id, variantId: waitlist.variantId, sessionId: s.id, label: `${waitlist.label} — ${name}, ${formatSessionWhen(s)}` }]} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@ import React, { useCallback, useEffect, useState } from "react";
|
||||
import { ListChecks } from "lucide-react";
|
||||
import { apiFetch } from "@/lib/api";
|
||||
import { errorMessage } from "@/lib/utils";
|
||||
import { entryLineName } from "@/lib/waitlist";
|
||||
|
||||
type Entry = {
|
||||
id: string;
|
||||
@@ -14,6 +15,7 @@ type Entry = {
|
||||
event: { id: string; title: string; startDate: string };
|
||||
eventOption: { name: string };
|
||||
variant: { name: string } | null;
|
||||
session: { label: string | null; startsAt: string } | null;
|
||||
};
|
||||
|
||||
/** My Events: the waitlists I'm on, with Leave (and a note when a place is on offer). */
|
||||
@@ -46,7 +48,7 @@ export function MyWaitlists({ token, onMessage }: { token: string; onMessage: (m
|
||||
<li key={e.id} className="py-2 flex items-center justify-between gap-3 text-sm">
|
||||
<div>
|
||||
<div className="font-medium">{e.event.title}</div>
|
||||
<div className="text-xs text-gray-500">{e.quantity} × {e.eventOption.name}{e.variant ? ` (${e.variant.name})` : ""}</div>
|
||||
<div className="text-xs text-gray-500">{e.quantity} × {entryLineName(e)}</div>
|
||||
{e.status === "offered" ? (
|
||||
<div className="text-xs text-green-700 mt-0.5">
|
||||
{e.offeredQuantity} place(s) held for you until {e.offerExpiresAt ? new Date(e.offerExpiresAt).toLocaleString() : ""} — use the link we sent you to claim.
|
||||
|
||||
Reference in New Issue
Block a user