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

fix issue
This commit is contained in:
marshal
2026-08-22 09:17:41 +03:00
committed by GitHub

View File

@@ -412,10 +412,9 @@ function NewShipmentBookingForm({
mode: "onChange", mode: "onChange",
}); });
// 20ft containers ride two per wagon. An odd total no longer blocks the // 20ft containers ride two per wagon. On the COMPLETION page an odd total
// booking — the server auto-pairs it with another customer's odd booking, or // hard-blocks submit — odd (consolidated) bookings are GL's job in the
// parks it as PENDING_CONSOLIDATION until one shows up (same consolidation // backoffice. The direct-booking route keeps the consolidation notice.
// gate the direct-booking flow already uses).
const watchedContainers = form.watch("containers"); const watchedContainers = form.watch("containers");
const ft20Total = const ft20Total =
contract.freightType === "CONTAINER" contract.freightType === "CONTAINER"
@@ -424,6 +423,7 @@ function NewShipmentBookingForm({
.reduce((sum, l) => sum + Number(l.quantity || 0), 0) .reduce((sum, l) => sum + Number(l.quantity || 0), 0)
: 0; : 0;
const hasOdd20ft = ft20Total % 2 === 1; const hasOdd20ft = ft20Total % 2 === 1;
const blockOdd20ft = hasOdd20ft && Boolean(completeBookingId);
// COMPLETION mode: fetch the booking — a changes-requested resubmit prefills // COMPLETION mode: fetch the booking — a changes-requested resubmit prefills
// the form from it and shows the operations note + uploaded documents. // the form from it and shows the operations note + uploaded documents.
@@ -580,6 +580,9 @@ function NewShipmentBookingForm({
// run it for every freight type; container contracts additionally get // run it for every freight type; container contracts additionally get
// overweight warnings + 20ft pairing hard-blocks surfaced in the modal. // overweight warnings + 20ft pairing hard-blocks surfaced in the modal.
const handleReview = form.handleSubmit((values) => { const handleReview = form.handleSubmit((values) => {
// Completion: odd 20ft counts never reach review — the red alert next to
// the button explains; odd (consolidated) bookings are GL's backoffice job.
if (blockOdd20ft) return;
setPendingValues(values); setPendingValues(values);
validateMutation.reset(); validateMutation.reset();
validateMutation.mutate(buildDto(values)); validateMutation.mutate(buildDto(values));
@@ -744,7 +747,17 @@ function NewShipmentBookingForm({
Fix the highlighted fields before reviewing the price. Fix the highlighted fields before reviewing the price.
</Alert> </Alert>
) : null} ) : null}
{hasOdd20ft ? ( {blockOdd20ft ? (
<Alert
color="red"
variant="light"
radius="md"
icon={<AlertCircle size={16} />}
mb="sm"
>
{`${ft20Total} is an odd number of 20ft containers. 20ft containers travel two per wagon, so they must be booked in even numbers — add one more or remove one (e.g. ${ft20Total + 1} or ${ft20Total - 1}).`}
</Alert>
) : hasOdd20ft ? (
<Alert <Alert
color="yellow" color="yellow"
variant="light" variant="light"