mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 22:18:12 +00:00
Add countdown timer component and integrate phase deadlines in booking windows
This commit is contained in:
@@ -178,6 +178,8 @@ interface BookingWindowRow {
|
||||
window_phase: string | null;
|
||||
window_opens_at: Date | null;
|
||||
window_closes_at: Date | null;
|
||||
doc_review_ends_at: Date | null;
|
||||
payment_phase_ends_at: Date | null;
|
||||
booking_window_status: string;
|
||||
booking_cycle_no: number;
|
||||
scheduled_departure_date: Date;
|
||||
@@ -3027,6 +3029,8 @@ export class TrainSchedulingService {
|
||||
ts.window_phase,
|
||||
ts.window_opens_at,
|
||||
ts.window_closes_at,
|
||||
ts.doc_review_ends_at,
|
||||
ts.payment_phase_ends_at,
|
||||
ts.booking_window_status,
|
||||
ts.booking_cycle_no,
|
||||
ts.scheduled_departure_date,
|
||||
@@ -3041,6 +3045,7 @@ 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
|
||||
@@ -3068,6 +3073,8 @@ export class TrainSchedulingService {
|
||||
ts.window_phase,
|
||||
ts.window_opens_at,
|
||||
ts.window_closes_at,
|
||||
ts.doc_review_ends_at,
|
||||
ts.payment_phase_ends_at,
|
||||
ts.booking_window_status,
|
||||
ts.booking_cycle_no,
|
||||
ts.scheduled_departure_date,
|
||||
@@ -3079,6 +3086,10 @@ export class TrainSchedulingService {
|
||||
AND cr.destination_yard_id = ts.destination_station_id
|
||||
AND cr.contract_id = $1
|
||||
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
|
||||
WHERE ts.deleted_at IS NULL
|
||||
@@ -3101,6 +3112,8 @@ export class TrainSchedulingService {
|
||||
isOpenNow: r.window_phase === 'OPEN' && r.booking_window_status === 'OPEN',
|
||||
windowOpensAt: r.window_opens_at,
|
||||
windowClosesAt: r.window_closes_at,
|
||||
docReviewEndsAt: r.doc_review_ends_at,
|
||||
paymentPhaseEndsAt: r.payment_phase_ends_at,
|
||||
bookingWindowStatus: r.booking_window_status,
|
||||
bookingCycleNo: r.booking_cycle_no,
|
||||
departureDate: r.scheduled_departure_date,
|
||||
@@ -3388,6 +3401,21 @@ export class TrainSchedulingService {
|
||||
freightType: this.resolveScheduleFreightType(schedule),
|
||||
trainNumber: schedule.trainNumber ?? null,
|
||||
direction: schedule.direction ?? null,
|
||||
// Booking-window phase + phase deadlines drive the countdown timers in the
|
||||
// operations workspace (display only — the window engine enforces them).
|
||||
windowPhase: schedule.windowPhase ?? null,
|
||||
windowOpensAt: schedule.windowOpensAt
|
||||
? schedule.windowOpensAt.toISOString()
|
||||
: null,
|
||||
windowClosesAt: schedule.windowClosesAt
|
||||
? schedule.windowClosesAt.toISOString()
|
||||
: null,
|
||||
docReviewEndsAt: schedule.docReviewEndsAt
|
||||
? schedule.docReviewEndsAt.toISOString()
|
||||
: null,
|
||||
paymentPhaseEndsAt: schedule.paymentPhaseEndsAt
|
||||
? schedule.paymentPhaseEndsAt.toISOString()
|
||||
: null,
|
||||
route: schedule.route
|
||||
? { id: schedule.route.id, name: formatRouteLabel(schedule.route) }
|
||||
: null,
|
||||
|
||||
Reference in New Issue
Block a user