@burdenoff/microfe-movethewheels 2026.1016.3 → 2026.1016.4

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.
Files changed (88) hide show
  1. package/README.md +10 -0
  2. package/dist/MoveTheWheelsRoot.js +5 -0
  3. package/dist/MoveTheWheelsRoutes.js +25 -21
  4. package/dist/components/ContainerEvidencePicker.js +55 -55
  5. package/dist/components/FleetAlertsPanel.js +2 -2
  6. package/dist/components/freight-invoice/InvoiceForm.js +366 -0
  7. package/dist/components/freight-invoice/InvoiceResults.js +240 -0
  8. package/dist/generated/consolidation-operations.d.ts +195 -265
  9. package/dist/generated/container-condition-operations.d.ts +124 -187
  10. package/dist/generated/container-operations.d.ts +59 -85
  11. package/dist/generated/empty-reuse-operations.d.ts +165 -271
  12. package/dist/generated/free-time-operations.d.ts +120 -184
  13. package/dist/generated/freight-cost-operations.d.ts +307 -476
  14. package/dist/generated/freight-invoice-operations.d.ts +1447 -0
  15. package/dist/generated/logistics-procedure-operations.d.ts +100 -156
  16. package/dist/generated/pending-pick-operations.d.ts +769 -1025
  17. package/dist/generated/shipment-status-authority-operations.d.ts +82 -103
  18. package/dist/generated/stock-binding-operations.d.ts +188 -260
  19. package/dist/generated/stock-observation-operations.d.ts +103 -138
  20. package/dist/generated/tracking-quality-operations.d.ts +27 -41
  21. package/dist/generated/trip-utilization-operations.d.ts +137 -185
  22. package/dist/generated/wspace-operations.d.ts +628 -2272
  23. package/dist/generated/wspace-types.d.ts +4 -23
  24. package/dist/hooks/useInvoiceComparisonRecovery.js +118 -0
  25. package/dist/movethewheels/components/ContainerEvidencePicker.d.ts +2 -1
  26. package/dist/movethewheels/components/freight-invoice/InvoiceForm.d.ts +19 -0
  27. package/dist/movethewheels/components/freight-invoice/InvoiceResults.d.ts +9 -0
  28. package/dist/movethewheels/hooks/useFleet.d.ts +1 -1
  29. package/dist/movethewheels/hooks/useFleetIntelligence.d.ts +1 -1
  30. package/dist/movethewheels/hooks/useInvoiceComparisonRecovery.d.ts +22 -0
  31. package/dist/movethewheels/hooks/useProcedureSelection.d.ts +1 -3
  32. package/dist/movethewheels/pages/FreightInvoicePage.d.ts +10 -0
  33. package/dist/movethewheels/utils/driverLicenseExpiry.d.ts +6 -0
  34. package/dist/movethewheels/utils/invoiceComparison.d.ts +32 -0
  35. package/dist/pages/DriverDetailsPage.js +306 -282
  36. package/dist/pages/FreightEstimatePage.js +1 -0
  37. package/dist/pages/FreightInvoicePage.js +346 -0
  38. package/dist/src/generated/consolidation-operations.js +3961 -503
  39. package/dist/src/generated/container-condition-operations.js +2968 -206
  40. package/dist/src/generated/container-operations.js +997 -99
  41. package/dist/src/generated/empty-reuse-operations.js +4811 -747
  42. package/dist/src/generated/free-time-operations.js +2824 -233
  43. package/dist/src/generated/freight-cost-operations.js +4852 -812
  44. package/dist/src/generated/freight-invoice-operations.js +4894 -0
  45. package/dist/src/generated/logistics-procedure-operations.js +2707 -360
  46. package/dist/src/generated/pending-pick-operations.js +8244 -1196
  47. package/dist/src/generated/shipment-status-authority-operations.js +1157 -84
  48. package/dist/src/generated/stock-binding-operations.js +2779 -173
  49. package/dist/src/generated/stock-observation-operations.js +1274 -91
  50. package/dist/src/generated/tracking-quality-operations.js +407 -42
  51. package/dist/src/generated/trip-utilization-operations.js +1765 -138
  52. package/dist/src/generated/wspace-operations.js +428 -706
  53. package/dist/utils/driverLicenseExpiry.js +14 -0
  54. package/dist/utils/invoiceComparison.js +272 -0
  55. package/package.json +29 -29
  56. package/src/generated/consolidation-operations.ts +60 -559
  57. package/src/generated/container-condition-operations.ts +63 -265
  58. package/src/generated/container-operations.ts +37 -132
  59. package/src/generated/empty-reuse-operations.ts +83 -824
  60. package/src/generated/free-time-operations.ts +55 -284
  61. package/src/generated/freight-cost-operations.ts +42 -848
  62. package/src/generated/freight-invoice-operations.ts +830 -0
  63. package/src/generated/logistics-procedure-operations.ts +60 -414
  64. package/src/generated/pending-pick-operations.ts +48 -1239
  65. package/src/generated/shipment-status-authority-operations.ts +33 -113
  66. package/src/generated/stock-binding-operations.ts +29 -198
  67. package/src/generated/stock-observation-operations.ts +24 -111
  68. package/src/generated/tracking-quality-operations.ts +19 -57
  69. package/src/generated/trip-utilization-operations.ts +32 -166
  70. package/src/generated/wspace-operations.ts +284 -2906
  71. package/src/generated/wspace-types.ts +2 -8
  72. package/src/movethewheels/MoveTheWheelsRoot.tsx +6 -0
  73. package/src/movethewheels/MoveTheWheelsRoutes.tsx +2 -0
  74. package/src/movethewheels/components/ContainerEvidencePicker.tsx +12 -4
  75. package/src/movethewheels/components/FleetAlertsPanel.tsx +4 -2
  76. package/src/movethewheels/components/freight-invoice/InvoiceForm.tsx +412 -0
  77. package/src/movethewheels/components/freight-invoice/InvoiceResults.tsx +162 -0
  78. package/src/movethewheels/hooks/useFleet.ts +1 -1
  79. package/src/movethewheels/hooks/useFleetIntelligence.ts +5 -1
  80. package/src/movethewheels/hooks/useInvoiceComparisonRecovery.ts +227 -0
  81. package/src/movethewheels/pages/DriverDetailsPage.tsx +35 -9
  82. package/src/movethewheels/pages/FreightEstimatePage.tsx +1 -0
  83. package/src/movethewheels/pages/FreightInvoicePage.tsx +477 -0
  84. package/src/movethewheels/utils/driverLicenseExpiry.ts +25 -0
  85. package/src/movethewheels/utils/invoiceComparison.ts +520 -0
  86. package/src/operations/freight-invoice/comparison.graphql +40 -0
  87. package/src/operations/wspace/freight-invoice-evidence.graphql +6 -0
  88. package/patches/braces@3.0.3.patch +0 -87
