mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 11:08:12 +00:00
fix
This commit is contained in:
@@ -64,6 +64,19 @@ const STATUS_META: Record<FirstMileApiStatus, { label: string; color: string }>
|
|||||||
RECEIVED_TO_PORT: { label: "Received to Port", color: "green" },
|
RECEIVED_TO_PORT: { label: "Received to Port", color: "green" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Invoice payment state → badge color, keyed by upper-cased status.
|
||||||
|
const INVOICE_STATUS_META: Record<string, { label: string; color: string }> = {
|
||||||
|
PAID: { label: "Paid", color: "green" },
|
||||||
|
PARTIALLY_PAID: { label: "Partially Paid", color: "teal" },
|
||||||
|
PENDING: { label: "Pending", color: "yellow" },
|
||||||
|
UNPAID: { label: "Unpaid", color: "yellow" },
|
||||||
|
OPEN: { label: "Open", color: "yellow" },
|
||||||
|
ISSUED: { label: "Issued", color: "blue" },
|
||||||
|
OVERDUE: { label: "Overdue", color: "red" },
|
||||||
|
CANCELLED: { label: "Cancelled", color: "gray" },
|
||||||
|
VOID: { label: "Void", color: "gray" },
|
||||||
|
};
|
||||||
|
|
||||||
const NEXT_STATUS: Partial<Record<FirstMileApiStatus, FirstMileApiStatus>> = {
|
const NEXT_STATUS: Partial<Record<FirstMileApiStatus, FirstMileApiStatus>> = {
|
||||||
PAYMENT_PENDING: "READY_TO_TRANSIT",
|
PAYMENT_PENDING: "READY_TO_TRANSIT",
|
||||||
READY_TO_TRANSIT: "IN_TRANSIT",
|
READY_TO_TRANSIT: "IN_TRANSIT",
|
||||||
@@ -757,7 +770,8 @@ const FirstMilePage = () => {
|
|||||||
if (!invoice) {
|
if (!invoice) {
|
||||||
return <Text c="dimmed">—</Text>;
|
return <Text c="dimmed">—</Text>;
|
||||||
}
|
}
|
||||||
const isPaid = (row.original as any).paid || invoice.status === "Paid";
|
const status = String((row.original as any).paid ? "PAID" : invoice.status || "").toUpperCase();
|
||||||
|
const badge = INVOICE_STATUS_META[status] ?? { color: "gray", label: status || "—" };
|
||||||
return (
|
return (
|
||||||
<Group gap="xs" wrap="nowrap">
|
<Group gap="xs" wrap="nowrap">
|
||||||
<UnstyledButton
|
<UnstyledButton
|
||||||
@@ -772,7 +786,7 @@ const FirstMilePage = () => {
|
|||||||
>
|
>
|
||||||
{invoice.number}
|
{invoice.number}
|
||||||
</UnstyledButton>
|
</UnstyledButton>
|
||||||
{isPaid && <Badge color="green" variant="light" size="sm">Paid</Badge>}
|
{status && <Badge color={badge.color} variant="filled" size="sm">{badge.label}</Badge>}
|
||||||
</Group>
|
</Group>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -71,6 +71,19 @@ const STATUS_META: Record<LastMileApiStatus, { label: string; color: string }> =
|
|||||||
DELIVERED: { label: "Delivered", color: "green" },
|
DELIVERED: { label: "Delivered", color: "green" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Invoice payment state → badge color, keyed by upper-cased status.
|
||||||
|
const INVOICE_STATUS_META: Record<string, { label: string; color: string }> = {
|
||||||
|
PAID: { label: "Paid", color: "green" },
|
||||||
|
PARTIALLY_PAID: { label: "Partially Paid", color: "teal" },
|
||||||
|
PENDING: { label: "Pending", color: "yellow" },
|
||||||
|
UNPAID: { label: "Unpaid", color: "yellow" },
|
||||||
|
OPEN: { label: "Open", color: "yellow" },
|
||||||
|
ISSUED: { label: "Issued", color: "blue" },
|
||||||
|
OVERDUE: { label: "Overdue", color: "red" },
|
||||||
|
CANCELLED: { label: "Cancelled", color: "gray" },
|
||||||
|
VOID: { label: "Void", color: "gray" },
|
||||||
|
};
|
||||||
|
|
||||||
const NEXT_STATUS: Partial<Record<LastMileApiStatus, LastMileApiStatus>> = {
|
const NEXT_STATUS: Partial<Record<LastMileApiStatus, LastMileApiStatus>> = {
|
||||||
PAYMENT_PENDING: "READY_TO_TRANSIT",
|
PAYMENT_PENDING: "READY_TO_TRANSIT",
|
||||||
READY_TO_TRANSIT: "IN_TRANSIT",
|
READY_TO_TRANSIT: "IN_TRANSIT",
|
||||||
@@ -1128,7 +1141,8 @@ const LastMilePage = () => {
|
|||||||
if (!invoice) {
|
if (!invoice) {
|
||||||
return <Text c="dimmed">—</Text>;
|
return <Text c="dimmed">—</Text>;
|
||||||
}
|
}
|
||||||
const isPaid = (row.original as any).paid || invoice.status === "Paid";
|
const status = String((row.original as any).paid ? "PAID" : invoice.status || "").toUpperCase();
|
||||||
|
const badge = INVOICE_STATUS_META[status] ?? { color: "gray", label: status || "—" };
|
||||||
return (
|
return (
|
||||||
<Group gap="xs" wrap="nowrap">
|
<Group gap="xs" wrap="nowrap">
|
||||||
<UnstyledButton
|
<UnstyledButton
|
||||||
@@ -1143,7 +1157,7 @@ const LastMilePage = () => {
|
|||||||
>
|
>
|
||||||
{invoice.number}
|
{invoice.number}
|
||||||
</UnstyledButton>
|
</UnstyledButton>
|
||||||
{isPaid && <Badge color="green" variant="light" size="sm">Paid</Badge>}
|
{status && <Badge color={badge.color} variant="filled" size="sm">{badge.label}</Badge>}
|
||||||
</Group>
|
</Group>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user