mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 10:45:44 +00:00
Fix seat label
This commit is contained in:
@@ -1892,20 +1892,32 @@ export class BookingsService {
|
|||||||
departureAt: returnSegment!.departureAt, arrivalAt: returnSegment!.arrivalAt,
|
departureAt: returnSegment!.departureAt, arrivalAt: returnSegment!.arrivalAt,
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
passengers: (booking as any).seats?.map((bs: any) => ({
|
passengers: (booking as any).seats?.map((bs: any) => {
|
||||||
fullName: bs.passengerName,
|
// A coach type can have several seat classes (e.g. a VIP Bed coach has separate
|
||||||
category: bs.passengerCategory,
|
// Upper/Lower classes) — seatClasses[0] is whichever was seeded first, so it always
|
||||||
leg: bs.leg ?? 1,
|
// showed the SAME class for every seat in the coach regardless of that seat's own
|
||||||
fareMinor: bs.fareMinor,
|
// bed position. Match against the seat's actual bedPosition instead (Seat.bedPosition
|
||||||
verifaydaVerified: bs.verifaydaVerified,
|
// is lowercase, SeatClass.bedPosition is uppercase — compare case-insensitively).
|
||||||
seat: {
|
// Falls back to [0] for non-bed seats (bedPosition is null, single class per coach).
|
||||||
id: bs.seat.id,
|
const classes = bs.seat.coach.coachType?.seatClasses ?? [];
|
||||||
number: bs.seat.seatNumber,
|
const matchedClass = bs.seat.bedPosition
|
||||||
coach: bs.seat.coach.number,
|
? classes.find((sc: any) => sc.bedPosition?.toLowerCase() === bs.seat.bedPosition.toLowerCase())
|
||||||
coachId: bs.seat.coach.id,
|
: null;
|
||||||
seatClass: bs.seat.coach.coachType?.seatClasses?.[0]?.name ?? null,
|
return {
|
||||||
},
|
fullName: bs.passengerName,
|
||||||
})),
|
category: bs.passengerCategory,
|
||||||
|
leg: bs.leg ?? 1,
|
||||||
|
fareMinor: bs.fareMinor,
|
||||||
|
verifaydaVerified: bs.verifaydaVerified,
|
||||||
|
seat: {
|
||||||
|
id: bs.seat.id,
|
||||||
|
number: bs.seat.seatNumber,
|
||||||
|
coach: bs.seat.coach.number,
|
||||||
|
coachId: bs.seat.coach.id,
|
||||||
|
seatClass: (matchedClass ?? classes[0])?.name ?? null,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}),
|
||||||
payment: (booking as any).paymentIntent
|
payment: (booking as any).paymentIntent
|
||||||
? {
|
? {
|
||||||
method: (booking as any).paymentIntent.method,
|
method: (booking as any).paymentIntent.method,
|
||||||
|
|||||||
Reference in New Issue
Block a user