mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 06:40:57 +00:00
feat(bookings): add Additional Payments tab, add-charge modal, portal pay
Backoffice: new tab on the booking detail page (?tab=additional-charges, already linked from the row menu) with an Add Charge modal — Save draft or Send to customer. Portal: charges panel on the booking detail page, Pay now per charge via the existing OTP/CBE-bill payment flow. Also fixes: GET /bookings/:id/additional-charges was returning DRAFT charges to the customer (hidden client-side only) — now filtered server-side per caller.
This commit is contained in:
@@ -1222,11 +1222,14 @@ export class BookingsController {
|
||||
@Param("id", ParseUUIDPipe) id: string,
|
||||
@CurrentUser() user: TCurrentUser,
|
||||
) {
|
||||
if (!hasFreightPermission(user, FREIGHT_PERMS.additionalCharges.view)) {
|
||||
const isStaff = hasFreightPermission(user, FREIGHT_PERMS.additionalCharges.view);
|
||||
if (!isStaff) {
|
||||
const booking = await this.bookingsService.findById(id);
|
||||
await this.bookingsService.assertCustomerCanAccessBooking(user?.id, booking);
|
||||
}
|
||||
return this.additionalChargeService.list(id);
|
||||
const charges = await this.additionalChargeService.list(id);
|
||||
// A charge finance hasn't sent yet isn't the customer's to see.
|
||||
return isStaff ? charges : charges.filter((c) => c.status !== "DRAFT");
|
||||
}
|
||||
|
||||
@Post(":id/additional-charges")
|
||||
|
||||
Reference in New Issue
Block a user