enhance contract clearance and train scheduling logic; add filters for clearance documents and improve booking validation

This commit is contained in:
Marshal
2026-07-13 21:40:10 +00:00
parent 3fe4ea72ac
commit 957a185a4d
5 changed files with 45 additions and 7 deletions

View File

@@ -149,8 +149,12 @@ export function ExportClearanceStepper({
const entityId = contractId ?? bookingId ?? "";
// The booking that carries the post-booking steps (gate pass, T1, invoice).
const actionBookingId = clearance.linkedBookingId ?? bookingId ?? null;
// Per-booking GENERAL clearance runs on a bare instance that only becomes a
// real booking once GL completes it — the caller's bookingCreated prop carries
// that signal, so a booking-keyed view must NOT count as "created" by itself
// (it would lock GL Ethiopia out of the declaration step right after the RO).
const effectiveBookingCreated =
bookingCreated || Boolean(clearance.linkedBookingId) || isBooking;
bookingCreated || Boolean(clearance.linkedBookingId);
const activeStep = useMemo(
() => computeExportActiveStep(clearance, bookingMilestones, effectiveBookingCreated),