import { Icon } from '../shared/Icon';
const CANCELABILITY_RULES = [
{ status: 'TRIP_BOOK_PENDING', riderCancel: true, driverCancel: false, opsCancel: true, note: 'Before assignment — rider or ops can cancel freely' },
{ status: 'TRIP_BOOK_RIDER_CONFIRMED', riderCancel: true, driverCancel: false, opsCancel: true, note: 'Rider confirmed but no driver yet' },
{ status: 'TRIP_BOOK_OPERATION_DRIVER_CONFIRMED', riderCancel: true, driverCancel: true, opsCancel: true, note: 'Both confirmed — either party can still cancel' },
{ status: 'TRIP_BOOK_FINISHED', riderCancel: false, driverCancel: false, opsCancel: false, note: 'Terminal: trip completed' },
{ status: 'TRIP_BOOK_OPERATION_RIDER_CANCELED', riderCancel: false, driverCancel: false, opsCancel: false, note: 'Terminal: rider cancelled' },
{ status: 'TRIP_BOOK_OPERATION_DRIVER_CANCELED', riderCancel: false, driverCancel: false, opsCancel: false, note: 'Terminal: driver cancelled' },
{ status: 'TRIP_BOOK_SYSTEM_CANCELED', riderCancel: false, driverCancel: false, opsCancel: false, note: 'Terminal: system auto-cancelled (timeout)' },
];
function CancelBadge({ allowed }: { allowed: boolean }) {
return allowed ? (
Cancellation is only possible before a booking reaches a terminal state.
The terminal status guard in fnUpdateBookingStatus prevents
any further transitions once a booking is finished, cancelled by rider/driver, or auto-cancelled by the system.
| Booking Status | Rider | Driver | Ops |
|---|---|---|---|
|
{rule.status}
{rule.note}
|