feat(rates): multi-tier distance band entry in last-mile rate form

- tierList field type in rule-engine form dialog (add/remove rows,
  overlap + open-ended validation, From km auto-continues)
- create submits one rate row per tier sequentially
- editing a band row keeps the single From/To/value form
This commit is contained in:
Hagernesh
2026-08-06 04:14:19 +00:00
parent ea9df4407e
commit 4716aa14c3
7 changed files with 304 additions and 6 deletions

View File

@@ -0,0 +1,36 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
/**
* Last-mile contract fields on freight.last_mile_requests: the customer-chosen
* delivery date, the chief-approved advance amount (held until the invoice is
* generated at signing time), the rate snapshot rendered into the contract,
* and the customer signature bookkeeping. The signed PDF and signature image
* live in freight.files (resource 'last_mile_requests').
*/
export class LastMileRequestContract3290000000000 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE freight.last_mile_requests
ADD COLUMN IF NOT EXISTS requested_delivery_date date,
ADD COLUMN IF NOT EXISTS approved_advance_amount numeric(14,2),
ADD COLUMN IF NOT EXISTS contract_summary jsonb,
ADD COLUMN IF NOT EXISTS contract_generated_at timestamptz,
ADD COLUMN IF NOT EXISTS customer_signed_at timestamptz,
ADD COLUMN IF NOT EXISTS signer_display_name varchar(160),
ADD COLUMN IF NOT EXISTS consent_text text
`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE freight.last_mile_requests
DROP COLUMN IF EXISTS requested_delivery_date,
DROP COLUMN IF EXISTS approved_advance_amount,
DROP COLUMN IF EXISTS contract_summary,
DROP COLUMN IF EXISTS contract_generated_at,
DROP COLUMN IF EXISTS customer_signed_at,
DROP COLUMN IF EXISTS signer_display_name,
DROP COLUMN IF EXISTS consent_text
`);
}
}