@burdenoff/microfe-movethewheels 2026.805.1 → 2026.827.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 +108 -0
- package/dist/components/index.js +1 -0
- package/dist/generated/wspace-operations.d.ts +168 -912
- package/dist/generated/wspace-types.d.ts +78432 -35831
- package/dist/hooks/useAnalytics.js +45 -4
- package/dist/hooks/useFleet.js +142 -74
- package/dist/hooks/useInventory.js +163 -70
- package/dist/hooks/useOrders.js +2 -2
- package/dist/hooks/useTracking.js +5 -5
- package/dist/index.js +33 -32
- package/dist/movethewheels/components/CarbonFootprintPanel.d.ts +7 -0
- package/dist/movethewheels/components/index.d.ts +1 -0
- package/dist/movethewheels/hooks/index.d.ts +3 -3
- package/dist/movethewheels/hooks/useAnalytics.d.ts +22 -0
- package/dist/movethewheels/hooks/useFleet.d.ts +32 -1
- package/dist/movethewheels/hooks/useInventory.d.ts +67 -12
- package/dist/movethewheels/hooks/useOrders.d.ts +25 -2
- package/dist/movethewheels/types/index.d.ts +2 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-down-right.js +11 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-left-right.js +22 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-up-right.js +11 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/calendar-clock.js +32 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/history.js +18 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/leaf.js +11 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/lock.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/user-round.js +13 -0
- package/dist/pages/AnalyticsPage.js +81 -79
- package/dist/pages/CreateOrderPage.js +246 -195
- package/dist/pages/DeliveryCapturePage.js +91 -78
- package/dist/pages/DriversPage.js +202 -108
- package/dist/pages/InventoryPage.js +356 -131
- package/dist/pages/ProductDetailsPage.js +212 -156
- package/dist/pages/VehicleDetailsPage.js +257 -193
- package/dist/utils/formatters.js +4 -1
- package/package.json +1 -1
- package/src/generated/wspace-operations.ts +134 -929
- package/src/generated/wspace-types.ts +91730 -40059
- package/src/movethewheels/components/CarbonFootprintPanel.tsx +133 -0
- package/src/movethewheels/components/UpcomingDemandPanel.tsx +20 -11
- package/src/movethewheels/components/index.ts +3 -0
- package/src/movethewheels/hooks/index.ts +11 -0
- package/src/movethewheels/hooks/useAnalytics.ts +86 -0
- package/src/movethewheels/hooks/useDemandForecast.ts +10 -4
- package/src/movethewheels/hooks/useFleet.ts +133 -3
- package/src/movethewheels/hooks/useInventory.ts +311 -53
- package/src/movethewheels/hooks/useOrders.ts +31 -7
- package/src/movethewheels/hooks/useTracking.ts +14 -14
- package/src/movethewheels/pages/AnalyticsPage.tsx +5 -5
- package/src/movethewheels/pages/CreateOrderPage.tsx +67 -10
- package/src/movethewheels/pages/DeliveryCapturePage.tsx +8 -0
- package/src/movethewheels/pages/DriversPage.tsx +181 -31
- package/src/movethewheels/pages/InventoryPage.tsx +299 -19
- package/src/movethewheels/pages/ProductDetailsPage.tsx +68 -3
- package/src/movethewheels/pages/VehicleDetailsPage.tsx +86 -27
- package/src/movethewheels/types/index.ts +2 -0
- package/src/operations/wspace/movethewheels/fragments/core.graphql +23 -53
- package/src/operations/wspace/movethewheels/fragments/core.withdrawn.graphql +59 -0
- package/src/operations/wspace/movethewheels/mutations/entities.graphql +5 -5
- package/src/operations/wspace/movethewheels/mutations/marketplace-reports.graphql +18 -78
- package/src/operations/wspace/movethewheels/mutations/marketplace-reports.withdrawn.graphql +93 -0
- package/src/operations/wspace/movethewheels/mutations/orders.graphql +7 -7
- package/src/operations/wspace/movethewheels/queries/dashboard.graphql +3 -3
- package/src/operations/wspace/movethewheels/queries/entities.graphql +3 -3
- package/src/operations/wspace/movethewheels/queries/logistics.graphql +3 -3
- package/src/operations/wspace/movethewheels/queries/marketplace-reports.withdrawn.graphql +58 -0
- package/src/operations/wspace/movethewheels/queries/orders.graphql +3 -3
- package/src/operations/wspace/movethewheels/queries/marketplace-reports.graphql +0 -40
|
@@ -2,8 +2,8 @@ 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/useInventory.ts
|
|
5
|
-
var o = "\n query ListInventoryItems($filter: InventoryFilterInput, $pagination: PaginationInput) {\n inventoryItems(filter: $filter, pagination: $pagination) {\n id\n
|
|
6
|
-
function
|
|
5
|
+
var o = "\n query ListInventoryItems($filter: InventoryFilterInput, $pagination: PaginationInput) {\n inventoryItems(filter: $filter, pagination: $pagination) {\n id\n cargoItemId\n warehouseId\n onHand\n available\n allocated\n damaged\n reorderPoint\n createdAt\n updatedAt\n }\n }\n", s = "\n query ListCargoItems($filter: CargoItemFilterInput, $pagination: PaginationInput) {\n cargoItems(filter: $filter, pagination: $pagination) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n }\n", c = "\n query ListWarehouses($filter: WarehouseFilterInput, $pagination: PaginationInput) {\n warehouses(filter: $filter, pagination: $pagination) {\n id\n name\n code\n type\n address\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", l = "\n query GetCargoItem($id: ID!) {\n cargoItem(id: $id) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n }\n", u = "\n query GetWarehouse($id: ID!) {\n warehouse(id: $id) {\n id\n name\n code\n type\n address\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", d = "\n query GetInventoryStats {\n inventoryStats {\n totalOnHand\n totalAvailable\n totalAllocated\n totalDamaged\n lowStockCount\n }\n cargoItemsCount\n warehousesCount\n }\n", f = "\n query ListInventoryTransactions($filter: InventoryFilterInput, $pagination: PaginationInput) {\n inventoryTransactions(filter: $filter, pagination: $pagination) {\n id\n transactionNumber\n type\n quantity\n cargoItemId\n warehouseId\n notes\n referenceType\n referenceId\n createdAt\n }\n }\n", p = "\n mutation CreateCargoItem($input: CreateCargoItemInput!) {\n createCargoItem(input: $input) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n }\n", m = "\n mutation UpdateCargoItem($id: ID!, $input: UpdateCargoItemInput!) {\n updateCargoItem(id: $id, input: $input) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n }\n", h = "\n mutation CreateWarehouse($input: CreateWarehouseInput!) {\n createWarehouse(input: $input) {\n id\n name\n code\n type\n address\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", g = "\n mutation UpdateWarehouse($id: ID!, $input: UpdateWarehouseInput!) {\n updateWarehouse(id: $id, input: $input) {\n id\n name\n code\n type\n address\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", _ = "\n mutation AdjustInventoryStock($input: AdjustInventoryStockInput!) {\n adjustInventoryStock(input: $input) {\n id\n cargoItemId\n warehouseId\n onHand\n available\n allocated\n damaged\n reorderPoint\n createdAt\n updatedAt\n }\n }\n";
|
|
6
|
+
function v(e) {
|
|
7
7
|
return {
|
|
8
8
|
id: e.id,
|
|
9
9
|
sku: e.sku,
|
|
@@ -30,7 +30,7 @@ function _(e) {
|
|
|
30
30
|
updatedAt: new Date(e.updatedAt)
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function y(e) {
|
|
34
34
|
let t = e.totalCapacity ?? 0, n = e.usedCapacity ?? 0;
|
|
35
35
|
return {
|
|
36
36
|
id: e.id,
|
|
@@ -70,10 +70,10 @@ function v(e) {
|
|
|
70
70
|
createdAt: new Date(e.createdAt)
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function b(e) {
|
|
74
74
|
return {
|
|
75
75
|
id: e.id,
|
|
76
|
-
productId: e.
|
|
76
|
+
productId: e.cargoItemId,
|
|
77
77
|
warehouseId: e.warehouseId,
|
|
78
78
|
zoneId: "",
|
|
79
79
|
quantity: e.onHand,
|
|
@@ -93,7 +93,7 @@ function y(e) {
|
|
|
93
93
|
updatedAt: new Date(e.updatedAt)
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function x() {
|
|
97
97
|
let { apiGatewayUrl: t, authToken: n, workspaceToken: r, workspaceId: a, tenantId: o, currentUser: s } = e();
|
|
98
98
|
return i(() => ({
|
|
99
99
|
apiGatewayUrl: t,
|
|
@@ -111,19 +111,19 @@ function b() {
|
|
|
111
111
|
s?.id
|
|
112
112
|
]);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function S(e = {}) {
|
|
115
115
|
let { filters: l } = e, u = i(() => l, [
|
|
116
116
|
l?.lowStock,
|
|
117
117
|
l?.productId,
|
|
118
118
|
l?.warehouseId
|
|
119
|
-
]), d =
|
|
119
|
+
]), d = x(), [f, S] = a([]), [C, w] = a([]), [T, E] = a([]), [D, O] = a(!1), [k, A] = a(null), j = n(async () => {
|
|
120
120
|
O(!0), A(null);
|
|
121
121
|
try {
|
|
122
122
|
let [e, n, r] = await Promise.all([
|
|
123
123
|
t(d, o, {
|
|
124
124
|
filter: {
|
|
125
125
|
warehouseId: u?.warehouseId,
|
|
126
|
-
|
|
126
|
+
cargoItemId: u?.productId
|
|
127
127
|
},
|
|
128
128
|
pagination: {
|
|
129
129
|
limit: 500,
|
|
@@ -138,8 +138,8 @@ function x(e = {}) {
|
|
|
138
138
|
limit: 500,
|
|
139
139
|
offset: 0
|
|
140
140
|
} })
|
|
141
|
-
]), i = e.inventoryItems.map(
|
|
142
|
-
u?.lowStock && (i = i.filter((e) => e.availableQuantity <= e.reorderLevel)), S(i), w(n.
|
|
141
|
+
]), i = e.inventoryItems.map(b);
|
|
142
|
+
u?.lowStock && (i = i.filter((e) => e.availableQuantity <= e.reorderLevel)), S(i), w(n.cargoItems.map(v)), E(r.warehouses.map(y));
|
|
143
143
|
} catch (e) {
|
|
144
144
|
A(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load inventory data"));
|
|
145
145
|
} finally {
|
|
@@ -152,9 +152,9 @@ function x(e = {}) {
|
|
|
152
152
|
let M = n(() => {
|
|
153
153
|
j();
|
|
154
154
|
}, [j]), N = n(async (e, n, r) => {
|
|
155
|
-
let i =
|
|
155
|
+
let i = f.find((t) => t.id === e);
|
|
156
156
|
if (!i) throw Error("Inventory item not found");
|
|
157
|
-
let a =
|
|
157
|
+
let a = b((await t(d, _, { input: {
|
|
158
158
|
id: e,
|
|
159
159
|
onHand: i.quantity + n,
|
|
160
160
|
available: i.availableQuantity + n,
|
|
@@ -162,23 +162,23 @@ function x(e = {}) {
|
|
|
162
162
|
damaged: 0
|
|
163
163
|
} })).adjustInventoryStock);
|
|
164
164
|
return S((t) => t.map((t) => t.id === e ? a : t)), a;
|
|
165
|
-
}, [d,
|
|
166
|
-
let i =
|
|
165
|
+
}, [d, f]), P = n(async (e, t, n, r) => {
|
|
166
|
+
let i = f.find((t) => t.warehouseId === e && t.productId === n);
|
|
167
167
|
if (!i) throw Error("Source inventory not found");
|
|
168
168
|
await N(i.id, -Math.abs(r), "transfer out");
|
|
169
|
-
let a =
|
|
169
|
+
let a = f.find((e) => e.warehouseId === t && e.productId === n);
|
|
170
170
|
a && await N(a.id, Math.abs(r), "transfer in");
|
|
171
|
-
}, [
|
|
172
|
-
let n =
|
|
171
|
+
}, [f, N]), F = n(async (e) => {
|
|
172
|
+
let n = v((await t(d, p, { input: {
|
|
173
173
|
name: e.name,
|
|
174
174
|
sku: e.sku,
|
|
175
175
|
category: e.category,
|
|
176
176
|
brand: e.brand,
|
|
177
177
|
weight: e.weight
|
|
178
|
-
} })).
|
|
178
|
+
} })).createCargoItem);
|
|
179
179
|
return w((e) => [n, ...e]), n;
|
|
180
180
|
}, [d]), I = n(async (e) => {
|
|
181
|
-
let n =
|
|
181
|
+
let n = y((await t(d, h, { input: {
|
|
182
182
|
code: e.code,
|
|
183
183
|
name: e.name,
|
|
184
184
|
type: e.type,
|
|
@@ -187,7 +187,7 @@ function x(e = {}) {
|
|
|
187
187
|
} })).createWarehouse);
|
|
188
188
|
return E((e) => [n, ...e]), n;
|
|
189
189
|
}, [d]), L = n(async (e, n) => {
|
|
190
|
-
let r =
|
|
190
|
+
let r = v((await t(d, m, {
|
|
191
191
|
id: e,
|
|
192
192
|
input: {
|
|
193
193
|
name: n.name,
|
|
@@ -196,10 +196,10 @@ function x(e = {}) {
|
|
|
196
196
|
brand: n.brand,
|
|
197
197
|
weight: n.weight
|
|
198
198
|
}
|
|
199
|
-
})).
|
|
199
|
+
})).updateCargoItem);
|
|
200
200
|
return w((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
201
201
|
}, [d]), R = n(async (e, n) => {
|
|
202
|
-
let r =
|
|
202
|
+
let r = y((await t(d, g, {
|
|
203
203
|
id: e,
|
|
204
204
|
input: {
|
|
205
205
|
code: n.code,
|
|
@@ -212,10 +212,10 @@ function x(e = {}) {
|
|
|
212
212
|
return E((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
213
213
|
}, [d]);
|
|
214
214
|
return {
|
|
215
|
-
inventory:
|
|
215
|
+
inventory: f,
|
|
216
216
|
products: C,
|
|
217
217
|
warehouses: T,
|
|
218
|
-
totalItems:
|
|
218
|
+
totalItems: f.length,
|
|
219
219
|
isLoading: D,
|
|
220
220
|
error: k,
|
|
221
221
|
refetch: M,
|
|
@@ -227,15 +227,15 @@ function x(e = {}) {
|
|
|
227
227
|
updateWarehouse: R
|
|
228
228
|
};
|
|
229
229
|
}
|
|
230
|
-
function
|
|
231
|
-
let { limit: i = 500, offset: o = 0 } = e, c =
|
|
230
|
+
function C(e = {}) {
|
|
231
|
+
let { limit: i = 500, offset: o = 0 } = e, c = x(), [l, u] = a([]), [d, f] = a(!1), [p, m] = a(!1), [h, g] = a(null), _ = n(async () => {
|
|
232
232
|
m(!0), g(null);
|
|
233
233
|
try {
|
|
234
234
|
let e = await t(c, s, { pagination: {
|
|
235
235
|
limit: i,
|
|
236
236
|
offset: o
|
|
237
237
|
} });
|
|
238
|
-
f(e.
|
|
238
|
+
f(e.cargoItems.length === i), u(e.cargoItems.map(v));
|
|
239
239
|
} catch (e) {
|
|
240
240
|
g(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load products"));
|
|
241
241
|
} finally {
|
|
@@ -247,18 +247,18 @@ function S(e = {}) {
|
|
|
247
247
|
o
|
|
248
248
|
]);
|
|
249
249
|
return r(() => {
|
|
250
|
-
|
|
251
|
-
}, [
|
|
250
|
+
_();
|
|
251
|
+
}, [_]), {
|
|
252
252
|
products: l,
|
|
253
253
|
totalProducts: l.length,
|
|
254
254
|
hasMore: d,
|
|
255
255
|
isLoading: p,
|
|
256
256
|
error: h,
|
|
257
|
-
refetch: () => void
|
|
257
|
+
refetch: () => void _()
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
|
-
function
|
|
261
|
-
let { products: t, isLoading: n, error: r } =
|
|
260
|
+
function w(e = 500) {
|
|
261
|
+
let { products: t, isLoading: n, error: r } = C({
|
|
262
262
|
limit: e,
|
|
263
263
|
offset: 0
|
|
264
264
|
});
|
|
@@ -272,8 +272,8 @@ function C(e = 500) {
|
|
|
272
272
|
error: r
|
|
273
273
|
};
|
|
274
274
|
}
|
|
275
|
-
function
|
|
276
|
-
let i =
|
|
275
|
+
function T(e) {
|
|
276
|
+
let i = x(), [o, s] = a(null), [c, u] = a(!1), [d, f] = a(null), p = n(async () => {
|
|
277
277
|
if (!e) {
|
|
278
278
|
s(null);
|
|
279
279
|
return;
|
|
@@ -281,7 +281,7 @@ function w(e) {
|
|
|
281
281
|
u(!0), f(null);
|
|
282
282
|
try {
|
|
283
283
|
let n = await t(i, l, { id: e });
|
|
284
|
-
s(n.
|
|
284
|
+
s(n.cargoItem ? v(n.cargoItem) : null);
|
|
285
285
|
} catch (e) {
|
|
286
286
|
f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load product"));
|
|
287
287
|
} finally {
|
|
@@ -297,15 +297,15 @@ function w(e) {
|
|
|
297
297
|
refetch: () => void p()
|
|
298
298
|
};
|
|
299
299
|
}
|
|
300
|
-
function
|
|
301
|
-
let { limit: i = 500, offset: o = 0 } = e, s =
|
|
300
|
+
function E(e = {}) {
|
|
301
|
+
let { limit: i = 500, offset: o = 0 } = e, s = x(), [l, u] = a([]), [d, f] = a(!1), [p, m] = a(!1), [h, g] = a(null), _ = n(async () => {
|
|
302
302
|
m(!0), g(null);
|
|
303
303
|
try {
|
|
304
304
|
let e = await t(s, c, { pagination: {
|
|
305
305
|
limit: i,
|
|
306
306
|
offset: o
|
|
307
307
|
} });
|
|
308
|
-
f(e.warehouses.length === i), u(e.warehouses.map(
|
|
308
|
+
f(e.warehouses.length === i), u(e.warehouses.map(y));
|
|
309
309
|
} catch (e) {
|
|
310
310
|
g(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load warehouses"));
|
|
311
311
|
} finally {
|
|
@@ -327,8 +327,8 @@ function T(e = {}) {
|
|
|
327
327
|
refetch: () => void _()
|
|
328
328
|
};
|
|
329
329
|
}
|
|
330
|
-
function
|
|
331
|
-
let { warehouses: t, isLoading: n, error: r } =
|
|
330
|
+
function D(e = 500) {
|
|
331
|
+
let { warehouses: t, isLoading: n, error: r } = E({
|
|
332
332
|
limit: e,
|
|
333
333
|
offset: 0
|
|
334
334
|
});
|
|
@@ -345,8 +345,8 @@ function E(e = 500) {
|
|
|
345
345
|
error: r
|
|
346
346
|
};
|
|
347
347
|
}
|
|
348
|
-
function
|
|
349
|
-
let i =
|
|
348
|
+
function O(e) {
|
|
349
|
+
let i = x(), [o, s] = a(null), [c, l] = a(!1), [d, f] = a(null), p = n(async () => {
|
|
350
350
|
if (!e) {
|
|
351
351
|
s(null);
|
|
352
352
|
return;
|
|
@@ -354,7 +354,7 @@ function D(e) {
|
|
|
354
354
|
l(!0), f(null);
|
|
355
355
|
try {
|
|
356
356
|
let n = await t(i, u, { id: e });
|
|
357
|
-
s(n.warehouse ?
|
|
357
|
+
s(n.warehouse ? y(n.warehouse) : null);
|
|
358
358
|
} catch (e) {
|
|
359
359
|
f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load warehouse"));
|
|
360
360
|
} finally {
|
|
@@ -370,37 +370,32 @@ function D(e) {
|
|
|
370
370
|
refetch: () => void p()
|
|
371
371
|
};
|
|
372
372
|
}
|
|
373
|
-
function
|
|
374
|
-
let e =
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
373
|
+
function k() {
|
|
374
|
+
let e = x(), [n, i] = a({
|
|
375
|
+
totalOnHand: 0,
|
|
376
|
+
totalAvailable: 0,
|
|
377
|
+
totalAllocated: 0,
|
|
378
|
+
totalDamaged: 0,
|
|
379
|
+
lowStockCount: 0,
|
|
378
380
|
totalProducts: 0,
|
|
379
|
-
totalWarehouses: 0
|
|
380
|
-
|
|
381
|
-
}), [o, s] = a(!1), [l, u] = a(null);
|
|
381
|
+
totalWarehouses: 0
|
|
382
|
+
}), [o, s] = a(!1), [c, l] = a(null);
|
|
382
383
|
return r(() => {
|
|
383
384
|
(async () => {
|
|
384
|
-
s(!0),
|
|
385
|
+
s(!0), l(null);
|
|
385
386
|
try {
|
|
386
|
-
let
|
|
387
|
-
limit: 500,
|
|
388
|
-
offset: 0
|
|
389
|
-
} })]);
|
|
387
|
+
let n = await t(e, d);
|
|
390
388
|
i({
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
name: e.name,
|
|
399
|
-
utilization: (e.totalCapacity ?? 0) > 0 ? (e.usedCapacity ?? 0) / (e.totalCapacity ?? 1) * 100 : 0
|
|
400
|
-
}))
|
|
389
|
+
totalOnHand: n.inventoryStats.totalOnHand,
|
|
390
|
+
totalAvailable: n.inventoryStats.totalAvailable,
|
|
391
|
+
totalAllocated: n.inventoryStats.totalAllocated,
|
|
392
|
+
totalDamaged: n.inventoryStats.totalDamaged,
|
|
393
|
+
lowStockCount: n.inventoryStats.lowStockCount,
|
|
394
|
+
totalProducts: n.cargoItemsCount,
|
|
395
|
+
totalWarehouses: n.warehousesCount
|
|
401
396
|
});
|
|
402
397
|
} catch (e) {
|
|
403
|
-
|
|
398
|
+
l(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load inventory stats"));
|
|
404
399
|
} finally {
|
|
405
400
|
s(!1);
|
|
406
401
|
}
|
|
@@ -408,8 +403,106 @@ function O() {
|
|
|
408
403
|
}, [e]), {
|
|
409
404
|
stats: n,
|
|
410
405
|
isLoading: o,
|
|
411
|
-
error:
|
|
406
|
+
error: c
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
var A = "\n query GetCargoItemStockLevels($cargoItemId: ID!) {\n inventoryItems(filter: { cargoItemId: $cargoItemId }, pagination: { limit: 200, offset: 0 }) {\n id\n onHand\n available\n allocated\n damaged\n reorderPoint\n warehouse {\n id\n name\n code\n }\n }\n }\n";
|
|
410
|
+
function j(e) {
|
|
411
|
+
let i = x(), [o, s] = a([]), [c, l] = a(!1), [u, d] = a(null), f = n(async () => {
|
|
412
|
+
if (!e) {
|
|
413
|
+
s([]);
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
l(!0), d(null);
|
|
417
|
+
try {
|
|
418
|
+
s((await t(i, A, { cargoItemId: e })).inventoryItems.map((e) => ({
|
|
419
|
+
inventoryItemId: e.id,
|
|
420
|
+
warehouseId: e.warehouse?.id ?? "",
|
|
421
|
+
warehouseName: e.warehouse?.name ?? "Unknown warehouse",
|
|
422
|
+
warehouseCode: e.warehouse?.code ?? "",
|
|
423
|
+
onHand: e.onHand,
|
|
424
|
+
available: e.available,
|
|
425
|
+
allocated: e.allocated,
|
|
426
|
+
damaged: e.damaged,
|
|
427
|
+
reorderPoint: e.reorderPoint ?? void 0
|
|
428
|
+
})));
|
|
429
|
+
} catch (e) {
|
|
430
|
+
d(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load stock levels"));
|
|
431
|
+
} finally {
|
|
432
|
+
l(!1);
|
|
433
|
+
}
|
|
434
|
+
}, [i, e]);
|
|
435
|
+
return r(() => {
|
|
436
|
+
f();
|
|
437
|
+
}, [f]), {
|
|
438
|
+
levels: o,
|
|
439
|
+
isLoading: c,
|
|
440
|
+
error: u,
|
|
441
|
+
refetch: n(() => {
|
|
442
|
+
f();
|
|
443
|
+
}, [f])
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
var M = [
|
|
447
|
+
"RECEIPT",
|
|
448
|
+
"ISSUE",
|
|
449
|
+
"TRANSFER",
|
|
450
|
+
"ADJUSTMENT",
|
|
451
|
+
"RETURN"
|
|
452
|
+
];
|
|
453
|
+
function N(e) {
|
|
454
|
+
let t = e.toUpperCase();
|
|
455
|
+
return M.find((e) => e === t) ?? "ADJUSTMENT";
|
|
456
|
+
}
|
|
457
|
+
function P(e) {
|
|
458
|
+
return {
|
|
459
|
+
id: e.id,
|
|
460
|
+
transactionNumber: e.transactionNumber,
|
|
461
|
+
type: N(e.type),
|
|
462
|
+
quantity: e.quantity,
|
|
463
|
+
productId: e.cargoItemId,
|
|
464
|
+
warehouseId: e.warehouseId,
|
|
465
|
+
notes: e.notes ?? void 0,
|
|
466
|
+
referenceType: e.referenceType ?? void 0,
|
|
467
|
+
referenceId: e.referenceId ?? void 0,
|
|
468
|
+
createdAt: new Date(e.createdAt)
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
function F(e = {}) {
|
|
472
|
+
let { limit: i = 10, productId: o, warehouseId: s } = e, c = x(), [l, u] = a([]), [d, p] = a(!1), [m, h] = a(null), g = n(async () => {
|
|
473
|
+
p(!0), h(null);
|
|
474
|
+
try {
|
|
475
|
+
u((await t(c, f, {
|
|
476
|
+
filter: o || s ? {
|
|
477
|
+
cargoItemId: o,
|
|
478
|
+
warehouseId: s
|
|
479
|
+
} : void 0,
|
|
480
|
+
pagination: {
|
|
481
|
+
limit: i,
|
|
482
|
+
offset: 0
|
|
483
|
+
}
|
|
484
|
+
})).inventoryTransactions.map(P));
|
|
485
|
+
} catch (e) {
|
|
486
|
+
h(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load inventory transactions"));
|
|
487
|
+
} finally {
|
|
488
|
+
p(!1);
|
|
489
|
+
}
|
|
490
|
+
}, [
|
|
491
|
+
c,
|
|
492
|
+
i,
|
|
493
|
+
o,
|
|
494
|
+
s
|
|
495
|
+
]);
|
|
496
|
+
return r(() => {
|
|
497
|
+
g();
|
|
498
|
+
}, [g]), {
|
|
499
|
+
transactions: l,
|
|
500
|
+
isLoading: d,
|
|
501
|
+
error: m,
|
|
502
|
+
refetch: n(() => {
|
|
503
|
+
g();
|
|
504
|
+
}, [g])
|
|
412
505
|
};
|
|
413
506
|
}
|
|
414
507
|
//#endregion
|
|
415
|
-
export {
|
|
508
|
+
export { S as useInventory, k as useInventoryStats, F as useInventoryTransactions, T as useProduct, w as useProductStats, j as useProductStockLevels, C as useProducts, O as useWarehouse, D as useWarehouseStats, E as useWarehouses };
|
package/dist/hooks/useOrders.js
CHANGED
|
@@ -216,7 +216,7 @@ function b(o = {}) {
|
|
|
216
216
|
pricing: n.pricing,
|
|
217
217
|
specialInstructions: n.specialInstructions,
|
|
218
218
|
trackingNumber: n.trackingNumber,
|
|
219
|
-
scheduledDelivery: n.scheduledDelivery?.toISOString(),
|
|
219
|
+
scheduledDelivery: n.scheduledDelivery === null ? null : n.scheduledDelivery?.toISOString(),
|
|
220
220
|
vehicleId: n.vehicleId,
|
|
221
221
|
driverId: n.driverId
|
|
222
222
|
}
|
|
@@ -352,4 +352,4 @@ function S() {
|
|
|
352
352
|
};
|
|
353
353
|
}
|
|
354
354
|
//#endregion
|
|
355
|
-
export { x as useOrder, S as useOrderStats, b as useOrders };
|
|
355
|
+
export { h as mapOrderPriority, m as mapOrderStatus, x as useOrder, S as useOrderStats, b as useOrders };
|
|
@@ -4,7 +4,7 @@ import { useOrder as n, useOrders as r } from "./useOrders.js";
|
|
|
4
4
|
import { useDriver as i, useDrivers as a, useVehicle as o, useVehicles as s } from "./useFleet.js";
|
|
5
5
|
import { useCallback as c, useEffect as l, useMemo as u, useState as d } from "react";
|
|
6
6
|
//#region src/movethewheels/hooks/useTracking.ts
|
|
7
|
-
var f = "\n query ListShipments($filter: ShipmentFilterInput, $pagination: PaginationInput) {\n shipments(filter: $filter, pagination: $pagination) {\n id\n shipmentNumber\n
|
|
7
|
+
var f = "\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", p = "\n query GetShipment($id: ID!) {\n shipment(id: $id) {\n id\n shipmentNumber\n deliveryJobId\n status\n estimatedDelivery\n trackingEvents {\n id\n shipmentId\n eventType\n location\n details\n timestamp\n }\n }\n }\n", m = "\n query GetDeliveryJobTracking($deliveryJobId: ID!) {\n deliveryJobTracking(deliveryJobId: $deliveryJobId) {\n id\n shipmentId\n eventType\n location\n details\n timestamp\n }\n }\n", h = "\n query GetActiveDeliveries {\n activeDeliveries {\n id\n shipmentNumber\n deliveryJobId\n status\n estimatedDelivery\n }\n }\n", g = "\n query GetTrackingAlerts {\n trackingAlerts {\n shipmentId\n shipmentNumber\n alertType\n message\n }\n }\n";
|
|
8
8
|
function _(e, t) {
|
|
9
9
|
let n = {
|
|
10
10
|
latitude: Number(e.location?.latitude ?? 0),
|
|
@@ -52,7 +52,7 @@ function y(e = {}) {
|
|
|
52
52
|
offset: 0
|
|
53
53
|
} })).shipments.map((e) => ({
|
|
54
54
|
id: e.id,
|
|
55
|
-
entityId: e.
|
|
55
|
+
entityId: e.deliveryJobId ?? e.id,
|
|
56
56
|
entityType: "order",
|
|
57
57
|
currentLocation: {
|
|
58
58
|
latitude: 0,
|
|
@@ -93,7 +93,7 @@ function b(e) {
|
|
|
93
93
|
}
|
|
94
94
|
u(!0), p(null);
|
|
95
95
|
try {
|
|
96
|
-
let n = await t(r, m, {
|
|
96
|
+
let n = await t(r, m, { deliveryJobId: e }), i = n.deliveryJobTracking[n.deliveryJobTracking.length - 1];
|
|
97
97
|
o(i ? _(i, e) : null);
|
|
98
98
|
} catch (e) {
|
|
99
99
|
p(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load order tracking"));
|
|
@@ -155,12 +155,12 @@ function C() {
|
|
|
155
155
|
try {
|
|
156
156
|
let r = await t(e, h);
|
|
157
157
|
f((await Promise.all(r.activeDeliveries.map(async (r) => {
|
|
158
|
-
let a = (await t(e, p, { id: r.id })).shipment?.trackingEvents ?? [], s = a[a.length - 1], c = n.find((e) => e.id === r.
|
|
158
|
+
let a = (await t(e, p, { id: r.id })).shipment?.trackingEvents ?? [], s = a[a.length - 1], c = n.find((e) => e.id === r.deliveryJobId);
|
|
159
159
|
return c ? {
|
|
160
160
|
order: c,
|
|
161
161
|
driver: c.driverId ? o.find((e) => e.id === c.driverId || e.userId === c.driverId) ?? null : null,
|
|
162
162
|
vehicle: c.vehicleId ? i.find((e) => e.id === c.vehicleId) ?? null : null,
|
|
163
|
-
tracking: s ? _(s, r.
|
|
163
|
+
tracking: s ? _(s, r.deliveryJobId ?? r.id) : null,
|
|
164
164
|
estimatedArrival: r.estimatedDelivery ? new Date(r.estimatedDelivery) : void 0
|
|
165
165
|
} : null;
|
|
166
166
|
}))).filter((e) => e !== null));
|
package/dist/index.js
CHANGED
|
@@ -3,37 +3,38 @@ import { MoveTheWheelsRoot as n } from "./MoveTheWheelsRoot.js";
|
|
|
3
3
|
import { useMoveTheWheelsStore as r } from "./store/movethewheelsStore.js";
|
|
4
4
|
import { useSandboxAssistantTransport as i } from "./services/createSandboxAssistantTransport.js";
|
|
5
5
|
import { useOrder as a, useOrderStats as o, useOrders as s } from "./hooks/useOrders.js";
|
|
6
|
-
import { useDriver as c,
|
|
7
|
-
import { useInventory as
|
|
8
|
-
import { useCustomer as
|
|
9
|
-
import { useRoute as
|
|
10
|
-
import { useAnalytics as
|
|
11
|
-
import { useDriverTracking as
|
|
12
|
-
import { useReports as
|
|
13
|
-
import { useImportExport as
|
|
14
|
-
import { useModuleSettings as
|
|
15
|
-
import { useEntityDocuments as
|
|
16
|
-
import { useCaptureEpod as
|
|
6
|
+
import { useDriver as c, useDriverStatusCounts as l, useDrivers as u, useFleet as d, useFleetStats as f, useVehicle as p, useVehicleDrivers as m, useVehicles as h } from "./hooks/useFleet.js";
|
|
7
|
+
import { useInventory as g, useInventoryStats as _, useInventoryTransactions as v, useProduct as y, useProductStockLevels as b, useProducts as x, useWarehouse as S, useWarehouses as C } from "./hooks/useInventory.js";
|
|
8
|
+
import { useCustomer as w, useCustomerStats as T, useCustomers as E } from "./hooks/useCustomers.js";
|
|
9
|
+
import { useRoute as D, useRouteStats as O, useRoutes as k } from "./hooks/useRoutes.js";
|
|
10
|
+
import { useAnalytics as A, useDashboardMetrics as j, useEmissionsSummary as M, useFinanceMetrics as N, useFleetAnalytics as P, useOrderAnalytics as F, usePerformanceAnalytics as I, useRevenueAnalytics as L } from "./hooks/useAnalytics.js";
|
|
11
|
+
import { useDriverTracking as R, useGeofence as z, useLiveTracking as B, useOrderTracking as V, useTracking as H, useTrackingAlerts as U, useVehicleTracking as W } from "./hooks/useTracking.js";
|
|
12
|
+
import { useReports as G } from "./hooks/useReports.js";
|
|
13
|
+
import { useImportExport as K } from "./hooks/useImportExport.js";
|
|
14
|
+
import { useModuleSettings as q } from "./hooks/useSettings.js";
|
|
15
|
+
import { useEntityDocuments as J } from "./hooks/useEntityDocuments.js";
|
|
16
|
+
import { useCaptureEpod as Y, useEpod as X, useEpodPhotoUpload as Z, useEpodPhotoUrl as Q, useMyPendingEpodDeliveryJobs as $ } from "./hooks/useEpod.js";
|
|
17
17
|
import "./hooks/index.js";
|
|
18
|
-
import { Avatar as
|
|
19
|
-
import { EmptyState as
|
|
20
|
-
import { chartTokens as
|
|
21
|
-
import { Sparkline as
|
|
22
|
-
import { MetricCard as
|
|
23
|
-
import { GlassPanel as
|
|
24
|
-
import { ChartEmpty as
|
|
25
|
-
import { TrendChart as
|
|
26
|
-
import { VolumeBar as
|
|
27
|
-
import { StatusDonut as
|
|
28
|
-
import { createCurrentIcon as
|
|
29
|
-
import { MapCanvas as
|
|
30
|
-
import { LogisticsMap as
|
|
31
|
-
import { RouteMap as
|
|
32
|
-
import { TrackingMap as
|
|
33
|
-
import { PaymentStatusBadge as
|
|
34
|
-
import { DataTable as
|
|
35
|
-
import { FormError as
|
|
36
|
-
import { Notice as
|
|
37
|
-
import { DocumentsCard as
|
|
18
|
+
import { Avatar as ee, AvatarFallback as te, AvatarImage as ne, Badge as re, Button as ie, Card as ae, CardContent as oe, CardDescription as se, CardFooter as ce, CardHeader as le, CardTitle as ue, Checkbox as de, Dialog as fe, DialogContent as pe, DialogDescription as me, DialogFooter as he, DialogHeader as ge, DialogTitle as _e, DialogTrigger as ve, DropdownMenu as ye, DropdownMenuContent as be, DropdownMenuItem as xe, DropdownMenuSeparator as Se, DropdownMenuTrigger as Ce, Input as we, Label as Te, Progress as Ee, ScrollArea as De, Select as Oe, SelectContent as ke, SelectItem as Ae, SelectTrigger as je, SelectValue as Me, Separator as Ne, Skeleton as Pe, Switch as Fe, Table as Ie, TableBody as Le, TableCell as Re, TableHead as ze, TableHeader as Be, TableRow as Ve, Tabs as He, TabsContent as Ue, TabsList as We, TabsTrigger as Ge, Textarea as Ke, Tooltip as qe, TooltipContent as Je, TooltipProvider as Ye, TooltipTrigger as Xe } from "./components/ui.js";
|
|
19
|
+
import { EmptyState as Ze, ErrorState as Qe, LoadingState as $e, PageLayout as et, PageSection as tt } from "./components/PageLayout.js";
|
|
20
|
+
import { chartTokens as nt, seriesColor as rt } from "./components/charts/chartTokens.js";
|
|
21
|
+
import { Sparkline as it } from "./components/charts/Sparkline.js";
|
|
22
|
+
import { MetricCard as at, MetricCardSkeleton as ot, MetricGrid as st } from "./components/MetricCard.js";
|
|
23
|
+
import { GlassPanel as ct } from "./components/GlassPanel.js";
|
|
24
|
+
import { ChartEmpty as lt, ChartTooltip as ut } from "./components/charts/ChartShell.js";
|
|
25
|
+
import { TrendChart as dt } from "./components/charts/TrendChart.js";
|
|
26
|
+
import { VolumeBar as ft } from "./components/charts/VolumeBar.js";
|
|
27
|
+
import { StatusDonut as pt } from "./components/charts/StatusDonut.js";
|
|
28
|
+
import { createCurrentIcon as mt, createPinIcon as ht, createStopIcon as gt, isRealCoord as _t } from "./components/maps/leaflet-setup.js";
|
|
29
|
+
import { MapCanvas as vt } from "./components/maps/MapCanvas.js";
|
|
30
|
+
import { LogisticsMap as yt } from "./components/maps/LogisticsMap.js";
|
|
31
|
+
import { RouteMap as bt } from "./components/maps/RouteMap.js";
|
|
32
|
+
import { TrackingMap as xt } from "./components/maps/TrackingMap.js";
|
|
33
|
+
import { PaymentStatusBadge as St, PriorityBadge as Ct, StatusBadge as wt, TypeBadge as Tt, VehicleTypeBadge as Et } from "./components/StatusBadge.js";
|
|
34
|
+
import { DataTable as Dt } from "./components/DataTable.js";
|
|
35
|
+
import { FormError as Ot } from "./components/FormError.js";
|
|
36
|
+
import { Notice as kt, useNotice as At } from "./components/Notice.js";
|
|
37
|
+
import { DocumentsCard as jt } from "./components/DocumentsCard.js";
|
|
38
|
+
import { CarbonFootprintPanel as Mt } from "./components/CarbonFootprintPanel.js";
|
|
38
39
|
import "./components/index.js";
|
|
39
|
-
export {
|
|
40
|
+
export { ee as Avatar, te as AvatarFallback, ne as AvatarImage, re as Badge, ie as Button, Mt as CarbonFootprintPanel, ae as Card, oe as CardContent, se as CardDescription, ce as CardFooter, le as CardHeader, ue as CardTitle, lt as ChartEmpty, ut as ChartTooltip, de as Checkbox, Dt as DataTable, fe as Dialog, pe as DialogContent, me as DialogDescription, he as DialogFooter, ge as DialogHeader, _e as DialogTitle, ve as DialogTrigger, jt as DocumentsCard, ye as DropdownMenu, be as DropdownMenuContent, xe as DropdownMenuItem, Se as DropdownMenuSeparator, Ce as DropdownMenuTrigger, Ze as EmptyState, Qe as ErrorState, Ot as FormError, ct as GlassPanel, we as Input, Te as Label, $e as LoadingState, yt as LogisticsMap, vt as MapCanvas, at as MetricCard, ot as MetricCardSkeleton, st as MetricGrid, n as MoveTheWheelsRoot, kt as Notice, et as PageLayout, tt as PageSection, St as PaymentStatusBadge, Ct as PriorityBadge, Ee as Progress, bt as RouteMap, De as ScrollArea, Oe as Select, ke as SelectContent, Ae as SelectItem, je as SelectTrigger, Me as SelectValue, Ne as Separator, Pe as Skeleton, it as Sparkline, wt as StatusBadge, pt as StatusDonut, Fe as Switch, Ie as Table, Le as TableBody, Re as TableCell, ze as TableHead, Be as TableHeader, Ve as TableRow, He as Tabs, Ue as TabsContent, We as TabsList, Ge as TabsTrigger, Ke as Textarea, qe as Tooltip, Je as TooltipContent, Ye as TooltipProvider, Xe as TooltipTrigger, xt as TrackingMap, dt as TrendChart, Tt as TypeBadge, Et as VehicleTypeBadge, ft as VolumeBar, nt as chartTokens, mt as createCurrentIcon, ht as createPinIcon, gt as createStopIcon, _t as isRealCoord, rt as seriesColor, A as useAnalytics, Y as useCaptureEpod, w as useCustomer, T as useCustomerStats, E as useCustomers, j as useDashboardMetrics, c as useDriver, l as useDriverStatusCounts, R as useDriverTracking, u as useDrivers, M as useEmissionsSummary, J as useEntityDocuments, X as useEpod, Z as useEpodPhotoUpload, Q as useEpodPhotoUrl, N as useFinanceMetrics, d as useFleet, P as useFleetAnalytics, f as useFleetStats, z as useGeofence, K as useImportExport, g as useInventory, _ as useInventoryStats, v as useInventoryTransactions, B as useLiveTracking, q as useModuleSettings, e as useMoveTheWheels, t as useMoveTheWheelsNavigate, r as useMoveTheWheelsStore, $ as useMyPendingEpodDeliveryJobs, At as useNotice, a as useOrder, F as useOrderAnalytics, o as useOrderStats, V as useOrderTracking, s as useOrders, I as usePerformanceAnalytics, y as useProduct, b as useProductStockLevels, x as useProducts, G as useReports, L as useRevenueAnalytics, D as useRoute, O as useRouteStats, k as useRoutes, i as useSandboxAssistantTransport, H as useTracking, U as useTrackingAlerts, p as useVehicle, m as useVehicleDrivers, W as useVehicleTracking, h as useVehicles, S as useWarehouse, C as useWarehouses };
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* All custom hooks for data access and operations.
|
|
5
5
|
*/
|
|
6
6
|
export { useOrders, useOrder, useOrderStats } from './useOrders';
|
|
7
|
-
export { useFleet, useVehicles, useVehicle, useDrivers, useDriver, useFleetStats, } from './useFleet';
|
|
8
|
-
export { useInventory, useProducts, useProduct, useWarehouses, useWarehouse, useInventoryStats, } from './useInventory';
|
|
7
|
+
export { useFleet, useVehicles, useVehicle, useVehicleDrivers, useDrivers, useDriver, useDriverStatusCounts, useFleetStats, type DriverStatusCounts, } from './useFleet';
|
|
8
|
+
export { useInventory, useProducts, useProduct, useProductStockLevels, useWarehouses, useWarehouse, useInventoryStats, useInventoryTransactions, type InventoryStats, type InventoryTransaction, type InventoryTransactionType, type ProductStockLevel, } from './useInventory';
|
|
9
9
|
export { useCustomers, useCustomer, useCustomerStats } from './useCustomers';
|
|
10
10
|
export { useRoutes, useRoute, useRouteStats } from './useRoutes';
|
|
11
|
-
export { useAnalytics, useDashboardMetrics, useRevenueAnalytics, useOrderAnalytics, useFleetAnalytics, usePerformanceAnalytics, useFinanceMetrics, type FinanceMetrics, } from './useAnalytics';
|
|
11
|
+
export { useAnalytics, useDashboardMetrics, useRevenueAnalytics, useOrderAnalytics, useFleetAnalytics, usePerformanceAnalytics, useFinanceMetrics, type FinanceMetrics, useEmissionsSummary, type EmissionsSummary, } from './useAnalytics';
|
|
12
12
|
export { useTracking, useOrderTracking, useVehicleTracking, useDriverTracking, useLiveTracking, useTrackingAlerts, useGeofence, } from './useTracking';
|
|
13
13
|
export { useReports } from './useReports';
|
|
14
14
|
export { useImportExport } from './useImportExport';
|