@burdenoff/microfe-movethewheels 2026.1102.1 → 2026.1102.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/components/freight-cost/FreightCommercialFactEditor.js +46 -46
- package/dist/components/freight-cost/FreightCommercialHistory.js +7 -7
- package/dist/components/freight-cost/FreightDraftForm.js +20 -20
- package/dist/components/freight-invoice/InvoiceReviewPanel.js +255 -0
- package/dist/components/freight-invoice/InvoiceReviewQueue.js +93 -0
- package/dist/generated/freight-invoice-operations.d.ts +461 -0
- package/dist/hooks/useInvoiceComparisonRecovery.js +26 -26
- package/dist/hooks/useInvoiceReviewPermissions.js +14 -0
- package/dist/movethewheels/components/freight-invoice/InvoiceReviewPanel.d.ts +11 -0
- package/dist/movethewheels/components/freight-invoice/InvoiceReviewQueue.d.ts +22 -0
- package/dist/movethewheels/hooks/useInvoiceReviewPermissions.d.ts +5 -0
- package/dist/movethewheels/pages/FinancePage.d.ts +3 -1
- package/dist/movethewheels/utils/invoiceReview.d.ts +26 -0
- package/dist/pages/FinancePage.js +109 -67
- package/dist/pages/FreightEstimatePage.js +89 -89
- package/dist/pages/FreightInvoicePage.js +138 -120
- package/dist/src/generated/freight-invoice-operations.js +2100 -1
- package/dist/utils/invoiceReview.js +84 -0
- package/package.json +2 -2
- package/src/generated/freight-invoice-operations.ts +245 -1
- package/src/movethewheels/components/freight-invoice/InvoiceReviewPanel.tsx +319 -0
- package/src/movethewheels/components/freight-invoice/InvoiceReviewQueue.tsx +96 -0
- package/src/movethewheels/hooks/useInvoiceReviewPermissions.ts +25 -0
- package/src/movethewheels/pages/FinancePage.tsx +34 -2
- package/src/movethewheels/pages/FreightInvoicePage.tsx +44 -3
- package/src/movethewheels/utils/invoiceReview.ts +146 -0
- package/src/operations/freight-invoice/review.graphql +26 -0
|
@@ -3,67 +3,67 @@ import { Button as t } from "../components/ui.js";
|
|
|
3
3
|
import { PageLayout as n } from "../components/PageLayout.js";
|
|
4
4
|
import { useConditionApi as r, useConditionQuery as i } from "../hooks/useContainerCondition.js";
|
|
5
5
|
import { PinnedSelect as a, ReusePager as o, ReuseState as s, reuseCard as c } from "../components/ReuseControls.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { FreightDraftForm as
|
|
10
|
-
import { FreightHistory as
|
|
11
|
-
import { useFreightRecoveryAction as
|
|
12
|
-
import { useEffect as
|
|
13
|
-
import { Fragment as
|
|
6
|
+
import { FreightText as l } from "../components/freight-cost/FreightFields.js";
|
|
7
|
+
import { freightPinMatches as u, freightSaveInput as d } from "../utils/freightDraft.js";
|
|
8
|
+
import { FreightCommercialVersionDocument as f, FreightHistoryDocument as p, FreightShipmentDocument as m, FreightShipmentsDocument as h, PreviewFreightCostsDocument as g, SaveFreightCommercialCostsDocument as _, SaveFreightCostsDocument as v } from "../src/generated/freight-cost-operations.js";
|
|
9
|
+
import { FreightDraftForm as y } from "../components/freight-cost/FreightDraftForm.js";
|
|
10
|
+
import { FreightHistory as ee } from "../components/freight-cost/FreightHistory.js";
|
|
11
|
+
import { useFreightRecoveryAction as b } from "../hooks/useFreightRecoveryAction.js";
|
|
12
|
+
import { useEffect as x, useRef as S, useState as C } from "react";
|
|
13
|
+
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
14
14
|
//#region src/movethewheels/pages/FreightEstimatePage.tsx
|
|
15
|
-
function
|
|
16
|
-
let t =
|
|
17
|
-
return /* @__PURE__ */
|
|
15
|
+
function D() {
|
|
16
|
+
let t = b();
|
|
17
|
+
return /* @__PURE__ */ T(n, {
|
|
18
18
|
title: "Freight cost estimates",
|
|
19
19
|
subtitle: "Dated source costs, visible unknowns and immutable versions.",
|
|
20
|
-
icon: /* @__PURE__ */
|
|
21
|
-
children: /* @__PURE__ */
|
|
20
|
+
icon: /* @__PURE__ */ T(e, { "aria-hidden": "true" }),
|
|
21
|
+
children: /* @__PURE__ */ T(O, { actions: t }, t.contextKey)
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
let n = r(), [
|
|
26
|
-
|
|
24
|
+
function O({ actions: e }) {
|
|
25
|
+
let n = r(), [b, D] = C(0), [O, k] = C(0), [A, te] = C(null), [j, ne] = C(""), [M, N] = C(null), [P, F] = C(null), [I, L] = C(!1), [R, z] = C(!1), [B, V] = C(null), H = S(!0), U = S(!1);
|
|
26
|
+
x(() => (H.current = !0, () => {
|
|
27
27
|
H.current = !1;
|
|
28
28
|
}), []);
|
|
29
|
-
let W = i(
|
|
29
|
+
let W = i(h, { pagination: {
|
|
30
30
|
limit: 25,
|
|
31
|
-
offset:
|
|
32
|
-
} }, e.revision), G = i(
|
|
33
|
-
shipmentId:
|
|
31
|
+
offset: b
|
|
32
|
+
} }, e.revision), G = i(m, A ? { id: A.id } : null, e.revision), K = i(p, A && j.trim() ? {
|
|
33
|
+
shipmentId: A.id,
|
|
34
34
|
estimateReference: j.trim(),
|
|
35
35
|
pagination: {
|
|
36
36
|
limit: 1,
|
|
37
37
|
offset: 0
|
|
38
38
|
}
|
|
39
|
-
} : null, e.revision), q = e.uncertain ? e.originalHistoryTarget :
|
|
40
|
-
shipmentId:
|
|
39
|
+
} : null, e.revision), q = e.uncertain ? e.originalHistoryTarget : A ? {
|
|
40
|
+
shipmentId: A.id,
|
|
41
41
|
estimateReference: void 0
|
|
42
|
-
} : null, J = i(
|
|
42
|
+
} : null, J = i(p, q ? {
|
|
43
43
|
shipmentId: q.shipmentId,
|
|
44
44
|
estimateReference: q.estimateReference,
|
|
45
45
|
pagination: {
|
|
46
46
|
limit: 10,
|
|
47
|
-
offset:
|
|
47
|
+
offset: O
|
|
48
48
|
}
|
|
49
|
-
} : null, e.revision), Y = i(
|
|
49
|
+
} : null, e.revision), Y = i(f, q && M ? {
|
|
50
50
|
shipmentId: q.shipmentId,
|
|
51
|
-
id:
|
|
52
|
-
} : null, e.revision), X = K.data?.mtwFreightEstimatePage.items[0] ?? null, Z = !!
|
|
51
|
+
id: M
|
|
52
|
+
} : null, e.revision), X = K.data?.mtwFreightEstimatePage.items[0] ?? null, Z = !!P && !!G.data && !!K.data && !u(P, G.data.shipment, X), Q = e.busy || I || e.uncertain, $ = W.data?.shipments.map((e) => ({
|
|
53
53
|
id: e.id,
|
|
54
54
|
label: `${e.shipmentNumber} — ${e.primaryMode} — ${e.status}`
|
|
55
55
|
})) ?? [];
|
|
56
|
-
|
|
57
|
-
id:
|
|
58
|
-
label: `${
|
|
56
|
+
A && !$.some((e) => e.id === A.id) && $.unshift({
|
|
57
|
+
id: A.id,
|
|
58
|
+
label: `${A.label} — selected outside this page`
|
|
59
59
|
});
|
|
60
60
|
let re = async (t, r, i) => {
|
|
61
61
|
if (U.current || Q) return;
|
|
62
|
-
if (!
|
|
62
|
+
if (!P) throw Error("Review the shipment and current cost history first.");
|
|
63
63
|
U.current = !0, L(!0), V(null);
|
|
64
|
-
let a =
|
|
64
|
+
let a = P;
|
|
65
65
|
try {
|
|
66
|
-
let o = await n(
|
|
66
|
+
let o = await n(m, { id: a.shipmentId }), s = await n(p, {
|
|
67
67
|
shipmentId: a.shipmentId,
|
|
68
68
|
estimateReference: a.estimateReference,
|
|
69
69
|
pagination: {
|
|
@@ -73,77 +73,77 @@ function D({ actions: e }) {
|
|
|
73
73
|
});
|
|
74
74
|
if (!H.current) throw Error("The current workspace changed. Nothing was sent.");
|
|
75
75
|
let c = s.mtwFreightEstimatePage.items[0] ?? null;
|
|
76
|
-
|
|
77
|
-
let l =
|
|
76
|
+
u(a, o.shipment, c) || z(!0);
|
|
77
|
+
let l = d(a, o.shipment, c, t, r.map(({ fileId: e, versionId: t }) => ({
|
|
78
78
|
fileId: e,
|
|
79
79
|
versionId: t
|
|
80
|
-
}))), f = await e.run(i ?
|
|
80
|
+
}))), f = await e.run(i ? _ : v, i ? {
|
|
81
81
|
...l,
|
|
82
82
|
commercialCapture: i
|
|
83
83
|
} : l, "Sourced cost version recorded.");
|
|
84
|
-
f && H.current && (
|
|
84
|
+
f && H.current && (N(f.saveMtwFreightEstimate.id), F(null), k(0));
|
|
85
85
|
} finally {
|
|
86
86
|
H.current && L(!1), U.current = !1;
|
|
87
87
|
}
|
|
88
88
|
}, ie = W.data ? {
|
|
89
89
|
total: W.data.shipmentsCount,
|
|
90
90
|
limit: 25,
|
|
91
|
-
offset:
|
|
92
|
-
hasMore:
|
|
93
|
-
nextOffset:
|
|
91
|
+
offset: b,
|
|
92
|
+
hasMore: b + W.data.shipments.length < W.data.shipmentsCount,
|
|
93
|
+
nextOffset: b + 25
|
|
94
94
|
} : void 0;
|
|
95
|
-
return /* @__PURE__ */
|
|
95
|
+
return /* @__PURE__ */ E("div", {
|
|
96
96
|
className: "min-w-0 space-y-6 break-words",
|
|
97
97
|
children: [
|
|
98
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ T("p", {
|
|
99
99
|
className: "rounded border p-4 text-sm",
|
|
100
100
|
children: "Record the costs stated by your source. Missing facts are not zero. Saving does not book freight, accept a quote or settle an invoice."
|
|
101
101
|
}),
|
|
102
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ E("section", {
|
|
103
103
|
className: c,
|
|
104
104
|
children: [
|
|
105
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ T("h2", {
|
|
106
106
|
className: "text-lg font-semibold",
|
|
107
107
|
children: "Shipment and cost sheet"
|
|
108
108
|
}),
|
|
109
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ T(a, {
|
|
110
110
|
label: "Shipment",
|
|
111
|
-
value:
|
|
111
|
+
value: A?.id ?? "",
|
|
112
112
|
options: $,
|
|
113
113
|
disabled: Q,
|
|
114
114
|
onChange: (e) => {
|
|
115
115
|
let t = $.find((t) => t.id === e);
|
|
116
|
-
|
|
116
|
+
te(t ? {
|
|
117
117
|
id: t.id,
|
|
118
118
|
label: t.label
|
|
119
|
-
} : null),
|
|
119
|
+
} : null), F(null), N(null), k(0), z(!1);
|
|
120
120
|
}
|
|
121
121
|
}),
|
|
122
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ T(s, {
|
|
123
123
|
loading: W.loading,
|
|
124
124
|
error: W.error
|
|
125
125
|
}),
|
|
126
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ T(o, {
|
|
127
127
|
page: ie,
|
|
128
128
|
busy: W.loading || Q,
|
|
129
|
-
offset:
|
|
130
|
-
onChange:
|
|
129
|
+
offset: b,
|
|
130
|
+
onChange: D
|
|
131
131
|
}),
|
|
132
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ T(l, {
|
|
133
133
|
label: "Cost sheet reference",
|
|
134
134
|
value: j,
|
|
135
|
-
disabled: Q ||
|
|
136
|
-
onChange:
|
|
135
|
+
disabled: Q || P !== null,
|
|
136
|
+
onChange: ne
|
|
137
137
|
}),
|
|
138
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ T(s, {
|
|
139
139
|
loading: G.loading,
|
|
140
140
|
error: G.error
|
|
141
141
|
}),
|
|
142
|
-
/* @__PURE__ */
|
|
142
|
+
/* @__PURE__ */ T(s, {
|
|
143
143
|
loading: K.loading,
|
|
144
144
|
error: K.error
|
|
145
145
|
}),
|
|
146
|
-
G.data?.shipment && /* @__PURE__ */
|
|
146
|
+
G.data?.shipment && /* @__PURE__ */ E("p", { children: [
|
|
147
147
|
G.data.shipment.shipmentNumber,
|
|
148
148
|
" — ",
|
|
149
149
|
G.data.shipment.primaryMode,
|
|
@@ -152,20 +152,20 @@ function D({ actions: e }) {
|
|
|
152
152
|
X ? `latest sheet version ${X.version}` : "no version in the loaded sheet",
|
|
153
153
|
"."
|
|
154
154
|
] }),
|
|
155
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ E("div", {
|
|
156
156
|
className: "flex flex-wrap gap-3",
|
|
157
|
-
children: [/* @__PURE__ */
|
|
157
|
+
children: [/* @__PURE__ */ T(t, {
|
|
158
158
|
type: "button",
|
|
159
159
|
variant: "outline",
|
|
160
160
|
disabled: Q,
|
|
161
161
|
onClick: e.refresh,
|
|
162
162
|
children: "Refresh current records"
|
|
163
|
-
}), /* @__PURE__ */
|
|
163
|
+
}), /* @__PURE__ */ T(t, {
|
|
164
164
|
type: "button",
|
|
165
165
|
disabled: Q || G.loading || K.loading || !!G.error || !!K.error || !G.data?.shipment || !K.data || !j.trim(),
|
|
166
166
|
onClick: () => {
|
|
167
167
|
let e = G.data?.shipment;
|
|
168
|
-
e && K.data && (
|
|
168
|
+
e && K.data && (F({
|
|
169
169
|
shipmentId: e.id,
|
|
170
170
|
shipmentUpdatedAt: e.updatedAt,
|
|
171
171
|
estimateReference: j.trim(),
|
|
@@ -179,43 +179,43 @@ function D({ actions: e }) {
|
|
|
179
179
|
})
|
|
180
180
|
]
|
|
181
181
|
}),
|
|
182
|
-
(Z || R) && /* @__PURE__ */
|
|
182
|
+
(Z || R) && /* @__PURE__ */ T("p", {
|
|
183
183
|
role: "alert",
|
|
184
184
|
children: "The shipment or cost history changed. Review the current records and explicitly start a new draft; entered facts were not rebound."
|
|
185
185
|
}),
|
|
186
|
-
|
|
187
|
-
shipmentId:
|
|
186
|
+
P && !Z && !R && /* @__PURE__ */ T(y, {
|
|
187
|
+
shipmentId: P.shipmentId,
|
|
188
188
|
disabled: Q || G.loading || K.loading || !!G.error || !!K.error,
|
|
189
|
-
onPreview: async (e) => (await n(
|
|
189
|
+
onPreview: async (e) => (await n(g, { input: e })).previewMtwFreightTotal,
|
|
190
190
|
onSave: re
|
|
191
|
-
},
|
|
192
|
-
B && /* @__PURE__ */
|
|
191
|
+
}, P.generation),
|
|
192
|
+
B && /* @__PURE__ */ T("p", {
|
|
193
193
|
role: "alert",
|
|
194
194
|
children: B
|
|
195
195
|
}),
|
|
196
|
-
e.error && /* @__PURE__ */
|
|
196
|
+
e.error && /* @__PURE__ */ T("p", {
|
|
197
197
|
role: "alert",
|
|
198
198
|
children: e.error
|
|
199
199
|
}),
|
|
200
|
-
e.notice && /* @__PURE__ */
|
|
200
|
+
e.notice && /* @__PURE__ */ T("p", {
|
|
201
201
|
role: "status",
|
|
202
202
|
children: e.notice
|
|
203
203
|
}),
|
|
204
|
-
e.uncertain && /* @__PURE__ */
|
|
204
|
+
e.uncertain && /* @__PURE__ */ E("section", {
|
|
205
205
|
className: "space-y-4 rounded-xl border bg-bg-surface p-5",
|
|
206
206
|
children: [
|
|
207
|
-
/* @__PURE__ */
|
|
207
|
+
/* @__PURE__ */ T("h2", {
|
|
208
208
|
className: "font-semibold",
|
|
209
209
|
children: "Resolve the original save"
|
|
210
210
|
}),
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
-
/* @__PURE__ */
|
|
211
|
+
/* @__PURE__ */ T("p", { children: "The server may already have recorded it. Check history first. Return to the original account, organization, workspace and project before retrying." }),
|
|
212
|
+
/* @__PURE__ */ T(t, {
|
|
213
213
|
type: "button",
|
|
214
214
|
disabled: !e.canRetry || e.busy,
|
|
215
215
|
onClick: () => void e.retryOriginal(),
|
|
216
216
|
children: "Retry original request"
|
|
217
217
|
}),
|
|
218
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ T(t, {
|
|
219
219
|
type: "button",
|
|
220
220
|
variant: "outline",
|
|
221
221
|
disabled: e.busy,
|
|
@@ -226,39 +226,39 @@ function D({ actions: e }) {
|
|
|
226
226
|
})
|
|
227
227
|
]
|
|
228
228
|
}),
|
|
229
|
-
e.uncertain && !e.originalHistoryTarget && /* @__PURE__ */
|
|
229
|
+
e.uncertain && !e.originalHistoryTarget && /* @__PURE__ */ T("p", {
|
|
230
230
|
role: "status",
|
|
231
231
|
children: "Original history is unavailable in this context. Return to the original account, organization, workspace and project. A malformed saved request cannot supply a history target."
|
|
232
232
|
}),
|
|
233
|
-
q && /* @__PURE__ */
|
|
233
|
+
q && /* @__PURE__ */ E("section", {
|
|
234
234
|
className: "space-y-4 rounded-xl border bg-bg-surface p-5",
|
|
235
235
|
children: [
|
|
236
|
-
/* @__PURE__ */
|
|
236
|
+
/* @__PURE__ */ T("h2", {
|
|
237
237
|
className: "text-lg font-semibold",
|
|
238
238
|
children: e.uncertain ? "Original request cost history" : "Immutable cost history"
|
|
239
239
|
}),
|
|
240
|
-
e.uncertain && /* @__PURE__ */
|
|
240
|
+
e.uncertain && /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ E("p", { children: [
|
|
241
241
|
"Shipment ",
|
|
242
242
|
q.shipmentId,
|
|
243
243
|
"; sheet ",
|
|
244
244
|
q.estimateReference,
|
|
245
245
|
". Reading these records does not confirm the original request key or clear recovery."
|
|
246
|
-
] }), /* @__PURE__ */
|
|
246
|
+
] }), /* @__PURE__ */ T(t, {
|
|
247
247
|
type: "button",
|
|
248
248
|
variant: "outline",
|
|
249
249
|
disabled: e.busy,
|
|
250
250
|
onClick: e.refresh,
|
|
251
251
|
children: "Refresh original history"
|
|
252
252
|
})] }),
|
|
253
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ T(s, {
|
|
254
254
|
loading: J.loading,
|
|
255
255
|
error: J.error
|
|
256
256
|
}),
|
|
257
|
-
J.data?.mtwFreightEstimatePage.items.map((e) => /* @__PURE__ */
|
|
257
|
+
J.data?.mtwFreightEstimatePage.items.map((e) => /* @__PURE__ */ E(t, {
|
|
258
258
|
type: "button",
|
|
259
259
|
variant: "outline",
|
|
260
260
|
className: "h-auto w-full max-w-full justify-start whitespace-normal break-all text-left",
|
|
261
|
-
onClick: () =>
|
|
261
|
+
onClick: () => N(e.id),
|
|
262
262
|
children: [
|
|
263
263
|
e.facts.title,
|
|
264
264
|
" / ",
|
|
@@ -270,20 +270,20 @@ function D({ actions: e }) {
|
|
|
270
270
|
new Date(e.recordedAt).toLocaleString()
|
|
271
271
|
]
|
|
272
272
|
}, e.id)),
|
|
273
|
-
/* @__PURE__ */
|
|
273
|
+
/* @__PURE__ */ T(o, {
|
|
274
274
|
page: J.data?.mtwFreightEstimatePage,
|
|
275
275
|
busy: J.loading,
|
|
276
|
-
offset:
|
|
277
|
-
onChange:
|
|
276
|
+
offset: O,
|
|
277
|
+
onChange: k
|
|
278
278
|
})
|
|
279
279
|
]
|
|
280
280
|
}),
|
|
281
|
-
q &&
|
|
281
|
+
q && M && /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(s, {
|
|
282
282
|
loading: Y.loading,
|
|
283
283
|
error: Y.error
|
|
284
|
-
}), Y.data && /* @__PURE__ */
|
|
284
|
+
}), Y.data && /* @__PURE__ */ T(ee, { record: Y.data.mtwFreightEstimateVersion })] })
|
|
285
285
|
]
|
|
286
286
|
});
|
|
287
287
|
}
|
|
288
288
|
//#endregion
|
|
289
|
-
export {
|
|
289
|
+
export { D as default };
|