Add offline ticket scanning

Staff can lock a section (or the whole event) to their device, download
its tickets and keep scanning with no connection. Scans are queued in
IndexedDB and synced idempotently when back online; conflicts go into a
sync report for supervisors, who can also force-release a lost device.
The server now validates scan sections and refuses scans in a scope
locked to another device. Adds a web app manifest and a service worker
for the scanner page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-19 14:06:22 +02:00
co-authored by Claude Opus 5.5
parent c5b0032e1d
commit ae7dbf457c
29 changed files with 1451 additions and 72 deletions
@@ -24,6 +24,7 @@ import { supervisorFormsHelpContent } from "./supervisor-forms";
import { supervisorCouponsHelpContent } from "./supervisor-coupons";
import { supervisorConsentHelpContent } from "./supervisor-consent";
import { supervisorWaitlistHelpContent } from "./supervisor-waitlist";
import { supervisorOfflineScansHelpContent } from "./supervisor-offline-scans";
import { supervisorEmailAttendeesHelpContent } from "./supervisor-email-attendees";
import { supervisorWhatsappAttendeesHelpContent } from "./supervisor-whatsapp-attendees";
import { staffEventTicketsHelpContent } from "./staff-event-tickets";
@@ -150,6 +151,11 @@ const REGISTRY: HelpRegistryEntry[] = [
matches: pathname => pathname === "/dashboard/supervisor/payments",
content: supervisorPaymentsHelpContent,
},
{
slug: "supervisor-offline-scans",
matches: pathname => pathname === "/dashboard/supervisor/offline-scans",
content: supervisorOfflineScansHelpContent,
},
{
slug: "supervisor-waitlist",
matches: pathname => pathname === "/dashboard/supervisor/waitlist",
@@ -1,5 +1,5 @@
import React from "react";
import { QrCode, Filter, CheckCircle2, ShieldAlert } from "lucide-react";
import { QrCode, Filter, CheckCircle2, ShieldAlert, WifiOff } from "lucide-react";
import { GuideItem } from "@/components/shared/GuideItem";
import type { HelpContent } from "./types";
@@ -19,6 +19,9 @@ export const staffTicketScanningHelpContent: HelpContent = {
<GuideItem icon={CheckCircle2} title="Outcomes" tone="green">
You&apos;ll see Success (with redeemed/remaining counts), Already Used, or an Error if something&apos;s wrong with the ticket.
</GuideItem>
<GuideItem icon={WifiOff} title="Offline mode" tone="amber">
Worried about the venue Wi-Fi? While you&apos;re online, pick the event and section and tap &quot;Enable offline mode&quot;. The section is locked to your device and its tickets are downloaded, so you can keep scanning with no connection. Scans sync automatically when you&apos;re back online. Tickets bought after the download won&apos;t be on your list — send those people to the door desk. Tap &quot;Release section&quot; when you&apos;re done. Tip: add this page to your home screen so it opens offline.
</GuideItem>
<GuideItem icon={ShieldAlert} title="Parental consent" tone="rose">
On youth events, the confirm screen warns when a parent hasn&apos;t given consent yet (or declined). That person can&apos;t be checked in; a supervisor can override, and the override is recorded in the audit log.
</GuideItem>
@@ -0,0 +1,32 @@
import React from "react";
import { WifiOff, Unlock, CheckCircle2, Lock } from "lucide-react";
import { GuideItem } from "@/components/shared/GuideItem";
import type { HelpContent } from "./types";
/** Help content for /dashboard/supervisor/offline-scans. */
export const supervisorOfflineScansHelpContent: HelpContent = {
title: "Offline scanning",
subtitle: "Devices scanning without a connection, and what they synced.",
tabs: [
{
key: "page",
label: "This page",
icon: WifiOff,
content: (
<div className="space-y-4">
<div className="space-y-4">
<GuideItem icon={Lock} title="Locked sections" tone="brand">
Each section (or the whole event) in offline mode is locked to one device, so two devices can never check in the same ticket while offline. You can see who holds each lock, when their ticket list was downloaded, and when they last synced.
</GuideItem>
<GuideItem icon={Unlock} title="Force release" tone="amber">
For a lost or flat device. The section is unlocked straight away. If the device reconnects later, its offline scans still sync and are flagged here.
</GuideItem>
<GuideItem icon={CheckCircle2} title="Sync reports" tone="rose">
Scans that need a person to look: tickets not found (e.g. transferred), cancelled registrations, tickets already used up, scans outside the locked section, or check-ins without parental consent. Mark each report reviewed once it&apos;s been dealt with.
</GuideItem>
</div>
</div>
),
},
],
};