Files
edr-platform/apps/edr-freight-web/backoffice/src/constants/rateMatrixConstants.ts
2026-06-02 10:47:36 +03:00

60 lines
2.6 KiB
TypeScript

// constants/rateMatrixConstants.ts
export const RATE_TYPES = {
CONTAINER_IMPORT: 'container_import',
CONTAINER_EXPORT: 'container_export',
BULK_IMPORT: 'bulk_import',
BULK_EXPORT: 'bulk_export',
INTER_CITY_BULK: 'inter_city_bulk',
INTER_CITY_CONTAINER: 'inter_city_container',
FIRST_MILE: 'first_mile',
LAST_MILE: 'last_mile',
DEMURRAGE: 'demurrage',
LASHING: 'lashing',
DOUBLE_HANDLING: 'double_handling',
CONTAINER_WITH_RETURN: 'container_with_return',
CANCELLATION_FEE: 'cancellation_fee',
} as const;
export const RATE_TYPE_LABELS = {
[RATE_TYPES.CONTAINER_IMPORT]: 'Container Import Rates',
[RATE_TYPES.CONTAINER_EXPORT]: 'Container Export Rates',
[RATE_TYPES.BULK_IMPORT]: 'Bulk Import Rates',
[RATE_TYPES.BULK_EXPORT]: 'Bulk Export Rates',
[RATE_TYPES.INTER_CITY_BULK]: 'Inter City Bulk Rates',
[RATE_TYPES.INTER_CITY_CONTAINER]: 'Inter City Container Rates',
[RATE_TYPES.FIRST_MILE]: 'First Mile Cost Rates',
[RATE_TYPES.LAST_MILE]: 'Last Mile Cost Rates',
[RATE_TYPES.DEMURRAGE]: 'Demurrage Cost Rates',
[RATE_TYPES.LASHING]: 'Lashing Cost Rates',
[RATE_TYPES.DOUBLE_HANDLING]: 'Double Handling Cost Rates',
[RATE_TYPES.CONTAINER_WITH_RETURN]: 'Container With Return Cost Rates',
[RATE_TYPES.CANCELLATION_FEE]: 'Cancellation Fee Cost Rates',
} as const;
export const REQUIRED_RATE_TYPES = Object.values(RATE_TYPES);
export const RATE_FIELDS_CONFIG = {
[RATE_TYPES.CONTAINER_IMPORT]: [
{ name: 'portOfLoading', label: 'Port of Loading', type: 'text', required: true },
{ name: 'portOfDischarge', label: 'Port of Discharge', type: 'text', required: true },
{ name: 'containerType', label: 'Container Type', type: 'select', required: true },
{ name: 'baseRate', label: 'Base Rate', type: 'number', required: true, min: 0, step: '0.01' },
{ name: 'baf', label: 'Bunker Adjustment Factor', type: 'number', required: false, min: 0 },
{ name: 'caf', label: 'Currency Adjustment Factor', type: 'number', required: false, min: 0 },
],
[RATE_TYPES.DEMURRAGE]: [
{ name: 'containerType', label: 'Container Type', type: 'select', required: true },
{ name: 'freeDays', label: 'Free Days', type: 'number', required: true, min: 0 },
{ name: 'ratePerDay', label: 'Rate per Day', type: 'number', required: true, min: 0 },
{ name: 'maximumDays', label: 'Maximum Days', type: 'number', required: false, min: 1 },
],
// ... define for all 13 rate types
} as const;
export const MATRIX_STATUS = {
DRAFT: 'draft',
PENDING_APPROVAL: 'pending_approval',
ACTIVE: 'active',
REJECTED: 'rejected',
EXPIRED: 'expired',
} as const;