@burdenoff/microfe-movethewheels 2026.1101.4 → 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.
Files changed (47) hide show
  1. package/dist/components/CustomerDeliveryUpdatesFields.js +57 -0
  2. package/dist/components/CustomerNotificationSettingsCard.js +368 -0
  3. package/dist/components/freight-cost/FreightCommercialFactEditor.js +46 -46
  4. package/dist/components/freight-cost/FreightCommercialHistory.js +7 -7
  5. package/dist/components/freight-cost/FreightDraftForm.js +20 -20
  6. package/dist/components/freight-invoice/InvoiceReviewPanel.js +255 -0
  7. package/dist/components/freight-invoice/InvoiceReviewQueue.js +93 -0
  8. package/dist/generated/freight-invoice-operations.d.ts +461 -0
  9. package/dist/generated/tracking-quality-operations.d.ts +275 -0
  10. package/dist/hooks/useCustomers.js +9 -3
  11. package/dist/hooks/useInvoiceComparisonRecovery.js +26 -26
  12. package/dist/hooks/useInvoiceReviewPermissions.js +14 -0
  13. package/dist/movethewheels/components/CustomerDeliveryUpdatesFields.d.ts +12 -0
  14. package/dist/movethewheels/components/CustomerNotificationSettingsCard.d.ts +3 -0
  15. package/dist/movethewheels/components/freight-invoice/InvoiceReviewPanel.d.ts +11 -0
  16. package/dist/movethewheels/components/freight-invoice/InvoiceReviewQueue.d.ts +22 -0
  17. package/dist/movethewheels/hooks/useInvoiceReviewPermissions.d.ts +5 -0
  18. package/dist/movethewheels/pages/FinancePage.d.ts +3 -1
  19. package/dist/movethewheels/types/index.d.ts +4 -0
  20. package/dist/movethewheels/utils/customerNotifications.d.ts +66 -0
  21. package/dist/movethewheels/utils/invoiceReview.d.ts +26 -0
  22. package/dist/node_modules/lucide-react/dist/esm/icons/bell-ring.js +22 -0
  23. package/dist/pages/CustomerDetailsPage.js +279 -231
  24. package/dist/pages/FinancePage.js +109 -67
  25. package/dist/pages/FreightEstimatePage.js +89 -89
  26. package/dist/pages/FreightInvoicePage.js +138 -120
  27. package/dist/pages/SettingsPage.js +242 -238
  28. package/dist/src/generated/freight-invoice-operations.js +2100 -1
  29. package/dist/utils/customerNotifications.js +83 -0
  30. package/dist/utils/invoiceReview.js +84 -0
  31. package/package.json +4 -3
  32. package/src/generated/freight-invoice-operations.ts +245 -1
  33. package/src/generated/tracking-quality-operations.ts +304 -0
  34. package/src/movethewheels/components/CustomerDeliveryUpdatesFields.tsx +67 -0
  35. package/src/movethewheels/components/CustomerNotificationSettingsCard.tsx +465 -0
  36. package/src/movethewheels/components/freight-invoice/InvoiceReviewPanel.tsx +319 -0
  37. package/src/movethewheels/components/freight-invoice/InvoiceReviewQueue.tsx +96 -0
  38. package/src/movethewheels/hooks/useCustomers.ts +17 -0
  39. package/src/movethewheels/hooks/useInvoiceReviewPermissions.ts +25 -0
  40. package/src/movethewheels/pages/CustomerDetailsPage.tsx +39 -0
  41. package/src/movethewheels/pages/FinancePage.tsx +34 -2
  42. package/src/movethewheels/pages/FreightInvoicePage.tsx +44 -3
  43. package/src/movethewheels/pages/SettingsPage.tsx +221 -208
  44. package/src/movethewheels/types/index.ts +4 -0
  45. package/src/movethewheels/utils/customerNotifications.ts +209 -0
  46. package/src/movethewheels/utils/invoiceReview.ts +146 -0
  47. package/src/operations/freight-invoice/review.graphql +26 -0
