feat(train): enhance train history and scheduling features

- Added a reason field to train history entries for detach/maintenance actions.
- Updated TrainHistoryPanel to display the reason for wagon detachments.
- Introduced per-wagon load/unload functionality in ScheduleWorkspacePanel with a modal for managing individual wagons.
- Implemented API endpoints for loading and unloading specific wagons, including the ability to cancel remaining wagons with a reason.
- Refactored detach request handling in TrainBuilderDetailPage to streamline the process and remove the approval flow, requiring a reason for detachments.
- Updated types and services to support new wagon loading/unloading features and booking wagon retrieval.
This commit is contained in:
Marshal
2026-08-28 07:33:28 +00:00
parent 8b8870e85e
commit ba56974e32
26 changed files with 1435 additions and 583 deletions

View File

@@ -707,6 +707,46 @@ export class TrainSchedulingController {
return this.bookingJourneyService.unloadBooking(id, bookingId);
}
@Post("schedules/:id/bookings/:bookingId/wagons/:allocationId/load")
@TrainSchedulingLoad()
@ApiOperation({
summary:
"Confirm ONE wagon of the booking loaded (per-wagon loading). The booking stays PAID until every remaining wagon is LOADED; the last wagon runs the whole-booking load completion.",
})
loadScheduleBookingWagon(
@Param("id", ParseUUIDPipe) id: string,
@Param("bookingId", ParseUUIDPipe) bookingId: string,
@Param("allocationId", ParseUUIDPipe) allocationId: string,
@CurrentUser() user: AuthUserPayload,
) {
return this.bookingJourneyService.loadWagon(
id,
bookingId,
allocationId,
resolveAuthUserId(user),
);
}
@Post("schedules/:id/bookings/:bookingId/wagons/:allocationId/unload")
@TrainSchedulingUnload()
@ApiOperation({
summary:
"Confirm ONE wagon of the booking unloaded (per-wagon unloading). The booking stays IN_TRANSIT until the last wagon, which runs the whole-booking unload completion.",
})
unloadScheduleBookingWagon(
@Param("id", ParseUUIDPipe) id: string,
@Param("bookingId", ParseUUIDPipe) bookingId: string,
@Param("allocationId", ParseUUIDPipe) allocationId: string,
@CurrentUser() user: AuthUserPayload,
) {
return this.bookingJourneyService.unloadWagon(
id,
bookingId,
allocationId,
resolveAuthUserId(user),
);
}
@Post("schedules/:id/intercity/:bookingId/load")
@TrainSchedulingLoad()
@ApiOperation({