Season passes (1.47.3)

A pass sells a ticket at each of several events in a series for one
price. Supervisors set passes up on the Event series page (events and
ticket per event; fixed once sold). Buying on the series page registers
the buyer at every event at once with one checkout (free passes give
tickets straight away; Pay now if online payment isn't possible). The
price is split over the events in proportion to their normal prices:
each registration line is priced at its share and the webhook records
one Payment per event, so cashups stay per event. Pass registrations
aren't repriced, take no coupons and can't be edited. Migration
20261028150000_season_pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-28 11:19:58 +02:00
co-authored by Claude Opus 5.5
parent 24cd604b43
commit cf7d00bdf3
34 changed files with 1396 additions and 26 deletions
@@ -120,6 +120,7 @@ const ACTION_LABELS: Record<string, string> = {
series_created: "Event series created",
series_updated: "Event series changed",
series_deleted: "Event series deleted",
season_pass_changed: "Season pass created, changed or deleted",
};
interface AuditLogEntry {
@@ -9,6 +9,7 @@ import { apiFetch } from "@/lib/api";
import { errorMessage } from "@/lib/utils";
import { BackLink } from "@/components/shared/BackLink";
import { CampusBadge } from "@/components/shared/CampusFilter";
import { SeasonPassesPanel } from "@/components/series/SeasonPassesPanel";
import type { EventSeries } from "@/types";
type Draft = { id?: string; name: string; slug: string; description: string; picture: string };
@@ -184,6 +185,7 @@ export default function SeriesPage() {
<p className="text-[11px] text-gray-400 mt-1">{s.eventCount - s.events.length} more at other campuses.</p>
)}
</div>
{s.events.length > 0 && <SeasonPassesPanel seriesId={s.id} seriesSlug={s.slug} />}
</>
)}
</li>
@@ -7,16 +7,18 @@ import { EventCard } from "@/components/events/EventCard";
import { ApiImage } from "@/components/shared/ApiImage";
import { CampusBadge } from "@/components/shared/CampusFilter";
import { FollowSeriesButton } from "@/components/events/FollowSeriesButton";
import { SeasonPassOffers } from "@/components/series/SeasonPassOffers";
import { Suspense } from "react";
import { apiFetch, apiFetchListForPrerender, ApiError } from "@/lib/api";
import { formatDateTimeRange } from "@/lib/date";
import { ArrowLeft, CalendarX, Layers } from "lucide-react";
import type { Event as FullEvent } from "@/types";
import type { Event as FullEvent, SeasonPassView } from "@/types";
export const revalidate = 60;
type Event = React.ComponentProps<typeof EventCard>["event"] & { cashupStatus?: string; nextSession?: { startsAt: string } | null };
type PastEvent = { id: string; title: string; startDate: string; endDate: string; campus?: FullEvent["campus"] };
type Series = { id: string; name: string; slug: string; description: string | null; picture: string | null; past: PastEvent[] };
type Series = { id: string; name: string; slug: string; description: string | null; picture: string | null; past: PastEvent[]; passes?: SeasonPassView[] };
async function loadSeries(slug: string): Promise<Series | null> {
try {
@@ -69,6 +71,10 @@ export default async function SeriesPage({ params }: { params: Promise<{ slug: s
</div>
</div>
<Suspense fallback={null}>
<SeasonPassOffers slug={series.slug} passes={series.passes || []} />
</Suspense>
<h2 className="text-xl font-semibold text-gray-900 mb-4">Coming up</h2>
{upcoming.length === 0 ? (
<div className="text-center py-12 border rounded-xl bg-gray-50 mb-10">
@@ -0,0 +1,141 @@
"use client";
import React, { useCallback, useEffect, useState } from "react";
import { Ticket, CheckCircle2 } from "lucide-react";
import { useSearchParams } from "next/navigation";
import { useAuth } from "@/hooks/useAuth";
import { apiFetch } from "@/lib/api";
import { errorMessage } from "@/lib/utils";
import { formatDateTimeRange } from "@/lib/date";
import type { SeasonPassPurchase, SeasonPassView } from "@/types";
const rand = (n: number) => `R ${n.toFixed(2)}`;
type BuyResult = { purchaseId: string; total: number; paid: boolean; redirectUrl: string | null; message: string | null };
/**
* The season passes on a series page: what each includes and costs, Buy (registers you for every
* event on it, then one payment), and your own passes for this series with "Pay now" when unpaid.
*/
export function SeasonPassOffers({ slug, passes: initial }: { slug: string; passes: SeasonPassView[] }) {
const { user, token, loading } = useAuth();
const params = useSearchParams();
const [qty, setQty] = useState<Record<string, number>>({});
const [busy, setBusy] = useState<string | null>(null);
const [error, setError] = useState<string | null>(null);
const [notice, setNotice] = useState<string | null>(null);
const [mine, setMine] = useState<SeasonPassPurchase[]>([]);
// The page is cached for everyone; ask for the passes as they are now.
const [passes, setPasses] = useState<SeasonPassView[]>(initial);
useEffect(() => {
apiFetch<{ passes?: SeasonPassView[] }>(`/api/series/by-slug/${encodeURIComponent(slug)}`).then(s => setPasses(s.passes || [])).catch(() => {});
}, [slug]);
const loadMine = useCallback(async () => {
if (!token) return;
const list = await apiFetch<SeasonPassPurchase[]>("/api/season-passes/mine", { authToken: token }).catch(() => []);
setMine(list.filter(p => p.pass.series.slug === slug && p.status !== "cancelled"));
}, [token, slug]);
useEffect(() => { loadMine(); }, [loadMine]);
const returned = params.get("pass");
const go = (res: BuyResult | { redirectUrl: string | null; message: string | null }) => {
if (res.redirectUrl) { window.location.href = res.redirectUrl; return; }
setNotice(res.message || "Done.");
loadMine();
};
const buy = async (p: SeasonPassView) => {
setBusy(p.id); setError(null); setNotice(null);
try {
go(await apiFetch<BuyResult>(`/api/season-passes/${p.id}/buy`, { method: "POST", authToken: token || undefined, body: { quantity: qty[p.id] || 1 } }));
} catch (e) {
setError(errorMessage(e) || "Couldn't buy the pass");
} finally {
setBusy(null);
}
};
const pay = async (purchaseId: string) => {
setBusy(purchaseId); setError(null); setNotice(null);
try {
go(await apiFetch<{ redirectUrl: string | null; message: string | null }>(`/api/season-passes/purchases/${purchaseId}/checkout`, { method: "POST", authToken: token || undefined }));
} catch (e) {
setError(errorMessage(e) || "Couldn't start the payment");
} finally {
setBusy(null);
}
};
if (passes.length === 0 && mine.length === 0) return null;
return (
<section className="mb-10" data-testid="season-pass-offers">
<h2 className="text-xl font-semibold text-gray-900 mb-1 flex items-center gap-2"><Ticket className="w-5 h-5 text-brand-600" /> Season passes</h2>
<p className="text-sm text-gray-500 mb-4">One payment, a ticket for every event on the pass.</p>
{returned === "paid" && <div className="p-3 mb-3 border rounded bg-green-50 text-green-800 text-sm">Thank you! Your tickets are on their way by email once the payment comes through.</div>}
{(returned === "cancelled" || returned === "failed") && <div className="p-3 mb-3 border rounded bg-amber-50 text-amber-800 text-sm">The payment didn&apos;t go through. Your places are kept — use &quot;Pay now&quot; below to try again.</div>}
{notice && <div className="p-3 mb-3 border rounded bg-green-50 text-green-800 text-sm" role="status">{notice}</div>}
{error && <div className="p-3 mb-3 border rounded bg-red-50 text-red-700 text-sm">{error}</div>}
{mine.length > 0 && (
<div className="border rounded-xl bg-white p-4 mb-4" data-testid="my-passes">
<div className="text-sm font-medium text-gray-900 mb-2">Your passes</div>
<ul className="space-y-2">
{mine.map(m => (
<li key={m.id} className="flex flex-wrap items-center justify-between gap-2 text-sm">
<span>{m.quantity} × {m.pass.name} · {rand(m.total)} · {m.status === "paid" ? <span className="text-green-700 inline-flex items-center gap-1"><CheckCircle2 className="w-3.5 h-3.5" /> paid — tickets in My events</span> : <span className="text-amber-700">not paid yet</span>}</span>
{m.status === "pending" && (
<button type="button" disabled={busy === m.id} onClick={() => pay(m.id)} className="px-3 py-1.5 text-xs rounded bg-brand-600 text-white hover:bg-brand-700 disabled:opacity-50">Pay now</button>
)}
</li>
))}
</ul>
</div>
)}
<div className="grid gap-4 md:grid-cols-2">
{passes.map(p => (
<div key={p.id} className="border rounded-xl bg-white shadow-sm p-5" data-testid="season-pass-offer">
<div className="flex items-start justify-between gap-3">
<div>
<h3 className="font-semibold text-gray-900">{p.name}</h3>
{p.description && <p className="text-sm text-gray-600 mt-0.5">{p.description}</p>}
</div>
<div className="text-right shrink-0">
<div className="text-lg font-bold text-gray-900">{p.price === 0 ? "Free" : rand(p.price)}</div>
{p.saving > 0 && <div className="text-xs text-green-700">save {rand(p.saving)}</div>}
</div>
</div>
<ul className="mt-3 space-y-1 text-sm text-gray-700">
{p.items.map(i => (
<li key={i.id} className="flex justify-between gap-2">
<span className="min-w-0"><span className="font-medium">{i.eventTitle}</span> <span className="text-gray-500 text-xs">· {formatDateTimeRange(i.startDate, i.endDate)} · {i.ticket}</span></span>
</li>
))}
</ul>
<div className="mt-4">
{p.unavailable ? (
<p className="text-sm text-gray-500">{p.unavailable}</p>
) : loading ? null : !user ? (
<a href={`/login?redirect=/series/${slug}`} className="inline-block px-4 py-2 text-sm rounded-lg border bg-white hover:bg-gray-50">Log in to buy</a>
) : (
<div className="flex items-center gap-2">
<label className="text-sm text-gray-600 flex items-center gap-1.5">
How many
<select aria-label={`How many of ${p.name}`} className="border rounded px-2 py-1 text-sm" value={qty[p.id] || 1} onChange={e => setQty({ ...qty, [p.id]: Number(e.target.value) })}>
{Array.from({ length: 10 }, (_, k) => k + 1).map(n => <option key={n} value={n}>{n}</option>)}
</select>
</label>
<button type="button" disabled={busy === p.id} onClick={() => buy(p)} className="px-4 py-2 text-sm rounded-lg bg-brand-600 text-white hover:bg-brand-700 font-medium disabled:opacity-50">
{busy === p.id ? "Booking…" : p.price === 0 ? "Get the pass" : `Buy · ${rand(p.price * (qty[p.id] || 1))}`}
</button>
</div>
)}
</div>
</div>
))}
</div>
</section>
);
}
@@ -0,0 +1,207 @@
"use client";
import React, { useCallback, useEffect, useMemo, useState } from "react";
import { Ticket } from "lucide-react";
import { useAuth } from "@/hooks/useAuth";
import { apiFetch } from "@/lib/api";
import { errorMessage } from "@/lib/utils";
import type { Event, SeasonPassView } from "@/types";
type ItemDraft = { eventId: string; on: boolean; eventOptionId: string; variantId: string };
type Draft = { id?: string; name: string; description: string; price: string; saleEndsAt: string; isActive: boolean; items: ItemDraft[] };
const rand = (n: number) => `R ${n.toFixed(2)}`;
/** The staff-only kids and volunteer tickets aren't sold on a pass. */
const sellable = (ev: Event) => (ev.eventOptions || []).filter(o => o.id !== ev.kidsOptionId && o.id !== ev.volunteerOptionId && !(ev.attendanceMode === "pick" && o.sessionMode === "pick"));
/**
* A series' season passes on the Event series page: what's on each, sold so far, and a form to
* make or change one (events and price are fixed once someone has bought it).
*/
export function SeasonPassesPanel({ seriesId, seriesSlug }: { seriesId: string; seriesSlug: string }) {
const { token } = useAuth();
const [passes, setPasses] = useState<SeasonPassView[]>([]);
const [events, setEvents] = useState<Event[]>([]);
// The series' events have arrived (the pass form needs them before it can be saved).
const [loaded, setLoaded] = useState(false);
const [draft, setDraft] = useState<Draft | null>(null);
const [saving, setSaving] = useState(false);
const [error, setError] = useState<string | null>(null);
const load = useCallback(async () => {
if (!token) return;
const [p, all] = await Promise.all([
apiFetch<SeasonPassView[]>(`/api/season-passes?seriesId=${encodeURIComponent(seriesId)}`, { authToken: token }).catch(() => []),
apiFetch<Event[]>("/api/events/all?includeInactive=true", { authToken: token }).catch(() => []),
]);
setPasses(p);
// Upcoming events in this series that take registrations, not youth events.
setEvents((all || []).filter(e => e.seriesId === seriesId && e.requiresRegistration !== false && !e.requiresParentalConsent).sort((a, b) => a.startDate.localeCompare(b.startDate)));
setLoaded(true);
}, [token, seriesId]);
useEffect(() => { load(); }, [load]);
// A pass's own events; events without a row yet (a new pass, or still loading) take the default:
// ticked on a new pass, with the first ticket that can be sold.
const passItems = (p: SeasonPassView): ItemDraft[] => p.items.map(i => ({ eventId: i.eventId, on: true, eventOptionId: i.eventOptionId, variantId: i.variantId || "" }));
const itemFor = (d: Draft, ev: Event): ItemDraft => d.items.find(i => i.eventId === ev.id)
|| { eventId: ev.id, on: !d.id, eventOptionId: sellable(ev)[0]?.id || "", variantId: "" };
const openNew = () => { setError(null); setDraft({ name: "", description: "", price: "", saleEndsAt: "", isActive: true, items: [] }); };
const openEdit = (p: SeasonPassView) => {
setError(null);
setDraft({ id: p.id, name: p.name, description: p.description || "", price: String(p.price), saleEndsAt: p.saleEndsAt ? p.saleEndsAt.slice(0, 16) : "", isActive: p.isActive, items: passItems(p) });
};
const editing = draft?.id ? passes.find(p => p.id === draft.id) : null;
const locked = !!editing && ((editing.sold || 0) + (editing.unpaid || 0)) > 0;
// What the chosen tickets cost separately, to show the saving while typing the price.
const normalValue = useMemo(() => (draft ? events.map(ev => itemFor(draft, ev)) : []).filter(i => i.on).reduce((s, i) => {
const ev = events.find(e => e.id === i.eventId);
const opt = ev?.eventOptions?.find(o => o.id === i.eventOptionId);
const v = opt?.variants?.find(x => x.id === i.variantId);
return s + Number(v?.price ?? opt?.price ?? 0);
}, 0), [draft, events]);
const save = async () => {
if (!draft) return;
setSaving(true); setError(null);
try {
const body = {
seriesId, name: draft.name, description: draft.description, isActive: draft.isActive,
saleEndsAt: draft.saleEndsAt ? new Date(draft.saleEndsAt).toISOString() : null,
...(locked ? {} : {
price: Number(draft.price),
items: events.map(ev => itemFor(draft, ev)).filter(i => i.on).map(i => ({ eventId: i.eventId, eventOptionId: i.eventOptionId, variantId: i.variantId || null })),
}),
};
await apiFetch(draft.id ? `/api/season-passes/${draft.id}` : "/api/season-passes", { method: draft.id ? "PUT" : "POST", authToken: token || undefined, body });
setDraft(null);
await load();
} catch (e) {
setError(errorMessage(e) || "Couldn't save the pass");
} finally {
setSaving(false);
}
};
const remove = async (p: SeasonPassView) => {
if (!window.confirm(`Delete "${p.name}"?`)) return;
try {
await apiFetch(`/api/season-passes/${p.id}`, { method: "DELETE", authToken: token || undefined });
await load();
} catch (e) {
setError(errorMessage(e) || "Couldn't delete the pass");
}
};
const updItem = (ev: Event, patch: Partial<ItemDraft>) => setDraft(d => d && ({ ...d, items: [...d.items.filter(i => i.eventId !== ev.id), { ...itemFor(d, ev), ...patch }] }));
return (
<div className="mt-3 border-t pt-3" data-testid="season-passes">
<div className="flex items-center justify-between gap-2 mb-2">
<div className="text-xs font-medium text-gray-700 flex items-center gap-1"><Ticket className="w-3.5 h-3.5" /> Season passes</div>
{!draft && <button type="button" className="text-xs px-2.5 py-1 rounded border bg-white hover:bg-gray-50" onClick={openNew}>+ New pass</button>}
</div>
{error && <div className="p-2 mb-2 border rounded bg-red-50 text-red-700 text-xs">{error}</div>}
{passes.length === 0 && !draft && <p className="text-xs text-gray-500">No passes. A pass sells a ticket for several events in this series at one price.</p>}
<ul className="space-y-2">
{passes.map(p => (
<li key={p.id} className="border rounded-lg p-3 text-sm bg-gray-50/50" data-testid="season-pass">
<div className="flex items-start justify-between gap-2 flex-wrap">
<div>
<span className="font-medium">{p.name}</span> · {rand(p.price)}
{p.saving > 0 && <span className="text-xs text-green-700"> (saves {rand(p.saving)})</span>}
{!p.isActive && <span className="ml-1 text-[10px] px-1.5 py-0.5 rounded bg-gray-100 text-gray-500">Off</span>}
<div className="text-xs text-gray-500 mt-0.5">{p.sold || 0} sold{p.unpaid ? ` · ${p.unpaid} not paid yet` : ""}{p.unavailable && p.isActive ? ` · ${p.unavailable}` : ""}</div>
</div>
<div className="flex gap-2">
<a href={`/series/${seriesSlug}`} target="_blank" rel="noreferrer" className="text-xs px-2 py-1 rounded border bg-white hover:bg-gray-50">View</a>
<button type="button" className="text-xs px-2 py-1 rounded border bg-white hover:bg-gray-50" onClick={() => openEdit(p)}>Edit</button>
{!(p.sold || p.unpaid) && <button type="button" className="text-xs px-2 py-1 rounded bg-red-50 text-red-700 border border-red-200" onClick={() => remove(p)}>Delete</button>}
</div>
</div>
<ul className="mt-2 text-xs text-gray-600 space-y-0.5">
{p.items.map(i => (
<li key={i.id}>{i.eventTitle} ({new Date(i.startDate).toLocaleDateString()}) — {i.ticket}: normally {rand(i.normalPrice)}, share {rand(i.share)}</li>
))}
</ul>
</li>
))}
</ul>
{draft && (
<div className="border rounded-lg p-3 bg-white space-y-3 mt-2" data-testid="season-pass-form">
<div className="grid sm:grid-cols-3 gap-3">
<div className="sm:col-span-2">
<label className="block text-xs text-gray-600 mb-1" htmlFor="pass-name">Pass name</label>
<input id="pass-name" className="w-full border rounded px-2 py-1.5 text-sm" value={draft.name} onChange={e => setDraft({ ...draft, name: e.target.value })} placeholder="e.g. All 2027 breakfasts" />
</div>
<div>
<label className="block text-xs text-gray-600 mb-1" htmlFor="pass-price">Price (R)</label>
<input id="pass-price" type="number" min="0" step="1" disabled={locked} className="w-full border rounded px-2 py-1.5 text-sm disabled:bg-gray-50" value={draft.price} onChange={e => setDraft({ ...draft, price: e.target.value })} />
</div>
</div>
<div>
<label className="block text-xs text-gray-600 mb-1" htmlFor="pass-description">Description (optional)</label>
<input id="pass-description" className="w-full border rounded px-2 py-1.5 text-sm" value={draft.description} onChange={e => setDraft({ ...draft, description: e.target.value })} />
</div>
<div>
<div className="text-xs text-gray-600 mb-1">Events on the pass</div>
{locked && <p className="text-[11px] text-amber-700 mb-1">People have bought this pass, so its events and price can&apos;t change — switch it off and make a new one.</p>}
{!loaded ? <p className="text-xs text-gray-500">Loading events…</p> : events.length === 0 ? <p className="text-xs text-gray-500">This series has no events that take registrations yet.</p> : (
<ul className="space-y-1.5">
{events.map(ev => {
const item = itemFor(draft, ev);
const opts = sellable(ev);
const variants = opts.find(o => o.id === item.eventOptionId)?.variants || [];
return (
<li key={ev.id} className="flex flex-wrap items-center gap-2 text-sm">
<label className="flex items-center gap-1.5 min-w-0 flex-1">
<input type="checkbox" disabled={locked} checked={item.on} onChange={e => updItem(ev, { on: e.target.checked })} />
<span className="truncate">{ev.title}</span>
<span className="text-xs text-gray-500">{new Date(ev.startDate).toLocaleDateString()}</span>
</label>
{item.on && (
<>
<select aria-label={`Ticket for ${ev.title}`} disabled={locked} className="border rounded px-2 py-1 text-xs" value={item.eventOptionId} onChange={e => updItem(ev, { eventOptionId: e.target.value, variantId: "" })}>
{opts.map(o => <option key={o.id} value={o.id}>{o.name} (R{Number(o.price).toFixed(0)})</option>)}
</select>
{variants.length > 0 && (
<select aria-label={`Variant for ${ev.title}`} disabled={locked} className="border rounded px-2 py-1 text-xs" value={item.variantId} onChange={e => updItem(ev, { variantId: e.target.value })}>
<option value="">Any / none</option>
{variants.map(v => <option key={v.id} value={v.id}>{v.name}</option>)}
</select>
)}
</>
)}
</li>
);
})}
</ul>
)}
{!locked && normalValue > 0 && (
<p className="text-[11px] text-gray-500 mt-1">Bought separately: {rand(normalValue)}{draft.price !== "" && Number(draft.price) < normalValue ? ` — the pass saves ${rand(normalValue - Number(draft.price))}` : ""}. The price is split over the events in proportion to these prices for each event&apos;s cashup.</p>
)}
</div>
<div className="grid sm:grid-cols-2 gap-3 items-end">
<div>
<label className="block text-xs text-gray-600 mb-1" htmlFor="pass-sale-ends">Stop selling at (optional)</label>
<input id="pass-sale-ends" type="datetime-local" className="w-full border rounded px-2 py-1.5 text-sm" value={draft.saleEndsAt} onChange={e => setDraft({ ...draft, saleEndsAt: e.target.value })} />
<p className="text-[10px] text-gray-400 mt-0.5">It always stops when the first event on it starts.</p>
</div>
<label className="flex items-center gap-2 text-sm"><input type="checkbox" checked={draft.isActive} onChange={e => setDraft({ ...draft, isActive: e.target.checked })} /> On sale</label>
</div>
<div className="flex gap-2">
<button type="button" onClick={save} disabled={saving || !loaded || !draft.name.trim() || (!locked && draft.price === "")} className="px-3 py-1.5 text-sm rounded bg-brand-600 text-white hover:bg-brand-700 disabled:opacity-50 font-medium">
{saving ? "Saving…" : draft.id ? "Save pass" : "Create pass"}
</button>
<button type="button" onClick={() => setDraft(null)} className="px-3 py-1.5 text-sm rounded border bg-white hover:bg-gray-50">Cancel</button>
</div>
</div>
)}
</div>
);
}
@@ -1,5 +1,5 @@
import React from "react";
import { Layers, Calendar, Bell, MapPin, Copy, BarChart3 } from "lucide-react";
import { Layers, Calendar, Bell, MapPin, Copy, BarChart3, Ticket } from "lucide-react";
import { GuideItem } from "@/components/shared/GuideItem";
import type { HelpContent } from "./types";
@@ -31,6 +31,9 @@ export const seriesHelpContent: HelpContent = {
<GuideItem icon={BarChart3} title="Year on year" tone="green">
&quot;Compare&quot; opens Reports → Series: year on year — each event in the series side by side (registrations, tickets, income, how many came) with how much it went up or down from the one before.
</GuideItem>
<GuideItem icon={Ticket} title="Season passes" tone="violet">
&quot;+ New pass&quot; under a series: a name, a price and which events (and which ticket at each) it includes. People buy it on the series page and are registered for every event at once with one payment. The price is shared out over the events in line with their normal ticket prices, so each event&apos;s cashup shows its part. A pass stops selling when its first event starts; once someone has bought it, its events and price can&apos;t change (switch it off and make a new one). Youth events can&apos;t be on a pass.
</GuideItem>
<GuideItem icon={MapPin} title="Campuses" tone="gray">
A series can have events at different campuses. Supervisors limited to some campuses see the series, but only their campuses&apos; events in it.
</GuideItem>
+22
View File
@@ -203,6 +203,28 @@ export type EventSeries = EventSeriesRef & {
events: { id: string; title: string; startDate: string; endDate: string; isActive: boolean; isHidden: boolean; campus?: Event["campus"] }[];
};
/** A season pass (1.47.3): one price for a ticket at each of several events in a series. */
export type SeasonPassItemView = {
id: string; eventId: string; eventOptionId: string; variantId: string | null;
eventTitle: string; startDate: string; endDate: string; ticket: string;
// The ticket's normal price, and this event's share of the pass price.
normalPrice: number; share: number;
};
export type SeasonPassView = {
id: string; seriesId: string; name: string; description: string | null; price: number;
isActive: boolean; saleEndsAt: string | null; normalValue: number; saving: number;
// Why it can't be bought right now, or null.
unavailable: string | null;
items: SeasonPassItemView[];
// Supervisor list only: passes paid for and still unpaid.
sold?: number; unpaid?: number;
};
export type SeasonPassPurchase = {
id: string; quantity: number; total: number; status: "pending" | "paid" | "cancelled"; createdAt: string;
pass: { id: string; name: string; series: { name: string; slug: string } };
registrations: { id: string; status: string; event: { id: string; title: string; startDate: string } }[];
};
/** GET /api/series/:id/compare — one row per event in the series, oldest first. */
export type SeriesComparisonRow = {
eventId: string; title: string; startDate: string; endDate: string; campus?: Event["campus"]; isActive: boolean;