@@ -257,6 +257,7 @@ function D({ actions: e }) {
257
257
  J.data?.mtwFreightEstimatePage.items.map((e) => /* @__PURE__ */ T(t, {
258
258
  type: "button",
259
259
  variant: "outline",
260
+ className: "h-auto w-full max-w-full justify-start whitespace-normal break-all text-left",
260
261
  onClick: () => P(e.id),
261
262
  children: [
262
263
  e.facts.title,
@@ -0,0 +1,346 @@
1
+ import { FileText as e } from "../node_modules/lucide-react/dist/esm/icons/file-text.js";
2
+ import { useMoveTheWheels as t } from "../providers/MoveTheWheelsProvider.js";
3
+ import { Button as n } from "../components/ui.js";
4
+ import { PageLayout as r } from "../components/PageLayout.js";
5
+ import { useConditionApi as i, useConditionQuery as a } from "../hooks/useContainerCondition.js";
6
+ import { PinnedSelect as o, ReusePager as s, ReuseState as c, reuseCard as l } from "../components/ReuseControls.js";
7
+ import { useShipmentPermissions as u } from "../hooks/useShipmentPermissions.js";
8
+ import { FreightText as ee } from "../components/freight-cost/FreightFields.js";
9
+ import { sameInvoiceScope as d } from "../utils/invoiceComparison.js";
10
+ import { InvoiceHistoryRecord as te } from "../components/freight-invoice/InvoiceResults.js";
11
+ import { InvoiceForm as ne } from "../components/freight-invoice/InvoiceForm.js";
12
+ import { InvoiceComparisonExactDocument as re, InvoiceComparisonHistoryDocument as f, InvoiceEstimatePageDocument as ie, InvoiceEstimateVersionDocument as ae, InvoiceShipmentsDocument as oe, InvoiceStructuralPreviewDocument as se } from "../src/generated/freight-invoice-operations.js";
13
+ import { useInvoiceComparisonRecovery as p, useInvoiceComparisonScope as m } from "../hooks/useInvoiceComparisonRecovery.js";
14
+ import { useState as h } from "react";
15
+ import { useSearchParams as g } from "react-router";
16
+ import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
17
+ import { PermissionProvider as b } from "@burdenoff/fe-libs/shared/providers/shell";
18
+ //#region src/movethewheels/pages/FreightInvoicePage.tsx
19
+ function x() {
20
+ let n = t();
21
+ return /* @__PURE__ */ v(r, {
22
+ title: "Freight invoice comparisons",
23
+ subtitle: "Compare manually reported source facts with one immutable estimate version.",
24
+ icon: /* @__PURE__ */ v(e, { "aria-hidden": "true" }),
25
+ children: /* @__PURE__ */ v(b, {
26
+ scopeId: n.workspaceId ?? null,
27
+ gateway: "workspace",
28
+ children: /* @__PURE__ */ v(S, {})
29
+ }, `${n.workspaceId}:${n.tenantId}:${n.currentUser?.id}:${n.apiGatewayUrl}`)
30
+ });
31
+ }
32
+ function S() {
33
+ let e = u(), t = m(e.canRead), n = p(t, () => e.allows("update"));
34
+ return /* @__PURE__ */ y(_, { children: [!e.canRead && /* @__PURE__ */ v("p", {
35
+ role: "status",
36
+ children: e.loading ? "Checking shipment read permission…" : e.failed ? "Shipment permissions are unavailable. Reload to inspect them." : "Shipment read permission in the current workspace is required."
37
+ }), /* @__PURE__ */ v(C, {
38
+ access: e,
39
+ scope: t,
40
+ actions: n
41
+ }, n.scopeKey)] });
42
+ }
43
+ function C({ access: e, scope: t, actions: r }) {
44
+ let l = i(), [u, d] = g(), [p, m] = h(() => u.get("invoiceShipment")?.slice(0, 255) ?? ""), [b, x] = h(0), [S, C] = h(0), [T, E] = h(""), [D, O] = h(!1), [k, A] = h(null), [j, M] = h(() => u.get("invoiceIdentity")?.slice(0, 255) ?? ""), [N, P] = h(j), [F, I] = h(0), [L, R] = h(""), [z, B] = h(null), [V, H] = h(null), U = !!t && e.canRead, W = r.busy || r.uncertain, G = a(oe, U ? { pagination: {
45
+ limit: 25,
46
+ offset: b
47
+ } } : null, r.revision), K = a(ie, U && p ? {
48
+ shipmentId: p,
49
+ pagination: {
50
+ limit: 25,
51
+ offset: S
52
+ }
53
+ } : null, r.revision), q = a(ae, U && p && T ? {
54
+ shipmentId: p,
55
+ id: T
56
+ } : null, r.revision), J = a(f, U && p && j ? {
57
+ shipmentId: p,
58
+ invoiceIdentityId: j,
59
+ pagination: {
60
+ limit: 10,
61
+ offset: F
62
+ }
63
+ } : null, r.revision), Y = a(re, U && p && L ? {
64
+ shipmentId: p,
65
+ id: L
66
+ } : null, r.revision), X = Y.data?.mtwFreightInvoiceComparison ?? z, Z = (e) => {
67
+ m(e.shipmentId), B(e), R(e.id), M(e.invoiceIdentityId), P(e.invoiceIdentityId), I(0), O(!1), A(null), d((t) => {
68
+ let n = new URLSearchParams(t);
69
+ return n.set("invoiceShipment", e.shipmentId), n.set("invoiceIdentity", e.invoiceIdentityId), n;
70
+ }, { replace: !0 });
71
+ }, Q = G.data?.shipments.map((e) => ({
72
+ id: e.id,
73
+ label: `${e.shipmentNumber} — ${e.primaryMode} — ${e.status}`
74
+ })) ?? [];
75
+ p && !Q.some((e) => e.id === p) && Q.unshift({
76
+ id: p,
77
+ label: "Selected shipment outside this loaded page"
78
+ });
79
+ let ce = G.data ? {
80
+ total: G.data.shipmentsCount,
81
+ limit: 25,
82
+ offset: b,
83
+ hasMore: b + G.data.shipments.length < G.data.shipmentsCount,
84
+ nextOffset: b + 25
85
+ } : void 0, $ = q.data?.mtwFreightEstimateVersion;
86
+ return /* @__PURE__ */ y("div", {
87
+ className: "min-w-0 space-y-6 break-words",
88
+ children: [
89
+ /* @__PURE__ */ v("p", {
90
+ className: "rounded border p-4 text-sm",
91
+ children: "Record only what the supplier source reports. Unknown is not zero. This comparison establishes no quote acceptance, liability, invoice approval or payment. Corrections append a new immutable revision."
92
+ }),
93
+ r.uncertain && /* @__PURE__ */ v(w, {
94
+ pending: r.pending,
95
+ scope: t,
96
+ busy: r.busy,
97
+ canReconcile: r.canReconcile,
98
+ onRead: () => void r.reconcile().then((e) => {
99
+ e && Z(e);
100
+ })
101
+ }),
102
+ r.feedback && /* @__PURE__ */ v("p", {
103
+ role: r.feedback.error ? "alert" : "status",
104
+ children: r.feedback.message
105
+ }),
106
+ U && /* @__PURE__ */ y(_, { children: [
107
+ /* @__PURE__ */ y("section", {
108
+ className: "space-y-4 rounded-xl border bg-bg-surface p-5",
109
+ children: [
110
+ /* @__PURE__ */ v("h2", {
111
+ className: "text-lg font-semibold",
112
+ children: "Choose the exact recorded estimate"
113
+ }),
114
+ /* @__PURE__ */ v(o, {
115
+ label: "Invoice shipment",
116
+ value: p,
117
+ disabled: W || D,
118
+ options: Q,
119
+ onChange: (e) => {
120
+ m(e), E(""), C(0), M(""), P(""), R(""), B(null), A(null), O(!1), d((t) => {
121
+ let n = new URLSearchParams(t);
122
+ return n.set("invoiceShipment", e), n.delete("invoiceIdentity"), n;
123
+ }, { replace: !0 });
124
+ }
125
+ }),
126
+ /* @__PURE__ */ v(c, {
127
+ loading: G.loading,
128
+ error: G.error
129
+ }),
130
+ /* @__PURE__ */ v(s, {
131
+ page: ce,
132
+ busy: W || D || G.loading,
133
+ offset: b,
134
+ onChange: x
135
+ }),
136
+ p && /* @__PURE__ */ y(_, { children: [
137
+ /* @__PURE__ */ v(o, {
138
+ label: "Exact estimate version",
139
+ value: T,
140
+ disabled: W || D,
141
+ options: K.data?.mtwFreightEstimatePage.items.map((e) => ({
142
+ id: e.id,
143
+ label: `${e.estimateReference} / version ${e.version} / ${e.facts.kind} / ${e.facts.title}`
144
+ })) ?? [],
145
+ onChange: (e) => E(e)
146
+ }),
147
+ /* @__PURE__ */ v(c, {
148
+ loading: K.loading,
149
+ error: K.error
150
+ }),
151
+ /* @__PURE__ */ v(s, {
152
+ page: K.data?.mtwFreightEstimatePage,
153
+ busy: W || D || K.loading,
154
+ offset: S,
155
+ onChange: C
156
+ })
157
+ ] }),
158
+ /* @__PURE__ */ v(c, {
159
+ loading: q.loading,
160
+ error: q.error
161
+ }),
162
+ $ && /* @__PURE__ */ y("p", { children: [
163
+ "Pinned ",
164
+ $.facts.kind,
165
+ ": ",
166
+ $.estimateReference,
167
+ " version",
168
+ " ",
169
+ $.version,
170
+ ". Source ",
171
+ $.facts.sourceReference,
172
+ "/",
173
+ $.facts.sourceRevision,
174
+ "; source validity ",
175
+ $.validityAtRead,
176
+ ". This does not establish acceptance."
177
+ ] }),
178
+ /* @__PURE__ */ y("div", {
179
+ className: "flex flex-wrap gap-3",
180
+ children: [
181
+ /* @__PURE__ */ v(n, {
182
+ type: "button",
183
+ disabled: W || !$ || $.shipmentId !== p || q.loading || !!q.error,
184
+ onClick: () => {
185
+ O(!0), H(null);
186
+ },
187
+ children: k ? `Start correction draft after revision ${k.revision}` : "Start manual invoice draft"
188
+ }),
189
+ D && /* @__PURE__ */ v(n, {
190
+ type: "button",
191
+ variant: "outline",
192
+ disabled: W,
193
+ onClick: () => {
194
+ O(!1), A(null);
195
+ },
196
+ children: "Discard unsent draft"
197
+ }),
198
+ /* @__PURE__ */ v(n, {
199
+ type: "button",
200
+ variant: "outline",
201
+ disabled: r.busy,
202
+ onClick: r.refresh,
203
+ children: "Refresh recorded data"
204
+ })
205
+ ]
206
+ })
207
+ ]
208
+ }),
209
+ D && $ && $.shipmentId === p && /* @__PURE__ */ v(ne, {
210
+ estimate: $,
211
+ previous: k,
212
+ disabled: W || q.loading || !!q.error,
213
+ canRecord: e.canUpdate,
214
+ onPreview: async (e) => (await l(se, { input: e })).previewMtwFreightInvoice,
215
+ onSave: async (e, t) => {
216
+ let n = await r.run(e, t);
217
+ return n && Z(n), n;
218
+ }
219
+ }, `${$.id}:${k?.id ?? "first"}`),
220
+ V && /* @__PURE__ */ v("p", {
221
+ role: "alert",
222
+ children: V
223
+ }),
224
+ p && /* @__PURE__ */ y("section", {
225
+ className: "space-y-4 rounded-xl border bg-bg-surface p-5",
226
+ children: [
227
+ /* @__PURE__ */ v("h2", {
228
+ className: "text-lg font-semibold",
229
+ children: "Recorded invoice history"
230
+ }),
231
+ /* @__PURE__ */ v("p", { children: "A confirmed save opens its invoice history here. Bookmark this page to return to it. Complete invoice browsing is not available in this view. A missing page never proves that an unresolved save had no effect." }),
232
+ /* @__PURE__ */ y("details", { children: [
233
+ /* @__PURE__ */ v("summary", {
234
+ className: "min-h-11 cursor-pointer",
235
+ children: "Advanced: open a known receipt identity"
236
+ }),
237
+ /* @__PURE__ */ v(ee, {
238
+ label: "Known invoice identity ID",
239
+ value: N,
240
+ disabled: r.busy,
241
+ onChange: P
242
+ }),
243
+ /* @__PURE__ */ v(n, {
244
+ type: "button",
245
+ variant: "outline",
246
+ disabled: r.busy || !N.trim(),
247
+ onClick: () => {
248
+ M(N.trim()), I(0), R(""), B(null), d((e) => {
249
+ let t = new URLSearchParams(e);
250
+ return t.set("invoiceShipment", p), t.set("invoiceIdentity", N.trim()), t;
251
+ }, { replace: !0 });
252
+ },
253
+ children: "Read identity history"
254
+ })
255
+ ] }),
256
+ j && /* @__PURE__ */ y(_, { children: [
257
+ /* @__PURE__ */ v(c, {
258
+ loading: J.loading,
259
+ error: J.error
260
+ }),
261
+ J.data?.mtwFreightInvoiceComparisonPage.items.map((e) => /* @__PURE__ */ y(n, {
262
+ className: "h-auto max-w-full whitespace-normal break-words text-left",
263
+ type: "button",
264
+ variant: "outline",
265
+ onClick: () => {
266
+ R(e.id), B(null);
267
+ },
268
+ children: [
269
+ e.facts.supplierLabel ?? e.facts.supplierReference,
270
+ " / invoice",
271
+ " ",
272
+ e.facts.invoiceReference,
273
+ ", revision ",
274
+ e.revision,
275
+ " / ",
276
+ e.recordedAt
277
+ ]
278
+ }, e.id)),
279
+ /* @__PURE__ */ v(s, {
280
+ page: J.data?.mtwFreightInvoiceComparisonPage,
281
+ busy: J.loading || r.busy,
282
+ offset: F,
283
+ onChange: I
284
+ })
285
+ ] })
286
+ ]
287
+ }),
288
+ /* @__PURE__ */ v(c, {
289
+ loading: Y.loading,
290
+ error: Y.error
291
+ }),
292
+ X && X.shipmentId === p && /* @__PURE__ */ y(_, { children: [
293
+ /* @__PURE__ */ v(te, { record: X }),
294
+ /* @__PURE__ */ v(n, {
295
+ type: "button",
296
+ disabled: W || !e.canUpdate || !J.data || J.data.mtwFreightInvoiceComparisonPage.items[0]?.id !== X.id || F !== 0,
297
+ onClick: () => {
298
+ E(X.estimate.id), A(X), O(!1), H(null);
299
+ },
300
+ children: "Prepare correction to this latest revision"
301
+ }),
302
+ /* @__PURE__ */ v("p", { children: "Refresh the first history page to pin its latest revision before correcting. The server checks the exact predecessor again." })
303
+ ] })
304
+ ] })
305
+ ]
306
+ });
307
+ }
308
+ function w({ pending: e, scope: t, busy: r, canReconcile: i, onRead: a }) {
309
+ return /* @__PURE__ */ y("section", {
310
+ className: l,
311
+ "aria-label": "Original invoice request recovery",
312
+ children: [/* @__PURE__ */ v("h2", {
313
+ className: "font-semibold",
314
+ children: "Original save is unresolved"
315
+ }), e && d(e.scope, t) ? /* @__PURE__ */ y(_, { children: [
316
+ /* @__PURE__ */ y("p", { children: [
317
+ "Invoice ",
318
+ e.input.facts.invoiceReference ?? "reference unknown",
319
+ "; exact",
320
+ " ",
321
+ e.estimate.kind.toLowerCase(),
322
+ " ",
323
+ e.estimate.estimateReference,
324
+ ", version",
325
+ " ",
326
+ e.estimate.version,
327
+ ". No automatic resend or new request is allowed."
328
+ ] }),
329
+ /* @__PURE__ */ v(n, {
330
+ type: "button",
331
+ disabled: !i || r,
332
+ onClick: a,
333
+ children: "Read original request receipt"
334
+ }),
335
+ /* @__PURE__ */ y("details", { children: [/* @__PURE__ */ v("summary", {
336
+ className: "min-h-11 cursor-pointer",
337
+ children: "Retained original source intent"
338
+ }), /* @__PURE__ */ v("pre", {
339
+ className: "max-w-full whitespace-pre-wrap break-all text-xs",
340
+ children: JSON.stringify(e.input, null, 2)
341
+ })] })
342
+ ] }) : /* @__PURE__ */ v("p", { children: e ? "The original request is retained in another or unavailable context. Return to the original account, organization, workspace and project with read permission; its source facts remain hidden here." : "The saved intent is malformed or unavailable. It remains blocked; do not discard it or start another request as proof of no effect." })]
343
+ });
344
+ }
345
+ //#endregion
346
+ export { w as InvoiceRequestRecovery, x as default };