refactor(bookings): simplify capacity tracking to use seats
Replace 'pax' booking mode with 'seat' Consolidate inventory summary to track only seat counts Update database schema and UI for seat-centric capacity
This commit is contained in:
@@ -67,10 +67,11 @@ const selectedTicket = computed(() => getTicketCatalogItem(form.ticketType) ?? B
|
||||
const submittingBooking = ref(false)
|
||||
|
||||
const quantityLabel = computed(() => {
|
||||
return form.bookingMode === 'table' ? 'Number of tables' : 'Number of people'
|
||||
return form.bookingMode === 'table' ? 'Number of Tables' : 'Number of Seats'
|
||||
})
|
||||
|
||||
const totalPrice = computed(() => getSeatCount(form.bookingMode, form.quantity) * selectedTicket.value.price)
|
||||
const seatCount = computed(() => getSeatCount(form.bookingMode, form.quantity))
|
||||
const totalPrice = computed(() => seatCount.value * selectedTicket.value.price)
|
||||
|
||||
const totalFormatted = computed(() => formatBookingCurrency(totalPrice.value))
|
||||
|
||||
@@ -88,7 +89,7 @@ function validateBooking(state: typeof form): FormError[] {
|
||||
}
|
||||
|
||||
if (state.quantity < 1) {
|
||||
errors.push({ name: 'quantity', message: 'Quantity must be at least 1.' })
|
||||
errors.push({ name: 'quantity', message: `${quantityLabel.value} must be at least 1.` })
|
||||
}
|
||||
|
||||
return errors
|
||||
@@ -194,6 +195,9 @@ async function bookTicket(event: FormSubmitEvent<typeof form>) {
|
||||
|
||||
<UFormField :label="quantityLabel" name="quantity">
|
||||
<UInputNumber v-model="form.quantity" size="xl" class="w-full" :min="1" :step="1" />
|
||||
<template #help>
|
||||
This booking will generate {{ seatCount }} seat{{ seatCount === 1 ? '' : 's' }}.
|
||||
</template>
|
||||
</UFormField>
|
||||
|
||||
<UFormField label="Ticket Category" name="ticketType">
|
||||
@@ -221,7 +225,7 @@ async function bookTicket(event: FormSubmitEvent<typeof form>) {
|
||||
/>
|
||||
</UFormField>
|
||||
|
||||
<UButton id="getTicketBtn" type="submit" label="Book Your Ticket Now" size="xl"
|
||||
<UButton id="getTicketBtn" type="submit" label="Book Now" size="xl"
|
||||
class="w-full justify-center" :disabled="!selectedPersonInCharge" :loading="submittingBooking" />
|
||||
</UForm>
|
||||
</UCard>
|
||||
|
||||
Reference in New Issue
Block a user