@burdenoff/microfe-movethewheels 2026.1016.1 → 2026.1016.3

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 (200) hide show
  1. package/dist/components/freight-cost/FreightCommercialEditor.js +217 -0
  2. package/dist/components/freight-cost/FreightCommercialFactEditor.js +217 -0
  3. package/dist/components/freight-cost/FreightCommercialHistory.js +115 -0
  4. package/dist/components/freight-cost/FreightDraftForm.js +106 -91
  5. package/dist/components/freight-cost/FreightHistory.js +42 -40
  6. package/dist/dev/main.d.ts +0 -1
  7. package/dist/generated/freight-cost-operations.d.ts +959 -0
  8. package/dist/hooks/useFreightRecoveryAction.js +20 -20
  9. package/dist/index.d.ts +2 -4
  10. package/dist/movethewheels/MoveTheWheelsRoot.d.ts +0 -1
  11. package/dist/movethewheels/MoveTheWheelsRoutes.d.ts +1 -1
  12. package/dist/movethewheels/components/AssignmentSuggestions.d.ts +1 -2
  13. package/dist/movethewheels/components/CarbonFootprintPanel.d.ts +1 -1
  14. package/dist/movethewheels/components/ContainerEvidencePicker.d.ts +1 -2
  15. package/dist/movethewheels/components/CustomerPicker.d.ts +1 -2
  16. package/dist/movethewheels/components/DataTable.d.ts +1 -2
  17. package/dist/movethewheels/components/DocumentsCard.d.ts +1 -2
  18. package/dist/movethewheels/components/EntityCombobox.d.ts +1 -1
  19. package/dist/movethewheels/components/FleetAlertsPanel.d.ts +1 -2
  20. package/dist/movethewheels/components/FormError.d.ts +1 -1
  21. package/dist/movethewheels/components/FreeTimeAgreementForm.d.ts +1 -2
  22. package/dist/movethewheels/components/GlassPanel.d.ts +1 -2
  23. package/dist/movethewheels/components/MetricCard.d.ts +3 -4
  24. package/dist/movethewheels/components/Notice.d.ts +1 -1
  25. package/dist/movethewheels/components/OrderItemRow.d.ts +1 -2
  26. package/dist/movethewheels/components/PageLayout.d.ts +5 -6
  27. package/dist/movethewheels/components/ProofOfDeliveryCard.d.ts +1 -1
  28. package/dist/movethewheels/components/ReturnInstructionForm.d.ts +1 -2
  29. package/dist/movethewheels/components/ReuseControls.d.ts +4 -5
  30. package/dist/movethewheels/components/ReusePermissionForm.d.ts +1 -2
  31. package/dist/movethewheels/components/ReuseProposalForm.d.ts +1 -2
  32. package/dist/movethewheels/components/ReuseSourceFields.d.ts +1 -2
  33. package/dist/movethewheels/components/ShippingQuoteResults.d.ts +1 -2
  34. package/dist/movethewheels/components/StatusBadge.d.ts +5 -6
  35. package/dist/movethewheels/components/StockActionDialogs.d.ts +3 -3
  36. package/dist/movethewheels/components/UpcomingDemandPanel.d.ts +1 -2
  37. package/dist/movethewheels/components/VehicleServiceCard.d.ts +1 -2
  38. package/dist/movethewheels/components/charts/ChartShell.d.ts +2 -3
  39. package/dist/movethewheels/components/charts/Sparkline.d.ts +1 -1
  40. package/dist/movethewheels/components/charts/StatusDonut.d.ts +1 -1
  41. package/dist/movethewheels/components/charts/TrendChart.d.ts +1 -1
  42. package/dist/movethewheels/components/charts/VolumeBar.d.ts +1 -1
  43. package/dist/movethewheels/components/consolidation/ConsolidationHistory.d.ts +3 -4
  44. package/dist/movethewheels/components/consolidation/ConsolidationLotEditor.d.ts +1 -2
  45. package/dist/movethewheels/components/consolidation/ConsolidationManifestWorkbench.d.ts +1 -2
  46. package/dist/movethewheels/components/consolidation/ConsolidationPlanForm.d.ts +1 -2
  47. package/dist/movethewheels/components/consolidation/ConsolidationPlanWorkbench.d.ts +1 -2
  48. package/dist/movethewheels/components/consolidation/ConsolidationReportForm.d.ts +1 -2
  49. package/dist/movethewheels/components/consolidation/ConsolidationReportsWorkbench.d.ts +1 -2
  50. package/dist/movethewheels/components/consolidation/ConsolidationSummary.d.ts +1 -2
  51. package/dist/movethewheels/components/consolidation/OriginalConsolidationHistory.d.ts +1 -2
  52. package/dist/movethewheels/components/freight-cost/FreightCommercialEditor.d.ts +8 -0
  53. package/dist/movethewheels/components/freight-cost/FreightCommercialFactEditor.d.ts +8 -0
  54. package/dist/movethewheels/components/freight-cost/FreightCommercialHistory.d.ts +4 -0
  55. package/dist/movethewheels/components/freight-cost/FreightDraftForm.d.ts +5 -4
  56. package/dist/movethewheels/components/freight-cost/FreightFields.d.ts +3 -4
  57. package/dist/movethewheels/components/freight-cost/FreightFxEditor.d.ts +1 -2
  58. package/dist/movethewheels/components/freight-cost/FreightHistory.d.ts +3 -4
  59. package/dist/movethewheels/components/freight-cost/FreightLineEditor.d.ts +1 -2
  60. package/dist/movethewheels/components/freight-cost/FreightScopeEditor.d.ts +1 -2
  61. package/dist/movethewheels/components/freight-cost/FreightTotals.d.ts +1 -2
  62. package/dist/movethewheels/components/logistics-procedure/ProcedureDecisionForm.d.ts +2 -3
  63. package/dist/movethewheels/components/logistics-procedure/ProcedureFields.d.ts +3 -4
  64. package/dist/movethewheels/components/logistics-procedure/ProcedureHistory.d.ts +1 -2
  65. package/dist/movethewheels/components/logistics-procedure/ProcedurePolicyForm.d.ts +1 -2
  66. package/dist/movethewheels/components/logistics-procedure/ProcedurePolicyWorkbench.d.ts +1 -2
  67. package/dist/movethewheels/components/logistics-procedure/ProcedureReviewWorkbench.d.ts +1 -2
  68. package/dist/movethewheels/components/logistics-procedure/ProcedureRunWorkbench.d.ts +1 -2
  69. package/dist/movethewheels/components/logistics-procedure/ProcedureSubjectPicker.d.ts +1 -2
  70. package/dist/movethewheels/components/maps/LogisticsMap.d.ts +1 -2
  71. package/dist/movethewheels/components/maps/MapCanvas.d.ts +1 -2
  72. package/dist/movethewheels/components/maps/RouteMap.d.ts +1 -1
  73. package/dist/movethewheels/components/maps/TrackingMap.d.ts +1 -1
  74. package/dist/movethewheels/components/maps/leaflet-setup.d.ts +0 -1
  75. package/dist/movethewheels/components/pending-pick/PendingPickDraft.d.ts +1 -2
  76. package/dist/movethewheels/components/pending-pick/PendingPickHistory.d.ts +1 -1
  77. package/dist/movethewheels/components/pending-pick/PickCapture.d.ts +1 -2
  78. package/dist/movethewheels/components/pending-pick/PickLineSelection.d.ts +1 -2
  79. package/dist/movethewheels/components/pending-pick/PickReviewPanel.d.ts +1 -2
  80. package/dist/movethewheels/components/stock-binding/StockAssessmentDraft.d.ts +1 -2
  81. package/dist/movethewheels/components/stock-binding/StockAssessmentHistory.d.ts +1 -2
  82. package/dist/movethewheels/components/stock-binding/StockAssessmentSummary.d.ts +1 -2
  83. package/dist/movethewheels/components/stock-binding/StockFactForm.d.ts +1 -2
  84. package/dist/movethewheels/components/stock-observation/StockIssueForm.d.ts +1 -2
  85. package/dist/movethewheels/components/stock-observation/StockIssueHistory.d.ts +1 -2
  86. package/dist/movethewheels/components/stock-observation/StockIssueReadPanel.d.ts +1 -1
  87. package/dist/movethewheels/components/trip-utilization/TripReportForm.d.ts +1 -2
  88. package/dist/movethewheels/components/trip-utilization/TripReportHistory.d.ts +1 -2
  89. package/dist/movethewheels/components/trip-utilization/TripReportSummary.d.ts +1 -2
  90. package/dist/movethewheels/components/trip-utilization/TripSegmentFields.d.ts +1 -2
  91. package/dist/movethewheels/hooks/useAnalytics.d.ts +0 -1
  92. package/dist/movethewheels/hooks/useConsolidationAction.d.ts +0 -1
  93. package/dist/movethewheels/hooks/useContainerCondition.d.ts +0 -1
  94. package/dist/movethewheels/hooks/useContainerLifecycle.d.ts +0 -1
  95. package/dist/movethewheels/hooks/useCustomers.d.ts +0 -1
  96. package/dist/movethewheels/hooks/useEmptyReuseAction.d.ts +0 -1
  97. package/dist/movethewheels/hooks/useEpod.d.ts +0 -1
  98. package/dist/movethewheels/hooks/useFleet.d.ts +0 -1
  99. package/dist/movethewheels/hooks/useFreightRecoveryAction.d.ts +0 -1
  100. package/dist/movethewheels/hooks/useInventory.d.ts +0 -1
  101. package/dist/movethewheels/hooks/useOrders.d.ts +0 -1
  102. package/dist/movethewheels/hooks/useProcedureAction.d.ts +0 -1
  103. package/dist/movethewheels/hooks/useProcedureSelection.d.ts +0 -1
  104. package/dist/movethewheels/hooks/useReuseRecoveryAction.d.ts +0 -1
  105. package/dist/movethewheels/hooks/useRoutes.d.ts +0 -1
  106. package/dist/movethewheels/hooks/useShipmentStatusAuthority.d.ts +0 -1
  107. package/dist/movethewheels/hooks/useTracking.d.ts +0 -1
  108. package/dist/movethewheels/hooks/useTrackingEventQuality.d.ts +0 -1
  109. package/dist/movethewheels/pages/AIAssistantPage.d.ts +1 -1
  110. package/dist/movethewheels/pages/AnalyticsPage.d.ts +1 -1
  111. package/dist/movethewheels/pages/ConsolidationPage.d.ts +1 -1
  112. package/dist/movethewheels/pages/ContainerConditionPage.d.ts +1 -1
  113. package/dist/movethewheels/pages/ContainersPage.d.ts +1 -1
  114. package/dist/movethewheels/pages/CreateOrderPage.d.ts +1 -1
  115. package/dist/movethewheels/pages/CustomerDetailsPage.d.ts +1 -1
  116. package/dist/movethewheels/pages/CustomersPage.d.ts +1 -1
  117. package/dist/movethewheels/pages/DashboardPage.d.ts +1 -1
  118. package/dist/movethewheels/pages/DeliveryCapturePage.d.ts +1 -1
  119. package/dist/movethewheels/pages/DriverDetailsPage.d.ts +1 -1
  120. package/dist/movethewheels/pages/DriversPage.d.ts +1 -1
  121. package/dist/movethewheels/pages/EmptyReusePage.d.ts +1 -1
  122. package/dist/movethewheels/pages/FinancePage.d.ts +1 -1
  123. package/dist/movethewheels/pages/FleetPage.d.ts +1 -1
  124. package/dist/movethewheels/pages/FreeTimePage.d.ts +1 -1
  125. package/dist/movethewheels/pages/FreightEstimatePage.d.ts +1 -1
  126. package/dist/movethewheels/pages/ImportExportPage.d.ts +1 -1
  127. package/dist/movethewheels/pages/InventoryPage.d.ts +1 -1
  128. package/dist/movethewheels/pages/LiveTrackingPage.d.ts +1 -1
  129. package/dist/movethewheels/pages/LogisticsProceduresPage.d.ts +1 -1
  130. package/dist/movethewheels/pages/MarketplacePage.d.ts +1 -1
  131. package/dist/movethewheels/pages/MultiModalShipmentPage.d.ts +1 -1
  132. package/dist/movethewheels/pages/OrderDetailsPage.d.ts +1 -1
  133. package/dist/movethewheels/pages/OrdersListPage.d.ts +1 -1
  134. package/dist/movethewheels/pages/PendingPickPage.d.ts +1 -1
  135. package/dist/movethewheels/pages/ProductDetailsPage.d.ts +1 -1
  136. package/dist/movethewheels/pages/ProductsPage.d.ts +1 -1
  137. package/dist/movethewheels/pages/ReportsPage.d.ts +1 -1
  138. package/dist/movethewheels/pages/RouteDetailsPage.d.ts +1 -1
  139. package/dist/movethewheels/pages/RoutesPage.d.ts +1 -1
  140. package/dist/movethewheels/pages/SettingsPage.d.ts +1 -1
  141. package/dist/movethewheels/pages/ShipmentStatusAuthorityPage.d.ts +1 -1
  142. package/dist/movethewheels/pages/ShippingRatesPage.d.ts +1 -1
  143. package/dist/movethewheels/pages/StockBindingPage.d.ts +1 -1
  144. package/dist/movethewheels/pages/StockObservationsPage.d.ts +1 -1
  145. package/dist/movethewheels/pages/TrackingEventQualityPage.d.ts +1 -1
  146. package/dist/movethewheels/pages/TrackingPage.d.ts +1 -1
  147. package/dist/movethewheels/pages/TripUtilizationPage.d.ts +1 -1
  148. package/dist/movethewheels/pages/VehicleDetailsPage.d.ts +1 -1
  149. package/dist/movethewheels/pages/VehiclesPage.d.ts +1 -1
  150. package/dist/movethewheels/pages/WarehouseDetailsPage.d.ts +1 -1
  151. package/dist/movethewheels/pages/WarehousesPage.d.ts +1 -1
  152. package/dist/movethewheels/providers/MoveTheWheelsProvider.d.ts +0 -1
  153. package/dist/movethewheels/store/movethewheelsStore.d.ts +0 -1
  154. package/dist/movethewheels/types/index.d.ts +0 -1
  155. package/dist/movethewheels/utils/cn.d.ts +0 -1
  156. package/dist/movethewheels/utils/consolidationHistoryTarget.d.ts +0 -1
  157. package/dist/movethewheels/utils/consolidationInput.d.ts +0 -1
  158. package/dist/movethewheels/utils/consolidationLot.d.ts +0 -1
  159. package/dist/movethewheels/utils/consolidationPins.d.ts +0 -1
  160. package/dist/movethewheels/utils/consolidationRecovery.d.ts +0 -1
  161. package/dist/movethewheels/utils/consolidationReportHead.d.ts +0 -1
  162. package/dist/movethewheels/utils/formatters.d.ts +0 -1
  163. package/dist/movethewheels/utils/freightCommercial.d.ts +44 -0
  164. package/dist/movethewheels/utils/freightDraft.d.ts +0 -1
  165. package/dist/movethewheels/utils/freightRecovery.d.ts +0 -1
  166. package/dist/movethewheels/utils/mapMarkers.d.ts +0 -1
  167. package/dist/movethewheels/utils/orderValidation.d.ts +0 -1
  168. package/dist/movethewheels/utils/pendingPickDraft.d.ts +0 -1
  169. package/dist/movethewheels/utils/pickReviewAcknowledgement.d.ts +0 -1
  170. package/dist/movethewheels/utils/procedureInput.d.ts +0 -1
  171. package/dist/movethewheels/utils/procedureRecovery.d.ts +0 -1
  172. package/dist/movethewheels/utils/reuseForm.d.ts +0 -1
  173. package/dist/movethewheels/utils/reuseRecovery.d.ts +0 -1
  174. package/dist/movethewheels/utils/stockBindingForm.d.ts +0 -1
  175. package/dist/movethewheels/utils/stockObservationForm.d.ts +0 -1
  176. package/dist/movethewheels/utils/tripDraftContext.d.ts +0 -1
  177. package/dist/movethewheels/utils/tripUtilizationForm.d.ts +0 -1
  178. package/dist/pages/FreightEstimatePage.js +96 -92
  179. package/dist/services/createSandboxAssistantTransport.d.ts +2 -1
  180. package/dist/src/generated/freight-cost-operations.js +495 -6
  181. package/dist/stories/EntityCombobox.stories.d.ts +1 -2
  182. package/dist/stories/MetricCard.stories.d.ts +0 -1
  183. package/dist/stories/Notice.stories.d.ts +0 -1
  184. package/dist/stories/StatusBadge.stories.d.ts +0 -1
  185. package/dist/utils/freightAcknowledgement.js +6 -5
  186. package/dist/utils/freightCommercial.js +194 -0
  187. package/dist/utils/freightRecovery.js +22 -22
  188. package/package.json +6 -5
  189. package/src/generated/freight-cost-operations.ts +831 -1
  190. package/src/movethewheels/components/freight-cost/FreightCommercialEditor.tsx +236 -0
  191. package/src/movethewheels/components/freight-cost/FreightCommercialFactEditor.tsx +258 -0
  192. package/src/movethewheels/components/freight-cost/FreightCommercialHistory.tsx +90 -0
  193. package/src/movethewheels/components/freight-cost/FreightDraftForm.tsx +33 -4
  194. package/src/movethewheels/components/freight-cost/FreightHistory.tsx +4 -2
  195. package/src/movethewheels/hooks/useFreightRecoveryAction.ts +2 -1
  196. package/src/movethewheels/pages/FreightEstimatePage.tsx +14 -7
  197. package/src/movethewheels/utils/freightAcknowledgement.ts +3 -1
  198. package/src/movethewheels/utils/freightCommercial.ts +388 -0
  199. package/src/movethewheels/utils/freightRecovery.ts +6 -2
  200. package/src/operations/freight-cost/commercial.graphql +483 -0
