Merge pull request #1342 from Tria-plc/freight_feature/usermanagement

feat: implement parity checks for 20ft container bookings to ensure e…
This commit is contained in:
marshal
2026-08-19 09:21:43 +03:00
committed by GitHub
5 changed files with 84 additions and 19 deletions

View File

@@ -874,9 +874,14 @@ export default function GlCreateBookingForm() {
// Only a customs (Path B) instance being COMPLETED by GL can use the shared
// wagon: it is GL, not the customer, who links the two bookings. Anything else
// keeps the historical hard block on odd 20ft.
const oddConsolidationAvailable = Boolean(
completeBookingId && isContainer && contract?.customsClearingEnabled,
);
//
// Switched OFF for now: consolidation is built end to end (toggle, parent
// picker, split entry, paired pricing, approval gate) but not in use, so an
// odd 20ft total is rejected outright instead of offering the shared wagon.
// Drop the `false &&` to bring the whole flow back.
const oddConsolidationAvailable =
false &&
Boolean(completeBookingId && isContainer && contract?.customsClearingEnabled);
// Auto-on: entering an odd 20ft total opens the consolidation panel by itself,
// once. GL can still switch it off — then odd is blocked exactly as before.
@@ -965,10 +970,11 @@ export default function GlCreateBookingForm() {
!cargoDescriptionError
: !bulkErrors.quantity && !bulkErrors.hazardous && !bulkErrors.reefer;
// The unpaired 20ft container is resolved by the shared wagon, so with an
// active consolidation an odd total stops being a blocker; without one it
// blocks exactly as before.
const oddBlocksSubmit = hasOdd20ft && !consolidationActive;
// Consolidation (sharing the wagon with another customer's odd booking) is
// built but switched off for now, so an odd 20ft total always blocks — the
// shared wagon no longer resolves the unpaired container. Flip this back to
// `hasOdd20ft && !consolidationActive` to re-enable the shared-wagon path.
const oddBlocksSubmit = hasOdd20ft;
// Partner side: a linked partner must be picked, carry an odd 20ft count of
// its own (odd + odd = even fills the wagon) and have complete unit details.
@@ -2168,7 +2174,23 @@ export default function GlCreateBookingForm() {
}}
>
<Box maw={896} mx="auto">
{showErrors && !formValid ? (
{/* The review button is disabled on an odd 20ft total, so the click
that would surface the errors never lands — state the reason here
rather than leaving it in a tooltip nobody hovers. */}
{oddBlocksSubmit ? (
<Alert
color="red"
variant="light"
radius="md"
icon={<AlertCircle size={16} />}
mb="sm"
title={`Odd number of 20ft containers (${ft20Total})`}
>
20ft containers travel two per wagon, so they must be booked in
even numbers. Add one more 20ft container or remove one — book{" "}
{ft20Total + 1} or {ft20Total - 1} instead of {ft20Total}.
</Alert>
) : showErrors && !formValid ? (
<Alert
color="red"
variant="light"