mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 16:28:12 +00:00
Implement intercity document handling and rejection notes for contracts
This commit is contained in:
@@ -447,6 +447,17 @@ export default function GlCreateBookingForm() {
|
||||
if (!copyFromBooking || prefilled) return;
|
||||
const lines = copyFromBooking.bookingContainers ?? [];
|
||||
if (!lines.length) return;
|
||||
// The booking stores a numeric sizeFt (20) but the contract scope — and the
|
||||
// create payload the server validates — uses its own size strings ("20ft").
|
||||
// Seed with the scope's string so the rebook payload matches what a fresh
|
||||
// form entry would send.
|
||||
const scopeSizeForFt = (sizeFt: number | null | undefined): string => {
|
||||
if (sizeFt == null) return "";
|
||||
return (
|
||||
containerSizes.find((s) => parseInt(s, 10) === Number(sizeFt)) ??
|
||||
`${sizeFt}ft`
|
||||
);
|
||||
};
|
||||
setPrefilled(true);
|
||||
setContainerLines(
|
||||
lines.map((c) => {
|
||||
@@ -466,7 +477,7 @@ export default function GlCreateBookingForm() {
|
||||
}))
|
||||
: Array.from({ length: qty }, emptyUnit);
|
||||
return {
|
||||
containerSize: String(c.containerType?.sizeFt ?? ""),
|
||||
containerSize: scopeSizeForFt(c.containerType?.sizeFt),
|
||||
quantity: String(qty),
|
||||
hazardousQuantity: String(units.filter((u) => u.isHazardous).length),
|
||||
reeferQuantity: String(units.filter((u) => u.isReefer).length),
|
||||
@@ -475,7 +486,7 @@ export default function GlCreateBookingForm() {
|
||||
};
|
||||
}),
|
||||
);
|
||||
}, [copyFromBooking, prefilled]);
|
||||
}, [copyFromBooking, prefilled, containerSizes]);
|
||||
|
||||
// Seed one shipment line per contracted size exactly once — same seeding the
|
||||
// portal form does. Subsequent renders reuse the lines.
|
||||
|
||||
Reference in New Issue
Block a user