@burdenoff/microfe-movethewheels 2026.925.2 → 2026.925.3
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/StatusBadge.js +30 -30
- package/dist/constants/index.js +12 -5
- package/dist/hooks/useCustomers.js +0 -3
- package/dist/hooks/useFleet.js +144 -131
- package/dist/hooks/useInventory.js +144 -145
- package/dist/hooks/useRoutes.js +5 -14
- package/dist/movethewheels/constants/index.d.ts +1 -0
- package/dist/movethewheels/hooks/useFleet.d.ts +13 -1
- package/dist/movethewheels/hooks/useInventory.d.ts +10 -0
- package/dist/movethewheels/types/index.d.ts +13 -70
- package/dist/pages/CustomerDetailsPage.js +666 -344
- package/dist/pages/CustomersPage.js +71 -80
- package/dist/pages/FleetPage.js +1 -3
- package/dist/pages/InventoryPage.js +4 -4
- package/dist/pages/RouteDetailsPage.js +273 -248
- package/dist/pages/RoutesPage.js +130 -67
- package/dist/pages/VehicleDetailsPage.js +506 -391
- package/dist/pages/VehiclesPage.js +119 -70
- package/dist/pages/WarehouseDetailsPage.js +410 -370
- package/dist/pages/WarehousesPage.js +131 -82
- package/package.json +1 -1
- package/src/movethewheels/components/StatusBadge.tsx +8 -3
- package/src/movethewheels/constants/index.ts +9 -0
- package/src/movethewheels/hooks/useCustomers.ts +0 -3
- package/src/movethewheels/hooks/useFleet.ts +74 -19
- package/src/movethewheels/hooks/useInventory.ts +76 -32
- package/src/movethewheels/hooks/useRoutes.ts +17 -12
- package/src/movethewheels/pages/CustomerDetailsPage.tsx +376 -109
- package/src/movethewheels/pages/CustomersPage.tsx +6 -15
- package/src/movethewheels/pages/FleetPage.tsx +2 -1
- package/src/movethewheels/pages/InventoryPage.tsx +14 -5
- package/src/movethewheels/pages/RouteDetailsPage.tsx +74 -34
- package/src/movethewheels/pages/RoutesPage.tsx +66 -2
- package/src/movethewheels/pages/VehicleDetailsPage.tsx +151 -11
- package/src/movethewheels/pages/VehiclesPage.tsx +68 -3
- package/src/movethewheels/pages/WarehouseDetailsPage.tsx +213 -135
- package/src/movethewheels/pages/WarehousesPage.tsx +77 -16
- package/src/movethewheels/types/index.ts +14 -70
|
@@ -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 cargoItemId\n warehouseId\n onHand\n available\n allocated\n damaged\n reorderPoint\n createdAt\n updatedAt\n cargoItem {\n id\n name\n sku\n }\n warehouse {\n id\n name\n code\n }\n }\n inventoryItemsCount(filter: $filter)\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 cargoItemsCount(filter: $filter)\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 warehousesCount(filter: $filter)\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",
|
|
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 cargoItem {\n id\n name\n sku\n }\n warehouse {\n id\n name\n code\n }\n }\n inventoryItemsCount(filter: $filter)\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 cargoItemsCount(filter: $filter)\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 status\n contactInfo\n operatingHours\n totalCapacity\n usedCapacity\n createdAt\n }\n warehousesCount(filter: $filter)\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 status\n contactInfo\n operatingHours\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 status\n contactInfo\n operatingHours\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", g = "\n mutation DeleteWarehouse($id: ID!) {\n deleteWarehouse(id: $id)\n }\n", _ = "\n mutation UpdateWarehouse($id: ID!, $input: UpdateWarehouseInput!) {\n updateWarehouse(id: $id, input: $input) {\n id\n name\n code\n type\n address\n status\n contactInfo\n operatingHours\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", v = "\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 y(e) {
|
|
7
7
|
return {
|
|
8
8
|
id: e.id,
|
|
9
9
|
sku: e.sku,
|
|
@@ -30,8 +30,13 @@ function v(e) {
|
|
|
30
30
|
updatedAt: new Date(e.updatedAt)
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
let t = e.totalCapacity ?? 0, n = e.usedCapacity ?? 0;
|
|
33
|
+
function b(e) {
|
|
34
|
+
let t = e.totalCapacity ?? 0, n = e.usedCapacity ?? 0, r = e.operatingHours ?? {}, i = {};
|
|
35
|
+
for (let [e, t] of Object.entries(r)) t && typeof t == "object" && "open" in t && "close" in t ? i[e] = {
|
|
36
|
+
open: String(t.open),
|
|
37
|
+
close: String(t.close)
|
|
38
|
+
} : i[e] = null;
|
|
39
|
+
let a = e.contactInfo ?? void 0;
|
|
35
40
|
return {
|
|
36
41
|
id: e.id,
|
|
37
42
|
name: e.name,
|
|
@@ -45,32 +50,21 @@ function y(e) {
|
|
|
45
50
|
...e.address ?? {}
|
|
46
51
|
},
|
|
47
52
|
type: e.type?.toLowerCase() ?? "distribution",
|
|
53
|
+
status: e.status ?? "ACTIVE",
|
|
48
54
|
capacity: {
|
|
49
55
|
totalSpace: t,
|
|
50
|
-
usedSpace: n
|
|
51
|
-
totalPallets: 0,
|
|
52
|
-
usedPallets: 0,
|
|
53
|
-
specialAreas: []
|
|
56
|
+
usedSpace: n
|
|
54
57
|
},
|
|
55
|
-
operatingHours:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
throughput: 0,
|
|
62
|
-
accuracy: 0,
|
|
63
|
-
productivity: 0,
|
|
64
|
-
utilization: t > 0 ? n / t * 100 : 0,
|
|
65
|
-
ordersFulfilled: 0,
|
|
66
|
-
averageProcessingTime: 0,
|
|
67
|
-
lastUpdated: /* @__PURE__ */ new Date()
|
|
68
|
-
},
|
|
69
|
-
isActive: !0,
|
|
58
|
+
operatingHours: i,
|
|
59
|
+
contactInfo: a ? {
|
|
60
|
+
email: a.email ?? void 0,
|
|
61
|
+
phone: a.phone ?? void 0
|
|
62
|
+
} : void 0,
|
|
63
|
+
utilization: t > 0 ? n / t * 100 : 0,
|
|
70
64
|
createdAt: new Date(e.createdAt)
|
|
71
65
|
};
|
|
72
66
|
}
|
|
73
|
-
function
|
|
67
|
+
function x(e) {
|
|
74
68
|
return {
|
|
75
69
|
id: e.id,
|
|
76
70
|
productId: e.cargoItemId,
|
|
@@ -78,25 +72,17 @@ function b(e) {
|
|
|
78
72
|
productSku: e.cargoItem?.sku,
|
|
79
73
|
warehouseId: e.warehouseId,
|
|
80
74
|
warehouseName: e.warehouse?.name,
|
|
81
|
-
zoneId: "",
|
|
82
75
|
quantity: e.onHand,
|
|
83
76
|
reservedQuantity: e.allocated,
|
|
84
77
|
availableQuantity: e.available,
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
damagedQuantity: e.damaged,
|
|
79
|
+
reorderLevel: e.reorderPoint ?? void 0,
|
|
87
80
|
lastRestocked: new Date(e.updatedAt),
|
|
88
|
-
location: {
|
|
89
|
-
aisle: "",
|
|
90
|
-
shelf: "",
|
|
91
|
-
position: "",
|
|
92
|
-
level: 0
|
|
93
|
-
},
|
|
94
|
-
movements: [],
|
|
95
81
|
createdAt: new Date(e.createdAt),
|
|
96
82
|
updatedAt: new Date(e.updatedAt)
|
|
97
83
|
};
|
|
98
84
|
}
|
|
99
|
-
function
|
|
85
|
+
function S() {
|
|
100
86
|
let { apiGatewayUrl: t, authToken: n, workspaceToken: r, workspaceId: a, tenantId: o, currentUser: s } = e();
|
|
101
87
|
return i(() => ({
|
|
102
88
|
apiGatewayUrl: t,
|
|
@@ -114,32 +100,32 @@ function x() {
|
|
|
114
100
|
s?.id
|
|
115
101
|
]);
|
|
116
102
|
}
|
|
117
|
-
function
|
|
118
|
-
let { filters: l, search: u, limit: d = 10, offset: f = 0 } = e,
|
|
103
|
+
function C(e = {}) {
|
|
104
|
+
let { filters: l, search: u, limit: d = 10, offset: f = 0 } = e, C = i(() => l, [
|
|
119
105
|
l?.lowStock,
|
|
120
106
|
l?.productId,
|
|
121
107
|
l?.search,
|
|
122
108
|
l?.warehouseId
|
|
123
|
-
]),
|
|
124
|
-
|
|
109
|
+
]), w = S(), [T, E] = a([]), [D, O] = a([]), [k, A] = a([]), [j, M] = a([]), [N, P] = a(0), [F, I] = a(!1), [L, R] = a(!1), [z, B] = a(null), V = n(async () => {
|
|
110
|
+
R(!0), B(null);
|
|
125
111
|
try {
|
|
126
112
|
let e = {
|
|
127
|
-
warehouseId:
|
|
128
|
-
cargoItemId:
|
|
129
|
-
search: u ||
|
|
130
|
-
lowStock:
|
|
113
|
+
warehouseId: C?.warehouseId,
|
|
114
|
+
cargoItemId: C?.productId,
|
|
115
|
+
search: u || C?.search || void 0,
|
|
116
|
+
lowStock: C?.lowStock || void 0
|
|
131
117
|
}, [n, r, i, a] = await Promise.all([
|
|
132
|
-
t(
|
|
118
|
+
t(w, o, {
|
|
133
119
|
filter: e,
|
|
134
120
|
pagination: {
|
|
135
121
|
limit: d,
|
|
136
122
|
offset: f
|
|
137
123
|
}
|
|
138
124
|
}),
|
|
139
|
-
t(
|
|
125
|
+
t(w, o, {
|
|
140
126
|
filter: {
|
|
141
|
-
warehouseId:
|
|
142
|
-
cargoItemId:
|
|
127
|
+
warehouseId: C?.warehouseId,
|
|
128
|
+
cargoItemId: C?.productId,
|
|
143
129
|
lowStock: !0
|
|
144
130
|
},
|
|
145
131
|
pagination: {
|
|
@@ -147,85 +133,88 @@ function S(e = {}) {
|
|
|
147
133
|
offset: 0
|
|
148
134
|
}
|
|
149
135
|
}),
|
|
150
|
-
t(
|
|
136
|
+
t(w, s, { pagination: {
|
|
151
137
|
limit: 5,
|
|
152
138
|
offset: 0
|
|
153
139
|
} }),
|
|
154
|
-
t(
|
|
140
|
+
t(w, c, { pagination: {
|
|
155
141
|
limit: 5,
|
|
156
142
|
offset: 0
|
|
157
143
|
} })
|
|
158
144
|
]);
|
|
159
|
-
|
|
145
|
+
E(n.inventoryItems.map(x)), O(r.inventoryItems.map(x)), P(n.inventoryItemsCount), I(f + n.inventoryItems.length < n.inventoryItemsCount), A(i.cargoItems.map(y)), M(a.warehouses.map(b));
|
|
160
146
|
} catch (e) {
|
|
161
|
-
|
|
147
|
+
B(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load inventory data"));
|
|
162
148
|
} finally {
|
|
163
|
-
|
|
149
|
+
R(!1);
|
|
164
150
|
}
|
|
165
151
|
}, [
|
|
166
|
-
S,
|
|
167
152
|
C,
|
|
153
|
+
w,
|
|
168
154
|
d,
|
|
169
155
|
f,
|
|
170
156
|
u
|
|
171
157
|
]);
|
|
172
158
|
r(() => {
|
|
173
|
-
|
|
174
|
-
}, [
|
|
175
|
-
let
|
|
176
|
-
|
|
177
|
-
}, [
|
|
178
|
-
let i =
|
|
159
|
+
V();
|
|
160
|
+
}, [V]);
|
|
161
|
+
let H = n(() => {
|
|
162
|
+
V();
|
|
163
|
+
}, [V]), U = n(async (e, n, r) => {
|
|
164
|
+
let i = T.find((t) => t.id === e);
|
|
179
165
|
if (!i) throw Error("Inventory item not found");
|
|
180
|
-
let a =
|
|
166
|
+
let a = x((await t(w, v, { input: {
|
|
181
167
|
id: e,
|
|
182
168
|
onHand: i.quantity + n,
|
|
183
169
|
available: i.availableQuantity + n,
|
|
184
170
|
allocated: i.reservedQuantity,
|
|
185
|
-
damaged:
|
|
171
|
+
damaged: i.damagedQuantity
|
|
186
172
|
} })).adjustInventoryStock);
|
|
187
|
-
return
|
|
188
|
-
}, [
|
|
173
|
+
return E((t) => t.map((t) => t.id === e ? a : t)), a;
|
|
174
|
+
}, [w, T]);
|
|
189
175
|
return {
|
|
190
|
-
inventory:
|
|
191
|
-
lowStockItems:
|
|
192
|
-
products:
|
|
193
|
-
warehouses:
|
|
194
|
-
totalItems:
|
|
195
|
-
hasMore:
|
|
196
|
-
isLoading:
|
|
197
|
-
error:
|
|
198
|
-
refetch:
|
|
199
|
-
updateStock:
|
|
176
|
+
inventory: T,
|
|
177
|
+
lowStockItems: D,
|
|
178
|
+
products: k,
|
|
179
|
+
warehouses: j,
|
|
180
|
+
totalItems: N,
|
|
181
|
+
hasMore: F,
|
|
182
|
+
isLoading: L,
|
|
183
|
+
error: z,
|
|
184
|
+
refetch: H,
|
|
185
|
+
updateStock: U,
|
|
200
186
|
transferStock: n(async (e, t, n, r) => {
|
|
201
|
-
let i =
|
|
187
|
+
let i = T.find((t) => t.warehouseId === e && t.productId === n);
|
|
202
188
|
if (!i) throw Error("Source inventory not found");
|
|
203
|
-
await
|
|
204
|
-
let a =
|
|
205
|
-
a && await
|
|
206
|
-
}, [
|
|
189
|
+
await U(i.id, -Math.abs(r), "transfer out");
|
|
190
|
+
let a = T.find((e) => e.warehouseId === t && e.productId === n);
|
|
191
|
+
a && await U(a.id, Math.abs(r), "transfer in");
|
|
192
|
+
}, [T, U]),
|
|
207
193
|
createProduct: n(async (e) => {
|
|
208
|
-
let n =
|
|
194
|
+
let n = y((await t(w, p, { input: {
|
|
209
195
|
name: e.name,
|
|
210
196
|
sku: e.sku,
|
|
211
197
|
category: e.category,
|
|
212
198
|
brand: e.brand,
|
|
213
199
|
weight: e.weight
|
|
214
200
|
} })).createCargoItem);
|
|
215
|
-
return
|
|
216
|
-
}, [
|
|
201
|
+
return A((e) => [n, ...e]), n;
|
|
202
|
+
}, [w]),
|
|
217
203
|
createWarehouse: n(async (e) => {
|
|
218
|
-
let n =
|
|
204
|
+
let n = b((await t(w, h, { input: {
|
|
219
205
|
code: e.code,
|
|
220
206
|
name: e.name,
|
|
221
207
|
type: e.type,
|
|
222
208
|
address: e.address,
|
|
223
|
-
|
|
209
|
+
status: e.status,
|
|
210
|
+
contactInfo: e.contactInfo,
|
|
211
|
+
totalCapacity: e.totalCapacity,
|
|
212
|
+
usedCapacity: e.usedCapacity
|
|
224
213
|
} })).createWarehouse);
|
|
225
|
-
return
|
|
226
|
-
}, [
|
|
214
|
+
return M((e) => [n, ...e]), n;
|
|
215
|
+
}, [w]),
|
|
227
216
|
updateProduct: n(async (e, n) => {
|
|
228
|
-
let r =
|
|
217
|
+
let r = y((await t(w, m, {
|
|
229
218
|
id: e,
|
|
230
219
|
input: {
|
|
231
220
|
name: n.name,
|
|
@@ -235,26 +224,32 @@ function S(e = {}) {
|
|
|
235
224
|
weight: n.weight
|
|
236
225
|
}
|
|
237
226
|
})).updateCargoItem);
|
|
238
|
-
return
|
|
239
|
-
}, [
|
|
227
|
+
return A((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
228
|
+
}, [w]),
|
|
240
229
|
updateWarehouse: n(async (e, n) => {
|
|
241
|
-
let r =
|
|
230
|
+
let r = b((await t(w, _, {
|
|
242
231
|
id: e,
|
|
243
232
|
input: {
|
|
244
233
|
code: n.code,
|
|
245
234
|
name: n.name,
|
|
246
235
|
type: n.type,
|
|
247
236
|
address: n.address,
|
|
248
|
-
|
|
237
|
+
status: n.status,
|
|
238
|
+
contactInfo: n.contactInfo,
|
|
239
|
+
totalCapacity: n.totalCapacity,
|
|
240
|
+
usedCapacity: n.usedCapacity
|
|
249
241
|
}
|
|
250
242
|
})).updateWarehouse);
|
|
251
|
-
return
|
|
252
|
-
}, [
|
|
243
|
+
return M((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
244
|
+
}, [w]),
|
|
245
|
+
deleteWarehouse: n(async (e) => {
|
|
246
|
+
await t(w, g, { id: e }), M((t) => t.filter((t) => t.id !== e));
|
|
247
|
+
}, [w])
|
|
253
248
|
};
|
|
254
249
|
}
|
|
255
|
-
function
|
|
256
|
-
let { limit: i = 20, offset: o = 0, search: c, category: l } = e, u =
|
|
257
|
-
|
|
250
|
+
function w(e = {}) {
|
|
251
|
+
let { limit: i = 20, offset: o = 0, search: c, category: l } = e, u = S(), [d, f] = a([]), [p, m] = a(0), [h, g] = a(!1), [_, v] = a(!1), [b, x] = a(null), C = n(async () => {
|
|
252
|
+
v(!0), x(null);
|
|
258
253
|
try {
|
|
259
254
|
let e = await t(u, s, {
|
|
260
255
|
filter: {
|
|
@@ -266,11 +261,11 @@ function C(e = {}) {
|
|
|
266
261
|
offset: o
|
|
267
262
|
}
|
|
268
263
|
});
|
|
269
|
-
g(o + e.cargoItems.length < e.cargoItemsCount), m(e.cargoItemsCount), f(e.cargoItems.map(
|
|
264
|
+
g(o + e.cargoItems.length < e.cargoItemsCount), m(e.cargoItemsCount), f(e.cargoItems.map(y));
|
|
270
265
|
} catch (e) {
|
|
271
|
-
|
|
266
|
+
x(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load products"));
|
|
272
267
|
} finally {
|
|
273
|
-
|
|
268
|
+
v(!1);
|
|
274
269
|
}
|
|
275
270
|
}, [
|
|
276
271
|
u,
|
|
@@ -290,9 +285,9 @@ function C(e = {}) {
|
|
|
290
285
|
refetch: () => void C()
|
|
291
286
|
};
|
|
292
287
|
}
|
|
293
|
-
var
|
|
294
|
-
function
|
|
295
|
-
let e =
|
|
288
|
+
var T = "\n query CargoItemStats {\n cargoItemStats {\n total\n specialHandling\n temperatureControlled\n }\n }\n";
|
|
289
|
+
function E() {
|
|
290
|
+
let e = S(), [n, i] = a({
|
|
296
291
|
total: 0,
|
|
297
292
|
specialHandling: 0,
|
|
298
293
|
temperatureControlled: 0
|
|
@@ -301,7 +296,7 @@ function T() {
|
|
|
301
296
|
(async () => {
|
|
302
297
|
s(!0), l(null);
|
|
303
298
|
try {
|
|
304
|
-
i((await t(e,
|
|
299
|
+
i((await t(e, T)).cargoItemStats);
|
|
305
300
|
} catch (e) {
|
|
306
301
|
l(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load product stats"));
|
|
307
302
|
} finally {
|
|
@@ -314,8 +309,8 @@ function T() {
|
|
|
314
309
|
error: c
|
|
315
310
|
};
|
|
316
311
|
}
|
|
317
|
-
function
|
|
318
|
-
let i =
|
|
312
|
+
function D(e) {
|
|
313
|
+
let i = S(), [o, s] = a(null), [c, u] = a(!1), [d, f] = a(null), p = n(async () => {
|
|
319
314
|
if (!e) {
|
|
320
315
|
s(null);
|
|
321
316
|
return;
|
|
@@ -323,7 +318,7 @@ function E(e) {
|
|
|
323
318
|
u(!0), f(null);
|
|
324
319
|
try {
|
|
325
320
|
let n = await t(i, l, { id: e });
|
|
326
|
-
s(n.cargoItem ?
|
|
321
|
+
s(n.cargoItem ? y(n.cargoItem) : null);
|
|
327
322
|
} catch (e) {
|
|
328
323
|
f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load product"));
|
|
329
324
|
} finally {
|
|
@@ -339,43 +334,47 @@ function E(e) {
|
|
|
339
334
|
refetch: () => void p()
|
|
340
335
|
};
|
|
341
336
|
}
|
|
342
|
-
function
|
|
343
|
-
let { limit: i = 20, offset: o = 0, search: s } = e,
|
|
344
|
-
|
|
337
|
+
function O(e = {}) {
|
|
338
|
+
let { limit: i = 20, offset: o = 0, search: s, status: l } = e, u = S(), [d, f] = a([]), [p, m] = a(0), [h, g] = a(!1), [_, v] = a(!1), [y, x] = a(null), C = n(async () => {
|
|
339
|
+
v(!0), x(null);
|
|
345
340
|
try {
|
|
346
|
-
let e = await t(
|
|
347
|
-
filter: {
|
|
341
|
+
let e = await t(u, c, {
|
|
342
|
+
filter: {
|
|
343
|
+
search: s || void 0,
|
|
344
|
+
status: l || void 0
|
|
345
|
+
},
|
|
348
346
|
pagination: {
|
|
349
347
|
limit: i,
|
|
350
348
|
offset: o
|
|
351
349
|
}
|
|
352
350
|
});
|
|
353
|
-
|
|
351
|
+
m(e.warehousesCount), g(o + e.warehouses.length < e.warehousesCount), f(e.warehouses.map(b));
|
|
354
352
|
} catch (e) {
|
|
355
|
-
|
|
353
|
+
x(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load warehouses"));
|
|
356
354
|
} finally {
|
|
357
|
-
|
|
355
|
+
v(!1);
|
|
358
356
|
}
|
|
359
357
|
}, [
|
|
360
|
-
|
|
358
|
+
u,
|
|
361
359
|
i,
|
|
362
360
|
o,
|
|
363
|
-
s
|
|
361
|
+
s,
|
|
362
|
+
l
|
|
364
363
|
]);
|
|
365
364
|
return r(() => {
|
|
366
|
-
|
|
367
|
-
}, [
|
|
368
|
-
warehouses:
|
|
369
|
-
totalWarehouses:
|
|
370
|
-
hasMore:
|
|
371
|
-
isLoading:
|
|
372
|
-
error:
|
|
373
|
-
refetch: () => void
|
|
365
|
+
C();
|
|
366
|
+
}, [C]), {
|
|
367
|
+
warehouses: d,
|
|
368
|
+
totalWarehouses: p,
|
|
369
|
+
hasMore: h,
|
|
370
|
+
isLoading: _,
|
|
371
|
+
error: y,
|
|
372
|
+
refetch: () => void C()
|
|
374
373
|
};
|
|
375
374
|
}
|
|
376
|
-
var
|
|
377
|
-
function
|
|
378
|
-
let e =
|
|
375
|
+
var k = "\n query WarehouseStats {\n warehouseStats {\n total\n active\n avgUtilization\n }\n }\n";
|
|
376
|
+
function A() {
|
|
377
|
+
let e = S(), [n, i] = a({
|
|
379
378
|
total: 0,
|
|
380
379
|
active: 0,
|
|
381
380
|
avgUtilization: 0
|
|
@@ -384,7 +383,7 @@ function k() {
|
|
|
384
383
|
(async () => {
|
|
385
384
|
s(!0), l(null);
|
|
386
385
|
try {
|
|
387
|
-
i((await t(e,
|
|
386
|
+
i((await t(e, k)).warehouseStats);
|
|
388
387
|
} catch (e) {
|
|
389
388
|
l(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load warehouse stats"));
|
|
390
389
|
} finally {
|
|
@@ -397,8 +396,8 @@ function k() {
|
|
|
397
396
|
error: c
|
|
398
397
|
};
|
|
399
398
|
}
|
|
400
|
-
function
|
|
401
|
-
let i =
|
|
399
|
+
function j(e) {
|
|
400
|
+
let i = S(), [o, s] = a(null), [c, l] = a(!1), [d, f] = a(null), p = n(async () => {
|
|
402
401
|
if (!e) {
|
|
403
402
|
s(null);
|
|
404
403
|
return;
|
|
@@ -406,7 +405,7 @@ function A(e) {
|
|
|
406
405
|
l(!0), f(null);
|
|
407
406
|
try {
|
|
408
407
|
let n = await t(i, u, { id: e });
|
|
409
|
-
s(n.warehouse ?
|
|
408
|
+
s(n.warehouse ? b(n.warehouse) : null);
|
|
410
409
|
} catch (e) {
|
|
411
410
|
f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load warehouse"));
|
|
412
411
|
} finally {
|
|
@@ -422,8 +421,8 @@ function A(e) {
|
|
|
422
421
|
refetch: () => void p()
|
|
423
422
|
};
|
|
424
423
|
}
|
|
425
|
-
function
|
|
426
|
-
let e =
|
|
424
|
+
function M() {
|
|
425
|
+
let e = S(), [n, i] = a({
|
|
427
426
|
totalOnHand: 0,
|
|
428
427
|
totalAvailable: 0,
|
|
429
428
|
totalAllocated: 0,
|
|
@@ -458,16 +457,16 @@ function j() {
|
|
|
458
457
|
error: c
|
|
459
458
|
};
|
|
460
459
|
}
|
|
461
|
-
var
|
|
462
|
-
function
|
|
463
|
-
let { limit: o = 20, offset: s = 0 } = i, c =
|
|
460
|
+
var N = "\n query GetCargoItemStockLevels($cargoItemId: ID!, $pagination: PaginationInput) {\n inventoryItems(filter: { cargoItemId: $cargoItemId }, pagination: $pagination) {\n id\n onHand\n available\n allocated\n damaged\n reorderPoint\n warehouse {\n id\n name\n code\n }\n }\n inventoryItemsCount(filter: { cargoItemId: $cargoItemId })\n inventoryStats(filter: { cargoItemId: $cargoItemId }) {\n totalAvailable\n }\n }\n";
|
|
461
|
+
function P(e, i = {}) {
|
|
462
|
+
let { limit: o = 20, offset: s = 0 } = i, c = S(), [l, u] = a([]), [d, f] = a(0), [p, m] = a(0), [h, g] = a(!1), [_, v] = a(null), y = n(async () => {
|
|
464
463
|
if (!e) {
|
|
465
464
|
u([]), f(0), m(0);
|
|
466
465
|
return;
|
|
467
466
|
}
|
|
468
467
|
g(!0), v(null);
|
|
469
468
|
try {
|
|
470
|
-
let n = await t(c,
|
|
469
|
+
let n = await t(c, N, {
|
|
471
470
|
cargoItemId: e,
|
|
472
471
|
pagination: {
|
|
473
472
|
limit: o,
|
|
@@ -512,22 +511,22 @@ function N(e, i = {}) {
|
|
|
512
511
|
refetch: b
|
|
513
512
|
};
|
|
514
513
|
}
|
|
515
|
-
var
|
|
514
|
+
var F = [
|
|
516
515
|
"RECEIPT",
|
|
517
516
|
"ISSUE",
|
|
518
517
|
"TRANSFER",
|
|
519
518
|
"ADJUSTMENT",
|
|
520
519
|
"RETURN"
|
|
521
520
|
];
|
|
522
|
-
function
|
|
521
|
+
function I(e) {
|
|
523
522
|
let t = e.toUpperCase();
|
|
524
|
-
return
|
|
523
|
+
return F.find((e) => e === t) ?? "ADJUSTMENT";
|
|
525
524
|
}
|
|
526
|
-
function
|
|
525
|
+
function L(e) {
|
|
527
526
|
return {
|
|
528
527
|
id: e.id,
|
|
529
528
|
transactionNumber: e.transactionNumber,
|
|
530
|
-
type:
|
|
529
|
+
type: I(e.type),
|
|
531
530
|
quantity: e.quantity,
|
|
532
531
|
productId: e.cargoItemId,
|
|
533
532
|
warehouseId: e.warehouseId,
|
|
@@ -537,8 +536,8 @@ function I(e) {
|
|
|
537
536
|
createdAt: new Date(e.createdAt)
|
|
538
537
|
};
|
|
539
538
|
}
|
|
540
|
-
function
|
|
541
|
-
let { limit: i = 10, productId: o, warehouseId: s } = e, c =
|
|
539
|
+
function R(e = {}) {
|
|
540
|
+
let { limit: i = 10, productId: o, warehouseId: s } = e, c = S(), [l, u] = a([]), [d, p] = a(!1), [m, h] = a(null), g = n(async () => {
|
|
542
541
|
p(!0), h(null);
|
|
543
542
|
try {
|
|
544
543
|
u((await t(c, f, {
|
|
@@ -550,7 +549,7 @@ function L(e = {}) {
|
|
|
550
549
|
limit: i,
|
|
551
550
|
offset: 0
|
|
552
551
|
}
|
|
553
|
-
})).inventoryTransactions.map(
|
|
552
|
+
})).inventoryTransactions.map(L));
|
|
554
553
|
} catch (e) {
|
|
555
554
|
h(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load inventory transactions"));
|
|
556
555
|
} finally {
|
|
@@ -574,4 +573,4 @@ function L(e = {}) {
|
|
|
574
573
|
};
|
|
575
574
|
}
|
|
576
575
|
//#endregion
|
|
577
|
-
export {
|
|
576
|
+
export { C as useInventory, M as useInventoryStats, R as useInventoryTransactions, D as useProduct, E as useProductStats, P as useProductStockLevels, w as useProducts, j as useWarehouse, A as useWarehouseStats, O as useWarehouses };
|
package/dist/hooks/useRoutes.js
CHANGED
|
@@ -52,14 +52,11 @@ function h(e) {
|
|
|
52
52
|
vehicleId: e.vehicleId ?? "",
|
|
53
53
|
status: f(e.status),
|
|
54
54
|
stops: m(e.waypoints),
|
|
55
|
-
distance: e.estimatedDistance ?? 0,
|
|
55
|
+
distance: e.actualDistance ?? e.estimatedDistance ?? 0,
|
|
56
56
|
estimatedDuration: e.estimatedDuration ?? 0,
|
|
57
57
|
fuelCost: e.fuelCost ?? void 0,
|
|
58
58
|
actualDuration: e.actualDuration ?? void 0,
|
|
59
|
-
|
|
60
|
-
endTime: void 0,
|
|
61
|
-
optimized: !1,
|
|
62
|
-
trafficConditions: [],
|
|
59
|
+
optimized: (e.estimatedDistance ?? 0) > 0,
|
|
63
60
|
createdAt: new Date(e.createdAt)
|
|
64
61
|
};
|
|
65
62
|
}
|
|
@@ -125,11 +122,8 @@ function _(e = {}) {
|
|
|
125
122
|
vehicleId: e.vehicleId,
|
|
126
123
|
driverId: e.driverId,
|
|
127
124
|
waypoints: e.stops ?? [],
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
fuelCost: e.fuelCost,
|
|
131
|
-
actualDistance: e.distance,
|
|
132
|
-
actualDuration: e.actualDuration
|
|
125
|
+
estimatedDuration: e.estimatedDuration,
|
|
126
|
+
fuelCost: e.fuelCost
|
|
133
127
|
} })).createRoute);
|
|
134
128
|
return x((e) => [n, ...e]), n;
|
|
135
129
|
}, [y]), N = n(async (e, n) => {
|
|
@@ -142,11 +136,8 @@ function _(e = {}) {
|
|
|
142
136
|
vehicleId: n.vehicleId,
|
|
143
137
|
driverId: n.driverId,
|
|
144
138
|
waypoints: n.stops,
|
|
145
|
-
estimatedDistance: n.distance,
|
|
146
139
|
estimatedDuration: n.estimatedDuration,
|
|
147
|
-
fuelCost: n.fuelCost
|
|
148
|
-
actualDistance: n.distance,
|
|
149
|
-
actualDuration: n.actualDuration
|
|
140
|
+
fuelCost: n.fuelCost
|
|
150
141
|
}
|
|
151
142
|
})).updateRoute);
|
|
152
143
|
return x((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
@@ -12,6 +12,7 @@ export interface StatusColor {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const ORDER_STATUS_COLORS: Record<string, StatusColor>;
|
|
14
14
|
export declare const VEHICLE_STATUS_COLORS: Record<string, StatusColor>;
|
|
15
|
+
export declare const VEHICLE_STATUS_LABELS: Record<string, string>;
|
|
15
16
|
export declare const DRIVER_STATUS_COLORS: Record<string, StatusColor>;
|
|
16
17
|
export declare const DRIVER_STATUS_LABELS: Record<string, string>;
|
|
17
18
|
export declare const PRIORITY_COLORS: Record<string, StatusColor>;
|
|
@@ -18,6 +18,11 @@ export interface CreateVehicleInput {
|
|
|
18
18
|
status?: string;
|
|
19
19
|
fuelType?: string;
|
|
20
20
|
fuelEfficiencyLPer100Km?: number;
|
|
21
|
+
capacity?: {
|
|
22
|
+
weight?: number;
|
|
23
|
+
volume?: number;
|
|
24
|
+
pallets?: number;
|
|
25
|
+
};
|
|
21
26
|
}
|
|
22
27
|
export interface CreateDriverInput {
|
|
23
28
|
employeeId: string;
|
|
@@ -56,6 +61,7 @@ interface UseFleetResult {
|
|
|
56
61
|
createDriver: (input: CreateDriverInput) => Promise<Driver>;
|
|
57
62
|
updateVehicle: (id: string, input: CreateVehicleInput) => Promise<Vehicle>;
|
|
58
63
|
updateDriver: (id: string, input: UpdateDriverInput) => Promise<Driver>;
|
|
64
|
+
deleteVehicle: (id: string) => Promise<void>;
|
|
59
65
|
}
|
|
60
66
|
export interface ApiVehicle {
|
|
61
67
|
id: string;
|
|
@@ -104,7 +110,12 @@ export interface ApiDriver {
|
|
|
104
110
|
terminationReason?: string | null;
|
|
105
111
|
createdAt: string;
|
|
106
112
|
}
|
|
107
|
-
/**
|
|
113
|
+
/**
|
|
114
|
+
* Exported so the vehicle edit form's status field can round-trip (BOFF-7909).
|
|
115
|
+
* `decommissioned` must stay distinct from `out_of_service` — collapsing them
|
|
116
|
+
* used to silently rewrite a DECOMMISSIONED vehicle to INACTIVE on any save
|
|
117
|
+
* that touched status, even without the user changing it.
|
|
118
|
+
*/
|
|
108
119
|
export declare function toApiVehicleStatus(status: VehicleStatus): string;
|
|
109
120
|
/** Exported so the driver edit form's status field can round-trip losslessly (BOFF-7909). */
|
|
110
121
|
export declare function toApiDriverStatus(status: DriverStatus): string;
|
|
@@ -134,6 +145,7 @@ interface UseVehiclesResult {
|
|
|
134
145
|
refetch: () => void;
|
|
135
146
|
updateVehicleStatus: (id: string, status: VehicleStatus) => Promise<Vehicle>;
|
|
136
147
|
assignDriver: (vehicleId: string, driverId: string) => Promise<Vehicle>;
|
|
148
|
+
deleteVehicle: (id: string) => Promise<void>;
|
|
137
149
|
}
|
|
138
150
|
export declare function useVehicles(options?: UseVehiclesOptions): UseVehiclesResult;
|
|
139
151
|
export declare function useVehicle(vehicleId: string | undefined): {
|