@burdenoff/microfe-movethewheels 2026.920.3 → 2026.921.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 +1043 -5
- 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 +146 -125
- package/dist/hooks/useInventory.js +255 -186
- package/dist/hooks/useMultiModalShipments.js +35 -27
- package/dist/hooks/useOrders.js +73 -73
- package/dist/hooks/useRoutes.js +97 -75
- package/dist/hooks/useTracking.js +100 -88
- 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 +33 -5
- package/dist/movethewheels/hooks/useRoutes.d.ts +2 -1
- package/dist/movethewheels/hooks/useTracking.d.ts +12 -11
- package/dist/movethewheels/types/index.d.ts +7 -5
- package/dist/pages/CreateOrderPage.js +207 -201
- 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 +224 -208
- 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 +343 -321
- 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 +1188 -5
- 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 +58 -37
- 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 +13 -14
- package/src/movethewheels/hooks/useRoutes.ts +80 -23
- package/src/movethewheels/hooks/useTracking.ts +130 -98
- package/src/movethewheels/pages/CreateOrderPage.tsx +9 -1
- 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 +17 -1
- 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 +35 -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 +7 -5
|
@@ -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/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 }\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";
|
|
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", _ = "\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
6
|
function v(e) {
|
|
7
7
|
return {
|
|
8
8
|
id: e.id,
|
|
@@ -74,7 +74,10 @@ function b(e) {
|
|
|
74
74
|
return {
|
|
75
75
|
id: e.id,
|
|
76
76
|
productId: e.cargoItemId,
|
|
77
|
+
productName: e.cargoItem?.name,
|
|
78
|
+
productSku: e.cargoItem?.sku,
|
|
77
79
|
warehouseId: e.warehouseId,
|
|
80
|
+
warehouseName: e.warehouse?.name,
|
|
78
81
|
zoneId: "",
|
|
79
82
|
quantity: e.onHand,
|
|
80
83
|
reservedQuantity: e.allocated,
|
|
@@ -112,167 +115,206 @@ function x() {
|
|
|
112
115
|
]);
|
|
113
116
|
}
|
|
114
117
|
function S(e = {}) {
|
|
115
|
-
let { filters: l } = e,
|
|
118
|
+
let { filters: l, search: u, limit: d = 10, offset: f = 0 } = e, S = i(() => l, [
|
|
116
119
|
l?.lowStock,
|
|
117
120
|
l?.productId,
|
|
121
|
+
l?.search,
|
|
118
122
|
l?.warehouseId
|
|
119
|
-
]),
|
|
120
|
-
|
|
123
|
+
]), C = x(), [w, T] = a([]), [E, D] = a([]), [O, k] = a([]), [A, j] = a([]), [M, N] = a(0), [P, F] = a(!1), [I, L] = a(!1), [R, z] = a(null), B = n(async () => {
|
|
124
|
+
L(!0), z(null);
|
|
121
125
|
try {
|
|
122
|
-
let
|
|
123
|
-
|
|
126
|
+
let e = {
|
|
127
|
+
warehouseId: S?.warehouseId,
|
|
128
|
+
cargoItemId: S?.productId,
|
|
129
|
+
search: u || S?.search || void 0,
|
|
130
|
+
lowStock: S?.lowStock || void 0
|
|
131
|
+
}, [n, r, i, a] = await Promise.all([
|
|
132
|
+
t(C, o, {
|
|
133
|
+
filter: e,
|
|
134
|
+
pagination: {
|
|
135
|
+
limit: d,
|
|
136
|
+
offset: f
|
|
137
|
+
}
|
|
138
|
+
}),
|
|
139
|
+
t(C, o, {
|
|
124
140
|
filter: {
|
|
125
|
-
warehouseId:
|
|
126
|
-
cargoItemId:
|
|
141
|
+
warehouseId: S?.warehouseId,
|
|
142
|
+
cargoItemId: S?.productId,
|
|
143
|
+
lowStock: !0
|
|
127
144
|
},
|
|
128
145
|
pagination: {
|
|
129
|
-
limit:
|
|
146
|
+
limit: 5,
|
|
130
147
|
offset: 0
|
|
131
148
|
}
|
|
132
149
|
}),
|
|
133
|
-
t(
|
|
134
|
-
limit:
|
|
150
|
+
t(C, s, { pagination: {
|
|
151
|
+
limit: 5,
|
|
135
152
|
offset: 0
|
|
136
153
|
} }),
|
|
137
|
-
t(
|
|
138
|
-
limit:
|
|
154
|
+
t(C, c, { pagination: {
|
|
155
|
+
limit: 5,
|
|
139
156
|
offset: 0
|
|
140
157
|
} })
|
|
141
|
-
])
|
|
142
|
-
|
|
158
|
+
]);
|
|
159
|
+
T(n.inventoryItems.map(b)), D(r.inventoryItems.map(b)), N(n.inventoryItemsCount), F(f + n.inventoryItems.length < n.inventoryItemsCount), k(i.cargoItems.map(v)), j(a.warehouses.map(y));
|
|
143
160
|
} catch (e) {
|
|
144
|
-
|
|
161
|
+
z(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load inventory data"));
|
|
145
162
|
} finally {
|
|
146
|
-
|
|
163
|
+
L(!1);
|
|
147
164
|
}
|
|
148
|
-
}, [
|
|
165
|
+
}, [
|
|
166
|
+
S,
|
|
167
|
+
C,
|
|
168
|
+
d,
|
|
169
|
+
f,
|
|
170
|
+
u
|
|
171
|
+
]);
|
|
149
172
|
r(() => {
|
|
150
|
-
|
|
151
|
-
}, [
|
|
152
|
-
let
|
|
153
|
-
|
|
154
|
-
}, [
|
|
155
|
-
let i =
|
|
173
|
+
B();
|
|
174
|
+
}, [B]);
|
|
175
|
+
let V = n(() => {
|
|
176
|
+
B();
|
|
177
|
+
}, [B]), H = n(async (e, n, r) => {
|
|
178
|
+
let i = w.find((t) => t.id === e);
|
|
156
179
|
if (!i) throw Error("Inventory item not found");
|
|
157
|
-
let a = b((await t(
|
|
180
|
+
let a = b((await t(C, _, { input: {
|
|
158
181
|
id: e,
|
|
159
182
|
onHand: i.quantity + n,
|
|
160
183
|
available: i.availableQuantity + n,
|
|
161
184
|
allocated: i.reservedQuantity,
|
|
162
185
|
damaged: 0
|
|
163
186
|
} })).adjustInventoryStock);
|
|
164
|
-
return
|
|
165
|
-
}, [
|
|
166
|
-
let i = f.find((t) => t.warehouseId === e && t.productId === n);
|
|
167
|
-
if (!i) throw Error("Source inventory not found");
|
|
168
|
-
await N(i.id, -Math.abs(r), "transfer out");
|
|
169
|
-
let a = f.find((e) => e.warehouseId === t && e.productId === n);
|
|
170
|
-
a && await N(a.id, Math.abs(r), "transfer in");
|
|
171
|
-
}, [f, N]), F = n(async (e) => {
|
|
172
|
-
let n = v((await t(d, p, { input: {
|
|
173
|
-
name: e.name,
|
|
174
|
-
sku: e.sku,
|
|
175
|
-
category: e.category,
|
|
176
|
-
brand: e.brand,
|
|
177
|
-
weight: e.weight
|
|
178
|
-
} })).createCargoItem);
|
|
179
|
-
return w((e) => [n, ...e]), n;
|
|
180
|
-
}, [d]), I = n(async (e) => {
|
|
181
|
-
let n = y((await t(d, h, { input: {
|
|
182
|
-
code: e.code,
|
|
183
|
-
name: e.name,
|
|
184
|
-
type: e.type,
|
|
185
|
-
address: e.address,
|
|
186
|
-
totalCapacity: e.totalCapacity
|
|
187
|
-
} })).createWarehouse);
|
|
188
|
-
return E((e) => [n, ...e]), n;
|
|
189
|
-
}, [d]), L = n(async (e, n) => {
|
|
190
|
-
let r = v((await t(d, m, {
|
|
191
|
-
id: e,
|
|
192
|
-
input: {
|
|
193
|
-
name: n.name,
|
|
194
|
-
sku: n.sku,
|
|
195
|
-
category: n.category,
|
|
196
|
-
brand: n.brand,
|
|
197
|
-
weight: n.weight
|
|
198
|
-
}
|
|
199
|
-
})).updateCargoItem);
|
|
200
|
-
return w((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
201
|
-
}, [d]), R = n(async (e, n) => {
|
|
202
|
-
let r = y((await t(d, g, {
|
|
203
|
-
id: e,
|
|
204
|
-
input: {
|
|
205
|
-
code: n.code,
|
|
206
|
-
name: n.name,
|
|
207
|
-
type: n.type,
|
|
208
|
-
address: n.address,
|
|
209
|
-
totalCapacity: n.totalCapacity
|
|
210
|
-
}
|
|
211
|
-
})).updateWarehouse);
|
|
212
|
-
return E((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
213
|
-
}, [d]);
|
|
187
|
+
return T((t) => t.map((t) => t.id === e ? a : t)), a;
|
|
188
|
+
}, [C, w]);
|
|
214
189
|
return {
|
|
215
|
-
inventory:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
190
|
+
inventory: w,
|
|
191
|
+
lowStockItems: E,
|
|
192
|
+
products: O,
|
|
193
|
+
warehouses: A,
|
|
194
|
+
totalItems: M,
|
|
195
|
+
hasMore: P,
|
|
196
|
+
isLoading: I,
|
|
197
|
+
error: R,
|
|
198
|
+
refetch: V,
|
|
199
|
+
updateStock: H,
|
|
200
|
+
transferStock: n(async (e, t, n, r) => {
|
|
201
|
+
let i = w.find((t) => t.warehouseId === e && t.productId === n);
|
|
202
|
+
if (!i) throw Error("Source inventory not found");
|
|
203
|
+
await H(i.id, -Math.abs(r), "transfer out");
|
|
204
|
+
let a = w.find((e) => e.warehouseId === t && e.productId === n);
|
|
205
|
+
a && await H(a.id, Math.abs(r), "transfer in");
|
|
206
|
+
}, [w, H]),
|
|
207
|
+
createProduct: n(async (e) => {
|
|
208
|
+
let n = v((await t(C, p, { input: {
|
|
209
|
+
name: e.name,
|
|
210
|
+
sku: e.sku,
|
|
211
|
+
category: e.category,
|
|
212
|
+
brand: e.brand,
|
|
213
|
+
weight: e.weight
|
|
214
|
+
} })).createCargoItem);
|
|
215
|
+
return k((e) => [n, ...e]), n;
|
|
216
|
+
}, [C]),
|
|
217
|
+
createWarehouse: n(async (e) => {
|
|
218
|
+
let n = y((await t(C, h, { input: {
|
|
219
|
+
code: e.code,
|
|
220
|
+
name: e.name,
|
|
221
|
+
type: e.type,
|
|
222
|
+
address: e.address,
|
|
223
|
+
totalCapacity: e.totalCapacity
|
|
224
|
+
} })).createWarehouse);
|
|
225
|
+
return j((e) => [n, ...e]), n;
|
|
226
|
+
}, [C]),
|
|
227
|
+
updateProduct: n(async (e, n) => {
|
|
228
|
+
let r = v((await t(C, m, {
|
|
229
|
+
id: e,
|
|
230
|
+
input: {
|
|
231
|
+
name: n.name,
|
|
232
|
+
sku: n.sku,
|
|
233
|
+
category: n.category,
|
|
234
|
+
brand: n.brand,
|
|
235
|
+
weight: n.weight
|
|
236
|
+
}
|
|
237
|
+
})).updateCargoItem);
|
|
238
|
+
return k((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
239
|
+
}, [C]),
|
|
240
|
+
updateWarehouse: n(async (e, n) => {
|
|
241
|
+
let r = y((await t(C, g, {
|
|
242
|
+
id: e,
|
|
243
|
+
input: {
|
|
244
|
+
code: n.code,
|
|
245
|
+
name: n.name,
|
|
246
|
+
type: n.type,
|
|
247
|
+
address: n.address,
|
|
248
|
+
totalCapacity: n.totalCapacity
|
|
249
|
+
}
|
|
250
|
+
})).updateWarehouse);
|
|
251
|
+
return j((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
252
|
+
}, [C])
|
|
228
253
|
};
|
|
229
254
|
}
|
|
230
255
|
function C(e = {}) {
|
|
231
|
-
let { limit: i =
|
|
232
|
-
|
|
256
|
+
let { limit: i = 20, offset: o = 0, search: c, category: l } = e, u = x(), [d, f] = a([]), [p, m] = a(0), [h, g] = a(!1), [_, y] = a(!1), [b, S] = a(null), C = n(async () => {
|
|
257
|
+
y(!0), S(null);
|
|
233
258
|
try {
|
|
234
|
-
let e = await t(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
259
|
+
let e = await t(u, s, {
|
|
260
|
+
filter: {
|
|
261
|
+
search: c || void 0,
|
|
262
|
+
category: l || void 0
|
|
263
|
+
},
|
|
264
|
+
pagination: {
|
|
265
|
+
limit: i,
|
|
266
|
+
offset: o
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
g(o + e.cargoItems.length < e.cargoItemsCount), m(e.cargoItemsCount), f(e.cargoItems.map(v));
|
|
239
270
|
} catch (e) {
|
|
240
|
-
|
|
271
|
+
S(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load products"));
|
|
241
272
|
} finally {
|
|
242
|
-
|
|
273
|
+
y(!1);
|
|
243
274
|
}
|
|
244
275
|
}, [
|
|
245
|
-
|
|
276
|
+
u,
|
|
246
277
|
i,
|
|
247
|
-
o
|
|
278
|
+
o,
|
|
279
|
+
c,
|
|
280
|
+
l
|
|
248
281
|
]);
|
|
249
282
|
return r(() => {
|
|
250
|
-
|
|
251
|
-
}, [
|
|
252
|
-
products:
|
|
253
|
-
totalProducts:
|
|
254
|
-
hasMore:
|
|
255
|
-
isLoading:
|
|
256
|
-
error:
|
|
257
|
-
refetch: () => void
|
|
283
|
+
C();
|
|
284
|
+
}, [C]), {
|
|
285
|
+
products: d,
|
|
286
|
+
totalProducts: p,
|
|
287
|
+
hasMore: h,
|
|
288
|
+
isLoading: _,
|
|
289
|
+
error: b,
|
|
290
|
+
refetch: () => void C()
|
|
258
291
|
};
|
|
259
292
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
293
|
+
var w = "\n query CargoItemStats {\n cargoItemStats {\n total\n specialHandling\n temperatureControlled\n }\n }\n";
|
|
294
|
+
function T() {
|
|
295
|
+
let e = x(), [n, i] = a({
|
|
296
|
+
total: 0,
|
|
297
|
+
specialHandling: 0,
|
|
298
|
+
temperatureControlled: 0
|
|
299
|
+
}), [o, s] = a(!1), [c, l] = a(null);
|
|
300
|
+
return r(() => {
|
|
301
|
+
(async () => {
|
|
302
|
+
s(!0), l(null);
|
|
303
|
+
try {
|
|
304
|
+
i((await t(e, w)).cargoItemStats);
|
|
305
|
+
} catch (e) {
|
|
306
|
+
l(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load product stats"));
|
|
307
|
+
} finally {
|
|
308
|
+
s(!1);
|
|
309
|
+
}
|
|
310
|
+
})();
|
|
311
|
+
}, [e]), {
|
|
312
|
+
stats: n,
|
|
313
|
+
isLoading: o,
|
|
314
|
+
error: c
|
|
273
315
|
};
|
|
274
316
|
}
|
|
275
|
-
function
|
|
317
|
+
function E(e) {
|
|
276
318
|
let i = x(), [o, s] = a(null), [c, u] = a(!1), [d, f] = a(null), p = n(async () => {
|
|
277
319
|
if (!e) {
|
|
278
320
|
s(null);
|
|
@@ -297,55 +339,65 @@ function T(e) {
|
|
|
297
339
|
refetch: () => void p()
|
|
298
340
|
};
|
|
299
341
|
}
|
|
300
|
-
function
|
|
301
|
-
let { limit: i =
|
|
302
|
-
|
|
342
|
+
function D(e = {}) {
|
|
343
|
+
let { limit: i = 20, offset: o = 0, search: s } = e, l = x(), [u, d] = a([]), [f, p] = a(0), [m, h] = a(!1), [g, _] = a(!1), [v, b] = a(null), S = n(async () => {
|
|
344
|
+
_(!0), b(null);
|
|
303
345
|
try {
|
|
304
|
-
let e = await t(
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
346
|
+
let e = await t(l, c, {
|
|
347
|
+
filter: { search: s || void 0 },
|
|
348
|
+
pagination: {
|
|
349
|
+
limit: i,
|
|
350
|
+
offset: o
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
p(e.warehousesCount), h(o + e.warehouses.length < e.warehousesCount), d(e.warehouses.map(y));
|
|
309
354
|
} catch (e) {
|
|
310
|
-
|
|
355
|
+
b(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load warehouses"));
|
|
311
356
|
} finally {
|
|
312
|
-
|
|
357
|
+
_(!1);
|
|
313
358
|
}
|
|
314
359
|
}, [
|
|
315
|
-
|
|
360
|
+
l,
|
|
316
361
|
i,
|
|
317
|
-
o
|
|
362
|
+
o,
|
|
363
|
+
s
|
|
318
364
|
]);
|
|
319
365
|
return r(() => {
|
|
320
|
-
|
|
321
|
-
}, [
|
|
322
|
-
warehouses:
|
|
323
|
-
totalWarehouses:
|
|
324
|
-
hasMore:
|
|
325
|
-
isLoading:
|
|
326
|
-
error:
|
|
327
|
-
refetch: () => void
|
|
366
|
+
S();
|
|
367
|
+
}, [S]), {
|
|
368
|
+
warehouses: u,
|
|
369
|
+
totalWarehouses: f,
|
|
370
|
+
hasMore: m,
|
|
371
|
+
isLoading: g,
|
|
372
|
+
error: v,
|
|
373
|
+
refetch: () => void S()
|
|
328
374
|
};
|
|
329
375
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
376
|
+
var O = "\n query WarehouseStats {\n warehouseStats {\n total\n active\n avgUtilization\n }\n }\n";
|
|
377
|
+
function k() {
|
|
378
|
+
let e = x(), [n, i] = a({
|
|
379
|
+
total: 0,
|
|
380
|
+
active: 0,
|
|
381
|
+
avgUtilization: 0
|
|
382
|
+
}), [o, s] = a(!1), [c, l] = a(null);
|
|
383
|
+
return r(() => {
|
|
384
|
+
(async () => {
|
|
385
|
+
s(!0), l(null);
|
|
386
|
+
try {
|
|
387
|
+
i((await t(e, O)).warehouseStats);
|
|
388
|
+
} catch (e) {
|
|
389
|
+
l(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load warehouse stats"));
|
|
390
|
+
} finally {
|
|
391
|
+
s(!1);
|
|
392
|
+
}
|
|
393
|
+
})();
|
|
394
|
+
}, [e]), {
|
|
395
|
+
stats: n,
|
|
396
|
+
isLoading: o,
|
|
397
|
+
error: c
|
|
346
398
|
};
|
|
347
399
|
}
|
|
348
|
-
function
|
|
400
|
+
function A(e) {
|
|
349
401
|
let i = x(), [o, s] = a(null), [c, l] = a(!1), [d, f] = a(null), p = n(async () => {
|
|
350
402
|
if (!e) {
|
|
351
403
|
s(null);
|
|
@@ -370,7 +422,7 @@ function O(e) {
|
|
|
370
422
|
refetch: () => void p()
|
|
371
423
|
};
|
|
372
424
|
}
|
|
373
|
-
function
|
|
425
|
+
function j() {
|
|
374
426
|
let e = x(), [n, i] = a({
|
|
375
427
|
totalOnHand: 0,
|
|
376
428
|
totalAvailable: 0,
|
|
@@ -406,16 +458,23 @@ function k() {
|
|
|
406
458
|
error: c
|
|
407
459
|
};
|
|
408
460
|
}
|
|
409
|
-
var
|
|
410
|
-
function
|
|
411
|
-
let i = x(), [
|
|
461
|
+
var M = "\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";
|
|
462
|
+
function N(e, i = {}) {
|
|
463
|
+
let { limit: o = 20, offset: s = 0 } = i, c = x(), [l, u] = a([]), [d, f] = a(0), [p, m] = a(0), [h, g] = a(!1), [_, v] = a(null), y = n(async () => {
|
|
412
464
|
if (!e) {
|
|
413
|
-
|
|
465
|
+
u([]), f(0), m(0);
|
|
414
466
|
return;
|
|
415
467
|
}
|
|
416
|
-
|
|
468
|
+
g(!0), v(null);
|
|
417
469
|
try {
|
|
418
|
-
|
|
470
|
+
let n = await t(c, M, {
|
|
471
|
+
cargoItemId: e,
|
|
472
|
+
pagination: {
|
|
473
|
+
limit: o,
|
|
474
|
+
offset: s
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
u((n.inventoryItems ?? []).map((e) => ({
|
|
419
478
|
inventoryItemId: e.id,
|
|
420
479
|
warehouseId: e.warehouse?.id ?? "",
|
|
421
480
|
warehouseName: e.warehouse?.name ?? "Unknown warehouse",
|
|
@@ -425,40 +484,50 @@ function j(e) {
|
|
|
425
484
|
allocated: e.allocated,
|
|
426
485
|
damaged: e.damaged,
|
|
427
486
|
reorderPoint: e.reorderPoint ?? void 0
|
|
428
|
-
})));
|
|
487
|
+
}))), f(n.inventoryItemsCount ?? 0), m(n.inventoryStats?.totalAvailable ?? 0);
|
|
429
488
|
} catch (e) {
|
|
430
|
-
|
|
489
|
+
v(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load stock levels"));
|
|
431
490
|
} finally {
|
|
432
|
-
|
|
491
|
+
g(!1);
|
|
433
492
|
}
|
|
434
|
-
}, [
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
493
|
+
}, [
|
|
494
|
+
c,
|
|
495
|
+
o,
|
|
496
|
+
s,
|
|
497
|
+
e
|
|
498
|
+
]);
|
|
499
|
+
r(() => {
|
|
500
|
+
y();
|
|
501
|
+
}, [y]);
|
|
502
|
+
let b = n(() => {
|
|
503
|
+
y();
|
|
504
|
+
}, [y]);
|
|
505
|
+
return {
|
|
506
|
+
levels: l,
|
|
507
|
+
totalLevels: d,
|
|
508
|
+
totalAvailable: p,
|
|
509
|
+
hasMore: s + l.length < d,
|
|
510
|
+
isLoading: h,
|
|
511
|
+
error: _,
|
|
512
|
+
refetch: b
|
|
444
513
|
};
|
|
445
514
|
}
|
|
446
|
-
var
|
|
515
|
+
var P = [
|
|
447
516
|
"RECEIPT",
|
|
448
517
|
"ISSUE",
|
|
449
518
|
"TRANSFER",
|
|
450
519
|
"ADJUSTMENT",
|
|
451
520
|
"RETURN"
|
|
452
521
|
];
|
|
453
|
-
function
|
|
522
|
+
function F(e) {
|
|
454
523
|
let t = e.toUpperCase();
|
|
455
|
-
return
|
|
524
|
+
return P.find((e) => e === t) ?? "ADJUSTMENT";
|
|
456
525
|
}
|
|
457
|
-
function
|
|
526
|
+
function I(e) {
|
|
458
527
|
return {
|
|
459
528
|
id: e.id,
|
|
460
529
|
transactionNumber: e.transactionNumber,
|
|
461
|
-
type:
|
|
530
|
+
type: F(e.type),
|
|
462
531
|
quantity: e.quantity,
|
|
463
532
|
productId: e.cargoItemId,
|
|
464
533
|
warehouseId: e.warehouseId,
|
|
@@ -468,7 +537,7 @@ function P(e) {
|
|
|
468
537
|
createdAt: new Date(e.createdAt)
|
|
469
538
|
};
|
|
470
539
|
}
|
|
471
|
-
function
|
|
540
|
+
function L(e = {}) {
|
|
472
541
|
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
542
|
p(!0), h(null);
|
|
474
543
|
try {
|
|
@@ -481,7 +550,7 @@ function F(e = {}) {
|
|
|
481
550
|
limit: i,
|
|
482
551
|
offset: 0
|
|
483
552
|
}
|
|
484
|
-
})).inventoryTransactions.map(
|
|
553
|
+
})).inventoryTransactions.map(I));
|
|
485
554
|
} catch (e) {
|
|
486
555
|
h(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load inventory transactions"));
|
|
487
556
|
} finally {
|
|
@@ -505,4 +574,4 @@ function F(e = {}) {
|
|
|
505
574
|
};
|
|
506
575
|
}
|
|
507
576
|
//#endregion
|
|
508
|
-
export { S as useInventory,
|
|
577
|
+
export { S as useInventory, j as useInventoryStats, L as useInventoryTransactions, E as useProduct, T as useProductStats, N as useProductStockLevels, C as useProducts, A as useWarehouse, k as useWarehouseStats, D as useWarehouses };
|