@burdenoff/microfe-movethewheels 2026.1016.2 → 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 (113) 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-cost/FreightCommercialEditor.js +217 -0
  7. package/dist/components/freight-cost/FreightCommercialFactEditor.js +217 -0
  8. package/dist/components/freight-cost/FreightCommercialHistory.js +115 -0
  9. package/dist/components/freight-cost/FreightDraftForm.js +106 -91
  10. package/dist/components/freight-cost/FreightHistory.js +42 -40
  11. package/dist/components/freight-invoice/InvoiceForm.js +366 -0
  12. package/dist/components/freight-invoice/InvoiceResults.js +240 -0
  13. package/dist/generated/consolidation-operations.d.ts +195 -265
  14. package/dist/generated/container-condition-operations.d.ts +124 -187
  15. package/dist/generated/container-operations.d.ts +59 -85
  16. package/dist/generated/empty-reuse-operations.d.ts +165 -271
  17. package/dist/generated/free-time-operations.d.ts +120 -184
  18. package/dist/generated/freight-cost-operations.d.ts +955 -165
  19. package/dist/generated/freight-invoice-operations.d.ts +1447 -0
  20. package/dist/generated/logistics-procedure-operations.d.ts +100 -156
  21. package/dist/generated/pending-pick-operations.d.ts +769 -1025
  22. package/dist/generated/shipment-status-authority-operations.d.ts +82 -103
  23. package/dist/generated/stock-binding-operations.d.ts +188 -260
  24. package/dist/generated/stock-observation-operations.d.ts +103 -138
  25. package/dist/generated/tracking-quality-operations.d.ts +27 -41
  26. package/dist/generated/trip-utilization-operations.d.ts +137 -185
  27. package/dist/generated/wspace-operations.d.ts +628 -2272
  28. package/dist/generated/wspace-types.d.ts +4 -23
  29. package/dist/hooks/useFreightRecoveryAction.js +20 -20
  30. package/dist/hooks/useInvoiceComparisonRecovery.js +118 -0
  31. package/dist/movethewheels/components/ContainerEvidencePicker.d.ts +2 -1
  32. package/dist/movethewheels/components/freight-cost/FreightCommercialEditor.d.ts +8 -0
  33. package/dist/movethewheels/components/freight-cost/FreightCommercialFactEditor.d.ts +8 -0
  34. package/dist/movethewheels/components/freight-cost/FreightCommercialHistory.d.ts +4 -0
  35. package/dist/movethewheels/components/freight-cost/FreightDraftForm.d.ts +4 -2
  36. package/dist/movethewheels/components/freight-cost/FreightHistory.d.ts +2 -2
  37. package/dist/movethewheels/components/freight-invoice/InvoiceForm.d.ts +19 -0
  38. package/dist/movethewheels/components/freight-invoice/InvoiceResults.d.ts +9 -0
  39. package/dist/movethewheels/hooks/useFleet.d.ts +1 -1
  40. package/dist/movethewheels/hooks/useFleetIntelligence.d.ts +1 -1
  41. package/dist/movethewheels/hooks/useInvoiceComparisonRecovery.d.ts +22 -0
  42. package/dist/movethewheels/hooks/useProcedureSelection.d.ts +1 -3
  43. package/dist/movethewheels/pages/FreightInvoicePage.d.ts +10 -0
  44. package/dist/movethewheels/utils/driverLicenseExpiry.d.ts +6 -0
  45. package/dist/movethewheels/utils/freightCommercial.d.ts +44 -0
  46. package/dist/movethewheels/utils/invoiceComparison.d.ts +32 -0
  47. package/dist/pages/DriverDetailsPage.js +306 -282
  48. package/dist/pages/FreightEstimatePage.js +97 -92
  49. package/dist/pages/FreightInvoicePage.js +346 -0
  50. package/dist/src/generated/consolidation-operations.js +3961 -503
  51. package/dist/src/generated/container-condition-operations.js +2968 -206
  52. package/dist/src/generated/container-operations.js +997 -99
  53. package/dist/src/generated/empty-reuse-operations.js +4811 -747
  54. package/dist/src/generated/free-time-operations.js +2824 -233
  55. package/dist/src/generated/freight-cost-operations.js +4852 -323
  56. package/dist/src/generated/freight-invoice-operations.js +4894 -0
  57. package/dist/src/generated/logistics-procedure-operations.js +2707 -360
  58. package/dist/src/generated/pending-pick-operations.js +8244 -1196
  59. package/dist/src/generated/shipment-status-authority-operations.js +1157 -84
  60. package/dist/src/generated/stock-binding-operations.js +2779 -173
  61. package/dist/src/generated/stock-observation-operations.js +1274 -91
  62. package/dist/src/generated/tracking-quality-operations.js +407 -42
  63. package/dist/src/generated/trip-utilization-operations.js +1765 -138
  64. package/dist/src/generated/wspace-operations.js +428 -706
  65. package/dist/utils/driverLicenseExpiry.js +14 -0
  66. package/dist/utils/freightAcknowledgement.js +6 -5
  67. package/dist/utils/freightCommercial.js +194 -0
  68. package/dist/utils/freightRecovery.js +22 -22
  69. package/dist/utils/invoiceComparison.js +272 -0
  70. package/package.json +30 -29
  71. package/src/generated/consolidation-operations.ts +60 -559
  72. package/src/generated/container-condition-operations.ts +63 -265
  73. package/src/generated/container-operations.ts +37 -132
  74. package/src/generated/empty-reuse-operations.ts +83 -824
  75. package/src/generated/free-time-operations.ts +55 -284
  76. package/src/generated/freight-cost-operations.ts +373 -349
  77. package/src/generated/freight-invoice-operations.ts +830 -0
  78. package/src/generated/logistics-procedure-operations.ts +60 -414
  79. package/src/generated/pending-pick-operations.ts +48 -1239
  80. package/src/generated/shipment-status-authority-operations.ts +33 -113
  81. package/src/generated/stock-binding-operations.ts +29 -198
  82. package/src/generated/stock-observation-operations.ts +24 -111
  83. package/src/generated/tracking-quality-operations.ts +19 -57
  84. package/src/generated/trip-utilization-operations.ts +32 -166
  85. package/src/generated/wspace-operations.ts +284 -2906
  86. package/src/generated/wspace-types.ts +2 -8
  87. package/src/movethewheels/MoveTheWheelsRoot.tsx +6 -0
  88. package/src/movethewheels/MoveTheWheelsRoutes.tsx +2 -0
  89. package/src/movethewheels/components/ContainerEvidencePicker.tsx +12 -4
  90. package/src/movethewheels/components/FleetAlertsPanel.tsx +4 -2
  91. package/src/movethewheels/components/freight-cost/FreightCommercialEditor.tsx +236 -0
  92. package/src/movethewheels/components/freight-cost/FreightCommercialFactEditor.tsx +258 -0
  93. package/src/movethewheels/components/freight-cost/FreightCommercialHistory.tsx +90 -0
  94. package/src/movethewheels/components/freight-cost/FreightDraftForm.tsx +33 -4
  95. package/src/movethewheels/components/freight-cost/FreightHistory.tsx +4 -2
  96. package/src/movethewheels/components/freight-invoice/InvoiceForm.tsx +412 -0
  97. package/src/movethewheels/components/freight-invoice/InvoiceResults.tsx +162 -0
  98. package/src/movethewheels/hooks/useFleet.ts +1 -1
  99. package/src/movethewheels/hooks/useFleetIntelligence.ts +5 -1
  100. package/src/movethewheels/hooks/useFreightRecoveryAction.ts +2 -1
  101. package/src/movethewheels/hooks/useInvoiceComparisonRecovery.ts +227 -0
  102. package/src/movethewheels/pages/DriverDetailsPage.tsx +35 -9
  103. package/src/movethewheels/pages/FreightEstimatePage.tsx +15 -7
  104. package/src/movethewheels/pages/FreightInvoicePage.tsx +477 -0
  105. package/src/movethewheels/utils/driverLicenseExpiry.ts +25 -0
  106. package/src/movethewheels/utils/freightAcknowledgement.ts +3 -1
  107. package/src/movethewheels/utils/freightCommercial.ts +388 -0
  108. package/src/movethewheels/utils/freightRecovery.ts +6 -2
  109. package/src/movethewheels/utils/invoiceComparison.ts +520 -0
  110. package/src/operations/freight-cost/commercial.graphql +483 -0
  111. package/src/operations/freight-invoice/comparison.graphql +40 -0
  112. package/src/operations/wspace/freight-invoice-evidence.graphql +6 -0
  113. package/patches/braces@3.0.3.patch +0 -87
