fix(admin): per-row check-in toggle; feat(db): front-desk gate + badge copies

Registrations table felt buggy because both row actions did
setBusy(true) -> write -> reloadRegistrations() -> setBusy(false):
the list is sorted by points, so a reload made the row you just
touched jump (or vanish under a Checked-in filter), and the single
`busy` flag disabled every control in the table for the whole
request. The fix is per-row in-flight state (busyIds + withRowBusy)
and no reload at all: the toggle patches its own row's checked_in
plus the points delta the RPC returns, the type change patches
`type`; a rejected write rolls both back. Only the touched row is
disabled, shows a "Saving…" pulse, and two rows can save at once.
Toggle hit area is now 40x41 px with a focus-visible ring.

Front-desk gate: checkin_attendee reads registrations.checked_in
and raises "This attendee needs to be checked in at the front desk
first." when it is not true, and no longer sets checked_in as a
side effect. checkins has no INSERT policy, so the RPC is the only
write path and the gate cannot be bypassed. The scanner shows a
dedicated "Not checked in yet" sheet instead of a toast.

Badge copies: events.badge_copies (1..4, default 1). welcome_checkin
sends that many pgmq jobs in one transaction (the Pi prints one
label per job, so N jobs = N labels; no worker change) and clamps
the value again itself. preview_welcome_checkin gained a `copies`
column (drop + recreate) so the popup states the real count. Manual
reprint still prints exactly one. Set from Settings -> Badge
printing (active event) and the Events form, always as a
single-column update; the Settings badge section now renders even
when the LLM settings call fails.

Tests: badge_print 113 (+6), leaderboard 47 (+1), new
registration-checkin-toggle (6), front-desk-gate (3),
welcome-badge-copies (3); the stale registrations-PATCH mock in
registration-ticket-merge now targets set_registration_checked_in,
the ambiguous Save button is "Save copies", and the print-copy
assertion tolerates the typographic apostrophe. Docs updated
(rpcs, schema, printing, tests, admin-app, screens) with a release
record; NOT deployed - see docs/releases/2026-10-19.md.
This commit is contained in:
Lago committed 2026-10-19 15:10:20 +02:00
1 parent c857204cfe
commit c49a94fe80
27 files changed
+1378 -73

No files matched your search

+21
View File
@@ -11,6 +11,7 @@ import {
import type { Event, PretixOptions, PretixSyncResult, SyncResult } from '../lib/types';
import { useToast } from '../context/ToastContext';
import { Empty, Modal, Spinner, Toggle } from '../components/ui';
import { BadgeCopiesPicker, clampBadgeCopies } from '../components/BadgeCopiesSetting';
import { normalizeSessionizeSource } from '../lib/sessionizeSource';
export function Events() {
@@ -297,6 +298,7 @@ function EventModal({
const [pretixError, setPretixError] = useState<string | null>(null);
const [realtimeClock, setRealtimeClock] = useState(event?.use_realtime_clock ?? false);
const [talkBonus, setTalkBonus] = useState(event?.talk_networking_bonus ?? 2);
const [badgeCopies, setBadgeCopies] = useState(event?.badge_copies ?? 1);
const [busy, setBusy] = useState(false);
const lastFetchedKey = useRef<string | null>(null);
@@ -353,6 +355,7 @@ function EventModal({
pretix_api_key: pretixApiKey.trim() || null,
use_realtime_clock: realtimeClock,
talk_networking_bonus: Math.max(0, Math.min(10, Math.round(talkBonus) || 0)),
badge_copies: clampBadgeCopies(badgeCopies),
});
onSaved(event ? 'Event updated' : 'Event created');
} catch (e) {
@@ -537,6 +540,24 @@ function EventModal({
/>
</div>
</div>
<div className="field">
<div className="row between" style={{ alignItems: 'center', gap: 16, flexWrap: 'wrap' }}>
<div>
<label id="event-badge-copies-label">Badge copies on welcome check-in</label>
<div className="muted small" style={{ marginTop: 2, maxWidth: 420 }}>
How many labels print when an attendee is welcomed in at the front desk.
Manual reprints from the Registrations view always print one.
The same control lives in Settings for the active event.
</div>
</div>
<BadgeCopiesPicker
value={clampBadgeCopies(badgeCopies)}
onChange={setBadgeCopies}
disabled={busy}
labelId="event-badge-copies-label"
/>
</div>
</div>
</Modal>
);
}