mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 19:30:57 +00:00
- 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.
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import { BaseEntity } from '@edr/api-common';
|
|
import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm';
|
|
import { Contract } from './contract.entity';
|
|
|
|
export const CONTRACT_REVIEW_NOTE_TYPES = [
|
|
'CHANGES_REQUESTED',
|
|
'REJECTION',
|
|
'STAFF_NOTE',
|
|
'CUSTOMER_NOTE',
|
|
'AMENDMENT',
|
|
/**
|
|
* The customer disputed the advised duty & tax and asked GL Ethiopia to
|
|
* correct it. One row per round — the advice/dispute loop can repeat.
|
|
*/
|
|
'DUTY_DISPUTE',
|
|
/** Backoffice froze the contract; body is the reason shown to the customer. */
|
|
'SUSPENSION',
|
|
/** Backoffice lifted a suspension; body is the optional lift note. */
|
|
'SUSPENSION_LIFTED',
|
|
/** Customer cancelled their own contract; body is their reason. */
|
|
'CANCELLATION',
|
|
] as const;
|
|
export type ContractReviewNoteType =
|
|
(typeof CONTRACT_REVIEW_NOTE_TYPES)[number];
|
|
|
|
@Entity({ schema: 'freight', name: 'contract_review_notes' })
|
|
@Index(['contractId'])
|
|
export class ContractReviewNote extends BaseEntity {
|
|
@Column({ name: 'contract_id', type: 'uuid' })
|
|
contractId!: string;
|
|
|
|
@ManyToOne(() => Contract, (c) => c.reviewNotes, { onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'contract_id' })
|
|
contract?: Contract;
|
|
|
|
@Column({ name: 'note_type', type: 'varchar', length: 40 })
|
|
noteType!: ContractReviewNoteType;
|
|
|
|
@Column({ name: 'body', type: 'text' })
|
|
body!: string;
|
|
|
|
@Column({ name: 'author_role', type: 'varchar', length: 20, nullable: true })
|
|
authorRole?: string | null;
|
|
|
|
@Column({ name: 'author_user_id', type: 'uuid', nullable: true })
|
|
authorUserId?: string | null;
|
|
}
|