mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
add contract reference to bookings list and enhance search functionality
This commit is contained in:
BIN
apps/edr-freight-api/py/waafi.jpeg
Normal file
BIN
apps/edr-freight-api/py/waafi.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -449,12 +449,18 @@ export default function BookingsListPage() {
|
||||
const allItems = data?.items ?? [];
|
||||
const total = data?.meta?.total ?? allItems.length;
|
||||
|
||||
// Server handles status + pagination; reference search is applied on the page.
|
||||
// Server handles status + pagination; reference search is applied on the page
|
||||
// (matches booking reference, contract reference, and route yards).
|
||||
const rows = useMemo(() => {
|
||||
const q = query.trim().toLowerCase();
|
||||
if (!q) return allItems;
|
||||
return allItems.filter((b) =>
|
||||
[b.reference, b.originYard?.label, b.destinationYard?.label]
|
||||
[
|
||||
b.reference,
|
||||
b.contractReference,
|
||||
b.originYard?.label,
|
||||
b.destinationYard?.label,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.some((v) => String(v).toLowerCase().includes(q)),
|
||||
);
|
||||
@@ -506,6 +512,41 @@ export default function BookingsListPage() {
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "contract",
|
||||
size: 150,
|
||||
meta: hMeta,
|
||||
header: () => <ColHeader label="Contract" />,
|
||||
cell: ({ row }) => {
|
||||
const ref = row.original.contractReference;
|
||||
const cid = row.original.contractId;
|
||||
if (!ref) {
|
||||
return (
|
||||
<Text fz={13} c="edr-muted">
|
||||
—
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Text
|
||||
fz={13}
|
||||
fw={600}
|
||||
c={cid ? "edr-green" : "edr-text"}
|
||||
style={{ whiteSpace: "nowrap", cursor: cid ? "pointer" : "default" }}
|
||||
onClick={
|
||||
cid
|
||||
? (e) => {
|
||||
e.stopPropagation();
|
||||
navigate(`/contracts/${cid}`);
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{ref}
|
||||
</Text>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "type",
|
||||
size: 150,
|
||||
@@ -708,7 +749,7 @@ export default function BookingsListPage() {
|
||||
>
|
||||
<Group gap={10} wrap="wrap" style={{ flex: 1, minWidth: 260 }}>
|
||||
<TextInput
|
||||
placeholder="Search reference or route…"
|
||||
placeholder="Search booking, contract, or route…"
|
||||
leftSection={<Search size={16} />}
|
||||
value={query}
|
||||
onChange={(e) => setQuery(e.currentTarget.value)}
|
||||
|
||||
@@ -388,6 +388,8 @@ export interface IBooking extends BaseEntity {
|
||||
customerId: string;
|
||||
/** The contract this booking was created under (Path A / Path B). */
|
||||
contractId?: string | null;
|
||||
/** Human-readable reference of the parent contract, joined onto list rows. */
|
||||
contractReference?: string | null;
|
||||
trainId?: string | null;
|
||||
status: BookingStatus;
|
||||
/** ONE_TIME for normal bookings; GENERAL_CONTRACT for umbrella contracts. */
|
||||
|
||||
Reference in New Issue
Block a user