Archived
Fix: door and manual registrations get their tickets; admin Corrections (1.52.0)
On events with a required attendee form, tickets waited for the forms, but
At the door and Manual registration never asked for them: payment was
recorded and nobody could be checked in.
- The form pops up at the door and in Manual registration; "Fill in later"
(any staff) issues the tickets once paid and sends the payer a link
(Registration.formWaivedAt, POST /api/v2/registrations/{id}/form-later).
- One form per person on picked-session bookings; a required form with no
questions no longer holds tickets back; every caller asks the ticket
generator (formsOutstanding).
- Kiosk asks for the forms the server says are missing; headings show as text.
- Admin Corrections page and /api/v2/corrections: issue missing tickets,
pay later (ticketsReleasedAt), make it free (complimentaryDiscount),
check in or undo after the event.
- Migration 20261102120000_corrections; unit and e2e tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,7 @@ import type { Event, EventOption, PublicBundle, Registration, RegistrationOption
|
||||
import { BackLink } from "@/components/shared/BackLink";
|
||||
import { EventPicker } from "@/components/shared/EventPicker";
|
||||
import { apiV2Data } from "@/lib/apiV2";
|
||||
import { AttendeeFormModal, type AttendeeFormDef } from "@/components/shared/AttendeeFormModal";
|
||||
|
||||
// ─── Pricing helpers ─────────────────────────────────────────────────────────
|
||||
|
||||
@@ -91,6 +92,15 @@ export default function ManualRegistrationPage() {
|
||||
const [paySubmitting, setPaySubmitting] = useState(false);
|
||||
const [payMessage, setPayMessage] = useDismissingState<string | null>(null);
|
||||
const [payError, setPayError] = useDismissingState<string | null>(null);
|
||||
// A required attendee form holding the tickets back: fill it in now, or "Fill in later".
|
||||
const [formPrompt, setFormPrompt] = useState<{ registrationId: string; needed: number; form: AttendeeFormDef; name?: string } | null>(null);
|
||||
const promptForm = async (registrationId: string, needed: number, eventId: string, name?: string) => {
|
||||
if (!(needed > 0)) return;
|
||||
try {
|
||||
const ev = await fetchEvent<Event>(eventId, { authToken: token || undefined });
|
||||
setFormPrompt({ registrationId, needed, form: ev?.form, name });
|
||||
} catch {}
|
||||
};
|
||||
|
||||
// Load all users for client-side fuzzy matching
|
||||
useEffect(() => {
|
||||
@@ -164,7 +174,7 @@ export default function ManualRegistrationPage() {
|
||||
if (!payRegistrationId) { setPayError("Please select a registration"); return; }
|
||||
try {
|
||||
setPaySubmitting(true);
|
||||
await apiV2Data("post", "/payments", {
|
||||
const paid = await (apiV2Data("post", "/payments", {
|
||||
authToken: token,
|
||||
body: {
|
||||
amount: amt,
|
||||
@@ -174,8 +184,11 @@ export default function ManualRegistrationPage() {
|
||||
isDonation: false,
|
||||
paidAt: payPaidAtLocal ? new Date(payPaidAtLocal).toISOString() : undefined,
|
||||
},
|
||||
});
|
||||
setPayMessage(`Payment recorded (R ${amt.toFixed(2)}).`);
|
||||
}) as Promise<{ formsNeeded?: number; registration?: { eventId?: string } }>);
|
||||
setPayMessage(`Payment recorded (R ${amt.toFixed(2)}).${(paid?.formsNeeded || 0) > 0 ? " The attendee form is holding the tickets back." : ""}`);
|
||||
const paidReg = allRegistrations.find(r => r.id === payRegistrationId);
|
||||
const paidEventId = paid?.registration?.eventId || paidReg?.eventId;
|
||||
if (paidEventId) promptForm(payRegistrationId, paid?.formsNeeded || 0, paidEventId, paidReg?.user?.name);
|
||||
setPayAmount("");
|
||||
setPayPaidAtLocal("");
|
||||
// Refresh registrations so the displayed outstanding balance updates
|
||||
@@ -362,6 +375,7 @@ export default function ManualRegistrationPage() {
|
||||
setMessage(res?.couponError
|
||||
? `Manual registration created, but the code wasn't applied: ${res.couponError}`
|
||||
: coupon ? `Manual registration created with code ${coupon.code}.` : "Manual registration created successfully.");
|
||||
if ((res?.formsNeeded || 0) > 0) setFormPrompt({ registrationId: res.id, needed: res.formsNeeded || 0, form: fullEvent?.form, name: res.user?.name || guest.name });
|
||||
|
||||
// Pre-load the Record Payment tab with this registration so it's ready to go the
|
||||
// moment a supervisor clicks over — the tab itself is never switched to automatically.
|
||||
@@ -771,6 +785,24 @@ export default function ManualRegistrationPage() {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{formPrompt && (
|
||||
<AttendeeFormModal
|
||||
key={formPrompt.registrationId}
|
||||
registrationId={formPrompt.registrationId}
|
||||
form={formPrompt.form}
|
||||
needed={formPrompt.needed}
|
||||
token={token}
|
||||
attendeeName={formPrompt.name}
|
||||
onDone={({ later, ticketsIssued, sentTo }) => {
|
||||
setFormPrompt(null);
|
||||
const issued = ticketsIssued > 0 ? " Tickets issued." : "";
|
||||
const text = later
|
||||
? `Attendee form left for later${sentTo && sentTo.length ? ` — a link was sent by ${sentTo.join(" and ")}` : ""}.${issued}`
|
||||
: `Attendee form saved.${issued}`;
|
||||
if (tab === "payment") setPayMessage(text); else setMessage(text);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user