mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
Passenger list report filter updates
This commit is contained in:
@@ -328,7 +328,7 @@ export class ReportsService {
|
||||
_count: { select: { seats: true } },
|
||||
},
|
||||
},
|
||||
seat: { include: { coach: { select: { number: true, coachType: { select: { name: true } } } } } },
|
||||
seat: { select: { seatNumber: true, bedPosition: true, coach: { select: { number: true, coachType: { select: { name: true, seatClasses: { select: { name: true, bedPosition: true } } } } } } } },
|
||||
},
|
||||
orderBy: [{ seat: { coach: { number: 'asc' } } }, { seat: { seatNumber: 'asc' } }],
|
||||
});
|
||||
@@ -356,13 +356,25 @@ export class ReportsService {
|
||||
passportNumber: bs.passportNumber,
|
||||
passportCountry: bs.passportCountry,
|
||||
seatLabel: bs.seatLabelSnapshot,
|
||||
seatNumber: bs.seat?.seatNumber ?? null,
|
||||
seatClassName: (() => {
|
||||
const classes = bs.seat?.coach?.coachType?.seatClasses ?? [];
|
||||
const matched = bs.seat?.bedPosition
|
||||
? classes.find((sc: any) => sc.bedPosition?.toLowerCase() === bs.seat!.bedPosition!.toLowerCase())
|
||||
: null;
|
||||
return (matched ?? classes[0])?.name ?? bs.seat?.coach?.coachType?.name ?? null;
|
||||
})(),
|
||||
coachNumber: bs.seat?.coach?.number ?? null,
|
||||
coachType: (bs.seat?.coach as any)?.coachType?.name ?? null,
|
||||
coachType: bs.seat?.coach?.coachType?.name ?? null,
|
||||
nationality: bs.passportCountry
|
||||
? (bs.passportCountry === 'Djibouti' ? 'Djiboutian' : bs.passportCountry)
|
||||
: bs.idDocumentType === 'NATIONAL_ID' ? 'Ethiopian' : null,
|
||||
origin: bs.booking.originStationId ? (stationName.get(bs.booking.originStationId) ?? null) : null,
|
||||
destination: bs.booking.destinationStationId ? (stationName.get(bs.booking.destinationStationId) ?? null) : null,
|
||||
amountPaidMinor: bs.booking.totalMinor,
|
||||
currency: bs.booking.currency ?? 'ETB',
|
||||
isGroupBooking: (bs.booking._count?.seats ?? 0) > 1,
|
||||
bookingStatus: bs.booking.status,
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user