mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 22:18:12 +00:00
fix ui
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||||
|
|
||||||
|
export class AddDistanceColumnsToVehicles1821000000002 implements MigrationInterface {
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`
|
||||||
|
ALTER TABLE freight.vehicles
|
||||||
|
ADD COLUMN IF NOT EXISTS estimated_distance_km NUMERIC,
|
||||||
|
ADD COLUMN IF NOT EXISTS actual_distance_km NUMERIC;
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`
|
||||||
|
ALTER TABLE freight.vehicles
|
||||||
|
DROP COLUMN IF EXISTS estimated_distance_km,
|
||||||
|
DROP COLUMN IF EXISTS actual_distance_km;
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -49,4 +49,12 @@ export class CreateVehicleDto {
|
|||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
trailerPlateNo?: string;
|
trailerPlateNo?: string;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
|
estimatedDistanceKm?: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
|
actualDistanceKm?: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,4 +62,10 @@ export class Vehicle extends BaseEntity {
|
|||||||
|
|
||||||
@Column({ name: 'assigned_driver_name', nullable: true })
|
@Column({ name: 'assigned_driver_name', nullable: true })
|
||||||
assignedDriverName?: string;
|
assignedDriverName?: string;
|
||||||
|
|
||||||
|
@Column({ name: 'estimated_distance_km', type: 'numeric', nullable: true })
|
||||||
|
estimatedDistanceKm?: number;
|
||||||
|
|
||||||
|
@Column({ name: 'actual_distance_km', type: 'numeric', nullable: true })
|
||||||
|
actualDistanceKm?: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ export const vehiclesConfig: FleetResourceConfig = {
|
|||||||
{ id: "fuelType", header: "Fuel Type", accessorKey: "fuelType", format: "code", size: 110 },
|
{ id: "fuelType", header: "Fuel Type", accessorKey: "fuelType", format: "code", size: 110 },
|
||||||
{ id: "capacity", header: "Capacity (tons)", accessorKey: "capacity", format: "number", size: 130 },
|
{ id: "capacity", header: "Capacity (tons)", accessorKey: "capacity", format: "number", size: 130 },
|
||||||
{ id: "assignedDriverName", header: "Assigned Driver", accessorKey: "assignedDriverName", format: "code", size: 140 },
|
{ id: "assignedDriverName", header: "Assigned Driver", accessorKey: "assignedDriverName", format: "code", size: 140 },
|
||||||
|
{ id: "estimatedDistanceKm", header: "Est. Distance (KM)", accessorKey: "estimatedDistanceKm", format: "number", size: 150 },
|
||||||
|
{ id: "actualDistanceKm", header: "Actual Distance (KM)", accessorKey: "actualDistanceKm", format: "number", size: 150 },
|
||||||
{ id: "status", header: "Status", accessorKey: "status", format: "statusBadge", size: 100 },
|
{ id: "status", header: "Status", accessorKey: "status", format: "statusBadge", size: 100 },
|
||||||
],
|
],
|
||||||
formFields: [
|
formFields: [
|
||||||
@@ -73,6 +75,8 @@ export const vehiclesConfig: FleetResourceConfig = {
|
|||||||
{ name: "year", label: "Year", type: "number", required: true },
|
{ name: "year", label: "Year", type: "number", required: true },
|
||||||
{ name: "fuelType", label: "Fuel Type", type: "select", required: true, options: FUEL_TYPE_OPTIONS },
|
{ name: "fuelType", label: "Fuel Type", type: "select", required: true, options: FUEL_TYPE_OPTIONS },
|
||||||
{ name: "capacity", label: "Capacity", type: "number", required: true },
|
{ name: "capacity", label: "Capacity", type: "number", required: true },
|
||||||
|
{ name: "estimatedDistanceKm", label: "Estimated Distance (KM)", type: "number" },
|
||||||
|
{ name: "actualDistanceKm", label: "Actual Distance (KM)", type: "number" },
|
||||||
{ name: "status", label: "Status", type: "select", required: true, options: VEHICLE_STATUS_OPTIONS },
|
{ name: "status", label: "Status", type: "select", required: true, options: VEHICLE_STATUS_OPTIONS },
|
||||||
{ name: "description", label: "Description", type: "textarea" },
|
{ name: "description", label: "Description", type: "textarea" },
|
||||||
],
|
],
|
||||||
@@ -87,6 +91,8 @@ export const vehiclesConfig: FleetResourceConfig = {
|
|||||||
year: new Date().getFullYear(),
|
year: new Date().getFullYear(),
|
||||||
fuelType: "DIESEL",
|
fuelType: "DIESEL",
|
||||||
capacity: 0,
|
capacity: 0,
|
||||||
|
estimatedDistanceKm: "",
|
||||||
|
actualDistanceKm: "",
|
||||||
status: "ACTIVE",
|
status: "ACTIVE",
|
||||||
description: "",
|
description: "",
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user