@burdenoff/microfe-movethewheels 2026.920.3 → 2026.923.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/CarbonFootprintPanel.js +1 -1
- package/dist/components/CustomerPicker.js +76 -65
- package/dist/components/DataTable.js +140 -139
- package/dist/components/DocumentsCard.js +14 -8
- package/dist/generated/wspace-types.d.ts +2719 -8
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useAnalytics.js +21 -1
- package/dist/hooks/useCustomers.js +94 -78
- package/dist/hooks/useDebouncedValue.js +11 -0
- package/dist/hooks/useEntityDocuments.js +28 -18
- package/dist/hooks/useEpod.js +24 -17
- package/dist/hooks/useFleet.js +148 -125
- package/dist/hooks/useInventory.js +255 -186
- package/dist/hooks/useMultiModalShipments.js +35 -27
- package/dist/hooks/useOrders.js +139 -134
- package/dist/hooks/useRoutes.js +97 -75
- package/dist/hooks/useTracking.js +100 -88
- package/dist/index.js +6 -6
- package/dist/movethewheels/components/CustomerPicker.d.ts +3 -1
- package/dist/movethewheels/components/DataTable.d.ts +5 -1
- package/dist/movethewheels/hooks/useCustomers.d.ts +0 -1
- package/dist/movethewheels/hooks/useDebouncedValue.d.ts +1 -0
- package/dist/movethewheels/hooks/useEntityDocuments.d.ts +2 -0
- package/dist/movethewheels/hooks/useEpod.d.ts +6 -1
- package/dist/movethewheels/hooks/useFleet.d.ts +49 -5
- package/dist/movethewheels/hooks/useInventory.d.ts +24 -17
- package/dist/movethewheels/hooks/useMultiModalShipments.d.ts +6 -1
- package/dist/movethewheels/hooks/useOrders.d.ts +48 -5
- package/dist/movethewheels/hooks/useRoutes.d.ts +18 -1
- package/dist/movethewheels/hooks/useTracking.d.ts +12 -11
- package/dist/movethewheels/types/index.d.ts +12 -5
- package/dist/pages/CreateOrderPage.js +191 -129
- package/dist/pages/CustomersPage.js +61 -54
- package/dist/pages/DeliveryCapturePage.js +131 -109
- package/dist/pages/DriversPage.js +100 -92
- package/dist/pages/InventoryPage.js +239 -236
- package/dist/pages/MultiModalShipmentPage.js +163 -130
- package/dist/pages/OrderDetailsPage.js +190 -106
- package/dist/pages/OrdersListPage.js +66 -60
- package/dist/pages/ProductDetailsPage.js +241 -200
- package/dist/pages/ProductsPage.js +59 -52
- package/dist/pages/RouteDetailsPage.js +324 -293
- package/dist/pages/RoutesPage.js +55 -48
- package/dist/pages/VehiclesPage.js +63 -56
- package/dist/pages/WarehousesPage.js +60 -53
- package/package.json +1 -1
- package/src/generated/wspace-types.ts +3136 -8
- package/src/movethewheels/components/CarbonFootprintPanel.tsx +0 -1
- package/src/movethewheels/components/CustomerPicker.tsx +14 -0
- package/src/movethewheels/components/DataTable.tsx +34 -18
- package/src/movethewheels/components/DocumentsCard.tsx +6 -1
- package/src/movethewheels/components/maps/leaflet-setup.ts +1 -8
- package/src/movethewheels/hooks/useAnalytics.ts +27 -0
- package/src/movethewheels/hooks/useCustomers.ts +64 -24
- package/src/movethewheels/hooks/useDebouncedValue.ts +12 -0
- package/src/movethewheels/hooks/useEntityDocuments.ts +43 -25
- package/src/movethewheels/hooks/useEpod.ts +14 -7
- package/src/movethewheels/hooks/useFleet.ts +66 -38
- package/src/movethewheels/hooks/useFleetIntelligence.ts +1 -4
- package/src/movethewheels/hooks/useInventory.ts +211 -90
- package/src/movethewheels/hooks/useMultiModalShipments.ts +15 -11
- package/src/movethewheels/hooks/useOrders.ts +48 -14
- package/src/movethewheels/hooks/useRoutes.ts +81 -24
- package/src/movethewheels/hooks/useTracking.ts +130 -98
- package/src/movethewheels/pages/CreateOrderPage.tsx +93 -2
- package/src/movethewheels/pages/CustomersPage.tsx +11 -1
- package/src/movethewheels/pages/DeliveryCapturePage.tsx +31 -1
- package/src/movethewheels/pages/DriversPage.tsx +24 -12
- package/src/movethewheels/pages/InventoryPage.tsx +57 -32
- package/src/movethewheels/pages/MultiModalShipmentPage.tsx +52 -3
- package/src/movethewheels/pages/OrderDetailsPage.tsx +91 -6
- package/src/movethewheels/pages/OrdersListPage.tsx +20 -3
- package/src/movethewheels/pages/ProductDetailsPage.tsx +52 -3
- package/src/movethewheels/pages/ProductsPage.tsx +11 -1
- package/src/movethewheels/pages/RouteDetailsPage.tsx +45 -5
- package/src/movethewheels/pages/RoutesPage.tsx +11 -1
- package/src/movethewheels/pages/VehiclesPage.tsx +19 -2
- package/src/movethewheels/pages/WarehousesPage.tsx +11 -1
- package/src/movethewheels/types/index.ts +12 -5
package/dist/hooks/useRoutes.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/useRoutes.ts
|
|
5
|
-
var o = "\n query ListRoutes($filter: RouteFilterInput, $pagination: PaginationInput) {\n routes(filter: $filter, pagination: $pagination) {\n id\n name\n status\n shipmentId\n vehicleId\n driverId\n waypoints\n estimatedDistance\n estimatedDuration\n fuelCost\n actualDistance\n actualDuration\n createdAt\n }\n }\n", s = "\n query GetRoute($id: ID!) {\n route(id: $id) {\n id\n name\n status\n shipmentId\n vehicleId\n driverId\n waypoints\n estimatedDistance\n estimatedDuration\n fuelCost\n actualDistance\n actualDuration\n createdAt\n }\n }\n", c = "\n mutation CreateRoute($input: CreateRouteInput!) {\n createRoute(input: $input) {\n id\n name\n status\n shipmentId\n vehicleId\n driverId\n waypoints\n estimatedDistance\n estimatedDuration\n fuelCost\n actualDistance\n actualDuration\n createdAt\n }\n }\n", l = "\n mutation UpdateRoute($id: ID!, $input: UpdateRouteInput!) {\n updateRoute(id: $id, input: $input) {\n id\n name\n status\n shipmentId\n vehicleId\n driverId\n waypoints\n estimatedDistance\n estimatedDuration\n fuelCost\n actualDistance\n actualDuration\n createdAt\n }\n }\n", u = "\n mutation DeleteRoute($id: ID!) {\n deleteRoute(id: $id)\n }\n", d = "\n mutation OptimizeRoute($id: ID!) {\n optimizeRoute(id: $id) {\n id\n name\n status\n shipmentId\n vehicleId\n driverId\n waypoints\n estimatedDistance\n estimatedDuration\n fuelCost\n actualDistance\n actualDuration\n createdAt\n }\n }\n";
|
|
5
|
+
var o = "\n query ListRoutes($filter: RouteFilterInput, $pagination: PaginationInput) {\n routes(filter: $filter, pagination: $pagination) {\n id\n name\n status\n shipmentId\n vehicleId\n driverId\n waypoints\n estimatedDistance\n estimatedDuration\n fuelCost\n actualDistance\n actualDuration\n createdAt\n }\n routesCount(filter: $filter)\n }\n", s = "\n query GetRoute($id: ID!) {\n route(id: $id) {\n id\n name\n status\n shipmentId\n vehicleId\n driverId\n waypoints\n estimatedDistance\n estimatedDuration\n fuelCost\n actualDistance\n actualDuration\n createdAt\n }\n }\n", c = "\n mutation CreateRoute($input: CreateRouteInput!) {\n createRoute(input: $input) {\n id\n name\n status\n shipmentId\n vehicleId\n driverId\n waypoints\n estimatedDistance\n estimatedDuration\n fuelCost\n actualDistance\n actualDuration\n createdAt\n }\n }\n", l = "\n mutation UpdateRoute($id: ID!, $input: UpdateRouteInput!) {\n updateRoute(id: $id, input: $input) {\n id\n name\n status\n shipmentId\n vehicleId\n driverId\n waypoints\n estimatedDistance\n estimatedDuration\n fuelCost\n actualDistance\n actualDuration\n createdAt\n }\n }\n", u = "\n mutation DeleteRoute($id: ID!) {\n deleteRoute(id: $id)\n }\n", d = "\n mutation OptimizeRoute($id: ID!) {\n optimizeRoute(id: $id) {\n id\n name\n status\n shipmentId\n vehicleId\n driverId\n waypoints\n estimatedDistance\n estimatedDuration\n fuelCost\n actualDistance\n actualDuration\n createdAt\n }\n }\n";
|
|
6
6
|
function f(e) {
|
|
7
7
|
switch (e) {
|
|
8
8
|
case "IN_PROGRESS": return "in_progress";
|
|
@@ -82,41 +82,43 @@ function g() {
|
|
|
82
82
|
]);
|
|
83
83
|
}
|
|
84
84
|
function _(e = {}) {
|
|
85
|
-
let { driverId: i, vehicleId: s, status: f,
|
|
86
|
-
|
|
85
|
+
let { driverId: i, vehicleId: s, status: f, search: m, limit: _ = 20, offset: v = 0 } = e, y = g(), [b, x] = a([]), [S, C] = a(0), [w, T] = a(!1), [E, D] = a(!1), [O, k] = a(null), A = n(async () => {
|
|
86
|
+
D(!0), k(null);
|
|
87
87
|
try {
|
|
88
|
-
let e = await t(
|
|
88
|
+
let e = await t(y, o, {
|
|
89
89
|
filter: {
|
|
90
90
|
driverId: i,
|
|
91
91
|
vehicleId: s,
|
|
92
|
-
status: f ? p(f) : void 0
|
|
92
|
+
status: f ? p(f) : void 0,
|
|
93
|
+
search: m || void 0
|
|
93
94
|
},
|
|
94
95
|
pagination: {
|
|
95
|
-
limit:
|
|
96
|
-
offset:
|
|
96
|
+
limit: _,
|
|
97
|
+
offset: v
|
|
97
98
|
}
|
|
98
99
|
});
|
|
99
|
-
|
|
100
|
+
C(e.routesCount), T(v + e.routes.length < e.routesCount), x(e.routes.map(h));
|
|
100
101
|
} catch (e) {
|
|
101
|
-
|
|
102
|
+
k(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load routes"));
|
|
102
103
|
} finally {
|
|
103
|
-
|
|
104
|
+
D(!1);
|
|
104
105
|
}
|
|
105
106
|
}, [
|
|
106
107
|
i,
|
|
107
|
-
|
|
108
|
+
y,
|
|
109
|
+
m,
|
|
108
110
|
f,
|
|
109
111
|
s,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
_,
|
|
113
|
+
v
|
|
112
114
|
]);
|
|
113
115
|
r(() => {
|
|
114
|
-
|
|
115
|
-
}, [
|
|
116
|
-
let
|
|
117
|
-
|
|
118
|
-
}, [
|
|
119
|
-
let n = h((await t(
|
|
116
|
+
A();
|
|
117
|
+
}, [A]);
|
|
118
|
+
let j = n(() => {
|
|
119
|
+
A();
|
|
120
|
+
}, [A]), M = n(async (e) => {
|
|
121
|
+
let n = h((await t(y, c, { input: {
|
|
120
122
|
name: e.name ?? `Route ${(/* @__PURE__ */ new Date()).toLocaleDateString()}`,
|
|
121
123
|
status: p(e.status),
|
|
122
124
|
shipmentId: void 0,
|
|
@@ -129,9 +131,9 @@ function _(e = {}) {
|
|
|
129
131
|
actualDistance: e.distance,
|
|
130
132
|
actualDuration: e.actualDuration
|
|
131
133
|
} })).createRoute);
|
|
132
|
-
return
|
|
133
|
-
}, [
|
|
134
|
-
let r = h((await t(
|
|
134
|
+
return x((e) => [n, ...e]), n;
|
|
135
|
+
}, [y]), N = n(async (e, n) => {
|
|
136
|
+
let r = h((await t(y, l, {
|
|
135
137
|
id: e,
|
|
136
138
|
input: {
|
|
137
139
|
name: n.name,
|
|
@@ -147,40 +149,40 @@ function _(e = {}) {
|
|
|
147
149
|
actualDuration: n.actualDuration
|
|
148
150
|
}
|
|
149
151
|
})).updateRoute);
|
|
150
|
-
return
|
|
151
|
-
}, [
|
|
152
|
-
await t(v, u, { id: e }), b((t) => t.filter((t) => t.id !== e));
|
|
153
|
-
}, [v]), M = n(async (e) => {
|
|
154
|
-
let n = {
|
|
155
|
-
...h((await t(v, d, { id: e })).optimizeRoute),
|
|
156
|
-
optimized: !0
|
|
157
|
-
};
|
|
158
|
-
return b((t) => t.map((t) => t.id === e ? n : t)), n;
|
|
159
|
-
}, [v]), N = n(async (e, t, n) => {
|
|
160
|
-
let r = y.find((t) => t.id === e);
|
|
161
|
-
if (!r) throw Error("Route not found");
|
|
162
|
-
let i = r.stops.map((e) => e.id === t ? {
|
|
163
|
-
...e,
|
|
164
|
-
status: n,
|
|
165
|
-
actualTime: n === "completed" ? /* @__PURE__ */ new Date() : e.actualTime
|
|
166
|
-
} : e);
|
|
167
|
-
return A(e, {
|
|
168
|
-
stops: i,
|
|
169
|
-
status: i.every((e) => e.status === "completed") ? "completed" : r.status
|
|
170
|
-
});
|
|
171
|
-
}, [y, A]);
|
|
152
|
+
return x((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
153
|
+
}, [y]);
|
|
172
154
|
return {
|
|
173
|
-
routes:
|
|
174
|
-
totalRoutes:
|
|
175
|
-
hasMore:
|
|
176
|
-
isLoading:
|
|
177
|
-
error:
|
|
178
|
-
refetch:
|
|
179
|
-
createRoute:
|
|
180
|
-
updateRoute:
|
|
181
|
-
deleteRoute:
|
|
182
|
-
|
|
183
|
-
|
|
155
|
+
routes: b,
|
|
156
|
+
totalRoutes: S,
|
|
157
|
+
hasMore: w,
|
|
158
|
+
isLoading: E,
|
|
159
|
+
error: O,
|
|
160
|
+
refetch: j,
|
|
161
|
+
createRoute: M,
|
|
162
|
+
updateRoute: N,
|
|
163
|
+
deleteRoute: n(async (e) => {
|
|
164
|
+
await t(y, u, { id: e }), x((t) => t.filter((t) => t.id !== e));
|
|
165
|
+
}, [y]),
|
|
166
|
+
optimizeRoute: n(async (e) => {
|
|
167
|
+
let n = {
|
|
168
|
+
...h((await t(y, d, { id: e })).optimizeRoute),
|
|
169
|
+
optimized: !0
|
|
170
|
+
};
|
|
171
|
+
return x((t) => t.map((t) => t.id === e ? n : t)), n;
|
|
172
|
+
}, [y]),
|
|
173
|
+
updateStopStatus: n(async (e, t, n) => {
|
|
174
|
+
let r = b.find((t) => t.id === e);
|
|
175
|
+
if (!r) throw Error("Route not found");
|
|
176
|
+
let i = r.stops.map((e) => e.id === t ? {
|
|
177
|
+
...e,
|
|
178
|
+
status: n,
|
|
179
|
+
actualTime: n === "completed" ? /* @__PURE__ */ new Date() : e.actualTime
|
|
180
|
+
} : e);
|
|
181
|
+
return N(e, {
|
|
182
|
+
stops: i,
|
|
183
|
+
status: i.every((e) => e.status === "completed") ? "completed" : r.status
|
|
184
|
+
});
|
|
185
|
+
}, [b, N])
|
|
184
186
|
};
|
|
185
187
|
}
|
|
186
188
|
function v(e) {
|
|
@@ -208,26 +210,46 @@ function v(e) {
|
|
|
208
210
|
refetch: () => void p()
|
|
209
211
|
};
|
|
210
212
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
213
|
+
var y = "\n query RouteStats {\n routeStats {\n total\n totalDistance\n totalDuration\n completed\n inProgress\n planned\n optimized\n }\n }\n";
|
|
214
|
+
function b() {
|
|
215
|
+
let e = g(), [n, i] = a({
|
|
216
|
+
totalRoutes: 0,
|
|
217
|
+
totalDistance: 0,
|
|
218
|
+
totalDuration: 0,
|
|
219
|
+
avgDistance: 0,
|
|
220
|
+
avgDuration: 0,
|
|
221
|
+
completedRoutes: 0,
|
|
222
|
+
inProgressRoutes: 0,
|
|
223
|
+
plannedRoutes: 0,
|
|
224
|
+
optimizedRoutes: 0
|
|
225
|
+
}), [o, s] = a(!1), [c, l] = a(null);
|
|
226
|
+
return r(() => {
|
|
227
|
+
(async () => {
|
|
228
|
+
s(!0), l(null);
|
|
229
|
+
try {
|
|
230
|
+
let n = (await t(e, y)).routeStats;
|
|
231
|
+
i({
|
|
232
|
+
totalRoutes: n.total,
|
|
233
|
+
totalDistance: n.totalDistance,
|
|
234
|
+
totalDuration: n.totalDuration,
|
|
235
|
+
avgDistance: n.total > 0 ? n.totalDistance / n.total : 0,
|
|
236
|
+
avgDuration: n.total > 0 ? n.totalDuration / n.total : 0,
|
|
237
|
+
completedRoutes: n.completed,
|
|
238
|
+
inProgressRoutes: n.inProgress,
|
|
239
|
+
plannedRoutes: n.planned,
|
|
240
|
+
optimizedRoutes: n.optimized
|
|
241
|
+
});
|
|
242
|
+
} catch (e) {
|
|
243
|
+
l(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load route stats"));
|
|
244
|
+
} finally {
|
|
245
|
+
s(!1);
|
|
246
|
+
}
|
|
247
|
+
})();
|
|
248
|
+
}, [e]), {
|
|
249
|
+
stats: n,
|
|
250
|
+
isLoading: o,
|
|
251
|
+
error: c
|
|
230
252
|
};
|
|
231
253
|
}
|
|
232
254
|
//#endregion
|
|
233
|
-
export { v as useRoute,
|
|
255
|
+
export { h as mapRoute, v as useRoute, b as useRouteStats, _ as useRoutes };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
|
|
2
2
|
import { executeGraphQL as t } from "../utils/graphqlClient.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useCallback as
|
|
3
|
+
import { mapOrder as n, useOrder as r } from "./useOrders.js";
|
|
4
|
+
import { mapDriver as i, mapVehicle as a, useDriver as o, useDrivers as s, useVehicle as c, useVehicles as l } from "./useFleet.js";
|
|
5
|
+
import { useCallback as u, useEffect as d, useMemo as f, useState as p } from "react";
|
|
6
6
|
//#region src/movethewheels/hooks/useTracking.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
7
|
+
var m = "\n query ListShipments($filter: ShipmentFilterInput, $pagination: PaginationInput) {\n shipments(filter: $filter, pagination: $pagination) {\n id\n shipmentNumber\n deliveryJobId\n status\n estimatedDelivery\n }\n }\n", h = "\n query GetDeliveryJobTracking($deliveryJobId: ID!, $pagination: PaginationInput) {\n deliveryJobTracking(deliveryJobId: $deliveryJobId, pagination: $pagination) {\n id\n shipmentId\n eventType\n location\n details\n timestamp\n }\n }\n", g = "\n query GetActiveDeliveries($pagination: PaginationInput) {\n activeDeliveries(pagination: $pagination) {\n id\n shipmentNumber\n deliveryJobId\n status\n estimatedDelivery\n trackingEvents(pagination: { limit: 1, offset: 0 }) {\n id\n shipmentId\n eventType\n location\n details\n timestamp\n }\n deliveryJob {\n id\n deliveryJobNumber\n customerId\n status\n priority\n pickupAddress\n deliveryAddress\n cargoItems\n pricing\n trackingNumber\n specialInstructions\n scheduledDelivery\n vehicleId\n driverId\n createdAt\n updatedAt\n customer {\n name\n email\n phone\n company\n }\n vehicle {\n id\n vehicleNumber\n type\n make\n model\n licensePlate\n ownershipType\n year\n capacity\n status\n currentLocation\n fuelLevel\n mileage\n lastServiceDate\n nextServiceDueDate\n nextServiceDueMileage\n createdAt\n }\n driver {\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 createdAt\n }\n }\n }\n }\n", _ = "\n query GetTrackingAlerts {\n trackingAlerts {\n shipmentId\n shipmentNumber\n alertType\n message\n }\n }\n";
|
|
8
|
+
function v(e, t) {
|
|
9
9
|
let n = {
|
|
10
10
|
latitude: Number(e.location?.latitude ?? 0),
|
|
11
11
|
longitude: Number(e.location?.longitude ?? 0),
|
|
@@ -25,9 +25,9 @@ function _(e, t) {
|
|
|
25
25
|
lastUpdated: new Date(e.timestamp)
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function y() {
|
|
29
29
|
let { apiGatewayUrl: t, authToken: n, workspaceToken: r, workspaceId: i, tenantId: a, currentUser: o } = e();
|
|
30
|
-
return
|
|
30
|
+
return f(() => ({
|
|
31
31
|
apiGatewayUrl: t,
|
|
32
32
|
authToken: n,
|
|
33
33
|
workspaceToken: r,
|
|
@@ -43,17 +43,24 @@ function v() {
|
|
|
43
43
|
o?.id
|
|
44
44
|
]);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
let { entityId: n, entityType: r } = e, i =
|
|
48
|
-
|
|
46
|
+
function b(e = {}) {
|
|
47
|
+
let { entityId: n, entityType: r } = e, i = y(), [a, o] = p([]), [s, c] = p(!1), [l, f] = p(null), h = u(async () => {
|
|
48
|
+
c(!0), f(null);
|
|
49
49
|
try {
|
|
50
|
-
o((await t(i,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
o((await t(i, m, {
|
|
51
|
+
filter: n ? {
|
|
52
|
+
...r === "order" ? { deliveryJobId: n } : {},
|
|
53
|
+
...r === "vehicle" ? { vehicleId: n } : {},
|
|
54
|
+
...r === "driver" ? { driverId: n } : {}
|
|
55
|
+
} : void 0,
|
|
56
|
+
pagination: {
|
|
57
|
+
limit: 50,
|
|
58
|
+
offset: 0
|
|
59
|
+
}
|
|
60
|
+
})).shipments.map((e) => ({
|
|
54
61
|
id: e.id,
|
|
55
|
-
entityId: e.deliveryJobId ?? e.id,
|
|
56
|
-
entityType: "order",
|
|
62
|
+
entityId: n ?? e.deliveryJobId ?? e.id,
|
|
63
|
+
entityType: r ?? "order",
|
|
57
64
|
currentLocation: {
|
|
58
65
|
latitude: 0,
|
|
59
66
|
longitude: 0,
|
|
@@ -65,56 +72,62 @@ function y(e = {}) {
|
|
|
65
72
|
nextCheckpoint: e.shipmentNumber,
|
|
66
73
|
alerts: [],
|
|
67
74
|
lastUpdated: /* @__PURE__ */ new Date()
|
|
68
|
-
}))
|
|
75
|
+
})));
|
|
69
76
|
} catch (e) {
|
|
70
|
-
|
|
77
|
+
f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load tracking data"));
|
|
71
78
|
} finally {
|
|
72
|
-
|
|
79
|
+
c(!1);
|
|
73
80
|
}
|
|
74
81
|
}, [
|
|
75
82
|
n,
|
|
76
83
|
r,
|
|
77
84
|
i
|
|
78
85
|
]);
|
|
79
|
-
return
|
|
86
|
+
return d(() => {
|
|
80
87
|
h();
|
|
81
88
|
}, [h]), {
|
|
82
89
|
tracking: a,
|
|
83
90
|
isLoading: s,
|
|
84
|
-
error:
|
|
91
|
+
error: l,
|
|
85
92
|
refetch: () => void h()
|
|
86
93
|
};
|
|
87
94
|
}
|
|
88
|
-
function
|
|
89
|
-
let
|
|
95
|
+
function x(e) {
|
|
96
|
+
let n = y(), { order: i } = r(e), [a, o] = p(null), [s, c] = p(!1), [l, f] = p(null), m = u(async () => {
|
|
90
97
|
if (!e) {
|
|
91
98
|
o(null);
|
|
92
99
|
return;
|
|
93
100
|
}
|
|
94
|
-
|
|
101
|
+
c(!0), f(null);
|
|
95
102
|
try {
|
|
96
|
-
let
|
|
97
|
-
|
|
103
|
+
let r = (await t(n, h, {
|
|
104
|
+
deliveryJobId: e,
|
|
105
|
+
pagination: {
|
|
106
|
+
limit: 1,
|
|
107
|
+
offset: 0
|
|
108
|
+
}
|
|
109
|
+
})).deliveryJobTracking[0];
|
|
110
|
+
o(r ? v(r, e) : null);
|
|
98
111
|
} catch (e) {
|
|
99
|
-
|
|
112
|
+
f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load order tracking"));
|
|
100
113
|
} finally {
|
|
101
|
-
|
|
114
|
+
c(!1);
|
|
102
115
|
}
|
|
103
|
-
}, [
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
}, [
|
|
116
|
+
}, [n, e]);
|
|
117
|
+
return d(() => {
|
|
118
|
+
m();
|
|
119
|
+
}, [m]), {
|
|
107
120
|
tracking: a,
|
|
108
121
|
order: i,
|
|
109
122
|
isLoading: s,
|
|
110
|
-
error:
|
|
111
|
-
refetch: () => void
|
|
123
|
+
error: l,
|
|
124
|
+
refetch: () => void m()
|
|
112
125
|
};
|
|
113
126
|
}
|
|
114
|
-
function
|
|
115
|
-
let { vehicle: t, isLoading: n, error: r, refetch: i } =
|
|
127
|
+
function S(e) {
|
|
128
|
+
let { vehicle: t, isLoading: n, error: r, refetch: i } = c(e);
|
|
116
129
|
return {
|
|
117
|
-
tracking:
|
|
130
|
+
tracking: f(() => !t || !t.currentLocation ? null : {
|
|
118
131
|
id: `vehicle-track-${t.id}`,
|
|
119
132
|
entityId: t.id,
|
|
120
133
|
entityType: "vehicle",
|
|
@@ -130,10 +143,10 @@ function x(e) {
|
|
|
130
143
|
refetch: i
|
|
131
144
|
};
|
|
132
145
|
}
|
|
133
|
-
function
|
|
134
|
-
let { driver: t, isLoading: n, error: r, refetch:
|
|
146
|
+
function C(e) {
|
|
147
|
+
let { driver: t, isLoading: n, error: r, refetch: i } = o(e);
|
|
135
148
|
return {
|
|
136
|
-
tracking:
|
|
149
|
+
tracking: f(() => !t || !t.currentLocation ? null : {
|
|
137
150
|
id: `driver-track-${t.id}`,
|
|
138
151
|
entityId: t.id,
|
|
139
152
|
entityType: "driver",
|
|
@@ -146,49 +159,48 @@ function S(e) {
|
|
|
146
159
|
driver: t,
|
|
147
160
|
isLoading: n,
|
|
148
161
|
error: r,
|
|
149
|
-
refetch:
|
|
162
|
+
refetch: i
|
|
150
163
|
};
|
|
151
164
|
}
|
|
152
|
-
function
|
|
153
|
-
let e =
|
|
154
|
-
|
|
165
|
+
function w() {
|
|
166
|
+
let e = y(), [r, o] = p([]), [s, c] = p(!1), [l, f] = p(null), m = u(async () => {
|
|
167
|
+
c(!0), f(null);
|
|
155
168
|
try {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
169
|
+
o(((await t(e, g, { pagination: {
|
|
170
|
+
limit: 100,
|
|
171
|
+
offset: 0
|
|
172
|
+
} })).activeDeliveries ?? []).map((e) => {
|
|
173
|
+
let t = e.deliveryJob;
|
|
174
|
+
if (!t) return null;
|
|
175
|
+
let r = e.trackingEvents?.[0];
|
|
176
|
+
return {
|
|
177
|
+
order: n(t),
|
|
178
|
+
driver: t.driver ? i(t.driver) : null,
|
|
179
|
+
vehicle: t.vehicle ? a(t.vehicle) : null,
|
|
180
|
+
tracking: r ? v(r, t.id) : null,
|
|
181
|
+
estimatedArrival: e.estimatedDelivery ? new Date(e.estimatedDelivery) : void 0
|
|
182
|
+
};
|
|
183
|
+
}).filter((e) => e !== null));
|
|
167
184
|
} catch (e) {
|
|
168
|
-
|
|
185
|
+
f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load live tracking"));
|
|
169
186
|
} finally {
|
|
170
|
-
|
|
187
|
+
c(!1);
|
|
171
188
|
}
|
|
172
|
-
}, [
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}, [x]), {
|
|
181
|
-
activeDeliveries: u,
|
|
182
|
-
isLoading: m,
|
|
183
|
-
error: y,
|
|
184
|
-
refetch: () => void x()
|
|
189
|
+
}, [e]);
|
|
190
|
+
return d(() => {
|
|
191
|
+
m();
|
|
192
|
+
}, [m]), {
|
|
193
|
+
activeDeliveries: r,
|
|
194
|
+
isLoading: s,
|
|
195
|
+
error: l,
|
|
196
|
+
refetch: () => void m()
|
|
185
197
|
};
|
|
186
198
|
}
|
|
187
|
-
function
|
|
188
|
-
let e =
|
|
199
|
+
function T() {
|
|
200
|
+
let e = y(), [n, r] = p([]), [i, a] = p(!1), [o, s] = p(null), c = u(async () => {
|
|
189
201
|
a(!0), s(null);
|
|
190
202
|
try {
|
|
191
|
-
r((await t(e,
|
|
203
|
+
r((await t(e, _)).trackingAlerts.map((e) => ({
|
|
192
204
|
id: `${e.shipmentId}-${e.alertType}`,
|
|
193
205
|
type: "delay",
|
|
194
206
|
severity: "medium",
|
|
@@ -202,12 +214,12 @@ function w() {
|
|
|
202
214
|
a(!1);
|
|
203
215
|
}
|
|
204
216
|
}, [e]);
|
|
205
|
-
return
|
|
206
|
-
|
|
207
|
-
}, [
|
|
217
|
+
return d(() => {
|
|
218
|
+
c();
|
|
219
|
+
}, [c]), {
|
|
208
220
|
alerts: n,
|
|
209
|
-
unacknowledgedAlerts:
|
|
210
|
-
acknowledgeAlert:
|
|
221
|
+
unacknowledgedAlerts: f(() => n.filter((e) => !e.acknowledged), [n]),
|
|
222
|
+
acknowledgeAlert: u(async (e) => {
|
|
211
223
|
r((t) => t.map((t) => t.id === e ? {
|
|
212
224
|
...t,
|
|
213
225
|
acknowledged: !0
|
|
@@ -215,17 +227,17 @@ function w() {
|
|
|
215
227
|
}, []),
|
|
216
228
|
isLoading: i,
|
|
217
229
|
error: o,
|
|
218
|
-
refetch: () => void
|
|
230
|
+
refetch: () => void c()
|
|
219
231
|
};
|
|
220
232
|
}
|
|
221
|
-
function
|
|
222
|
-
let { vehicles: n } =
|
|
233
|
+
function E(e, t) {
|
|
234
|
+
let { vehicles: n } = l(), { drivers: r } = s();
|
|
223
235
|
return {
|
|
224
|
-
entitiesInRange:
|
|
236
|
+
entitiesInRange: f(() => {
|
|
225
237
|
let i = [];
|
|
226
238
|
return n.forEach((n) => {
|
|
227
239
|
if (!n.currentLocation) return;
|
|
228
|
-
let r =
|
|
240
|
+
let r = D(e.latitude, e.longitude, n.currentLocation.latitude, n.currentLocation.longitude);
|
|
229
241
|
r <= t && i.push({
|
|
230
242
|
type: "vehicle",
|
|
231
243
|
entity: n,
|
|
@@ -233,7 +245,7 @@ function T(e, t) {
|
|
|
233
245
|
});
|
|
234
246
|
}), r.forEach((n) => {
|
|
235
247
|
if (!n.currentLocation) return;
|
|
236
|
-
let r =
|
|
248
|
+
let r = D(e.latitude, e.longitude, n.currentLocation.latitude, n.currentLocation.longitude);
|
|
237
249
|
r <= t && i.push({
|
|
238
250
|
type: "driver",
|
|
239
251
|
entity: n,
|
|
@@ -251,12 +263,12 @@ function T(e, t) {
|
|
|
251
263
|
error: null
|
|
252
264
|
};
|
|
253
265
|
}
|
|
254
|
-
function
|
|
255
|
-
let i =
|
|
266
|
+
function D(e, t, n, r) {
|
|
267
|
+
let i = O(n - e), a = O(r - t), o = Math.sin(i / 2) * Math.sin(i / 2) + Math.cos(O(e)) * Math.cos(O(n)) * Math.sin(a / 2) * Math.sin(a / 2);
|
|
256
268
|
return 6371 * (2 * Math.atan2(Math.sqrt(o), Math.sqrt(1 - o)));
|
|
257
269
|
}
|
|
258
|
-
function
|
|
270
|
+
function O(e) {
|
|
259
271
|
return Math.PI / 180 * e;
|
|
260
272
|
}
|
|
261
273
|
//#endregion
|
|
262
|
-
export {
|
|
274
|
+
export { C as useDriverTracking, E as useGeofence, w as useLiveTracking, x as useOrderTracking, b as useTracking, T as useTrackingAlerts, S as useVehicleTracking };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useMoveTheWheels as e, useMoveTheWheelsNavigate as t } from "./providers/MoveTheWheelsProvider.js";
|
|
2
2
|
import { useTr as n } from "./shared/hooks/useTr.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { useRoute as r, useRouteStats as i, useRoutes as a } from "./hooks/useRoutes.js";
|
|
4
|
+
import { useOrder as o, useOrderStats as s, useOrders as c } from "./hooks/useOrders.js";
|
|
5
|
+
import { useDriver as l, useDriverStatusCounts as u, useDrivers as d, useFleet as f, useFleetStats as p, useVehicle as m, useVehicleDrivers as h, useVehicles as g } from "./hooks/useFleet.js";
|
|
6
|
+
import { useInventory as _, useInventoryStats as v, useInventoryTransactions as y, useProduct as b, useProductStockLevels as x, useProducts as S, useWarehouse as C, useWarehouses as w } from "./hooks/useInventory.js";
|
|
7
|
+
import { useCustomer as T, useCustomerStats as E, useCustomers as D } from "./hooks/useCustomers.js";
|
|
8
8
|
import { useAnalytics as O, useDashboardMetrics as k, useEmissionsSummary as A, useFinanceMetrics as j, useFleetAnalytics as M, useOrderAnalytics as N, usePerformanceAnalytics as P, useRevenueAnalytics as F } from "./hooks/useAnalytics.js";
|
|
9
9
|
import { useDriverTracking as I, useGeofence as L, useLiveTracking as R, useOrderTracking as z, useTracking as B, useTrackingAlerts as V, useVehicleTracking as H } from "./hooks/useTracking.js";
|
|
10
10
|
import { useReports as U } from "./hooks/useReports.js";
|
|
@@ -38,4 +38,4 @@ import { Notice as At, useNotice as jt } from "./components/Notice.js";
|
|
|
38
38
|
import { DocumentsCard as Mt } from "./components/DocumentsCard.js";
|
|
39
39
|
import { CarbonFootprintPanel as Nt } from "./components/CarbonFootprintPanel.js";
|
|
40
40
|
import "./components/index.js";
|
|
41
|
-
export { te as Avatar, ne as AvatarFallback, re as AvatarImage, ie as Badge, ae as Button, Nt as CarbonFootprintPanel, oe as Card, se as CardContent, ce as CardDescription, le as CardFooter, ue as CardHeader, de as CardTitle, ut as ChartEmpty, dt as ChartTooltip, fe as Checkbox, Ot as DataTable, pe as Dialog, me as DialogContent, he as DialogDescription, ge as DialogFooter, _e as DialogHeader, ve as DialogTitle, ye as DialogTrigger, Mt as DocumentsCard, be as DropdownMenu, xe as DropdownMenuContent, Se as DropdownMenuItem, Ce as DropdownMenuSeparator, we as DropdownMenuTrigger, Qe as EmptyState, $e as ErrorState, kt as FormError, lt as GlassPanel, Te as Input, Ee as Label, et as LoadingState, bt as LogisticsMap, yt as MapCanvas, ot as MetricCard, st as MetricCardSkeleton, ct as MetricGrid, Q as MoveTheWheelsRoot, At as Notice, tt as PageLayout, nt as PageSection, Ct as PaymentStatusBadge, wt as PriorityBadge, De as Progress, xt as RouteMap, Oe as ScrollArea, ke as Select, Ae as SelectContent, je as SelectItem, Me as SelectTrigger, Ne as SelectValue, Pe as Separator, Fe as Skeleton, at as Sparkline, Tt as StatusBadge, mt as StatusDonut, Ie as Switch, Le as Table, Re as TableBody, ze as TableCell, Be as TableHead, Ve as TableHeader, He as TableRow, Ue as Tabs, We as TabsContent, Ge as TabsList, Ke as TabsTrigger, qe as Textarea, Je as Tooltip, Ye as TooltipContent, Xe as TooltipProvider, Ze as TooltipTrigger, St as TrackingMap, ft as TrendChart, Et as TypeBadge, Dt as VehicleTypeBadge, pt as VolumeBar, rt as chartTokens, ht as createCurrentIcon, gt as createPinIcon, _t as createStopIcon, vt as isRealCoord, it as seriesColor, O as useAnalytics, q as useCaptureEpod,
|
|
41
|
+
export { te as Avatar, ne as AvatarFallback, re as AvatarImage, ie as Badge, ae as Button, Nt as CarbonFootprintPanel, oe as Card, se as CardContent, ce as CardDescription, le as CardFooter, ue as CardHeader, de as CardTitle, ut as ChartEmpty, dt as ChartTooltip, fe as Checkbox, Ot as DataTable, pe as Dialog, me as DialogContent, he as DialogDescription, ge as DialogFooter, _e as DialogHeader, ve as DialogTitle, ye as DialogTrigger, Mt as DocumentsCard, be as DropdownMenu, xe as DropdownMenuContent, Se as DropdownMenuItem, Ce as DropdownMenuSeparator, we as DropdownMenuTrigger, Qe as EmptyState, $e as ErrorState, kt as FormError, lt as GlassPanel, Te as Input, Ee as Label, et as LoadingState, bt as LogisticsMap, yt as MapCanvas, ot as MetricCard, st as MetricCardSkeleton, ct as MetricGrid, Q as MoveTheWheelsRoot, At as Notice, tt as PageLayout, nt as PageSection, Ct as PaymentStatusBadge, wt as PriorityBadge, De as Progress, xt as RouteMap, Oe as ScrollArea, ke as Select, Ae as SelectContent, je as SelectItem, Me as SelectTrigger, Ne as SelectValue, Pe as Separator, Fe as Skeleton, at as Sparkline, Tt as StatusBadge, mt as StatusDonut, Ie as Switch, Le as Table, Re as TableBody, ze as TableCell, Be as TableHead, Ve as TableHeader, He as TableRow, Ue as Tabs, We as TabsContent, Ge as TabsList, Ke as TabsTrigger, qe as Textarea, Je as Tooltip, Ye as TooltipContent, Xe as TooltipProvider, Ze as TooltipTrigger, St as TrackingMap, ft as TrendChart, Et as TypeBadge, Dt as VehicleTypeBadge, pt as VolumeBar, rt as chartTokens, ht as createCurrentIcon, gt as createPinIcon, _t as createStopIcon, vt as isRealCoord, it as seriesColor, O as useAnalytics, q as useCaptureEpod, T as useCustomer, E as useCustomerStats, D as useCustomers, k as useDashboardMetrics, l as useDriver, u as useDriverStatusCounts, I as useDriverTracking, d as useDrivers, A as useEmissionsSummary, K as useEntityDocuments, J as useEpod, Y as useEpodPhotoUpload, X as useEpodPhotoUrl, j as useFinanceMetrics, f as useFleet, M as useFleetAnalytics, p as useFleetStats, L as useGeofence, W as useImportExport, _ as useInventory, v as useInventoryStats, y as useInventoryTransactions, R as useLiveTracking, G as useModuleSettings, e as useMoveTheWheels, t as useMoveTheWheelsNavigate, $ as useMoveTheWheelsStore, Z as useMyPendingEpodDeliveryJobs, jt as useNotice, o as useOrder, N as useOrderAnalytics, s as useOrderStats, z as useOrderTracking, c as useOrders, P as usePerformanceAnalytics, b as useProduct, x as useProductStockLevels, S as useProducts, U as useReports, F as useRevenueAnalytics, r as useRoute, i as useRouteStats, a as useRoutes, ee as useSandboxAssistantTransport, n as useTr, B as useTracking, V as useTrackingAlerts, m as useVehicle, h as useVehicleDrivers, H as useVehicleTracking, g as useVehicles, C as useWarehouse, w as useWarehouses };
|
|
@@ -11,7 +11,9 @@ interface CustomerPickerProps {
|
|
|
11
11
|
onRetry: () => void;
|
|
12
12
|
onOpenCustomers?: () => void;
|
|
13
13
|
selectedCustomer?: Customer | null;
|
|
14
|
+
searchQuery?: string;
|
|
15
|
+
onSearchQueryChange?: (query: string) => void;
|
|
14
16
|
disabled?: boolean;
|
|
15
17
|
}
|
|
16
|
-
export declare function CustomerPicker({ customers, value, onValueChange, onCreated, createCustomer, isLoading, error, onRetry, onOpenCustomers, selectedCustomer, disabled, }: CustomerPickerProps): import("react").JSX.Element;
|
|
18
|
+
export declare function CustomerPicker({ customers, value, onValueChange, onCreated, createCustomer, isLoading, error, onRetry, onOpenCustomers, selectedCustomer, searchQuery, onSearchQueryChange, disabled, }: CustomerPickerProps): import("react").JSX.Element;
|
|
17
19
|
export {};
|
|
@@ -25,6 +25,10 @@ interface DataTableProps<T> {
|
|
|
25
25
|
searchable?: boolean;
|
|
26
26
|
searchPlaceholder?: string;
|
|
27
27
|
searchFields?: (keyof T)[];
|
|
28
|
+
/** Controlled search query for server-side filtering. */
|
|
29
|
+
searchQuery?: string;
|
|
30
|
+
/** Called when the search input changes; disables current-page filtering. */
|
|
31
|
+
onSearchQueryChange?: (query: string) => void;
|
|
28
32
|
pagination?: boolean;
|
|
29
33
|
pageSize?: number;
|
|
30
34
|
pageSizeOptions?: number[];
|
|
@@ -63,5 +67,5 @@ interface DataTableProps<T> {
|
|
|
63
67
|
* DataTable - A reusable data table component with sorting, search, and both
|
|
64
68
|
* client-side and controlled (server-side) pagination.
|
|
65
69
|
*/
|
|
66
|
-
export declare function DataTable<T extends object>({ columns, data, isLoading, error, onRetry, searchable, searchPlaceholder, searchFields, pagination, pageSize: pageSizeProp, pageSizeOptions, onRowClick, rowClassName, emptyMessage, emptyIllustration, emptyTitle, emptyDescription, emptyAction, className, getRowId, pageIndex, onPageChange, onPageSizeChange, totalItems, hasNextPage, }: DataTableProps<T>): import("react").JSX.Element;
|
|
70
|
+
export declare function DataTable<T extends object>({ columns, data, isLoading, error, onRetry, searchable, searchPlaceholder, searchFields, searchQuery: controlledSearchQuery, onSearchQueryChange, pagination, pageSize: pageSizeProp, pageSizeOptions, onRowClick, rowClassName, emptyMessage, emptyIllustration, emptyTitle, emptyDescription, emptyAction, className, getRowId, pageIndex, onPageChange, onPageSizeChange, totalItems, hasNextPage, }: DataTableProps<T>): import("react").JSX.Element;
|
|
67
71
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useDebouncedValue<T>(value: T, delay?: number): T;
|
|
@@ -39,9 +39,11 @@ export interface EntityDocument {
|
|
|
39
39
|
}
|
|
40
40
|
interface UseEntityDocumentsResult {
|
|
41
41
|
documents: EntityDocument[];
|
|
42
|
+
hasMore: boolean;
|
|
42
43
|
isLoading: boolean;
|
|
43
44
|
error: Error | null;
|
|
44
45
|
refetch: () => void;
|
|
46
|
+
loadMore: () => void;
|
|
45
47
|
}
|
|
46
48
|
export declare function useEntityDocuments(entityType: EntityDocumentType, entityId: string | undefined): UseEntityDocumentsResult;
|
|
47
49
|
export {};
|
|
@@ -18,8 +18,13 @@ export interface PendingEpodDeliveryJob {
|
|
|
18
18
|
customerPhone?: string;
|
|
19
19
|
}
|
|
20
20
|
/** Type C self-list: the CALLING driver's own jobs still awaiting ePOD capture — feeds the capture flow's job picker. */
|
|
21
|
-
export declare function useMyPendingEpodDeliveryJobs(
|
|
21
|
+
export declare function useMyPendingEpodDeliveryJobs(options?: {
|
|
22
|
+
limit?: number;
|
|
23
|
+
offset?: number;
|
|
24
|
+
}): {
|
|
22
25
|
jobs: PendingEpodDeliveryJob[];
|
|
26
|
+
totalJobs: number;
|
|
27
|
+
hasMore: boolean;
|
|
23
28
|
isLoading: boolean;
|
|
24
29
|
error: Error | null;
|
|
25
30
|
refetch: () => Promise<void>;
|