@burdenoff/microfe-movethewheels 2026.930.4 → 2026.1010.1

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 (377) hide show
  1. package/dist/MoveTheWheelsRoot.js +177 -102
  2. package/dist/MoveTheWheelsRoutes.js +55 -11
  3. package/dist/_virtual/_rolldown/runtime.js +1 -1
  4. package/dist/components/ContainerEvidencePicker.js +143 -0
  5. package/dist/components/FreeTimeAgreementForm.js +496 -0
  6. package/dist/components/ReturnInstructionForm.js +108 -0
  7. package/dist/components/ReuseControls.js +91 -0
  8. package/dist/components/ReusePermissionForm.js +114 -0
  9. package/dist/components/ReuseProposalForm.js +455 -0
  10. package/dist/components/ReuseSourceFields.js +78 -0
  11. package/dist/components/consolidation/ConsolidationHistory.js +244 -0
  12. package/dist/components/consolidation/ConsolidationLotEditor.js +133 -0
  13. package/dist/components/consolidation/ConsolidationManifestWorkbench.js +143 -0
  14. package/dist/components/consolidation/ConsolidationPlanForm.js +172 -0
  15. package/dist/components/consolidation/ConsolidationPlanWorkbench.js +321 -0
  16. package/dist/components/consolidation/ConsolidationReportForm.js +94 -0
  17. package/dist/components/consolidation/ConsolidationReportsWorkbench.js +195 -0
  18. package/dist/components/consolidation/ConsolidationSummary.js +76 -0
  19. package/dist/components/consolidation/OriginalConsolidationHistory.js +112 -0
  20. package/dist/components/freight-cost/FreightDraftForm.js +213 -0
  21. package/dist/components/freight-cost/FreightFields.js +70 -0
  22. package/dist/components/freight-cost/FreightFxEditor.js +90 -0
  23. package/dist/components/freight-cost/FreightHistory.js +164 -0
  24. package/dist/components/freight-cost/FreightLineEditor.js +191 -0
  25. package/dist/components/freight-cost/FreightScopeEditor.js +72 -0
  26. package/dist/components/freight-cost/FreightTotals.js +66 -0
  27. package/dist/components/logistics-procedure/ProcedureDecisionForm.js +197 -0
  28. package/dist/components/logistics-procedure/ProcedureFields.js +31 -0
  29. package/dist/components/logistics-procedure/ProcedureHistory.js +177 -0
  30. package/dist/components/logistics-procedure/ProcedurePolicyForm.js +227 -0
  31. package/dist/components/logistics-procedure/ProcedurePolicyWorkbench.js +155 -0
  32. package/dist/components/logistics-procedure/ProcedureReviewWorkbench.js +221 -0
  33. package/dist/components/logistics-procedure/ProcedureRunWorkbench.js +190 -0
  34. package/dist/components/logistics-procedure/ProcedureSubjectPicker.js +130 -0
  35. package/dist/components/pending-pick/PendingPickDraft.js +84 -0
  36. package/dist/components/pending-pick/PendingPickHistory.js +113 -0
  37. package/dist/components/pending-pick/PickCapture.js +166 -0
  38. package/dist/components/pending-pick/PickLineSelection.js +111 -0
  39. package/dist/components/stock-binding/StockAssessmentDraft.js +48 -0
  40. package/dist/components/stock-binding/StockAssessmentHistory.js +61 -0
  41. package/dist/components/stock-binding/StockAssessmentSummary.js +199 -0
  42. package/dist/components/stock-binding/StockFactForm.js +232 -0
  43. package/dist/components/stock-observation/StockIssueForm.js +148 -0
  44. package/dist/components/stock-observation/StockIssueHistory.js +116 -0
  45. package/dist/components/stock-observation/StockIssueReadPanel.js +70 -0
  46. package/dist/components/trip-utilization/TripReportForm.js +118 -0
  47. package/dist/components/trip-utilization/TripReportHistory.js +54 -0
  48. package/dist/components/trip-utilization/TripReportSummary.js +216 -0
  49. package/dist/components/trip-utilization/TripSegmentFields.js +166 -0
  50. package/dist/generated/consolidation-operations.d.ts +1060 -0
  51. package/dist/generated/container-condition-operations.d.ts +868 -0
  52. package/dist/generated/container-operations.d.ts +356 -0
  53. package/dist/generated/empty-reuse-operations.d.ts +1578 -0
  54. package/dist/generated/free-time-operations.d.ts +938 -0
  55. package/dist/generated/freight-cost-operations.d.ts +716 -0
  56. package/dist/generated/logistics-procedure-operations.d.ts +938 -0
  57. package/dist/generated/pending-pick-operations.d.ts +1969 -0
  58. package/dist/generated/stock-binding-operations.d.ts +930 -0
  59. package/dist/generated/stock-observation-operations.d.ts +476 -0
  60. package/dist/generated/trip-utilization-operations.d.ts +651 -0
  61. package/dist/generated/wspace-operations.d.ts +143 -50
  62. package/dist/hooks/useConsolidationAction.js +119 -0
  63. package/dist/hooks/useContainerCondition.js +105 -0
  64. package/dist/hooks/useContainerLifecycle.js +192 -0
  65. package/dist/hooks/useEmptyReuseAction.js +45 -0
  66. package/dist/hooks/useFreightRecoveryAction.js +117 -0
  67. package/dist/hooks/useInventory.js +12 -1
  68. package/dist/hooks/useProcedureAction.js +119 -0
  69. package/dist/hooks/useProcedureSelection.js +53 -0
  70. package/dist/hooks/useReuseRecoveryAction.js +116 -0
  71. package/dist/movethewheels/components/ContainerEvidencePicker.d.ts +10 -0
  72. package/dist/movethewheels/components/FreeTimeAgreementForm.d.ts +14 -0
  73. package/dist/movethewheels/components/ReturnInstructionForm.d.ts +8 -0
  74. package/dist/movethewheels/components/ReuseControls.d.ts +42 -0
  75. package/dist/movethewheels/components/ReusePermissionForm.d.ts +9 -0
  76. package/dist/movethewheels/components/ReuseProposalForm.d.ts +11 -0
  77. package/dist/movethewheels/components/ReuseSourceFields.d.ts +9 -0
  78. package/dist/movethewheels/components/consolidation/ConsolidationHistory.d.ts +13 -0
  79. package/dist/movethewheels/components/consolidation/ConsolidationLotEditor.d.ts +6 -0
  80. package/dist/movethewheels/components/consolidation/ConsolidationManifestWorkbench.d.ts +8 -0
  81. package/dist/movethewheels/components/consolidation/ConsolidationPlanForm.d.ts +8 -0
  82. package/dist/movethewheels/components/consolidation/ConsolidationPlanWorkbench.d.ts +5 -0
  83. package/dist/movethewheels/components/consolidation/ConsolidationReportForm.d.ts +9 -0
  84. package/dist/movethewheels/components/consolidation/ConsolidationReportsWorkbench.d.ts +7 -0
  85. package/dist/movethewheels/components/consolidation/ConsolidationSummary.d.ts +6 -0
  86. package/dist/movethewheels/components/consolidation/OriginalConsolidationHistory.d.ts +8 -0
  87. package/dist/movethewheels/components/freight-cost/FreightDraftForm.d.ts +8 -0
  88. package/dist/movethewheels/components/freight-cost/FreightFields.d.ts +23 -0
  89. package/dist/movethewheels/components/freight-cost/FreightFxEditor.d.ts +6 -0
  90. package/dist/movethewheels/components/freight-cost/FreightHistory.d.ts +5 -0
  91. package/dist/movethewheels/components/freight-cost/FreightLineEditor.d.ts +8 -0
  92. package/dist/movethewheels/components/freight-cost/FreightScopeEditor.d.ts +6 -0
  93. package/dist/movethewheels/components/freight-cost/FreightTotals.d.ts +6 -0
  94. package/dist/movethewheels/components/logistics-procedure/ProcedureDecisionForm.d.ts +20 -0
  95. package/dist/movethewheels/components/logistics-procedure/ProcedureFields.d.ts +17 -0
  96. package/dist/movethewheels/components/logistics-procedure/ProcedureHistory.d.ts +7 -0
  97. package/dist/movethewheels/components/logistics-procedure/ProcedurePolicyForm.d.ts +10 -0
  98. package/dist/movethewheels/components/logistics-procedure/ProcedurePolicyWorkbench.d.ts +5 -0
  99. package/dist/movethewheels/components/logistics-procedure/ProcedureReviewWorkbench.d.ts +5 -0
  100. package/dist/movethewheels/components/logistics-procedure/ProcedureRunWorkbench.d.ts +6 -0
  101. package/dist/movethewheels/components/logistics-procedure/ProcedureSubjectPicker.d.ts +7 -0
  102. package/dist/movethewheels/components/pending-pick/PendingPickDraft.d.ts +16 -0
  103. package/dist/movethewheels/components/pending-pick/PendingPickHistory.d.ts +5 -0
  104. package/dist/movethewheels/components/pending-pick/PickCapture.d.ts +6 -0
  105. package/dist/movethewheels/components/pending-pick/PickLineSelection.d.ts +17 -0
  106. package/dist/movethewheels/components/stock-binding/StockAssessmentDraft.d.ts +13 -0
  107. package/dist/movethewheels/components/stock-binding/StockAssessmentHistory.d.ts +18 -0
  108. package/dist/movethewheels/components/stock-binding/StockAssessmentSummary.d.ts +9 -0
  109. package/dist/movethewheels/components/stock-binding/StockFactForm.d.ts +6 -0
  110. package/dist/movethewheels/components/stock-observation/StockIssueForm.d.ts +7 -0
  111. package/dist/movethewheels/components/stock-observation/StockIssueHistory.d.ts +7 -0
  112. package/dist/movethewheels/components/stock-observation/StockIssueReadPanel.d.ts +5 -0
  113. package/dist/movethewheels/components/trip-utilization/TripReportForm.d.ts +6 -0
  114. package/dist/movethewheels/components/trip-utilization/TripReportHistory.d.ts +14 -0
  115. package/dist/movethewheels/components/trip-utilization/TripReportSummary.d.ts +5 -0
  116. package/dist/movethewheels/components/trip-utilization/TripSegmentFields.d.ts +9 -0
  117. package/dist/movethewheels/hooks/useConsolidationAction.d.ts +19 -0
  118. package/dist/movethewheels/hooks/useContainerCondition.d.ts +21 -0
  119. package/dist/movethewheels/hooks/useContainerLifecycle.d.ts +40 -0
  120. package/dist/movethewheels/hooks/useEmptyReuseAction.d.ts +14 -0
  121. package/dist/movethewheels/hooks/useFreightRecoveryAction.d.ts +23 -0
  122. package/dist/movethewheels/hooks/useProcedureAction.d.ts +18 -0
  123. package/dist/movethewheels/hooks/useProcedureSelection.d.ts +51 -0
  124. package/dist/movethewheels/hooks/useReuseRecoveryAction.d.ts +18 -0
  125. package/dist/movethewheels/pages/ConsolidationPage.d.ts +1 -0
  126. package/dist/movethewheels/pages/ContainerConditionPage.d.ts +1 -0
  127. package/dist/movethewheels/pages/ContainersPage.d.ts +2 -0
  128. package/dist/movethewheels/pages/EmptyReusePage.d.ts +1 -0
  129. package/dist/movethewheels/pages/FreeTimePage.d.ts +1 -0
  130. package/dist/movethewheels/pages/FreightEstimatePage.d.ts +1 -0
  131. package/dist/movethewheels/pages/LogisticsProceduresPage.d.ts +1 -0
  132. package/dist/movethewheels/pages/PendingPickPage.d.ts +1 -0
  133. package/dist/movethewheels/pages/StockBindingPage.d.ts +1 -0
  134. package/dist/movethewheels/pages/StockObservationsPage.d.ts +1 -0
  135. package/dist/movethewheels/pages/TripUtilizationPage.d.ts +1 -0
  136. package/dist/movethewheels/utils/consolidationHistoryTarget.d.ts +12 -0
  137. package/dist/movethewheels/utils/consolidationInput.d.ts +15 -0
  138. package/dist/movethewheels/utils/consolidationLot.d.ts +3 -0
  139. package/dist/movethewheels/utils/consolidationPins.d.ts +20 -0
  140. package/dist/movethewheels/utils/consolidationRecovery.d.ts +5 -0
  141. package/dist/movethewheels/utils/consolidationReportHead.d.ts +5 -0
  142. package/dist/movethewheels/utils/freeTimeDate.d.ts +1 -0
  143. package/dist/movethewheels/utils/freightAcknowledgement.d.ts +2 -0
  144. package/dist/movethewheels/utils/freightDraft.d.ts +36 -0
  145. package/dist/movethewheels/utils/freightRecovery.d.ts +5 -0
  146. package/dist/movethewheels/utils/graphqlClient.d.ts +2 -1
  147. package/dist/movethewheels/utils/pendingPickDraft.d.ts +8 -0
  148. package/dist/movethewheels/utils/procedureInput.d.ts +18 -0
  149. package/dist/movethewheels/utils/procedureRecovery.d.ts +5 -0
  150. package/dist/movethewheels/utils/reuseAttempt.d.ts +7 -0
  151. package/dist/movethewheels/utils/reuseForm.d.ts +6 -0
  152. package/dist/movethewheels/utils/reuseRecovery.d.ts +26 -0
  153. package/dist/movethewheels/utils/stockBindingForm.d.ts +23 -0
  154. package/dist/movethewheels/utils/stockBindingLabels.d.ts +10 -0
  155. package/dist/movethewheels/utils/stockObservationForm.d.ts +5 -0
  156. package/dist/movethewheels/utils/tripDraftContext.d.ts +25 -0
  157. package/dist/movethewheels/utils/tripUtilizationForm.d.ts +6 -0
  158. package/dist/node_modules/@react-leaflet/core/lib/component.js +5 -5
  159. package/dist/node_modules/fast-equals/dist/es/index.js +87 -74
  160. package/dist/node_modules/leaflet/dist/leaflet-src.js +8 -5
  161. package/dist/node_modules/lodash/_Stack.js +2 -1
  162. package/dist/node_modules/lucide-react/dist/esm/icons/clipboard-list.js +35 -0
  163. package/dist/node_modules/lucide-react/dist/esm/icons/repeat-2.js +22 -0
  164. package/dist/node_modules/react-leaflet/lib/MapContainer.js +3 -3
  165. package/dist/node_modules/react-smooth/es6/Animate.js +2 -2
  166. package/dist/node_modules/recharts/es6/cartesian/Area.js +13 -13
  167. package/dist/node_modules/recharts/es6/cartesian/Bar.js +9 -9
  168. package/dist/node_modules/recharts/es6/cartesian/Brush.js +12 -12
  169. package/dist/node_modules/recharts/es6/cartesian/CartesianAxis.js +7 -7
  170. package/dist/node_modules/recharts/es6/cartesian/CartesianGrid.js +13 -13
  171. package/dist/node_modules/recharts/es6/cartesian/ErrorBar.js +4 -4
  172. package/dist/node_modules/recharts/es6/cartesian/Line.js +10 -10
  173. package/dist/node_modules/recharts/es6/cartesian/ReferenceArea.js +3 -3
  174. package/dist/node_modules/recharts/es6/cartesian/ReferenceDot.js +3 -3
  175. package/dist/node_modules/recharts/es6/cartesian/ReferenceLine.js +4 -4
  176. package/dist/node_modules/recharts/es6/cartesian/XAxis.js +3 -3
  177. package/dist/node_modules/recharts/es6/cartesian/YAxis.js +3 -3
  178. package/dist/node_modules/recharts/es6/chart/AccessibilityManager.js +1 -1
  179. package/dist/node_modules/recharts/es6/chart/generateCategoricalChart.js +22 -22
  180. package/dist/node_modules/recharts/es6/component/Cursor.js +1 -1
  181. package/dist/node_modules/recharts/es6/component/DefaultLegendContent.js +11 -11
  182. package/dist/node_modules/recharts/es6/component/DefaultTooltipContent.js +6 -6
  183. package/dist/node_modules/recharts/es6/component/Label.js +14 -14
  184. package/dist/node_modules/recharts/es6/component/LabelList.js +6 -6
  185. package/dist/node_modules/recharts/es6/component/Legend.js +5 -5
  186. package/dist/node_modules/recharts/es6/component/ResponsiveContainer.js +3 -3
  187. package/dist/node_modules/recharts/es6/component/Text.js +2 -2
  188. package/dist/node_modules/recharts/es6/component/Tooltip.js +3 -3
  189. package/dist/node_modules/recharts/es6/component/TooltipBoundingBox.js +2 -2
  190. package/dist/node_modules/recharts/es6/container/Layer.js +2 -2
  191. package/dist/node_modules/recharts/es6/container/Surface.js +2 -2
  192. package/dist/node_modules/recharts/es6/context/chartLayoutContext.js +2 -2
  193. package/dist/node_modules/recharts/es6/polar/Pie.js +13 -13
  194. package/dist/node_modules/recharts/es6/polar/PolarAngleAxis.js +8 -8
  195. package/dist/node_modules/recharts/es6/polar/PolarRadiusAxis.js +6 -6
  196. package/dist/node_modules/recharts/es6/shape/Cross.js +1 -1
  197. package/dist/node_modules/recharts/es6/shape/Curve.js +1 -1
  198. package/dist/node_modules/recharts/es6/shape/Dot.js +1 -1
  199. package/dist/node_modules/recharts/es6/shape/Polygon.js +4 -4
  200. package/dist/node_modules/recharts/es6/shape/Rectangle.js +4 -4
  201. package/dist/node_modules/recharts/es6/shape/Sector.js +1 -1
  202. package/dist/node_modules/recharts/es6/shape/Symbols.js +1 -1
  203. package/dist/node_modules/recharts/es6/shape/Trapezoid.js +4 -4
  204. package/dist/node_modules/recharts/es6/util/ActiveShapeUtils.js +9 -9
  205. package/dist/node_modules/recharts/es6/util/BarUtils.js +1 -1
  206. package/dist/node_modules/recharts/es6/util/CartesianUtils.js +1 -1
  207. package/dist/node_modules/recharts/es6/util/PolarUtils.js +1 -1
  208. package/dist/node_modules/recharts/es6/util/ReactUtils.js +2 -2
  209. package/dist/node_modules/recharts/es6/util/ReduceCSSCalc.js +1 -1
  210. package/dist/node_modules/recharts/es6/util/types.js +1 -1
  211. package/dist/node_modules/{react-is → recharts/node_modules/react-is}/cjs/react-is.development.js +2 -2
  212. package/dist/node_modules/{react-is → recharts/node_modules/react-is}/cjs/react-is.production.min.js +2 -2
  213. package/dist/node_modules/{react-is → recharts/node_modules/react-is}/index.js +2 -2
  214. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +97 -18
  215. package/dist/node_modules/zustand/esm/middleware.js +2 -2
  216. package/dist/pages/ConsolidationPage.js +76 -0
  217. package/dist/pages/ContainerConditionPage.js +972 -0
  218. package/dist/pages/ContainersPage.js +522 -0
  219. package/dist/pages/EmptyReusePage.js +777 -0
  220. package/dist/pages/FreeTimePage.js +657 -0
  221. package/dist/pages/FreightEstimatePage.js +284 -0
  222. package/dist/pages/InventoryPage.js +77 -73
  223. package/dist/pages/LogisticsProceduresPage.js +100 -0
  224. package/dist/pages/PendingPickPage.js +155 -0
  225. package/dist/pages/StockBindingPage.js +236 -0
  226. package/dist/pages/StockObservationsPage.js +168 -0
  227. package/dist/pages/TripUtilizationPage.js +227 -0
  228. package/dist/src/generated/consolidation-operations.js +505 -0
  229. package/dist/src/generated/container-condition-operations.js +208 -0
  230. package/dist/src/generated/container-operations.js +101 -0
  231. package/dist/src/generated/empty-reuse-operations.js +749 -0
  232. package/dist/src/generated/free-time-operations.js +235 -0
  233. package/dist/src/generated/freight-cost-operations.js +325 -0
  234. package/dist/src/generated/logistics-procedure-operations.js +362 -0
  235. package/dist/src/generated/pending-pick-operations.js +1128 -0
  236. package/dist/src/generated/stock-binding-operations.js +175 -0
  237. package/dist/src/generated/stock-observation-operations.js +93 -0
  238. package/dist/src/generated/trip-utilization-operations.js +140 -0
  239. package/dist/src/generated/wspace-operations.js +708 -0
  240. package/dist/utils/consolidationHistoryTarget.js +27 -0
  241. package/dist/utils/consolidationInput.js +21 -0
  242. package/dist/utils/consolidationLot.js +29 -0
  243. package/dist/utils/consolidationPins.js +13 -0
  244. package/dist/utils/consolidationRecovery.js +40 -0
  245. package/dist/utils/consolidationReportHead.js +18 -0
  246. package/dist/utils/freeTimeDate.js +26 -0
  247. package/dist/utils/freightAcknowledgement.js +8 -0
  248. package/dist/utils/freightDraft.js +125 -0
  249. package/dist/utils/freightRecovery.js +36 -0
  250. package/dist/utils/graphqlClient.js +28 -28
  251. package/dist/utils/pendingPickDraft.js +46 -0
  252. package/dist/utils/procedureInput.js +43 -0
  253. package/dist/utils/procedureRecovery.js +42 -0
  254. package/dist/utils/reuseAttempt.js +20 -0
  255. package/dist/utils/reuseForm.js +25 -0
  256. package/dist/utils/reuseRecovery.js +71 -0
  257. package/dist/utils/stockBindingForm.js +142 -0
  258. package/dist/utils/stockBindingLabels.js +23 -0
  259. package/dist/utils/stockObservationForm.js +55 -0
  260. package/dist/utils/tripDraftContext.js +19 -0
  261. package/dist/utils/tripUtilizationForm.js +60 -0
  262. package/package.json +19 -5
  263. package/src/generated/consolidation-operations.ts +1138 -0
  264. package/src/generated/container-condition-operations.ts +771 -0
  265. package/src/generated/container-operations.ts +376 -0
  266. package/src/generated/empty-reuse-operations.ts +1648 -0
  267. package/src/generated/free-time-operations.ts +814 -0
  268. package/src/generated/freight-cost-operations.ts +753 -0
  269. package/src/generated/logistics-procedure-operations.ts +1047 -0
  270. package/src/generated/pending-pick-operations.ts +1508 -0
  271. package/src/generated/stock-binding-operations.ts +631 -0
  272. package/src/generated/stock-observation-operations.ts +373 -0
  273. package/src/generated/trip-utilization-operations.ts +500 -0
  274. package/src/generated/wspace-operations.ts +116 -0
  275. package/src/movethewheels/MoveTheWheelsRoot.tsx +79 -0
  276. package/src/movethewheels/MoveTheWheelsRoutes.tsx +22 -0
  277. package/src/movethewheels/components/ContainerEvidencePicker.tsx +146 -0
  278. package/src/movethewheels/components/FreeTimeAgreementForm.tsx +483 -0
  279. package/src/movethewheels/components/ReturnInstructionForm.tsx +102 -0
  280. package/src/movethewheels/components/ReuseControls.tsx +138 -0
  281. package/src/movethewheels/components/ReusePermissionForm.tsx +123 -0
  282. package/src/movethewheels/components/ReuseProposalForm.tsx +484 -0
  283. package/src/movethewheels/components/ReuseSourceFields.tsx +80 -0
  284. package/src/movethewheels/components/consolidation/ConsolidationHistory.tsx +159 -0
  285. package/src/movethewheels/components/consolidation/ConsolidationLotEditor.tsx +144 -0
  286. package/src/movethewheels/components/consolidation/ConsolidationManifestWorkbench.tsx +168 -0
  287. package/src/movethewheels/components/consolidation/ConsolidationPlanForm.tsx +185 -0
  288. package/src/movethewheels/components/consolidation/ConsolidationPlanWorkbench.tsx +395 -0
  289. package/src/movethewheels/components/consolidation/ConsolidationReportForm.tsx +124 -0
  290. package/src/movethewheels/components/consolidation/ConsolidationReportsWorkbench.tsx +233 -0
  291. package/src/movethewheels/components/consolidation/ConsolidationSummary.tsx +84 -0
  292. package/src/movethewheels/components/consolidation/OriginalConsolidationHistory.tsx +133 -0
  293. package/src/movethewheels/components/freight-cost/FreightDraftForm.tsx +224 -0
  294. package/src/movethewheels/components/freight-cost/FreightFields.tsx +91 -0
  295. package/src/movethewheels/components/freight-cost/FreightFxEditor.tsx +98 -0
  296. package/src/movethewheels/components/freight-cost/FreightHistory.tsx +91 -0
  297. package/src/movethewheels/components/freight-cost/FreightLineEditor.tsx +192 -0
  298. package/src/movethewheels/components/freight-cost/FreightScopeEditor.tsx +64 -0
  299. package/src/movethewheels/components/freight-cost/FreightTotals.tsx +68 -0
  300. package/src/movethewheels/components/logistics-procedure/ProcedureDecisionForm.tsx +204 -0
  301. package/src/movethewheels/components/logistics-procedure/ProcedureFields.tsx +43 -0
  302. package/src/movethewheels/components/logistics-procedure/ProcedureHistory.tsx +102 -0
  303. package/src/movethewheels/components/logistics-procedure/ProcedurePolicyForm.tsx +226 -0
  304. package/src/movethewheels/components/logistics-procedure/ProcedurePolicyWorkbench.tsx +174 -0
  305. package/src/movethewheels/components/logistics-procedure/ProcedureReviewWorkbench.tsx +278 -0
  306. package/src/movethewheels/components/logistics-procedure/ProcedureRunWorkbench.tsx +292 -0
  307. package/src/movethewheels/components/logistics-procedure/ProcedureSubjectPicker.tsx +111 -0
  308. package/src/movethewheels/components/pending-pick/PendingPickDraft.tsx +82 -0
  309. package/src/movethewheels/components/pending-pick/PendingPickHistory.tsx +93 -0
  310. package/src/movethewheels/components/pending-pick/PickCapture.tsx +70 -0
  311. package/src/movethewheels/components/pending-pick/PickLineSelection.tsx +130 -0
  312. package/src/movethewheels/components/stock-binding/StockAssessmentDraft.tsx +52 -0
  313. package/src/movethewheels/components/stock-binding/StockAssessmentHistory.tsx +56 -0
  314. package/src/movethewheels/components/stock-binding/StockAssessmentSummary.tsx +108 -0
  315. package/src/movethewheels/components/stock-binding/StockFactForm.tsx +186 -0
  316. package/src/movethewheels/components/stock-observation/StockIssueForm.tsx +103 -0
  317. package/src/movethewheels/components/stock-observation/StockIssueHistory.tsx +96 -0
  318. package/src/movethewheels/components/stock-observation/StockIssueReadPanel.tsx +72 -0
  319. package/src/movethewheels/components/trip-utilization/TripReportForm.tsx +116 -0
  320. package/src/movethewheels/components/trip-utilization/TripReportHistory.tsx +51 -0
  321. package/src/movethewheels/components/trip-utilization/TripReportSummary.tsx +127 -0
  322. package/src/movethewheels/components/trip-utilization/TripSegmentFields.tsx +118 -0
  323. package/src/movethewheels/hooks/useConsolidationAction.ts +196 -0
  324. package/src/movethewheels/hooks/useContainerCondition.ts +129 -0
  325. package/src/movethewheels/hooks/useContainerLifecycle.ts +291 -0
  326. package/src/movethewheels/hooks/useEmptyReuseAction.ts +72 -0
  327. package/src/movethewheels/hooks/useFreightRecoveryAction.ts +201 -0
  328. package/src/movethewheels/hooks/useInventory.ts +2 -20
  329. package/src/movethewheels/hooks/useProcedureAction.ts +196 -0
  330. package/src/movethewheels/hooks/useProcedureSelection.ts +75 -0
  331. package/src/movethewheels/hooks/useReuseRecoveryAction.ts +192 -0
  332. package/src/movethewheels/pages/ConsolidationPage.tsx +70 -0
  333. package/src/movethewheels/pages/ContainerConditionPage.tsx +959 -0
  334. package/src/movethewheels/pages/ContainersPage.tsx +490 -0
  335. package/src/movethewheels/pages/EmptyReusePage.tsx +823 -0
  336. package/src/movethewheels/pages/FreeTimePage.tsx +720 -0
  337. package/src/movethewheels/pages/FreightEstimatePage.tsx +353 -0
  338. package/src/movethewheels/pages/InventoryPage.tsx +16 -2
  339. package/src/movethewheels/pages/LogisticsProceduresPage.tsx +86 -0
  340. package/src/movethewheels/pages/PendingPickPage.tsx +226 -0
  341. package/src/movethewheels/pages/StockBindingPage.tsx +299 -0
  342. package/src/movethewheels/pages/StockObservationsPage.tsx +181 -0
  343. package/src/movethewheels/pages/TripUtilizationPage.tsx +315 -0
  344. package/src/movethewheels/utils/consolidationHistoryTarget.ts +39 -0
  345. package/src/movethewheels/utils/consolidationInput.ts +70 -0
  346. package/src/movethewheels/utils/consolidationLot.ts +24 -0
  347. package/src/movethewheels/utils/consolidationPins.ts +52 -0
  348. package/src/movethewheels/utils/consolidationRecovery.ts +88 -0
  349. package/src/movethewheels/utils/consolidationReportHead.ts +29 -0
  350. package/src/movethewheels/utils/freeTimeDate.ts +31 -0
  351. package/src/movethewheels/utils/freightAcknowledgement.ts +31 -0
  352. package/src/movethewheels/utils/freightDraft.ts +170 -0
  353. package/src/movethewheels/utils/freightRecovery.ts +79 -0
  354. package/src/movethewheels/utils/graphqlClient.ts +14 -5
  355. package/src/movethewheels/utils/pendingPickDraft.ts +61 -0
  356. package/src/movethewheels/utils/procedureInput.ts +98 -0
  357. package/src/movethewheels/utils/procedureRecovery.ts +92 -0
  358. package/src/movethewheels/utils/reuseAttempt.ts +29 -0
  359. package/src/movethewheels/utils/reuseForm.ts +30 -0
  360. package/src/movethewheels/utils/reuseRecovery.ts +151 -0
  361. package/src/movethewheels/utils/stockBindingForm.ts +209 -0
  362. package/src/movethewheels/utils/stockBindingLabels.ts +41 -0
  363. package/src/movethewheels/utils/stockObservationForm.ts +73 -0
  364. package/src/movethewheels/utils/tripDraftContext.ts +61 -0
  365. package/src/movethewheels/utils/tripUtilizationForm.ts +105 -0
  366. package/src/operations/condition/container-condition.graphql +41 -0
  367. package/src/operations/consolidation/consolidation.graphql +490 -0
  368. package/src/operations/container/container-lifecycle.graphql +80 -0
  369. package/src/operations/empty-reuse/empty-reuse.graphql +737 -0
  370. package/src/operations/free-time/free-time.graphql +47 -0
  371. package/src/operations/freight-cost/freight.graphql +6 -0
  372. package/src/operations/logistics-procedure/procedure.graphql +15 -0
  373. package/src/operations/pending-pick/pending-pick.graphql +1122 -0
  374. package/src/operations/stock-binding/stock-binding.graphql +160 -0
  375. package/src/operations/stock-observation/stock-observation.graphql +20 -0
  376. package/src/operations/trip-utilization/trip-utilization.graphql +126 -0
  377. package/src/operations/wspace/container-evidence.graphql +6 -0
