mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 19:58:11 +00:00
mile
This commit is contained in:
@@ -1086,35 +1086,25 @@ const LastMilePage = () => {
|
||||
header: "Invoice",
|
||||
meta: { headerClassName, cellClassName },
|
||||
cell: ({ row }) => {
|
||||
const hasDistance = row.original.exactKm != null && row.original.exactKm > 0;
|
||||
const isPaid = (row.original as any).paid;
|
||||
if (!hasDistance) {
|
||||
// Only show an invoice once it's actually been generated — NOT merely
|
||||
// because distance was entered.
|
||||
const invoice = row.original.invoice;
|
||||
if (!invoice) {
|
||||
return <Text c="dimmed">—</Text>;
|
||||
}
|
||||
if (isPaid) {
|
||||
return (
|
||||
<Group gap="xs" wrap="nowrap">
|
||||
<UnstyledButton
|
||||
onClick={() => openInvoice(row.original)}
|
||||
c="blue"
|
||||
fw={500}
|
||||
style={{ textDecoration: "underline", cursor: "pointer" }}
|
||||
>
|
||||
#345
|
||||
</UnstyledButton>
|
||||
<Badge color="green" variant="light" size="sm">Paid</Badge>
|
||||
</Group>
|
||||
);
|
||||
}
|
||||
const isPaid = (row.original as any).paid || invoice.status === "Paid";
|
||||
return (
|
||||
<UnstyledButton
|
||||
onClick={() => openInvoice(row.original)}
|
||||
c="blue"
|
||||
fw={500}
|
||||
style={{ textDecoration: "underline", cursor: "pointer" }}
|
||||
>
|
||||
#345
|
||||
</UnstyledButton>
|
||||
<Group gap="xs" wrap="nowrap">
|
||||
<UnstyledButton
|
||||
onClick={() => openInvoice(row.original)}
|
||||
c="blue"
|
||||
fw={500}
|
||||
style={{ textDecoration: "underline", cursor: "pointer" }}
|
||||
>
|
||||
{invoice.number}
|
||||
</UnstyledButton>
|
||||
{isPaid && <Badge color="green" variant="light" size="sm">Paid</Badge>}
|
||||
</Group>
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -64,6 +64,8 @@ export interface LastMileRecord {
|
||||
distanceKm?: number | null;
|
||||
vehicle?: LastMileVehicle | null;
|
||||
}>;
|
||||
/** Present only when an invoice has actually been generated (not on distance). */
|
||||
invoice?: { number: string; status: string } | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user