@burdenoff/microfe-movethewheels 2026.1016.13 → 2026.1017.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/hooks/useFleet.js +7 -0
- package/dist/hooks/useOrderDispatch.js +93 -0
- package/dist/hooks/useOrders.js +148 -134
- package/dist/movethewheels/hooks/useOrderDispatch.d.ts +26 -0
- package/dist/movethewheels/hooks/useOrders.d.ts +2 -1
- package/dist/movethewheels/utils/graphqlClient.d.ts +2 -1
- package/dist/movethewheels/utils/orderVehicleHold.d.ts +16 -0
- package/dist/pages/OrderDetailsPage.js +269 -241
- package/dist/utils/graphqlClient.js +72 -65
- package/dist/utils/orderVehicleHold.js +38 -0
- package/package.json +3 -2
- package/src/movethewheels/hooks/useFleet.ts +9 -0
- package/src/movethewheels/hooks/useOrderDispatch.ts +196 -0
- package/src/movethewheels/hooks/useOrders.ts +59 -27
- package/src/movethewheels/pages/OrderDetailsPage.tsx +229 -90
- package/src/movethewheels/utils/graphqlClient.ts +36 -7
- package/src/movethewheels/utils/orderVehicleHold.ts +84 -0
|
@@ -1,38 +1,42 @@
|
|
|
1
1
|
import { ArrowLeft as e } from "../node_modules/lucide-react/dist/esm/icons/arrow-left.js";
|
|
2
2
|
import { ArrowRight as t } from "../node_modules/lucide-react/dist/esm/icons/arrow-right.js";
|
|
3
3
|
import { CircleCheckBig as n } from "../node_modules/lucide-react/dist/esm/icons/circle-check-big.js";
|
|
4
|
-
import { CircleX as
|
|
5
|
-
import { Clock as
|
|
6
|
-
import { DollarSign as
|
|
7
|
-
import { FileText as
|
|
8
|
-
import { Mail as
|
|
9
|
-
import { MapPin as
|
|
10
|
-
import { Package as
|
|
11
|
-
import { Phone as
|
|
12
|
-
import { Printer as
|
|
4
|
+
import { CircleX as r } from "../node_modules/lucide-react/dist/esm/icons/circle-x.js";
|
|
5
|
+
import { Clock as ee } from "../node_modules/lucide-react/dist/esm/icons/clock.js";
|
|
6
|
+
import { DollarSign as te } from "../node_modules/lucide-react/dist/esm/icons/dollar-sign.js";
|
|
7
|
+
import { FileText as ne } from "../node_modules/lucide-react/dist/esm/icons/file-text.js";
|
|
8
|
+
import { Mail as re } from "../node_modules/lucide-react/dist/esm/icons/mail.js";
|
|
9
|
+
import { MapPin as i } from "../node_modules/lucide-react/dist/esm/icons/map-pin.js";
|
|
10
|
+
import { Package as a } from "../node_modules/lucide-react/dist/esm/icons/package.js";
|
|
11
|
+
import { Phone as ie } from "../node_modules/lucide-react/dist/esm/icons/phone.js";
|
|
12
|
+
import { Printer as ae } from "../node_modules/lucide-react/dist/esm/icons/printer.js";
|
|
13
13
|
import { Search as oe } from "../node_modules/lucide-react/dist/esm/icons/search.js";
|
|
14
14
|
import { SquarePen as o } from "../node_modules/lucide-react/dist/esm/icons/square-pen.js";
|
|
15
|
-
import { Truck as
|
|
16
|
-
import { UserCheck as
|
|
17
|
-
import { User as
|
|
18
|
-
import { joinPath as
|
|
19
|
-
import { useMoveTheWheels as
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
15
|
+
import { Truck as se } from "../node_modules/lucide-react/dist/esm/icons/truck.js";
|
|
16
|
+
import { UserCheck as ce } from "../node_modules/lucide-react/dist/esm/icons/user-check.js";
|
|
17
|
+
import { User as le } from "../node_modules/lucide-react/dist/esm/icons/user.js";
|
|
18
|
+
import { joinPath as ue } from "../utils/navigation.js";
|
|
19
|
+
import { useMoveTheWheels as de } from "../providers/MoveTheWheelsProvider.js";
|
|
20
|
+
import { useTr as fe } from "../shared/hooks/useTr.js";
|
|
21
|
+
import { isVehicleAssignable as s } from "../utils/orderVehicleHold.js";
|
|
22
|
+
import { useOrder as pe, useOrders as me } from "../hooks/useOrders.js";
|
|
23
|
+
import { useDriver as he, useDrivers as ge, useVehicle as _e, useVehicles as ve } from "../hooks/useFleet.js";
|
|
24
|
+
import { Badge as c, Button as l, Card as u, CardContent as d, CardHeader as f, CardTitle as p, Input as ye, Label as m, Separator as h, Table as be, TableBody as xe, TableCell as g, TableHead as _, TableHeader as Se, TableRow as Ce } from "../components/ui.js";
|
|
25
|
+
import { ErrorState as we, LoadingState as Te, PageLayout as Ee } from "../components/PageLayout.js";
|
|
26
|
+
import { PaymentStatusBadge as De, PriorityBadge as Oe, StatusBadge as ke } from "../components/StatusBadge.js";
|
|
27
|
+
import { FormError as v } from "../components/FormError.js";
|
|
28
|
+
import { Notice as Ae } from "../components/Notice.js";
|
|
29
|
+
import { formatAddress as y, formatCurrency as b, formatDate as x } from "../utils/formatters.js";
|
|
30
|
+
import { DocumentsCard as je } from "../components/DocumentsCard.js";
|
|
31
|
+
import { reuseRecoveryContextKey as Me, reuseRecoveryScope as S } from "../utils/reuseRecovery.js";
|
|
32
|
+
import { useDebouncedValue as Ne } from "../hooks/useDebouncedValue.js";
|
|
33
|
+
import { EntityCombobox as C } from "../components/EntityCombobox.js";
|
|
34
|
+
import { useOrderDispatch as Pe } from "../hooks/useOrderDispatch.js";
|
|
35
|
+
import { ProofOfDeliveryCard as Fe } from "../components/ProofOfDeliveryCard.js";
|
|
36
|
+
import { useState as w } from "react";
|
|
37
|
+
import { useParams as T } from "react-router";
|
|
34
38
|
import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
35
|
-
import { EmphasisPanel as
|
|
39
|
+
import { EmphasisPanel as Ie, NextSteps as Le, PagePurpose as Re } from "@burdenoff/fe-libs/ui";
|
|
36
40
|
//#region src/movethewheels/pages/OrderDetailsPage.tsx
|
|
37
41
|
var k = [
|
|
38
42
|
"pending",
|
|
@@ -42,7 +46,7 @@ var k = [
|
|
|
42
46
|
"in_transit",
|
|
43
47
|
"out_for_delivery",
|
|
44
48
|
"delivered"
|
|
45
|
-
],
|
|
49
|
+
], ze = {
|
|
46
50
|
pending: "Pending",
|
|
47
51
|
confirmed: "Confirmed",
|
|
48
52
|
assigned: "Assigned",
|
|
@@ -53,90 +57,72 @@ var k = [
|
|
|
53
57
|
returned: "Returned",
|
|
54
58
|
cancelled: "Cancelled",
|
|
55
59
|
failed: "Failed"
|
|
56
|
-
},
|
|
60
|
+
}, Be = new Set([
|
|
57
61
|
"delivered",
|
|
58
62
|
"returned",
|
|
59
63
|
"cancelled",
|
|
60
64
|
"failed"
|
|
61
65
|
]);
|
|
62
|
-
function
|
|
66
|
+
function Ve(e) {
|
|
63
67
|
let t = k.indexOf(e);
|
|
64
68
|
return t === -1 || t >= k.length - 1 ? null : k[t + 1];
|
|
65
69
|
}
|
|
66
|
-
function
|
|
67
|
-
let
|
|
70
|
+
function A() {
|
|
71
|
+
let e = de(), { orderId: t } = T(), n = S(e.currentUser?.id, e.workspaceId, e.tenantId, e.apiGatewayUrl, e.workspaceToken), r = JSON.stringify([
|
|
72
|
+
Me(n),
|
|
73
|
+
e.currentUser?.id,
|
|
74
|
+
e.workspaceId,
|
|
75
|
+
e.tenantId,
|
|
76
|
+
e.apiGatewayUrl,
|
|
77
|
+
t
|
|
78
|
+
]);
|
|
79
|
+
return /* @__PURE__ */ D(j, {
|
|
80
|
+
contextKey: r,
|
|
81
|
+
contextReady: n !== null
|
|
82
|
+
}, r);
|
|
83
|
+
}
|
|
84
|
+
function j({ contextKey: Me, contextReady: S }) {
|
|
85
|
+
let k = fe(), { orderId: A } = T(), { basePath: j, navigate: M } = de(), { order: N, isLoading: P, error: F, refetch: He } = pe(A), { updateOrder: Ue, updateOrderStatus: We } = me(), [Ge, Ke] = w(""), [I, qe] = w(""), [Je, Ye] = w(""), Xe = Ne(Ge), { vehicles: Ze, isLoading: L, isLoadingMore: Qe, hasMore: $e, totalVehicles: et, error: R, refetch: tt, loadMore: nt } = ve({
|
|
68
86
|
limit: 20,
|
|
69
|
-
search:
|
|
70
|
-
}), { drivers:
|
|
87
|
+
search: Xe || void 0
|
|
88
|
+
}), { drivers: rt, isLoading: z, isLoadingMore: it, hasMore: at, totalDrivers: ot, error: B, refetch: st, loadMore: ct } = ge({
|
|
71
89
|
limit: 20,
|
|
72
|
-
search:
|
|
73
|
-
}), { vehicle:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
await Re(k, {
|
|
87
|
-
vehicleId: e,
|
|
88
|
-
driverId: t
|
|
89
|
-
}), !n && P.status === "confirmed" && await I(k, "assigned"), Z(!n && P.status === "confirmed" ? "Fleet assigned and order advanced to Assigned." : "Assignment updated."), z(""), V(""), F();
|
|
90
|
-
} catch (e) {
|
|
91
|
-
q(e instanceof Error ? e.message : "Failed to update assignment.");
|
|
92
|
-
} finally {
|
|
93
|
-
U(!1);
|
|
94
|
-
}
|
|
95
|
-
}, Q = async (e, t) => {
|
|
96
|
-
if (!(!k || !P)) {
|
|
97
|
-
if (e === "assigned" && (!P.vehicleId || !P.driverId)) {
|
|
98
|
-
q("Assign both a compatible vehicle and driver before advancing to Assigned.");
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (!j.has(P.status)) {
|
|
102
|
-
G(!0), q(null);
|
|
103
|
-
try {
|
|
104
|
-
await I(k, e), Z(t), F();
|
|
105
|
-
} catch (e) {
|
|
106
|
-
q(e instanceof Error ? e.message : "Failed to update status.");
|
|
107
|
-
} finally {
|
|
108
|
-
G(!1);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}, $ = (e) => {
|
|
113
|
-
N && N(c(M, e));
|
|
90
|
+
search: Xe || void 0
|
|
91
|
+
}), { vehicle: V, isLoading: lt, error: ut, refetch: dt } = _e(I || N?.vehicleId || void 0), { driver: H, isLoading: ft, error: pt, refetch: mt } = he(Je || N?.driverId || void 0), ht = Ze.filter((e) => s(e.status) || e.id === N?.vehicleId), gt = rt.filter((e) => e.status === "available" || e.id === N?.driverId), { vehicle: U, isLoading: _t, error: vt, refetch: yt } = _e(N?.vehicleId), W = !N?.vehicleId || !_t && !vt && U?.id === N.vehicleId, G = !!(N?.vehicleId && W && U && !s(U.status)), K = I || N?.vehicleId, q = Je || N?.driverId, J = !K || !lt && !ut && V?.id === K, Y = !q || !ft && !pt && H?.id === q, bt = !!(K && J && V && !s(V.status)), xt = !!(N && !(N.vehicleId && N.driverId) && N.status === "confirmed"), St = bt && (K !== N?.vehicleId || xt), Ct = () => {
|
|
92
|
+
He(), dt(), yt(), mt(), tt(), st();
|
|
93
|
+
}, X = Pe({
|
|
94
|
+
order: N,
|
|
95
|
+
contextKey: Me,
|
|
96
|
+
ready: S && !P && !F && !!N,
|
|
97
|
+
assignmentReady: !!(K && q) && J && Y && !St && !L && !z && !R && !B,
|
|
98
|
+
movementReady: W && !G,
|
|
99
|
+
updateOrder: Ue,
|
|
100
|
+
updateOrderStatus: We,
|
|
101
|
+
refresh: Ct
|
|
102
|
+
}), wt = K !== N?.vehicleId || q !== N?.driverId, Z = X.busy || X.blocked || !S || P || !!F, Tt = () => X.assign(K ?? "", q ?? ""), Q = (e) => X.changeStatus(e), Et = 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
|
+
M && M(ue(j, e));
|
|
114
104
|
};
|
|
115
|
-
return
|
|
116
|
-
title:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}) : /* @__PURE__ */ O(Se, {
|
|
120
|
-
title: P.orderNumber,
|
|
121
|
-
subtitle: `Created ${C(P.createdAt, "full")}`,
|
|
122
|
-
icon: /* @__PURE__ */ D(i, { size: 24 }),
|
|
105
|
+
return P && !N ? /* @__PURE__ */ D(Te, { message: "Loading order details..." }) : N ? /* @__PURE__ */ O(Ee, {
|
|
106
|
+
title: N.orderNumber,
|
|
107
|
+
subtitle: `Created ${x(N.createdAt, "full")}`,
|
|
108
|
+
icon: /* @__PURE__ */ D(a, { size: 24 }),
|
|
123
109
|
headerActions: /* @__PURE__ */ O("div", {
|
|
124
110
|
className: "flex gap-2",
|
|
125
111
|
children: [
|
|
126
|
-
/* @__PURE__ */ O(
|
|
112
|
+
/* @__PURE__ */ O(l, {
|
|
127
113
|
variant: "outline",
|
|
128
114
|
onClick: () => {
|
|
129
|
-
|
|
115
|
+
M && M(ue(j, "orders"));
|
|
130
116
|
},
|
|
131
117
|
children: [/* @__PURE__ */ D(e, { size: 16 }), "Back"]
|
|
132
118
|
}),
|
|
133
|
-
/* @__PURE__ */ O(
|
|
119
|
+
/* @__PURE__ */ O(l, {
|
|
134
120
|
variant: "outline",
|
|
135
121
|
onClick: () => window.print(),
|
|
136
|
-
children: [/* @__PURE__ */ D(
|
|
122
|
+
children: [/* @__PURE__ */ D(ae, { size: 16 }), "Print"]
|
|
137
123
|
}),
|
|
138
|
-
/* @__PURE__ */ O(
|
|
139
|
-
onClick: () => $(`orders/${
|
|
124
|
+
/* @__PURE__ */ O(l, {
|
|
125
|
+
onClick: () => $(`orders/${A}/edit`),
|
|
140
126
|
children: [/* @__PURE__ */ D(o, { size: 16 }), "Edit"]
|
|
141
127
|
})
|
|
142
128
|
]
|
|
@@ -144,41 +130,41 @@ function M() {
|
|
|
144
130
|
headerContent: /* @__PURE__ */ O("div", {
|
|
145
131
|
className: "flex flex-wrap gap-2",
|
|
146
132
|
children: [
|
|
147
|
-
/* @__PURE__ */ D(
|
|
148
|
-
status:
|
|
133
|
+
/* @__PURE__ */ D(ke, {
|
|
134
|
+
status: N.status,
|
|
149
135
|
type: "order"
|
|
150
136
|
}),
|
|
151
|
-
/* @__PURE__ */ D(
|
|
152
|
-
/* @__PURE__ */ D(
|
|
137
|
+
/* @__PURE__ */ D(Oe, { priority: N.priority }),
|
|
138
|
+
/* @__PURE__ */ D(De, { status: N.pricing.paymentStatus })
|
|
153
139
|
]
|
|
154
140
|
}),
|
|
155
141
|
children: [
|
|
156
|
-
/* @__PURE__ */ D(
|
|
157
|
-
icon: /* @__PURE__ */ D(
|
|
142
|
+
/* @__PURE__ */ D(Re, {
|
|
143
|
+
icon: /* @__PURE__ */ D(a, { size: 18 }),
|
|
158
144
|
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."
|
|
159
145
|
}),
|
|
160
|
-
/* @__PURE__ */ D(
|
|
146
|
+
/* @__PURE__ */ D(Le, {
|
|
161
147
|
storageKey: "movethewheels-order-details",
|
|
162
148
|
steps: [
|
|
163
149
|
{
|
|
164
150
|
id: "track",
|
|
165
151
|
label: "Track this order live",
|
|
166
152
|
description: "See where the shipment is right now on the map.",
|
|
167
|
-
icon: /* @__PURE__ */ D(
|
|
168
|
-
onClick: () => $(`tracking?order=${
|
|
153
|
+
icon: /* @__PURE__ */ D(i, { size: 16 }),
|
|
154
|
+
onClick: () => $(`tracking?order=${N.id}`)
|
|
169
155
|
},
|
|
170
156
|
{
|
|
171
157
|
id: "edit",
|
|
172
158
|
label: "Edit order details",
|
|
173
159
|
description: "Update items, addresses or instructions before dispatch.",
|
|
174
160
|
icon: /* @__PURE__ */ D(o, { size: 16 }),
|
|
175
|
-
onClick: () => $(`orders/${
|
|
161
|
+
onClick: () => $(`orders/${A}/edit`)
|
|
176
162
|
},
|
|
177
163
|
{
|
|
178
164
|
id: "print",
|
|
179
165
|
label: "Print the delivery docket",
|
|
180
166
|
description: "Generate a printable copy for the driver or warehouse.",
|
|
181
|
-
icon: /* @__PURE__ */ D(
|
|
167
|
+
icon: /* @__PURE__ */ D(ae, { size: 16 }),
|
|
182
168
|
onClick: () => window.print()
|
|
183
169
|
}
|
|
184
170
|
]
|
|
@@ -188,75 +174,75 @@ function M() {
|
|
|
188
174
|
children: [/* @__PURE__ */ O("div", {
|
|
189
175
|
className: "lg:col-span-2 space-y-6",
|
|
190
176
|
children: [
|
|
191
|
-
/* @__PURE__ */ O(
|
|
177
|
+
/* @__PURE__ */ O(u, { children: [/* @__PURE__ */ D(f, { children: /* @__PURE__ */ O(p, {
|
|
192
178
|
className: "flex items-center gap-2",
|
|
193
|
-
children: [/* @__PURE__ */ D(
|
|
194
|
-
}) }), /* @__PURE__ */ D(
|
|
179
|
+
children: [/* @__PURE__ */ D(le, { size: 18 }), "Customer Information"]
|
|
180
|
+
}) }), /* @__PURE__ */ D(d, { children: /* @__PURE__ */ O("div", {
|
|
195
181
|
className: "grid grid-cols-1 md:grid-cols-2 gap-6",
|
|
196
182
|
children: [/* @__PURE__ */ O("div", { children: [
|
|
197
183
|
/* @__PURE__ */ D("h4", {
|
|
198
184
|
className: "font-medium mb-2",
|
|
199
|
-
children:
|
|
185
|
+
children: N.customerInfo.name
|
|
200
186
|
}),
|
|
201
|
-
|
|
187
|
+
N.customerInfo.company && /* @__PURE__ */ D("p", {
|
|
202
188
|
className: "text-sm text-text-secondary mb-2",
|
|
203
|
-
children:
|
|
189
|
+
children: N.customerInfo.company
|
|
204
190
|
}),
|
|
205
191
|
/* @__PURE__ */ O("div", {
|
|
206
192
|
className: "space-y-1 text-sm",
|
|
207
193
|
children: [/* @__PURE__ */ O("p", {
|
|
208
194
|
className: "flex items-center gap-2",
|
|
209
|
-
children: [/* @__PURE__ */ D(
|
|
195
|
+
children: [/* @__PURE__ */ D(re, {
|
|
210
196
|
size: 14,
|
|
211
197
|
className: "text-text-secondary"
|
|
212
|
-
}),
|
|
198
|
+
}), N.customerInfo.email]
|
|
213
199
|
}), /* @__PURE__ */ O("p", {
|
|
214
200
|
className: "flex items-center gap-2",
|
|
215
|
-
children: [/* @__PURE__ */ D(
|
|
201
|
+
children: [/* @__PURE__ */ D(ie, {
|
|
216
202
|
size: 14,
|
|
217
203
|
className: "text-text-secondary"
|
|
218
|
-
}),
|
|
204
|
+
}), N.customerInfo.phone]
|
|
219
205
|
})]
|
|
220
206
|
})
|
|
221
|
-
] }), /* @__PURE__ */ O("div", { children: [
|
|
207
|
+
] }), /* @__PURE__ */ O("div", { children: [N.customerInfo.preferredDeliveryTime && /* @__PURE__ */ O("div", {
|
|
222
208
|
className: "mb-2",
|
|
223
209
|
children: [/* @__PURE__ */ D("p", {
|
|
224
210
|
className: "text-sm text-text-secondary",
|
|
225
211
|
children: "Preferred Delivery Time"
|
|
226
212
|
}), /* @__PURE__ */ D("p", {
|
|
227
213
|
className: "text-sm",
|
|
228
|
-
children:
|
|
214
|
+
children: N.customerInfo.preferredDeliveryTime
|
|
229
215
|
})]
|
|
230
|
-
}),
|
|
216
|
+
}), N.customerInfo.deliveryInstructions && /* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("p", {
|
|
231
217
|
className: "text-sm text-text-secondary",
|
|
232
218
|
children: "Delivery Instructions"
|
|
233
219
|
}), /* @__PURE__ */ D("p", {
|
|
234
220
|
className: "text-sm",
|
|
235
|
-
children:
|
|
221
|
+
children: N.customerInfo.deliveryInstructions
|
|
236
222
|
})] })] })]
|
|
237
223
|
}) })] }),
|
|
238
|
-
/* @__PURE__ */ O(
|
|
224
|
+
/* @__PURE__ */ O(u, { children: [/* @__PURE__ */ D(f, { children: /* @__PURE__ */ O(p, {
|
|
239
225
|
className: "flex items-center gap-2",
|
|
240
|
-
children: [/* @__PURE__ */ D(
|
|
241
|
-
}) }), /* @__PURE__ */ D(
|
|
226
|
+
children: [/* @__PURE__ */ D(i, { size: 18 }), "Addresses"]
|
|
227
|
+
}) }), /* @__PURE__ */ D(d, { children: /* @__PURE__ */ O("div", {
|
|
242
228
|
className: "grid grid-cols-1 md:grid-cols-2 gap-6",
|
|
243
229
|
children: [/* @__PURE__ */ O("div", { children: [
|
|
244
230
|
/* @__PURE__ */ D("h4", {
|
|
245
231
|
className: "font-medium mb-2 flex items-center gap-2",
|
|
246
|
-
children: /* @__PURE__ */ D(
|
|
232
|
+
children: /* @__PURE__ */ D(c, {
|
|
247
233
|
variant: "outline",
|
|
248
234
|
children: "Pickup"
|
|
249
235
|
})
|
|
250
236
|
}),
|
|
251
237
|
/* @__PURE__ */ D("p", {
|
|
252
238
|
className: "text-sm",
|
|
253
|
-
children:
|
|
239
|
+
children: y(N.pickupAddress)
|
|
254
240
|
}),
|
|
255
|
-
|
|
241
|
+
N.scheduledPickup && /* @__PURE__ */ O("p", {
|
|
256
242
|
className: "text-sm text-text-secondary mt-2",
|
|
257
|
-
children: ["Scheduled: ",
|
|
243
|
+
children: ["Scheduled: ", x(N.scheduledPickup, "full")]
|
|
258
244
|
}),
|
|
259
|
-
|
|
245
|
+
N.actualPickup && /* @__PURE__ */ O("p", {
|
|
260
246
|
className: "text-sm text-status-success-text mt-1",
|
|
261
247
|
children: [
|
|
262
248
|
/* @__PURE__ */ D(n, {
|
|
@@ -264,26 +250,26 @@ function M() {
|
|
|
264
250
|
className: "inline mr-1"
|
|
265
251
|
}),
|
|
266
252
|
"Picked up: ",
|
|
267
|
-
|
|
253
|
+
x(N.actualPickup, "full")
|
|
268
254
|
]
|
|
269
255
|
})
|
|
270
256
|
] }), /* @__PURE__ */ O("div", { children: [
|
|
271
257
|
/* @__PURE__ */ D("h4", {
|
|
272
258
|
className: "font-medium mb-2 flex items-center gap-2",
|
|
273
|
-
children: /* @__PURE__ */ D(
|
|
259
|
+
children: /* @__PURE__ */ D(c, {
|
|
274
260
|
variant: "outline",
|
|
275
261
|
children: "Delivery"
|
|
276
262
|
})
|
|
277
263
|
}),
|
|
278
264
|
/* @__PURE__ */ D("p", {
|
|
279
265
|
className: "text-sm",
|
|
280
|
-
children:
|
|
266
|
+
children: y(N.deliveryAddress)
|
|
281
267
|
}),
|
|
282
|
-
|
|
268
|
+
N.scheduledDelivery && /* @__PURE__ */ O("p", {
|
|
283
269
|
className: "text-sm text-text-secondary mt-2",
|
|
284
|
-
children: ["Scheduled: ",
|
|
270
|
+
children: ["Scheduled: ", x(N.scheduledDelivery, "full")]
|
|
285
271
|
}),
|
|
286
|
-
|
|
272
|
+
N.actualDelivery && /* @__PURE__ */ O("p", {
|
|
287
273
|
className: "text-sm text-status-success-text mt-1",
|
|
288
274
|
children: [
|
|
289
275
|
/* @__PURE__ */ D(n, {
|
|
@@ -291,36 +277,36 @@ function M() {
|
|
|
291
277
|
className: "inline mr-1"
|
|
292
278
|
}),
|
|
293
279
|
"Delivered: ",
|
|
294
|
-
|
|
280
|
+
x(N.actualDelivery, "full")
|
|
295
281
|
]
|
|
296
282
|
})
|
|
297
283
|
] })]
|
|
298
284
|
}) })] }),
|
|
299
|
-
/* @__PURE__ */ O(
|
|
285
|
+
/* @__PURE__ */ O(u, { children: [/* @__PURE__ */ D(f, { children: /* @__PURE__ */ O(p, {
|
|
300
286
|
className: "flex items-center gap-2",
|
|
301
|
-
children: [/* @__PURE__ */ D(
|
|
302
|
-
}) }), /* @__PURE__ */ D(
|
|
287
|
+
children: [/* @__PURE__ */ D(se, { size: 18 }), "Saved Route"]
|
|
288
|
+
}) }), /* @__PURE__ */ D(d, { children: N.route ? /* @__PURE__ */ O("div", {
|
|
303
289
|
className: "space-y-3",
|
|
304
290
|
children: [/* @__PURE__ */ O("div", {
|
|
305
291
|
className: "flex items-center justify-between gap-3",
|
|
306
292
|
children: [/* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("p", {
|
|
307
293
|
className: "font-medium",
|
|
308
|
-
children:
|
|
294
|
+
children: N.route.name
|
|
309
295
|
}), /* @__PURE__ */ O("p", {
|
|
310
296
|
className: "text-sm text-text-secondary",
|
|
311
297
|
children: [
|
|
312
|
-
|
|
298
|
+
N.route.stops.length,
|
|
313
299
|
" stops ·",
|
|
314
300
|
" ",
|
|
315
|
-
|
|
301
|
+
N.route.status.replace("_", " ").toLowerCase()
|
|
316
302
|
]
|
|
317
|
-
})] }), /* @__PURE__ */ D(
|
|
303
|
+
})] }), /* @__PURE__ */ D(c, {
|
|
318
304
|
variant: "outline",
|
|
319
305
|
children: "Reusable route"
|
|
320
306
|
})]
|
|
321
307
|
}), /* @__PURE__ */ D("div", {
|
|
322
308
|
className: "space-y-2",
|
|
323
|
-
children:
|
|
309
|
+
children: N.route.stops.map((e, t) => /* @__PURE__ */ O("div", {
|
|
324
310
|
className: "flex items-start gap-2 text-sm",
|
|
325
311
|
children: [/* @__PURE__ */ O("span", {
|
|
326
312
|
className: "text-text-secondary",
|
|
@@ -332,7 +318,7 @@ function M() {
|
|
|
332
318
|
}),
|
|
333
319
|
" ·",
|
|
334
320
|
" ",
|
|
335
|
-
|
|
321
|
+
y(e.address)
|
|
336
322
|
] })]
|
|
337
323
|
}, e.id))
|
|
338
324
|
})]
|
|
@@ -340,79 +326,79 @@ function M() {
|
|
|
340
326
|
className: "text-sm text-text-secondary",
|
|
341
327
|
children: "No saved route was selected for this order."
|
|
342
328
|
}) })] }),
|
|
343
|
-
/* @__PURE__ */ O(
|
|
329
|
+
/* @__PURE__ */ O(u, { children: [/* @__PURE__ */ D(f, { children: /* @__PURE__ */ O(p, {
|
|
344
330
|
className: "flex items-center gap-2",
|
|
345
331
|
children: [
|
|
346
|
-
/* @__PURE__ */ D(
|
|
332
|
+
/* @__PURE__ */ D(a, { size: 18 }),
|
|
347
333
|
"Order Items (",
|
|
348
|
-
|
|
334
|
+
N.items.length,
|
|
349
335
|
")"
|
|
350
336
|
]
|
|
351
|
-
}) }), /* @__PURE__ */ D(
|
|
337
|
+
}) }), /* @__PURE__ */ D(d, {
|
|
352
338
|
className: "p-0",
|
|
353
|
-
children: /* @__PURE__ */ O(
|
|
354
|
-
/* @__PURE__ */ D(
|
|
355
|
-
/* @__PURE__ */ D(
|
|
356
|
-
/* @__PURE__ */ D(
|
|
339
|
+
children: /* @__PURE__ */ O(be, { children: [/* @__PURE__ */ D(Se, { children: /* @__PURE__ */ O(Ce, { children: [
|
|
340
|
+
/* @__PURE__ */ D(_, { children: "Item" }),
|
|
341
|
+
/* @__PURE__ */ D(_, { children: "SKU" }),
|
|
342
|
+
/* @__PURE__ */ D(_, {
|
|
357
343
|
className: "text-center",
|
|
358
344
|
children: "Qty"
|
|
359
345
|
}),
|
|
360
|
-
/* @__PURE__ */ D(
|
|
346
|
+
/* @__PURE__ */ D(_, {
|
|
361
347
|
className: "text-right",
|
|
362
348
|
children: "Unit Price"
|
|
363
349
|
}),
|
|
364
|
-
/* @__PURE__ */ D(
|
|
350
|
+
/* @__PURE__ */ D(_, {
|
|
365
351
|
className: "text-right",
|
|
366
352
|
children: "Total"
|
|
367
353
|
})
|
|
368
|
-
] }) }), /* @__PURE__ */ D(
|
|
369
|
-
/* @__PURE__ */ D(
|
|
354
|
+
] }) }), /* @__PURE__ */ D(xe, { children: N.items.map((e) => /* @__PURE__ */ O(Ce, { children: [
|
|
355
|
+
/* @__PURE__ */ D(g, { children: /* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("p", {
|
|
370
356
|
className: "font-medium",
|
|
371
357
|
children: e.name
|
|
372
358
|
}), e.description && /* @__PURE__ */ D("p", {
|
|
373
359
|
className: "text-sm text-text-secondary",
|
|
374
360
|
children: e.description
|
|
375
361
|
})] }) }),
|
|
376
|
-
/* @__PURE__ */ D(
|
|
362
|
+
/* @__PURE__ */ D(g, {
|
|
377
363
|
className: "font-mono text-sm",
|
|
378
364
|
children: e.sku
|
|
379
365
|
}),
|
|
380
|
-
/* @__PURE__ */ D(
|
|
366
|
+
/* @__PURE__ */ D(g, {
|
|
381
367
|
className: "text-center",
|
|
382
368
|
children: e.quantity
|
|
383
369
|
}),
|
|
384
|
-
/* @__PURE__ */ D(
|
|
370
|
+
/* @__PURE__ */ D(g, {
|
|
385
371
|
className: "text-right",
|
|
386
|
-
children:
|
|
372
|
+
children: b(e.value)
|
|
387
373
|
}),
|
|
388
|
-
/* @__PURE__ */ D(
|
|
374
|
+
/* @__PURE__ */ D(g, {
|
|
389
375
|
className: "text-right font-medium",
|
|
390
|
-
children:
|
|
376
|
+
children: b(e.value * e.quantity)
|
|
391
377
|
})
|
|
392
378
|
] }, e.id)) })] })
|
|
393
379
|
})] }),
|
|
394
|
-
/* @__PURE__ */ O(
|
|
380
|
+
/* @__PURE__ */ O(u, { children: [/* @__PURE__ */ D(f, { children: /* @__PURE__ */ O(p, {
|
|
395
381
|
className: "flex items-center gap-2",
|
|
396
|
-
children: [/* @__PURE__ */ D(
|
|
397
|
-
}) }), /* @__PURE__ */ D(
|
|
382
|
+
children: [/* @__PURE__ */ D(ee, { size: 18 }), "Order Timeline"]
|
|
383
|
+
}) }), /* @__PURE__ */ D(d, { children: /* @__PURE__ */ D("div", {
|
|
398
384
|
className: "relative",
|
|
399
|
-
children:
|
|
385
|
+
children: N.timeline.map((e, t) => /* @__PURE__ */ O("div", {
|
|
400
386
|
className: "flex gap-4 pb-6 last:pb-0",
|
|
401
387
|
children: [/* @__PURE__ */ O("div", {
|
|
402
388
|
className: "relative",
|
|
403
|
-
children: [/* @__PURE__ */ D("div", { className: "w-3 h-3 rounded-full bg-action-primary-bg mt-1.5" }), t <
|
|
389
|
+
children: [/* @__PURE__ */ D("div", { className: "w-3 h-3 rounded-full bg-action-primary-bg mt-1.5" }), t < N.timeline.length - 1 && /* @__PURE__ */ D("div", { className: "absolute top-4 left-1.5 w-px h-full -ml-px bg-border" })]
|
|
404
390
|
}), /* @__PURE__ */ O("div", {
|
|
405
391
|
className: "flex-1",
|
|
406
392
|
children: [
|
|
407
393
|
/* @__PURE__ */ O("div", {
|
|
408
394
|
className: "flex items-center gap-2 mb-1",
|
|
409
|
-
children: [/* @__PURE__ */ D(
|
|
395
|
+
children: [/* @__PURE__ */ D(ke, {
|
|
410
396
|
status: e.status,
|
|
411
397
|
type: "order",
|
|
412
398
|
size: "sm"
|
|
413
399
|
}), /* @__PURE__ */ D("span", {
|
|
414
400
|
className: "text-sm text-text-secondary",
|
|
415
|
-
children:
|
|
401
|
+
children: x(e.timestamp, "full")
|
|
416
402
|
})]
|
|
417
403
|
}),
|
|
418
404
|
e.notes && /* @__PURE__ */ D("p", {
|
|
@@ -431,9 +417,9 @@ function M() {
|
|
|
431
417
|
}), /* @__PURE__ */ O("div", {
|
|
432
418
|
className: "space-y-6",
|
|
433
419
|
children: [
|
|
434
|
-
/* @__PURE__ */ O(
|
|
420
|
+
/* @__PURE__ */ O(Ie, { children: [/* @__PURE__ */ O("h2", {
|
|
435
421
|
className: "flex items-center gap-2 text-base font-semibold text-text-primary mb-4",
|
|
436
|
-
children: [/* @__PURE__ */ D(
|
|
422
|
+
children: [/* @__PURE__ */ D(te, { size: 18 }), "Order Summary"]
|
|
437
423
|
}), /* @__PURE__ */ O("div", {
|
|
438
424
|
className: "space-y-3",
|
|
439
425
|
children: [
|
|
@@ -442,42 +428,42 @@ function M() {
|
|
|
442
428
|
children: [/* @__PURE__ */ D("span", {
|
|
443
429
|
className: "text-text-secondary",
|
|
444
430
|
children: "Subtotal"
|
|
445
|
-
}), /* @__PURE__ */ D("span", { children:
|
|
431
|
+
}), /* @__PURE__ */ D("span", { children: b(N.pricing.subtotal) })]
|
|
446
432
|
}),
|
|
447
433
|
/* @__PURE__ */ O("div", {
|
|
448
434
|
className: "flex justify-between text-sm",
|
|
449
435
|
children: [/* @__PURE__ */ D("span", {
|
|
450
436
|
className: "text-text-secondary",
|
|
451
437
|
children: "Delivery"
|
|
452
|
-
}), /* @__PURE__ */ D("span", { children:
|
|
438
|
+
}), /* @__PURE__ */ D("span", { children: b(N.pricing.fees.delivery) })]
|
|
453
439
|
}),
|
|
454
440
|
/* @__PURE__ */ O("div", {
|
|
455
441
|
className: "flex justify-between text-sm",
|
|
456
442
|
children: [/* @__PURE__ */ D("span", {
|
|
457
443
|
className: "text-text-secondary",
|
|
458
444
|
children: "Handling"
|
|
459
|
-
}), /* @__PURE__ */ D("span", { children:
|
|
445
|
+
}), /* @__PURE__ */ D("span", { children: b(N.pricing.fees.handling) })]
|
|
460
446
|
}),
|
|
461
|
-
|
|
447
|
+
N.pricing.fees.insurance && /* @__PURE__ */ O("div", {
|
|
462
448
|
className: "flex justify-between text-sm",
|
|
463
449
|
children: [/* @__PURE__ */ D("span", {
|
|
464
450
|
className: "text-text-secondary",
|
|
465
451
|
children: "Insurance"
|
|
466
|
-
}), /* @__PURE__ */ D("span", { children:
|
|
452
|
+
}), /* @__PURE__ */ D("span", { children: b(N.pricing.fees.insurance) })]
|
|
467
453
|
}),
|
|
468
454
|
/* @__PURE__ */ O("div", {
|
|
469
455
|
className: "flex justify-between text-sm",
|
|
470
456
|
children: [/* @__PURE__ */ D("span", {
|
|
471
457
|
className: "text-text-secondary",
|
|
472
458
|
children: "Taxes"
|
|
473
|
-
}), /* @__PURE__ */ D("span", { children:
|
|
459
|
+
}), /* @__PURE__ */ D("span", { children: b(N.pricing.taxes) })]
|
|
474
460
|
}),
|
|
475
|
-
/* @__PURE__ */ D(
|
|
461
|
+
/* @__PURE__ */ D(h, {}),
|
|
476
462
|
/* @__PURE__ */ O("div", {
|
|
477
463
|
className: "flex justify-between font-medium",
|
|
478
464
|
children: [/* @__PURE__ */ D("span", { children: "Total" }), /* @__PURE__ */ D("span", {
|
|
479
465
|
className: "text-lg",
|
|
480
|
-
children:
|
|
466
|
+
children: b(N.pricing.total)
|
|
481
467
|
})]
|
|
482
468
|
}),
|
|
483
469
|
/* @__PURE__ */ O("div", {
|
|
@@ -487,41 +473,67 @@ function M() {
|
|
|
487
473
|
children: "Payment Method"
|
|
488
474
|
}), /* @__PURE__ */ D("p", {
|
|
489
475
|
className: "text-sm capitalize",
|
|
490
|
-
children:
|
|
476
|
+
children: N.pricing.paymentMethod.replace("_", " ")
|
|
491
477
|
})]
|
|
492
478
|
})
|
|
493
479
|
]
|
|
494
480
|
})] }),
|
|
495
|
-
/* @__PURE__ */ O(
|
|
481
|
+
/* @__PURE__ */ O(u, { children: [/* @__PURE__ */ D(f, { children: /* @__PURE__ */ O(p, {
|
|
496
482
|
className: "flex items-center gap-2",
|
|
497
|
-
children: [/* @__PURE__ */ D(
|
|
498
|
-
}) }), /* @__PURE__ */ D(
|
|
483
|
+
children: [/* @__PURE__ */ D(se, { size: 18 }), "Assignment"]
|
|
484
|
+
}) }), /* @__PURE__ */ D(d, { children: /* @__PURE__ */ O("div", {
|
|
499
485
|
className: "space-y-4",
|
|
500
486
|
children: [
|
|
501
|
-
|
|
502
|
-
|
|
487
|
+
P && /* @__PURE__ */ D("p", {
|
|
488
|
+
role: "status",
|
|
489
|
+
className: "text-sm",
|
|
490
|
+
children: k("movethewheels.order.refreshing", "Refreshing order details. Changes are unavailable.")
|
|
491
|
+
}),
|
|
492
|
+
F && /* @__PURE__ */ D(v, { message: k("movethewheels.order.refreshFailed", "Order details could not be refreshed. Existing values are read-only.") }),
|
|
493
|
+
X.message && /* @__PURE__ */ D(Ae, {
|
|
494
|
+
variant: "info",
|
|
495
|
+
message: X.message
|
|
496
|
+
}),
|
|
497
|
+
X.knownAssignment && /* @__PURE__ */ D("p", {
|
|
498
|
+
className: "text-sm break-words",
|
|
499
|
+
role: "status",
|
|
500
|
+
children: k("movethewheels.order.knownAssignment", "Saved assignment: vehicle {{vehicle}}, driver {{driver}}.", {
|
|
501
|
+
vehicle: V?.id === X.knownAssignment.vehicleId ? V.vehicleNumber : X.knownAssignment.vehicleId,
|
|
502
|
+
driver: H?.id === X.knownAssignment.driverId ? H.fullName : X.knownAssignment.driverId
|
|
503
|
+
})
|
|
504
|
+
}),
|
|
505
|
+
X.blocked && /* @__PURE__ */ D(v, { message: k("movethewheels.order.blocked", "An order write is unconfirmed. Refresh is read-only and will not unlock another write.") }),
|
|
506
|
+
bt && /* @__PURE__ */ D(v, { message: Et }),
|
|
507
|
+
(!J || !Y || !W || R || B) && /* @__PURE__ */ D(v, { message: k("movethewheels.order.unverifiedFleet", "Vehicle status could not be verified. Refresh before assigning or advancing.") }),
|
|
508
|
+
/* @__PURE__ */ D(l, {
|
|
509
|
+
variant: "outline",
|
|
510
|
+
onClick: Ct,
|
|
511
|
+
disabled: X.busy,
|
|
512
|
+
children: k("movethewheels.order.refreshAssignment", "Refresh assignment")
|
|
513
|
+
}),
|
|
503
514
|
/* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("p", {
|
|
504
515
|
className: "text-sm text-text-secondary",
|
|
505
516
|
children: "Tracking Number"
|
|
506
517
|
}), /* @__PURE__ */ D("p", {
|
|
507
518
|
className: "text-sm font-mono",
|
|
508
|
-
children:
|
|
519
|
+
children: N.trackingNumber || "—"
|
|
509
520
|
})] }),
|
|
510
|
-
/* @__PURE__ */ D(
|
|
521
|
+
/* @__PURE__ */ D(h, {}),
|
|
511
522
|
/* @__PURE__ */ O("div", {
|
|
512
523
|
className: "space-y-3",
|
|
513
524
|
children: [
|
|
514
525
|
/* @__PURE__ */ O("div", {
|
|
515
526
|
className: "space-y-1.5",
|
|
516
|
-
children: [/* @__PURE__ */ D(
|
|
527
|
+
children: [/* @__PURE__ */ D(m, {
|
|
517
528
|
htmlFor: "assign-fleet-search",
|
|
518
529
|
children: "Search vehicles & drivers"
|
|
519
530
|
}), /* @__PURE__ */ O("div", {
|
|
520
531
|
className: "relative",
|
|
521
|
-
children: [/* @__PURE__ */ D(oe, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ D(
|
|
532
|
+
children: [/* @__PURE__ */ D(oe, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ D(ye, {
|
|
522
533
|
id: "assign-fleet-search",
|
|
523
|
-
value:
|
|
524
|
-
|
|
534
|
+
value: Ge,
|
|
535
|
+
disabled: Z,
|
|
536
|
+
onChange: (e) => Ke(e.target.value),
|
|
525
537
|
placeholder: "Vehicle number, driver name or employee ID",
|
|
526
538
|
className: "pl-9"
|
|
527
539
|
})]
|
|
@@ -529,15 +541,16 @@ function M() {
|
|
|
529
541
|
}),
|
|
530
542
|
/* @__PURE__ */ O("div", {
|
|
531
543
|
className: "space-y-1.5",
|
|
532
|
-
children: [/* @__PURE__ */ D(
|
|
544
|
+
children: [/* @__PURE__ */ D(m, {
|
|
533
545
|
htmlFor: "assign-vehicle",
|
|
534
546
|
children: "Vehicle"
|
|
535
|
-
}), /* @__PURE__ */ D(
|
|
547
|
+
}), /* @__PURE__ */ D(C, {
|
|
536
548
|
id: "assign-vehicle",
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
549
|
+
disabled: Z,
|
|
550
|
+
value: K ?? "",
|
|
551
|
+
onChange: qe,
|
|
552
|
+
options: ht,
|
|
553
|
+
loading: L,
|
|
541
554
|
getId: (e) => e.id,
|
|
542
555
|
getLabel: (e) => `${e.vehicleNumber} (${e.type})`,
|
|
543
556
|
renderOption: (e) => /* @__PURE__ */ O(E, { children: [
|
|
@@ -546,28 +559,29 @@ function M() {
|
|
|
546
559
|
e.type,
|
|
547
560
|
")"
|
|
548
561
|
] }),
|
|
549
|
-
selectedOption:
|
|
550
|
-
selectedLoading:
|
|
551
|
-
hasMore:
|
|
552
|
-
totalCount:
|
|
553
|
-
onLoadMore:
|
|
554
|
-
loadingMore:
|
|
562
|
+
selectedOption: J ? V : null,
|
|
563
|
+
selectedLoading: !J,
|
|
564
|
+
hasMore: $e,
|
|
565
|
+
totalCount: et,
|
|
566
|
+
onLoadMore: nt,
|
|
567
|
+
loadingMore: Qe,
|
|
555
568
|
required: !0,
|
|
556
|
-
placeholder:
|
|
569
|
+
placeholder: N.vehicleId ? `Current: ${N.vehicleId}` : "Select a vehicle",
|
|
557
570
|
emptyText: "No available vehicles."
|
|
558
571
|
})]
|
|
559
572
|
}),
|
|
560
573
|
/* @__PURE__ */ O("div", {
|
|
561
574
|
className: "space-y-1.5",
|
|
562
|
-
children: [/* @__PURE__ */ D(
|
|
575
|
+
children: [/* @__PURE__ */ D(m, {
|
|
563
576
|
htmlFor: "assign-driver",
|
|
564
577
|
children: "Driver"
|
|
565
|
-
}), /* @__PURE__ */ D(
|
|
578
|
+
}), /* @__PURE__ */ D(C, {
|
|
566
579
|
id: "assign-driver",
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
580
|
+
disabled: Z,
|
|
581
|
+
value: q ?? "",
|
|
582
|
+
onChange: Ye,
|
|
583
|
+
options: gt,
|
|
584
|
+
loading: z,
|
|
571
585
|
getId: (e) => e.id,
|
|
572
586
|
getLabel: (e) => `${e.fullName} (${e.employeeId})`,
|
|
573
587
|
renderOption: (e) => /* @__PURE__ */ O(E, { children: [
|
|
@@ -576,26 +590,26 @@ function M() {
|
|
|
576
590
|
e.employeeId,
|
|
577
591
|
")"
|
|
578
592
|
] }),
|
|
579
|
-
selectedOption:
|
|
580
|
-
selectedLoading:
|
|
581
|
-
hasMore:
|
|
582
|
-
totalCount:
|
|
583
|
-
onLoadMore:
|
|
584
|
-
loadingMore:
|
|
593
|
+
selectedOption: Y ? H : null,
|
|
594
|
+
selectedLoading: !Y,
|
|
595
|
+
hasMore: at,
|
|
596
|
+
totalCount: ot,
|
|
597
|
+
onLoadMore: ct,
|
|
598
|
+
loadingMore: it,
|
|
585
599
|
required: !0,
|
|
586
|
-
placeholder:
|
|
600
|
+
placeholder: N.driverId ? `Current: ${N.driverId}` : "Select a driver",
|
|
587
601
|
emptyText: "No available drivers."
|
|
588
602
|
})]
|
|
589
603
|
}),
|
|
590
|
-
/* @__PURE__ */ O(
|
|
604
|
+
/* @__PURE__ */ O(l, {
|
|
591
605
|
className: "w-full",
|
|
592
|
-
onClick:
|
|
593
|
-
disabled:
|
|
594
|
-
children: [/* @__PURE__ */ D(
|
|
606
|
+
onClick: Tt,
|
|
607
|
+
disabled: Z || !wt || St || !J || !Y || L || z || !!(R || B),
|
|
608
|
+
children: [/* @__PURE__ */ D(ce, { size: 16 }), X.busy ? "Assigning…" : "Assign driver & vehicle"]
|
|
595
609
|
})
|
|
596
610
|
]
|
|
597
611
|
}),
|
|
598
|
-
/* @__PURE__ */ D(
|
|
612
|
+
/* @__PURE__ */ D(h, {}),
|
|
599
613
|
/* @__PURE__ */ O("div", {
|
|
600
614
|
className: "space-y-2",
|
|
601
615
|
children: [
|
|
@@ -606,59 +620,73 @@ function M() {
|
|
|
606
620
|
" ",
|
|
607
621
|
/* @__PURE__ */ D("span", {
|
|
608
622
|
className: "font-medium",
|
|
609
|
-
children:
|
|
623
|
+
children: ze[N.status]
|
|
610
624
|
})
|
|
611
625
|
]
|
|
612
626
|
}),
|
|
627
|
+
G && /* @__PURE__ */ D("p", {
|
|
628
|
+
className: "text-sm text-status-error-text",
|
|
629
|
+
role: "status",
|
|
630
|
+
children: k("movethewheels.order.currentVehicleHeld", "The currently assigned vehicle is on hold. Save a replacement before advancing movement.")
|
|
631
|
+
}),
|
|
613
632
|
(() => {
|
|
614
|
-
let e =
|
|
633
|
+
let e = Ve(N.status);
|
|
615
634
|
if (!e) return null;
|
|
616
|
-
let n = e === "assigned" && (!
|
|
617
|
-
return /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ O(
|
|
635
|
+
let n = e === "assigned" && (!N.vehicleId || !N.driverId);
|
|
636
|
+
return /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ O(l, {
|
|
618
637
|
variant: "outline",
|
|
619
638
|
className: "w-full",
|
|
620
|
-
onClick: () => Q(e
|
|
621
|
-
disabled:
|
|
622
|
-
|
|
639
|
+
onClick: () => Q(e),
|
|
640
|
+
disabled: Z || n || [
|
|
641
|
+
"assigned",
|
|
642
|
+
"picked_up",
|
|
643
|
+
"in_transit",
|
|
644
|
+
"out_for_delivery"
|
|
645
|
+
].includes(e) && (!W || G),
|
|
646
|
+
children: [/* @__PURE__ */ D(t, { size: 16 }), X.busy ? "Updating…" : `Advance to ${ze[e]}`]
|
|
623
647
|
}), n && /* @__PURE__ */ D("p", {
|
|
624
648
|
className: "text-xs text-text-secondary",
|
|
625
649
|
children: "Assign both a compatible vehicle and driver before dispatching this order."
|
|
626
650
|
})] });
|
|
627
651
|
})(),
|
|
628
|
-
|
|
652
|
+
N.status !== "cancelled" && !Be.has(N.status) && /* @__PURE__ */ O(l, {
|
|
629
653
|
variant: "outline",
|
|
630
654
|
className: "w-full text-status-error-text",
|
|
631
|
-
onClick: () => Q("cancelled"
|
|
632
|
-
disabled:
|
|
633
|
-
children: [/* @__PURE__ */ D(
|
|
655
|
+
onClick: () => Q("cancelled"),
|
|
656
|
+
disabled: Z,
|
|
657
|
+
children: [/* @__PURE__ */ D(r, { size: 16 }), "Cancel order"]
|
|
634
658
|
})
|
|
635
659
|
]
|
|
636
660
|
}),
|
|
637
|
-
/* @__PURE__ */ O(
|
|
661
|
+
/* @__PURE__ */ O(l, {
|
|
638
662
|
variant: "outline",
|
|
639
663
|
className: "w-full",
|
|
640
|
-
onClick: () => $(`tracking?order=${
|
|
641
|
-
children: [/* @__PURE__ */ D(
|
|
664
|
+
onClick: () => $(`tracking?order=${N.id}`),
|
|
665
|
+
children: [/* @__PURE__ */ D(i, { size: 16 }), "Track Order"]
|
|
642
666
|
})
|
|
643
667
|
]
|
|
644
668
|
}) })] }),
|
|
645
|
-
/* @__PURE__ */ D(
|
|
669
|
+
/* @__PURE__ */ D(je, {
|
|
646
670
|
entityType: "order",
|
|
647
|
-
entityId:
|
|
671
|
+
entityId: N.id
|
|
648
672
|
}),
|
|
649
|
-
/* @__PURE__ */ D(
|
|
650
|
-
|
|
673
|
+
/* @__PURE__ */ D(Fe, { deliveryJobId: N.id }),
|
|
674
|
+
N.specialInstructions && /* @__PURE__ */ O(u, { children: [/* @__PURE__ */ D(f, { children: /* @__PURE__ */ O(p, {
|
|
651
675
|
className: "flex items-center gap-2",
|
|
652
|
-
children: [/* @__PURE__ */ D(
|
|
653
|
-
}) }), /* @__PURE__ */ D(
|
|
676
|
+
children: [/* @__PURE__ */ D(ne, { size: 18 }), "Special Instructions"]
|
|
677
|
+
}) }), /* @__PURE__ */ D(d, { children: /* @__PURE__ */ D("p", {
|
|
654
678
|
className: "text-sm",
|
|
655
|
-
children:
|
|
679
|
+
children: N.specialInstructions
|
|
656
680
|
}) })] })
|
|
657
681
|
]
|
|
658
682
|
})]
|
|
659
683
|
})
|
|
660
684
|
]
|
|
685
|
+
}) : /* @__PURE__ */ D(we, {
|
|
686
|
+
title: k("movethewheels.order.unavailable", "Order unavailable"),
|
|
687
|
+
message: k("movethewheels.order.loadUnavailable", "The requested order could not be loaded. Refresh before making changes."),
|
|
688
|
+
onRetry: He
|
|
661
689
|
});
|
|
662
690
|
}
|
|
663
691
|
//#endregion
|
|
664
|
-
export {
|
|
692
|
+
export { A as default };
|