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

update body-parser implementation to use Nest's API and improve depe…
This commit is contained in:
marshal
2026-07-28 10:25:05 +03:00
committed by GitHub
6 changed files with 128 additions and 35 deletions

View File

@@ -375,10 +375,9 @@ export default function ContractDetailPage() {
const cancellable = cancelStatusOk && activeShipments === 0;
const customsPath = contract.customsClearingEnabled;
// Only the NON-customs (Path A) customer books himself — once the contract is
// executed after self-clearance. Customs (Path B) bookings are created by
// Global Logistics on the customer's behalf, so the customer gets no booking
// button on a customs contract.
// A ONE_TIME contract's shipment instance is opened by the customer on both
// paths; on customs (Path B) GL then clears it and completes it with cargo and
// price. GENERAL customs stays request-driven, so no booking button there.
const bookingAction = getContractBookingAction(contract, contractBookings);
// Whether the customer may open a new self-service booking. Derived from the
// shared booking-action helper so it honours the ONE_TIME single-slot rule:
@@ -1229,10 +1228,10 @@ export default function ContractDetailPage() {
<Text fz={13} c="dimmed" ta="center" maw={380}>
{canBookShipment
? "No bookings yet. Use “New booking” to ship against this contract."
: customsPath
? "No bookings yet. Global Logistics opens the shipment on your behalf — you upload the clearance documents on it."
: canInitiateBooking
? `No shipments yet. Start one with “Initiate booking” — you upload the ${bookingDocNoun(contract)} on that shipment.`
: canInitiateBooking
? `No shipments yet. Start one with “Initiate booking” — you upload the ${bookingDocNoun(contract)} on that shipment.`
: customsPath
? "No bookings yet. Global Logistics opens the shipment on your behalf — you upload the clearance documents on it."
: "Bookings appear here once the contract is fully executed."}
</Text>
</Stack>

View File

@@ -40,9 +40,9 @@ export interface ContractBookingAction {
* The single source of truth for whether a contract row should show a
* Book / Re-book shipment button, and where it should navigate.
*
* - ONE_TIME: one shipment instance at a time. Import/export self-clearance
* initiates a bare instance (clearance first); intercity books directly.
* Customs is initiated by GL, so the customer gets no button.
* - ONE_TIME: one shipment instance at a time. Import/export initiates a bare
* instance (clearance first) whether it self-clears or goes through customs;
* intercity books directly.
* - GENERAL: bookable while CONTRACT_ACTIVE (CONTRACT_CLOSED / EXPIRED are
* already excluded by the PATH_A_BOOKABLE gate).
*/
@@ -62,9 +62,18 @@ export function getContractBookingAction(
};
}
// Other customs (ONE_TIME): GL initiates the shipment instance and completes
// it — the customer only uploads documents on that booking. No action here.
if (contract.customsClearingEnabled) return { kind: "none", to: "" };
// Customs: only a ONE_TIME import/export contract is opened by the customer —
// he initiates the bare instance and uploads the customs documents on it, GL
// clears it and completes it with cargo and price. GENERAL customs went
// through the shipment-request branch above; intercity customs is booked by GL
// directly with its cargo.
if (
contract.customsClearingEnabled &&
(contract.contractKind !== "ONE_TIME" ||
contract.tradeDirection === "DOMESTIC")
) {
return { kind: "none", to: "" };
}
if (!PATH_A_BOOKABLE.includes(contract.status)) return { kind: "none", to: "" };
const to = `/contracts/${contract.id}/bookings/new`;