@@ -1,64 +1,66 @@
1
1
  import { freightLabel as e, freightMoney as t } from "../../utils/freightDraft.js";
2
2
  import { FreightTotals as n } from "./FreightTotals.js";
3
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
3
+ import { FreightCommercialHistory as r } from "./FreightCommercialHistory.js";
4
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
4
5
  //#region src/movethewheels/components/freight-cost/FreightHistory.tsx
5
- function a({ record: a }) {
6
- return /* @__PURE__ */ i("article", {
6
+ function o({ record: o }) {
7
+ return /* @__PURE__ */ a("article", {
7
8
  className: "min-w-0 space-y-4 break-words rounded border p-4",
8
9
  children: [
9
- /* @__PURE__ */ i("h2", {
10
+ /* @__PURE__ */ a("h2", {
10
11
  className: "text-lg font-semibold",
11
12
  children: [
12
- a.facts.title,
13
+ o.facts.title,
13
14
  " — version ",
14
- a.version
15
+ o.version
15
16
  ]
16
17
  }),
17
- /* @__PURE__ */ i("p", { children: [
18
- a.shipmentCapture.shipmentNumber,
18
+ /* @__PURE__ */ a("p", { children: [
19
+ o.shipmentCapture.shipmentNumber,
19
20
  " / ",
20
- a.shipmentCapture.primaryMode,
21
+ o.shipmentCapture.primaryMode,
21
22
  " — captured shipment context"
22
23
  ] }),
23
- /* @__PURE__ */ i("p", { children: [
24
- a.facts.kind === "QUOTE" ? "Reported quote" : "Estimate",
24
+ /* @__PURE__ */ a("p", { children: [
25
+ o.facts.kind === "QUOTE" ? "Reported quote" : "Estimate",
25
26
  ";",
26
27
  " ",
27
- e(a.validityAtRead),
28
+ e(o.validityAtRead),
28
29
  ". This record does not accept a quote or confirm capacity."
29
30
  ] }),
30
- /* @__PURE__ */ r("p", { children: a.facts.commercialScope }),
31
- /* @__PURE__ */ i("p", { children: [
31
+ /* @__PURE__ */ i("p", { children: o.facts.commercialScope }),
32
+ /* @__PURE__ */ a("p", { children: [
32
33
  "Source: ",
33
- a.facts.sourceReference,
34
+ o.facts.sourceReference,
34
35
  " / ",
35
- a.facts.sourceRevision
36
+ o.facts.sourceRevision
36
37
  ] }),
37
- /* @__PURE__ */ i("p", { children: [
38
+ /* @__PURE__ */ a("p", { children: [
38
39
  "Price at ",
39
- a.facts.pricingAt,
40
+ o.facts.pricingAt,
40
41
  "; recorded ",
41
- a.recordedAt,
42
+ o.recordedAt,
42
43
  " by ",
43
- a.createdBy,
44
+ o.createdBy,
44
45
  " (",
45
- e(a.actorProvenance),
46
+ e(o.actorProvenance),
46
47
  ")."
47
48
  ] }),
48
- /* @__PURE__ */ r(n, {
49
- value: a.totals,
50
- currency: a.facts.reportingCurrency
49
+ /* @__PURE__ */ i(r, { capture: o.commercialCapture }),
50
+ /* @__PURE__ */ i(n, {
51
+ value: o.totals,
52
+ currency: o.facts.reportingCurrency
51
53
  }),
52
- /* @__PURE__ */ i("details", { children: [/* @__PURE__ */ r("summary", {
54
+ /* @__PURE__ */ a("details", { children: [/* @__PURE__ */ i("summary", {
53
55
  className: "min-h-11 cursor-pointer font-medium",
54
56
  children: "Cost facts and evidence recorded with this version"
55
- }), /* @__PURE__ */ i("div", {
57
+ }), /* @__PURE__ */ a("div", {
56
58
  className: "space-y-3",
57
59
  children: [
58
- a.facts.lines.map((n) => /* @__PURE__ */ i("div", {
60
+ o.facts.lines.map((n) => /* @__PURE__ */ a("div", {
59
61
  className: "rounded border p-3",
60
62
  children: [
61
- /* @__PURE__ */ i("h3", {
63
+ /* @__PURE__ */ a("h3", {
62
64
  className: "font-medium",
63
65
  children: [
64
66
  n.description,
@@ -66,7 +68,7 @@ function a({ record: a }) {
66
68
  e(n.category)
67
69
  ]
68
70
  }),
69
- /* @__PURE__ */ i("p", { children: [
71
+ /* @__PURE__ */ a("p", { children: [
70
72
  e(n.disposition),
71
73
  "; payer ",
72
74
  n.payerLabel ?? "Unknown",
@@ -74,7 +76,7 @@ function a({ record: a }) {
74
76
  n.payerReference ?? "Unknown reference",
75
77
  ")."
76
78
  ] }),
77
- /* @__PURE__ */ i("p", { children: [
79
+ /* @__PURE__ */ a("p", { children: [
78
80
  "Reported amount: ",
79
81
  t(n.amountMinor, n.currency.minorUnitDigits),
80
82
  " ",
@@ -91,7 +93,7 @@ function a({ record: a }) {
91
93
  n.unitRateMajor ?? "Unknown",
92
94
  "."
93
95
  ] }),
94
- /* @__PURE__ */ i("p", { children: [
96
+ /* @__PURE__ */ a("p", { children: [
95
97
  "Source ",
96
98
  n.sourceReference ?? "Unknown",
97
99
  " /",
@@ -100,10 +102,10 @@ function a({ record: a }) {
100
102
  n.inclusionParentLineId ? `; included in recorded line ${n.inclusionParentLineId}` : "",
101
103
  "."
102
104
  ] }),
103
- n.zeroReason && /* @__PURE__ */ i("p", { children: ["Zero reason: ", n.zeroReason] })
105
+ n.zeroReason && /* @__PURE__ */ a("p", { children: ["Zero reason: ", n.zeroReason] })
104
106
  ]
105
107
  }, n.id)),
106
- a.facts.requirements.map((t) => /* @__PURE__ */ i("p", { children: [
108
+ o.facts.requirements.map((t) => /* @__PURE__ */ a("p", { children: [
107
109
  e(t.category),
108
110
  ": ",
109
111
  e(t.status),
@@ -116,17 +118,17 @@ function a({ record: a }) {
116
118
  " ",
117
119
  t.sourceRevision ?? "Unknown"
118
120
  ] }, t.category)),
119
- /* @__PURE__ */ i("p", { children: [
121
+ /* @__PURE__ */ a("p", { children: [
120
122
  "Quote occurred ",
121
- a.facts.quotedAt ?? "Unknown",
123
+ o.facts.quotedAt ?? "Unknown",
122
124
  "; validity",
123
125
  " ",
124
- a.facts.validFrom ?? "Unknown",
126
+ o.facts.validFrom ?? "Unknown",
125
127
  " to ",
126
- a.facts.validUntil ?? "Unknown",
128
+ o.facts.validUntil ?? "Unknown",
127
129
  "."
128
130
  ] }),
129
- a.facts.fx.map((e) => /* @__PURE__ */ i("p", { children: [
131
+ o.facts.fx.map((e) => /* @__PURE__ */ a("p", { children: [
130
132
  "1 ",
131
133
  e.fromCurrency.code,
132
134
  " = ",
@@ -146,7 +148,7 @@ function a({ record: a }) {
146
148
  "/",
147
149
  e.sourceRevision
148
150
  ] }, e.fromCurrency.code)),
149
- a.evidence.map((e) => /* @__PURE__ */ i("p", { children: [
151
+ o.evidence.map((e) => /* @__PURE__ */ a("p", { children: [
150
152
  "Recorded evidence: file ",
151
153
  e.fileId,
152
154
  ", version ",
@@ -161,4 +163,4 @@ function a({ record: a }) {
161
163
  });
162
164
  }
163
165
  //#endregion
164
- export { a as FreightHistory };
166
+ export { o as FreightHistory };
@@ -0,0 +1,366 @@
1
+ import { Button as e } from "../ui.js";
2
+ import { ContainerEvidencePicker as t } from "../ContainerEvidencePicker.js";
3
+ import { FreightCurrency as n, FreightSelect as r, FreightText as i } from "../freight-cost/FreightFields.js";
4
+ import { fixedFreightMinor as a, freightMoney as o } from "../../utils/freightDraft.js";
5
+ import { invoiceCanonical as s, invoiceFactsInput as c, matchesInvoicePreview as l } from "../../utils/invoiceComparison.js";
6
+ import { InvoiceResults as u } from "./InvoiceResults.js";
7
+ import { useEffect as d, useRef as f, useState as p } from "react";
8
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
9
+ //#region src/movethewheels/components/freight-invoice/InvoiceForm.tsx
10
+ function g() {
11
+ return {
12
+ schemaVersion: 1,
13
+ supplierReference: null,
14
+ supplierLabel: null,
15
+ invoiceReference: null,
16
+ sourceReference: "",
17
+ sourceRevision: "",
18
+ invoiceDate: null,
19
+ currency: {
20
+ code: "",
21
+ minorUnitDigits: 2
22
+ },
23
+ rows: [{
24
+ id: crypto.randomUUID(),
25
+ description: "",
26
+ estimateLineId: null,
27
+ currency: {
28
+ code: "",
29
+ minorUnitDigits: 2
30
+ },
31
+ payerReference: null,
32
+ payerLabel: null,
33
+ quantity: null,
34
+ unit: null,
35
+ unitRateMajor: null,
36
+ amountMinor: null,
37
+ zeroReason: null
38
+ }]
39
+ };
40
+ }
41
+ function _(e) {
42
+ return {
43
+ id: e.id,
44
+ estimateReference: e.estimateReference,
45
+ version: e.version,
46
+ kind: e.facts.kind,
47
+ sourceReference: e.facts.sourceReference,
48
+ sourceRevision: e.facts.sourceRevision,
49
+ quotedAt: e.facts.quotedAt,
50
+ validFrom: e.facts.validFrom,
51
+ validUntil: e.facts.validUntil,
52
+ acceptance: "NOT_ESTABLISHED"
53
+ };
54
+ }
55
+ function v({ estimate: v, previous: y, disabled: b, canRecord: x, onPreview: S, onSave: C }) {
56
+ let [w, T] = p(() => y ? structuredClone(y.facts) : g()), [E, D] = p([]), [O, k] = p(""), [A, j] = p(null), [M, N] = p(null), [P, F] = p(!1), I = f(null), L = f(!0), R = f(!1);
57
+ d(() => (L.current = !0, () => {
58
+ L.current = !1;
59
+ }), []);
60
+ let z = s({
61
+ facts: w,
62
+ evidence: E.map(({ fileId: e, versionId: t }) => ({
63
+ fileId: e,
64
+ versionId: t
65
+ })),
66
+ estimateId: v.id
67
+ }), B = A?.body === z ? A.value : null, V = (e) => T({
68
+ ...w,
69
+ ...e
70
+ }), H = (e, t) => V({ rows: w.rows.map((n) => n.id === e ? {
71
+ ...n,
72
+ ...t
73
+ } : n) }), U = async () => {
74
+ if (R.current || b || !I.current?.reportValidity()) return;
75
+ R.current = !0, F(!0), N(null);
76
+ let e = z;
77
+ try {
78
+ let t = c(w), n = await S({
79
+ shipmentId: v.shipmentId,
80
+ estimateVersionId: v.id,
81
+ facts: t,
82
+ evidence: E.map(({ fileId: e, versionId: t }) => ({
83
+ fileId: e,
84
+ versionId: t
85
+ }))
86
+ });
87
+ if (!l(n, t, _(v))) throw Error("The preview did not match these reported facts and exact estimate. Nothing was sent.");
88
+ L.current && j({
89
+ body: e,
90
+ value: n
91
+ });
92
+ } catch (e) {
93
+ L.current && N(e instanceof Error ? e.message : "Unable to preview the reported facts.");
94
+ } finally {
95
+ R.current = !1, L.current && F(!1);
96
+ }
97
+ };
98
+ return /* @__PURE__ */ h("form", {
99
+ ref: I,
100
+ className: "min-w-0 space-y-5",
101
+ "aria-label": "Manual invoice comparison",
102
+ onSubmit: (e) => {
103
+ if (e.preventDefault(), !(!B || B.recordable !== !0 || b || !x || R.current)) {
104
+ N(null);
105
+ try {
106
+ let e = c(w);
107
+ C({
108
+ shipmentId: v.shipmentId,
109
+ estimateVersionId: v.id,
110
+ facts: e,
111
+ evidence: E.map(({ fileId: e, versionId: t }) => ({
112
+ fileId: e,
113
+ versionId: t
114
+ })),
115
+ expectedRevision: y?.revision ?? 0,
116
+ expectedPreviousComparisonId: y?.id ?? null,
117
+ correctionReason: y && O.trim() || null
118
+ }, _(v)).catch(() => N("The original request remains retained; inspect read-only recovery."));
119
+ } catch (e) {
120
+ N(e instanceof Error ? e.message : "Review the reported source fields. Nothing was sent.");
121
+ }
122
+ }
123
+ },
124
+ children: [
125
+ /* @__PURE__ */ h("fieldset", {
126
+ disabled: b || P,
127
+ className: "min-w-0 space-y-5",
128
+ children: [
129
+ /* @__PURE__ */ m("legend", {
130
+ className: "text-lg font-semibold",
131
+ children: y ? "Append an immutable correction" : "Reported supplier invoice"
132
+ }),
133
+ /* @__PURE__ */ m("p", { children: "Blank means unknown, never zero. This is a manual comparison, not approval or payment. No FX, credits or split allocation." }),
134
+ /* @__PURE__ */ h("p", { children: [
135
+ "Exact pinned ",
136
+ v.facts.kind.toLowerCase(),
137
+ ": ",
138
+ v.estimateReference,
139
+ " / version",
140
+ " ",
141
+ v.version,
142
+ "; ",
143
+ v.facts.title,
144
+ ". Source validity: ",
145
+ v.validityAtRead,
146
+ ". Acceptance is not established."
147
+ ] }),
148
+ /* @__PURE__ */ h("div", {
149
+ className: "grid min-w-0 gap-3 md:grid-cols-2",
150
+ children: [
151
+ /* @__PURE__ */ m(i, {
152
+ label: "Supplier source reference",
153
+ value: w.supplierReference ?? "",
154
+ disabled: !!y,
155
+ onChange: (e) => V({ supplierReference: e })
156
+ }),
157
+ /* @__PURE__ */ m(i, {
158
+ label: "Supplier label",
159
+ value: w.supplierLabel ?? "",
160
+ onChange: (e) => V({ supplierLabel: e })
161
+ }),
162
+ /* @__PURE__ */ m(i, {
163
+ label: "Invoice reference",
164
+ value: w.invoiceReference ?? "",
165
+ disabled: !!y,
166
+ onChange: (e) => V({ invoiceReference: e })
167
+ }),
168
+ /* @__PURE__ */ m(i, {
169
+ label: "Invoice source reference",
170
+ value: w.sourceReference,
171
+ required: !0,
172
+ onChange: (e) => V({ sourceReference: e })
173
+ }),
174
+ /* @__PURE__ */ m(i, {
175
+ label: "Invoice source revision",
176
+ value: w.sourceRevision,
177
+ required: !0,
178
+ onChange: (e) => V({ sourceRevision: e })
179
+ }),
180
+ /* @__PURE__ */ m(i, {
181
+ label: "Invoice source date (optional)",
182
+ type: "date",
183
+ value: w.invoiceDate ?? "",
184
+ onChange: (e) => V({ invoiceDate: e || null })
185
+ })
186
+ ]
187
+ }),
188
+ /* @__PURE__ */ m(n, {
189
+ label: "Invoice currency",
190
+ value: w.currency,
191
+ onChange: (e) => V({
192
+ currency: e,
193
+ rows: w.rows.map((t) => ({
194
+ ...t,
195
+ currency: e,
196
+ amountMinor: null,
197
+ zeroReason: null
198
+ }))
199
+ })
200
+ }),
201
+ w.rows.map((t, n) => /* @__PURE__ */ h("fieldset", {
202
+ className: "min-w-0 space-y-3 rounded border p-3",
203
+ children: [
204
+ /* @__PURE__ */ h("legend", {
205
+ className: "font-semibold",
206
+ children: ["Reported row ", n + 1]
207
+ }),
208
+ /* @__PURE__ */ m(i, {
209
+ label: `Row ${n + 1} description`,
210
+ value: t.description,
211
+ required: !0,
212
+ onChange: (e) => H(t.id, { description: e })
213
+ }),
214
+ /* @__PURE__ */ h(r, {
215
+ label: `Row ${n + 1} exact estimate mapping`,
216
+ value: t.estimateLineId ?? "",
217
+ onChange: (e) => H(t.id, { estimateLineId: e || null }),
218
+ children: [/* @__PURE__ */ m("option", {
219
+ value: "",
220
+ children: "Unmatched invoice row"
221
+ }), v.facts.lines.map((e) => /* @__PURE__ */ h("option", {
222
+ value: e.id,
223
+ children: [
224
+ e.description,
225
+ " / ",
226
+ e.id,
227
+ " / ",
228
+ e.disposition
229
+ ]
230
+ }, e.id))]
231
+ }),
232
+ /* @__PURE__ */ h("div", {
233
+ className: "grid min-w-0 gap-3 md:grid-cols-2",
234
+ children: [
235
+ /* @__PURE__ */ m(i, {
236
+ label: `Row ${n + 1} payer source reference`,
237
+ value: t.payerReference ?? "",
238
+ onChange: (e) => H(t.id, { payerReference: e })
239
+ }),
240
+ /* @__PURE__ */ m(i, {
241
+ label: `Row ${n + 1} payer label`,
242
+ value: t.payerLabel ?? "",
243
+ onChange: (e) => H(t.id, { payerLabel: e })
244
+ }),
245
+ /* @__PURE__ */ h("label", {
246
+ className: "block text-sm",
247
+ children: [
248
+ "Row ",
249
+ n + 1,
250
+ " supplied amount (",
251
+ t.currency.code || "declare currency",
252
+ ")",
253
+ /* @__PURE__ */ m("input", {
254
+ className: "mt-1 min-h-11 w-full rounded border p-2",
255
+ "aria-label": `Row ${n + 1} supplied amount`,
256
+ inputMode: "decimal",
257
+ defaultValue: t.amountMinor == null ? "" : o(t.amountMinor, t.currency.minorUnitDigits),
258
+ onChange: (e) => {
259
+ try {
260
+ H(t.id, { amountMinor: a(e.target.value, t.currency.minorUnitDigits) }), e.target.setCustomValidity("");
261
+ } catch (n) {
262
+ H(t.id, { amountMinor: null }), e.target.setCustomValidity(n instanceof Error ? n.message : "Invalid sourced amount.");
263
+ }
264
+ }
265
+ }, `${t.currency.code}:${t.currency.minorUnitDigits}`)
266
+ ]
267
+ }),
268
+ /* @__PURE__ */ m(i, {
269
+ label: `Row ${n + 1} zero source reason`,
270
+ value: t.zeroReason ?? "",
271
+ onChange: (e) => H(t.id, { zeroReason: e })
272
+ }),
273
+ /* @__PURE__ */ m(i, {
274
+ label: `Row ${n + 1} supplied quantity`,
275
+ value: t.quantity ?? "",
276
+ onChange: (e) => H(t.id, { quantity: e })
277
+ }),
278
+ /* @__PURE__ */ m(i, {
279
+ label: `Row ${n + 1} explicit unit`,
280
+ value: t.unit ?? "",
281
+ onChange: (e) => H(t.id, { unit: e })
282
+ }),
283
+ /* @__PURE__ */ m(i, {
284
+ label: `Row ${n + 1} supplied unit rate`,
285
+ value: t.unitRateMajor ?? "",
286
+ onChange: (e) => H(t.id, { unitRateMajor: e })
287
+ })
288
+ ]
289
+ }),
290
+ /* @__PURE__ */ h("p", { children: [
291
+ w.currency.code || "currency unknown",
292
+ " / decimal places",
293
+ " ",
294
+ w.currency.minorUnitDigits,
295
+ ". Amount stays as supplied, not quantity × rate."
296
+ ] }),
297
+ /* @__PURE__ */ h(e, {
298
+ type: "button",
299
+ variant: "outline",
300
+ disabled: w.rows.length === 1,
301
+ onClick: () => V({ rows: w.rows.filter((e) => e.id !== t.id) }),
302
+ children: ["Remove row ", n + 1]
303
+ })
304
+ ]
305
+ }, t.id)),
306
+ /* @__PURE__ */ m(e, {
307
+ type: "button",
308
+ variant: "outline",
309
+ disabled: w.rows.length >= 100,
310
+ onClick: () => V({ rows: [...w.rows, {
311
+ id: crypto.randomUUID(),
312
+ description: "",
313
+ estimateLineId: null,
314
+ currency: { ...w.currency },
315
+ payerReference: null,
316
+ payerLabel: null,
317
+ quantity: null,
318
+ unit: null,
319
+ unitRateMajor: null,
320
+ amountMinor: null,
321
+ zeroReason: null
322
+ }] }),
323
+ children: "Add reported row"
324
+ }),
325
+ /* @__PURE__ */ m(t, {
326
+ currentOnly: !0,
327
+ value: E,
328
+ onChange: D,
329
+ description: "Choose current readable ACTIVE Files versions with an integrity fingerprint. The server rechecks eligibility when recording; no binary is uploaded here."
330
+ }),
331
+ y && /* @__PURE__ */ m(i, {
332
+ label: "Correction source reason",
333
+ value: O,
334
+ required: !1,
335
+ onChange: k
336
+ }),
337
+ /* @__PURE__ */ h("div", {
338
+ className: "flex flex-wrap gap-3",
339
+ children: [/* @__PURE__ */ m(e, {
340
+ type: "button",
341
+ variant: "outline",
342
+ onClick: () => void U(),
343
+ children: "Preview reported comparison"
344
+ }), /* @__PURE__ */ m(e, {
345
+ type: "submit",
346
+ disabled: !x || B?.recordable !== !0 || !E.length || !!y && !O.trim(),
347
+ children: "Record immutable comparison"
348
+ })]
349
+ })
350
+ ]
351
+ }),
352
+ !x && /* @__PURE__ */ m("p", { children: "Shipment update permission is required to record; structural preview remains read-only." }),
353
+ P && /* @__PURE__ */ m("p", {
354
+ role: "status",
355
+ children: "Comparing the exact recorded facts…"
356
+ }),
357
+ M && /* @__PURE__ */ m("p", {
358
+ role: "alert",
359
+ children: M
360
+ }),
361
+ B && /* @__PURE__ */ m(u, { value: B })
362
+ ]
363
+ });
364
+ }
365
+ //#endregion
366
+ export { v as InvoiceForm };