@@ -17,87 +17,128 @@ import { MetricCard as b, MetricGrid as x } from "../components/MetricCard.js";
17
17
  import { TrendChart as S } from "../components/charts/TrendChart.js";
18
18
  import { VolumeBar as C } from "../components/charts/VolumeBar.js";
19
19
  import "../components/charts/index.js";
20
- import { useMemo as w } from "react";
21
- import { jsx as T, jsxs as E } from "react/jsx-runtime";
22
- import { EmphasisPanel as D, PagePurpose as O } from "@burdenoff/fe-libs/ui";
20
+ import { useInvoiceReviewSummary as w } from "../components/freight-invoice/InvoiceReviewQueue.js";
21
+ import { useMemo as T } from "react";
22
+ import { jsx as E, jsxs as D } from "react/jsx-runtime";
23
+ import { EmphasisPanel as O, PagePurpose as k } from "@burdenoff/fe-libs/ui";
23
24
  //#region src/movethewheels/pages/FinancePage.tsx
24
- function k() {
25
- let { analytics: k } = d(), { metrics: A } = f(), { navigate: j, basePath: M } = l(), N = () => j("/billing"), P = () => j(c(M, "finance/freight-estimates")), F = () => j(c(M, "finance/freight-invoice-comparisons")), I = w(() => k.trends.revenue.map((e) => ({
25
+ function A() {
26
+ let { summary: e, loading: t, error: n } = w(!0);
27
+ return t ? /* @__PURE__ */ E("p", {
28
+ className: "text-sm text-text-secondary",
29
+ children: "Loading invoice review counts…"
30
+ }) : n || !e ? /* @__PURE__ */ E("p", {
31
+ className: "text-sm text-text-secondary",
32
+ children: "Invoice review counts need freight invoice read permission."
33
+ }) : /* @__PURE__ */ E("dl", {
34
+ className: "grid grid-cols-2 gap-2",
35
+ "aria-label": "Carrier invoice review",
36
+ children: [
37
+ {
38
+ label: "Awaiting review",
39
+ value: e.awaitingReview
40
+ },
41
+ {
42
+ label: "Disputed",
43
+ value: e.disputed + e.supplierResponded
44
+ },
45
+ {
46
+ label: "Accepted",
47
+ value: e.accepted + e.acceptedWithVariance
48
+ },
49
+ {
50
+ label: "Handed to Billing",
51
+ value: e.settlementHandedOff
52
+ }
53
+ ].map((e) => /* @__PURE__ */ D("div", {
54
+ className: "rounded-lg border border-border-default p-3",
55
+ children: [/* @__PURE__ */ E("dt", {
56
+ className: "text-xs text-text-secondary",
57
+ children: e.label
58
+ }), /* @__PURE__ */ E("dd", {
59
+ className: "text-lg font-semibold text-text-primary",
60
+ children: e.value
61
+ })]
62
+ }, e.label))
63
+ });
64
+ }
65
+ function j() {
66
+ let { analytics: w } = d(), { metrics: j } = f(), { navigate: M, basePath: N } = l(), P = () => M("/billing"), F = () => M(c(N, "finance/freight-estimates")), I = () => M(c(N, "finance/freight-invoice-comparisons")), L = T(() => w.trends.revenue.map((e) => ({
26
67
  month: e.month,
27
68
  revenue: e.revenue
28
- })), [k.trends.revenue]), L = w(() => [
69
+ })), [w.trends.revenue]), R = T(() => [
29
70
  {
30
71
  label: "Total revenue",
31
- amount: A.totalRevenue
72
+ amount: j.totalRevenue
32
73
  },
33
74
  {
34
75
  label: "Collected",
35
- amount: A.deliveredRevenue
76
+ amount: j.deliveredRevenue
36
77
  },
37
78
  {
38
79
  label: "Fuel cost",
39
- amount: A.fuelCost
80
+ amount: j.fuelCost
40
81
  }
41
82
  ], [
42
- A.totalRevenue,
43
- A.deliveredRevenue,
44
- A.fuelCost
45
- ]), R = L.some((e) => e.amount > 0);
46
- return /* @__PURE__ */ E(v, {
83
+ j.totalRevenue,
84
+ j.deliveredRevenue,
85
+ j.fuelCost
86
+ ]), z = R.some((e) => e.amount > 0);
87
+ return /* @__PURE__ */ D(v, {
47
88
  title: "Finance",
48
89
  subtitle: "Financial overview and reports",
49
- icon: /* @__PURE__ */ T(n, { size: 24 }),
50
- headerActions: /* @__PURE__ */ E(p, {
90
+ icon: /* @__PURE__ */ E(n, { size: 24 }),
91
+ headerActions: /* @__PURE__ */ D(p, {
51
92
  variant: "outline",
52
- onClick: N,
53
- children: [/* @__PURE__ */ T(i, { size: 16 }), " Invoices & Billing"]
93
+ onClick: P,
94
+ children: [/* @__PURE__ */ E(i, { size: 16 }), " Invoices & Billing"]
54
95
  }),
55
96
  children: [
56
- /* @__PURE__ */ T(O, {
57
- icon: /* @__PURE__ */ T(n, { size: 18 }),
97
+ /* @__PURE__ */ E(k, {
98
+ icon: /* @__PURE__ */ E(n, { size: 18 }),
58
99
  children: "Follow the money behind your deliveries. See total revenue, how much has already been collected on delivered orders, fuel cost and how many invoices are still open — then head to Billing to raise and settle invoices."
59
100
  }),
60
- /* @__PURE__ */ E(x, {
101
+ /* @__PURE__ */ D(x, {
61
102
  columns: 4,
62
103
  children: [
63
- /* @__PURE__ */ T(b, {
104
+ /* @__PURE__ */ E(b, {
64
105
  treatment: "glass",
65
106
  glow: !0,
66
107
  label: "Total Revenue",
67
- value: u(A.totalRevenue),
68
- icon: /* @__PURE__ */ T(n, { size: 20 }),
108
+ value: u(j.totalRevenue),
109
+ icon: /* @__PURE__ */ E(n, { size: 20 }),
69
110
  accent: "success"
70
111
  }),
71
- /* @__PURE__ */ T(b, {
112
+ /* @__PURE__ */ E(b, {
72
113
  label: "Collected (Delivered)",
73
- value: u(A.deliveredRevenue),
74
- icon: /* @__PURE__ */ T(s, { size: 20 }),
114
+ value: u(j.deliveredRevenue),
115
+ icon: /* @__PURE__ */ E(s, { size: 20 }),
75
116
  accent: "brand"
76
117
  }),
77
- /* @__PURE__ */ T(b, {
118
+ /* @__PURE__ */ E(b, {
78
119
  label: "Fuel Cost",
79
- value: u(A.fuelCost),
80
- icon: /* @__PURE__ */ T(a, { size: 20 }),
120
+ value: u(j.fuelCost),
121
+ icon: /* @__PURE__ */ E(a, { size: 20 }),
81
122
  accent: "warning"
82
123
  }),
83
- /* @__PURE__ */ T(b, {
124
+ /* @__PURE__ */ E(b, {
84
125
  label: "Open Invoices",
85
- value: String(A.openInvoices),
86
- icon: /* @__PURE__ */ T(t, { size: 20 }),
126
+ value: String(j.openInvoices),
127
+ icon: /* @__PURE__ */ E(t, { size: 20 }),
87
128
  accent: "blue"
88
129
  })
89
130
  ]
90
131
  }),
91
- /* @__PURE__ */ E("div", {
132
+ /* @__PURE__ */ D("div", {
92
133
  className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
93
- children: [/* @__PURE__ */ E(m, {
134
+ children: [/* @__PURE__ */ D(m, {
94
135
  className: "lg:col-span-2",
95
- children: [/* @__PURE__ */ T(g, { children: /* @__PURE__ */ T(_, { children: "Revenue trend" }) }), /* @__PURE__ */ T(h, { children: /* @__PURE__ */ T(S, {
136
+ children: [/* @__PURE__ */ E(g, { children: /* @__PURE__ */ E(_, { children: "Revenue trend" }) }), /* @__PURE__ */ E(h, { children: /* @__PURE__ */ E(S, {
96
137
  xKey: "month",
97
138
  variant: "area",
98
139
  height: 280,
99
140
  showLegend: !1,
100
- data: I,
141
+ data: L,
101
142
  series: [{
102
143
  dataKey: "revenue",
103
144
  name: "Revenue",
@@ -106,65 +147,66 @@ function k() {
106
147
  valueFormatter: (e) => u(Number(e)),
107
148
  emptyMessage: "No revenue recorded yet. Revenue appears here as orders are delivered."
108
149
  }) })]
109
- }), /* @__PURE__ */ E(D, {
150
+ }), /* @__PURE__ */ D(O, {
110
151
  className: "space-y-4",
111
152
  children: [
112
- /* @__PURE__ */ T("h2", {
153
+ /* @__PURE__ */ E("h2", {
113
154
  className: "text-base font-semibold text-text-primary",
114
155
  children: "Invoices & Settlement"
115
156
  }),
116
- /* @__PURE__ */ T("p", {
157
+ /* @__PURE__ */ E("p", {
117
158
  className: "text-sm text-text-secondary",
118
159
  children: "Invoicing, payments and settlement run through the platform Billing module — the single source of truth for what's been billed and paid. MoveTheWheels doesn't keep its own invoice ledger."
119
160
  }),
120
- /* @__PURE__ */ E("div", {
161
+ /* @__PURE__ */ D("div", {
121
162
  className: "flex items-center justify-between p-4 bg-status-warning-bg/10 rounded-lg",
122
- children: [/* @__PURE__ */ E("div", {
163
+ children: [/* @__PURE__ */ D("div", {
123
164
  className: "flex items-center gap-3",
124
- children: [/* @__PURE__ */ T("div", {
165
+ children: [/* @__PURE__ */ E("div", {
125
166
  className: "w-10 h-10 rounded-full bg-status-warning-bg/20 flex items-center justify-center",
126
- children: /* @__PURE__ */ T(t, {
167
+ children: /* @__PURE__ */ E(t, {
127
168
  size: 20,
128
169
  className: "text-status-warning-text"
129
170
  })
130
- }), /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("p", {
171
+ }), /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
131
172
  className: "font-medium",
132
173
  children: "Open invoices"
133
- }), /* @__PURE__ */ E("p", {
174
+ }), /* @__PURE__ */ D("p", {
134
175
  className: "text-sm text-text-secondary",
135
- children: [A.openInvoices, " awaiting settlement"]
176
+ children: [j.openInvoices, " awaiting settlement"]
136
177
  })] })]
137
- }), /* @__PURE__ */ T("span", {
178
+ }), /* @__PURE__ */ E("span", {
138
179
  className: "text-xl font-bold text-status-warning-text",
139
- children: A.openInvoices
180
+ children: j.openInvoices
140
181
  })]
141
182
  }),
142
- /* @__PURE__ */ E(p, {
183
+ /* @__PURE__ */ D(p, {
143
184
  className: "w-full",
144
- onClick: N,
145
- children: ["Open Billing ", /* @__PURE__ */ T(e, { size: 16 })]
185
+ onClick: P,
186
+ children: ["Open Billing ", /* @__PURE__ */ E(e, { size: 16 })]
146
187
  }),
147
- /* @__PURE__ */ E("div", {
188
+ /* @__PURE__ */ D("div", {
148
189
  className: "space-y-2 border-t border-border-default pt-4",
149
190
  children: [
150
- /* @__PURE__ */ T("h3", {
191
+ /* @__PURE__ */ E("h3", {
151
192
  className: "text-sm font-semibold text-text-primary",
152
193
  children: "Freight cost control"
153
194
  }),
154
- /* @__PURE__ */ T("p", {
195
+ /* @__PURE__ */ E("p", {
155
196
  className: "text-sm text-text-secondary",
156
- children: "Record the agreed freight estimate for a shipment, then check the carrier's invoice against it line by line before it is settled in Billing."
197
+ children: "Record the agreed freight estimate for a shipment, then check the carrier's invoice against it line by line. Someone other than its author accepts or disputes it, and accepted invoices are handed to Billing for settlement."
157
198
  }),
158
- /* @__PURE__ */ E("div", {
199
+ /* @__PURE__ */ E(A, {}),
200
+ /* @__PURE__ */ D("div", {
159
201
  className: "grid grid-cols-1 gap-2 sm:grid-cols-2",
160
- children: [/* @__PURE__ */ E(p, {
161
- variant: "outline",
162
- onClick: P,
163
- children: [/* @__PURE__ */ T(o, { size: 16 }), " Freight estimates"]
164
- }), /* @__PURE__ */ E(p, {
202
+ children: [/* @__PURE__ */ D(p, {
165
203
  variant: "outline",
166
204
  onClick: F,
167
- children: [/* @__PURE__ */ T(r, { size: 16 }), " Invoice comparisons"]
205
+ children: [/* @__PURE__ */ E(o, { size: 16 }), " Freight estimates"]
206
+ }), /* @__PURE__ */ D(p, {
207
+ variant: "outline",
208
+ onClick: I,
209
+ children: [/* @__PURE__ */ E(r, { size: 16 }), " Invoice comparisons"]
168
210
  })]
169
211
  })
170
212
  ]
@@ -172,17 +214,17 @@ function k() {
172
214
  ]
173
215
  })]
174
216
  }),
175
- /* @__PURE__ */ E(m, { children: [/* @__PURE__ */ T(g, { children: /* @__PURE__ */ T(_, { children: "Revenue vs cost" }) }), /* @__PURE__ */ T(h, { children: R ? /* @__PURE__ */ T(C, {
217
+ /* @__PURE__ */ D(m, { children: [/* @__PURE__ */ E(g, { children: /* @__PURE__ */ E(_, { children: "Revenue vs cost" }) }), /* @__PURE__ */ E(h, { children: z ? /* @__PURE__ */ E(C, {
176
218
  xKey: "label",
177
219
  height: 260,
178
220
  showLegend: !1,
179
- data: L,
221
+ data: R,
180
222
  series: [{
181
223
  dataKey: "amount",
182
224
  name: "Amount"
183
225
  }],
184
226
  valueFormatter: (e) => u(Number(e))
185
- }) : /* @__PURE__ */ T("p", {
227
+ }) : /* @__PURE__ */ E("p", {
186
228
  className: "py-8 text-center text-sm text-text-secondary",
187
229
  children: "Revenue and cost figures appear here as orders are delivered."
188
230
  }) })] })
@@ -190,4 +232,4 @@ function k() {
190
232
  });
191
233
  }
192
234
  //#endregion
193
- export { k as default };
235
+ export { j as default };
@@ -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 { FreightCommercialVersionDocument as l, FreightHistoryDocument as u, FreightShipmentDocument as d, FreightShipmentsDocument as f, PreviewFreightCostsDocument as ee, SaveFreightCommercialCostsDocument as p, SaveFreightCostsDocument as m } from "../src/generated/freight-cost-operations.js";
7
- import { FreightText as h } from "../components/freight-cost/FreightFields.js";
8
- import { freightPinMatches as g, freightSaveInput as _ } from "../utils/freightDraft.js";
9
- import { FreightDraftForm as v } from "../components/freight-cost/FreightDraftForm.js";
10
- import { FreightHistory as te } from "../components/freight-cost/FreightHistory.js";
11
- import { useFreightRecoveryAction as y } from "../hooks/useFreightRecoveryAction.js";
12
- import { useEffect as b, useRef as x, useState as S } from "react";
13
- import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
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 E() {
16
- let t = y();
17
- return /* @__PURE__ */ w(n, {
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__ */ w(e, { "aria-hidden": "true" }),
21
- children: /* @__PURE__ */ w(D, { actions: t }, t.contextKey)
20
+ icon: /* @__PURE__ */ T(e, { "aria-hidden": "true" }),
21
+ children: /* @__PURE__ */ T(O, { actions: t }, t.contextKey)
22
22
  });
23
23
  }
24
- function D({ actions: e }) {
25
- let n = r(), [y, E] = S(0), [D, O] = S(0), [k, A] = S(null), [j, M] = S(""), [N, P] = S(null), [F, I] = S(null), [ne, L] = S(!1), [R, z] = S(!1), [B, V] = S(null), H = x(!0), U = x(!1);
26
- b(() => (H.current = !0, () => {
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(f, { pagination: {
29
+ let W = i(h, { pagination: {
30
30
  limit: 25,
31
- offset: y
32
- } }, e.revision), G = i(d, k ? { id: k.id } : null, e.revision), K = i(u, k && j.trim() ? {
33
- shipmentId: k.id,
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 : k ? {
40
- shipmentId: k.id,
39
+ } : null, e.revision), q = e.uncertain ? e.originalHistoryTarget : A ? {
40
+ shipmentId: A.id,
41
41
  estimateReference: void 0
42
- } : null, J = i(u, q ? {
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: D
47
+ offset: O
48
48
  }
49
- } : null, e.revision), Y = i(l, q && N ? {
49
+ } : null, e.revision), Y = i(f, q && M ? {
50
50
  shipmentId: q.shipmentId,
51
- id: N
52
- } : null, e.revision), X = K.data?.mtwFreightEstimatePage.items[0] ?? null, Z = !!F && !!G.data && !!K.data && !g(F, G.data.shipment, X), Q = e.busy || ne || e.uncertain, $ = W.data?.shipments.map((e) => ({
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
- k && !$.some((e) => e.id === k.id) && $.unshift({
57
- id: k.id,
58
- label: `${k.label} — selected outside this page`
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 (!F) throw Error("Review the shipment and current cost history first.");
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 = F;
64
+ let a = P;
65
65
  try {
66
- let o = await n(d, { id: a.shipmentId }), s = await n(u, {
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
- g(a, o.shipment, c) || z(!0);
77
- let l = _(a, o.shipment, c, t, r.map(({ fileId: e, versionId: t }) => ({
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 ? p : m, 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 && (P(f.saveMtwFreightEstimate.id), I(null), O(0));
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: y,
92
- hasMore: y + W.data.shipments.length < W.data.shipmentsCount,
93
- nextOffset: y + 25
91
+ offset: b,
92
+ hasMore: b + W.data.shipments.length < W.data.shipmentsCount,
93
+ nextOffset: b + 25
94
94
  } : void 0;
95
- return /* @__PURE__ */ T("div", {
95
+ return /* @__PURE__ */ E("div", {
96
96
  className: "min-w-0 space-y-6 break-words",
97
97
  children: [
98
- /* @__PURE__ */ w("p", {
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__ */ T("section", {
102
+ /* @__PURE__ */ E("section", {
103
103
  className: c,
104
104
  children: [
105
- /* @__PURE__ */ w("h2", {
105
+ /* @__PURE__ */ T("h2", {
106
106
  className: "text-lg font-semibold",
107
107
  children: "Shipment and cost sheet"
108
108
  }),
109
- /* @__PURE__ */ w(a, {
109
+ /* @__PURE__ */ T(a, {
110
110
  label: "Shipment",
111
- value: k?.id ?? "",
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
- A(t ? {
116
+ te(t ? {
117
117
  id: t.id,
118
118
  label: t.label
119
- } : null), I(null), P(null), O(0), z(!1);
119
+ } : null), F(null), N(null), k(0), z(!1);
120
120
  }
121
121
  }),
122
- /* @__PURE__ */ w(s, {
122
+ /* @__PURE__ */ T(s, {
123
123
  loading: W.loading,
124
124
  error: W.error
125
125
  }),
126
- /* @__PURE__ */ w(o, {
126
+ /* @__PURE__ */ T(o, {
127
127
  page: ie,
128
128
  busy: W.loading || Q,
129
- offset: y,
130
- onChange: E
129
+ offset: b,
130
+ onChange: D
131
131
  }),
132
- /* @__PURE__ */ w(h, {
132
+ /* @__PURE__ */ T(l, {
133
133
  label: "Cost sheet reference",
134
134
  value: j,
135
- disabled: Q || F !== null,
136
- onChange: M
135
+ disabled: Q || P !== null,
136
+ onChange: ne
137
137
  }),
138
- /* @__PURE__ */ w(s, {
138
+ /* @__PURE__ */ T(s, {
139
139
  loading: G.loading,
140
140
  error: G.error
141
141
  }),
142
- /* @__PURE__ */ w(s, {
142
+ /* @__PURE__ */ T(s, {
143
143
  loading: K.loading,
144
144
  error: K.error
145
145
  }),
146
- G.data?.shipment && /* @__PURE__ */ T("p", { children: [
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__ */ T("div", {
155
+ /* @__PURE__ */ E("div", {
156
156
  className: "flex flex-wrap gap-3",
157
- children: [/* @__PURE__ */ w(t, {
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__ */ w(t, {
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 && (I({
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__ */ w("p", {
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
- F && !Z && !R && /* @__PURE__ */ w(v, {
187
- shipmentId: F.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(ee, { input: e })).previewMtwFreightTotal,
189
+ onPreview: async (e) => (await n(g, { input: e })).previewMtwFreightTotal,
190
190
  onSave: re
191
- }, F.generation),
192
- B && /* @__PURE__ */ w("p", {
191
+ }, P.generation),
192
+ B && /* @__PURE__ */ T("p", {
193
193
  role: "alert",
194
194
  children: B
195
195
  }),
196
- e.error && /* @__PURE__ */ w("p", {
196
+ e.error && /* @__PURE__ */ T("p", {
197
197
  role: "alert",
198
198
  children: e.error
199
199
  }),
200
- e.notice && /* @__PURE__ */ w("p", {
200
+ e.notice && /* @__PURE__ */ T("p", {
201
201
  role: "status",
202
202
  children: e.notice
203
203
  }),
204
- e.uncertain && /* @__PURE__ */ T("section", {
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__ */ w("h2", {
207
+ /* @__PURE__ */ T("h2", {
208
208
  className: "font-semibold",
209
209
  children: "Resolve the original save"
210
210
  }),
211
- /* @__PURE__ */ w("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__ */ w(t, {
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__ */ w(t, {
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__ */ w("p", {
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__ */ T("section", {
233
+ q && /* @__PURE__ */ E("section", {
234
234
  className: "space-y-4 rounded-xl border bg-bg-surface p-5",
235
235
  children: [
236
- /* @__PURE__ */ w("h2", {
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__ */ T(C, { children: [/* @__PURE__ */ T("p", { children: [
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__ */ w(t, {
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__ */ w(s, {
253
+ /* @__PURE__ */ T(s, {
254
254
  loading: J.loading,
255
255
  error: J.error
256
256
  }),
257
- J.data?.mtwFreightEstimatePage.items.map((e) => /* @__PURE__ */ T(t, {
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: () => P(e.id),
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__ */ w(o, {
273
+ /* @__PURE__ */ T(o, {
274
274
  page: J.data?.mtwFreightEstimatePage,
275
275
  busy: J.loading,
276
- offset: D,
277
- onChange: O
276
+ offset: O,
277
+ onChange: k
278
278
  })
279
279
  ]
280
280
  }),
281
- q && N && /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(s, {
281
+ q && M && /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(s, {
282
282
  loading: Y.loading,
283
283
  error: Y.error
284
- }), Y.data && /* @__PURE__ */ w(te, { record: Y.data.mtwFreightEstimateVersion })] })
284
+ }), Y.data && /* @__PURE__ */ T(ee, { record: Y.data.mtwFreightEstimateVersion })] })
285
285
  ]
286
286
  });
287
287
  }
288
288
  //#endregion
289
- export { E as default };
289
+ export { D as default };