@@ -0,0 +1,159 @@
1
+ import type {
2
+ ConsolidationObservationsQuery,
3
+ ConsolidationManifestQuery,
4
+ ConsolidationPlanQuery,
5
+ } from '../../../generated/consolidation-operations';
6
+ import { ProcedureTime as Time } from '../logistics-procedure/ProcedureFields';
7
+ import { ConsolidationSummary } from './ConsolidationSummary';
8
+ export function ConsolidationPlanHistory({
9
+ plan,
10
+ }: {
11
+ plan: ConsolidationPlanQuery['mtwConsolidationPlan'];
12
+ }) {
13
+ return (
14
+ <section className="space-y-3 rounded-lg border p-4">
15
+ <h3>
16
+ {plan.planReference} · version {plan.version} · {plan.facts.hubName}
17
+ </h3>
18
+ <p>
19
+ Effective <Time value={plan.facts.effectiveAt} /> · recorded{' '}
20
+ <Time value={plan.recordedAt} />
21
+ </p>
22
+ <p>
23
+ Captured shipment {plan.sourceCapture.shipmentNumber}; booking{' '}
24
+ {plan.sourceCapture.bookingReference ?? 'Unknown'}
25
+ </p>
26
+ {plan.facts.lots.map((lot) => (
27
+ <article key={lot.id} className="break-words border-t pt-2">
28
+ <h4>
29
+ {lot.supplierReference} · {lot.lotReference} · {lot.consignmentReference}
30
+ </h4>
31
+ <p>
32
+ Planned {lot.plannedQuantity ?? 'Unknown'} / available{' '}
33
+ {lot.reportedAvailableQuantity ?? 'Unknown'} {lot.unitReference ?? '(unit unknown)'}
34
+ </p>
35
+ <p>
36
+ Basis: {lot.quantityBasis.toLowerCase().replaceAll('_', ' ')}; unit revision{' '}
37
+ {lot.unitRevision ?? 'Unknown'}; balance revision {lot.balanceRevision ?? 'Unknown'}
38
+ </p>
39
+ <p>
40
+ Source {lot.source.reference ?? 'Unknown'} / {lot.source.revision ?? 'Unknown'}
41
+ </p>
42
+ </article>
43
+ ))}
44
+ <details>
45
+ <summary>Captured source and audit references</summary>
46
+ <p className="break-all">
47
+ {plan.id}; predecessor {plan.previousVersionId ?? 'None'}
48
+ </p>
49
+ <p>
50
+ Hub source {plan.facts.hubSource.reference ?? 'Unknown'} /{' '}
51
+ {plan.facts.hubSource.revision ?? 'Unknown'}
52
+ </p>
53
+ <p>
54
+ Context source {plan.facts.contextSource.reference ?? 'Unknown'} /{' '}
55
+ {plan.facts.contextSource.revision ?? 'Unknown'}
56
+ </p>
57
+ <p>
58
+ Mode {plan.facts.mode ?? 'Unknown'}; carrier {plan.facts.carrierReference ?? 'Unknown'};
59
+ declared booking {plan.facts.bookingReference ?? 'Unknown'}
60
+ </p>
61
+ <p>
62
+ Cutoff <Time value={plan.facts.cutoffAt} />; timezone {plan.facts.timezone ?? 'Unknown'};
63
+ jurisdiction {plan.facts.jurisdictionReference ?? 'Unknown'}
64
+ </p>
65
+ <p>
66
+ Recorded by {plan.createdBy} · {plan.actorProvenance}; on behalf of{' '}
67
+ {plan.onBehalfOf ?? 'Not supplied'}
68
+ </p>
69
+ {plan.evidence.map((row) => (
70
+ <p className="break-all" key={JSON.stringify([row.fileId, row.versionId])}>
71
+ {row.fileId} / {row.versionId} · checked <Time value={row.checkedAt} />
72
+ </p>
73
+ ))}
74
+ </details>
75
+ </section>
76
+ );
77
+ }
78
+ export function ConsolidationReportHistory({
79
+ rows,
80
+ labels,
81
+ }: {
82
+ rows: ConsolidationObservationsQuery['mtwConsolidationObservationPage']['items'];
83
+ labels: Record<string, string>;
84
+ }) {
85
+ return (
86
+ <section className="space-y-3">
87
+ <h3 className="font-semibold">Append-only report history</h3>
88
+ {rows.map((row) => (
89
+ <article key={row.id} className="min-w-0 space-y-1 rounded-lg border p-3">
90
+ <h4>
91
+ {labels[row.lotId] ?? 'Captured lot'} ·{' '}
92
+ {row.kind === 'ISSUE'
93
+ ? 'Unresolved reported issue'
94
+ : row.kind === 'RECEIPT_REPORT'
95
+ ? 'Receipt total'
96
+ : 'Stuffing total'}{' '}
97
+ · version {row.version}
98
+ </h4>
99
+ <p>
100
+ {row.kind === 'ISSUE'
101
+ ? row.issueReference
102
+ : (row.reportedQuantity ?? 'Unknown quantity')}{' '}
103
+ {row.unitReference ?? '(unit unknown)'}
104
+ </p>
105
+ <p className="break-words">{row.reason}</p>
106
+ <p>
107
+ Observed <Time value={row.reportedObservedAt} /> · recorded{' '}
108
+ <Time value={row.recordedAt} /> · receipt sequence {row.receiptSequence}
109
+ </p>
110
+ <details>
111
+ <summary>Source and original attribution</summary>
112
+ <p>
113
+ {row.source.reference ?? 'Unknown'} / {row.source.revision ?? 'Unknown'}
114
+ </p>
115
+ <p className="break-all">
116
+ {row.id}; predecessor {row.previousVersionId ?? 'None'}; recorded by {row.createdBy} ·{' '}
117
+ {row.actorProvenance}; on behalf of {row.onBehalfOf ?? 'Not supplied'}
118
+ </p>
119
+ {row.evidence.map((e) => (
120
+ <p className="break-all" key={JSON.stringify([e.fileId, e.versionId])}>
121
+ Checked evidence {e.fileId} / {e.versionId}
122
+ </p>
123
+ ))}
124
+ {row.evidenceDeclarations.map((e) => (
125
+ <p className="break-all" key={JSON.stringify([e.fileId, e.versionId])}>
126
+ Unverified declaration {e.fileId} / {e.versionId}
127
+ </p>
128
+ ))}
129
+ </details>
130
+ </article>
131
+ ))}
132
+ </section>
133
+ );
134
+ }
135
+ export function ConsolidationManifestHistory({
136
+ manifest,
137
+ labels,
138
+ }: {
139
+ manifest: ConsolidationManifestQuery['mtwConsolidationManifest'];
140
+ labels: Record<string, string>;
141
+ }) {
142
+ return (
143
+ <section className="space-y-3 rounded-lg border p-4">
144
+ <h3>Immutable manifest record · version {manifest.version}</h3>
145
+ <p>
146
+ Recorded <Time value={manifest.recordedAt} /> · by {manifest.createdBy} ·{' '}
147
+ {manifest.actorProvenance}
148
+ </p>
149
+ <ConsolidationSummary snapshot={manifest.snapshot} labels={labels} />
150
+ <details>
151
+ <summary>Exact historical references</summary>
152
+ <p className="break-all">
153
+ {manifest.id}; predecessor {manifest.previousVersionId ?? 'None'}; plan {manifest.planId};
154
+ recorded on behalf of {manifest.onBehalfOf ?? 'Not supplied'}
155
+ </p>
156
+ </details>
157
+ </section>
158
+ );
159
+ }
@@ -0,0 +1,144 @@
1
+ import type { MtwConsolidationLotInput } from '../../../generated/consolidation-operations';
2
+ import {
3
+ ProcedureField as Field,
4
+ ProcedureGroup as Group,
5
+ } from '../logistics-procedure/ProcedureFields';
6
+ import { reuseSelect } from '../ReuseControls';
7
+ export function ConsolidationLotEditor({
8
+ lot,
9
+ onChange,
10
+ }: {
11
+ lot: MtwConsolidationLotInput;
12
+ onChange: (lot: MtwConsolidationLotInput) => void;
13
+ }) {
14
+ const set = (key: keyof MtwConsolidationLotInput, value: string) =>
15
+ onChange({ ...lot, [key]: value || null });
16
+ return (
17
+ <Group title="Supplier lot">
18
+ <div className="grid gap-3 sm:grid-cols-2">
19
+ {(
20
+ ['supplierReference', 'lotReference', 'consignmentReference', 'sourceRevision'] as const
21
+ ).map((key) => (
22
+ <Field
23
+ key={key}
24
+ label={
25
+ {
26
+ supplierReference: 'Supplier reference',
27
+ lotReference: 'Lot reference',
28
+ consignmentReference: 'Consignment reference',
29
+ sourceRevision: 'Lot source revision',
30
+ }[key]
31
+ }
32
+ value={lot[key]}
33
+ onChange={(value) => set(key, value)}
34
+ />
35
+ ))}
36
+ </div>
37
+ <label className="block">
38
+ Quantity basis
39
+ <select
40
+ className={reuseSelect}
41
+ value={lot.quantityBasis}
42
+ onChange={(event) =>
43
+ onChange({
44
+ ...lot,
45
+ quantityBasis:
46
+ event.target.value === 'SOURCE_DECLARATION'
47
+ ? 'SOURCE_DECLARATION'
48
+ : event.target.value === 'HUB_REPORT'
49
+ ? 'HUB_REPORT'
50
+ : 'UNKNOWN',
51
+ })
52
+ }
53
+ >
54
+ <option value="UNKNOWN">Unknown</option>
55
+ <option value="SOURCE_DECLARATION">Supplier declaration</option>
56
+ <option value="HUB_REPORT">Reported at hub</option>
57
+ </select>
58
+ </label>
59
+ <p>
60
+ Blank quantities are unknown. Zero means an explicitly reported zero. No unit conversion is
61
+ inferred.
62
+ </p>
63
+ <div className="grid gap-3 sm:grid-cols-2">
64
+ {(
65
+ [
66
+ 'unitReference',
67
+ 'unitRevision',
68
+ 'balanceRevision',
69
+ 'plannedQuantity',
70
+ 'reportedAvailableQuantity',
71
+ ] as const
72
+ ).map((key) => (
73
+ <Field
74
+ key={key}
75
+ required={false}
76
+ label={
77
+ {
78
+ unitReference: 'Reported count unit',
79
+ unitRevision: 'Unit source revision',
80
+ balanceRevision: 'Balance source revision',
81
+ plannedQuantity: 'Planned quantity',
82
+ reportedAvailableQuantity: 'Reported available quantity',
83
+ }[key]
84
+ }
85
+ value={lot[key] ?? ''}
86
+ onChange={(value) => set(key, value)}
87
+ />
88
+ ))}
89
+ </div>
90
+ <div className="grid gap-3 sm:grid-cols-2">
91
+ <Field
92
+ required={false}
93
+ label="Quantity source reference"
94
+ value={lot.source.reference ?? ''}
95
+ onChange={(value) =>
96
+ onChange({ ...lot, source: { ...lot.source, reference: value || null } })
97
+ }
98
+ />
99
+ <Field
100
+ required={false}
101
+ label="Quantity source revision"
102
+ value={lot.source.revision ?? ''}
103
+ onChange={(value) =>
104
+ onChange({ ...lot, source: { ...lot.source, revision: value || null } })
105
+ }
106
+ />
107
+ </div>
108
+ <details>
109
+ <summary>Mass, volume and transport context</summary>
110
+ <div className="grid gap-3 sm:grid-cols-2">
111
+ {(
112
+ [
113
+ 'grossKg',
114
+ 'cubeM3',
115
+ 'originReference',
116
+ 'destinationReference',
117
+ 'importerReference',
118
+ 'transportReference',
119
+ 'documentReference',
120
+ ] as const
121
+ ).map((key) => (
122
+ <Field
123
+ key={key}
124
+ required={false}
125
+ label={
126
+ {
127
+ grossKg: 'Reported gross mass (kg)',
128
+ cubeM3: 'Reported volume (m³)',
129
+ originReference: 'Origin reference',
130
+ destinationReference: 'Destination reference',
131
+ importerReference: 'Importer reference',
132
+ transportReference: 'Transport reference',
133
+ documentReference: 'Document reference',
134
+ }[key]
135
+ }
136
+ value={lot[key] ?? ''}
137
+ onChange={(value) => set(key, value)}
138
+ />
139
+ ))}
140
+ </div>
141
+ </details>
142
+ </Group>
143
+ );
144
+ }
@@ -0,0 +1,168 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+ import {
3
+ ConsolidationObservationsDocument,
4
+ ConsolidationPreviewDocument,
5
+ ConsolidationManifestsDocument,
6
+ ConsolidationManifestDocument,
7
+ SaveConsolidationManifestDocument,
8
+ type ConsolidationObservationsQuery,
9
+ type ConsolidationPreviewQuery,
10
+ type ConsolidationManifestsQuery,
11
+ type ConsolidationManifestQuery,
12
+ type ConsolidationPlanQuery,
13
+ } from '../../../generated/consolidation-operations';
14
+ import { useConditionApi, useConditionQuery } from '../../hooks/useContainerCondition';
15
+ import type { useConsolidationAction } from '../../hooks/useConsolidationAction';
16
+ import { assertConsolidationPredecessor } from '../../utils/consolidationPins';
17
+ import { ConsolidationSummary } from './ConsolidationSummary';
18
+ import { ConsolidationManifestHistory } from './ConsolidationHistory';
19
+ import { Button } from '../ui';
20
+ import { ReusePager, ReuseState, reuseCard } from '../ReuseControls';
21
+ export function ConsolidationManifestWorkbench({
22
+ plan,
23
+ actions,
24
+ labels,
25
+ }: {
26
+ plan: ConsolidationPlanQuery['mtwConsolidationPlan'];
27
+ actions: ReturnType<typeof useConsolidationAction>;
28
+ labels: Record<string, string>;
29
+ }) {
30
+ const request = useConditionApi(),
31
+ active = useRef(true);
32
+ useEffect(() => {
33
+ active.current = true;
34
+ return () => {
35
+ active.current = false;
36
+ };
37
+ }, []);
38
+ const [preview, setPreview] = useState<{
39
+ snapshot: ConsolidationPreviewQuery['previewMtwConsolidationManifest'];
40
+ previous: { id: string; version: number } | null;
41
+ } | null>(null),
42
+ [checking, setChecking] = useState(false),
43
+ [error, setError] = useState<string | null>(null),
44
+ [offset, setOffset] = useState(0),
45
+ [selected, setSelected] = useState('');
46
+ const history = useConditionQuery<ConsolidationManifestsQuery>(
47
+ ConsolidationManifestsDocument,
48
+ { planId: plan.id, pagination: { limit: 10, offset } },
49
+ actions.revision
50
+ ),
51
+ exact = useConditionQuery<ConsolidationManifestQuery>(
52
+ ConsolidationManifestDocument,
53
+ selected ? { planId: plan.id, id: selected } : null,
54
+ actions.revision
55
+ ),
56
+ paused = checking || actions.busy || actions.uncertain;
57
+ const current = async () => {
58
+ const [observations, manifests] = await Promise.all([
59
+ request<ConsolidationObservationsQuery>(ConsolidationObservationsDocument, {
60
+ planId: plan.id,
61
+ pagination: { limit: 1, offset: 0 },
62
+ }),
63
+ request<ConsolidationManifestsQuery>(ConsolidationManifestsDocument, {
64
+ planId: plan.id,
65
+ pagination: { limit: 1, offset: 0 },
66
+ }),
67
+ ]);
68
+ return {
69
+ sequence: observations.mtwConsolidationObservationPage.items[0]?.receiptSequence ?? 0,
70
+ previous: manifests.mtwConsolidationManifestPage.items[0] ?? null,
71
+ };
72
+ };
73
+ const review = async () => {
74
+ if (paused) return;
75
+ setChecking(true);
76
+ setError(null);
77
+ try {
78
+ const pins = await current();
79
+ const result = await request<ConsolidationPreviewQuery>(ConsolidationPreviewDocument, {
80
+ planId: plan.id,
81
+ expectedObservationSequence: pins.sequence,
82
+ });
83
+ if (active.current)
84
+ setPreview({ snapshot: result.previewMtwConsolidationManifest, previous: pins.previous });
85
+ } catch (f) {
86
+ setError(f instanceof Error ? f.message : 'Unable to preview.');
87
+ } finally {
88
+ setChecking(false);
89
+ }
90
+ };
91
+ const save = async () => {
92
+ if (!preview || paused) return;
93
+ setChecking(true);
94
+ setError(null);
95
+ try {
96
+ const pins = await current();
97
+ if (!active.current) throw new Error('Context changed. Nothing was sent.');
98
+ if (pins.sequence !== preview.snapshot.observationSequence)
99
+ throw new Error('New reports were received. Review a fresh preview before recording.');
100
+ assertConsolidationPredecessor(preview.previous, pins.previous);
101
+ const result = await actions.run(
102
+ SaveConsolidationManifestDocument,
103
+ {
104
+ planId: plan.id,
105
+ expectedObservationSequence: preview.snapshot.observationSequence,
106
+ expectedPreviousVersionId: preview.previous?.id ?? null,
107
+ expectedVersion: preview.previous?.version ?? 0,
108
+ },
109
+ 'Immutable manifest record saved.'
110
+ );
111
+ if (result) {
112
+ setPreview(null);
113
+ setOffset(0);
114
+ }
115
+ } catch (f) {
116
+ setError(f instanceof Error ? f.message : 'Unable to record manifest.');
117
+ } finally {
118
+ setChecking(false);
119
+ }
120
+ };
121
+ return (
122
+ <section className={reuseCard}>
123
+ <h2 className="text-lg font-semibold">Review and record a manifest</h2>
124
+ <p>
125
+ Each record captures the reported quantities at one receipt sequence. Historical records
126
+ retain their original reports and time; later corrections do not rewrite them.
127
+ </p>
128
+ <Button disabled={paused} variant="outline" onClick={() => void review()}>
129
+ Load current reconciliation preview
130
+ </Button>
131
+ {preview && (
132
+ <>
133
+ <ConsolidationSummary snapshot={preview.snapshot} labels={labels} />
134
+ <Button disabled={paused} onClick={() => void save()}>
135
+ Record this manifest snapshot
136
+ </Button>
137
+ </>
138
+ )}
139
+ {error && <p role="alert">{error}</p>}
140
+ <ReuseState loading={history.loading} error={history.error} />
141
+ <div className="flex flex-wrap gap-2">
142
+ {history.data?.mtwConsolidationManifestPage.items.map((row) => (
143
+ <Button
144
+ key={row.id}
145
+ disabled={paused}
146
+ variant="outline"
147
+ onClick={() => setSelected(row.id)}
148
+ >
149
+ Version {row.version} · receipt sequence {row.observationSequence}
150
+ </Button>
151
+ ))}
152
+ </div>
153
+ <ReusePager
154
+ offset={offset}
155
+ page={history.data?.mtwConsolidationManifestPage}
156
+ busy={paused}
157
+ onChange={setOffset}
158
+ />
159
+ <ReuseState loading={exact.loading} error={exact.error} />
160
+ {exact.data && (
161
+ <ConsolidationManifestHistory
162
+ manifest={exact.data.mtwConsolidationManifest}
163
+ labels={labels}
164
+ />
165
+ )}
166
+ </section>
167
+ );
168
+ }
@@ -0,0 +1,185 @@
1
+ import { useState } from 'react';
2
+ import type {
3
+ SaveMtwConsolidationPlanInput,
4
+ MtwConsolidationLotInput,
5
+ } from '../../../generated/consolidation-operations';
6
+ import { ContainerEvidencePicker, type SelectedEvidence } from '../ContainerEvidencePicker';
7
+ import {
8
+ ProcedureField as Field,
9
+ ProcedureGroup as Group,
10
+ } from '../logistics-procedure/ProcedureFields';
11
+ import {
12
+ consolidationInstant,
13
+ consolidationQuantity,
14
+ nullableText,
15
+ } from '../../utils/consolidationInput';
16
+ import { ConsolidationLotEditor } from './ConsolidationLotEditor';
17
+ import { emptyConsolidationLot } from '../../utils/consolidationLot';
18
+ import { Button } from '../ui';
19
+ export type ConsolidationPlanPin = Omit<
20
+ SaveMtwConsolidationPlanInput,
21
+ 'facts' | 'evidence' | 'idempotencyKey'
22
+ >;
23
+ export function ConsolidationPlanForm({
24
+ pin,
25
+ busy,
26
+ onSave,
27
+ }: {
28
+ pin: ConsolidationPlanPin;
29
+ busy: boolean;
30
+ onSave: (input: Omit<SaveMtwConsolidationPlanInput, 'idempotencyKey'>) => Promise<void>;
31
+ }) {
32
+ const [hubName, setHubName] = useState(''),
33
+ [hubReference, setHubReference] = useState(''),
34
+ [hubSource, setHubSource] = useState(''),
35
+ [hubRevision, setHubRevision] = useState(''),
36
+ [effective, setEffective] = useState(''),
37
+ [lots, setLots] = useState<MtwConsolidationLotInput[]>(() => [emptyConsolidationLot()]),
38
+ [evidence, setEvidence] = useState<SelectedEvidence[]>([]),
39
+ [error, setError] = useState<string | null>(null);
40
+ const [context, setContext] = useState({
41
+ mode: '',
42
+ carrierReference: '',
43
+ bookingReference: '',
44
+ cutoffAt: '',
45
+ timezone: '',
46
+ jurisdictionReference: '',
47
+ reference: '',
48
+ revision: '',
49
+ });
50
+ return (
51
+ <form
52
+ className="space-y-4"
53
+ onSubmit={(event) => {
54
+ event.preventDefault();
55
+ if (busy) return;
56
+ setError(null);
57
+ void (async () => {
58
+ if (evidence.length < 1 || evidence.length > 10)
59
+ throw new Error('Choose one to ten exact evidence versions.');
60
+ const normalized = lots.map((lot) => ({
61
+ ...lot,
62
+ plannedQuantity: consolidationQuantity(lot.plannedQuantity ?? ''),
63
+ reportedAvailableQuantity: consolidationQuantity(lot.reportedAvailableQuantity ?? ''),
64
+ grossKg: consolidationQuantity(lot.grossKg ?? ''),
65
+ cubeM3: consolidationQuantity(lot.cubeM3 ?? ''),
66
+ }));
67
+ await onSave({
68
+ ...pin,
69
+ facts: {
70
+ hubName: hubName.trim(),
71
+ hubReference: hubReference.trim(),
72
+ hubSource: {
73
+ reference: nullableText(hubSource),
74
+ revision: nullableText(hubRevision),
75
+ },
76
+ effectiveAt: consolidationInstant(effective),
77
+ lots: normalized,
78
+ mode: nullableText(context.mode),
79
+ carrierReference: nullableText(context.carrierReference),
80
+ bookingReference: nullableText(context.bookingReference),
81
+ cutoffAt: context.cutoffAt ? consolidationInstant(context.cutoffAt) : null,
82
+ timezone: nullableText(context.timezone),
83
+ jurisdictionReference: nullableText(context.jurisdictionReference),
84
+ contextSource: {
85
+ reference: nullableText(context.reference),
86
+ revision: nullableText(context.revision),
87
+ },
88
+ },
89
+ evidence: evidence.map(({ fileId, versionId }) => ({ fileId, versionId })),
90
+ });
91
+ })().catch((f) => setError(f instanceof Error ? f.message : 'Unable to record plan.'));
92
+ }}
93
+ >
94
+ <fieldset disabled={busy} className="space-y-4">
95
+ <Group title="One named hub">
96
+ <Field label="Hub name" value={hubName} onChange={setHubName} />
97
+ <Field label="Hub reference" value={hubReference} onChange={setHubReference} />
98
+ <Field label="Hub source reference" value={hubSource} onChange={setHubSource} />
99
+ <Field label="Hub source revision" value={hubRevision} onChange={setHubRevision} />
100
+ <Field
101
+ label="Effective from (local time)"
102
+ type="datetime-local"
103
+ value={effective}
104
+ onChange={setEffective}
105
+ />
106
+ <p>Times are saved as UTC. A future plan does not make its reports effective now.</p>
107
+ </Group>
108
+ <p>
109
+ A new plan version starts separate receipt and stuffing histories. Earlier reports remain
110
+ attached to their original plan.
111
+ </p>
112
+ {lots.map((lot, index) => (
113
+ <section key={lot.id} className="space-y-2">
114
+ <ConsolidationLotEditor
115
+ lot={lot}
116
+ onChange={(value) =>
117
+ setLots((rows) => rows.map((row, i) => (i === index ? value : row)))
118
+ }
119
+ />
120
+ <Button
121
+ type="button"
122
+ variant="outline"
123
+ disabled={lots.length === 1}
124
+ onClick={() => setLots((rows) => rows.filter((_, i) => i !== index))}
125
+ >
126
+ Remove lot {index + 1}
127
+ </Button>
128
+ </section>
129
+ ))}
130
+ <Button
131
+ type="button"
132
+ variant="outline"
133
+ disabled={lots.length >= 20}
134
+ onClick={() => setLots((rows) => [...rows, emptyConsolidationLot()])}
135
+ >
136
+ Add supplier lot ({lots.length}/20)
137
+ </Button>
138
+ <details>
139
+ <summary>Lane, cutoff and document context</summary>
140
+ <Group title="Declared context">
141
+ {(
142
+ [
143
+ 'mode',
144
+ 'carrierReference',
145
+ 'bookingReference',
146
+ 'cutoffAt',
147
+ 'timezone',
148
+ 'jurisdictionReference',
149
+ 'reference',
150
+ 'revision',
151
+ ] as const
152
+ ).map((key) => (
153
+ <Field
154
+ key={key}
155
+ required={false}
156
+ label={
157
+ {
158
+ mode: 'Transport mode',
159
+ carrierReference: 'Carrier reference',
160
+ bookingReference: 'Booking reference',
161
+ cutoffAt: 'Cutoff (local time)',
162
+ timezone: 'Reported timezone',
163
+ jurisdictionReference: 'Jurisdiction reference',
164
+ reference: 'Context source reference',
165
+ revision: 'Context source revision',
166
+ }[key]
167
+ }
168
+ type={key === 'cutoffAt' ? 'datetime-local' : 'text'}
169
+ value={context[key]}
170
+ onChange={(value) => setContext((row) => ({ ...row, [key]: value }))}
171
+ />
172
+ ))}
173
+ </Group>
174
+ </details>
175
+ <ContainerEvidencePicker
176
+ value={evidence}
177
+ onChange={setEvidence}
178
+ description="Choose exact readable Files versions supporting these declarations. This does not verify physical stock or approvals."
179
+ />
180
+ {error && <p role="alert">{error}</p>}
181
+ <Button type="submit">Record plan version</Button>
182
+ </fieldset>
183
+ </form>
184
+ );
185
+ }