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

add per-container handling options for hazardous, reefer, and return…
This commit is contained in:
marshal
2026-07-18 22:22:46 +03:00
committed by GitHub
28 changed files with 585 additions and 250 deletions

View File

@@ -126,15 +126,15 @@ export class IntercityService {
booking.destinationYardId,
);
return {
...this.mapBooking(booking),
...this.mapBooking(booking, need),
need,
fits: Boolean(need && capacity && leg && capacity.budget.fits(need, leg)),
};
}),
accepted: accepted.map((booking) => ({
...this.mapBooking(booking),
need: capacity?.needFor(booking) ?? null,
})),
accepted: accepted.map((booking) => {
const need = capacity?.needFor(booking) ?? null;
return { ...this.mapBooking(booking, need), need };
}),
};
}
@@ -356,7 +356,12 @@ export class IntercityService {
return { schedule, booking };
}
private mapBooking(booking: Booking) {
/**
* `need` carries the GROSS weight (cargo + wagon tare) the capacity budget is
* spent in. Prefer it, so the row's weight sits on the same axis as the
* remaining-capacity figure shown beside it; cargo VGM is the fallback.
*/
private mapBooking(booking: Booking, need?: { weightTons: number } | null) {
return {
id: booking.id,
reference: booking.reference,
@@ -372,7 +377,7 @@ export class IntercityService {
booking.destinationYard?.label ??
booking.destinationYard?.code ??
'Unknown destination',
weightTons: Number(booking.cargoTotalWeightVgm ?? 0),
weightTons: need?.weightTons ?? Number(booking.cargoTotalWeightVgm ?? 0),
paymentDeadline: booking.paymentDeadline?.toISOString() ?? null,
};
}