feat: enhance ClearanceChargesSection with file viewing and downloading capabilities

This commit is contained in:
Marshal
2026-08-20 16:07:16 +00:00
committed by Hagernesh
parent c5909b8ec7
commit 3a4eeee61b
2 changed files with 44 additions and 5 deletions

View File

@@ -102,8 +102,9 @@ export function ClearanceChargesTab({
onError,
});
const bill = useMutation({
mutationFn: (p: BillInput & { chargeId: string }) =>
bookingsService.billClearanceCharge(bookingId, p.chargeId, p),
// Body must be exactly the DTO — the API rejects unknown keys like chargeId.
mutationFn: ({ chargeId, ...payload }: BillInput & { chargeId: string }) =>
bookingsService.billClearanceCharge(bookingId, chargeId, payload),
onSuccess: (next) => {
toast.success("Charge amount saved");
refresh(next);
@@ -120,8 +121,8 @@ export function ClearanceChargesTab({
onError,
});
const createMisc = useMutation({
mutationFn: (p: BillInput & { file: File }) =>
bookingsService.createMiscellaneousCharge(bookingId, p.file, p),
mutationFn: ({ file, ...payload }: BillInput & { file: File }) =>
bookingsService.createMiscellaneousCharge(bookingId, file, payload),
onSuccess: (next) => {
toast.success("Miscellaneous charge created");
// Remount the form so the next charge starts from an empty one.