implement contract cancellation feature and update contract statuses

- Added functionality to cancel contracts, allowing users to provide a reason for cancellation.
- Updated contract statuses to include SUSPENDED and changed CLOSED to COMPLETED.
- Enhanced the UI to reflect the new cancellation option and updated messaging for contract statuses.
- Refactored contract booking actions to accommodate changes in booking logic for ONE_TIME and GENERAL contracts.
- Removed clearance document management from the contract detail page, as it is now handled per booking.
- Introduced a SQL script to reset bookings and train schedules for development purposes.
This commit is contained in:
Marshal
2026-07-28 05:02:58 +00:00
parent 481878e553
commit 2429f6b629
83 changed files with 3083 additions and 3729 deletions

View File

@@ -78,6 +78,9 @@ export const CONTRACT_STATUSES = [
"CLEARANCE_UNDER_REVIEW",
"CLEARANCE_READY_FOR_BOOKING",
"ACTIVE_SHIPMENT_IN_PROGRESS",
// Backoffice froze the contract post-signature. Reversible: the pre-suspension
// status is kept in statusBeforeSuspension and restored on resume.
"SUSPENDED",
// terminal
"CONTRACT_CLOSED",
"EXPIRED",
@@ -768,6 +771,18 @@ export interface IContract extends BaseEntity {
* Tells the returned-to approver why the chain came back to them.
*/
latestSendBackNote?: string | null;
/** Status the contract returns to when a suspension is lifted. */
statusBeforeSuspension?: ContractStatus | null;
/**
* Body of the latest SUSPENSION review note (detail response only, while
* SUSPENDED). Shown to both staff and customer.
*/
latestSuspensionNote?: string | null;
/**
* Bookings on this contract that are not in a terminal state (detail response
* only). The portal's cancel action is blocked while this is > 0.
*/
activeBookingCount?: number;
clearanceStatus: ContractClearanceStatus;
clearanceCycleNumber: number;
/**

View File

@@ -326,6 +326,8 @@ export enum WagonMovementKind {
EmptyReposition = "EMPTY_REPOSITION",
/** Staff manually corrected/updated the wagon's yard. */
Manual = "MANUAL",
/** Detached from a train and put out of service for maintenance. */
Maintenance = "MAINTENANCE",
}
export interface IWagonMovement extends BaseEntity {