@burdenoff/microfe-movethewheels 2026.929.3 → 2026.929.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/wspace-types.d.ts +1547 -64
- package/dist/hooks/useCustomers.js +3 -9
- package/dist/hooks/useFleet.js +146 -149
- package/dist/hooks/useInventory.js +178 -153
- package/dist/hooks/useRoutes.js +9 -9
- package/dist/hooks/useTracking.js +14 -16
- package/dist/movethewheels/hooks/useFleet.d.ts +9 -2
- package/dist/movethewheels/hooks/useInventory.d.ts +13 -12
- package/dist/movethewheels/hooks/useRoutes.d.ts +4 -1
- package/dist/movethewheels/types/index.d.ts +33 -23
- package/dist/movethewheels/utils/formatters.d.ts +1 -1
- package/dist/pages/CustomerDetailsPage.js +6 -6
- package/dist/pages/CustomersPage.js +2 -2
- package/dist/pages/DashboardPage.js +1 -1
- package/dist/pages/DriverDetailsPage.js +7 -3
- package/dist/pages/DriversPage.js +4 -4
- package/dist/pages/FleetPage.js +1 -1
- package/dist/pages/InventoryPage.js +11 -12
- package/dist/pages/LiveTrackingPage.js +4 -4
- package/dist/pages/ProductDetailsPage.js +408 -249
- package/dist/pages/ProductsPage.js +5 -5
- package/dist/pages/RouteDetailsPage.js +8 -10
- package/dist/pages/RoutesPage.js +2 -2
- package/dist/pages/TrackingPage.js +14 -8
- package/dist/pages/WarehouseDetailsPage.js +166 -163
- package/dist/pages/WarehousesPage.js +29 -21
- package/package.json +1 -1
- package/src/generated/wspace-types.ts +1762 -64
- package/src/movethewheels/hooks/useCustomers.ts +7 -9
- package/src/movethewheels/hooks/useFleet.ts +89 -31
- package/src/movethewheels/hooks/useInventory.ts +143 -49
- package/src/movethewheels/hooks/useRoutes.ts +36 -16
- package/src/movethewheels/hooks/useTracking.ts +23 -15
- package/src/movethewheels/pages/CustomerDetailsPage.tsx +14 -8
- package/src/movethewheels/pages/CustomersPage.tsx +5 -2
- package/src/movethewheels/pages/DashboardPage.tsx +3 -1
- package/src/movethewheels/pages/DriverDetailsPage.tsx +13 -3
- package/src/movethewheels/pages/DriversPage.tsx +1 -1
- package/src/movethewheels/pages/FleetPage.tsx +1 -1
- package/src/movethewheels/pages/InventoryPage.tsx +20 -16
- package/src/movethewheels/pages/LiveTrackingPage.tsx +6 -4
- package/src/movethewheels/pages/ProductDetailsPage.tsx +228 -49
- package/src/movethewheels/pages/ProductsPage.tsx +13 -5
- package/src/movethewheels/pages/RouteDetailsPage.tsx +16 -8
- package/src/movethewheels/pages/RoutesPage.tsx +4 -2
- package/src/movethewheels/pages/TrackingPage.tsx +25 -10
- package/src/movethewheels/pages/WarehouseDetailsPage.tsx +42 -29
- package/src/movethewheels/pages/WarehousesPage.tsx +23 -15
- package/src/movethewheels/types/index.ts +36 -24
- package/src/movethewheels/utils/formatters.ts +1 -1
|
@@ -4,6 +4,7 @@ import { useCallback as n, useEffect as r, useMemo as i, useState as a } from "r
|
|
|
4
4
|
//#region src/movethewheels/hooks/useCustomers.ts
|
|
5
5
|
var o = "\n query ListCustomers($filter: CustomerFilterInput, $pagination: PaginationInput) {\n customers(filter: $filter, pagination: $pagination) {\n id\n name\n email\n phone\n type\n company\n address\n businessLicense\n taxId\n rating\n createdAt\n updatedAt\n deletedAt\n }\n customersCount(filter: $filter)\n }\n", s = "\n query GetCustomer($id: ID!) {\n customer(id: $id) {\n id\n name\n email\n phone\n type\n company\n address\n businessLicense\n taxId\n rating\n createdAt\n updatedAt\n deletedAt\n }\n }\n", c = "\n mutation CreateCustomer($input: CreateCustomerInput!) {\n createCustomer(input: $input) {\n id\n name\n email\n phone\n type\n company\n address\n businessLicense\n taxId\n rating\n createdAt\n updatedAt\n deletedAt\n }\n }\n", l = "\n mutation UpdateCustomer($id: ID!, $input: UpdateCustomerInput!) {\n updateCustomer(id: $id, input: $input) {\n id\n name\n email\n phone\n type\n company\n address\n businessLicense\n taxId\n rating\n createdAt\n updatedAt\n deletedAt\n }\n }\n", u = "\n mutation DeleteCustomer($id: ID!) {\n deleteCustomer(id: $id)\n }\n";
|
|
6
6
|
function d(e) {
|
|
7
|
+
let t = e.address ?? {};
|
|
7
8
|
return {
|
|
8
9
|
id: e.id,
|
|
9
10
|
name: e.name,
|
|
@@ -11,17 +12,10 @@ function d(e) {
|
|
|
11
12
|
phone: e.phone ?? "",
|
|
12
13
|
type: e.type.toLowerCase() === "b2b" ? "b2b" : "b2c",
|
|
13
14
|
company: e.company ?? void 0,
|
|
14
|
-
address:
|
|
15
|
-
street: "",
|
|
16
|
-
city: "",
|
|
17
|
-
state: "",
|
|
18
|
-
postalCode: "",
|
|
19
|
-
country: "",
|
|
20
|
-
...e.address ?? {}
|
|
21
|
-
},
|
|
15
|
+
address: Object.fromEntries(Object.entries(t).filter(([, e]) => typeof e == "string" && e.trim().length > 0)),
|
|
22
16
|
businessLicense: e.businessLicense ?? void 0,
|
|
23
17
|
taxId: e.taxId ?? void 0,
|
|
24
|
-
rating: e.rating ?? 0,
|
|
18
|
+
rating: e.rating ?? void 0,
|
|
25
19
|
createdAt: new Date(e.createdAt),
|
|
26
20
|
updatedAt: new Date(e.updatedAt)
|
|
27
21
|
};
|
package/dist/hooks/useFleet.js
CHANGED
|
@@ -2,7 +2,7 @@ import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
|
|
|
2
2
|
import { executeGraphQL as t } from "../utils/graphqlClient.js";
|
|
3
3
|
import { useCallback as n, useEffect as r, useMemo as i, useState as a } from "react";
|
|
4
4
|
//#region src/movethewheels/hooks/useFleet.ts
|
|
5
|
-
var o = "\n query ListVehicles($filter: VehicleFilterInput, $pagination: PaginationInput) {\n vehicles(filter: $filter, pagination: $pagination) {\n id\n vehicleNumber\n type\n make\n model\n licensePlate\n ownershipType\n year\n capacity\n status\n currentLocation\n fuelType\n fuelEfficiencyLPer100Km\n fuelLevel\n mileage\n lastServiceDate\n nextServiceDueDate\n nextServiceDueMileage\n createdAt\n updatedAt\n }\n vehiclesCount(filter: $filter)\n }\n", s = "\n query ListDrivers($filter: DriverFilterInput, $pagination: PaginationInput) {\n drivers(filter: $filter, pagination: $pagination) {\n id\n userId\n firstName\n lastName\n email\n phone\n employeeId\n licenseNumber\n licenseClass\n licenseExpiry\n status\n currentLocation\n rating\n vehicleId\n notes\n hireDate\n baseSalary\n bonusYtd\n payCurrency\n onLeaveUntil\n terminatedAt\n terminationReason\n createdAt\n }\n driversCount(filter: $filter)\n }\n", c = "\n query GetVehicle($id: ID!) {\n vehicle(id: $id) {\n id\n vehicleNumber\n type\n make\n model\n licensePlate\n ownershipType\n year\n capacity\n status\n currentLocation\n fuelType\n fuelEfficiencyLPer100Km\n fuelLevel\n mileage\n lastServiceDate\n nextServiceDueDate\n nextServiceDueMileage\n createdAt\n updatedAt\n }\n }\n", l = "\n query GetDriver($id: ID!) {\n driver(id: $id) {\n id\n userId\n firstName\n lastName\n email\n phone\n employeeId\n licenseNumber\n licenseClass\n licenseExpiry\n status\n currentLocation\n rating\n vehicleId\n notes\n hireDate\n baseSalary\n bonusYtd\n payCurrency\n onLeaveUntil\n terminatedAt\n terminationReason\n createdAt\n }\n }\n", u = "\n mutation DeleteVehicle($id: ID!) {\n deleteVehicle(id: $id)\n }\n", d = "\n mutation UpdateVehicleStatus($id: ID!, $status: VehicleStatus!) {\n updateVehicleStatus(id: $id, status: $status) {\n id\n vehicleNumber\n type\n make\n model\n licensePlate\n ownershipType\n year\n capacity\n status\n currentLocation\n fuelType\n fuelEfficiencyLPer100Km\n fuelLevel\n mileage\n createdAt\n updatedAt\n }\n }\n", f = "\n mutation AssignDriverVehicle($id: ID!, $vehicleId: ID) {\n assignDriverVehicle(id: $id, vehicleId: $vehicleId) {\n id\n userId\n firstName\n lastName\n email\n phone\n employeeId\n licenseNumber\n licenseClass\n licenseExpiry\n status\n currentLocation\n rating\n vehicleId\n notes\n hireDate\n baseSalary\n bonusYtd\n payCurrency\n onLeaveUntil\n terminatedAt\n terminationReason\n createdAt\n }\n }\n", p = "\n mutation UpdateDriverStatus($id: ID!, $status: DriverStatus!) {\n updateDriverStatus(id: $id, status: $status) {\n id\n userId\n firstName\n lastName\n email\n phone\n employeeId\n licenseNumber\n licenseClass\n licenseExpiry\n status\n currentLocation\n rating\n vehicleId\n notes\n hireDate\n baseSalary\n bonusYtd\n payCurrency\n onLeaveUntil\n terminatedAt\n terminationReason\n createdAt\n }\n }\n", m = "\n mutation CreateVehicle($input: CreateVehicleInput!) {\n createVehicle(input: $input) {\n id\n vehicleNumber\n type\n make\n model\n licensePlate\n ownershipType\n year\n capacity\n status\n currentLocation\n fuelType\n fuelEfficiencyLPer100Km\n fuelLevel\n mileage\n createdAt\n updatedAt\n }\n }\n", h = "\n mutation CreateDriver($input: CreateDriverInput!) {\n createDriver(input: $input) {\n id\n userId\n firstName\n lastName\n email\n phone\n employeeId\n licenseNumber\n licenseClass\n licenseExpiry\n status\n currentLocation\n rating\n vehicleId\n notes\n hireDate\n baseSalary\n bonusYtd\n payCurrency\n onLeaveUntil\n terminatedAt\n terminationReason\n createdAt\n }\n }\n", g = "\n mutation UpdateVehicle($id: ID!, $input: UpdateVehicleInput!) {\n updateVehicle(id: $id, input: $input) {\n id\n vehicleNumber\n type\n make\n model\n licensePlate\n ownershipType\n year\n capacity\n status\n currentLocation\n fuelType\n fuelEfficiencyLPer100Km\n fuelLevel\n mileage\n createdAt\n updatedAt\n }\n }\n", _ = "\n mutation UpdateDriver($id: ID!, $input: UpdateDriverInput!) {\n updateDriver(id: $id, input: $input) {\n id\n userId\n firstName\n lastName\n email\n phone\n employeeId\n licenseNumber\n licenseClass\n licenseExpiry\n status\n currentLocation\n rating\n vehicleId\n notes\n hireDate\n baseSalary\n bonusYtd\n payCurrency\n onLeaveUntil\n terminatedAt\n terminationReason\n createdAt\n }\n }\n", v = "\n query GetDriverStatusCounts {\n onBreak: driversCount(filter: { status: ON_BREAK })\n offDuty: driversCount(filter: { status: OFF_DUTY })\n inactive: driversCount(filter: { status: INACTIVE })\n }\n", y = "\n query GetFleetStats {\n fleetStats {\n totalVehicles\n activeVehicles\n inTransitVehicles\n maintenanceVehicles\n totalDrivers\n availableDrivers\n onDeliveryDrivers\n avgDriverRating\n }\n }\n";
|
|
5
|
+
var o = "\n query ListVehicles($filter: VehicleFilterInput, $pagination: PaginationInput) {\n vehicles(filter: $filter, pagination: $pagination) {\n id\n vehicleNumber\n type\n make\n model\n licensePlate\n ownershipType\n year\n capacity\n status\n currentLocation\n fuelType\n fuelEfficiencyLPer100Km\n fuelLevel\n mileage\n lastServiceDate\n nextServiceDueDate\n nextServiceDueMileage\n createdAt\n updatedAt\n drivers {\n id\n }\n }\n vehiclesCount(filter: $filter)\n }\n", s = "\n query ListDrivers($filter: DriverFilterInput, $pagination: PaginationInput) {\n drivers(filter: $filter, pagination: $pagination) {\n id\n userId\n firstName\n lastName\n email\n phone\n employeeId\n licenseNumber\n licenseClass\n licenseExpiry\n status\n currentLocation\n rating\n vehicleId\n notes\n hireDate\n baseSalary\n bonusYtd\n payCurrency\n onLeaveUntil\n terminatedAt\n terminationReason\n createdAt\n vehicles {\n id\n }\n }\n driversCount(filter: $filter)\n }\n", c = "\n query GetVehicle($id: ID!) {\n vehicle(id: $id) {\n id\n vehicleNumber\n type\n make\n model\n licensePlate\n ownershipType\n year\n capacity\n status\n currentLocation\n fuelType\n fuelEfficiencyLPer100Km\n fuelLevel\n mileage\n lastServiceDate\n nextServiceDueDate\n nextServiceDueMileage\n createdAt\n updatedAt\n drivers {\n id\n }\n }\n }\n", l = "\n query GetDriver($id: ID!) {\n driver(id: $id) {\n id\n userId\n firstName\n lastName\n email\n phone\n employeeId\n licenseNumber\n licenseClass\n licenseExpiry\n status\n currentLocation\n rating\n vehicleId\n notes\n hireDate\n baseSalary\n bonusYtd\n payCurrency\n onLeaveUntil\n terminatedAt\n terminationReason\n createdAt\n vehicles {\n id\n }\n }\n }\n", u = "\n mutation DeleteVehicle($id: ID!) {\n deleteVehicle(id: $id)\n }\n", d = "\n mutation UpdateVehicleStatus($id: ID!, $status: VehicleStatus!) {\n updateVehicleStatus(id: $id, status: $status) {\n id\n vehicleNumber\n type\n make\n model\n licensePlate\n ownershipType\n year\n capacity\n status\n currentLocation\n fuelType\n fuelEfficiencyLPer100Km\n fuelLevel\n mileage\n createdAt\n updatedAt\n drivers {\n id\n }\n }\n }\n", f = "\n mutation AssignDriverVehicle($id: ID!, $vehicleId: ID) {\n assignDriverVehicle(id: $id, vehicleId: $vehicleId) {\n id\n userId\n firstName\n lastName\n email\n phone\n employeeId\n licenseNumber\n licenseClass\n licenseExpiry\n status\n currentLocation\n rating\n vehicleId\n notes\n hireDate\n baseSalary\n bonusYtd\n payCurrency\n onLeaveUntil\n terminatedAt\n terminationReason\n createdAt\n vehicles {\n id\n }\n }\n }\n", p = "\n mutation UpdateDriverStatus($id: ID!, $status: DriverStatus!) {\n updateDriverStatus(id: $id, status: $status) {\n id\n userId\n firstName\n lastName\n email\n phone\n employeeId\n licenseNumber\n licenseClass\n licenseExpiry\n status\n currentLocation\n rating\n vehicleId\n notes\n hireDate\n baseSalary\n bonusYtd\n payCurrency\n onLeaveUntil\n terminatedAt\n terminationReason\n createdAt\n vehicles {\n id\n }\n }\n }\n", m = "\n mutation CreateVehicle($input: CreateVehicleInput!) {\n createVehicle(input: $input) {\n id\n vehicleNumber\n type\n make\n model\n licensePlate\n ownershipType\n year\n capacity\n status\n currentLocation\n fuelType\n fuelEfficiencyLPer100Km\n fuelLevel\n mileage\n createdAt\n updatedAt\n drivers {\n id\n }\n }\n }\n", h = "\n mutation CreateDriver($input: CreateDriverInput!) {\n createDriver(input: $input) {\n id\n userId\n firstName\n lastName\n email\n phone\n employeeId\n licenseNumber\n licenseClass\n licenseExpiry\n status\n currentLocation\n rating\n vehicleId\n notes\n hireDate\n baseSalary\n bonusYtd\n payCurrency\n onLeaveUntil\n terminatedAt\n terminationReason\n createdAt\n vehicles {\n id\n }\n }\n }\n", g = "\n mutation UpdateVehicle($id: ID!, $input: UpdateVehicleInput!) {\n updateVehicle(id: $id, input: $input) {\n id\n vehicleNumber\n type\n make\n model\n licensePlate\n ownershipType\n year\n capacity\n status\n currentLocation\n fuelType\n fuelEfficiencyLPer100Km\n fuelLevel\n mileage\n createdAt\n updatedAt\n drivers {\n id\n }\n }\n }\n", _ = "\n mutation UpdateDriver($id: ID!, $input: UpdateDriverInput!) {\n updateDriver(id: $id, input: $input) {\n id\n userId\n firstName\n lastName\n email\n phone\n employeeId\n licenseNumber\n licenseClass\n licenseExpiry\n status\n currentLocation\n rating\n vehicleId\n notes\n hireDate\n baseSalary\n bonusYtd\n payCurrency\n onLeaveUntil\n terminatedAt\n terminationReason\n createdAt\n vehicles {\n id\n }\n }\n }\n", v = "\n query GetDriverStatusCounts {\n onBreak: driversCount(filter: { status: ON_BREAK })\n offDuty: driversCount(filter: { status: OFF_DUTY })\n inactive: driversCount(filter: { status: INACTIVE })\n }\n", y = "\n query GetFleetStats {\n fleetStats {\n totalVehicles\n activeVehicles\n inTransitVehicles\n maintenanceVehicles\n totalDrivers\n availableDrivers\n onDeliveryDrivers\n avgDriverRating\n }\n }\n";
|
|
6
6
|
function b(e) {
|
|
7
7
|
switch (e) {
|
|
8
8
|
case "ACTIVE": return "available";
|
|
@@ -68,7 +68,8 @@ function T(e) {
|
|
|
68
68
|
pallets: typeof e.capacity?.pallets == "number" ? e.capacity.pallets : void 0
|
|
69
69
|
},
|
|
70
70
|
status: b(e.status),
|
|
71
|
-
|
|
71
|
+
driverIds: (e.drivers ?? []).map((e) => e.id),
|
|
72
|
+
driverId: e.drivers?.[0]?.id,
|
|
72
73
|
currentLocation: w(e.currentLocation),
|
|
73
74
|
lastMaintenance: e.lastServiceDate ? new Date(e.lastServiceDate) : void 0,
|
|
74
75
|
nextMaintenance: e.nextServiceDueDate ? new Date(e.nextServiceDueDate) : void 0,
|
|
@@ -92,11 +93,11 @@ function E(e) {
|
|
|
92
93
|
licenseNumber: e.licenseNumber ?? "",
|
|
93
94
|
licenseType: e.licenseClass ?? "",
|
|
94
95
|
licenseExpiry: e.licenseExpiry ? new Date(e.licenseExpiry) : void 0,
|
|
95
|
-
vehicleIds: e.vehicleId ? [e.vehicleId] : [],
|
|
96
|
-
assignedVehicle: e.vehicleId ?? void 0,
|
|
96
|
+
vehicleIds: e.vehicles && e.vehicles.length > 0 ? e.vehicles.map((e) => e.id) : e.vehicleId ? [e.vehicleId] : [],
|
|
97
|
+
assignedVehicle: e.vehicles?.[0]?.id ?? e.vehicleId ?? void 0,
|
|
97
98
|
status: S(e.status),
|
|
98
99
|
currentLocation: w(e.currentLocation),
|
|
99
|
-
rating: e.rating ?? 0,
|
|
100
|
+
rating: e.rating ?? void 0,
|
|
100
101
|
notes: e.notes ?? void 0,
|
|
101
102
|
hireDate: e.hireDate ? new Date(e.hireDate) : void 0,
|
|
102
103
|
baseSalary: e.baseSalary ?? void 0,
|
|
@@ -134,8 +135,8 @@ function O(e = {}) {
|
|
|
134
135
|
c?.status,
|
|
135
136
|
c?.vehicleId,
|
|
136
137
|
c?.vehicleType
|
|
137
|
-
]), f = D(), [p, v] = a([]), [y, b] = a([]), [S, C] = a(
|
|
138
|
-
|
|
138
|
+
]), f = D(), [p, v] = a([]), [y, b] = a([]), [S, C] = a(0), [w, O] = a(0), [k, A] = a(!1), [j, M] = a(null), N = n(async () => {
|
|
139
|
+
A(!0), M(null);
|
|
139
140
|
try {
|
|
140
141
|
let [e, n] = await Promise.all([t(f, o, {
|
|
141
142
|
filter: {
|
|
@@ -158,190 +159,186 @@ function O(e = {}) {
|
|
|
158
159
|
offset: 0
|
|
159
160
|
}
|
|
160
161
|
})]);
|
|
161
|
-
v(e.vehicles.map(T)), b(n.drivers.map(E));
|
|
162
|
+
v(e.vehicles.map(T)), b(n.drivers.map(E)), C(e.vehiclesCount), O(n.driversCount);
|
|
162
163
|
} catch (e) {
|
|
163
|
-
|
|
164
|
+
M(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load fleet data"));
|
|
164
165
|
} finally {
|
|
165
|
-
|
|
166
|
+
A(!1);
|
|
166
167
|
}
|
|
167
168
|
}, [
|
|
168
169
|
d,
|
|
169
170
|
f,
|
|
170
171
|
l
|
|
171
172
|
]);
|
|
172
|
-
r(() => {
|
|
173
|
-
|
|
174
|
-
}, [
|
|
175
|
-
let A = n(() => {
|
|
176
|
-
k();
|
|
177
|
-
}, [k]), j = n(async (e) => {
|
|
178
|
-
let n = T((await t(f, m, { input: {
|
|
179
|
-
vehicleNumber: e.vehicleNumber,
|
|
180
|
-
type: e.type,
|
|
181
|
-
make: e.make,
|
|
182
|
-
model: e.model,
|
|
183
|
-
licensePlate: e.licensePlate,
|
|
184
|
-
ownershipType: e.ownershipType,
|
|
185
|
-
year: e.year,
|
|
186
|
-
status: e.status,
|
|
187
|
-
fuelType: e.fuelType,
|
|
188
|
-
fuelEfficiencyLPer100Km: e.fuelEfficiencyLPer100Km,
|
|
189
|
-
capacity: e.capacity
|
|
190
|
-
} })).createVehicle);
|
|
191
|
-
return v((e) => [n, ...e]), n;
|
|
192
|
-
}, [f]), M = n(async (e) => {
|
|
193
|
-
let n = E((await t(f, h, { input: {
|
|
194
|
-
employeeId: e.employeeId,
|
|
195
|
-
firstName: e.firstName,
|
|
196
|
-
lastName: e.lastName,
|
|
197
|
-
email: e.email,
|
|
198
|
-
phone: e.phone,
|
|
199
|
-
licenseNumber: e.licenseNumber,
|
|
200
|
-
licenseClass: e.licenseClass,
|
|
201
|
-
licenseExpiry: e.licenseExpiry,
|
|
202
|
-
status: e.status,
|
|
203
|
-
vehicleId: e.vehicleId,
|
|
204
|
-
rating: e.rating,
|
|
205
|
-
notes: e.notes,
|
|
206
|
-
hireDate: e.hireDate,
|
|
207
|
-
baseSalary: e.baseSalary,
|
|
208
|
-
bonusYtd: e.bonusYtd,
|
|
209
|
-
payCurrency: e.payCurrency
|
|
210
|
-
} })).createDriver);
|
|
211
|
-
return b((e) => [n, ...e]), n;
|
|
212
|
-
}, [f]), N = n(async (e, n) => {
|
|
213
|
-
let r = T((await t(f, g, {
|
|
214
|
-
id: e,
|
|
215
|
-
input: {
|
|
216
|
-
vehicleNumber: n.vehicleNumber,
|
|
217
|
-
type: n.type,
|
|
218
|
-
make: n.make,
|
|
219
|
-
model: n.model,
|
|
220
|
-
licensePlate: n.licensePlate,
|
|
221
|
-
ownershipType: n.ownershipType,
|
|
222
|
-
year: n.year,
|
|
223
|
-
status: n.status,
|
|
224
|
-
fuelType: n.fuelType,
|
|
225
|
-
fuelEfficiencyLPer100Km: n.fuelEfficiencyLPer100Km,
|
|
226
|
-
capacity: n.capacity
|
|
227
|
-
}
|
|
228
|
-
})).updateVehicle);
|
|
229
|
-
return v((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
230
|
-
}, [f]), P = n(async (e, n) => {
|
|
231
|
-
let r = E((await t(f, _, {
|
|
232
|
-
id: e,
|
|
233
|
-
input: {
|
|
234
|
-
firstName: n.firstName,
|
|
235
|
-
lastName: n.lastName,
|
|
236
|
-
email: n.email,
|
|
237
|
-
phone: n.phone,
|
|
238
|
-
licenseNumber: n.licenseNumber,
|
|
239
|
-
licenseClass: n.licenseClass,
|
|
240
|
-
licenseExpiry: n.licenseExpiry,
|
|
241
|
-
status: n.status,
|
|
242
|
-
vehicleId: n.vehicleId,
|
|
243
|
-
rating: n.rating,
|
|
244
|
-
notes: n.notes,
|
|
245
|
-
hireDate: n.hireDate,
|
|
246
|
-
baseSalary: n.baseSalary,
|
|
247
|
-
bonusYtd: n.bonusYtd,
|
|
248
|
-
payCurrency: n.payCurrency,
|
|
249
|
-
onLeaveUntil: n.onLeaveUntil,
|
|
250
|
-
terminatedAt: n.terminatedAt,
|
|
251
|
-
terminationReason: n.terminationReason
|
|
252
|
-
}
|
|
253
|
-
})).updateDriver);
|
|
254
|
-
return b((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
255
|
-
}, [f]), F = n(async (e) => {
|
|
256
|
-
await t(f, u, { id: e }), v((t) => t.filter((t) => t.id !== e));
|
|
257
|
-
}, [f]);
|
|
258
|
-
return {
|
|
173
|
+
return r(() => {
|
|
174
|
+
N();
|
|
175
|
+
}, [N]), {
|
|
259
176
|
vehicles: p,
|
|
260
177
|
drivers: y,
|
|
261
|
-
totalVehicles:
|
|
262
|
-
totalDrivers:
|
|
263
|
-
isLoading:
|
|
264
|
-
error:
|
|
265
|
-
refetch:
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
178
|
+
totalVehicles: S,
|
|
179
|
+
totalDrivers: w,
|
|
180
|
+
isLoading: k,
|
|
181
|
+
error: j,
|
|
182
|
+
refetch: n(() => {
|
|
183
|
+
N();
|
|
184
|
+
}, [N]),
|
|
185
|
+
createVehicle: n(async (e) => {
|
|
186
|
+
let n = T((await t(f, m, { input: {
|
|
187
|
+
vehicleNumber: e.vehicleNumber,
|
|
188
|
+
type: e.type,
|
|
189
|
+
make: e.make,
|
|
190
|
+
model: e.model,
|
|
191
|
+
licensePlate: e.licensePlate,
|
|
192
|
+
ownershipType: e.ownershipType,
|
|
193
|
+
year: e.year,
|
|
194
|
+
status: e.status,
|
|
195
|
+
fuelType: e.fuelType,
|
|
196
|
+
fuelEfficiencyLPer100Km: e.fuelEfficiencyLPer100Km,
|
|
197
|
+
capacity: e.capacity
|
|
198
|
+
} })).createVehicle);
|
|
199
|
+
return v((e) => [n, ...e]), n;
|
|
200
|
+
}, [f]),
|
|
201
|
+
createDriver: n(async (e) => {
|
|
202
|
+
let n = E((await t(f, h, { input: {
|
|
203
|
+
employeeId: e.employeeId,
|
|
204
|
+
firstName: e.firstName,
|
|
205
|
+
lastName: e.lastName,
|
|
206
|
+
email: e.email,
|
|
207
|
+
phone: e.phone,
|
|
208
|
+
licenseNumber: e.licenseNumber,
|
|
209
|
+
licenseClass: e.licenseClass,
|
|
210
|
+
licenseExpiry: e.licenseExpiry,
|
|
211
|
+
status: e.status,
|
|
212
|
+
vehicleId: e.vehicleId,
|
|
213
|
+
vehicleIds: e.vehicleIds,
|
|
214
|
+
rating: e.rating,
|
|
215
|
+
notes: e.notes,
|
|
216
|
+
hireDate: e.hireDate,
|
|
217
|
+
baseSalary: e.baseSalary,
|
|
218
|
+
bonusYtd: e.bonusYtd,
|
|
219
|
+
payCurrency: e.payCurrency
|
|
220
|
+
} })).createDriver);
|
|
221
|
+
return b((e) => [n, ...e]), n;
|
|
222
|
+
}, [f]),
|
|
223
|
+
updateVehicle: n(async (e, n) => {
|
|
224
|
+
let r = T((await t(f, g, {
|
|
225
|
+
id: e,
|
|
226
|
+
input: {
|
|
227
|
+
vehicleNumber: n.vehicleNumber,
|
|
228
|
+
type: n.type,
|
|
229
|
+
make: n.make,
|
|
230
|
+
model: n.model,
|
|
231
|
+
licensePlate: n.licensePlate,
|
|
232
|
+
ownershipType: n.ownershipType,
|
|
233
|
+
year: n.year,
|
|
234
|
+
status: n.status,
|
|
235
|
+
fuelType: n.fuelType,
|
|
236
|
+
fuelEfficiencyLPer100Km: n.fuelEfficiencyLPer100Km,
|
|
237
|
+
capacity: n.capacity
|
|
238
|
+
}
|
|
239
|
+
})).updateVehicle);
|
|
240
|
+
return v((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
241
|
+
}, [f]),
|
|
242
|
+
updateDriver: n(async (e, n) => {
|
|
243
|
+
let r = E((await t(f, _, {
|
|
244
|
+
id: e,
|
|
245
|
+
input: {
|
|
246
|
+
firstName: n.firstName,
|
|
247
|
+
lastName: n.lastName,
|
|
248
|
+
email: n.email,
|
|
249
|
+
phone: n.phone,
|
|
250
|
+
licenseNumber: n.licenseNumber,
|
|
251
|
+
licenseClass: n.licenseClass,
|
|
252
|
+
licenseExpiry: n.licenseExpiry,
|
|
253
|
+
status: n.status,
|
|
254
|
+
vehicleId: n.vehicleId,
|
|
255
|
+
vehicleIds: n.vehicleIds,
|
|
256
|
+
rating: n.rating,
|
|
257
|
+
notes: n.notes,
|
|
258
|
+
hireDate: n.hireDate,
|
|
259
|
+
baseSalary: n.baseSalary,
|
|
260
|
+
bonusYtd: n.bonusYtd,
|
|
261
|
+
payCurrency: n.payCurrency,
|
|
262
|
+
onLeaveUntil: n.onLeaveUntil,
|
|
263
|
+
terminatedAt: n.terminatedAt,
|
|
264
|
+
terminationReason: n.terminationReason
|
|
265
|
+
}
|
|
266
|
+
})).updateDriver);
|
|
267
|
+
return b((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
268
|
+
}, [f]),
|
|
269
|
+
deleteVehicle: n(async (e) => {
|
|
270
|
+
await t(f, u, { id: e }), v((t) => t.filter((t) => t.id !== e));
|
|
271
|
+
}, [f])
|
|
271
272
|
};
|
|
272
273
|
}
|
|
273
274
|
function k(e = {}) {
|
|
274
|
-
let { limit: i = 20, offset: s = 0, search:
|
|
275
|
-
if (
|
|
276
|
-
|
|
275
|
+
let { limit: i = 20, offset: s = 0, search: l, status: p, vehicleType: m, driverId: h, ids: g } = e, _ = D(), [v, y] = a([]), [b, S] = a(0), [C, w] = a(!1), [E, O] = a(!1), [k, A] = a(null), j = n(async () => {
|
|
276
|
+
if (g && g.length === 0) {
|
|
277
|
+
y([]), S(0), w(!1);
|
|
277
278
|
return;
|
|
278
279
|
}
|
|
279
|
-
|
|
280
|
+
O(!0), A(null);
|
|
280
281
|
try {
|
|
281
|
-
let e = await t(
|
|
282
|
+
let e = await t(_, o, {
|
|
282
283
|
filter: {
|
|
283
|
-
search:
|
|
284
|
-
status:
|
|
285
|
-
type:
|
|
286
|
-
driverId:
|
|
287
|
-
ids:
|
|
284
|
+
search: l || void 0,
|
|
285
|
+
status: p ? x(p) : void 0,
|
|
286
|
+
type: m?.toUpperCase(),
|
|
287
|
+
driverId: h || void 0,
|
|
288
|
+
ids: g && g.length > 0 ? [...g] : void 0
|
|
288
289
|
},
|
|
289
290
|
pagination: {
|
|
290
|
-
limit:
|
|
291
|
-
offset:
|
|
291
|
+
limit: g && g.length > 0 ? g.length : i,
|
|
292
|
+
offset: g ? 0 : s
|
|
292
293
|
}
|
|
293
294
|
});
|
|
294
|
-
|
|
295
|
+
w(s + e.vehicles.length < e.vehiclesCount), S(e.vehiclesCount), y(e.vehicles.map(T));
|
|
295
296
|
} catch (e) {
|
|
296
|
-
|
|
297
|
+
A(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load vehicles"));
|
|
297
298
|
} finally {
|
|
298
|
-
|
|
299
|
+
O(!1);
|
|
299
300
|
}
|
|
300
301
|
}, [
|
|
301
|
-
|
|
302
|
+
_,
|
|
302
303
|
i,
|
|
303
304
|
s,
|
|
304
|
-
c,
|
|
305
305
|
l,
|
|
306
306
|
p,
|
|
307
307
|
m,
|
|
308
|
-
h
|
|
308
|
+
h,
|
|
309
|
+
g ? [...g].sort().join(",") : ""
|
|
309
310
|
]);
|
|
310
311
|
return r(() => {
|
|
311
|
-
|
|
312
|
-
}, [
|
|
313
|
-
vehicles:
|
|
314
|
-
totalVehicles:
|
|
315
|
-
hasMore:
|
|
316
|
-
isLoading:
|
|
317
|
-
error:
|
|
312
|
+
j();
|
|
313
|
+
}, [j]), {
|
|
314
|
+
vehicles: v,
|
|
315
|
+
totalVehicles: b,
|
|
316
|
+
hasMore: C,
|
|
317
|
+
isLoading: E,
|
|
318
|
+
error: k,
|
|
318
319
|
refetch: n(() => {
|
|
319
|
-
|
|
320
|
-
}, [
|
|
320
|
+
j();
|
|
321
|
+
}, [j]),
|
|
321
322
|
updateVehicleStatus: n(async (e, n) => {
|
|
322
|
-
let r = T((await t(
|
|
323
|
+
let r = T((await t(_, d, {
|
|
323
324
|
id: e,
|
|
324
325
|
status: x(n)
|
|
325
326
|
})).updateVehicleStatus);
|
|
326
|
-
return
|
|
327
|
-
}, [
|
|
327
|
+
return y((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
328
|
+
}, [_]),
|
|
328
329
|
assignDriver: n(async (e, n) => {
|
|
329
|
-
await t(
|
|
330
|
+
await t(_, f, {
|
|
330
331
|
id: n,
|
|
331
332
|
vehicleId: e
|
|
332
333
|
});
|
|
333
|
-
let r = _
|
|
334
|
-
if (!r) throw Error("Vehicle not found");
|
|
335
|
-
let i =
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
status: "assigned"
|
|
339
|
-
};
|
|
340
|
-
return v((t) => t.map((t) => t.id === e ? i : t)), i;
|
|
341
|
-
}, [g, _]),
|
|
334
|
+
let r = await t(_, c, { id: e });
|
|
335
|
+
if (!r.vehicle) throw Error("Vehicle not found");
|
|
336
|
+
let i = T(r.vehicle);
|
|
337
|
+
return y((t) => t.map((t) => t.id === e ? i : t)), i;
|
|
338
|
+
}, [_]),
|
|
342
339
|
deleteVehicle: n(async (e) => {
|
|
343
|
-
await t(
|
|
344
|
-
}, [
|
|
340
|
+
await t(_, u, { id: e }), y((t) => t.filter((t) => t.id !== e));
|
|
341
|
+
}, [_])
|
|
345
342
|
};
|
|
346
343
|
}
|
|
347
344
|
function A(e) {
|