feat: implement wagon transfer management modals and page

- Add TransferFulfillModal for fulfilling wagon transfer requests.
- Create TransferRequestFormModal for filing new wagon transfer requests.
- Introduce TransferCloseShortModal for closing requests that cannot be fully fulfilled.
- Develop WagonTransfersPage to manage and display wagon transfer requests.
- Implement utility functions for handling wagon transfer request data and UI components.
- Enhance UI with Mantine components for better user experience.
This commit is contained in:
Marshal
2026-07-26 15:11:50 +00:00
parent 9a1c8e5603
commit 9b13fa2ac6
40 changed files with 2584 additions and 809 deletions

View File

@@ -348,24 +348,44 @@ export interface IWagonMovement extends BaseEntity {
* wagons); OCC staff later pick the physical wagons and execute the move.
*/
export enum WagonTransferRequestStatus {
/** Awaiting OCC fulfilment. */
/** Awaiting OCC fulfilment — nothing moved yet. */
Pending = "PENDING",
/** OCC picked the wagons and executed the transfer. */
/**
* Some of the asked-for wagons have moved and the request is still open. OCC
* keeps sending more, any number at any time, until the full count is met.
*/
PartiallyFulfilled = "PARTIALLY_FULFILLED",
/** The full requested count has moved. */
Fulfilled = "FULFILLED",
/** Requester or OCC withdrew it before fulfilment. */
/**
* OCC ended the request with fewer wagons than asked for — the source yard
* has no more to give. The shortfall must be requested from another yard.
*/
ClosedShort = "CLOSED_SHORT",
/** Requester or OCC withdrew it before anything moved. */
Cancelled = "CANCELLED",
}
/** Statuses where OCC can still move wagons against the request. */
export const OPEN_WAGON_TRANSFER_STATUSES: WagonTransferRequestStatus[] = [
WagonTransferRequestStatus.Pending,
WagonTransferRequestStatus.PartiallyFulfilled,
];
export interface IWagonTransferRequest extends BaseEntity {
fromYardId: string;
toYardId: string;
wagonTypeId: string;
/** How many wagons of `wagonTypeId` to move out of `fromYardId`. */
quantity: number;
/** How many have actually moved so far — 0 until the first transfer. */
fulfilledQuantity: number;
status: WagonTransferRequestStatus;
requestedByUserId?: string | null;
fulfilledByUserId?: string | null;
fulfilledAt?: string | null;
/** Set when OCC ended the request short of the asked-for count. */
closedShortAt?: string | null;
/** Why the wagons are needed — required for new requests, shown on the OCC queue. */
reason?: string | null;
note?: string | null;