diff --git a/src/modules/activities/composables/useUserTickets.ts b/src/modules/activities/composables/useUserTickets.ts index d562086..c8571c4 100644 --- a/src/modules/activities/composables/useUserTickets.ts +++ b/src/modules/activities/composables/useUserTickets.ts @@ -66,6 +66,21 @@ export function useUserTickets() { return sortedTickets.value.filter(ticket => ticket.paid && !ticket.registered) }) + // Seat counts (sum extra.quantity across rows) so the tab pills + // surface "what the buyer bought" rather than "how many purchase + // rows are in the database". A multi-ticket purchase is one row + // with extra.quantity = N seats. + function seatsOnRow(t: ActivityTicket): number { + return Math.max(1, t.extra?.quantity ?? 1) + } + function sumSeats(arr: ActivityTicket[]): number { + return arr.reduce((total, t) => total + seatsOnRow(t), 0) + } + const totalSeats = computed(() => sumSeats(sortedTickets.value)) + const paidSeats = computed(() => sumSeats(paidTickets.value)) + const pendingSeats = computed(() => sumSeats(pendingTickets.value)) + const registeredSeats = computed(() => sumSeats(registeredTickets.value)) + const groupedTickets = computed(() => { const groups = new Map() @@ -119,6 +134,11 @@ export function useUserTickets() { registeredTickets, unregisteredTickets, groupedTickets, + totalSeats, + paidSeats, + pendingSeats, + registeredSeats, + seatsOnRow, isLoading, error, refresh: loadTickets, diff --git a/src/modules/activities/views/MyTicketsPage.vue b/src/modules/activities/views/MyTicketsPage.vue index cbf43ea..1d1347a 100644 --- a/src/modules/activities/views/MyTicketsPage.vue +++ b/src/modules/activities/views/MyTicketsPage.vue @@ -17,6 +17,11 @@ const { pendingTickets, registeredTickets, groupedTickets, + totalSeats, + paidSeats, + pendingSeats, + registeredSeats, + seatsOnRow, isLoading, error, refresh @@ -158,10 +163,10 @@ onMounted(async () => {
- All ({{ tickets.length }}) - Paid ({{ paidTickets.length }}) - Pending ({{ pendingTickets.length }}) - Registered ({{ registeredTickets.length }}) + All ({{ totalSeats }}) + Paid ({{ paidSeats }}) + Pending ({{ pendingSeats }}) + Registered ({{ registeredSeats }}) @@ -173,11 +178,14 @@ onMounted(async () => {
Event: {{ group.eventId.slice(0, 8) }}... - {{ group.tickets.length }} ticket{{ group.tickets.length !== 1 ? 's' : '' }} + {{ group.paidCount + group.pendingCount }} ticket{{ (group.paidCount + group.pendingCount) !== 1 ? 's' : '' }}
{{ group.paidCount }} paid · {{ group.pendingCount }} pending · {{ group.registeredCount }} registered + + ({{ group.tickets.length }} purchase{{ group.tickets.length !== 1 ? 's' : '' }}) + @@ -217,9 +225,18 @@ onMounted(async () => {
- - Ticket #{{ getCurrentTicket(group.tickets, group.eventId).id.slice(0, 8) }} - +
+ + Ticket #{{ getCurrentTicket(group.tickets, group.eventId).id.slice(0, 8) }} + + + ×{{ seatsOnRow(getCurrentTicket(group.tickets, group.eventId)) }} + +
{{ getTicketStatus(getCurrentTicket(group.tickets, group.eventId)).label }}