diff --git a/apps/edr-freight-api/src/modules/train-scheduling/train-scheduling.service.ts b/apps/edr-freight-api/src/modules/train-scheduling/train-scheduling.service.ts index 8768b16b1..199be696a 100644 --- a/apps/edr-freight-api/src/modules/train-scheduling/train-scheduling.service.ts +++ b/apps/edr-freight-api/src/modules/train-scheduling/train-scheduling.service.ts @@ -176,6 +176,7 @@ const DEFAULT_TRAIN_LIMITS: Required = { interface BookingWindowRow { schedule_id: string; contract_id: string | null; + contract_kind: string | null; direction: string | null; window_phase: string | null; window_opens_at: Date | null; @@ -3129,6 +3130,7 @@ export class TrainSchedulingService { const rows: Array = await this.dataSource.query( `SELECT DISTINCT ts.id AS schedule_id, cr.contract_id AS contract_id, + c.contract_kind AS contract_kind, ts.direction, ts.window_phase, ts.window_opens_at, @@ -3149,7 +3151,6 @@ export class TrainSchedulingService { ON c.id = cr.contract_id AND c.company_id = $1 AND c.status IN ('CONTRACT_ACTIVE', 'FULLY_EXECUTED') - AND c.contract_kind = 'GENERAL' AND c.deleted_at IS NULL LEFT JOIN freight.yards oy ON oy.id = ts.origin_station_id LEFT JOIN freight.yards dy ON dy.id = ts.destination_station_id @@ -3173,6 +3174,7 @@ export class TrainSchedulingService { const rows: Array = await this.dataSource.query( `SELECT DISTINCT ts.id AS schedule_id, cr.contract_id AS contract_id, + c.contract_kind AS contract_kind, ts.direction, ts.window_phase, ts.window_opens_at, @@ -3192,7 +3194,6 @@ export class TrainSchedulingService { AND cr.deleted_at IS NULL JOIN freight.contracts c ON c.id = cr.contract_id - AND c.contract_kind = 'GENERAL' AND c.deleted_at IS NULL LEFT JOIN freight.yards oy ON oy.id = ts.origin_station_id LEFT JOIN freight.yards dy ON dy.id = ts.destination_station_id @@ -3211,6 +3212,7 @@ export class TrainSchedulingService { return { scheduleId: r.schedule_id, contractId: r.contract_id, + contractKind: r.contract_kind, direction: r.direction, windowPhase: r.window_phase, isOpenNow: r.window_phase === 'OPEN' && r.booking_window_status === 'OPEN', diff --git a/apps/edr-freight-web/portal/src/pages/MyPortalPage/components/UpcomingWindowsSection.tsx b/apps/edr-freight-web/portal/src/pages/MyPortalPage/components/UpcomingWindowsSection.tsx index 00351761f..bb5b629de 100644 --- a/apps/edr-freight-web/portal/src/pages/MyPortalPage/components/UpcomingWindowsSection.tsx +++ b/apps/edr-freight-web/portal/src/pages/MyPortalPage/components/UpcomingWindowsSection.tsx @@ -221,7 +221,10 @@ export const UpcomingWindowsSection = memo(function UpcomingWindowsSection({ - {w.isOpenNow && ( + {/* ONE_TIME contracts book via their own single-shipment flow, + not window drawdown — show the window + countdown but no + "Book now" entry. */} + {w.isOpenNow && w.contractKind !== "ONE_TIME" && (