@burdenoff/microfe-movethewheels 2026.1107.5 → 2026.1107.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CarrierRecommendationDialog.js +21 -0
- package/dist/components/DispatchDecisionCard.js +111 -97
- package/dist/components/ShipmentDecisionPanel.js +362 -0
- package/dist/components/ShipmentRiskDialog.js +134 -89
- package/dist/generated/tracking-quality-operations.d.ts +288 -0
- package/dist/generated/wspace-types.d.ts +1206 -5
- package/dist/hooks/useShipmentDecision.js +111 -0
- package/dist/movethewheels/components/CarrierRecommendationDialog.d.ts +20 -0
- package/dist/movethewheels/components/DispatchDecisionCard.d.ts +5 -1
- package/dist/movethewheels/components/ShipmentDecisionPanel.d.ts +14 -0
- package/dist/movethewheels/hooks/useDispatchPlan.d.ts +1 -1
- package/dist/movethewheels/hooks/useShipmentDecision.d.ts +67 -0
- package/dist/pages/DispatchPlanPage.js +198 -171
- package/package.json +1 -1
- package/src/generated/tracking-quality-operations.ts +321 -0
- package/src/generated/wspace-types.ts +1379 -5
- package/src/movethewheels/components/CarrierRecommendationDialog.tsx +54 -0
- package/src/movethewheels/components/DispatchDecisionCard.tsx +17 -2
- package/src/movethewheels/components/ShipmentDecisionPanel.tsx +459 -0
- package/src/movethewheels/components/ShipmentRiskDialog.tsx +67 -1
- package/src/movethewheels/hooks/useShipmentDecision.ts +318 -0
- package/src/movethewheels/pages/DispatchPlanPage.tsx +30 -1
|
@@ -1,70 +1,72 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Building2 as e } from "../node_modules/lucide-react/dist/esm/icons/building-2.js";
|
|
2
|
+
import { LoaderCircle as t } from "../node_modules/lucide-react/dist/esm/icons/loader-circle.js";
|
|
3
|
+
import { Navigation as n } from "../node_modules/lucide-react/dist/esm/icons/navigation.js";
|
|
4
|
+
import { Plus as r } from "../node_modules/lucide-react/dist/esm/icons/plus.js";
|
|
5
|
+
import { RefreshCw as ee } from "../node_modules/lucide-react/dist/esm/icons/refresh-cw.js";
|
|
5
6
|
import { Sparkles as i } from "../node_modules/lucide-react/dist/esm/icons/sparkles.js";
|
|
6
7
|
import { WandSparkles as a } from "../node_modules/lucide-react/dist/esm/icons/wand-sparkles.js";
|
|
7
|
-
import { joinPath as
|
|
8
|
-
import { useMoveTheWheels as
|
|
9
|
-
import { formatDateTime as
|
|
10
|
-
import { Badge as
|
|
11
|
-
import { PageLayout as
|
|
12
|
-
import { FormError as
|
|
13
|
-
import { Notice as
|
|
14
|
-
import { DispatchDecisionCard as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
8
|
+
import { joinPath as te } from "../utils/navigation.js";
|
|
9
|
+
import { useMoveTheWheels as o } from "../providers/MoveTheWheelsProvider.js";
|
|
10
|
+
import { formatDateTime as s } from "../utils/formatters.js";
|
|
11
|
+
import { Badge as c, Button as l, Card as u, CardContent as d, CardHeader as f, CardTitle as p, Select as ne, SelectContent as re, SelectItem as m, SelectTrigger as h, SelectValue as g, Skeleton as _ } from "../components/ui.js";
|
|
12
|
+
import { PageLayout as v } from "../components/PageLayout.js";
|
|
13
|
+
import { FormError as y } from "../components/FormError.js";
|
|
14
|
+
import { Notice as b, useNotice as x } from "../components/Notice.js";
|
|
15
|
+
import { DispatchDecisionCard as S } from "../components/DispatchDecisionCard.js";
|
|
16
|
+
import { CarrierRecommendationDialog as C } from "../components/CarrierRecommendationDialog.js";
|
|
17
|
+
import { useDispatchPlan as ie } from "../hooks/useDispatchPlan.js";
|
|
18
|
+
import { useEffect as ae, useMemo as oe, useState as w } from "react";
|
|
19
|
+
import { Fragment as se, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
20
|
+
import { useI18n as ce } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
21
|
+
import { CTAOverflowMenu as D, EmphasisPanel as O, PagePurpose as k } from "@burdenoff/fe-libs/ui";
|
|
20
22
|
//#region src/movethewheels/pages/DispatchPlanPage.tsx
|
|
21
|
-
var
|
|
23
|
+
var A = {
|
|
22
24
|
"24h": 24,
|
|
23
25
|
"72h": 72,
|
|
24
26
|
"7d": 168
|
|
25
|
-
},
|
|
27
|
+
}, j = {
|
|
26
28
|
PROPOSED: ["movethewheels.dispatch.status.proposed", "Waiting for your decision"],
|
|
27
29
|
APPLYING: ["movethewheels.dispatch.status.applying", "Applying decisions"],
|
|
28
30
|
APPLIED: ["movethewheels.dispatch.status.applied", "All accepted"],
|
|
29
31
|
PARTIALLY_APPLIED: ["movethewheels.dispatch.status.partiallyApplied", "Partly accepted"],
|
|
30
32
|
REJECTED: ["movethewheels.dispatch.status.rejected", "Rejected — nothing written"],
|
|
31
33
|
EXPIRED: ["movethewheels.dispatch.status.expired", "Expired"]
|
|
32
|
-
},
|
|
34
|
+
}, M = {
|
|
33
35
|
NOT_NEEDED: ["movethewheels.dispatch.ai.notNeeded", "Nothing could be assigned, so there was nothing for AI to explain."],
|
|
34
36
|
AI_DISABLED: ["movethewheels.dispatch.ai.disabled", "AI explanations are switched off. The rule-based rationale below is complete."],
|
|
35
37
|
CREDITS_EXHAUSTED: ["movethewheels.dispatch.ai.creditsExhausted", "This workspace has used its MoveTheWheels AI credits, so no AI explanation was written. The proposal and its rule-based rationale are unaffected."],
|
|
36
38
|
DAILY_CAP_REACHED: ["movethewheels.dispatch.ai.dailyCap", "Today's AI explanation limit is reached. The proposal and its rule-based rationale are unaffected."],
|
|
37
39
|
UNAVAILABLE: ["movethewheels.dispatch.ai.unavailable", "The AI explanation could not be produced this time. The proposal and its rule-based rationale are unaffected."]
|
|
38
|
-
},
|
|
40
|
+
}, N = {
|
|
39
41
|
NO_ELIGIBLE_PAIR: ["movethewheels.dispatch.unassigned.noPair", "No linked vehicle and driver are free (vehicle active and not on a live route, driver with a valid licence)."],
|
|
40
42
|
FLEET_FULLY_ASSIGNED: ["movethewheels.dispatch.unassigned.fleetFull", "Every free vehicle and driver pair is already used in this plan."],
|
|
41
43
|
OVER_CAPACITY: ["movethewheels.dispatch.unassigned.overCapacity", "The load is heavier than every free vehicle’s recorded capacity."],
|
|
42
44
|
PLAN_LIMIT_REACHED: ["movethewheels.dispatch.unassigned.limit", "The plan reached its assignment limit."],
|
|
43
45
|
NOT_PLANNABLE: ["movethewheels.dispatch.unassigned.notPlannable", "Not a planned shipment without a route."]
|
|
44
46
|
};
|
|
45
|
-
function
|
|
46
|
-
return e === "all" ? {} : { to: new Date(Date.now() +
|
|
47
|
+
function P(e) {
|
|
48
|
+
return e === "all" ? {} : { to: new Date(Date.now() + A[e] * 36e5).toISOString() };
|
|
47
49
|
}
|
|
48
|
-
function
|
|
49
|
-
let [n, r] =
|
|
50
|
-
return /* @__PURE__ */ O
|
|
50
|
+
function F({ plan: e, t }) {
|
|
51
|
+
let [n, r] = j[e.status];
|
|
52
|
+
return /* @__PURE__ */ E(O, { children: [/* @__PURE__ */ E("div", {
|
|
51
53
|
className: "flex flex-wrap items-center justify-between gap-3",
|
|
52
|
-
children: [/* @__PURE__ */
|
|
54
|
+
children: [/* @__PURE__ */ E("div", {
|
|
53
55
|
className: "space-y-1",
|
|
54
|
-
children: [/* @__PURE__ */
|
|
56
|
+
children: [/* @__PURE__ */ E("p", {
|
|
55
57
|
className: "text-sm font-medium text-text-secondary",
|
|
56
58
|
children: [
|
|
57
59
|
t("movethewheels.dispatch.planLabel", "Latest proposal"),
|
|
58
60
|
" ·",
|
|
59
61
|
" ",
|
|
60
|
-
|
|
62
|
+
s(e.createdAt)
|
|
61
63
|
]
|
|
62
|
-
}), /* @__PURE__ */
|
|
64
|
+
}), /* @__PURE__ */ E("div", {
|
|
63
65
|
className: "flex flex-wrap items-center gap-2",
|
|
64
|
-
children: [/* @__PURE__ */
|
|
66
|
+
children: [/* @__PURE__ */ T(c, {
|
|
65
67
|
variant: e.status === "PROPOSED" ? "default" : "secondary",
|
|
66
68
|
children: t(n, r)
|
|
67
|
-
}), /* @__PURE__ */
|
|
69
|
+
}), /* @__PURE__ */ E("span", {
|
|
68
70
|
className: "text-xs text-text-secondary",
|
|
69
71
|
children: [
|
|
70
72
|
t("movethewheels.dispatch.method", "Rule-based planner"),
|
|
@@ -74,301 +76,326 @@ function I({ plan: e, t }) {
|
|
|
74
76
|
]
|
|
75
77
|
})]
|
|
76
78
|
})]
|
|
77
|
-
}), /* @__PURE__ */
|
|
79
|
+
}), /* @__PURE__ */ E("div", {
|
|
78
80
|
className: "grid grid-cols-3 gap-4 text-center",
|
|
79
81
|
children: [
|
|
80
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("p", {
|
|
81
83
|
className: "text-2xl font-bold tabular-nums text-text-primary",
|
|
82
84
|
children: e.assignments.length
|
|
83
|
-
}), /* @__PURE__ */
|
|
85
|
+
}), /* @__PURE__ */ T("p", {
|
|
84
86
|
className: "text-xs text-text-secondary",
|
|
85
87
|
children: t("movethewheels.dispatch.proposed", "Proposed")
|
|
86
88
|
})] }),
|
|
87
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("p", {
|
|
88
90
|
className: "text-2xl font-bold tabular-nums text-text-primary",
|
|
89
91
|
children: e.acceptedCount
|
|
90
|
-
}), /* @__PURE__ */
|
|
92
|
+
}), /* @__PURE__ */ T("p", {
|
|
91
93
|
className: "text-xs text-text-secondary",
|
|
92
94
|
children: t("movethewheels.dispatch.acceptedCount", "Accepted")
|
|
93
95
|
})] }),
|
|
94
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("p", {
|
|
95
97
|
className: "text-2xl font-bold tabular-nums text-text-primary",
|
|
96
98
|
children: e.unassigned.length
|
|
97
|
-
}), /* @__PURE__ */
|
|
99
|
+
}), /* @__PURE__ */ T("p", {
|
|
98
100
|
className: "text-xs text-text-secondary",
|
|
99
101
|
children: t("movethewheels.dispatch.unassignedCount", "Unassigned")
|
|
100
102
|
})] })
|
|
101
103
|
]
|
|
102
104
|
})]
|
|
103
|
-
}), e.status === "PROPOSED" && /* @__PURE__ */
|
|
105
|
+
}), e.status === "PROPOSED" && /* @__PURE__ */ E("p", {
|
|
104
106
|
className: "mt-3 text-xs text-text-secondary",
|
|
105
107
|
children: [
|
|
106
108
|
t("movethewheels.dispatch.expires", "Valid until"),
|
|
107
109
|
" ",
|
|
108
|
-
|
|
110
|
+
s(e.expiresAt)
|
|
109
111
|
]
|
|
110
112
|
})] });
|
|
111
113
|
}
|
|
112
|
-
function
|
|
113
|
-
if (e.aiStatus === "AVAILABLE" && e.aiSummary) return /* @__PURE__ */
|
|
114
|
+
function I({ plan: e, t }) {
|
|
115
|
+
if (e.aiStatus === "AVAILABLE" && e.aiSummary) return /* @__PURE__ */ E(u, { children: [/* @__PURE__ */ T(f, { children: /* @__PURE__ */ E(p, {
|
|
114
116
|
className: "flex items-center gap-2 text-base",
|
|
115
|
-
children: [/* @__PURE__ */
|
|
117
|
+
children: [/* @__PURE__ */ T(i, {
|
|
116
118
|
size: 16,
|
|
117
119
|
"aria-hidden": "true"
|
|
118
120
|
}), t("movethewheels.dispatch.ai.title", "AI summary")]
|
|
119
|
-
}) }), /* @__PURE__ */
|
|
121
|
+
}) }), /* @__PURE__ */ E(d, {
|
|
120
122
|
className: "space-y-2",
|
|
121
|
-
children: [/* @__PURE__ */
|
|
123
|
+
children: [/* @__PURE__ */ T("p", {
|
|
122
124
|
className: "text-sm text-text-primary",
|
|
123
125
|
children: e.aiSummary
|
|
124
|
-
}), /* @__PURE__ */
|
|
126
|
+
}), /* @__PURE__ */ E("p", {
|
|
125
127
|
className: "text-xs text-text-secondary",
|
|
126
128
|
children: [t("movethewheels.dispatch.ai.disclaimer", "Written by AI from the planner’s facts. It never changes an assignment; check before accepting."), e.aiModel ? ` (${e.aiModel})` : ""]
|
|
127
129
|
})]
|
|
128
130
|
})] });
|
|
129
|
-
let [n, r] =
|
|
130
|
-
return /* @__PURE__ */
|
|
131
|
+
let [n, r] = M[e.aiStatus === "AVAILABLE" ? "UNAVAILABLE" : e.aiStatus];
|
|
132
|
+
return /* @__PURE__ */ T("div", {
|
|
131
133
|
role: "status",
|
|
132
134
|
className: "rounded-lg border border-status-info-border bg-status-info-bg-subtle px-4 py-3 text-sm text-status-info-text",
|
|
133
135
|
children: t(n, r)
|
|
134
136
|
});
|
|
135
137
|
}
|
|
136
|
-
function
|
|
137
|
-
let { t: i } =
|
|
138
|
+
function L() {
|
|
139
|
+
let { t: i } = ce(), s = (e, t) => {
|
|
138
140
|
let n = i(e);
|
|
139
141
|
return n === e ? t : n;
|
|
140
|
-
}, { basePath:
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}, [
|
|
144
|
-
let Y =
|
|
145
|
-
|
|
142
|
+
}, { basePath: c, navigate: O } = o(), A = (e) => O?.(te(c, e)), { plan: j, isLoading: M, error: L, pendingAction: R, refetch: z, propose: B, apply: V, reject: H } = ie(), [U, le] = w("72h"), [W, G] = w({}), [ue, K] = w(null), [de, q] = w(null), { message: fe, notify: J } = x(6e3);
|
|
143
|
+
ae(() => {
|
|
144
|
+
G({});
|
|
145
|
+
}, [j?.id, j?.status]);
|
|
146
|
+
let Y = j?.status === "PROPOSED", X = R !== null, Z = oe(() => j ? j.assignments.filter((e) => W[e.id] === "accept").map((e) => e.id) : [], [j, W]), pe = j ? j.assignments.filter((e) => e.decision === "PENDING" && !W[e.id]).length : 0, Q = async (e, t) => {
|
|
147
|
+
K(null);
|
|
146
148
|
try {
|
|
147
|
-
|
|
149
|
+
J(t(await e()));
|
|
148
150
|
} catch (e) {
|
|
149
|
-
|
|
151
|
+
K(e instanceof Error ? e.message : "The request failed.");
|
|
150
152
|
}
|
|
151
|
-
},
|
|
152
|
-
return /* @__PURE__ */
|
|
153
|
-
title:
|
|
154
|
-
subtitle:
|
|
155
|
-
icon: /* @__PURE__ */
|
|
153
|
+
}, me = () => Q(() => B(P(U)), (e) => e.assignments.length > 0 ? s("movethewheels.dispatch.notice.proposed", "New proposal ready. Nothing is written until you accept.") : s("movethewheels.dispatch.notice.proposedEmpty", "No shipment could be assigned right now.")), he = () => j && Q(() => V(j.id, Z), (e) => `${s("movethewheels.dispatch.notice.applied", "Decisions applied. Routes created")}: ${e.acceptedCount}`), ge = () => j && Q(() => H(j.id), () => s("movethewheels.dispatch.notice.rejected", "Proposal rejected. Nothing was written.")), $ = (e) => j && G(Object.fromEntries(j.assignments.map((t) => [t.id, e])));
|
|
154
|
+
return /* @__PURE__ */ E(v, {
|
|
155
|
+
title: s("movethewheels.dispatch.title", "Dispatch planner"),
|
|
156
|
+
subtitle: s("movethewheels.dispatch.subtitle", "Proposed vehicle and driver assignments for planned shipments — you decide what becomes a route."),
|
|
157
|
+
icon: /* @__PURE__ */ T(a, {
|
|
156
158
|
size: 24,
|
|
157
159
|
"aria-hidden": "true"
|
|
158
160
|
}),
|
|
159
|
-
headerActions: /* @__PURE__ */ D
|
|
161
|
+
headerActions: /* @__PURE__ */ T(D, {
|
|
160
162
|
primary: {
|
|
161
|
-
label:
|
|
162
|
-
icon: /* @__PURE__ */
|
|
163
|
-
onSelect: () =>
|
|
163
|
+
label: s("movethewheels.dispatch.manual", "Create route manually"),
|
|
164
|
+
icon: /* @__PURE__ */ T(r, { size: 16 }),
|
|
165
|
+
onSelect: () => A("routes/new")
|
|
164
166
|
},
|
|
165
167
|
actions: [{
|
|
166
|
-
label:
|
|
167
|
-
icon: /* @__PURE__ */
|
|
168
|
-
onSelect: () =>
|
|
168
|
+
label: s("movethewheels.dispatch.allRoutes", "All routes"),
|
|
169
|
+
icon: /* @__PURE__ */ T(n, { size: 16 }),
|
|
170
|
+
onSelect: () => A("routes")
|
|
169
171
|
}, {
|
|
170
|
-
label:
|
|
171
|
-
icon: /* @__PURE__ */
|
|
172
|
-
onSelect: () =>
|
|
172
|
+
label: s("movethewheels.dispatch.refresh", "Refresh"),
|
|
173
|
+
icon: /* @__PURE__ */ T(ee, { size: 16 }),
|
|
174
|
+
onSelect: () => z()
|
|
173
175
|
}]
|
|
174
176
|
}),
|
|
175
177
|
children: [
|
|
176
|
-
/* @__PURE__ */
|
|
177
|
-
icon: /* @__PURE__ */
|
|
178
|
-
children:
|
|
178
|
+
/* @__PURE__ */ T(k, {
|
|
179
|
+
icon: /* @__PURE__ */ T(a, { size: 18 }),
|
|
180
|
+
children: s("movethewheels.dispatch.purpose", "The planner pairs each planned shipment that has no route with a free, linked vehicle and driver, earliest due first, and explains why. Proposing writes nothing. Accept the cards you agree with and apply: each accepted card becomes a planned route, checked again at that moment; everything else is rejected.")
|
|
179
181
|
}),
|
|
180
|
-
/* @__PURE__ */
|
|
182
|
+
/* @__PURE__ */ T(u, { children: /* @__PURE__ */ E(d, {
|
|
181
183
|
className: "flex flex-wrap items-center gap-3 p-4",
|
|
182
184
|
children: [
|
|
183
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ T("span", {
|
|
184
186
|
className: "text-sm font-medium",
|
|
185
|
-
children:
|
|
187
|
+
children: s("movethewheels.dispatch.horizon", "Shipments due within")
|
|
186
188
|
}),
|
|
187
|
-
/* @__PURE__ */
|
|
188
|
-
value:
|
|
189
|
-
onValueChange: (e) =>
|
|
190
|
-
children: [/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ E(ne, {
|
|
190
|
+
value: U,
|
|
191
|
+
onValueChange: (e) => le(e),
|
|
192
|
+
children: [/* @__PURE__ */ T(h, {
|
|
191
193
|
className: "w-[180px]",
|
|
192
|
-
"aria-label":
|
|
193
|
-
children: /* @__PURE__ */
|
|
194
|
-
}), /* @__PURE__ */
|
|
195
|
-
/* @__PURE__ */
|
|
194
|
+
"aria-label": s("movethewheels.dispatch.horizon", "Shipments due within"),
|
|
195
|
+
children: /* @__PURE__ */ T(g, {})
|
|
196
|
+
}), /* @__PURE__ */ E(re, { children: [
|
|
197
|
+
/* @__PURE__ */ T(m, {
|
|
196
198
|
value: "24h",
|
|
197
|
-
children:
|
|
199
|
+
children: s("movethewheels.dispatch.horizon.24h", "Next 24 hours")
|
|
198
200
|
}),
|
|
199
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ T(m, {
|
|
200
202
|
value: "72h",
|
|
201
|
-
children:
|
|
203
|
+
children: s("movethewheels.dispatch.horizon.72h", "Next 3 days")
|
|
202
204
|
}),
|
|
203
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ T(m, {
|
|
204
206
|
value: "7d",
|
|
205
|
-
children:
|
|
207
|
+
children: s("movethewheels.dispatch.horizon.7d", "Next 7 days")
|
|
206
208
|
}),
|
|
207
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ T(m, {
|
|
208
210
|
value: "all",
|
|
209
|
-
children:
|
|
211
|
+
children: s("movethewheels.dispatch.horizon.all", "Any due date")
|
|
210
212
|
})
|
|
211
213
|
] })]
|
|
212
214
|
}),
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
-
onClick:
|
|
215
|
+
/* @__PURE__ */ E(l, {
|
|
216
|
+
onClick: me,
|
|
215
217
|
disabled: X,
|
|
216
|
-
children: [
|
|
218
|
+
children: [R === "propose" ? /* @__PURE__ */ T(t, {
|
|
217
219
|
size: 16,
|
|
218
220
|
className: "animate-spin",
|
|
219
221
|
"aria-hidden": "true"
|
|
220
|
-
}) : /* @__PURE__ */
|
|
222
|
+
}) : /* @__PURE__ */ T(a, {
|
|
221
223
|
size: 16,
|
|
222
224
|
"aria-hidden": "true"
|
|
223
|
-
}),
|
|
225
|
+
}), R === "propose" ? s("movethewheels.dispatch.proposing", "Proposing…") : s("movethewheels.dispatch.propose", "Propose assignments")]
|
|
224
226
|
}),
|
|
225
|
-
/* @__PURE__ */
|
|
227
|
+
/* @__PURE__ */ T("span", {
|
|
226
228
|
className: "text-xs text-text-secondary",
|
|
227
|
-
children:
|
|
229
|
+
children: s("movethewheels.dispatch.noUndatedNote", "Shipments without a due date are always included.")
|
|
228
230
|
})
|
|
229
231
|
]
|
|
230
232
|
}) }),
|
|
231
|
-
/* @__PURE__ */
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
|
|
233
|
+
/* @__PURE__ */ T(b, { message: fe }),
|
|
234
|
+
/* @__PURE__ */ T(y, { message: ue }),
|
|
235
|
+
M && !j ? /* @__PURE__ */ E("div", {
|
|
234
236
|
className: "space-y-3",
|
|
235
|
-
children: [/* @__PURE__ */
|
|
236
|
-
}) :
|
|
237
|
+
children: [/* @__PURE__ */ T(_, { className: "h-24 w-full" }), /* @__PURE__ */ T(_, { className: "h-40 w-full" })]
|
|
238
|
+
}) : L ? /* @__PURE__ */ T(u, {
|
|
237
239
|
className: "border-status-error-border",
|
|
238
|
-
children: /* @__PURE__ */
|
|
240
|
+
children: /* @__PURE__ */ E(d, {
|
|
239
241
|
className: "space-y-3 p-6 text-center",
|
|
240
242
|
children: [
|
|
241
|
-
/* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ T("p", {
|
|
242
244
|
className: "font-medium text-status-error-text",
|
|
243
|
-
children:
|
|
245
|
+
children: s("movethewheels.dispatch.loadError", "Couldn't load the dispatch plan")
|
|
244
246
|
}),
|
|
245
|
-
/* @__PURE__ */
|
|
247
|
+
/* @__PURE__ */ T("p", {
|
|
246
248
|
className: "text-sm text-text-secondary",
|
|
247
|
-
children:
|
|
249
|
+
children: L.message
|
|
248
250
|
}),
|
|
249
|
-
/* @__PURE__ */
|
|
251
|
+
/* @__PURE__ */ T(l, {
|
|
250
252
|
variant: "outline",
|
|
251
|
-
onClick:
|
|
252
|
-
children:
|
|
253
|
+
onClick: z,
|
|
254
|
+
children: s("movethewheels.fleet.error.retry", "Retry")
|
|
253
255
|
})
|
|
254
256
|
]
|
|
255
257
|
})
|
|
256
|
-
}) :
|
|
257
|
-
/* @__PURE__ */
|
|
258
|
-
plan:
|
|
259
|
-
t:
|
|
258
|
+
}) : j ? /* @__PURE__ */ E(se, { children: [
|
|
259
|
+
/* @__PURE__ */ T(F, {
|
|
260
|
+
plan: j,
|
|
261
|
+
t: s
|
|
260
262
|
}),
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
plan:
|
|
263
|
-
t:
|
|
263
|
+
/* @__PURE__ */ T(I, {
|
|
264
|
+
plan: j,
|
|
265
|
+
t: s
|
|
264
266
|
}),
|
|
265
|
-
Y &&
|
|
267
|
+
Y && j.assignments.length > 0 && /* @__PURE__ */ T(u, { children: /* @__PURE__ */ E(d, {
|
|
266
268
|
className: "flex flex-wrap items-center justify-between gap-3 p-4",
|
|
267
|
-
children: [/* @__PURE__ */
|
|
269
|
+
children: [/* @__PURE__ */ E("div", {
|
|
268
270
|
className: "space-y-1",
|
|
269
|
-
children: [/* @__PURE__ */
|
|
271
|
+
children: [/* @__PURE__ */ E("p", {
|
|
270
272
|
className: "text-sm font-medium text-text-primary",
|
|
271
273
|
"aria-live": "polite",
|
|
272
274
|
children: [
|
|
273
275
|
Z.length,
|
|
274
276
|
" ",
|
|
275
|
-
|
|
277
|
+
s("movethewheels.dispatch.toAccept", "to accept"),
|
|
276
278
|
" ·",
|
|
277
279
|
" ",
|
|
278
|
-
|
|
280
|
+
j.assignments.length - Z.length,
|
|
279
281
|
" ",
|
|
280
|
-
|
|
282
|
+
s("movethewheels.dispatch.toReject", "to reject")
|
|
281
283
|
]
|
|
282
|
-
}),
|
|
284
|
+
}), pe > 0 && /* @__PURE__ */ T("p", {
|
|
283
285
|
className: "text-xs text-text-secondary",
|
|
284
|
-
children:
|
|
286
|
+
children: s("movethewheels.dispatch.undecidedNote", "Cards you have not accepted are rejected when you apply.")
|
|
285
287
|
})]
|
|
286
|
-
}), /* @__PURE__ */
|
|
288
|
+
}), /* @__PURE__ */ E("div", {
|
|
287
289
|
className: "flex flex-wrap gap-2",
|
|
288
290
|
children: [
|
|
289
|
-
/* @__PURE__ */
|
|
291
|
+
/* @__PURE__ */ T(l, {
|
|
290
292
|
variant: "ghost",
|
|
291
293
|
size: "sm",
|
|
292
294
|
disabled: X,
|
|
293
295
|
onClick: () => $("accept"),
|
|
294
|
-
children:
|
|
296
|
+
children: s("movethewheels.dispatch.acceptAll", "Accept all")
|
|
295
297
|
}),
|
|
296
|
-
/* @__PURE__ */
|
|
298
|
+
/* @__PURE__ */ T(l, {
|
|
297
299
|
variant: "ghost",
|
|
298
300
|
size: "sm",
|
|
299
301
|
disabled: X,
|
|
300
302
|
onClick: () => $(null),
|
|
301
|
-
children:
|
|
303
|
+
children: s("movethewheels.dispatch.clear", "Clear")
|
|
302
304
|
}),
|
|
303
|
-
/* @__PURE__ */
|
|
305
|
+
/* @__PURE__ */ E(l, {
|
|
304
306
|
variant: "outline",
|
|
305
307
|
disabled: X,
|
|
306
|
-
onClick:
|
|
307
|
-
children: [
|
|
308
|
+
onClick: ge,
|
|
309
|
+
children: [R === "reject" && /* @__PURE__ */ T(t, {
|
|
308
310
|
size: 16,
|
|
309
311
|
className: "animate-spin",
|
|
310
312
|
"aria-hidden": "true"
|
|
311
|
-
}),
|
|
313
|
+
}), s("movethewheels.dispatch.rejectPlan", "Reject proposal")]
|
|
312
314
|
}),
|
|
313
|
-
/* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ E(l, {
|
|
314
316
|
disabled: X || Z.length === 0,
|
|
315
|
-
onClick:
|
|
316
|
-
children: [
|
|
317
|
+
onClick: he,
|
|
318
|
+
children: [R === "apply" && /* @__PURE__ */ T(t, {
|
|
317
319
|
size: 16,
|
|
318
320
|
className: "animate-spin",
|
|
319
321
|
"aria-hidden": "true"
|
|
320
|
-
}),
|
|
322
|
+
}), R === "apply" ? s("movethewheels.dispatch.applying", "Creating routes…") : s("movethewheels.dispatch.apply", "Apply decisions")]
|
|
321
323
|
})
|
|
322
324
|
]
|
|
323
325
|
})]
|
|
324
326
|
}) }),
|
|
325
|
-
|
|
326
|
-
"aria-label":
|
|
327
|
+
j.assignments.length > 0 && /* @__PURE__ */ T("section", {
|
|
328
|
+
"aria-label": s("movethewheels.dispatch.cards", "Decision cards"),
|
|
327
329
|
className: "grid gap-4 lg:grid-cols-2",
|
|
328
|
-
children:
|
|
330
|
+
children: j.assignments.map((e) => /* @__PURE__ */ T(S, {
|
|
329
331
|
assignment: e,
|
|
330
332
|
open: Y,
|
|
331
|
-
choice:
|
|
333
|
+
choice: W[e.id] ?? null,
|
|
332
334
|
disabled: X,
|
|
333
|
-
onChoose: (t) =>
|
|
335
|
+
onChoose: (t) => G((n) => ({
|
|
334
336
|
...n,
|
|
335
337
|
[e.id]: t
|
|
336
338
|
})),
|
|
337
|
-
onOpenRoute: (e) =>
|
|
338
|
-
|
|
339
|
+
onOpenRoute: (e) => A(`routes/${e}`),
|
|
340
|
+
onRecommendCarrier: (e, t) => q({
|
|
341
|
+
id: e,
|
|
342
|
+
number: t
|
|
343
|
+
}),
|
|
344
|
+
t: s
|
|
339
345
|
}, e.id))
|
|
340
346
|
}),
|
|
341
|
-
|
|
347
|
+
j.unassigned.length > 0 && /* @__PURE__ */ E(u, { children: [/* @__PURE__ */ T(f, { children: /* @__PURE__ */ T(p, {
|
|
342
348
|
className: "text-base",
|
|
343
|
-
children:
|
|
344
|
-
}) }), /* @__PURE__ */
|
|
349
|
+
children: s("movethewheels.dispatch.unassignedTitle", "Not assigned")
|
|
350
|
+
}) }), /* @__PURE__ */ T(d, { children: /* @__PURE__ */ T("ul", {
|
|
345
351
|
className: "divide-y",
|
|
346
|
-
children:
|
|
347
|
-
let
|
|
348
|
-
return /* @__PURE__ */
|
|
352
|
+
children: j.unassigned.map((t) => {
|
|
353
|
+
let n = N[t.reason];
|
|
354
|
+
return /* @__PURE__ */ E("li", {
|
|
349
355
|
className: "flex flex-wrap justify-between gap-2 py-2 text-sm",
|
|
350
|
-
children: [
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
356
|
+
children: [
|
|
357
|
+
/* @__PURE__ */ T("span", {
|
|
358
|
+
className: "font-medium break-words",
|
|
359
|
+
children: t.shipmentNumber ?? t.shipmentId
|
|
360
|
+
}),
|
|
361
|
+
/* @__PURE__ */ T("span", {
|
|
362
|
+
className: "text-text-secondary",
|
|
363
|
+
children: n ? s(n[0], n[1]) : t.reason
|
|
364
|
+
}),
|
|
365
|
+
t.reason !== "NOT_PLANNABLE" && /* @__PURE__ */ E(l, {
|
|
366
|
+
size: "sm",
|
|
367
|
+
variant: "outline",
|
|
368
|
+
onClick: () => q({
|
|
369
|
+
id: t.shipmentId,
|
|
370
|
+
number: t.shipmentNumber
|
|
371
|
+
}),
|
|
372
|
+
children: [/* @__PURE__ */ T(e, {
|
|
373
|
+
size: 14,
|
|
374
|
+
"aria-hidden": "true"
|
|
375
|
+
}), s("movethewheels.carrierDecision.propose", "Recommend a carrier")]
|
|
376
|
+
})
|
|
377
|
+
]
|
|
378
|
+
}, t.shipmentId);
|
|
358
379
|
})
|
|
359
380
|
}) })] })
|
|
360
|
-
] }) : /* @__PURE__ */
|
|
381
|
+
] }) : /* @__PURE__ */ T(u, { children: /* @__PURE__ */ E(d, {
|
|
361
382
|
className: "space-y-2 p-6 text-center",
|
|
362
|
-
children: [/* @__PURE__ */
|
|
383
|
+
children: [/* @__PURE__ */ T("p", {
|
|
363
384
|
className: "font-medium text-text-primary",
|
|
364
|
-
children:
|
|
365
|
-
}), /* @__PURE__ */
|
|
385
|
+
children: s("movethewheels.dispatch.empty", "No proposal yet")
|
|
386
|
+
}), /* @__PURE__ */ T("p", {
|
|
366
387
|
className: "text-sm text-text-secondary",
|
|
367
|
-
children:
|
|
388
|
+
children: s("movethewheels.dispatch.emptyHint", "Propose assignments to see decision cards for your planned shipments.")
|
|
368
389
|
})]
|
|
369
|
-
}) })
|
|
390
|
+
}) }),
|
|
391
|
+
/* @__PURE__ */ T(C, {
|
|
392
|
+
shipment: de,
|
|
393
|
+
onOpenChange: (e) => !e && q(null),
|
|
394
|
+
onApplied: () => J(s("movethewheels.carrierDecision.applied", "Carrier assigned to the shipment. It stays planned for you to hand over.")),
|
|
395
|
+
t: s
|
|
396
|
+
})
|
|
370
397
|
]
|
|
371
398
|
});
|
|
372
399
|
}
|
|
373
400
|
//#endregion
|
|
374
|
-
export {
|
|
401
|
+
export { L as default };
|
package/package.json
CHANGED