From 3a08625cbe99dc01ef46215f362516318a9d6788 Mon Sep 17 00:00:00 2001 From: alisaza Date: Fri, 11 Sep 2026 22:56:04 +0330 Subject: [PATCH] feat(bookings): add cancellation reason column to bookings table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enhanced the bookings page and admin event bookings tab by adding a new column for 'cancellationReason'. This column displays the reason for cancellations when applicable, improving the visibility of booking statuses. Additionally, removed the 'غایب' (no-show) insight stat from the event overview tab for a cleaner presentation of event insights. --- app/(dashboard)/bookings/page.tsx | 19 +++++++++++++++++++ .../AdminEventBookingsTab.tsx | 13 +++++++++++++ .../AdminEventOverviewTab.tsx | 4 ---- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/app/(dashboard)/bookings/page.tsx b/app/(dashboard)/bookings/page.tsx index 13df326..2d18202 100644 --- a/app/(dashboard)/bookings/page.tsx +++ b/app/(dashboard)/bookings/page.tsx @@ -56,6 +56,13 @@ const columns: PaginationListColumnType[] = [ type: 'select', filterItems: BOOKING_STATUS_FILTER_ITEMS, }, + { + field: 'cancellationReason', + label: 'دلیل لغو', + filterable: false, + sortable: false, + type: 'text', + }, { field: 'checkedInAt', label: 'چک‌این', @@ -123,6 +130,18 @@ const BookingsPage = () => { /> ) }, + cancellationReason: (row, cellValue) => { + const reason = coerceToString(cellValue).trim() + const isCancelledLike = row.status === 'cancelled' || row.status === 'refunded' + + if (!isCancelledLike || !reason) return '—' + + return ( + + {reason} + + ) + }, checkedInAt: (_row, cellValue) => formatPersianDate(cellValue), createdAt: (_row, cellValue) => formatPersianDate(cellValue), actions: (row) => { diff --git a/features/events/detail/admin-event-detail/AdminEventBookingsTab.tsx b/features/events/detail/admin-event-detail/AdminEventBookingsTab.tsx index 7c2ebfb..732191f 100644 --- a/features/events/detail/admin-event-detail/AdminEventBookingsTab.tsx +++ b/features/events/detail/admin-event-detail/AdminEventBookingsTab.tsx @@ -34,6 +34,7 @@ const bookingsColumns: PaginationListColumnType[] = [ { field: 'bookingCode', label: 'کد رزرو', filterable: false, sortable: false, type: 'text' }, { field: 'userId', label: 'مهمان', filterable: false, sortable: false, type: 'text' }, { field: 'status', label: 'وضعیت', filterable: true, sortable: true, type: 'select', filterItems: BOOKING_STATUS_FILTER_ITEMS }, + { field: 'cancellationReason', label: 'دلیل لغو', filterable: false, sortable: false, type: 'text' }, { field: 'checkedInAt', label: 'چک‌این', filterable: false, sortable: false, type: 'date' }, { field: 'createdAt', label: 'تاریخ ثبت', filterable: false, sortable: true, type: 'date' }, { field: 'actions', label: 'عملیات' }, @@ -113,6 +114,18 @@ const AdminEventBookingsTab = ({ eventId, eventStatus, onCheckedIn }: AdminEvent /> ) }, + cancellationReason: (row, cellValue) => { + const reason = coerceToString(cellValue).trim() + const isCancelledLike = row.status === 'cancelled' || row.status === 'refunded' + + if (!isCancelledLike || !reason) return '—' + + return ( + + {reason} + + ) + }, checkedInAt: (_row, cellValue) => formatPersianDate(cellValue), createdAt: (_row, cellValue) => formatPersianDate(cellValue), actions: (row) => { diff --git a/features/events/detail/admin-event-detail/AdminEventOverviewTab.tsx b/features/events/detail/admin-event-detail/AdminEventOverviewTab.tsx index 5851c77..f557305 100644 --- a/features/events/detail/admin-event-detail/AdminEventOverviewTab.tsx +++ b/features/events/detail/admin-event-detail/AdminEventOverviewTab.tsx @@ -48,10 +48,6 @@ const AdminEventOverviewTab = ({ insights }: AdminEventOverviewTabProps) => { label="بازپرداخت‌شده" value={number(insights.registrations.refundedCount)} /> -