diff --git a/app/pages/bookings/index.vue b/app/pages/bookings/index.vue index 8b69ac0..f6426bf 100644 --- a/app/pages/bookings/index.vue +++ b/app/pages/bookings/index.vue @@ -285,62 +285,43 @@ @@ -798,6 +779,59 @@ function receiptPath(booking: PublicBooking) { return `/receipt/${booking.receiptToken}` } +function isBookingRowActionBusy(booking: PublicBooking) { + return Boolean( + (deletingBookingId.value && deletingBookingId.value !== booking.id) + || (cancellingBookingId.value && cancellingBookingId.value !== booking.id) + || deletingBookingId.value === booking.id + || cancellingBookingId.value === booking.id + ) +} + +function bookingActionMenuItems(booking: PublicBooking) { + const busy = isBookingRowActionBusy(booking) + const items = [ + [ + { + label: 'Edit booking', + icon: 'i-lucide-pencil-line', + disabled: busy || !bookingConfig.value, + onSelect: () => openBookingEditor(booking) + }, + { + label: 'Transfer booking', + icon: 'i-lucide-send', + disabled: busy || !hasTransferTargets(booking), + onSelect: () => openTransferEditor(booking) + } + ] + ] + + if (booking.status === 'confirmed') { + items.push([ + { + label: 'Unconfirm booking', + icon: 'i-lucide-x-circle', + color: 'error', + disabled: busy, + onSelect: () => cancelBookingConfirmation(booking) + } + ]) + } + + items.push([ + { + label: 'Delete booking', + icon: 'i-lucide-trash-2', + color: 'error', + disabled: busy, + onSelect: () => deleteBooking(booking) + } + ]) + + return items +} + function openBookingEditor(booking: PublicBooking) { detailsBooking.value = booking detailsForm.customerName = booking.customerName diff --git a/app/pages/index.vue b/app/pages/index.vue index bb0d3b1..0c7108e 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -235,23 +235,28 @@ async function bookTicket(event: FormSubmitEvent) {