feat(events): promo codes — organizer editor and server-validated checkout discount #153

Merged
padreug merged 6 commits from feat/events-promo-codes into dev 2026-09-13 16:55:15 +00:00
2 changed files with 14 additions and 2 deletions
Showing only changes of commit 7dbe04afa3 - Show all commits

feat(events): show the redeemed promo code in the scanner roster

Maps applied_promo_code from the stats endpoint onto the roster rows as a
small outline badge and includes it in the fuzzy search keys.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ByAwHU4pRnyE58YocQvAas
Padreug 2026-09-10 12:22:13 +02:00

View file

@ -28,6 +28,8 @@ export interface EventTicket {
name?: string | null name?: string | null
registered: boolean registered: boolean
registeredAt: string | null registeredAt: string | null
/** Promo code redeemed on this ticket, when the extension reports it. */
promoCode?: string | null
} }
/** Counts + roster snapshot for the event, sourced from the backend. */ /** Counts + roster snapshot for the event, sourced from the backend. */
@ -110,6 +112,7 @@ export function useTicketScanner(eventId: Ref<string>) {
name: t.name ?? null, name: t.name ?? null,
registered: t.registered, registered: t.registered,
registeredAt: t.registered_at, registeredAt: t.registered_at,
promoCode: t.applied_promo_code ?? null,
})), })),
} }
} catch (e) { } catch (e) {

View file

@ -104,8 +104,9 @@ const { searchQuery, filteredItems: searchedTickets } = useFuzzySearch(
{ {
fuseOptions: { fuseOptions: {
keys: [ keys: [
{ name: 'name', weight: 0.7 }, { name: 'name', weight: 0.6 },
{ name: 'id', weight: 0.3 }, { name: 'id', weight: 0.25 },
{ name: 'promoCode', weight: 0.15 },
], ],
threshold: 0.3, threshold: 0.3,
ignoreLocation: true, ignoreLocation: true,
@ -296,6 +297,14 @@ function fmtTime(iso: string) {
<span v-if="ticket.name" class="font-medium text-foreground"> <span v-if="ticket.name" class="font-medium text-foreground">
{{ ticket.name }} {{ ticket.name }}
</span> </span>
<Badge
v-if="ticket.promoCode"
variant="outline"
class="text-[10px] font-mono px-1.5"
:title="ticket.promoCode"
>
{{ ticket.promoCode }}
</Badge>
</div> </div>
<p class="font-mono text-[10px] text-muted-foreground break-all mt-0.5"> <p class="font-mono text-[10px] text-muted-foreground break-all mt-0.5">
{{ ticket.id }} {{ ticket.id }}