Add parental consent for youth events

Youth events need a name and date of birth for every attendee, and a
parent/guardian's details for under-18s. Parents get an email and
WhatsApp link to a consent page that records the signed name, time, IP,
device and exact consent text; medical and emergency details are stored
encrypted. Tickets are issued but check-in is blocked until consent is
given (supervisor override audited). A daily job sends reminders and
purges medical details after the retention period. Adds a supervisor
consent tracker, consent status and medical list reports, and clears
consent data when an account is anonymised.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-19 13:24:44 +02:00
co-authored by Claude Opus 5.5
parent 03b79972e6
commit f55353ecc6
41 changed files with 1988 additions and 88 deletions
@@ -4,7 +4,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"
import { apiFetch } from "@/lib/api";
import { TwoFactorChallenge, isTwoFactorChallenge } from "@/lib/auth";
import { CouponCodeField, AppliedCoupon } from "@/components/shared/CouponCodeField";
import { AttendeeNamesEditor, AttendeeEntries, TicketDelivery, attendeesPayload } from "@/components/shared/AttendeeNamesEditor";
import { AttendeeNamesEditor, AttendeeEntries, TicketDelivery, attendeesPayload, consentDetailsMissing } from "@/components/shared/AttendeeNamesEditor";
// ─── Types ────────────────────────────────────────────────────────────────────
type EarlyBirdTier = { deadline: string; price: number; order?: number; variantId?: string | null };
@@ -41,6 +41,7 @@ type KioskEvent = {
eventOptions?: EventOption[];
form?: EventForm | null;
allowNamedAttendees?: boolean;
requiresParentalConsent?: boolean;
};
type Screen = "setup" | "form" | "eventform" | "confirmation";
@@ -388,6 +389,10 @@ export default function SelfServicePage() {
setFormError("The email and phone number entered belong to two different existing accounts. Please check and correct one of them before continuing.");
return;
}
if (selectedEvent?.requiresParentalConsent) {
const missing = consentDetailsMissing(selectedEvent.eventOptions || [], (o, v) => quantities[v ? `${o}::${v}` : o] || 0, attendeeEntries, selectedEvent.startDate);
if (missing) { setFormError(missing); return; }
}
if (pendingChanges.length > 0) {
setShowUpdateConfirm(true);
return;
@@ -417,7 +422,7 @@ export default function SelfServicePage() {
notificationPreference: notificationPref,
...(kioskCoupon ? { couponCode: kioskCoupon.code } : {}),
};
const kioskNames = selectedEvent?.allowNamedAttendees && namingOthers
const kioskNames = (selectedEvent?.allowNamedAttendees && namingOthers) || selectedEvent?.requiresParentalConsent
? attendeesPayload(selectedEvent.eventOptions || [], (o, v) => quantities[v ? `${o}::${v}` : o] || 0, attendeeEntries)
: [];
if (kioskNames.length > 0) {
@@ -1008,7 +1013,7 @@ export default function SelfServicePage() {
);
})}
</div>
{selectedEvent?.allowNamedAttendees && (
{(selectedEvent?.allowNamedAttendees || selectedEvent?.requiresParentalConsent) && (
<div className="mt-4">
<AttendeeNamesEditor
options={selectedEvent.eventOptions || []}
@@ -1019,6 +1024,7 @@ export default function SelfServicePage() {
onEntriesChange={setAttendeeEntries}
delivery={delivery}
onDeliveryChange={setDelivery}
consentEventStart={selectedEvent.requiresParentalConsent ? selectedEvent.startDate : undefined}
/>
</div>
)}