diff --git a/helpers/booking.ts b/helpers/booking.ts new file mode 100644 index 0000000..af0f394 --- /dev/null +++ b/helpers/booking.ts @@ -0,0 +1,16 @@ +import { BOOKING_STATUS } from '../db/enums' + +export function getBookingStatus(booking: { status: BOOKING_STATUS }) { + switch (booking.status) { + case BOOKING_STATUS.REQUESTED: + return 'Angefragt' + case BOOKING_STATUS.CONFIRMED: + return 'Bestätigt' + case BOOKING_STATUS.REJECTED: + return 'Abgewiesen' + case BOOKING_STATUS.CANCELED: + return 'Storniert' + default: + return 'Unbekannt - bitte kontaktieren Sie uns!' + } +} diff --git a/pages/booking/[uuid]/bill.tsx b/pages/booking/[uuid]/bill.tsx index 05caf7d..3066d43 100644 --- a/pages/booking/[uuid]/bill.tsx +++ b/pages/booking/[uuid]/bill.tsx @@ -10,6 +10,7 @@ import { BILL_STATUS, MILAGE_TARIFS } from '../../../db/enums' import { getBookingByUUID, getMilageMax } from '../../../db/index' import { dateFormatFrontend } from '../../../helpers/date' import { getBillTotal } from '../../../helpers/bill' +import { getBookingStatus } from '../../../helpers/booking' const milageTarifOptions = Object.values(MILAGE_TARIFS).map((tarif) => { return ( @@ -184,6 +185,9 @@ export default function BillPage({