Add group tickets with named attendees
Events can take a name (and optional email/phone) for each main-ticket place. Each named person gets their own quantity-1 ticket and attendee form; unnamed places share one ticket. Tickets go to the payer or to each person, attendees matching one existing account are linked to it, and the payer can edit names and send form links from My Events. Ticket generation is now planned per line (utils/attendees.js), free registrations use the same generator, and guest registration matches accounts by phone too, refusing conflicting email/phone pairs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -145,7 +145,7 @@ function EventTicketsContent() {
|
||||
const optVariant = t.registrationOption?.variant?.name;
|
||||
const type = optVariant ? `${optBase} — ${optVariant}` : optBase;
|
||||
const qty = t.quantity || 1;
|
||||
const holder = t.user?.name || t.userId || "";
|
||||
const holder = t.attendee?.name ? `${t.attendee.name}${t.user?.name ? ` (booked by ${t.user.name})` : ""}` : (t.user?.name || t.userId || "");
|
||||
const qrSrc = `https://api.qrserver.com/v1/create-qr-code/?size=140x140&data=${encodeURIComponent(
|
||||
t.qrCode || t.id
|
||||
)}`;
|
||||
|
||||
@@ -375,7 +375,10 @@ export default function TicketScanningPage() {
|
||||
<div className="bg-gray-50 border rounded-lg p-4 mb-4 space-y-1 text-sm">
|
||||
<div><span className="font-medium">Ticket type:</span> {confirmModal.ticket?.registrationOption?.eventOption?.name || 'Ticket'}{confirmModal.ticket?.registrationOption?.variant?.name ? ` — ${confirmModal.ticket.registrationOption.variant.name}` : ''}</div>
|
||||
<div><span className="font-medium">Event:</span> {confirmModal.ticket?.event?.title || '—'}</div>
|
||||
<div><span className="font-medium">Holder:</span> {confirmModal.ticket?.user?.name || confirmModal.ticket?.registrationOption?.registration?.user?.name || '—'}</div>
|
||||
<div><span className="font-medium">Holder:</span> {confirmModal.ticket?.attendee?.name || confirmModal.ticket?.user?.name || confirmModal.ticket?.registrationOption?.registration?.user?.name || '—'}</div>
|
||||
{confirmModal.ticket?.attendee?.name && confirmModal.ticket?.user?.name && (
|
||||
<div className="text-xs text-gray-500">Booked by {confirmModal.ticket.user.name}</div>
|
||||
)}
|
||||
<div><span className="font-medium">Qty on ticket:</span> {confirmModal.ticket?.quantity || 1}</div>
|
||||
<div><span className="font-medium">Remaining:</span> <span className={confirmModal.remaining < (confirmModal.ticket?.quantity || 1) ? 'text-amber-600 font-semibold' : 'text-green-700 font-semibold'}>{confirmModal.remaining}</span></div>
|
||||
</div>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { apiFetch } from "@/lib/api";
|
||||
import { scoreUser } from "@/lib/fuzzyMatch";
|
||||
import { useDismissingState } from "@/hooks/useDismissingState";
|
||||
import { CouponCodeField, AppliedCoupon } from "@/components/shared/CouponCodeField";
|
||||
import { AttendeeNamesEditor, AttendeeEntries, TicketDelivery, attendeesPayload } from "@/components/shared/AttendeeNamesEditor";
|
||||
import { DoorOpen, UserPlus, CreditCard, CheckSquare, Ticket, RotateCcw, type LucideIcon } from "lucide-react";
|
||||
|
||||
type Mode = "registration" | "payment" | "checkin" | "tickets" | "refund";
|
||||
@@ -102,6 +103,10 @@ export default function AtTheDoorPage() {
|
||||
const [showOptionsModal, setShowOptionsModal] = useState(false);
|
||||
const [pendingUser, setPendingUser] = useState<any | null>(null);
|
||||
const [doorCoupon, setDoorCoupon] = useState<AppliedCoupon | null>(null);
|
||||
const [doorAllowsNames, setDoorAllowsNames] = useState(false);
|
||||
const [doorNaming, setDoorNaming] = useState(false);
|
||||
const [doorEntries, setDoorEntries] = useState<AttendeeEntries>({});
|
||||
const [doorDelivery, setDoorDelivery] = useState<TicketDelivery>("payer");
|
||||
const [pendingEditReg, setPendingEditReg] = useState<any | null>(null);
|
||||
const [confirming, setConfirming] = useState(false);
|
||||
const [quantities, setQuantities] = useState<Record<string, number>>({});
|
||||
@@ -155,6 +160,7 @@ export default function AtTheDoorPage() {
|
||||
});
|
||||
|
||||
setEventOptions(ev.options || ev.eventOptions || []);
|
||||
setDoorAllowsNames(!!ev.allowNamedAttendees);
|
||||
} catch {
|
||||
setEventOptions([]);
|
||||
}
|
||||
@@ -266,6 +272,9 @@ export default function AtTheDoorPage() {
|
||||
options: opts,
|
||||
notificationPreference: pendingUser.notifPref,
|
||||
...(doorCoupon ? { couponCode: doorCoupon.code } : {}),
|
||||
...(doorAllowsNames && doorNaming && attendeesPayload(eventOptions, (o, v) => quantities[v ? `${o}::${v}` : o] || 0, doorEntries).length > 0
|
||||
? { attendees: attendeesPayload(eventOptions, (o, v) => quantities[v ? `${o}::${v}` : o] || 0, doorEntries), ticketDelivery: doorDelivery }
|
||||
: {}),
|
||||
}
|
||||
});
|
||||
setShowOptionsModal(false);
|
||||
@@ -302,6 +311,9 @@ export default function AtTheDoorPage() {
|
||||
setPendingUser({ name, email: email || null, phone: phone || null, notifPref });
|
||||
setPendingEditReg(null);
|
||||
setDoorCoupon(null);
|
||||
setDoorNaming(false);
|
||||
setDoorEntries({});
|
||||
setDoorDelivery("payer");
|
||||
setShowNewAttendeeModal(false);
|
||||
setShowOptionsModal(true);
|
||||
};
|
||||
@@ -489,6 +501,11 @@ export default function AtTheDoorPage() {
|
||||
setCoupon={setDoorCoupon}
|
||||
couponForUserId={pendingEditReg ? pendingEditReg.userId : null}
|
||||
existingCode={(pendingEditReg?.couponRedemptions || [])[0]?.coupon?.code || null}
|
||||
names={doorAllowsNames && !pendingEditReg ? {
|
||||
enabled: doorNaming, onEnabledChange: setDoorNaming,
|
||||
entries: doorEntries, onEntriesChange: setDoorEntries,
|
||||
delivery: doorDelivery, onDeliveryChange: setDoorDelivery,
|
||||
} : null}
|
||||
/>
|
||||
<DonationModal
|
||||
open={showDonationModal}
|
||||
@@ -1173,7 +1190,7 @@ function DoorCheckInPanel({ token, eventId, registration, setError, setInfo }: a
|
||||
);
|
||||
}
|
||||
|
||||
function OptionsModal({ open, onClose, options, quantities, setQuantities, minQuantities = {}, onConfirm, confirming, isEdit, totalPaid = 0, eventId, token, coupon, setCoupon, couponForUserId, existingCode }: any) {
|
||||
function OptionsModal({ open, onClose, options, quantities, setQuantities, minQuantities = {}, onConfirm, confirming, isEdit, totalPaid = 0, eventId, token, coupon, setCoupon, couponForUserId, existingCode, names }: any) {
|
||||
if (!open) return null;
|
||||
|
||||
const basket = Object.entries(quantities as Record<string, number>)
|
||||
@@ -1287,6 +1304,16 @@ function OptionsModal({ open, onClose, options, quantities, setQuantities, minQu
|
||||
One or more items are below the quantity already issued as tickets. Please increase the selection.
|
||||
</div>
|
||||
)}
|
||||
{names && (
|
||||
<div className="mb-3 max-h-64 overflow-y-auto">
|
||||
<AttendeeNamesEditor
|
||||
options={safeOptions}
|
||||
qtyFor={(o: string, v: string | null) => quantities[v ? `${o}::${v}` : o] || 0}
|
||||
{...names}
|
||||
payerLabel="the person registering"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{existingCode ? (
|
||||
<div className="mb-3 text-sm text-green-700">Code <span className="font-mono font-semibold">{existingCode}</span> is applied to this registration.</div>
|
||||
) : (
|
||||
|
||||
@@ -769,7 +769,7 @@ interface EventDraft {
|
||||
registrationDeadline: string; goLiveAt: string; price: string; picture: string;
|
||||
redirectUrl: string; isActive: boolean; isHidden: boolean; requiresAuth: boolean;
|
||||
requiresRegistration: boolean; contactName: string; contactPhone: string; contactEmail: string;
|
||||
location: string;
|
||||
location: string; allowNamedAttendees: boolean;
|
||||
}
|
||||
|
||||
const blankDraft = (location = ""): EventDraft => ({
|
||||
@@ -777,7 +777,7 @@ const blankDraft = (location = ""): EventDraft => ({
|
||||
registrationDeadline: "", goLiveAt: "", price: "", picture: "",
|
||||
redirectUrl: "", isActive: true, isHidden: false, requiresAuth: true,
|
||||
requiresRegistration: true, contactName: "", contactPhone: "", contactEmail: "",
|
||||
location,
|
||||
location, allowNamedAttendees: false,
|
||||
});
|
||||
|
||||
const blankOptions = (): OptionDraft[] => [
|
||||
@@ -812,6 +812,7 @@ function EventModal({ mode, event: ev, onClose, onSuccess }: EventModalProps) {
|
||||
price: String(ev.price ?? ""), picture: ev.picture || "", redirectUrl: ev.redirectUrl || "",
|
||||
isActive: ev.isActive !== false, isHidden: !!ev.isHidden, requiresAuth: ev.requiresAuth !== false,
|
||||
requiresRegistration: ev.requiresRegistration !== false,
|
||||
allowNamedAttendees: !!ev.allowNamedAttendees,
|
||||
contactName: ev.contactName || "", contactPhone: ev.contactPhone || "", contactEmail: ev.contactEmail || "",
|
||||
location: ev.location || "",
|
||||
} : blankDraft(settings.org_address || ""));
|
||||
@@ -1085,6 +1086,7 @@ function EventModal({ mode, event: ev, onClose, onSuccess }: EventModalProps) {
|
||||
picture: draft.picture || undefined, isHidden: draft.isHidden, requiresAuth: draft.requiresAuth,
|
||||
redirectUrl: draft.redirectUrl?.trim().replace(/\s+/g, "-") || undefined,
|
||||
requiresRegistration: draft.requiresRegistration,
|
||||
allowNamedAttendees: draft.allowNamedAttendees,
|
||||
contactName: draft.contactName || undefined,
|
||||
contactPhone: draft.contactPhone || undefined,
|
||||
contactEmail: draft.contactEmail || undefined,
|
||||
@@ -1339,6 +1341,10 @@ function EventModal({ mode, event: ev, onClose, onSuccess }: EventModalProps) {
|
||||
<input type="checkbox" className="mt-0.5" checked={!draft.requiresAuth} onChange={e => upd({ requiresAuth: !e.target.checked })} />
|
||||
<span><strong>Allow guest registration</strong> — attendees can register without creating an account</span>
|
||||
</label>
|
||||
<label className="flex items-start gap-2 text-sm cursor-pointer">
|
||||
<input type="checkbox" className="mt-0.5" checked={draft.allowNamedAttendees} onChange={e => upd({ allowNamedAttendees: e.target.checked })} />
|
||||
<span><strong>Named attendees (group tickets)</strong> — someone registering several people can give each a name, so each gets their own ticket and attendee form</span>
|
||||
</label>
|
||||
{mode === "edit" && (
|
||||
<label className="flex items-start gap-2 text-sm cursor-pointer">
|
||||
<input type="checkbox" className="mt-0.5" checked={draft.isActive} onChange={e => upd({ isActive: e.target.checked })} />
|
||||
|
||||
@@ -7,6 +7,7 @@ import { apiFetch, fetchAllUsers } from "@/lib/api";
|
||||
import { scoreUser } from "@/lib/fuzzyMatch";
|
||||
import { useDismissingState } from "@/hooks/useDismissingState";
|
||||
import { CouponCodeField, AppliedCoupon } from "@/components/shared/CouponCodeField";
|
||||
import { AttendeeNamesEditor, AttendeeEntries, TicketDelivery, attendeesPayload } from "@/components/shared/AttendeeNamesEditor";
|
||||
import { UserPlus, CreditCard } from "lucide-react";
|
||||
|
||||
// ─── Pricing helpers ─────────────────────────────────────────────────────────
|
||||
@@ -218,6 +219,12 @@ export default function ManualRegistrationPage() {
|
||||
|
||||
// Discount code, checked against the picked account (or a walk-in when none is picked).
|
||||
const [coupon, setCoupon] = useState<AppliedCoupon | null>(null);
|
||||
// Named attendees (group tickets), when the event takes them.
|
||||
const [namingOthers, setNamingOthers] = useState(false);
|
||||
const [attendeeEntries, setAttendeeEntries] = useState<AttendeeEntries>({});
|
||||
const [delivery, setDelivery] = useState<TicketDelivery>("payer");
|
||||
const manualQtyFor = (optionId: string, variantId: string | null) => quantities[variantId ? `${optionId}::${variantId}` : optionId] || 0;
|
||||
const selectedEventAllowsNames = !!events.find(ev => ev.id === selectedEventId)?.allowNamedAttendees;
|
||||
const [pickedUserId, setPickedUserId] = useState<string | null>(null);
|
||||
|
||||
const selectUser = (u: any) => {
|
||||
@@ -315,6 +322,9 @@ export default function ManualRegistrationPage() {
|
||||
user: guest,
|
||||
notificationPreference: resolvedPref,
|
||||
...(coupon ? { couponCode: coupon.code } : {}),
|
||||
...(selectedEventAllowsNames && namingOthers && attendeesPayload(options, manualQtyFor, attendeeEntries).length > 0
|
||||
? { attendees: attendeesPayload(options, manualQtyFor, attendeeEntries), ticketDelivery: delivery }
|
||||
: {}),
|
||||
}
|
||||
});
|
||||
setMessage(res?.couponError
|
||||
@@ -336,6 +346,9 @@ export default function ManualRegistrationPage() {
|
||||
setDropdownOpen(false);
|
||||
setCoupon(null);
|
||||
setPickedUserId(null);
|
||||
setNamingOthers(false);
|
||||
setAttendeeEntries({});
|
||||
setDelivery("payer");
|
||||
setQuantities(prev => Object.fromEntries(Object.keys(prev).map(k => [k, 0])));
|
||||
} catch (e: any) {
|
||||
setError(e?.message || "Failed to create manual registration");
|
||||
@@ -592,6 +605,22 @@ export default function ManualRegistrationPage() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
{selectedEventAllowsNames && (
|
||||
<div className="mt-6">
|
||||
<AttendeeNamesEditor
|
||||
options={options}
|
||||
qtyFor={manualQtyFor}
|
||||
enabled={namingOthers}
|
||||
onEnabledChange={setNamingOthers}
|
||||
entries={attendeeEntries}
|
||||
onEntriesChange={setAttendeeEntries}
|
||||
delivery={delivery}
|
||||
onDeliveryChange={setDelivery}
|
||||
payerLabel="the person registering"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{selectedEventId && totalDue > 0 && (
|
||||
<div className="mt-6 max-w-md">
|
||||
<CouponCodeField
|
||||
|
||||
@@ -8,6 +8,7 @@ import { formatPaymentMethod } from "@/lib/paymentMethod";
|
||||
import { QrImage } from "@/components/shared/QrImage";
|
||||
import { ApiImage } from "@/components/shared/ApiImage";
|
||||
import { useDismissingState } from "@/hooks/useDismissingState";
|
||||
import { AttendeesPanel } from "@/components/shared/AttendeesPanel";
|
||||
import { ClipboardList, Calendar, Ticket, ChevronRight } from "lucide-react";
|
||||
|
||||
// Helper formatters
|
||||
@@ -381,7 +382,7 @@ export default function UserDashboardPage() {
|
||||
${dateStr ? `<div class="date">${dateStr}</div>` : ''}
|
||||
</div>
|
||||
<div class="type">${type}</div>
|
||||
<div class="qty">Qty: <strong>${qty}</strong></div>
|
||||
${t.attendee?.name ? `<div class="qty">Name: <strong>${t.attendee.name}</strong></div>` : `<div class="qty">Qty: <strong>${qty}</strong></div>`}
|
||||
<div class="qrwrap"><img src="${qrSrc}" alt="QR" /></div>
|
||||
<div class="meta">Ticket ID: ${t.id}</div>
|
||||
${buyerName ? `<div class="meta">Purchased by: ${buyerName}</div>` : ''}
|
||||
@@ -532,6 +533,17 @@ export default function UserDashboardPage() {
|
||||
}
|
||||
};
|
||||
|
||||
// Re-fetch registrations and tickets after something on one changes (attendee names).
|
||||
const reloadAfterAttendees = async () => {
|
||||
if (!token) return;
|
||||
try {
|
||||
const myRegs = await apiFetch<any[]>(`/api/registrations/myregistrations?showPast=${showPast ? '1' : '0'}`, { authToken: token });
|
||||
setRegistrations(myRegs);
|
||||
const myTicks = await apiFetch<any[]>("/api/tickets/mytickets", { authToken: token });
|
||||
setTickets(myTicks);
|
||||
} catch {}
|
||||
};
|
||||
|
||||
// Cancel registration state
|
||||
const [cancelLoading, setCancelLoading] = useState(false);
|
||||
const [showCancelConfirm, setShowCancelConfirm] = useState(false);
|
||||
@@ -971,8 +983,11 @@ export default function UserDashboardPage() {
|
||||
</div>
|
||||
<div className="text-sm text-gray-700">{type}</div>
|
||||
<div className="text-xs font-medium text-blue-700 bg-blue-50 rounded px-2 py-0.5 inline-block">
|
||||
Qty: {t.quantity || 1}
|
||||
{t.attendee?.name ? <>For: {t.attendee.name}</> : <>Qty: {t.quantity || 1}</>}
|
||||
</div>
|
||||
{t.userId && user?.id && t.userId !== user.id && t.user?.name && (
|
||||
<div className="text-xs text-gray-500">Booked by {t.user.name}</div>
|
||||
)}
|
||||
<div className="flex justify-center"><QrImage value={t.qrCode || t.id} size={120} className="w-28 h-28" /></div>
|
||||
<div className="text-center text-xs text-gray-500">#{t.id.slice(0, 8)}</div>
|
||||
<div className="flex gap-2 pt-1 flex-wrap">
|
||||
@@ -1202,6 +1217,16 @@ export default function UserDashboardPage() {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{token && (
|
||||
<AttendeesPanel
|
||||
registration={activeReg}
|
||||
token={token}
|
||||
canEdit={canModifyActive}
|
||||
hasForm={!!(activeReg.event?.form?.fields || []).length}
|
||||
onSaved={reloadAfterAttendees}
|
||||
onMessage={setInfo}
|
||||
/>
|
||||
)}
|
||||
{activeBill && activeBill.payments.length > 0 && (
|
||||
<div>
|
||||
<div className="font-medium mb-1">Payments</div>
|
||||
|
||||
@@ -15,6 +15,8 @@ function FormsContent() {
|
||||
const router = useRouter();
|
||||
const { token } = useAuth();
|
||||
const registrationId = search.get("registrationId");
|
||||
// Set when a named attendee opens the link sent to them — show only their form.
|
||||
const onlyAttendeeId = search.get("attendeeId");
|
||||
|
||||
const [registration, setRegistration] = useState<any | null>(null);
|
||||
const [eventForm, setEventForm] = useState<{ isRequired: boolean; fields: FormField[] } | null>(null);
|
||||
@@ -22,8 +24,8 @@ function FormsContent() {
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [info, setInfo] = useState<string | null>(null);
|
||||
|
||||
// Local entry state for new responses
|
||||
const [formsData, setFormsData] = useState<Record<number, Record<string, string>>>({});
|
||||
// Local entry state for new responses, keyed by form block (see `blocks` below)
|
||||
const [formsData, setFormsData] = useState<Record<string, Record<string, string>>>({});
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
@@ -65,7 +67,28 @@ function FormsContent() {
|
||||
}
|
||||
}, [registration]);
|
||||
|
||||
const remaining = Math.max(0, requiredCount - submittedCount);
|
||||
// One form block per place still to fill: each named attendee (group tickets) by name,
|
||||
// then numbered blocks for unnamed places. Unnamed blocks keep their old numeric keys,
|
||||
// so drafts saved before attendees existed still prefill.
|
||||
type FormBlock = { key: string; label: string; attendeeId?: string };
|
||||
const blocks = useMemo((): FormBlock[] => {
|
||||
if (!registration) return [];
|
||||
const responses = registration.formResponses || [];
|
||||
const answered = new Set(responses.map((r: any) => r.attendeeId).filter(Boolean));
|
||||
const attendees = (registration.attendees || []) as any[];
|
||||
const named = attendees
|
||||
.filter(a => !answered.has(a.id))
|
||||
.map(a => ({ key: `a:${a.id}`, label: a.name, attendeeId: a.id as string }));
|
||||
const unnamedPlaces = Math.max(0, requiredCount - attendees.length);
|
||||
const unnamedAnswered = responses.filter((r: any) => !r.attendeeId).length;
|
||||
const unnamed = Array.from({ length: Math.max(0, unnamedPlaces - unnamedAnswered) }, (_, i) => ({
|
||||
key: String(i), label: `Attendee ${unnamedAnswered + i + 1}`,
|
||||
}));
|
||||
const all: FormBlock[] = [...named, ...unnamed];
|
||||
return onlyAttendeeId ? all.filter(b => b.attendeeId === onlyAttendeeId) : all;
|
||||
}, [registration, requiredCount, onlyAttendeeId]);
|
||||
const remaining = blocks.length;
|
||||
const attendeeName = (id: string | null | undefined) => (registration?.attendees || []).find((a: any) => a.id === id)?.name;
|
||||
|
||||
// Determine if all required fields are filled for each attendee form to be submitted
|
||||
const canSubmit = useMemo(() => {
|
||||
@@ -73,8 +96,8 @@ function FormsContent() {
|
||||
const reqFields = (eventForm.fields || [])
|
||||
.filter(f => !!f.isRequired && f.type !== 'statement' && f.type !== 'paragraph')
|
||||
.map(f => f.id);
|
||||
for (let i = 0; i < remaining; i++) {
|
||||
const data = formsData[i] || {};
|
||||
for (const b of blocks) {
|
||||
const data = formsData[b.key] || {};
|
||||
for (const fid of reqFields) {
|
||||
const v = data[fid];
|
||||
if (v === undefined || v === null || String(v).trim() === '') {
|
||||
@@ -83,16 +106,13 @@ function FormsContent() {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}, [eventForm, formsData, remaining]);
|
||||
}, [eventForm, formsData, remaining, blocks]);
|
||||
|
||||
const submit = async () => {
|
||||
if (!registrationId) return;
|
||||
try {
|
||||
setError(null); setInfo(null);
|
||||
const payload: any[] = [];
|
||||
for (let i = 0; i < remaining; i++) {
|
||||
payload.push({ answers: formsData[i] || {} });
|
||||
}
|
||||
const payload = blocks.map(b => ({ ...(b.attendeeId ? { attendeeId: b.attendeeId } : {}), answers: formsData[b.key] || {} }));
|
||||
if (payload.length === 0) {
|
||||
// Nothing left to submit – still go to success page to continue the flow
|
||||
const totalDue = (registration?.registrationOptions || []).reduce((s: number, ro: any) => s + ((ro.eventOption?.price || 0) * (ro.quantity || 0)), 0);
|
||||
@@ -191,7 +211,7 @@ function FormsContent() {
|
||||
<ul className="space-y-2">
|
||||
{(registration.formResponses || []).map((resp: any, idx: number) => (
|
||||
<li key={resp.id} className="bg-white border rounded p-2">
|
||||
<div className="font-medium text-sm mb-1">Attendee {idx + 1}</div>
|
||||
<div className="font-medium text-sm mb-1">{attendeeName(resp.attendeeId) || `Attendee ${idx + 1}`}</div>
|
||||
{(resp.answers || []).length === 0 ? (
|
||||
<div className="text-xs text-gray-600">No answers recorded.</div>
|
||||
) : (
|
||||
@@ -214,9 +234,9 @@ function FormsContent() {
|
||||
<div className="border rounded p-3 bg-gray-50">
|
||||
<div className="text-sm font-medium mb-2">Fill remaining attendee details ({remaining})</div>
|
||||
<div className="space-y-4">
|
||||
{Array.from({ length: remaining }, (_, idx) => (
|
||||
{blocks.map(({ key: idx, label }) => (
|
||||
<div key={idx} className="bg-white border rounded p-3">
|
||||
<div className="font-medium mb-2">Attendee {submittedCount + idx + 1}</div>
|
||||
<div className="font-medium mb-2">{label}</div>
|
||||
{eventForm.fields.map((f) => (
|
||||
<div key={f.id} className="mb-2">
|
||||
{f.type === 'statement' ? (
|
||||
@@ -252,7 +272,9 @@ function FormsContent() {
|
||||
</div>
|
||||
<div className="mt-3 flex gap-2">
|
||||
<button className="px-3 py-1.5 text-sm rounded bg-brand-600 text-white hover:bg-brand-700 disabled:opacity-50" disabled={!canSubmit} onClick={submit}>Submit</button>
|
||||
<button className="px-3 py-1.5 text-sm rounded bg-gray-100 hover:bg-gray-200" onClick={saveDraft}>Save for later</button>
|
||||
{!onlyAttendeeId && (
|
||||
<button className="px-3 py-1.5 text-sm rounded bg-gray-100 hover:bg-gray-200" onClick={saveDraft}>Save for later</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -4,6 +4,7 @@ import React, { useEffect, useMemo, useState } from "react";
|
||||
import { useAuth } from "@/hooks/useAuth";
|
||||
import { apiFetch } from "@/lib/api";
|
||||
import { CouponCodeField, AppliedCoupon } from "@/components/shared/CouponCodeField";
|
||||
import { AttendeeNamesEditor, AttendeeEntries, TicketDelivery, attendeesPayload } from "@/components/shared/AttendeeNamesEditor";
|
||||
|
||||
// Tiered low-stock threshold — mirrors events/[id]/page.tsx
|
||||
function lowStockThreshold(stockLimit: number): number {
|
||||
@@ -40,6 +41,7 @@ type Event = {
|
||||
eventOptions?: EventOption[];
|
||||
form?: { isRequired: boolean; fields?: any[] } | null;
|
||||
requiresAuth?: boolean;
|
||||
allowNamedAttendees?: boolean;
|
||||
};
|
||||
|
||||
// Key format: "optionId" for no-variant options, "optionId:variantId" for variant options
|
||||
@@ -248,6 +250,13 @@ export default function RegisterForm({ event }: { event: Event }) {
|
||||
const [creatingCheckout, setCreatingCheckout] = useState(false);
|
||||
const [creatingRegistration, setCreatingRegistration] = useState(false);
|
||||
const [coupon, setCoupon] = useState<AppliedCoupon | null>(null);
|
||||
const [namingOthers, setNamingOthers] = useState(false);
|
||||
const [attendeeEntries, setAttendeeEntries] = useState<AttendeeEntries>({});
|
||||
const [delivery, setDelivery] = useState<TicketDelivery>("payer");
|
||||
const qtyFor = (optionId: string, variantId: string | null) => quantities[variantId ? `${optionId}:${variantId}` : optionId] || 0;
|
||||
const namedAttendees = () => (event.allowNamedAttendees && namingOthers
|
||||
? attendeesPayload(event.eventOptions || [], qtyFor, attendeeEntries)
|
||||
: []);
|
||||
|
||||
// Guest details (for unauthenticated free-event registration)
|
||||
const [guestName, setGuestName] = useState("");
|
||||
@@ -330,7 +339,12 @@ export default function RegisterForm({ event }: { event: Event }) {
|
||||
setCreatingRegistration(true);
|
||||
const res = await apiFetch<{ id: string; totalDueComputed?: number; couponError?: string }>("/api/registrations", {
|
||||
method: "POST",
|
||||
body: { eventId, options: items, ...(coupon ? { couponCode: coupon.code } : {}) },
|
||||
body: {
|
||||
eventId,
|
||||
options: items,
|
||||
...(coupon ? { couponCode: coupon.code } : {}),
|
||||
...(namedAttendees().length > 0 ? { attendees: namedAttendees(), ticketDelivery: delivery } : {}),
|
||||
},
|
||||
authToken: token,
|
||||
});
|
||||
if (res?.id) {
|
||||
@@ -370,7 +384,10 @@ export default function RegisterForm({ event }: { event: Event }) {
|
||||
setCreatingRegistration(true);
|
||||
const res = await apiFetch<{ id: string }>("/api/registrations", {
|
||||
method: "POST",
|
||||
body: { eventId, options: items, guestName: guestName.trim(), guestEmail: guestEmail.trim(), guestPhone: guestPhone.trim() || undefined },
|
||||
body: {
|
||||
eventId, options: items, guestName: guestName.trim(), guestEmail: guestEmail.trim(), guestPhone: guestPhone.trim() || undefined,
|
||||
...(namedAttendees().length > 0 ? { attendees: namedAttendees(), ticketDelivery: delivery } : {}),
|
||||
},
|
||||
});
|
||||
if (res?.id) {
|
||||
const hasForm = !!(event?.form && Array.isArray(event.form.fields) && event.form.fields.length > 0);
|
||||
@@ -488,6 +505,21 @@ export default function RegisterForm({ event }: { event: Event }) {
|
||||
);
|
||||
})()}
|
||||
|
||||
{event.allowNamedAttendees && !eventSoldOut && (isLoggedIn || showGuestForm) && (
|
||||
<div className="mt-6">
|
||||
<AttendeeNamesEditor
|
||||
options={event.eventOptions || []}
|
||||
qtyFor={qtyFor}
|
||||
enabled={namingOthers}
|
||||
onEnabledChange={setNamingOthers}
|
||||
entries={attendeeEntries}
|
||||
onEntriesChange={setAttendeeEntries}
|
||||
delivery={delivery}
|
||||
onDeliveryChange={setDelivery}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isLoggedIn && total > 0 && !eventSoldOut && (
|
||||
<div className="mt-6">
|
||||
<CouponCodeField eventId={eventId} basket={basket} token={token} applied={coupon} onChange={setCoupon} />
|
||||
|
||||
@@ -4,6 +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";
|
||||
|
||||
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||
type EarlyBirdTier = { deadline: string; price: number; order?: number; variantId?: string | null };
|
||||
@@ -39,6 +40,7 @@ type KioskEvent = {
|
||||
picture?: string;
|
||||
eventOptions?: EventOption[];
|
||||
form?: EventForm | null;
|
||||
allowNamedAttendees?: boolean;
|
||||
};
|
||||
|
||||
type Screen = "setup" | "form" | "eventform" | "confirmation";
|
||||
@@ -136,6 +138,9 @@ export default function SelfServicePage() {
|
||||
const [setupError, setSetupError] = useState<string | null>(null);
|
||||
const [supervisorToken, setSupervisorToken] = useState<string | null>(null);
|
||||
const [kioskCoupon, setKioskCoupon] = useState<AppliedCoupon | null>(null);
|
||||
const [namingOthers, setNamingOthers] = useState(false);
|
||||
const [attendeeEntries, setAttendeeEntries] = useState<AttendeeEntries>({});
|
||||
const [delivery, setDelivery] = useState<TicketDelivery>("payer");
|
||||
// Set while a supervisor with two-factor on still has to enter their code.
|
||||
const [setupChallenge, setSetupChallenge] = useState<TwoFactorChallenge | null>(null);
|
||||
const [setupCode, setSetupCode] = useState("");
|
||||
@@ -412,6 +417,13 @@ export default function SelfServicePage() {
|
||||
notificationPreference: notificationPref,
|
||||
...(kioskCoupon ? { couponCode: kioskCoupon.code } : {}),
|
||||
};
|
||||
const kioskNames = selectedEvent?.allowNamedAttendees && namingOthers
|
||||
? attendeesPayload(selectedEvent.eventOptions || [], (o, v) => quantities[v ? `${o}::${v}` : o] || 0, attendeeEntries)
|
||||
: [];
|
||||
if (kioskNames.length > 0) {
|
||||
payload.attendees = kioskNames;
|
||||
payload.ticketDelivery = delivery;
|
||||
}
|
||||
if (createAccount && visitorPassword) {
|
||||
payload.user.password = visitorPassword;
|
||||
}
|
||||
@@ -526,6 +538,9 @@ export default function SelfServicePage() {
|
||||
|
||||
function resetForm() {
|
||||
setKioskCoupon(null);
|
||||
setNamingOthers(false);
|
||||
setAttendeeEntries({});
|
||||
setDelivery("payer");
|
||||
setVisitorName("");
|
||||
setVisitorEmail("");
|
||||
setVisitorPhone("");
|
||||
@@ -993,6 +1008,20 @@ export default function SelfServicePage() {
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
{selectedEvent?.allowNamedAttendees && (
|
||||
<div className="mt-4">
|
||||
<AttendeeNamesEditor
|
||||
options={selectedEvent.eventOptions || []}
|
||||
qtyFor={(o, v) => quantities[v ? `${o}::${v}` : o] || 0}
|
||||
enabled={namingOthers}
|
||||
onEnabledChange={setNamingOthers}
|
||||
entries={attendeeEntries}
|
||||
onEntriesChange={setAttendeeEntries}
|
||||
delivery={delivery}
|
||||
onDeliveryChange={setDelivery}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{total > 0 && selectedEventId && (
|
||||
<div className="mt-4">
|
||||
<CouponCodeField
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { Users } from "lucide-react";
|
||||
|
||||
export type AttendeeOption = {
|
||||
id: string;
|
||||
name: string;
|
||||
isMainTicket?: boolean;
|
||||
variants?: { id: string; name: string }[] | null;
|
||||
};
|
||||
|
||||
export type AttendeeEntry = { name: string; email: string; phone: string };
|
||||
export type AttendeeEntries = Record<string, AttendeeEntry>;
|
||||
export type TicketDelivery = "payer" | "each";
|
||||
|
||||
export type AttendeePayload = { eventOptionId: string; variantId?: string | null; name: string; email?: string; phone?: string };
|
||||
|
||||
type Slot = { key: string; eventOptionId: string; variantId: string | null; label: string };
|
||||
|
||||
/**
|
||||
* One slot per main-ticket place in the basket. `qtyFor(optionId, variantId)` reads the
|
||||
* caller's quantities (each page keys its quantity map differently).
|
||||
*/
|
||||
function slotsFor(options: AttendeeOption[], qtyFor: (optionId: string, variantId: string | null) => number): Slot[] {
|
||||
const slots: Slot[] = [];
|
||||
for (const o of options) {
|
||||
if (!o.isMainTicket) continue;
|
||||
const variants = o.variants || [];
|
||||
const lines = variants.length > 0 ? variants.map(v => ({ variantId: v.id, label: `${o.name} (${v.name})` })) : [{ variantId: null, label: o.name }];
|
||||
for (const line of lines) {
|
||||
const qty = qtyFor(o.id, line.variantId);
|
||||
for (let i = 0; i < qty; i++) {
|
||||
slots.push({ key: `${o.id}::${line.variantId || ""}#${i}`, eventOptionId: o.id, variantId: line.variantId, label: `${line.label} ${i + 1}` });
|
||||
}
|
||||
}
|
||||
}
|
||||
return slots;
|
||||
}
|
||||
|
||||
/** The named places as the API expects them (unnamed places are left out). */
|
||||
export function attendeesPayload(options: AttendeeOption[], qtyFor: (optionId: string, variantId: string | null) => number, entries: AttendeeEntries): AttendeePayload[] {
|
||||
return slotsFor(options, qtyFor)
|
||||
.map(s => ({ s, e: entries[s.key] }))
|
||||
.filter(({ e }) => e && e.name.trim())
|
||||
.map(({ s, e }) => ({
|
||||
eventOptionId: s.eventOptionId,
|
||||
...(s.variantId ? { variantId: s.variantId } : {}),
|
||||
name: e.name.trim(),
|
||||
...(e.email.trim() ? { email: e.email.trim() } : {}),
|
||||
...(e.phone.trim() ? { phone: e.phone.trim() } : {}),
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* "Registering for other people?" — a name (and optional email/phone) for each main
|
||||
* ticket place, plus who gets the tickets. Named places get their own ticket; any left
|
||||
* blank share one ticket as usual.
|
||||
*/
|
||||
export function AttendeeNamesEditor({
|
||||
options,
|
||||
qtyFor,
|
||||
enabled,
|
||||
onEnabledChange,
|
||||
entries,
|
||||
onEntriesChange,
|
||||
delivery,
|
||||
onDeliveryChange,
|
||||
payerLabel = "me",
|
||||
}: {
|
||||
options: AttendeeOption[];
|
||||
qtyFor: (optionId: string, variantId: string | null) => number;
|
||||
enabled: boolean;
|
||||
onEnabledChange: (v: boolean) => void;
|
||||
entries: AttendeeEntries;
|
||||
onEntriesChange: (v: AttendeeEntries) => void;
|
||||
delivery: TicketDelivery;
|
||||
onDeliveryChange: (v: TicketDelivery) => void;
|
||||
payerLabel?: string;
|
||||
}) {
|
||||
const slots = slotsFor(options, qtyFor);
|
||||
const set = (key: string, field: keyof AttendeeEntry, value: string) => {
|
||||
const prev = entries[key] || { name: "", email: "", phone: "" };
|
||||
onEntriesChange({ ...entries, [key]: { ...prev, [field]: value } });
|
||||
};
|
||||
const inputCls = "w-full border rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-brand-400";
|
||||
|
||||
return (
|
||||
<div className="border rounded-xl p-4 bg-white shadow-sm">
|
||||
<label className="flex items-center gap-2 text-sm font-medium text-gray-800 cursor-pointer">
|
||||
<input type="checkbox" checked={enabled} onChange={e => onEnabledChange(e.target.checked)} />
|
||||
<Users className="w-4 h-4 text-brand-600" />
|
||||
Registering for other people?
|
||||
</label>
|
||||
{enabled && (
|
||||
<div className="mt-3 space-y-3">
|
||||
{slots.length === 0 ? (
|
||||
<p className="text-sm text-gray-500">Choose how many tickets first, then add a name for each person.</p>
|
||||
) : (
|
||||
<>
|
||||
<p className="text-xs text-gray-500">Each named person gets their own ticket and their own attendee form. Leave a name blank to keep that ticket with the others.</p>
|
||||
{slots.map(s => {
|
||||
const e = entries[s.key] || { name: "", email: "", phone: "" };
|
||||
return (
|
||||
<div key={s.key} className="border rounded-lg p-3">
|
||||
<div className="text-xs font-semibold text-gray-600 mb-2">{s.label}</div>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-3 gap-2">
|
||||
<input className={inputCls} placeholder="Full name" value={e.name} onChange={ev => set(s.key, "name", ev.target.value)} aria-label={`${s.label} name`} />
|
||||
<input type="email" className={inputCls} placeholder="Email (optional)" value={e.email} onChange={ev => set(s.key, "email", ev.target.value)} aria-label={`${s.label} email`} />
|
||||
<input type="tel" className={inputCls} placeholder="Phone (optional)" value={e.phone} onChange={ev => set(s.key, "phone", ev.target.value)} aria-label={`${s.label} phone`} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<fieldset className="pt-1">
|
||||
<legend className="text-sm font-medium text-gray-700 mb-1">Send the tickets</legend>
|
||||
<label className="flex items-center gap-2 text-sm text-gray-700">
|
||||
<input type="radio" name="ticket-delivery" checked={delivery === "payer"} onChange={() => onDeliveryChange("payer")} /> All to {payerLabel}
|
||||
</label>
|
||||
<label className="flex items-center gap-2 text-sm text-gray-700">
|
||||
<input type="radio" name="ticket-delivery" checked={delivery === "each"} onChange={() => onDeliveryChange("each")} /> Each person their own (by their email or WhatsApp; anyone without contact details goes to {payerLabel})
|
||||
</label>
|
||||
</fieldset>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
"use client";
|
||||
|
||||
import React, { useMemo, useState } from "react";
|
||||
import { Users, Send } from "lucide-react";
|
||||
import { apiFetch } from "@/lib/api";
|
||||
|
||||
type Attendee = { id: string; eventOptionId: string; variantId: string | null; name: string; email: string | null; phone: string | null; ticket?: { id: string; isUsed: boolean } | null };
|
||||
type Row = { id?: string; eventOptionId: string; variantId: string | null; label: string; name: string; email: string; phone: string; locked: boolean };
|
||||
|
||||
/**
|
||||
* Named attendees on a registration (group tickets): shows who each main-ticket place
|
||||
* is for, and lets the payer (or staff) name places, change details, choose where the
|
||||
* tickets go, and send an attendee the link to their own form.
|
||||
*/
|
||||
export function AttendeesPanel({ registration, token, canEdit, hasForm, onSaved, onMessage }: {
|
||||
registration: any;
|
||||
token: string;
|
||||
canEdit: boolean;
|
||||
hasForm: boolean;
|
||||
onSaved: () => void;
|
||||
onMessage: (msg: string) => void;
|
||||
}) {
|
||||
const attendees: Attendee[] = registration.attendees || [];
|
||||
const [editing, setEditing] = useState(false);
|
||||
const [rows, setRows] = useState<Row[]>([]);
|
||||
const [delivery, setDelivery] = useState<"payer" | "each">(registration.ticketDelivery || "payer");
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
// One row per main-ticket place: named ones first (in order), then blanks.
|
||||
const buildRows = useMemo(() => () => {
|
||||
const out: Row[] = [];
|
||||
for (const ro of registration.registrationOptions || []) {
|
||||
if (!ro.eventOption?.isMainTicket) continue;
|
||||
const label = `${ro.eventOption?.name || "Ticket"}${ro.variant?.name ? ` (${ro.variant.name})` : ""}`;
|
||||
const named = attendees.filter(a => a.eventOptionId === ro.eventOptionId && (a.variantId || null) === (ro.variantId || null));
|
||||
for (let i = 0; i < (ro.quantity || 0); i++) {
|
||||
const a = named[i];
|
||||
out.push({
|
||||
id: a?.id, eventOptionId: ro.eventOptionId, variantId: ro.variantId || null, label: `${label} ${i + 1}`,
|
||||
name: a?.name || "", email: a?.email || "", phone: a?.phone || "",
|
||||
locked: !!a?.ticket?.isUsed,
|
||||
});
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}, [registration, attendees]);
|
||||
|
||||
if (!registration.event?.allowNamedAttendees && attendees.length === 0) return null;
|
||||
|
||||
const startEdit = () => { setRows(buildRows()); setDelivery(registration.ticketDelivery || "payer"); setError(null); setEditing(true); };
|
||||
const update = (i: number, field: "name" | "email" | "phone", value: string) => setRows(prev => prev.map((r, j) => (j === i ? { ...r, [field]: value } : r)));
|
||||
|
||||
const save = async () => {
|
||||
setBusy(true);
|
||||
setError(null);
|
||||
try {
|
||||
await apiFetch(`/api/registrations/${encodeURIComponent(registration.id)}/attendees`, {
|
||||
method: "PUT",
|
||||
authToken: token,
|
||||
body: {
|
||||
ticketDelivery: delivery,
|
||||
attendees: rows.filter(r => r.name.trim()).map(r => ({
|
||||
...(r.id ? { id: r.id } : {}),
|
||||
eventOptionId: r.eventOptionId,
|
||||
...(r.variantId ? { variantId: r.variantId } : {}),
|
||||
name: r.name.trim(),
|
||||
email: r.email.trim() || undefined,
|
||||
phone: r.phone.trim() || undefined,
|
||||
})),
|
||||
},
|
||||
});
|
||||
setEditing(false);
|
||||
onMessage("Attendees saved.");
|
||||
onSaved();
|
||||
} catch (e: any) {
|
||||
setError(e?.message || "Couldn't save attendees");
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
const sendLink = async (a: Attendee) => {
|
||||
try {
|
||||
const res = await apiFetch<{ message: string }>(`/api/registrations/${encodeURIComponent(registration.id)}/attendees/${encodeURIComponent(a.id)}/send-form-link`, { method: "POST", authToken: token });
|
||||
onMessage(res.message);
|
||||
} catch (e: any) {
|
||||
setError(e?.message || "Couldn't send the form link");
|
||||
}
|
||||
};
|
||||
|
||||
const answered = new Set((registration.formResponses || []).map((r: any) => r.attendeeId).filter(Boolean));
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="font-medium mb-1 flex items-center justify-between">
|
||||
<span className="flex items-center gap-1.5"><Users className="w-4 h-4 text-brand-600" /> People</span>
|
||||
{canEdit && !editing && (
|
||||
<button onClick={startEdit} className="px-2.5 py-1 text-xs bg-brand-600 text-white rounded hover:bg-brand-700">{attendees.length ? "Edit names" : "Add names"}</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{!editing ? (
|
||||
attendees.length === 0 ? (
|
||||
<p className="text-sm text-gray-500">No names yet — add a name for each person to give them their own ticket.</p>
|
||||
) : (
|
||||
<>
|
||||
<ul className="text-sm space-y-1">
|
||||
{attendees.map(a => (
|
||||
<li key={a.id} className="flex items-center justify-between gap-2">
|
||||
<span>
|
||||
{a.name}
|
||||
{(a.email || a.phone) && <span className="text-xs text-gray-500"> · {[a.email, a.phone].filter(Boolean).join(" · ")}</span>}
|
||||
{hasForm && <span className={`ml-2 text-xs ${answered.has(a.id) ? "text-green-700" : "text-amber-700"}`}>{answered.has(a.id) ? "form done" : "form to do"}</span>}
|
||||
</span>
|
||||
{canEdit && hasForm && !answered.has(a.id) && (a.email || a.phone) && (
|
||||
<button onClick={() => sendLink(a)} className="text-xs text-brand-700 hover:underline shrink-0 inline-flex items-center gap-1"><Send className="w-3 h-3" /> Send form link</button>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<p className="text-xs text-gray-500 mt-1">Tickets go {registration.ticketDelivery === "each" ? "to each person (or you, if they have no contact details)" : "to you"}.</p>
|
||||
</>
|
||||
)
|
||||
) : (
|
||||
<div className="border rounded p-3 space-y-2 bg-gray-50">
|
||||
{rows.map((r, i) => (
|
||||
<div key={i}>
|
||||
<div className="text-xs font-semibold text-gray-600 mb-1">{r.label}{r.locked && <span className="font-normal text-gray-500"> — checked in, can't be changed</span>}</div>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-3 gap-2">
|
||||
<input className="border rounded px-2 py-1 text-sm" placeholder="Full name" value={r.name} disabled={r.locked} onChange={e => update(i, "name", e.target.value)} aria-label={`${r.label} name`} />
|
||||
<input className="border rounded px-2 py-1 text-sm" placeholder="Email (optional)" value={r.email} disabled={r.locked} onChange={e => update(i, "email", e.target.value)} aria-label={`${r.label} email`} />
|
||||
<input className="border rounded px-2 py-1 text-sm" placeholder="Phone (optional)" value={r.phone} disabled={r.locked} onChange={e => update(i, "phone", e.target.value)} aria-label={`${r.label} phone`} />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<div className="text-sm pt-1">
|
||||
<label className="flex items-center gap-2"><input type="radio" checked={delivery === "payer"} onChange={() => setDelivery("payer")} /> Send all tickets to me</label>
|
||||
<label className="flex items-center gap-2"><input type="radio" checked={delivery === "each"} onChange={() => setDelivery("each")} /> Send each person their own</label>
|
||||
</div>
|
||||
{error && <p className="text-xs text-red-600">{error}</p>}
|
||||
<div className="flex gap-2">
|
||||
<button onClick={() => setEditing(false)} className="px-3 py-1 text-xs rounded bg-gray-100 hover:bg-gray-200" disabled={busy}>Cancel</button>
|
||||
<button onClick={save} disabled={busy} className="px-3 py-1 text-xs rounded bg-brand-600 text-white hover:bg-brand-700 disabled:opacity-50">{busy ? "Saving…" : "Save"}</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{!editing && error && <p className="text-xs text-red-600 mt-1">{error}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from "react";
|
||||
import { Calendar, Ticket, CreditCard, HandHeart, Printer, CheckCircle2, ClipboardList, Clock, SquarePen, History, CheckSquare, Receipt, FileText } from "lucide-react";
|
||||
import { Calendar, Ticket, CreditCard, HandHeart, Printer, CheckCircle2, ClipboardList, Clock, SquarePen, History, CheckSquare, Receipt, FileText, Users } from "lucide-react";
|
||||
import { GuideItem } from "@/components/shared/GuideItem";
|
||||
import type { HelpContent } from "./types";
|
||||
|
||||
@@ -39,6 +39,9 @@ export const dashboardUserHelpContent: HelpContent = {
|
||||
<GuideItem icon={History} title="Show past events" tone="gray">
|
||||
Registrations page defaults to upcoming events only — tick "Show past events" at the top to bring back ones that have already happened.
|
||||
</GuideItem>
|
||||
<GuideItem icon={Users} title="People on a group booking" tone="brand">
|
||||
On events that take names, the registration popup has a People section: add or change each person's name and contact details, choose whether tickets come to you or go to each person, and send someone the link to fill in their own attendee form. Tickets someone else booked for you show here too, marked "Booked by".
|
||||
</GuideItem>
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from "react";
|
||||
import { Ticket, Tag, Share2, QrCode, Calendar } from "lucide-react";
|
||||
import { Ticket, Tag, Share2, QrCode, Calendar, Users } from "lucide-react";
|
||||
import { GuideItem } from "@/components/shared/GuideItem";
|
||||
import type { HelpContent } from "./types";
|
||||
|
||||
@@ -25,6 +25,9 @@ export const eventDetailHelpContent: HelpContent = {
|
||||
<GuideItem icon={Ticket} title="Availability badges" tone="brand">
|
||||
"N remaining" appears once stock runs low, and "Sold out" once an option is fully booked.
|
||||
</GuideItem>
|
||||
<GuideItem icon={Users} title="Registering for other people?" tone="violet">
|
||||
Some events let you name each person you're booking for. Each named person gets their own ticket and their own attendee form, and you can choose to have every ticket sent to you or each person their own.
|
||||
</GuideItem>
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
|
||||
@@ -44,7 +44,7 @@ export const supervisorEventsHelpContent: HelpContent = {
|
||||
Build a custom registration form — text, number, date, yes/no, statement, and heading fields, reorderable, optionally required before tickets are generated.
|
||||
</GuideItem>
|
||||
<GuideItem icon={Eye} title="Visibility" tone="gray">
|
||||
Hide the event, allow guest (no-account) registration, or toggle it active.
|
||||
Hide the event, allow guest (no-account) registration, turn on named attendees (group tickets — each named person gets their own ticket and form), or toggle it active.
|
||||
</GuideItem>
|
||||
<GuideItem icon={Bell} title="Notifications" tone="blue">
|
||||
Choose which staff get registration, payment, and daily-summary emails for this event.
|
||||
|
||||
@@ -14,7 +14,7 @@ export const supervisorManualHelpContent: HelpContent = {
|
||||
icon: UserPlus,
|
||||
content: (
|
||||
<div className="space-y-4">
|
||||
<p>Pick an event, then either search for an existing user or enter guest details (name, and at least one of email or phone). Choose ticket options and quantities — early-bird and staff pricing are applied automatically, and a discount code can be added under "Have a code?" — then create the registration. A new guest account is created inactive, and an activation link is sent immediately (by email if provided, otherwise WhatsApp) so they can set their own password.</p>
|
||||
<p>Pick an event, then either search for an existing user or enter guest details (name, and at least one of email or phone). Choose ticket options and quantities — early-bird and staff pricing are applied automatically, and a discount code can be added under "Have a code?" — then create the registration. On events that take names, tick "Registering for other people?" to name each person. A new guest account is created inactive, and an activation link is sent immediately (by email if provided, otherwise WhatsApp) so they can set their own password.</p>
|
||||
<p className="text-xs text-gray-500">After creating a registration, the Record Payment tab is pre-filled with it — switch tabs to take payment right away.</p>
|
||||
</div>
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user