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

@@ -3,9 +3,11 @@ import { Type } from 'class-transformer';
import {
ArrayNotEmpty,
IsArray,
IsBoolean,
IsDateString,
IsIn,
IsInt,
IsNotEmpty,
IsNumber,
IsOptional,
IsString,
@@ -169,3 +171,28 @@ export class FilterWagonCancellationsDto {
@Min(1)
pageSize?: number;
}
/**
* Staff cancel of the never-loaded remainder of a booking mid-load: everything
* not yet LOADED on the schedule is cut, the booking shrinks to its loaded
* wagons, and the freed credit is rebookable. Fault decides the fee: CUSTOMER
* — cancellation fee invoiced (payable after the cut); EDR — no fee.
*/
export class CancelRemainingWagonsDto {
@ApiProperty({ description: 'Schedule the booking is being loaded on' })
@IsUUID('4')
scheduleId!: string;
@ApiProperty({ description: 'Why the remaining wagons are not riding' })
@IsString()
@IsNotEmpty()
@MaxLength(2000)
reason!: string;
@ApiPropertyOptional({
description: 'The shortfall is EDR\'s fault (wagon shortage, yard problem) — no fee charged',
})
@IsOptional()
@IsBoolean()
edrFault?: boolean;
}