mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 06:28:12 +00:00
121 lines
4.7 KiB
TypeScript
121 lines
4.7 KiB
TypeScript
import type { FleetResourceConfig } from "./resources";
|
|
|
|
const VEHICLE_TYPE_OPTIONS = [
|
|
{ label: "Truck", value: "TRUCK" },
|
|
{ label: "Van", value: "VAN" },
|
|
{ label: "Car", value: "CAR" },
|
|
{ label: "Bus", value: "BUS" },
|
|
{ label: "Trailer", value: "TRAILER" },
|
|
{ label: "Tanker", value: "TANKER" },
|
|
{ label: "Flatbed", value: "FLATBED" },
|
|
];
|
|
|
|
const FUEL_TYPE_OPTIONS = [
|
|
{ label: "Petrol", value: "PETROL" },
|
|
{ label: "Diesel", value: "DIESEL" },
|
|
{ label: "Electric", value: "ELECTRIC" },
|
|
{ label: "Hybrid", value: "HYBRID" },
|
|
];
|
|
|
|
const VEHICLE_STATUS_OPTIONS = [
|
|
{ label: "Active", value: "ACTIVE" },
|
|
{ label: "Maintenance", value: "MAINTENANCE" },
|
|
{ label: "Retired", value: "RETIRED" },
|
|
{ label: "Out of service", value: "OUT_OF_SERVICE" },
|
|
];
|
|
|
|
const VEHICLE_AVAILABILITY_OPTIONS = [
|
|
{ label: "Free", value: "FREE" },
|
|
{ label: "Busy", value: "BUSY" },
|
|
];
|
|
|
|
const CURRENCY_OPTIONS = [
|
|
{ label: "ETB", value: "ETB" },
|
|
{ label: "USD", value: "USD" },
|
|
];
|
|
|
|
export const vehiclesConfig: FleetResourceConfig = {
|
|
slug: "vehicles",
|
|
label: "Vehicles",
|
|
subtitle: "Manage vehicle master data for fleet operations",
|
|
basePath: "/dashboard/vehicles",
|
|
detailPath: "/dashboard/vehicles/:id",
|
|
addLabel: "Add Vehicle",
|
|
entityLabel: "Vehicle",
|
|
searchPlaceholder: "Search vehicles…",
|
|
supportsSearch: true,
|
|
removeAction: "delete",
|
|
cardTitleKey: "plateNumber",
|
|
cardCodeKey: "plateNumber",
|
|
cardSubtitleKey: "status",
|
|
listFilters: [
|
|
{
|
|
key: "status",
|
|
label: "Status",
|
|
allLabel: "All statuses",
|
|
options: VEHICLE_STATUS_OPTIONS,
|
|
},
|
|
{
|
|
key: "availability",
|
|
label: "Availability",
|
|
allLabel: "All availability",
|
|
options: VEHICLE_AVAILABILITY_OPTIONS,
|
|
},
|
|
],
|
|
searchKeys: ["plateNumber", "registrationNumber", "manufacturer", "model", "vehicleType", "status"],
|
|
columns: [
|
|
{ id: "code", header: "Code", accessorKey: "code", size: 90 },
|
|
{ id: "plateNumber", header: "Plate Number", accessorKey: "plateNumber", size: 120 },
|
|
{ id: "trailerPlateNo", header: "Trailer Plate No", accessorKey: "trailerPlateNo", size: 130 },
|
|
{ id: "manufacturer", header: "Manufacturer", accessorKey: "manufacturer", size: 120 },
|
|
{ id: "model", header: "Model", accessorKey: "model", size: 100 },
|
|
{ id: "vehicleType", header: "Type", accessorKey: "vehicleType", size: 75 },
|
|
{ id: "capacity", header: "Capacity (tons)", accessorKey: "capacity", format: "number", size: 100 },
|
|
{ id: "locationId", header: "Location", accessorKey: "locationId", size: 140 },
|
|
{ id: "status", header: "Status", accessorKey: "status", format: "statusBadge", size: 100 },
|
|
{ id: "availability", header: "Availability", accessorKey: "availability", format: "statusBadge", size: 100 },
|
|
],
|
|
formFields: [
|
|
{ name: "code", label: "Code", type: "text" },
|
|
{ name: "plateNumber", label: "Power Plate No", type: "text", required: true },
|
|
// { name: "powerPlateNo", label: "Power Plate No", type: "text" },
|
|
{ name: "trailerPlateNo", label: "Trailer Plate No", type: "text" },
|
|
{ name: "vehicleType", label: "Vehicle Type", type: "select", required: true, options: VEHICLE_TYPE_OPTIONS },
|
|
{ name: "manufacturer", label: "Manufacturer", type: "text", required: true },
|
|
{ name: "model", label: "Model", type: "text", required: true },
|
|
{ name: "year", label: "Year", type: "number", required: true },
|
|
{ name: "fuelType", label: "Fuel Type", type: "select", required: true, options: FUEL_TYPE_OPTIONS },
|
|
{ name: "capacity", label: "Capacity", type: "number", required: true },
|
|
{ name: "locationId", label: "Location", type: "select", dynamicOptions: "yards" },
|
|
{ name: "estimatedDistanceKm", label: "Estimated Distance (KM)", type: "number" },
|
|
{ name: "actualDistanceKm", label: "Actual Distance (KM)", type: "number" },
|
|
{ name: "pricePerKm", label: "Price per KM", type: "number" },
|
|
{ name: "currency", label: "Currency", type: "radio", options: CURRENCY_OPTIONS },
|
|
{ name: "status", label: "Status", type: "select", required: true, options: VEHICLE_STATUS_OPTIONS },
|
|
{ name: "availability", label: "Availability", type: "select", required: true, options: VEHICLE_AVAILABILITY_OPTIONS },
|
|
{ name: "description", label: "Description", type: "textarea" },
|
|
],
|
|
emptyValues: {
|
|
code: "",
|
|
plateNumber: "",
|
|
powerPlateNo: "",
|
|
trailerPlateNo: "",
|
|
vehicleType: "TRUCK",
|
|
manufacturer: "",
|
|
model: "",
|
|
year: new Date().getFullYear(),
|
|
fuelType: "DIESEL",
|
|
capacity: 0,
|
|
locationId: null,
|
|
estimatedDistanceKm: "",
|
|
actualDistanceKm: "",
|
|
pricePerKm: "",
|
|
currency: "ETB",
|
|
status: "ACTIVE",
|
|
availability: "FREE",
|
|
description: "",
|
|
},
|
|
};
|
|
|
|
export { VEHICLE_TYPE_OPTIONS, FUEL_TYPE_OPTIONS, VEHICLE_STATUS_OPTIONS, VEHICLE_AVAILABILITY_OPTIONS };
|