mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 14:08:11 +00:00
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:
@@ -0,0 +1,40 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
/**
|
||||
* Partial wagon-transfer fulfilment.
|
||||
*
|
||||
* A request for 50 wagons no longer has to be met in one go: OCC moves what the
|
||||
* source yard can spare, whenever it can, and the request stays open until the
|
||||
* full count is met (FULFILLED) or OCC ends it short (CLOSED_SHORT) so the
|
||||
* requester can ask another yard for the rest.
|
||||
*
|
||||
* Existing rows are back-filled so history keeps reading correctly: a FULFILLED
|
||||
* request delivered its whole quantity; anything else delivered nothing.
|
||||
*/
|
||||
export class AddWagonTransferPartialFulfilment2930000000000
|
||||
implements MigrationInterface
|
||||
{
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE freight.wagon_transfer_requests
|
||||
ADD COLUMN IF NOT EXISTS fulfilled_quantity integer NOT NULL DEFAULT 0,
|
||||
ADD COLUMN IF NOT EXISTS closed_short_at timestamptz NULL,
|
||||
ADD COLUMN IF NOT EXISTS closed_short_by_user_id uuid NULL
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
UPDATE freight.wagon_transfer_requests
|
||||
SET fulfilled_quantity = quantity
|
||||
WHERE status = 'FULFILLED'
|
||||
AND fulfilled_quantity = 0
|
||||
`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE freight.wagon_transfer_requests
|
||||
DROP COLUMN IF EXISTS fulfilled_quantity,
|
||||
DROP COLUMN IF EXISTS closed_short_at,
|
||||
DROP COLUMN IF EXISTS closed_short_by_user_id
|
||||
`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user