@burdenoff/microfe-movethewheels 2026.719.3 → 2026.725.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/MoveTheWheelsRoot.js +45 -35
- package/dist/hooks/useOrders.js +119 -100
- package/dist/movethewheels/types/index.d.ts +1 -3
- package/dist/pages/CreateOrderPage.js +53 -79
- package/dist/pages/MarketplacePage.js +143 -124
- package/dist/pages/OrderDetailsPage.js +19 -20
- package/dist/pages/OrdersListPage.js +82 -113
- package/package.json +2 -1
- package/src/movethewheels/MoveTheWheelsRoot.tsx +57 -29
- package/src/movethewheels/hooks/useOrders.ts +83 -208
- package/src/movethewheels/pages/CreateOrderPage.tsx +1 -19
- package/src/movethewheels/pages/MarketplacePage.tsx +34 -1
- package/src/movethewheels/pages/OrderDetailsPage.tsx +1 -7
- package/src/movethewheels/pages/OrdersListPage.tsx +3 -31
- package/src/movethewheels/types/index.ts +1 -3
|
@@ -18,16 +18,16 @@ import { Warehouse as g } from "./node_modules/lucide-react/dist/esm/icons/wareh
|
|
|
18
18
|
import { MoveTheWheelsProvider as _ } from "./providers/MoveTheWheelsProvider.js";
|
|
19
19
|
import { MoveTheWheelsRoutes as v } from "./MoveTheWheelsRoutes.js";
|
|
20
20
|
import { useEffect as y } from "react";
|
|
21
|
-
import { jsx as b } from "react/jsx-runtime";
|
|
22
|
-
import { FeatureFlagProvider as
|
|
21
|
+
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
22
|
+
import { FeatureFlagProvider as S, useFeatureFlag as C } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
23
23
|
//#region src/movethewheels/MoveTheWheelsRoot.tsx
|
|
24
|
-
var
|
|
25
|
-
let
|
|
24
|
+
var w = ({ registerNavItems: _, basePath: v = "/" }) => {
|
|
25
|
+
let x = C("movethewheels.marketplace", !1), S = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
|
|
26
26
|
return y(() => {
|
|
27
|
-
if (
|
|
27
|
+
if (_) return _({
|
|
28
28
|
id: "movethewheels",
|
|
29
29
|
label: "MoveTheWheels",
|
|
30
|
-
path:
|
|
30
|
+
path: v,
|
|
31
31
|
icon: /* @__PURE__ */ b(p, { size: 20 }),
|
|
32
32
|
order: 25,
|
|
33
33
|
group: "workspace",
|
|
@@ -35,49 +35,49 @@ var S = (S) => {
|
|
|
35
35
|
{
|
|
36
36
|
id: "mtw-dashboard",
|
|
37
37
|
label: "Dashboard",
|
|
38
|
-
path:
|
|
38
|
+
path: v,
|
|
39
39
|
icon: /* @__PURE__ */ b(s, { size: 16 }),
|
|
40
40
|
order: 1
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
id: "mtw-orders",
|
|
44
44
|
label: "Orders",
|
|
45
|
-
path:
|
|
45
|
+
path: S(v, "orders"),
|
|
46
46
|
icon: /* @__PURE__ */ b(l, { size: 16 }),
|
|
47
47
|
order: 2
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
id: "mtw-tracking",
|
|
51
51
|
label: "Tracking",
|
|
52
|
-
path:
|
|
52
|
+
path: S(v, "tracking"),
|
|
53
53
|
icon: /* @__PURE__ */ b(c, { size: 16 }),
|
|
54
54
|
order: 3
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
id: "mtw-fleet",
|
|
58
58
|
label: "Fleet",
|
|
59
|
-
path:
|
|
59
|
+
path: S(v, "fleet"),
|
|
60
60
|
icon: /* @__PURE__ */ b(p, { size: 16 }),
|
|
61
61
|
order: 4,
|
|
62
62
|
children: [
|
|
63
63
|
{
|
|
64
64
|
id: "mtw-fleet-overview",
|
|
65
65
|
label: "Overview",
|
|
66
|
-
path:
|
|
66
|
+
path: S(v, "fleet"),
|
|
67
67
|
icon: /* @__PURE__ */ b(s, { size: 14 }),
|
|
68
68
|
order: 1
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
id: "mtw-vehicles",
|
|
72
72
|
label: "Vehicles",
|
|
73
|
-
path:
|
|
73
|
+
path: S(v, "fleet/vehicles"),
|
|
74
74
|
icon: /* @__PURE__ */ b(n, { size: 14 }),
|
|
75
75
|
order: 2
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
id: "mtw-drivers",
|
|
79
79
|
label: "Drivers",
|
|
80
|
-
path:
|
|
80
|
+
path: S(v, "fleet/drivers"),
|
|
81
81
|
icon: /* @__PURE__ */ b(m, { size: 14 }),
|
|
82
82
|
order: 3
|
|
83
83
|
}
|
|
@@ -86,28 +86,28 @@ var S = (S) => {
|
|
|
86
86
|
{
|
|
87
87
|
id: "mtw-inventory",
|
|
88
88
|
label: "Inventory",
|
|
89
|
-
path:
|
|
89
|
+
path: S(v, "inventory"),
|
|
90
90
|
icon: /* @__PURE__ */ b(g, { size: 16 }),
|
|
91
91
|
order: 5,
|
|
92
92
|
children: [
|
|
93
93
|
{
|
|
94
94
|
id: "mtw-inventory-overview",
|
|
95
95
|
label: "Overview",
|
|
96
|
-
path:
|
|
96
|
+
path: S(v, "inventory"),
|
|
97
97
|
icon: /* @__PURE__ */ b(s, { size: 14 }),
|
|
98
98
|
order: 1
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
101
|
id: "mtw-products",
|
|
102
102
|
label: "Products",
|
|
103
|
-
path:
|
|
103
|
+
path: S(v, "inventory/products"),
|
|
104
104
|
icon: /* @__PURE__ */ b(t, { size: 14 }),
|
|
105
105
|
order: 2
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
id: "mtw-warehouses",
|
|
109
109
|
label: "Warehouses",
|
|
110
|
-
path:
|
|
110
|
+
path: S(v, "inventory/warehouses"),
|
|
111
111
|
icon: /* @__PURE__ */ b(g, { size: 14 }),
|
|
112
112
|
order: 3
|
|
113
113
|
}
|
|
@@ -116,88 +116,98 @@ var S = (S) => {
|
|
|
116
116
|
{
|
|
117
117
|
id: "mtw-customers",
|
|
118
118
|
label: "Customers",
|
|
119
|
-
path:
|
|
119
|
+
path: S(v, "customers"),
|
|
120
120
|
icon: /* @__PURE__ */ b(h, { size: 16 }),
|
|
121
121
|
order: 6
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
id: "mtw-routes",
|
|
125
125
|
label: "Routes",
|
|
126
|
-
path:
|
|
126
|
+
path: S(v, "routes"),
|
|
127
127
|
icon: /* @__PURE__ */ b(u, { size: 16 }),
|
|
128
128
|
order: 7
|
|
129
129
|
},
|
|
130
130
|
{
|
|
131
131
|
id: "mtw-analytics",
|
|
132
132
|
label: "Analytics",
|
|
133
|
-
path:
|
|
133
|
+
path: S(v, "analytics"),
|
|
134
134
|
icon: /* @__PURE__ */ b(r, { size: 16 }),
|
|
135
135
|
order: 8
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
138
|
id: "mtw-finance",
|
|
139
139
|
label: "Finance",
|
|
140
|
-
path:
|
|
140
|
+
path: S(v, "finance"),
|
|
141
141
|
icon: /* @__PURE__ */ b(i, { size: 16 }),
|
|
142
142
|
order: 9
|
|
143
143
|
},
|
|
144
|
-
{
|
|
144
|
+
...x ? [{
|
|
145
145
|
id: "mtw-marketplace",
|
|
146
146
|
label: "Marketplace",
|
|
147
|
-
path:
|
|
147
|
+
path: S(v, "marketplace"),
|
|
148
148
|
icon: /* @__PURE__ */ b(f, { size: 16 }),
|
|
149
149
|
order: 10
|
|
150
|
-
},
|
|
150
|
+
}] : [],
|
|
151
151
|
{
|
|
152
152
|
id: "mtw-import-export",
|
|
153
153
|
label: "Import/Export",
|
|
154
|
-
path:
|
|
154
|
+
path: S(v, "import-export"),
|
|
155
155
|
icon: /* @__PURE__ */ b(o, { size: 16 }),
|
|
156
156
|
order: 11
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
159
|
id: "mtw-reports",
|
|
160
160
|
label: "Reports",
|
|
161
|
-
path:
|
|
161
|
+
path: S(v, "reports"),
|
|
162
162
|
icon: /* @__PURE__ */ b(a, { size: 16 }),
|
|
163
163
|
order: 12
|
|
164
164
|
},
|
|
165
165
|
{
|
|
166
166
|
id: "mtw-ai-assistant",
|
|
167
167
|
label: "AI Assistant",
|
|
168
|
-
path:
|
|
168
|
+
path: S(v, "ai-assistant"),
|
|
169
169
|
icon: /* @__PURE__ */ b(e, { size: 16 }),
|
|
170
170
|
order: 13
|
|
171
171
|
},
|
|
172
172
|
{
|
|
173
173
|
id: "mtw-settings",
|
|
174
174
|
label: "Settings",
|
|
175
|
-
path:
|
|
175
|
+
path: S(v, "settings"),
|
|
176
176
|
icon: /* @__PURE__ */ b(d, { size: 16 }),
|
|
177
177
|
order: 99
|
|
178
178
|
}
|
|
179
179
|
]
|
|
180
180
|
});
|
|
181
|
-
}, [
|
|
182
|
-
|
|
181
|
+
}, [
|
|
182
|
+
_,
|
|
183
|
+
v,
|
|
184
|
+
x
|
|
185
|
+
]), null;
|
|
186
|
+
}, T = (e) => {
|
|
187
|
+
let { registerNavItems: t, registerFooterItems: n, basePath: r = "/" } = e;
|
|
188
|
+
return y(() => {
|
|
189
|
+
if (n) return n([{
|
|
183
190
|
id: "mtw-status",
|
|
184
191
|
label: "Logistics Ready",
|
|
185
192
|
type: "status",
|
|
186
193
|
order: 20,
|
|
187
194
|
section: "left"
|
|
188
195
|
}]);
|
|
189
|
-
}, [
|
|
196
|
+
}, [n]), /* @__PURE__ */ x(S, {
|
|
190
197
|
workspaceId: null,
|
|
191
198
|
gateway: "global",
|
|
192
199
|
defaultEnabled: !0,
|
|
193
|
-
children: /* @__PURE__ */ b(
|
|
194
|
-
|
|
200
|
+
children: [/* @__PURE__ */ b(w, {
|
|
201
|
+
registerNavItems: t,
|
|
202
|
+
basePath: r
|
|
203
|
+
}), /* @__PURE__ */ b(_, {
|
|
204
|
+
...e,
|
|
195
205
|
children: /* @__PURE__ */ b("div", {
|
|
196
206
|
className: "movethewheels-root h-full",
|
|
197
207
|
children: /* @__PURE__ */ b(v, {})
|
|
198
208
|
})
|
|
199
|
-
})
|
|
209
|
+
})]
|
|
200
210
|
});
|
|
201
211
|
};
|
|
202
212
|
//#endregion
|
|
203
|
-
export {
|
|
213
|
+
export { T as MoveTheWheelsRoot };
|
package/dist/hooks/useOrders.js
CHANGED
|
@@ -2,8 +2,38 @@ 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/useOrders.ts
|
|
5
|
-
var o = "\n
|
|
6
|
-
|
|
5
|
+
var o = "\n id\n deliveryJobNumber\n customerId\n status\n priority\n pickupAddress\n deliveryAddress\n cargoItems\n pricing\n trackingNumber\n specialInstructions\n scheduledDelivery\n vehicleId\n driverId\n createdAt\n updatedAt\n customer {\n name\n email\n phone\n company\n }\n statusHistory {\n status\n notes\n location\n createdAt\n createdBy\n }\n", s = `
|
|
6
|
+
query ListDeliveryJobs($filter: DeliveryJobFilterInput, $pagination: PaginationInput) {
|
|
7
|
+
deliveryJobs(filter: $filter, pagination: $pagination) {
|
|
8
|
+
${o}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
`, c = `
|
|
12
|
+
query GetDeliveryJob($id: ID!) {
|
|
13
|
+
deliveryJob(id: $id) {
|
|
14
|
+
${o}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`, l = "\n query GetDeliveryJobStatsBundle {\n deliveryJobStats {\n total\n pending\n inTransit\n delivered\n cancelled\n failed\n }\n financeMetrics {\n revenue {\n totalRevenue\n averageOrderValue\n }\n }\n }\n", u = `
|
|
18
|
+
mutation CreateDeliveryJob($input: CreateDeliveryJobInput!) {
|
|
19
|
+
createDeliveryJob(input: $input) {
|
|
20
|
+
${o}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`, d = `
|
|
24
|
+
mutation UpdateDeliveryJob($id: ID!, $input: UpdateDeliveryJobInput!) {
|
|
25
|
+
updateDeliveryJob(id: $id, input: $input) {
|
|
26
|
+
${o}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`, f = `
|
|
30
|
+
mutation UpdateDeliveryJobStatus($id: ID!, $input: UpdateDeliveryJobStatusInput!) {
|
|
31
|
+
updateDeliveryJobStatus(id: $id, input: $input) {
|
|
32
|
+
${o}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
`, p = "\n mutation DeleteDeliveryJob($id: ID!) {\n deleteDeliveryJob(id: $id)\n }\n";
|
|
36
|
+
function m(e) {
|
|
7
37
|
switch (e) {
|
|
8
38
|
case "PENDING": return "pending";
|
|
9
39
|
case "CONFIRMED": return "confirmed";
|
|
@@ -16,9 +46,6 @@ function p(e) {
|
|
|
16
46
|
default: return "failed";
|
|
17
47
|
}
|
|
18
48
|
}
|
|
19
|
-
function m(e) {
|
|
20
|
-
return e === "B2B" ? "b2b" : "b2c";
|
|
21
|
-
}
|
|
22
49
|
function h(e) {
|
|
23
50
|
switch (e) {
|
|
24
51
|
case "LOW": return "low";
|
|
@@ -42,9 +69,6 @@ function g(e) {
|
|
|
42
69
|
}
|
|
43
70
|
}
|
|
44
71
|
function _(e) {
|
|
45
|
-
return e === "b2b" ? "B2B" : "B2C";
|
|
46
|
-
}
|
|
47
|
-
function v(e) {
|
|
48
72
|
switch (e) {
|
|
49
73
|
case "low": return "LOW";
|
|
50
74
|
case "high": return "HIGH";
|
|
@@ -52,7 +76,7 @@ function v(e) {
|
|
|
52
76
|
default: return "MEDIUM";
|
|
53
77
|
}
|
|
54
78
|
}
|
|
55
|
-
function
|
|
79
|
+
function v(e) {
|
|
56
80
|
return {
|
|
57
81
|
street: "",
|
|
58
82
|
city: "",
|
|
@@ -62,10 +86,10 @@ function y(e) {
|
|
|
62
86
|
...e ?? {}
|
|
63
87
|
};
|
|
64
88
|
}
|
|
65
|
-
function
|
|
89
|
+
function y(e) {
|
|
66
90
|
return {
|
|
67
91
|
id: e.id,
|
|
68
|
-
orderNumber: e.
|
|
92
|
+
orderNumber: e.deliveryJobNumber,
|
|
69
93
|
customerId: e.customerId,
|
|
70
94
|
customerInfo: {
|
|
71
95
|
name: e.customer?.name ?? "Unknown Customer",
|
|
@@ -73,12 +97,11 @@ function b(e) {
|
|
|
73
97
|
phone: e.customer?.phone ?? "",
|
|
74
98
|
company: e.customer?.company ?? void 0
|
|
75
99
|
},
|
|
76
|
-
items: Array.isArray(e.
|
|
77
|
-
status:
|
|
78
|
-
orderType: m(e.orderType),
|
|
100
|
+
items: Array.isArray(e.cargoItems) ? e.cargoItems : [],
|
|
101
|
+
status: m(e.status),
|
|
79
102
|
priority: h(e.priority),
|
|
80
|
-
pickupAddress:
|
|
81
|
-
deliveryAddress:
|
|
103
|
+
pickupAddress: v(e.pickupAddress),
|
|
104
|
+
deliveryAddress: v(e.deliveryAddress),
|
|
82
105
|
trackingNumber: e.trackingNumber ?? "",
|
|
83
106
|
specialInstructions: e.specialInstructions ?? void 0,
|
|
84
107
|
pricing: {
|
|
@@ -96,7 +119,7 @@ function b(e) {
|
|
|
96
119
|
},
|
|
97
120
|
timeline: e.statusHistory?.map((e) => ({
|
|
98
121
|
timestamp: new Date(e.createdAt),
|
|
99
|
-
status:
|
|
122
|
+
status: m(e.status),
|
|
100
123
|
location: e.location,
|
|
101
124
|
notes: e.notes ?? void 0,
|
|
102
125
|
performedBy: e.createdBy ?? "system"
|
|
@@ -108,92 +131,88 @@ function b(e) {
|
|
|
108
131
|
updatedAt: new Date(e.updatedAt)
|
|
109
132
|
};
|
|
110
133
|
}
|
|
111
|
-
function
|
|
112
|
-
let { filters: c, limit:
|
|
134
|
+
function b(o = {}) {
|
|
135
|
+
let { filters: c, limit: l = 20, offset: m = 0 } = o, h = i(() => c, [
|
|
113
136
|
c?.status,
|
|
114
137
|
c?.priority,
|
|
115
|
-
c?.orderType,
|
|
116
138
|
c?.customerId,
|
|
117
139
|
c?.driverId,
|
|
118
140
|
c?.unassigned
|
|
119
|
-
]), { apiGatewayUrl:
|
|
120
|
-
apiGatewayUrl:
|
|
121
|
-
authToken:
|
|
122
|
-
workspaceToken:
|
|
123
|
-
workspaceId:
|
|
124
|
-
tenantId:
|
|
125
|
-
actorId:
|
|
141
|
+
]), { apiGatewayUrl: v, authToken: b, workspaceToken: x, workspaceId: S, tenantId: C, currentUser: w } = e(), [T, E] = a([]), [D, O] = a(!1), [k, A] = a(!1), [j, M] = a(null), N = i(() => ({
|
|
142
|
+
apiGatewayUrl: v,
|
|
143
|
+
authToken: b,
|
|
144
|
+
workspaceToken: x,
|
|
145
|
+
workspaceId: S,
|
|
146
|
+
tenantId: C,
|
|
147
|
+
actorId: w?.id
|
|
126
148
|
}), [
|
|
127
|
-
|
|
149
|
+
v,
|
|
150
|
+
b,
|
|
128
151
|
x,
|
|
129
152
|
S,
|
|
130
153
|
C,
|
|
131
|
-
w
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
j(!0), N(null);
|
|
154
|
+
w?.id
|
|
155
|
+
]), P = n(async () => {
|
|
156
|
+
A(!0), M(null);
|
|
135
157
|
try {
|
|
136
|
-
let e = (await t(
|
|
158
|
+
let e = (await t(N, s, {
|
|
137
159
|
filter: {
|
|
138
160
|
status: h?.status ? g(h.status) : void 0,
|
|
139
|
-
priority: h?.priority ?
|
|
140
|
-
orderType: h?.orderType ? _(h.orderType) : void 0,
|
|
161
|
+
priority: h?.priority ? _(h.priority) : void 0,
|
|
141
162
|
customerId: h?.customerId,
|
|
142
163
|
driverId: h?.driverId
|
|
143
164
|
},
|
|
144
165
|
pagination: {
|
|
145
|
-
limit:
|
|
166
|
+
limit: l,
|
|
146
167
|
offset: m
|
|
147
168
|
}
|
|
148
|
-
})).
|
|
149
|
-
|
|
150
|
-
let n = e.map(
|
|
151
|
-
h?.unassigned && (n = n.filter((e) => !e.driverId)),
|
|
169
|
+
})).deliveryJobs;
|
|
170
|
+
O(e.length === l);
|
|
171
|
+
let n = e.map(y);
|
|
172
|
+
h?.unassigned && (n = n.filter((e) => !e.driverId)), E(n);
|
|
152
173
|
} catch (e) {
|
|
153
|
-
|
|
174
|
+
M(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load orders"));
|
|
154
175
|
} finally {
|
|
155
|
-
|
|
176
|
+
A(!1);
|
|
156
177
|
}
|
|
157
178
|
}, [
|
|
158
179
|
h,
|
|
159
|
-
|
|
160
|
-
|
|
180
|
+
N,
|
|
181
|
+
l,
|
|
161
182
|
m
|
|
162
183
|
]);
|
|
163
184
|
r(() => {
|
|
164
|
-
|
|
165
|
-
}, [
|
|
166
|
-
let
|
|
167
|
-
|
|
168
|
-
}, [
|
|
169
|
-
let n =
|
|
170
|
-
|
|
171
|
-
orderType: _(e.orderType),
|
|
185
|
+
P();
|
|
186
|
+
}, [P]);
|
|
187
|
+
let F = n(() => {
|
|
188
|
+
P();
|
|
189
|
+
}, [P]), I = n(async (e) => {
|
|
190
|
+
let n = y((await t(N, u, { input: {
|
|
191
|
+
deliveryJobNumber: e.orderNumber ?? `ORD-${(/* @__PURE__ */ new Date()).getFullYear()}-${Date.now().toString().slice(-6)}`,
|
|
172
192
|
status: g(e.status ?? "pending"),
|
|
173
|
-
priority:
|
|
193
|
+
priority: _(e.priority),
|
|
174
194
|
customerId: e.customerId,
|
|
175
195
|
pickupAddress: e.pickupAddress ?? {},
|
|
176
196
|
deliveryAddress: e.deliveryAddress ?? {},
|
|
177
|
-
|
|
197
|
+
cargoItems: e.items ?? [],
|
|
178
198
|
pricing: e.pricing ?? null,
|
|
179
199
|
specialInstructions: e.specialInstructions,
|
|
180
200
|
trackingNumber: e.trackingNumber,
|
|
181
201
|
scheduledDelivery: e.scheduledDelivery?.toISOString(),
|
|
182
202
|
vehicleId: e.vehicleId,
|
|
183
203
|
driverId: e.driverId
|
|
184
|
-
} })).
|
|
185
|
-
return
|
|
186
|
-
}, [
|
|
187
|
-
let r =
|
|
204
|
+
} })).createDeliveryJob);
|
|
205
|
+
return E((e) => [n, ...e]), n;
|
|
206
|
+
}, [N]), L = n(async (e, n) => {
|
|
207
|
+
let r = y((await t(N, d, {
|
|
188
208
|
id: e,
|
|
189
209
|
input: {
|
|
190
|
-
orderType: n.orderType ? _(n.orderType) : void 0,
|
|
191
210
|
status: n.status ? g(n.status) : void 0,
|
|
192
|
-
priority: n.priority ?
|
|
211
|
+
priority: n.priority ? _(n.priority) : void 0,
|
|
193
212
|
customerId: n.customerId,
|
|
194
213
|
pickupAddress: n.pickupAddress,
|
|
195
214
|
deliveryAddress: n.deliveryAddress,
|
|
196
|
-
|
|
215
|
+
cargoItems: n.items,
|
|
197
216
|
pricing: n.pricing,
|
|
198
217
|
specialInstructions: n.specialInstructions,
|
|
199
218
|
trackingNumber: n.trackingNumber,
|
|
@@ -201,40 +220,40 @@ function x(s = {}) {
|
|
|
201
220
|
vehicleId: n.vehicleId,
|
|
202
221
|
driverId: n.driverId
|
|
203
222
|
}
|
|
204
|
-
})).
|
|
205
|
-
return
|
|
206
|
-
}, [
|
|
207
|
-
await t(
|
|
208
|
-
}, [
|
|
209
|
-
let r =
|
|
223
|
+
})).updateDeliveryJob);
|
|
224
|
+
return E((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
225
|
+
}, [N]), R = n(async (e) => {
|
|
226
|
+
await t(N, p, { id: e }), E((t) => t.filter((t) => t.id !== e));
|
|
227
|
+
}, [N]), z = n(async (e, n) => {
|
|
228
|
+
let r = y((await t(N, f, {
|
|
210
229
|
id: e,
|
|
211
230
|
input: { status: g(n) }
|
|
212
|
-
})).
|
|
213
|
-
return
|
|
214
|
-
}, [
|
|
231
|
+
})).updateDeliveryJobStatus);
|
|
232
|
+
return E((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
233
|
+
}, [N]);
|
|
215
234
|
return {
|
|
216
|
-
orders:
|
|
217
|
-
totalOrders:
|
|
218
|
-
hasMore:
|
|
219
|
-
isLoading:
|
|
220
|
-
error:
|
|
221
|
-
refetch:
|
|
222
|
-
createOrder:
|
|
223
|
-
updateOrder:
|
|
224
|
-
deleteOrder:
|
|
225
|
-
updateOrderStatus:
|
|
235
|
+
orders: T,
|
|
236
|
+
totalOrders: T.length,
|
|
237
|
+
hasMore: D,
|
|
238
|
+
isLoading: k,
|
|
239
|
+
error: j,
|
|
240
|
+
refetch: F,
|
|
241
|
+
createOrder: I,
|
|
242
|
+
updateOrder: L,
|
|
243
|
+
deleteOrder: R,
|
|
244
|
+
updateOrderStatus: z
|
|
226
245
|
};
|
|
227
246
|
}
|
|
228
|
-
function
|
|
229
|
-
let { apiGatewayUrl:
|
|
230
|
-
apiGatewayUrl:
|
|
247
|
+
function x(o) {
|
|
248
|
+
let { apiGatewayUrl: s, authToken: l, workspaceToken: u, workspaceId: d, tenantId: f, currentUser: p } = e(), [m, h] = a(null), [g, _] = a(!1), [v, b] = a(null), x = i(() => ({
|
|
249
|
+
apiGatewayUrl: s,
|
|
231
250
|
authToken: l,
|
|
232
251
|
workspaceToken: u,
|
|
233
252
|
workspaceId: d,
|
|
234
253
|
tenantId: f,
|
|
235
254
|
actorId: p?.id
|
|
236
255
|
}), [
|
|
237
|
-
|
|
256
|
+
s,
|
|
238
257
|
l,
|
|
239
258
|
u,
|
|
240
259
|
d,
|
|
@@ -245,12 +264,12 @@ function S(o) {
|
|
|
245
264
|
h(null);
|
|
246
265
|
return;
|
|
247
266
|
}
|
|
248
|
-
_(!0),
|
|
267
|
+
_(!0), b(null);
|
|
249
268
|
try {
|
|
250
|
-
let e = await t(x,
|
|
251
|
-
h(e.
|
|
269
|
+
let e = await t(x, c, { id: o });
|
|
270
|
+
h(e.deliveryJob ? y(e.deliveryJob) : null);
|
|
252
271
|
} catch (e) {
|
|
253
|
-
|
|
272
|
+
b(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load order"));
|
|
254
273
|
} finally {
|
|
255
274
|
_(!1);
|
|
256
275
|
}
|
|
@@ -266,8 +285,8 @@ function S(o) {
|
|
|
266
285
|
}, [S])
|
|
267
286
|
};
|
|
268
287
|
}
|
|
269
|
-
function
|
|
270
|
-
let { apiGatewayUrl: o, authToken: s, workspaceToken:
|
|
288
|
+
function S() {
|
|
289
|
+
let { apiGatewayUrl: o, authToken: s, workspaceToken: c, workspaceId: u, tenantId: d, currentUser: f } = e(), [p, m] = a(!1), [h, g] = a(null), [_, v] = a({
|
|
271
290
|
total: 0,
|
|
272
291
|
byStatus: {
|
|
273
292
|
pending: 0,
|
|
@@ -286,33 +305,33 @@ function C() {
|
|
|
286
305
|
}), y = i(() => ({
|
|
287
306
|
apiGatewayUrl: o,
|
|
288
307
|
authToken: s,
|
|
289
|
-
workspaceToken:
|
|
308
|
+
workspaceToken: c,
|
|
290
309
|
workspaceId: u,
|
|
291
310
|
tenantId: d,
|
|
292
311
|
actorId: f?.id
|
|
293
312
|
}), [
|
|
294
313
|
o,
|
|
295
314
|
s,
|
|
296
|
-
|
|
315
|
+
c,
|
|
297
316
|
u,
|
|
298
317
|
d,
|
|
299
318
|
f?.id
|
|
300
319
|
]), b = n(async () => {
|
|
301
320
|
m(!0), g(null);
|
|
302
321
|
try {
|
|
303
|
-
let e = await t(y,
|
|
322
|
+
let e = await t(y, l);
|
|
304
323
|
v({
|
|
305
|
-
total: e.
|
|
324
|
+
total: e.deliveryJobStats.total,
|
|
306
325
|
byStatus: {
|
|
307
|
-
pending: e.
|
|
326
|
+
pending: e.deliveryJobStats.pending,
|
|
308
327
|
confirmed: 0,
|
|
309
328
|
assigned: 0,
|
|
310
329
|
picked_up: 0,
|
|
311
|
-
in_transit: e.
|
|
330
|
+
in_transit: e.deliveryJobStats.inTransit,
|
|
312
331
|
out_for_delivery: 0,
|
|
313
|
-
delivered: e.
|
|
314
|
-
cancelled: e.
|
|
315
|
-
failed: e.
|
|
332
|
+
delivered: e.deliveryJobStats.delivered,
|
|
333
|
+
cancelled: e.deliveryJobStats.cancelled,
|
|
334
|
+
failed: e.deliveryJobStats.failed
|
|
316
335
|
},
|
|
317
336
|
totalRevenue: e.financeMetrics.revenue.totalRevenue,
|
|
318
337
|
todayOrders: 0,
|
|
@@ -333,4 +352,4 @@ function C() {
|
|
|
333
352
|
};
|
|
334
353
|
}
|
|
335
354
|
//#endregion
|
|
336
|
-
export {
|
|
355
|
+
export { x as useOrder, S as useOrderStats, b as useOrders };
|
|
@@ -214,7 +214,6 @@ export interface Order {
|
|
|
214
214
|
};
|
|
215
215
|
items: OrderItem[];
|
|
216
216
|
status: OrderStatus;
|
|
217
|
-
orderType: 'b2b' | 'b2c';
|
|
218
217
|
priority: 'low' | 'normal' | 'high' | 'urgent';
|
|
219
218
|
pickupAddress: Address;
|
|
220
219
|
deliveryAddress: Address;
|
|
@@ -640,10 +639,9 @@ export interface OrderFilter {
|
|
|
640
639
|
dateFrom?: Date;
|
|
641
640
|
dateTo?: Date;
|
|
642
641
|
priority?: string;
|
|
643
|
-
orderType?: 'b2b' | 'b2c';
|
|
644
642
|
/**
|
|
645
643
|
* Client-side quick filter for orders that still need a driver assigned
|
|
646
|
-
* (driverId is null). The backend
|
|
644
|
+
* (driverId is null). The backend DeliveryJobFilterInput has no null-driver
|
|
647
645
|
* predicate, so this is applied to the fetched page after mapping.
|
|
648
646
|
*/
|
|
649
647
|
unassigned?: boolean;
|