feat: add contract extension request functionality

- Implemented  method in  to allow customers to request an extension for expired contracts.
- Added  component in  for users to initiate extension requests.
- Updated  to include logic for handling extension requests for expired contracts.
- Enhanced  to display extension request options and status.
- Created migration to add  and  columns to the contracts table.
- Added unit tests for contract extension request and handling in .
- Defined DTOs for request and extension in .
- Updated types in  to include new fields related to contract extensions.
This commit is contained in:
marshal
2026-09-06 12:33:40 +00:00
parent f225721e89
commit 75b75e3d4e
32 changed files with 1582 additions and 179 deletions

View File

@@ -844,6 +844,22 @@ export interface IContract extends BaseEntity {
* SUSPENDED). Shown to both staff and customer.
*/
latestSuspensionNote?: string | null;
/**
* Status the contract held when it lapsed to EXPIRED; restored when staff
* extend it. Null on rows that expired before this was tracked.
*/
statusBeforeExpiry?: ContractStatus | null;
/**
* When the customer asked for this EXPIRED contract's validity to be
* extended. Null when never asked, and cleared again once staff extend it.
* Staff can only extend while it is set.
*/
extensionRequestedAt?: string | null;
/**
* Body of the latest EXTENSION_REQUESTED review note (detail response only,
* while the request is pending). Tells staff why the customer wants more time.
*/
latestExtensionRequestNote?: 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.
@@ -1157,3 +1173,17 @@ export interface RenewContractDto {
/** Reference of the prior contract being renewed. */
previousContractReference?: string;
}
/** Customer asks EDR to extend the validity of their EXPIRED contract. */
export interface RequestContractExtensionDto {
/** Why the customer needs more time (optional, shown to staff). */
note?: string;
}
/** Staff extend an EXPIRED contract the customer asked to extend. */
export interface ExtendContractDto {
/** Days to add — from today once lapsed, else from the current end date. */
days: number;
/** Optional note recorded with the extension and shown to the customer. */
note?: string;
}