@burdenoff/microfe-movethewheels 2026.929.3 → 2026.930.1
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/components/CustomerPicker.js +52 -48
- package/dist/components/EntityCombobox.js +25 -23
- package/dist/components/OrderItemRow.js +123 -78
- package/dist/generated/wspace-types.d.ts +1547 -64
- package/dist/hooks/useCustomers.js +55 -26
- package/dist/hooks/useFleet.js +236 -157
- package/dist/hooks/useInventory.js +214 -153
- package/dist/hooks/useMultiModalShipments.js +30 -26
- package/dist/hooks/useRoutes.js +64 -24
- package/dist/hooks/useTracking.js +14 -16
- package/dist/movethewheels/components/CustomerPicker.d.ts +5 -1
- package/dist/movethewheels/components/EntityCombobox.d.ts +6 -3
- package/dist/movethewheels/components/OrderItemRow.d.ts +7 -1
- package/dist/movethewheels/hooks/useCustomers.d.ts +3 -0
- package/dist/movethewheels/hooks/useFleet.d.ts +15 -2
- package/dist/movethewheels/hooks/useInventory.d.ts +15 -12
- package/dist/movethewheels/hooks/useMultiModalShipments.d.ts +1 -0
- package/dist/movethewheels/hooks/useRoutes.d.ts +7 -1
- package/dist/movethewheels/types/index.d.ts +33 -23
- package/dist/movethewheels/utils/formatters.d.ts +1 -1
- package/dist/movethewheels/utils/orderValidation.d.ts +11 -0
- package/dist/pages/CreateOrderPage.js +349 -297
- 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 +340 -332
- package/dist/pages/DriversPage.js +7 -5
- package/dist/pages/FleetPage.js +1 -1
- package/dist/pages/InventoryPage.js +11 -12
- package/dist/pages/LiveTrackingPage.js +4 -4
- package/dist/pages/MultiModalShipmentPage.js +139 -125
- package/dist/pages/OrderDetailsPage.js +132 -140
- package/dist/pages/ProductDetailsPage.js +408 -249
- package/dist/pages/ProductsPage.js +5 -5
- package/dist/pages/RouteDetailsPage.js +208 -210
- package/dist/pages/RoutesPage.js +2 -2
- package/dist/pages/TrackingPage.js +16 -9
- package/dist/pages/WarehouseDetailsPage.js +166 -163
- package/dist/pages/WarehousesPage.js +29 -21
- package/dist/utils/orderValidation.js +18 -0
- package/package.json +1 -1
- package/src/generated/wspace-types.ts +1762 -64
- package/src/movethewheels/components/CustomerPicker.tsx +12 -0
- package/src/movethewheels/components/EntityCombobox.tsx +30 -11
- package/src/movethewheels/components/OrderItemRow.tsx +44 -0
- package/src/movethewheels/hooks/useCustomers.ts +45 -9
- package/src/movethewheels/hooks/useFleet.ts +214 -36
- package/src/movethewheels/hooks/useInventory.ts +185 -49
- package/src/movethewheels/hooks/useMultiModalShipments.ts +9 -7
- package/src/movethewheels/hooks/useRoutes.ts +87 -16
- package/src/movethewheels/hooks/useTracking.ts +23 -15
- package/src/movethewheels/pages/CreateOrderPage.tsx +66 -2
- 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 +25 -4
- package/src/movethewheels/pages/DriversPage.tsx +8 -2
- 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/MultiModalShipmentPage.tsx +15 -1
- package/src/movethewheels/pages/OrderDetailsPage.tsx +25 -25
- package/src/movethewheels/pages/ProductDetailsPage.tsx +228 -49
- package/src/movethewheels/pages/ProductsPage.tsx +13 -5
- package/src/movethewheels/pages/RouteDetailsPage.tsx +24 -12
- package/src/movethewheels/pages/RoutesPage.tsx +4 -2
- package/src/movethewheels/pages/TrackingPage.tsx +32 -12
- 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
- package/src/movethewheels/utils/orderValidation.ts +53 -0
|
@@ -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
|
};
|
|
@@ -31,7 +25,7 @@ function f(s = {}) {
|
|
|
31
25
|
f?.isActive,
|
|
32
26
|
f?.search,
|
|
33
27
|
f?.type
|
|
34
|
-
]), { apiGatewayUrl: g, authToken: _, workspaceToken: v, workspaceId: y, tenantId: b, currentUser: x } = e(), [S, C] = a([]), [w, T] = a(0), [E, D] = a(!1), [O, k] = a(!1), [A, j] = a(
|
|
28
|
+
]), { apiGatewayUrl: g, authToken: _, workspaceToken: v, workspaceId: y, tenantId: b, currentUser: x } = e(), [S, C] = a([]), [w, T] = a(0), [E, D] = a(!1), [O, k] = a(!1), [A, j] = a(!1), [M, N] = a(null), P = i(() => ({
|
|
35
29
|
apiGatewayUrl: g,
|
|
36
30
|
authToken: _,
|
|
37
31
|
workspaceToken: v,
|
|
@@ -45,10 +39,10 @@ function f(s = {}) {
|
|
|
45
39
|
y,
|
|
46
40
|
b,
|
|
47
41
|
x?.id
|
|
48
|
-
]),
|
|
49
|
-
k(!0),
|
|
42
|
+
]), F = n(async () => {
|
|
43
|
+
k(!0), N(null);
|
|
50
44
|
try {
|
|
51
|
-
let e = await t(
|
|
45
|
+
let e = await t(P, o, {
|
|
52
46
|
filter: {
|
|
53
47
|
type: h?.type,
|
|
54
48
|
search: h?.search
|
|
@@ -60,29 +54,64 @@ function f(s = {}) {
|
|
|
60
54
|
}), n = e.customers;
|
|
61
55
|
T(e.customersCount), D(m + n.length < e.customersCount), C(n.map(d));
|
|
62
56
|
} catch (e) {
|
|
63
|
-
|
|
57
|
+
N(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load customers"));
|
|
64
58
|
} finally {
|
|
65
59
|
k(!1);
|
|
66
60
|
}
|
|
67
61
|
}, [
|
|
68
62
|
h,
|
|
69
|
-
|
|
63
|
+
P,
|
|
64
|
+
p,
|
|
65
|
+
m
|
|
66
|
+
]), I = n(async () => {
|
|
67
|
+
if (!E || O || A) return;
|
|
68
|
+
let e = m + S.length;
|
|
69
|
+
j(!0), N(null);
|
|
70
|
+
try {
|
|
71
|
+
let n = await t(P, o, {
|
|
72
|
+
filter: {
|
|
73
|
+
type: h?.type,
|
|
74
|
+
search: h?.search
|
|
75
|
+
},
|
|
76
|
+
pagination: {
|
|
77
|
+
limit: p,
|
|
78
|
+
offset: e
|
|
79
|
+
}
|
|
80
|
+
}), r = n.customers.map(d);
|
|
81
|
+
T(n.customersCount), D(e + r.length < n.customersCount), C((e) => {
|
|
82
|
+
let t = new Set(e.map((e) => e.id));
|
|
83
|
+
return [...e, ...r.filter((e) => !t.has(e.id))];
|
|
84
|
+
});
|
|
85
|
+
} catch (e) {
|
|
86
|
+
N(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load more customers"));
|
|
87
|
+
} finally {
|
|
88
|
+
j(!1);
|
|
89
|
+
}
|
|
90
|
+
}, [
|
|
91
|
+
S.length,
|
|
92
|
+
h,
|
|
93
|
+
P,
|
|
94
|
+
E,
|
|
95
|
+
O,
|
|
96
|
+
A,
|
|
70
97
|
p,
|
|
71
98
|
m
|
|
72
99
|
]);
|
|
73
100
|
return r(() => {
|
|
74
|
-
|
|
75
|
-
}, [
|
|
101
|
+
F();
|
|
102
|
+
}, [F]), {
|
|
76
103
|
customers: S,
|
|
77
104
|
totalCustomers: w,
|
|
78
105
|
hasMore: E,
|
|
79
106
|
isLoading: O,
|
|
80
|
-
|
|
107
|
+
isLoadingMore: A,
|
|
108
|
+
error: M,
|
|
81
109
|
refetch: n(() => {
|
|
82
|
-
|
|
83
|
-
}, [
|
|
110
|
+
F();
|
|
111
|
+
}, [F]),
|
|
112
|
+
loadMore: I,
|
|
84
113
|
createCustomer: n(async (e) => {
|
|
85
|
-
let n = d((await t(
|
|
114
|
+
let n = d((await t(P, c, { input: {
|
|
86
115
|
name: e.name,
|
|
87
116
|
email: e.email,
|
|
88
117
|
phone: e.phone,
|
|
@@ -94,9 +123,9 @@ function f(s = {}) {
|
|
|
94
123
|
rating: e.rating
|
|
95
124
|
} })).createCustomer);
|
|
96
125
|
return C((e) => [n, ...e]), n;
|
|
97
|
-
}, [
|
|
126
|
+
}, [P]),
|
|
98
127
|
updateCustomer: n(async (e, n) => {
|
|
99
|
-
let r = d((await t(
|
|
128
|
+
let r = d((await t(P, l, {
|
|
100
129
|
id: e,
|
|
101
130
|
input: {
|
|
102
131
|
name: n.name,
|
|
@@ -111,10 +140,10 @@ function f(s = {}) {
|
|
|
111
140
|
}
|
|
112
141
|
})).updateCustomer);
|
|
113
142
|
return C((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
114
|
-
}, [
|
|
143
|
+
}, [P]),
|
|
115
144
|
deleteCustomer: n(async (e) => {
|
|
116
|
-
await t(
|
|
117
|
-
}, [
|
|
145
|
+
await t(P, u, { id: e }), C((t) => t.filter((t) => t.id !== e));
|
|
146
|
+
}, [P])
|
|
118
147
|
};
|
|
119
148
|
}
|
|
120
149
|
function p(o) {
|
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,228 @@ 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:
|
|
275
|
-
if (
|
|
276
|
-
|
|
275
|
+
let { limit: s = 20, offset: l = 0, search: p, status: m, vehicleType: h, driverId: g, ids: _ } = e, v = D(), [y, b] = a([]), [S, C] = a(0), [w, E] = a(!1), [O, k] = a(!1), [A, j] = a(!1), [M, N] = a(null), P = _ ? [..._].sort().join(",") : "", F = _ === void 0 ? "none" : "exact", I = i(() => P ? P.split(",") : [], [P]), L = n(async () => {
|
|
276
|
+
if (F === "exact" && I.length === 0) {
|
|
277
|
+
b([]), C(0), E(!1);
|
|
277
278
|
return;
|
|
278
279
|
}
|
|
279
|
-
|
|
280
|
+
k(!0), N(null);
|
|
280
281
|
try {
|
|
281
|
-
let e = await t(
|
|
282
|
+
let e = await t(v, o, {
|
|
282
283
|
filter: {
|
|
283
|
-
search:
|
|
284
|
-
status:
|
|
285
|
-
type:
|
|
286
|
-
driverId:
|
|
287
|
-
ids:
|
|
284
|
+
search: p || void 0,
|
|
285
|
+
status: m ? x(m) : void 0,
|
|
286
|
+
type: h?.toUpperCase(),
|
|
287
|
+
driverId: g || void 0,
|
|
288
|
+
ids: I.length > 0 ? I : void 0
|
|
288
289
|
},
|
|
289
290
|
pagination: {
|
|
290
|
-
limit:
|
|
291
|
-
offset:
|
|
291
|
+
limit: F === "exact" ? I.length : s,
|
|
292
|
+
offset: F === "exact" ? 0 : l
|
|
292
293
|
}
|
|
293
294
|
});
|
|
294
|
-
|
|
295
|
+
E(F === "none" && l + e.vehicles.length < e.vehiclesCount), C(e.vehiclesCount), b(e.vehicles.map(T));
|
|
295
296
|
} catch (e) {
|
|
296
|
-
|
|
297
|
+
N(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load vehicles"));
|
|
297
298
|
} finally {
|
|
298
|
-
|
|
299
|
+
k(!1);
|
|
299
300
|
}
|
|
300
301
|
}, [
|
|
302
|
+
v,
|
|
303
|
+
s,
|
|
304
|
+
l,
|
|
305
|
+
p,
|
|
306
|
+
m,
|
|
307
|
+
h,
|
|
301
308
|
g,
|
|
302
|
-
|
|
309
|
+
F,
|
|
310
|
+
I
|
|
311
|
+
]), R = n(async () => {
|
|
312
|
+
if (F === "exact" || !w || O || A) return;
|
|
313
|
+
let e = l + y.length;
|
|
314
|
+
j(!0), N(null);
|
|
315
|
+
try {
|
|
316
|
+
let n = await t(v, o, {
|
|
317
|
+
filter: {
|
|
318
|
+
search: p || void 0,
|
|
319
|
+
status: m ? x(m) : void 0,
|
|
320
|
+
type: h?.toUpperCase(),
|
|
321
|
+
driverId: g || void 0
|
|
322
|
+
},
|
|
323
|
+
pagination: {
|
|
324
|
+
limit: s,
|
|
325
|
+
offset: e
|
|
326
|
+
}
|
|
327
|
+
}), r = n.vehicles.map(T);
|
|
328
|
+
C(n.vehiclesCount), E(e + r.length < n.vehiclesCount), b((e) => {
|
|
329
|
+
let t = new Set(e.map((e) => e.id));
|
|
330
|
+
return [...e, ...r.filter((e) => !t.has(e.id))];
|
|
331
|
+
});
|
|
332
|
+
} catch (e) {
|
|
333
|
+
N(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load more vehicles"));
|
|
334
|
+
} finally {
|
|
335
|
+
j(!1);
|
|
336
|
+
}
|
|
337
|
+
}, [
|
|
338
|
+
g,
|
|
339
|
+
v,
|
|
340
|
+
w,
|
|
341
|
+
F,
|
|
342
|
+
O,
|
|
343
|
+
A,
|
|
303
344
|
s,
|
|
304
|
-
c,
|
|
305
345
|
l,
|
|
306
346
|
p,
|
|
307
347
|
m,
|
|
308
|
-
h
|
|
348
|
+
h,
|
|
349
|
+
y.length
|
|
309
350
|
]);
|
|
310
351
|
return r(() => {
|
|
311
|
-
|
|
312
|
-
}, [
|
|
313
|
-
vehicles:
|
|
314
|
-
totalVehicles:
|
|
315
|
-
hasMore:
|
|
316
|
-
isLoading:
|
|
317
|
-
|
|
352
|
+
L();
|
|
353
|
+
}, [L]), {
|
|
354
|
+
vehicles: y,
|
|
355
|
+
totalVehicles: S,
|
|
356
|
+
hasMore: w,
|
|
357
|
+
isLoading: O,
|
|
358
|
+
isLoadingMore: A,
|
|
359
|
+
error: M,
|
|
318
360
|
refetch: n(() => {
|
|
319
|
-
|
|
320
|
-
}, [
|
|
361
|
+
L();
|
|
362
|
+
}, [L]),
|
|
363
|
+
loadMore: R,
|
|
321
364
|
updateVehicleStatus: n(async (e, n) => {
|
|
322
|
-
let r = T((await t(
|
|
365
|
+
let r = T((await t(v, d, {
|
|
323
366
|
id: e,
|
|
324
367
|
status: x(n)
|
|
325
368
|
})).updateVehicleStatus);
|
|
326
|
-
return
|
|
327
|
-
}, [
|
|
369
|
+
return b((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
370
|
+
}, [v]),
|
|
328
371
|
assignDriver: n(async (e, n) => {
|
|
329
|
-
await t(
|
|
372
|
+
await t(v, f, {
|
|
330
373
|
id: n,
|
|
331
374
|
vehicleId: e
|
|
332
375
|
});
|
|
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, _]),
|
|
376
|
+
let r = await t(v, c, { id: e });
|
|
377
|
+
if (!r.vehicle) throw Error("Vehicle not found");
|
|
378
|
+
let i = T(r.vehicle);
|
|
379
|
+
return b((t) => t.map((t) => t.id === e ? i : t)), i;
|
|
380
|
+
}, [v]),
|
|
342
381
|
deleteVehicle: n(async (e) => {
|
|
343
|
-
await t(
|
|
344
|
-
}, [
|
|
382
|
+
await t(v, u, { id: e }), b((t) => t.filter((t) => t.id !== e));
|
|
383
|
+
}, [v])
|
|
345
384
|
};
|
|
346
385
|
}
|
|
347
386
|
function A(e) {
|
|
@@ -372,8 +411,8 @@ function A(e) {
|
|
|
372
411
|
};
|
|
373
412
|
}
|
|
374
413
|
function j(e = {}) {
|
|
375
|
-
let { limit: i = 20, offset: o = 0, status: c, search: l, licenseClass: u, vehicleId: d } = e, m = D(), [h, g] = a([]), [_, v] = a(0), [y, b] = a(!1), [x, S] = a(!1), [w, T] = a(
|
|
376
|
-
S(!0),
|
|
414
|
+
let { limit: i = 20, offset: o = 0, status: c, search: l, licenseClass: u, vehicleId: d } = e, m = D(), [h, g] = a([]), [_, v] = a(0), [y, b] = a(!1), [x, S] = a(!1), [w, T] = a(!1), [O, k] = a(null), A = n(async () => {
|
|
415
|
+
S(!0), k(null);
|
|
377
416
|
try {
|
|
378
417
|
let e = await t(m, s, {
|
|
379
418
|
filter: {
|
|
@@ -389,7 +428,7 @@ function j(e = {}) {
|
|
|
389
428
|
});
|
|
390
429
|
b(o + e.drivers.length < e.driversCount), v(e.driversCount), g(e.drivers.map(E));
|
|
391
430
|
} catch (e) {
|
|
392
|
-
|
|
431
|
+
k(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load drivers"));
|
|
393
432
|
} finally {
|
|
394
433
|
S(!1);
|
|
395
434
|
}
|
|
@@ -401,18 +440,58 @@ function j(e = {}) {
|
|
|
401
440
|
l,
|
|
402
441
|
u,
|
|
403
442
|
d
|
|
443
|
+
]), j = n(async () => {
|
|
444
|
+
if (!y || x || w) return;
|
|
445
|
+
let e = o + h.length;
|
|
446
|
+
T(!0), k(null);
|
|
447
|
+
try {
|
|
448
|
+
let n = await t(m, s, {
|
|
449
|
+
filter: {
|
|
450
|
+
status: c ? C(c) : void 0,
|
|
451
|
+
search: l || void 0,
|
|
452
|
+
licenseClass: u || void 0,
|
|
453
|
+
vehicleId: d || void 0
|
|
454
|
+
},
|
|
455
|
+
pagination: {
|
|
456
|
+
limit: i,
|
|
457
|
+
offset: e
|
|
458
|
+
}
|
|
459
|
+
}), r = n.drivers.map(E);
|
|
460
|
+
v(n.driversCount), b(e + r.length < n.driversCount), g((e) => {
|
|
461
|
+
let t = new Set(e.map((e) => e.id));
|
|
462
|
+
return [...e, ...r.filter((e) => !t.has(e.id))];
|
|
463
|
+
});
|
|
464
|
+
} catch (e) {
|
|
465
|
+
k(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load more drivers"));
|
|
466
|
+
} finally {
|
|
467
|
+
T(!1);
|
|
468
|
+
}
|
|
469
|
+
}, [
|
|
470
|
+
h.length,
|
|
471
|
+
m,
|
|
472
|
+
y,
|
|
473
|
+
x,
|
|
474
|
+
w,
|
|
475
|
+
i,
|
|
476
|
+
u,
|
|
477
|
+
o,
|
|
478
|
+
l,
|
|
479
|
+
c,
|
|
480
|
+
d
|
|
404
481
|
]);
|
|
405
482
|
return r(() => {
|
|
406
|
-
|
|
407
|
-
}, [
|
|
483
|
+
A();
|
|
484
|
+
}, [A]), {
|
|
408
485
|
drivers: h,
|
|
409
486
|
totalDrivers: _,
|
|
410
487
|
hasMore: y,
|
|
411
488
|
isLoading: x,
|
|
412
|
-
|
|
489
|
+
isLoadingMore: w,
|
|
490
|
+
error: O,
|
|
413
491
|
refetch: n(() => {
|
|
414
|
-
|
|
415
|
-
}, [
|
|
492
|
+
A();
|
|
493
|
+
}, [A]),
|
|
494
|
+
loadMore: j,
|
|
416
495
|
updateDriverStatus: n(async (e, n) => {
|
|
417
496
|
let r = E((await t(m, p, {
|
|
418
497
|
id: e,
|