@burdenoff/microfe-movethewheels 2026.1117.1 → 2026.1123.2
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 +149 -133
- package/dist/MoveTheWheelsRoutes.js +157 -139
- package/dist/components/EntityConversationsCard.js +145 -0
- package/dist/components/maps/MapCanvas.js +4 -3
- package/dist/events/rybbit.js +87 -0
- package/dist/generated/tracking-quality-operations.d.ts +342 -0
- package/dist/hooks/useEntityComments.js +111 -0
- package/dist/hooks/useFleet.js +394 -311
- package/dist/hooks/useInventory.js +378 -313
- package/dist/hooks/useMultiModalShipments.js +58 -53
- package/dist/hooks/useOrders.js +178 -158
- package/dist/hooks/useRoutes.js +146 -130
- package/dist/index.js +35 -34
- package/dist/movethewheels/components/EntityConversationsCard.d.ts +8 -0
- package/dist/movethewheels/events/rybbit.d.ts +27 -0
- package/dist/movethewheels/hooks/useEntityComments.d.ts +26 -0
- package/dist/movethewheels/hooks/useFleet.d.ts +73 -1
- package/dist/movethewheels/hooks/useInventory.d.ts +19 -0
- package/dist/movethewheels/index.d.ts +1 -0
- package/dist/movethewheels/pages/DocumentsLibraryPage.d.ts +1 -0
- package/dist/movethewheels/pages/NotificationsCenterPage.d.ts +1 -0
- package/dist/movethewheels/types/index.d.ts +95 -2
- package/dist/node_modules/lucide-react/dist/esm/icons/check-check.js +10 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/layers.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/message-square.js +7 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/send.js +10 -0
- package/dist/pages/DocumentsLibraryPage.js +235 -0
- package/dist/pages/DriverDetailsPage.js +625 -351
- package/dist/pages/NotificationsCenterPage.js +310 -0
- package/dist/pages/OrderDetailsPage.js +48 -42
- package/dist/pages/RouteDetailsPage.js +257 -251
- package/dist/pages/TrackingPage.js +202 -196
- package/dist/pages/VehicleDetailsPage.js +616 -314
- package/dist/pages/WarehouseDetailsPage.js +539 -253
- package/dist/stories/ControlTowerWidgets.stories.d.ts +10 -0
- package/dist/stories/DataTable.stories.d.ts +15 -0
- package/dist/stories/FleetCards.stories.d.ts +9 -0
- package/dist/stories/OrderForms.stories.d.ts +8 -0
- package/dist/stories/RouteMap.stories.d.ts +7 -0
- package/dist/stories/ShipmentTimeline.stories.d.ts +6 -0
- package/package.json +1 -1
- package/src/generated/tracking-quality-operations.ts +407 -0
- package/src/movethewheels/MoveTheWheelsRoot.tsx +16 -0
- package/src/movethewheels/MoveTheWheelsRoutes.tsx +17 -2
- package/src/movethewheels/components/EntityConversationsCard.tsx +143 -0
- package/src/movethewheels/components/maps/MapCanvas.tsx +3 -3
- package/src/movethewheels/events/__tests__/rybbit.test.ts +98 -0
- package/src/movethewheels/events/rybbit.ts +191 -0
- package/src/movethewheels/hooks/useEntityComments.ts +258 -0
- package/src/movethewheels/hooks/useFleet.ts +300 -5
- package/src/movethewheels/hooks/useInventory.ts +231 -3
- package/src/movethewheels/hooks/useMultiModalShipments.ts +8 -1
- package/src/movethewheels/hooks/useOrders.ts +19 -3
- package/src/movethewheels/hooks/useRoutes.ts +14 -2
- package/src/movethewheels/index.ts +1 -0
- package/src/movethewheels/pages/DocumentsLibraryPage.tsx +229 -0
- package/src/movethewheels/pages/DriverDetailsPage.tsx +250 -1
- package/src/movethewheels/pages/NotificationsCenterPage.tsx +331 -0
- package/src/movethewheels/pages/OrderDetailsPage.tsx +8 -0
- package/src/movethewheels/pages/RouteDetailsPage.tsx +6 -0
- package/src/movethewheels/pages/TrackingPage.tsx +8 -0
- package/src/movethewheels/pages/VehicleDetailsPage.tsx +255 -1
- package/src/movethewheels/pages/WarehouseDetailsPage.tsx +266 -2
- package/src/movethewheels/types/index.ts +103 -2
- package/src/stories/ControlTowerWidgets.stories.tsx +150 -0
- package/src/stories/DataTable.stories.tsx +94 -0
- package/src/stories/FleetCards.stories.tsx +77 -0
- package/src/stories/OrderForms.stories.tsx +84 -0
- package/src/stories/RouteMap.stories.tsx +43 -0
- package/src/stories/ShipmentTimeline.stories.tsx +128 -0
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import e from "../node_modules/lucide-react/dist/esm/icons/bell.js";
|
|
2
|
+
import t from "../node_modules/lucide-react/dist/esm/icons/check.js";
|
|
3
|
+
import n from "../node_modules/lucide-react/dist/esm/icons/check-check.js";
|
|
4
|
+
import r from "../node_modules/lucide-react/dist/esm/icons/external-link.js";
|
|
5
|
+
import i from "../node_modules/lucide-react/dist/esm/icons/refresh-cw.js";
|
|
6
|
+
import a from "../node_modules/lucide-react/dist/esm/icons/settings.js";
|
|
7
|
+
import o from "../node_modules/lucide-react/dist/esm/icons/trash-2.js";
|
|
8
|
+
import { PageLayout as s } from "../components/PageLayout.js";
|
|
9
|
+
import { Badge as c, Button as l, Card as u, CardContent as d, CardHeader as f, CardTitle as p } from "../components/ui.js";
|
|
10
|
+
import { useMoveTheWheels as m } from "../providers/MoveTheWheelsProvider.js";
|
|
11
|
+
import { formatDate as h } from "../utils/formatters.js";
|
|
12
|
+
import { useCallback as g, useEffect as _, useState as v } from "react";
|
|
13
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
14
|
+
import { useSafeGatewayClient as x } from "@burdenoff/fe-libs/shared/graphql";
|
|
15
|
+
import { gql as S } from "@apollo/client";
|
|
16
|
+
// src/movethewheels/pages/NotificationsCenterPage.tsx
|
|
17
|
+
var C = { preferWorkspaceAuth: !0 }, w = S`
|
|
18
|
+
query MtwGetNotifications($filter: NotificationFilterInput, $limit: Int, $offset: Int) {
|
|
19
|
+
notifications(filter: $filter, limit: $limit, offset: $offset) {
|
|
20
|
+
items {
|
|
21
|
+
id
|
|
22
|
+
title
|
|
23
|
+
message
|
|
24
|
+
type
|
|
25
|
+
priority
|
|
26
|
+
appName
|
|
27
|
+
redirectUrl
|
|
28
|
+
isRead
|
|
29
|
+
readAt
|
|
30
|
+
createdAt
|
|
31
|
+
}
|
|
32
|
+
total
|
|
33
|
+
hasMore
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`, T = S`
|
|
37
|
+
query MtwUnreadNotificationCount($filter: NotificationFilterInput) {
|
|
38
|
+
myUnreadNotificationCount(filter: $filter)
|
|
39
|
+
}
|
|
40
|
+
`, E = S`
|
|
41
|
+
mutation MtwMarkNotificationRead($id: ID!) {
|
|
42
|
+
markNotificationAsRead(id: $id) {
|
|
43
|
+
id
|
|
44
|
+
isRead
|
|
45
|
+
readAt
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`, D = S`
|
|
49
|
+
mutation MtwMarkAllNotificationsRead {
|
|
50
|
+
markAllMyNotificationsAsRead {
|
|
51
|
+
success
|
|
52
|
+
count
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`, O = S`
|
|
56
|
+
mutation MtwDeleteNotification($id: ID!) {
|
|
57
|
+
deleteNotification(id: $id)
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
function k() {
|
|
61
|
+
let S = x("global"), { navigate: k, workspaceId: A } = m(), [j, M] = v("all"), [N, P] = v(!1), [F, I] = v([]), [L, R] = v(0), [z, B] = v(0), [V, H] = v(!1), [U, W] = v(null), G = g(async () => {
|
|
62
|
+
if (!S) I([]), B(0), R(0);
|
|
63
|
+
else {
|
|
64
|
+
H(!0), W(null);
|
|
65
|
+
try {
|
|
66
|
+
let e = {
|
|
67
|
+
channel: "IN_APP",
|
|
68
|
+
archived: !1
|
|
69
|
+
};
|
|
70
|
+
j === "unread" && (e.isRead = !1), j === "read" && (e.isRead = !0), N && (e.appName = "movethewheels");
|
|
71
|
+
let [t, n] = await Promise.all([S.query({
|
|
72
|
+
context: C,
|
|
73
|
+
query: w,
|
|
74
|
+
variables: {
|
|
75
|
+
filter: e,
|
|
76
|
+
limit: 30,
|
|
77
|
+
offset: 0
|
|
78
|
+
},
|
|
79
|
+
fetchPolicy: "network-only"
|
|
80
|
+
}), S.query({
|
|
81
|
+
context: C,
|
|
82
|
+
query: T,
|
|
83
|
+
variables: { filter: N ? {
|
|
84
|
+
channel: "IN_APP",
|
|
85
|
+
archived: !1,
|
|
86
|
+
appName: "movethewheels"
|
|
87
|
+
} : {
|
|
88
|
+
channel: "IN_APP",
|
|
89
|
+
archived: !1
|
|
90
|
+
} },
|
|
91
|
+
fetchPolicy: "network-only"
|
|
92
|
+
})]);
|
|
93
|
+
I(t.data?.notifications?.items ?? []), B(t.data?.notifications?.total ?? 0), R(n.data?.myUnreadNotificationCount ?? 0);
|
|
94
|
+
} catch (e) {
|
|
95
|
+
W(e instanceof Error ? e.message : "Failed to load notifications.");
|
|
96
|
+
} finally {
|
|
97
|
+
H(!1);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}, [
|
|
101
|
+
j,
|
|
102
|
+
S,
|
|
103
|
+
N
|
|
104
|
+
]);
|
|
105
|
+
_(() => {
|
|
106
|
+
G();
|
|
107
|
+
}, [G, A]);
|
|
108
|
+
let K = async (e) => {
|
|
109
|
+
S && (await S.mutate({
|
|
110
|
+
context: C,
|
|
111
|
+
mutation: E,
|
|
112
|
+
variables: { id: e }
|
|
113
|
+
}), I((t) => t.map((t) => t.id === e ? {
|
|
114
|
+
...t,
|
|
115
|
+
isRead: !0,
|
|
116
|
+
readAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
117
|
+
} : t)), R((e) => Math.max(0, e - 1)));
|
|
118
|
+
}, q = async () => {
|
|
119
|
+
S && (await S.mutate({
|
|
120
|
+
context: C,
|
|
121
|
+
mutation: D
|
|
122
|
+
}), I((e) => e.map((e) => ({
|
|
123
|
+
...e,
|
|
124
|
+
isRead: !0,
|
|
125
|
+
readAt: e.readAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
126
|
+
}))), R(0));
|
|
127
|
+
}, J = async (e) => {
|
|
128
|
+
if (!S) return;
|
|
129
|
+
let t = F.find((t) => t.id === e);
|
|
130
|
+
await S.mutate({
|
|
131
|
+
context: C,
|
|
132
|
+
mutation: O,
|
|
133
|
+
variables: { id: e }
|
|
134
|
+
}), I((t) => t.filter((t) => t.id !== e)), B((e) => Math.max(0, e - 1)), t && !t.isRead && R((e) => Math.max(0, e - 1));
|
|
135
|
+
};
|
|
136
|
+
return /* @__PURE__ */ y(s, {
|
|
137
|
+
title: "Notifications",
|
|
138
|
+
subtitle: "Workspace shipment alerts, delivery updates, and operational notices",
|
|
139
|
+
icon: /* @__PURE__ */ y(e, { size: 24 }),
|
|
140
|
+
headerActions: /* @__PURE__ */ b("div", {
|
|
141
|
+
className: "flex flex-wrap gap-2",
|
|
142
|
+
children: [
|
|
143
|
+
/* @__PURE__ */ b(l, {
|
|
144
|
+
variant: "outline",
|
|
145
|
+
size: "sm",
|
|
146
|
+
onClick: () => void G(),
|
|
147
|
+
disabled: V,
|
|
148
|
+
children: [/* @__PURE__ */ y(i, {
|
|
149
|
+
size: 14,
|
|
150
|
+
"aria-hidden": "true"
|
|
151
|
+
}), " Refresh"]
|
|
152
|
+
}),
|
|
153
|
+
L > 0 && /* @__PURE__ */ b(l, {
|
|
154
|
+
variant: "outline",
|
|
155
|
+
size: "sm",
|
|
156
|
+
onClick: () => void q(),
|
|
157
|
+
children: [/* @__PURE__ */ y(n, {
|
|
158
|
+
size: 14,
|
|
159
|
+
"aria-hidden": "true"
|
|
160
|
+
}), " Mark all read"]
|
|
161
|
+
}),
|
|
162
|
+
/* @__PURE__ */ b(l, {
|
|
163
|
+
variant: "outline",
|
|
164
|
+
size: "sm",
|
|
165
|
+
onClick: () => k("/notifications/preferences"),
|
|
166
|
+
children: [/* @__PURE__ */ y(a, {
|
|
167
|
+
size: 14,
|
|
168
|
+
"aria-hidden": "true"
|
|
169
|
+
}), " Preferences"]
|
|
170
|
+
})
|
|
171
|
+
]
|
|
172
|
+
}),
|
|
173
|
+
children: /* @__PURE__ */ b("div", {
|
|
174
|
+
className: "space-y-6",
|
|
175
|
+
children: [/* @__PURE__ */ b("div", {
|
|
176
|
+
className: "flex flex-wrap items-center justify-between gap-3",
|
|
177
|
+
children: [/* @__PURE__ */ y("div", {
|
|
178
|
+
className: "flex gap-2",
|
|
179
|
+
role: "tablist",
|
|
180
|
+
"aria-label": "Notification read status",
|
|
181
|
+
children: [
|
|
182
|
+
"all",
|
|
183
|
+
"unread",
|
|
184
|
+
"read"
|
|
185
|
+
].map((e) => /* @__PURE__ */ b(l, {
|
|
186
|
+
type: "button",
|
|
187
|
+
role: "tab",
|
|
188
|
+
"aria-selected": j === e,
|
|
189
|
+
variant: j === e ? "default" : "outline",
|
|
190
|
+
size: "sm",
|
|
191
|
+
className: "capitalize",
|
|
192
|
+
onClick: () => M(e),
|
|
193
|
+
children: [e, e === "unread" && L > 0 ? ` (${L})` : ""]
|
|
194
|
+
}, e))
|
|
195
|
+
}), /* @__PURE__ */ b("div", {
|
|
196
|
+
className: "flex items-center gap-2",
|
|
197
|
+
children: [/* @__PURE__ */ y(l, {
|
|
198
|
+
type: "button",
|
|
199
|
+
variant: N ? "default" : "outline",
|
|
200
|
+
size: "sm",
|
|
201
|
+
onClick: () => P((e) => !e),
|
|
202
|
+
children: N ? "Showing: MoveTheWheels only" : "Showing: All workspace alerts"
|
|
203
|
+
}), /* @__PURE__ */ b(l, {
|
|
204
|
+
variant: "ghost",
|
|
205
|
+
size: "sm",
|
|
206
|
+
onClick: () => k("/notifications"),
|
|
207
|
+
children: [/* @__PURE__ */ y(r, {
|
|
208
|
+
size: 14,
|
|
209
|
+
"aria-hidden": "true"
|
|
210
|
+
}), " Platform inbox"]
|
|
211
|
+
})]
|
|
212
|
+
})]
|
|
213
|
+
}), /* @__PURE__ */ b(u, { children: [/* @__PURE__ */ y(f, { children: /* @__PURE__ */ b(p, {
|
|
214
|
+
className: "flex items-center gap-2",
|
|
215
|
+
children: [
|
|
216
|
+
/* @__PURE__ */ y(e, {
|
|
217
|
+
size: 18,
|
|
218
|
+
"aria-hidden": "true"
|
|
219
|
+
}),
|
|
220
|
+
"Inbox",
|
|
221
|
+
/* @__PURE__ */ y(c, {
|
|
222
|
+
variant: "secondary",
|
|
223
|
+
children: z
|
|
224
|
+
})
|
|
225
|
+
]
|
|
226
|
+
}) }), /* @__PURE__ */ b(d, { children: [U && /* @__PURE__ */ y("p", {
|
|
227
|
+
className: "text-sm text-status-error-text mb-3",
|
|
228
|
+
children: U
|
|
229
|
+
}), V ? /* @__PURE__ */ y("p", {
|
|
230
|
+
className: "text-sm text-text-secondary py-6 text-center",
|
|
231
|
+
children: "Loading notifications…"
|
|
232
|
+
}) : F.length === 0 ? /* @__PURE__ */ b("div", {
|
|
233
|
+
className: "py-10 text-center space-y-2",
|
|
234
|
+
children: [/* @__PURE__ */ y(e, {
|
|
235
|
+
size: 32,
|
|
236
|
+
className: "mx-auto text-text-secondary opacity-50"
|
|
237
|
+
}), /* @__PURE__ */ y("p", {
|
|
238
|
+
className: "text-sm text-text-secondary",
|
|
239
|
+
children: j === "unread" ? "You are all caught up — no unread notifications." : "No notifications match this filter."
|
|
240
|
+
})]
|
|
241
|
+
}) : /* @__PURE__ */ y("ul", {
|
|
242
|
+
className: "divide-y divide-border-seam",
|
|
243
|
+
children: F.map((e) => /* @__PURE__ */ b("li", {
|
|
244
|
+
className: `flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 py-3 ${e.isRead ? "opacity-80" : ""}`,
|
|
245
|
+
children: [/* @__PURE__ */ b("div", {
|
|
246
|
+
className: "min-w-0 space-y-1",
|
|
247
|
+
children: [
|
|
248
|
+
/* @__PURE__ */ b("div", {
|
|
249
|
+
className: "flex flex-wrap items-center gap-2",
|
|
250
|
+
children: [
|
|
251
|
+
!e.isRead && /* @__PURE__ */ y("span", {
|
|
252
|
+
className: "inline-block h-2 w-2 rounded-full bg-action-primary-bg",
|
|
253
|
+
"aria-label": "Unread"
|
|
254
|
+
}),
|
|
255
|
+
/* @__PURE__ */ y("p", {
|
|
256
|
+
className: "font-medium text-text-primary",
|
|
257
|
+
children: e.title
|
|
258
|
+
}),
|
|
259
|
+
e.appName && /* @__PURE__ */ y(c, {
|
|
260
|
+
variant: "outline",
|
|
261
|
+
children: e.appName
|
|
262
|
+
})
|
|
263
|
+
]
|
|
264
|
+
}),
|
|
265
|
+
/* @__PURE__ */ y("p", {
|
|
266
|
+
className: "text-sm text-text-secondary",
|
|
267
|
+
children: e.message
|
|
268
|
+
}),
|
|
269
|
+
/* @__PURE__ */ y("p", {
|
|
270
|
+
className: "text-xs text-text-secondary",
|
|
271
|
+
children: h(new Date(e.createdAt), "relative")
|
|
272
|
+
})
|
|
273
|
+
]
|
|
274
|
+
}), /* @__PURE__ */ b("div", {
|
|
275
|
+
className: "flex items-center gap-1 shrink-0",
|
|
276
|
+
children: [
|
|
277
|
+
e.redirectUrl && /* @__PURE__ */ y(l, {
|
|
278
|
+
variant: "ghost",
|
|
279
|
+
size: "sm",
|
|
280
|
+
onClick: () => k(e.redirectUrl),
|
|
281
|
+
children: "Open"
|
|
282
|
+
}),
|
|
283
|
+
!e.isRead && /* @__PURE__ */ b(l, {
|
|
284
|
+
variant: "ghost",
|
|
285
|
+
size: "sm",
|
|
286
|
+
onClick: () => void K(e.id),
|
|
287
|
+
children: [/* @__PURE__ */ y(t, {
|
|
288
|
+
size: 14,
|
|
289
|
+
"aria-hidden": "true"
|
|
290
|
+
}), " Mark read"]
|
|
291
|
+
}),
|
|
292
|
+
/* @__PURE__ */ y(l, {
|
|
293
|
+
variant: "ghost",
|
|
294
|
+
size: "sm",
|
|
295
|
+
className: "text-status-error-text",
|
|
296
|
+
"aria-label": `Delete notification ${e.title}`,
|
|
297
|
+
onClick: () => void J(e.id),
|
|
298
|
+
children: /* @__PURE__ */ y(o, {
|
|
299
|
+
size: 14,
|
|
300
|
+
"aria-hidden": "true"
|
|
301
|
+
})
|
|
302
|
+
})
|
|
303
|
+
]
|
|
304
|
+
})]
|
|
305
|
+
}, e.id))
|
|
306
|
+
})] })] })]
|
|
307
|
+
})
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
export { k as default };
|
|
@@ -29,14 +29,15 @@ import { isVehicleAssignable as g } from "../utils/orderVehicleHold.js";
|
|
|
29
29
|
import { reuseRecoveryContextKey as _, reuseRecoveryScope as v } from "../utils/reuseRecovery.js";
|
|
30
30
|
import { useTr as Ne } from "../shared/hooks/useTr.js";
|
|
31
31
|
import { DocumentsCard as Pe } from "../components/DocumentsCard.js";
|
|
32
|
-
import {
|
|
32
|
+
import { EntityConversationsCard as Fe } from "../components/EntityConversationsCard.js";
|
|
33
|
+
import { ProofOfDeliveryCard as Ie } from "../components/ProofOfDeliveryCard.js";
|
|
33
34
|
import { useMoveTheWheels as y } from "../providers/MoveTheWheelsProvider.js";
|
|
34
35
|
import { formatAddress as b, formatCurrency as x, formatDate as S } from "../utils/formatters.js";
|
|
35
36
|
import { joinPath as C } from "../utils/navigation.js";
|
|
36
37
|
import { useState as w } from "react";
|
|
37
38
|
import { useParams as T } from "react-router";
|
|
38
39
|
import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
39
|
-
import { EmphasisPanel as
|
|
40
|
+
import { EmphasisPanel as Le, NextSteps as Re, PagePurpose as ze } from "@burdenoff/fe-libs/ui";
|
|
40
41
|
// src/movethewheels/pages/OrderDetailsPage.tsx
|
|
41
42
|
var k = [
|
|
42
43
|
"pending",
|
|
@@ -46,7 +47,7 @@ var k = [
|
|
|
46
47
|
"in_transit",
|
|
47
48
|
"out_for_delivery",
|
|
48
49
|
"delivered"
|
|
49
|
-
],
|
|
50
|
+
], Be = {
|
|
50
51
|
pending: "Pending",
|
|
51
52
|
confirmed: "Confirmed",
|
|
52
53
|
assigned: "Assigned",
|
|
@@ -57,13 +58,13 @@ var k = [
|
|
|
57
58
|
returned: "Returned",
|
|
58
59
|
cancelled: "Cancelled",
|
|
59
60
|
failed: "Failed"
|
|
60
|
-
},
|
|
61
|
+
}, Ve = /* @__PURE__ */ new Set([
|
|
61
62
|
"delivered",
|
|
62
63
|
"returned",
|
|
63
64
|
"cancelled",
|
|
64
65
|
"failed"
|
|
65
66
|
]);
|
|
66
|
-
function
|
|
67
|
+
function He(e) {
|
|
67
68
|
let t = k.indexOf(e);
|
|
68
69
|
return t === -1 || t >= k.length - 1 ? null : k[t + 1];
|
|
69
70
|
}
|
|
@@ -82,24 +83,24 @@ function A() {
|
|
|
82
83
|
}, r);
|
|
83
84
|
}
|
|
84
85
|
function j({ contextKey: _, contextReady: v }) {
|
|
85
|
-
let k = Ne(), { orderId: A } = T(), { basePath: j, navigate: M } = y(), { order: N, isLoading: P, error: F, refetch:
|
|
86
|
+
let k = Ne(), { orderId: A } = T(), { basePath: j, navigate: M } = y(), { order: N, isLoading: P, error: F, refetch: Ue } = we(A), { updateOrder: We, updateOrderStatus: Ge } = Te(), [I, Ke] = w(""), [qe, Je] = w(""), [Ye, Xe] = w(""), Ze = Ae(I), { vehicles: Qe, isLoading: L, isLoadingMore: $e, hasMore: et, totalVehicles: tt, error: R, refetch: nt, loadMore: rt } = ke({
|
|
86
87
|
limit: 20,
|
|
87
88
|
search: Ze || void 0
|
|
88
|
-
}), { drivers: it, isLoading:
|
|
89
|
+
}), { drivers: it, isLoading: z, isLoadingMore: at, hasMore: ot, totalDrivers: st, error: B, refetch: ct, loadMore: lt } = De({
|
|
89
90
|
limit: 20,
|
|
90
91
|
search: Ze || void 0
|
|
91
|
-
}), { vehicle:
|
|
92
|
-
|
|
92
|
+
}), { vehicle: V, isLoading: ut, error: dt, refetch: ft } = Oe(qe || N?.vehicleId || void 0), { driver: H, isLoading: pt, error: mt, refetch: ht } = Ee(Ye || N?.driverId || void 0), gt = Qe.filter((e) => g(e.status) || e.id === N?.vehicleId), _t = it.filter((e) => e.status === "available" || e.id === N?.driverId), { vehicle: U, isLoading: vt, error: yt, refetch: bt } = Oe(N?.vehicleId), W = !N?.vehicleId || !vt && !yt && U?.id === N.vehicleId, G = !!(N?.vehicleId && W && U && !g(U.status)), K = qe || N?.vehicleId, q = Ye || N?.driverId, J = !K || !ut && !dt && V?.id === K, Y = !q || !pt && !mt && H?.id === q, xt = !!(K && J && V && !g(V.status)), St = !(!N || N.vehicleId && N.driverId || N.status !== "confirmed"), Ct = xt && (K !== N?.vehicleId || St), wt = () => {
|
|
93
|
+
Ue(), ft(), bt(), ht(), nt(), ct();
|
|
93
94
|
}, X = Me({
|
|
94
95
|
order: N,
|
|
95
96
|
contextKey: _,
|
|
96
97
|
ready: v && !P && !F && !!N,
|
|
97
|
-
assignmentReady: !!(
|
|
98
|
-
movementReady:
|
|
99
|
-
updateOrder:
|
|
100
|
-
updateOrderStatus:
|
|
101
|
-
refresh:
|
|
102
|
-
}),
|
|
98
|
+
assignmentReady: !!(K && q) && J && Y && !Ct && !L && !z && !R && !B,
|
|
99
|
+
movementReady: W && !G,
|
|
100
|
+
updateOrder: We,
|
|
101
|
+
updateOrderStatus: Ge,
|
|
102
|
+
refresh: wt
|
|
103
|
+
}), Tt = K !== N?.vehicleId || q !== N?.driverId, Z = X.busy || X.blocked || !v || P || !!F, Et = () => X.assign(K ?? "", q ?? ""), Q = (e) => X.changeStatus(e), Dt = V?.status === "maintenance" ? k("movethewheels.order.vehicleMaintenance", "Vehicle marked for maintenance. Choose another vehicle.") : V?.status === "decommissioned" ? k("movethewheels.order.vehicleDecommissioned", "Vehicle decommissioned. Choose another vehicle.") : k("movethewheels.order.vehicleInactive", "Vehicle marked inactive. Choose another vehicle."), $ = (e) => {
|
|
103
104
|
M && M(C(j, e));
|
|
104
105
|
};
|
|
105
106
|
return P && !N ? /* @__PURE__ */ D(me, { message: "Loading order details..." }) : N ? /* @__PURE__ */ O(he, {
|
|
@@ -139,11 +140,11 @@ function j({ contextKey: _, contextReady: v }) {
|
|
|
139
140
|
]
|
|
140
141
|
}),
|
|
141
142
|
children: [
|
|
142
|
-
/* @__PURE__ */ D(
|
|
143
|
+
/* @__PURE__ */ D(ze, {
|
|
143
144
|
icon: /* @__PURE__ */ D(e, { size: 18 }),
|
|
144
145
|
children: "Everything about this one delivery in a single place — who it's for, where it's going, what's inside, the running cost and the full status history. Use this page to review the order, hand it to a driver, print the docket, or jump into live tracking."
|
|
145
146
|
}),
|
|
146
|
-
/* @__PURE__ */ D(
|
|
147
|
+
/* @__PURE__ */ D(Re, {
|
|
147
148
|
storageKey: "movethewheels-order-details",
|
|
148
149
|
steps: [
|
|
149
150
|
{
|
|
@@ -417,7 +418,7 @@ function j({ contextKey: _, contextReady: v }) {
|
|
|
417
418
|
}), /* @__PURE__ */ O("div", {
|
|
418
419
|
className: "space-y-6",
|
|
419
420
|
children: [
|
|
420
|
-
/* @__PURE__ */ O(
|
|
421
|
+
/* @__PURE__ */ O(Le, { children: [/* @__PURE__ */ O("h2", {
|
|
421
422
|
className: "flex items-center gap-2 text-base font-semibold text-text-primary mb-4",
|
|
422
423
|
children: [/* @__PURE__ */ D(ne, { size: 18 }), "Order Summary"]
|
|
423
424
|
}), /* @__PURE__ */ O("div", {
|
|
@@ -498,16 +499,16 @@ function j({ contextKey: _, contextReady: v }) {
|
|
|
498
499
|
className: "text-sm break-words",
|
|
499
500
|
role: "status",
|
|
500
501
|
children: k("movethewheels.order.knownAssignment", "Saved assignment: vehicle {{vehicle}}, driver {{driver}}.", {
|
|
501
|
-
vehicle:
|
|
502
|
-
driver:
|
|
502
|
+
vehicle: V?.id === X.knownAssignment.vehicleId ? V.vehicleNumber : X.knownAssignment.vehicleId,
|
|
503
|
+
driver: H?.id === X.knownAssignment.driverId ? H.fullName : X.knownAssignment.driverId
|
|
503
504
|
})
|
|
504
505
|
}),
|
|
505
506
|
X.blocked && /* @__PURE__ */ D(h, { message: k("movethewheels.order.blocked", "An order write is unconfirmed. Refresh is read-only and will not unlock another write.") }),
|
|
506
|
-
xt && /* @__PURE__ */ D(h, { message:
|
|
507
|
-
(!
|
|
507
|
+
xt && /* @__PURE__ */ D(h, { message: Dt }),
|
|
508
|
+
(!J || !Y || !W || R || B) && /* @__PURE__ */ D(h, { message: k("movethewheels.order.unverifiedFleet", "Vehicle status could not be verified. Refresh before assigning or advancing.") }),
|
|
508
509
|
/* @__PURE__ */ D(o, {
|
|
509
510
|
variant: "outline",
|
|
510
|
-
onClick:
|
|
511
|
+
onClick: wt,
|
|
511
512
|
disabled: X.busy,
|
|
512
513
|
children: k("movethewheels.order.refreshAssignment", "Refresh assignment")
|
|
513
514
|
}),
|
|
@@ -531,7 +532,7 @@ function j({ contextKey: _, contextReady: v }) {
|
|
|
531
532
|
className: "relative",
|
|
532
533
|
children: [/* @__PURE__ */ D(fe, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ D(ve, {
|
|
533
534
|
id: "assign-fleet-search",
|
|
534
|
-
value:
|
|
535
|
+
value: I,
|
|
535
536
|
disabled: Z,
|
|
536
537
|
onChange: (e) => Ke(e.target.value),
|
|
537
538
|
placeholder: "Vehicle number, driver name or employee ID",
|
|
@@ -547,10 +548,10 @@ function j({ contextKey: _, contextReady: v }) {
|
|
|
547
548
|
}), /* @__PURE__ */ D(Ce, {
|
|
548
549
|
id: "assign-vehicle",
|
|
549
550
|
disabled: Z,
|
|
550
|
-
value:
|
|
551
|
+
value: K ?? "",
|
|
551
552
|
onChange: Je,
|
|
552
553
|
options: gt,
|
|
553
|
-
loading:
|
|
554
|
+
loading: L,
|
|
554
555
|
getId: (e) => e.id,
|
|
555
556
|
getLabel: (e) => `${e.vehicleNumber} (${e.type})`,
|
|
556
557
|
renderOption: (e) => /* @__PURE__ */ O(E, { children: [
|
|
@@ -559,8 +560,8 @@ function j({ contextKey: _, contextReady: v }) {
|
|
|
559
560
|
e.type,
|
|
560
561
|
")"
|
|
561
562
|
] }),
|
|
562
|
-
selectedOption:
|
|
563
|
-
selectedLoading: !
|
|
563
|
+
selectedOption: J ? V : null,
|
|
564
|
+
selectedLoading: !J,
|
|
564
565
|
hasMore: et,
|
|
565
566
|
totalCount: tt,
|
|
566
567
|
onLoadMore: rt,
|
|
@@ -578,10 +579,10 @@ function j({ contextKey: _, contextReady: v }) {
|
|
|
578
579
|
}), /* @__PURE__ */ D(Ce, {
|
|
579
580
|
id: "assign-driver",
|
|
580
581
|
disabled: Z,
|
|
581
|
-
value:
|
|
582
|
+
value: q ?? "",
|
|
582
583
|
onChange: Xe,
|
|
583
584
|
options: _t,
|
|
584
|
-
loading:
|
|
585
|
+
loading: z,
|
|
585
586
|
getId: (e) => e.id,
|
|
586
587
|
getLabel: (e) => `${e.fullName} (${e.employeeId})`,
|
|
587
588
|
renderOption: (e) => /* @__PURE__ */ O(E, { children: [
|
|
@@ -590,8 +591,8 @@ function j({ contextKey: _, contextReady: v }) {
|
|
|
590
591
|
e.employeeId,
|
|
591
592
|
")"
|
|
592
593
|
] }),
|
|
593
|
-
selectedOption:
|
|
594
|
-
selectedLoading: !
|
|
594
|
+
selectedOption: Y ? H : null,
|
|
595
|
+
selectedLoading: !Y,
|
|
595
596
|
hasMore: ot,
|
|
596
597
|
totalCount: st,
|
|
597
598
|
onLoadMore: lt,
|
|
@@ -603,8 +604,8 @@ function j({ contextKey: _, contextReady: v }) {
|
|
|
603
604
|
}),
|
|
604
605
|
/* @__PURE__ */ O(o, {
|
|
605
606
|
className: "w-full",
|
|
606
|
-
onClick:
|
|
607
|
-
disabled: Z || !
|
|
607
|
+
onClick: Et,
|
|
608
|
+
disabled: Z || !Tt || Ct || !J || !Y || L || z || !!(R || B),
|
|
608
609
|
children: [/* @__PURE__ */ D(de, { size: 16 }), X.busy ? "Assigning…" : "Assign driver & vehicle"]
|
|
609
610
|
})
|
|
610
611
|
]
|
|
@@ -620,17 +621,17 @@ function j({ contextKey: _, contextReady: v }) {
|
|
|
620
621
|
" ",
|
|
621
622
|
/* @__PURE__ */ D("span", {
|
|
622
623
|
className: "font-medium",
|
|
623
|
-
children:
|
|
624
|
+
children: Be[N.status]
|
|
624
625
|
})
|
|
625
626
|
]
|
|
626
627
|
}),
|
|
627
|
-
|
|
628
|
+
G && /* @__PURE__ */ D("p", {
|
|
628
629
|
className: "text-sm text-status-error-text",
|
|
629
630
|
role: "status",
|
|
630
631
|
children: k("movethewheels.order.currentVehicleHeld", "The currently assigned vehicle is on hold. Save a replacement before advancing movement.")
|
|
631
632
|
}),
|
|
632
633
|
(() => {
|
|
633
|
-
let e =
|
|
634
|
+
let e = He(N.status);
|
|
634
635
|
if (!e) return null;
|
|
635
636
|
let t = e === "assigned" && (!N.vehicleId || !N.driverId);
|
|
636
637
|
return /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ O(o, {
|
|
@@ -642,14 +643,14 @@ function j({ contextKey: _, contextReady: v }) {
|
|
|
642
643
|
"picked_up",
|
|
643
644
|
"in_transit",
|
|
644
645
|
"out_for_delivery"
|
|
645
|
-
].includes(e) && (!
|
|
646
|
-
children: [/* @__PURE__ */ D(le, { size: 16 }), X.busy ? "Updating…" : `Advance to ${
|
|
646
|
+
].includes(e) && (!W || G),
|
|
647
|
+
children: [/* @__PURE__ */ D(le, { size: 16 }), X.busy ? "Updating…" : `Advance to ${Be[e]}`]
|
|
647
648
|
}), t && /* @__PURE__ */ D("p", {
|
|
648
649
|
className: "text-xs text-text-secondary",
|
|
649
650
|
children: "Assign both a compatible vehicle and driver before dispatching this order."
|
|
650
651
|
})] });
|
|
651
652
|
})(),
|
|
652
|
-
N.status !== "cancelled" && !
|
|
653
|
+
N.status !== "cancelled" && !Ve.has(N.status) && /* @__PURE__ */ O(o, {
|
|
653
654
|
variant: "outline",
|
|
654
655
|
className: "w-full text-status-error-text",
|
|
655
656
|
onClick: () => Q("cancelled"),
|
|
@@ -670,7 +671,12 @@ function j({ contextKey: _, contextReady: v }) {
|
|
|
670
671
|
entityType: "order",
|
|
671
672
|
entityId: N.id
|
|
672
673
|
}),
|
|
673
|
-
/* @__PURE__ */ D(Fe, {
|
|
674
|
+
/* @__PURE__ */ D(Fe, {
|
|
675
|
+
entityType: "mtw_order",
|
|
676
|
+
entityId: N.id,
|
|
677
|
+
title: "Order conversation"
|
|
678
|
+
}),
|
|
679
|
+
/* @__PURE__ */ D(Ie, { deliveryJobId: N.id }),
|
|
674
680
|
N.specialInstructions && /* @__PURE__ */ O(s, { children: [/* @__PURE__ */ D(l, { children: /* @__PURE__ */ O(u, {
|
|
675
681
|
className: "flex items-center gap-2",
|
|
676
682
|
children: [/* @__PURE__ */ D(ae, { size: 18 }), "Special Instructions"]
|
|
@@ -685,7 +691,7 @@ function j({ contextKey: _, contextReady: v }) {
|
|
|
685
691
|
}) : /* @__PURE__ */ D(pe, {
|
|
686
692
|
title: k("movethewheels.order.unavailable", "Order unavailable"),
|
|
687
693
|
message: k("movethewheels.order.loadUnavailable", "The requested order could not be loaded. Refresh before making changes."),
|
|
688
|
-
onRetry:
|
|
694
|
+
onRetry: Ue
|
|
689
695
|
});
|
|
690
696
|
}
|
|
691
697
|
export { A as default };
|