This commit is contained in:
natib21
2026-07-02 14:14:13 +00:00
parent 34b87bbcee
commit c2c29f0735
13 changed files with 84 additions and 23 deletions

View File

@@ -19,13 +19,16 @@ const FUEL_TYPE_OPTIONS = [
const VEHICLE_STATUS_OPTIONS = [
{ label: "Active", value: "ACTIVE" },
{ label: "Free", value: "FREE" },
{ label: "Busy", value: "BUSY" },
{ 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" },
];
export const vehiclesConfig: FleetResourceConfig = {
slug: "vehicles",
label: "Vehicles",
@@ -58,6 +61,7 @@ export const vehiclesConfig: FleetResourceConfig = {
{ 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" },
@@ -95,4 +99,4 @@ export const vehiclesConfig: FleetResourceConfig = {
},
};
export { VEHICLE_TYPE_OPTIONS, FUEL_TYPE_OPTIONS, VEHICLE_STATUS_OPTIONS };
export { VEHICLE_TYPE_OPTIONS, FUEL_TYPE_OPTIONS, VEHICLE_STATUS_OPTIONS, VEHICLE_AVAILABILITY_OPTIONS };

View File

@@ -357,7 +357,7 @@ const FirstMilePage = () => {
const { data: vehiclesData } = useQuery({
queryKey: ["vehicles", "free"],
queryFn: async () => {
const res = await vehiclesService.getAll({ status: "FREE" });
const res = await vehiclesService.getAll({ status: "ACTIVE", availability: "FREE" });
return res.data;
},
});

View File

@@ -341,7 +341,7 @@ const LastMilePage = () => {
const { data: vehiclesData } = useQuery({
queryKey: ["vehicles", "free"],
queryFn: async () => {
const res = await vehiclesService.getAll({ status: "FREE" });
const res = await vehiclesService.getAll({ status: "ACTIVE", availability: "FREE" });
return res.data;
},
});