diff --git a/apps/edr-freight-web/portal/src/pages/bookings/BookingDetailPage/components/BookingPaymentPanel.tsx b/apps/edr-freight-web/portal/src/pages/bookings/BookingDetailPage/components/BookingPaymentPanel.tsx
index 81f727b29..1cb46d156 100644
--- a/apps/edr-freight-web/portal/src/pages/bookings/BookingDetailPage/components/BookingPaymentPanel.tsx
+++ b/apps/edr-freight-web/portal/src/pages/bookings/BookingDetailPage/components/BookingPaymentPanel.tsx
@@ -211,10 +211,6 @@ export function BookingPaymentPanel({
queryKey: ["booking-invoices", booking.id],
queryFn: () => invoicesService.listForSource("booking", booking.id),
});
- // The invoice worth a prominent "Download" — the first issued one, else any.
- const primary =
- invoices.find((inv) => inv.status !== "DRAFT") ?? invoices[0];
- const primaryPaid = primary ? Number(primary.paidAmount) > 0 : false;
const downloadInvoice = async (inv: PortalInvoice) => {
try {
@@ -380,50 +376,67 @@ export function BookingPaymentPanel({
- downloadInvoice(inv)}
- >
-
-
+ {invoices.length > 1 && (
+ <>
+ downloadInvoice(inv)}
+ >
+
+
+ {Number(inv.paidAmount) > 0 && (
+ downloadReceipt(inv)}
+ >
+
+
+ )}
+ >
+ )}
))}
- >
- )}
- {primary && (
- }
- onClick={() => downloadInvoice(primary)}
- styles={{
- root: { height: 46 },
- label: { fontSize: 13.5, fontWeight: 700, color: "#10202F" },
- }}
- >
- Download invoice
-
- )}
- {primary && primaryPaid && (
- }
- onClick={() => downloadReceipt(primary)}
- styles={{ root: { height: 42 }, label: { fontSize: 13, fontWeight: 700 } }}
- >
- Download receipt
-
+ {/* Single invoice: a prominent download instead of a lone row icon. */}
+ {invoices.length === 1 && (
+ <>
+ }
+ onClick={() => downloadInvoice(invoices[0])}
+ styles={{
+ root: { height: 46 },
+ label: { fontSize: 13.5, fontWeight: 700, color: "#10202F" },
+ }}
+ >
+ Download invoice
+
+ {Number(invoices[0].paidAmount) > 0 && (
+ }
+ onClick={() => downloadReceipt(invoices[0])}
+ styles={{ root: { height: 42 }, label: { fontSize: 13, fontWeight: 700 } }}
+ >
+ Download receipt
+
+ )}
+ >
+ )}
+ >
)}
);
diff --git a/apps/edr-freight-web/portal/src/pages/bookings/BookingDetailPage/components/WarehousePaymentsSection.tsx b/apps/edr-freight-web/portal/src/pages/bookings/BookingDetailPage/components/WarehousePaymentsSection.tsx
index acd4dbb25..927f1dbfb 100644
--- a/apps/edr-freight-web/portal/src/pages/bookings/BookingDetailPage/components/WarehousePaymentsSection.tsx
+++ b/apps/edr-freight-web/portal/src/pages/bookings/BookingDetailPage/components/WarehousePaymentsSection.tsx
@@ -1,6 +1,6 @@
import { ActionIcon, Box, Button, Group, Stack, Text } from "@mantine/core";
import { useMutation, useQuery } from "@tanstack/react-query";
-import { CreditCard, Download, Receipt } from "lucide-react";
+import { CreditCard, Download, FileText, Receipt } from "lucide-react";
import { useState } from "react";
import toast from "react-hot-toast";
@@ -184,23 +184,27 @@ export function WarehousePaymentsSection({ bookingId }: { bookingId: string }) {
Pay
)}
- download(inv)}
- >
-
-
- {Number(inv.paidAmount) > 0 && (
- downloadReceipt(inv)}
- >
-
-
+ {invoices.length > 1 && (
+ <>
+ download(inv)}
+ >
+
+
+ {Number(inv.paidAmount) > 0 && (
+ downloadReceipt(inv)}
+ >
+
+
+ )}
+ >
)}
@@ -208,6 +212,40 @@ export function WarehousePaymentsSection({ bookingId }: { bookingId: string }) {
})}
+ {/* Single invoice: a prominent download instead of a lone row icon. */}
+ {invoices.length === 1 && (
+ <>
+ }
+ onClick={() => download(invoices[0])}
+ styles={{
+ root: { height: 46 },
+ label: { fontSize: 13.5, fontWeight: 700, color: "#10202F" },
+ }}
+ >
+ Download invoice
+
+ {Number(invoices[0].paidAmount) > 0 && (
+ }
+ onClick={() => downloadReceipt(invoices[0])}
+ styles={{ root: { height: 42 }, label: { fontSize: 13, fontWeight: 700 } }}
+ >
+ Download receipt
+
+ )}
+ >
+ )}
+