@@ -0,0 +1,217 @@
1
+ import { Button as e } from "../ui.js";
2
+ import { useConditionQuery as t } from "../../hooks/useContainerCondition.js";
3
+ import { ReuseState as n } from "../ReuseControls.js";
4
+ import { commercialCanonical as r, commercialSlots as i, newCommercialEditor as a } from "../../utils/freightCommercial.js";
5
+ import { FreightCommercialLegsDocument as o } from "../../src/generated/freight-cost-operations.js";
6
+ import { FreightCommercialFactEditor as s } from "./FreightCommercialFactEditor.js";
7
+ import { useState as c } from "react";
8
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
9
+ import { OptionalFields as d } from "@burdenoff/fe-libs/ui";
10
+ //#region src/movethewheels/components/freight-cost/FreightCommercialEditor.tsx
11
+ function f({ value: e, onChange: t, shipmentId: n, evidence: r }) {
12
+ return /* @__PURE__ */ u(d, {
13
+ title: "Commercial context (optional)",
14
+ description: "Source declarations only. Off by default; no quote acceptance or completeness is inferred.",
15
+ defaultOpen: !1,
16
+ children: [/* @__PURE__ */ u("label", {
17
+ className: "flex min-h-11 items-center gap-2",
18
+ children: [/* @__PURE__ */ l("input", {
19
+ type: "checkbox",
20
+ checked: e !== null,
21
+ onChange: (e) => t(e.target.checked ? a() : null)
22
+ }), "Include commercial context"]
23
+ }), e && /* @__PURE__ */ l(p, {
24
+ value: e,
25
+ onChange: t,
26
+ shipmentId: n,
27
+ evidence: r
28
+ })]
29
+ });
30
+ }
31
+ function p({ value: a, onChange: d, shipmentId: f, evidence: p }) {
32
+ let [m, h] = c(0), [g, _] = c(0), v = t(o, {
33
+ shipmentId: f,
34
+ pagination: {
35
+ limit: 25,
36
+ offset: g
37
+ }
38
+ }, m), y = v.data?.shipment?.id === f ? v.data.shipment.legs : void 0, b = !!y && y.every((e) => e.shipmentId === f && !a.selectedLegs.some((t) => t.id === e.id && t.expectedUpdatedAt !== e.updatedAt)), x = (e) => {
39
+ d({
40
+ ...a,
41
+ reviewed: null
42
+ }), _(e);
43
+ };
44
+ return /* @__PURE__ */ u("div", {
45
+ className: "min-w-0 space-y-5",
46
+ children: [
47
+ /* @__PURE__ */ l("p", {
48
+ className: "text-sm",
49
+ children: "All eight facts start Unknown: “Not recorded for this cost version”. Edit that explanation when useful. Sourced and not-applicable declarations require explicit provenance; shipment details are never copied into these facts."
50
+ }),
51
+ /* @__PURE__ */ u("section", {
52
+ className: "space-y-3 rounded border p-3",
53
+ children: [
54
+ /* @__PURE__ */ l("h3", {
55
+ className: "font-semibold",
56
+ children: "Review selected shipment legs"
57
+ }),
58
+ /* @__PURE__ */ l("p", {
59
+ className: "text-sm",
60
+ children: "Select only the legs covered by this source. No selection does not mean all legs. Review the loaded selection explicitly before saving."
61
+ }),
62
+ /* @__PURE__ */ l(n, {
63
+ loading: v.loading,
64
+ error: v.error
65
+ }),
66
+ y?.map((e) => {
67
+ let t = a.selectedLegs.some((t) => t.id === e.id);
68
+ return /* @__PURE__ */ u("label", {
69
+ className: "flex min-h-11 items-center gap-2",
70
+ children: [/* @__PURE__ */ l("input", {
71
+ type: "checkbox",
72
+ checked: t,
73
+ disabled: !t && a.selectedLegs.length >= 16,
74
+ onChange: () => d({
75
+ ...a,
76
+ reviewed: null,
77
+ selectedLegs: t ? a.selectedLegs.filter((t) => t.id !== e.id) : [...a.selectedLegs, {
78
+ id: e.id,
79
+ expectedUpdatedAt: e.updatedAt
80
+ }]
81
+ })
82
+ }), /* @__PURE__ */ u("span", { children: [
83
+ "Leg ",
84
+ e.legNumber,
85
+ " — ",
86
+ e.mode,
87
+ "; carrier ",
88
+ e.carrierName ?? "not recorded",
89
+ "; updated ",
90
+ e.updatedAt
91
+ ] })]
92
+ }, e.id);
93
+ }),
94
+ y?.length === 0 && /* @__PURE__ */ l("p", { children: "No legs on this loaded page." }),
95
+ /* @__PURE__ */ u("p", {
96
+ className: "text-sm",
97
+ children: [
98
+ "Leg page ",
99
+ Math.floor(g / 25) + 1,
100
+ "; at most 25 records per page. Off-page selections keep their original revisions."
101
+ ]
102
+ }),
103
+ /* @__PURE__ */ u("div", {
104
+ className: "flex flex-wrap gap-3",
105
+ children: [/* @__PURE__ */ l(e, {
106
+ type: "button",
107
+ variant: "outline",
108
+ disabled: g === 0 || v.loading,
109
+ onClick: () => x(Math.max(0, g - 25)),
110
+ children: "Previous leg page"
111
+ }), /* @__PURE__ */ l(e, {
112
+ type: "button",
113
+ variant: "outline",
114
+ disabled: v.loading || !!v.error || y?.length !== 25,
115
+ onClick: () => x(g + 25),
116
+ children: "Next leg page"
117
+ })]
118
+ }),
119
+ a.selectedLegs.map((t) => /* @__PURE__ */ u("div", {
120
+ className: "flex flex-wrap items-center gap-2 break-all text-sm",
121
+ children: [/* @__PURE__ */ u("p", { children: [
122
+ "Selected leg ",
123
+ t.id,
124
+ "; pinned revision ",
125
+ t.expectedUpdatedAt,
126
+ "."
127
+ ] }), /* @__PURE__ */ u(e, {
128
+ type: "button",
129
+ variant: "outline",
130
+ onClick: () => d({
131
+ ...a,
132
+ reviewed: null,
133
+ selectedLegs: a.selectedLegs.filter((e) => e.id !== t.id)
134
+ }),
135
+ children: ["Remove selected leg ", t.id]
136
+ })]
137
+ }, t.id)),
138
+ /* @__PURE__ */ u("p", { children: [a.selectedLegs.length, " of 16 legs selected."] }),
139
+ !b && a.selectedLegs.length > 0 && /* @__PURE__ */ l("p", {
140
+ role: "alert",
141
+ children: "A selected leg on this page changed or the page does not match this shipment. Explicitly remove it and review the current selection; no revision is rebound automatically."
142
+ }),
143
+ /* @__PURE__ */ u("div", {
144
+ className: "flex flex-wrap gap-3",
145
+ children: [/* @__PURE__ */ l(e, {
146
+ type: "button",
147
+ variant: "outline",
148
+ onClick: () => {
149
+ d({
150
+ ...a,
151
+ reviewed: null
152
+ }), h((e) => e + 1);
153
+ },
154
+ children: "Refresh legs for review"
155
+ }), /* @__PURE__ */ l(e, {
156
+ type: "button",
157
+ variant: "outline",
158
+ disabled: v.loading || !!v.error || !b,
159
+ onClick: () => d({
160
+ ...a,
161
+ reviewed: r(a.selectedLegs)
162
+ }),
163
+ children: "I reviewed this leg selection"
164
+ })]
165
+ }),
166
+ a.reviewed === r(a.selectedLegs) && b && /* @__PURE__ */ l("p", {
167
+ role: "status",
168
+ children: "This explicit selection of IDs and revisions is reviewed. The server checks every selected leg on save, including off-page pins."
169
+ })
170
+ ]
171
+ }),
172
+ [
173
+ ["origin", "destination"],
174
+ [
175
+ "carrier",
176
+ "service",
177
+ "cargo"
178
+ ],
179
+ [
180
+ "weight",
181
+ "volume",
182
+ "equipment"
183
+ ]
184
+ ].map((e, t) => /* @__PURE__ */ u("section", {
185
+ className: "space-y-3",
186
+ children: [/* @__PURE__ */ l("h3", {
187
+ className: "font-semibold",
188
+ children: [
189
+ "Locations",
190
+ "Carrier, service and cargo",
191
+ "Measurements and equipment"
192
+ ][t]
193
+ }), /* @__PURE__ */ l("div", {
194
+ className: "grid min-w-0 gap-3 md:grid-cols-2",
195
+ children: e.map((e) => /* @__PURE__ */ l(s, {
196
+ slot: e,
197
+ value: a.facts[e],
198
+ evidence: p,
199
+ onChange: (t) => d({
200
+ ...a,
201
+ facts: {
202
+ ...a.facts,
203
+ [e]: t
204
+ }
205
+ })
206
+ }, e))
207
+ })]
208
+ }, e[0])),
209
+ /* @__PURE__ */ u("p", {
210
+ className: "text-sm",
211
+ children: [i.length, " declared facts. Owner shipment and leg snapshots are recorded separately by the server."]
212
+ })
213
+ ]
214
+ });
215
+ }
216
+ //#endregion
217
+ export { f as FreightCommercialEditor };
@@ -0,0 +1,217 @@
1
+ import { Button as e } from "../ui.js";
2
+ import { newCommercialFact as t } from "../../utils/freightCommercial.js";
3
+ import { FreightSelect as n, FreightText as r } from "./FreightFields.js";
4
+ import { freightInstant as i, freightLocalTime as a } from "../../utils/freightDraft.js";
5
+ import { useState as o } from "react";
6
+ import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
7
+ //#region src/movethewheels/components/freight-cost/FreightCommercialFactEditor.tsx
8
+ function u({ slot: i, value: a, onChange: s, evidence: u }) {
9
+ let [p, m] = o(!1), h = i[0].toUpperCase() + i.slice(1), g = (e) => s({
10
+ ...a,
11
+ ...e
12
+ });
13
+ return /* @__PURE__ */ l("fieldset", {
14
+ className: "min-w-0 space-y-3 rounded border p-3",
15
+ children: [
16
+ /* @__PURE__ */ c("legend", {
17
+ className: "px-1 font-semibold",
18
+ children: h
19
+ }),
20
+ /* @__PURE__ */ l(n, {
21
+ label: `${h} status`,
22
+ value: a.status,
23
+ onChange: (e) => {
24
+ (e === "UNKNOWN" || e === "SOURCED" || e === "NOT_APPLICABLE") && (m(!1), s(t(e)));
25
+ },
26
+ children: [
27
+ /* @__PURE__ */ c("option", {
28
+ value: "UNKNOWN",
29
+ children: "Unknown — not recorded"
30
+ }),
31
+ /* @__PURE__ */ c("option", {
32
+ value: "SOURCED",
33
+ children: "Sourced"
34
+ }),
35
+ /* @__PURE__ */ c("option", {
36
+ value: "NOT_APPLICABLE",
37
+ children: "Not applicable"
38
+ })
39
+ ]
40
+ }),
41
+ a.status === "UNKNOWN" && !p && /* @__PURE__ */ l("div", {
42
+ className: "flex flex-wrap items-center gap-2",
43
+ children: [/* @__PURE__ */ c("p", { children: a.reason }), /* @__PURE__ */ l(e, {
44
+ type: "button",
45
+ variant: "outline",
46
+ onClick: () => m(!0),
47
+ children: [
48
+ "Edit ",
49
+ h.toLowerCase(),
50
+ " reason"
51
+ ]
52
+ })]
53
+ }),
54
+ (a.status === "NOT_APPLICABLE" || a.status === "UNKNOWN" && p) && /* @__PURE__ */ c(r, {
55
+ label: `${h} reason`,
56
+ value: a.reason,
57
+ required: !0,
58
+ onChange: (e) => g({ reason: e })
59
+ }),
60
+ a.status === "SOURCED" && /* @__PURE__ */ c(d, {
61
+ slot: i,
62
+ label: h,
63
+ value: a,
64
+ patch: g
65
+ }),
66
+ a.status !== "UNKNOWN" && /* @__PURE__ */ c(f, {
67
+ label: h,
68
+ value: a,
69
+ patch: g,
70
+ evidence: u
71
+ })
72
+ ]
73
+ });
74
+ }
75
+ function d({ slot: e, label: t, value: i, patch: a }) {
76
+ return /* @__PURE__ */ l(s, { children: [
77
+ (e === "origin" || e === "destination") && /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ l(n, {
78
+ label: `${t} label kind`,
79
+ value: i.kind,
80
+ onChange: (e) => a({ kind: e }),
81
+ children: [/* @__PURE__ */ c("option", {
82
+ value: "",
83
+ children: "Choose a label kind"
84
+ }), [
85
+ "ADDRESS_LABEL",
86
+ "PORT_LABEL",
87
+ "TERMINAL_LABEL",
88
+ "POSTCODE_LABEL",
89
+ "CUSTOM_LABEL"
90
+ ].map((e) => /* @__PURE__ */ c("option", {
91
+ value: e,
92
+ children: e.replaceAll("_", " ").toLowerCase()
93
+ }, e))]
94
+ }), /* @__PURE__ */ c(r, {
95
+ label: `${t} jurisdiction label (optional)`,
96
+ value: i.jurisdiction,
97
+ onChange: (e) => a({ jurisdiction: e })
98
+ })] }),
99
+ e === "carrier" && /* @__PURE__ */ c(r, {
100
+ label: "Carrier reference",
101
+ value: i.reference,
102
+ required: !0,
103
+ onChange: (e) => a({ reference: e })
104
+ }),
105
+ e !== "weight" && e !== "volume" && /* @__PURE__ */ c(r, {
106
+ label: e === "cargo" ? "Cargo classification label" : e === "equipment" ? "Equipment type label" : `${t} label`,
107
+ value: i.label,
108
+ required: !0,
109
+ onChange: (e) => a({ label: e })
110
+ }),
111
+ e === "cargo" && /* @__PURE__ */ c(r, {
112
+ label: "Cargo description",
113
+ value: i.description,
114
+ required: !0,
115
+ onChange: (e) => a({ description: e })
116
+ }),
117
+ (e === "weight" || e === "volume") && /* @__PURE__ */ l(s, { children: [
118
+ /* @__PURE__ */ c(r, {
119
+ label: `${t} amount`,
120
+ value: i.amount,
121
+ required: !0,
122
+ onChange: (e) => a({
123
+ amount: e,
124
+ zeroReason: e === "0" ? i.zeroReason : ""
125
+ })
126
+ }),
127
+ /* @__PURE__ */ l(n, {
128
+ label: `${t} recorded unit`,
129
+ value: i.unit,
130
+ onChange: (e) => a({ unit: e }),
131
+ children: [/* @__PURE__ */ c("option", {
132
+ value: "",
133
+ children: "Choose a unit"
134
+ }), (e === "weight" ? [
135
+ "KG",
136
+ "TONNE",
137
+ "LB"
138
+ ] : ["M3", "FT3"]).map((e) => /* @__PURE__ */ c("option", {
139
+ value: e,
140
+ children: e
141
+ }, e))]
142
+ }),
143
+ i.amount === "0" && /* @__PURE__ */ c(r, {
144
+ label: `${t} recorded zero reason`,
145
+ value: i.zeroReason,
146
+ required: !0,
147
+ onChange: (e) => a({ zeroReason: e })
148
+ }),
149
+ /* @__PURE__ */ c("p", {
150
+ className: "text-sm",
151
+ children: "Record the source unit. No conversion is inferred."
152
+ })
153
+ ] }),
154
+ e === "equipment" && /* @__PURE__ */ c(r, {
155
+ label: "Equipment count",
156
+ value: i.count,
157
+ required: !0,
158
+ onChange: (e) => a({ count: e })
159
+ })
160
+ ] });
161
+ }
162
+ function f({ label: e, value: t, patch: n, evidence: o }) {
163
+ return /* @__PURE__ */ l(s, { children: [
164
+ /* @__PURE__ */ l("h4", {
165
+ className: "font-medium",
166
+ children: [e, " source declaration"]
167
+ }),
168
+ /* @__PURE__ */ c(r, {
169
+ label: `${e} source reference`,
170
+ value: t.sourceReference,
171
+ required: !0,
172
+ onChange: (e) => n({ sourceReference: e })
173
+ }),
174
+ /* @__PURE__ */ c(r, {
175
+ label: `${e} source revision`,
176
+ value: t.sourceRevision,
177
+ required: !0,
178
+ onChange: (e) => n({ sourceRevision: e })
179
+ }),
180
+ /* @__PURE__ */ c(r, {
181
+ label: `${e} observed at (local time, optional)`,
182
+ type: "datetime-local",
183
+ value: t.observedAt ? a(t.observedAt) : "",
184
+ onChange: (e) => n({ observedAt: e ? i(e) : "" })
185
+ }),
186
+ /* @__PURE__ */ c("p", {
187
+ className: "text-sm",
188
+ children: "Blank observation time is recorded as Unknown. No date is inferred from the upload or file check."
189
+ }),
190
+ /* @__PURE__ */ c("p", {
191
+ className: "text-sm",
192
+ children: "Choose 1–2 versions from the evidence selected below for this record. This declares the source; it does not verify its authority."
193
+ }),
194
+ o.map((e) => {
195
+ let r = t.evidenceLinks.some((t) => t.fileId === e.fileId && t.versionId === e.versionId);
196
+ return /* @__PURE__ */ l("label", {
197
+ className: "flex min-h-11 items-center gap-2 break-words text-sm",
198
+ children: [/* @__PURE__ */ c("input", {
199
+ type: "checkbox",
200
+ checked: r,
201
+ disabled: !r && t.evidenceLinks.length >= 2,
202
+ onChange: () => n({ evidenceLinks: r ? t.evidenceLinks.filter((t) => !(t.fileId === e.fileId && t.versionId === e.versionId)) : [...t.evidenceLinks, {
203
+ fileId: e.fileId,
204
+ versionId: e.versionId
205
+ }] })
206
+ }), e.label]
207
+ }, e.versionId);
208
+ }),
209
+ !o.length && /* @__PURE__ */ c("p", { children: "Select an exact Files version in Evidence for this record." }),
210
+ t.evidenceLinks.some((e) => !o.some((t) => t.fileId === e.fileId && t.versionId === e.versionId)) && /* @__PURE__ */ c("p", {
211
+ role: "alert",
212
+ children: "A linked evidence version was removed. Select the fact status again and review its source links before saving."
213
+ })
214
+ ] });
215
+ }
216
+ //#endregion
217
+ export { u as FreightCommercialFactEditor };
@@ -0,0 +1,115 @@
1
+ import { commercialSlots as e } from "../../utils/freightCommercial.js";
2
+ import { freightLabel as t } from "../../utils/freightDraft.js";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ //#region src/movethewheels/components/freight-cost/FreightCommercialHistory.tsx
5
+ function i({ capture: i }) {
6
+ return i === void 0 ? /* @__PURE__ */ n("p", {
7
+ role: "alert",
8
+ children: "Commercial context is unavailable in this reply."
9
+ }) : i === null ? /* @__PURE__ */ n("p", { children: "Commercial context was not captured with this version." }) : /* @__PURE__ */ r("section", {
10
+ className: "min-w-0 space-y-4 break-words rounded border p-4",
11
+ children: [
12
+ /* @__PURE__ */ r("h3", {
13
+ className: "font-semibold",
14
+ children: ["Recorded commercial context — schema ", i.schemaVersion]
15
+ }),
16
+ /* @__PURE__ */ n("p", {
17
+ className: "text-sm",
18
+ children: "These are source declarations, not quote acceptance, verified authority or a complete commercial checklist."
19
+ }),
20
+ /* @__PURE__ */ n("div", {
21
+ className: "grid min-w-0 gap-3 md:grid-cols-2",
22
+ children: e.map((e) => {
23
+ let a = i[e];
24
+ return /* @__PURE__ */ r("article", {
25
+ className: "space-y-2 rounded border p-3",
26
+ children: [
27
+ /* @__PURE__ */ r("h4", {
28
+ className: "font-medium",
29
+ children: [
30
+ t(e),
31
+ " — ",
32
+ t(a.status)
33
+ ]
34
+ }),
35
+ a.reason && /* @__PURE__ */ n("p", { children: a.reason }),
36
+ typeof a.value == "string" ? /* @__PURE__ */ n("p", { children: a.value }) : a.value && /* @__PURE__ */ n("dl", { children: Object.entries(a.value).filter(([e]) => e !== "__typename").map(([e, t]) => /* @__PURE__ */ r("div", { children: [/* @__PURE__ */ r("dt", {
37
+ className: "inline font-medium",
38
+ children: [e, ": "]
39
+ }), /* @__PURE__ */ n("dd", {
40
+ className: "inline",
41
+ children: t == null ? "Not recorded" : String(t)
42
+ })] }, e)) }),
43
+ a.provenance && /* @__PURE__ */ r("div", {
44
+ className: "text-sm",
45
+ children: [/* @__PURE__ */ r("p", { children: [
46
+ "Declared source ",
47
+ a.provenance.sourceReference,
48
+ " /",
49
+ " ",
50
+ a.provenance.sourceRevision,
51
+ "; observed",
52
+ " ",
53
+ a.provenance.observedAt ?? "Unknown",
54
+ "."
55
+ ] }), a.provenance.evidenceLinks.map((e) => /* @__PURE__ */ r("p", { children: [
56
+ "Exact Files link: ",
57
+ e.fileId,
58
+ "; version ",
59
+ e.versionId,
60
+ "."
61
+ ] }, JSON.stringify([e.fileId, e.versionId])))]
62
+ })
63
+ ]
64
+ }, e);
65
+ })
66
+ }),
67
+ /* @__PURE__ */ r("section", {
68
+ className: "space-y-2",
69
+ children: [
70
+ /* @__PURE__ */ n("h4", {
71
+ className: "font-medium",
72
+ children: "Server-recorded owner context (separate from declared facts)"
73
+ }),
74
+ /* @__PURE__ */ r("p", { children: [
75
+ "Shipment ",
76
+ i.ownerShipment.shipmentId,
77
+ "; revision at ",
78
+ i.ownerShipment.updatedAt,
79
+ "; mode ",
80
+ i.ownerShipment.primaryMode,
81
+ "."
82
+ ] }),
83
+ i.ownerLegs.length === 0 && /* @__PURE__ */ n("p", { children: "No legs selected for this capture. This does not mean the shipment has no legs." }),
84
+ i.ownerLegs.map((e) => /* @__PURE__ */ r("p", { children: [
85
+ "Leg ",
86
+ e.legNumber,
87
+ " (",
88
+ e.id,
89
+ ") / ",
90
+ e.mode,
91
+ "; revision ",
92
+ e.updatedAt,
93
+ "; carrier",
94
+ " ",
95
+ e.carrierName ?? "Not recorded",
96
+ " (",
97
+ e.carrierId ?? "No carrier reference",
98
+ "); weight",
99
+ " ",
100
+ e.weightKg ?? "Not recorded",
101
+ " kg; volume ",
102
+ e.volumeCbm ?? "Not recorded",
103
+ " m³; equipment ",
104
+ e.containerType ?? "Not recorded",
105
+ " × ",
106
+ e.containerCount ?? "Not recorded",
107
+ "."
108
+ ] }, e.id))
109
+ ]
110
+ })
111
+ ]
112
+ });
113
+ }
114
+ //#endregion
115
+ export { i as FreightCommercialHistory };