@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,483 @@
1
+ import { freeTimeIso } from '../utils/freeTimeDate';
2
+ import { useState } from 'react';
3
+ import type {
4
+ MtwFreeTimeAgreementInput,
5
+ FreeAgreementFieldsFragment,
6
+ } from '../../generated/free-time-operations';
7
+ import { ContainerEvidencePicker, type SelectedEvidence } from './ContainerEvidencePicker';
8
+ import { Button, Input } from './ui';
9
+
10
+ export interface FreeTimeEventOption {
11
+ id: string;
12
+ eventType: string;
13
+ kind: string;
14
+ occurredAt: string;
15
+ }
16
+ const field = 'block space-y-1 text-sm';
17
+ const select = 'w-full rounded-md border bg-bg-surface p-2';
18
+ export function FreeTimeAgreementForm({
19
+ events,
20
+ initial,
21
+ onSubmit,
22
+ busy,
23
+ }: {
24
+ events: FreeTimeEventOption[];
25
+ initial?: FreeAgreementFieldsFragment;
26
+ onSubmit: (input: MtwFreeTimeAgreementInput) => Promise<void>;
27
+ busy: boolean;
28
+ }) {
29
+ const [evidence, setEvidence] = useState<SelectedEvidence[]>([]);
30
+ const [pricing, setPricing] = useState(Boolean(initial?.terms));
31
+ const [rates, setRates] = useState(
32
+ initial?.terms?.rateTiers.map((rate) => ({
33
+ from: String(rate.fromDay),
34
+ through: rate.throughDay == null ? '' : String(rate.throughDay),
35
+ amount: String(rate.dailyMinorUnits),
36
+ })) ?? [{ from: '1', through: '', amount: '' }]
37
+ );
38
+ const [error, setError] = useState<string | null>(null);
39
+ const [triggerType, setTriggerType] = useState(
40
+ initial?.triggerEventType ?? 'AVAILABLE_FOR_PICKUP'
41
+ );
42
+ const [stopType, setStopType] = useState(initial?.stopEventType ?? 'GATE_OUT');
43
+ const [triggerEventId, setTriggerEventId] = useState(initial?.triggerEventId ?? '');
44
+ const [stopEventId, setStopEventId] = useState(initial?.stopEventId ?? '');
45
+ const holidays = (value: string) =>
46
+ value
47
+ .split(/\r?\n/)
48
+ .map((line) => line.trim())
49
+ .filter(Boolean);
50
+ return (
51
+ <form
52
+ className="space-y-4"
53
+ onSubmit={async (event) => {
54
+ event.preventDefault();
55
+ setError(null);
56
+ try {
57
+ if (!evidence.length) throw new Error('Select exact source evidence versions.');
58
+ const values = new FormData(event.currentTarget);
59
+ const text = (name: string) => String(values.get(name) ?? '').trim();
60
+ const weekdays = (name: string) =>
61
+ text(name)
62
+ .split(',')
63
+ .map((value) => Number(value.trim()));
64
+ const terms = pricing
65
+ ? {
66
+ timeZone: text('timeZone'),
67
+ freeDays: Number(text('freeDays')),
68
+ includeTriggerDate: values.get('includeTrigger') === 'on',
69
+ freeCalendar: {
70
+ weekdays: weekdays('freeWeekdays'),
71
+ excludedDates: holidays(text('freeHolidays')),
72
+ },
73
+ chargeCalendar: {
74
+ weekdays: weekdays('chargeWeekdays'),
75
+ excludedDates: holidays(text('chargeHolidays')),
76
+ },
77
+ currency: text('currency'),
78
+ minorUnitDigits: Number(text('minorDigits')),
79
+ rateTiers: rates.map((rate) => ({
80
+ fromDay: Number(rate.from),
81
+ throughDay: rate.through ? Number(rate.through) : null,
82
+ dailyMinorUnits: Number(rate.amount),
83
+ })),
84
+ calculationPolicy:
85
+ text('calculationPolicy') === 'LOCAL_DATE_END'
86
+ ? ('LOCAL_DATE_END' as const)
87
+ : ('UNSUPPORTED' as const),
88
+ partialDayPolicy:
89
+ text('partialDayPolicy') === 'ANY_STARTED_LOCAL_DATE'
90
+ ? ('ANY_STARTED_LOCAL_DATE' as const)
91
+ : ('UNSUPPORTED' as const),
92
+ tierBasis:
93
+ text('tierBasis') === 'CHARGED_DAYS'
94
+ ? ('CHARGED_DAYS' as const)
95
+ : ('UNSUPPORTED' as const),
96
+ }
97
+ : null;
98
+ await onSubmit({
99
+ payer: text('payer'),
100
+ payee: text('payee'),
101
+ sourceReference: text('source'),
102
+ effectiveAt: freeTimeIso(text('effectiveAt')),
103
+ applicability:
104
+ text('applicability') === 'WHOLE_CLOCK' ? 'WHOLE_CLOCK' : 'UNSUPPORTED_SEGMENTED',
105
+ triggerEventType: triggerType,
106
+ stopEventType: stopType,
107
+ triggerEventId: text('triggerEvent') || null,
108
+ stopEventId: text('stopEvent') || null,
109
+ confirmedFreeUntil: text('confirmedDeadline')
110
+ ? freeTimeIso(text('confirmedDeadline'))
111
+ : null,
112
+ terms,
113
+ changeReason: text('changeReason'),
114
+ evidence: evidence.map(({ fileId, versionId }) => ({ fileId, versionId })),
115
+ });
116
+ } catch (failure) {
117
+ setError(failure instanceof Error ? failure.message : 'Unable to record agreement.');
118
+ }
119
+ }}
120
+ >
121
+ <p className="text-sm">
122
+ Each version is a full sourced replacement. Previous versions remain in history. Prices are
123
+ estimates, not payable invoice determinations.
124
+ </p>
125
+ <div className="grid gap-3 md:grid-cols-2">
126
+ <label className={field}>
127
+ Obligated party
128
+ <Input name="payer" required maxLength={255} defaultValue={initial?.payer} />
129
+ </label>
130
+ <label className={field}>
131
+ Payee
132
+ <Input name="payee" required maxLength={255} defaultValue={initial?.payee} />
133
+ </label>
134
+ <label className={field}>
135
+ Agreement source reference
136
+ <Input name="source" required maxLength={255} defaultValue={initial?.sourceReference} />
137
+ </label>
138
+ <label className={field}>
139
+ Agreement effective time with timezone
140
+ <Input
141
+ name="effectiveAt"
142
+ required
143
+ placeholder="2026-10-04T09:00:00+05:30"
144
+ defaultValue={initial?.effectiveAt}
145
+ />
146
+ </label>
147
+ <label className={field}>
148
+ Agreement applicability
149
+ <select
150
+ name="applicability"
151
+ className={select}
152
+ required
153
+ defaultValue={initial?.applicability ?? ''}
154
+ >
155
+ <option value="">Choose recorded applicability</option>
156
+ <option value="WHOLE_CLOCK">Applies to the whole clock</option>
157
+ <option value="UNSUPPORTED_SEGMENTED">
158
+ Prospective segmented amendment — cannot estimate
159
+ </option>
160
+ </select>
161
+ </label>
162
+ <label className={field}>
163
+ Externally confirmed deadline with timezone
164
+ <Input
165
+ name="confirmedDeadline"
166
+ placeholder="Leave empty if unconfirmed"
167
+ defaultValue={initial?.confirmedFreeUntil ?? ''}
168
+ />
169
+ </label>
170
+ <label className={field}>
171
+ Contractual trigger
172
+ <select
173
+ className={select}
174
+ value={triggerType}
175
+ onChange={(event) => {
176
+ const option = (
177
+ ['AVAILABLE_FOR_PICKUP', 'DISCHARGED', 'GATE_OUT', 'GATE_IN'] as const
178
+ ).find((type) => type === event.target.value);
179
+ if (option) {
180
+ setTriggerType(option);
181
+ setTriggerEventId('');
182
+ }
183
+ }}
184
+ >
185
+ <option>AVAILABLE_FOR_PICKUP</option>
186
+ <option>DISCHARGED</option>
187
+ <option>GATE_OUT</option>
188
+ <option>GATE_IN</option>
189
+ </select>
190
+ </label>
191
+ <label className={field}>
192
+ Contractual stop
193
+ <select
194
+ className={select}
195
+ value={stopType}
196
+ onChange={(event) => {
197
+ const option = (
198
+ [
199
+ 'GATE_OUT',
200
+ 'GATE_IN',
201
+ 'LOADED',
202
+ 'DELIVERED',
203
+ 'EMPTY_RETURNED',
204
+ 'RETURN_ACCEPTED',
205
+ ] as const
206
+ ).find((type) => type === event.target.value);
207
+ if (option) {
208
+ setStopType(option);
209
+ setStopEventId('');
210
+ }
211
+ }}
212
+ >
213
+ <option>GATE_OUT</option>
214
+ <option>GATE_IN</option>
215
+ <option>LOADED</option>
216
+ <option>DELIVERED</option>
217
+ <option>EMPTY_RETURNED</option>
218
+ <option>RETURN_ACCEPTED</option>
219
+ </select>
220
+ </label>
221
+ <label className={field}>
222
+ Actual trigger observation
223
+ <select
224
+ name="triggerEvent"
225
+ className={select}
226
+ value={triggerEventId}
227
+ onChange={(event) => setTriggerEventId(event.target.value)}
228
+ >
229
+ <option value="">Missing — exposure stays unknown</option>
230
+ {triggerEventId && !events.some((event) => event.id === triggerEventId) && (
231
+ <option value={triggerEventId}>
232
+ Selected actual observation — not on this event page
233
+ </option>
234
+ )}
235
+ {events
236
+ .filter((event) => event.kind === 'ACTUAL' && event.eventType === triggerType)
237
+ .map((event) => (
238
+ <option key={event.id} value={event.id}>
239
+ {event.eventType} — {event.occurredAt}
240
+ </option>
241
+ ))}
242
+ </select>
243
+ </label>
244
+ <label className={field}>
245
+ Actual stop observation
246
+ <select
247
+ name="stopEvent"
248
+ className={select}
249
+ value={stopEventId}
250
+ onChange={(event) => setStopEventId(event.target.value)}
251
+ >
252
+ <option value="">No actual stop recorded</option>
253
+ {stopEventId && !events.some((event) => event.id === stopEventId) && (
254
+ <option value={stopEventId}>
255
+ Selected actual observation — not on this event page
256
+ </option>
257
+ )}
258
+ {events
259
+ .filter((event) => event.kind === 'ACTUAL' && event.eventType === stopType)
260
+ .map((event) => (
261
+ <option key={event.id} value={event.id}>
262
+ {event.eventType} — {event.occurredAt}
263
+ </option>
264
+ ))}
265
+ </select>
266
+ </label>
267
+ </div>
268
+ <p className="text-sm">
269
+ Availability is a separate sourced observation. Requested return, actual return and accepted
270
+ return are distinct; select the boundary in the contract.
271
+ </p>
272
+ <label className="flex items-center gap-2">
273
+ <input
274
+ type="checkbox"
275
+ checked={pricing}
276
+ onChange={(event) => setPricing(event.target.checked)}
277
+ />
278
+ Complete pricing terms available
279
+ </label>
280
+ {pricing && (
281
+ <fieldset className="space-y-3 rounded-lg border p-4">
282
+ <legend>Recorded pricing conventions</legend>
283
+ <div className="grid gap-3 md:grid-cols-2">
284
+ <label className={field}>
285
+ Named IANA timezone
286
+ <Input
287
+ name="timeZone"
288
+ required
289
+ defaultValue={initial?.terms?.timeZone}
290
+ placeholder="Asia/Kolkata"
291
+ />
292
+ </label>
293
+ <label className={field}>
294
+ Free days
295
+ <Input
296
+ name="freeDays"
297
+ type="number"
298
+ required
299
+ min={0}
300
+ max={365}
301
+ defaultValue={initial?.terms?.freeDays}
302
+ />
303
+ </label>
304
+ <label className={field}>
305
+ Currency code
306
+ <Input
307
+ name="currency"
308
+ required
309
+ pattern="[A-Z]{3}"
310
+ defaultValue={initial?.terms?.currency}
311
+ placeholder="INR"
312
+ />
313
+ </label>
314
+ <label className={field}>
315
+ Currency minor-unit digits
316
+ <Input
317
+ name="minorDigits"
318
+ type="number"
319
+ required
320
+ min={0}
321
+ max={4}
322
+ defaultValue={initial?.terms?.minorUnitDigits}
323
+ />
324
+ </label>
325
+ <label className={field}>
326
+ Free-day weekdays (Monday=1…Sunday=7)
327
+ <Input
328
+ name="freeWeekdays"
329
+ required
330
+ defaultValue={initial?.terms?.freeCalendar.weekdays.join(',')}
331
+ placeholder="1,2,3,4,5"
332
+ />
333
+ </label>
334
+ <label className={field}>
335
+ Charged-day weekdays
336
+ <Input
337
+ name="chargeWeekdays"
338
+ required
339
+ defaultValue={initial?.terms?.chargeCalendar.weekdays.join(',')}
340
+ placeholder="1,2,3,4,5,6,7"
341
+ />
342
+ </label>
343
+ <label className={field}>
344
+ Excluded free dates, one YYYY-MM-DD per line
345
+ <textarea
346
+ className={select}
347
+ name="freeHolidays"
348
+ defaultValue={initial?.terms?.freeCalendar.excludedDates.join('\n')}
349
+ />
350
+ </label>
351
+ <label className={field}>
352
+ Excluded charge dates, one per line
353
+ <textarea
354
+ className={select}
355
+ name="chargeHolidays"
356
+ defaultValue={initial?.terms?.chargeCalendar.excludedDates.join('\n')}
357
+ />
358
+ </label>
359
+ <label className={field}>
360
+ Free-time counting
361
+ <select
362
+ className={select}
363
+ name="calculationPolicy"
364
+ required
365
+ defaultValue={initial?.terms?.calculationPolicy ?? ''}
366
+ >
367
+ <option value="">Choose sourced policy</option>
368
+ <option value="LOCAL_DATE_END">End of eligible local date</option>
369
+ <option value="UNSUPPORTED">
370
+ Other / pooled / rolling 24-hour — cannot estimate
371
+ </option>
372
+ </select>
373
+ </label>
374
+ <label className={field}>
375
+ Partial-day charging
376
+ <select
377
+ className={select}
378
+ name="partialDayPolicy"
379
+ required
380
+ defaultValue={initial?.terms?.partialDayPolicy ?? ''}
381
+ >
382
+ <option value="">Choose sourced rounding</option>
383
+ <option value="ANY_STARTED_LOCAL_DATE">Any started eligible local date</option>
384
+ <option value="UNSUPPORTED">Other — cannot estimate</option>
385
+ </select>
386
+ </label>
387
+ <label className={field}>
388
+ Rate-tier basis
389
+ <select
390
+ className={select}
391
+ name="tierBasis"
392
+ required
393
+ defaultValue={initial?.terms?.tierBasis ?? ''}
394
+ >
395
+ <option value="">Choose sourced basis</option>
396
+ <option value="CHARGED_DAYS">Charged-day ordinal</option>
397
+ <option value="UNSUPPORTED">Elapsed / other — cannot estimate</option>
398
+ </select>
399
+ </label>
400
+ <label className="flex items-center gap-2">
401
+ <input
402
+ type="checkbox"
403
+ name="includeTrigger"
404
+ defaultChecked={initial?.terms?.includeTriggerDate}
405
+ />
406
+ Count trigger date when eligible
407
+ </label>
408
+ </div>
409
+ {rates.map((rate, index) => (
410
+ <div key={index} className="grid gap-3 rounded-md border p-3 md:grid-cols-3">
411
+ {(['from', 'through', 'amount'] as const).map((name) => (
412
+ <label key={name} className={field}>
413
+ {name === 'from'
414
+ ? 'From charged day'
415
+ : name === 'through'
416
+ ? 'Through charged day (blank = unbounded)'
417
+ : 'Daily price in integer minor units'}
418
+ <Input
419
+ type="number"
420
+ min={name === 'amount' ? 0 : 1}
421
+ max={name === 'amount' ? 1000000000 : undefined}
422
+ required={name !== 'through'}
423
+ value={rate[name]}
424
+ onChange={(event) =>
425
+ setRates((current) =>
426
+ current.map((item, position) =>
427
+ position === index ? { ...item, [name]: event.target.value } : item
428
+ )
429
+ )
430
+ }
431
+ />
432
+ </label>
433
+ ))}
434
+ </div>
435
+ ))}
436
+ <div className="flex flex-wrap gap-2">
437
+ <Button
438
+ type="button"
439
+ variant="outline"
440
+ disabled={rates.length >= 20}
441
+ onClick={() =>
442
+ setRates((current) => [...current, { from: '', through: '', amount: '' }])
443
+ }
444
+ >
445
+ Add rate tier
446
+ </Button>
447
+ <Button
448
+ type="button"
449
+ variant="outline"
450
+ disabled={rates.length === 1}
451
+ onClick={() => setRates((current) => current.slice(0, -1))}
452
+ >
453
+ Remove last tier
454
+ </Button>
455
+ </div>
456
+ <p className="text-sm">
457
+ Tiers start at day 1, are contiguous and end unbounded. Holidays must come from the
458
+ source; no country calendar is inferred.
459
+ </p>
460
+ </fieldset>
461
+ )}
462
+ <label className={field}>
463
+ Change reason and whole-clock applicability
464
+ <textarea
465
+ name="changeReason"
466
+ className={select}
467
+ required
468
+ maxLength={2000}
469
+ defaultValue={initial ? '' : undefined}
470
+ />
471
+ </label>
472
+ <ContainerEvidencePicker
473
+ description="Choose exact source versions. Integrity does not independently establish contractual terms or counterparty acceptance."
474
+ value={evidence}
475
+ onChange={setEvidence}
476
+ />
477
+ {error && <p role="alert">{error}</p>}
478
+ <Button type="submit" disabled={busy}>
479
+ {initial ? 'Record agreement correction' : 'Open sourced clock'}
480
+ </Button>
481
+ </form>
482
+ );
483
+ }
@@ -0,0 +1,102 @@
1
+ import { reuseText } from '../utils/reuseForm';
2
+ import { useState } from 'react';
3
+ import type {
4
+ RecordMtwEmptyReturnInstructionInput,
5
+ ReturnInstructionFieldsFragment,
6
+ } from '../../generated/empty-reuse-operations';
7
+ import { ContainerEvidencePicker, type SelectedEvidence } from './ContainerEvidencePicker';
8
+ import { ReuseField } from './ReuseControls';
9
+ import { freeTimeIso } from '../utils/freeTimeDate';
10
+ import { Button } from './ui';
11
+ export type ReturnInstructionDraft = Omit<
12
+ RecordMtwEmptyReturnInstructionInput,
13
+ 'idempotencyKey' | 'expectedCycleVersion' | 'cycleId' | 'currentInstructionId'
14
+ >;
15
+ export function ReturnInstructionForm({
16
+ current,
17
+ busy,
18
+ onSubmit,
19
+ }: {
20
+ current?: ReturnInstructionFieldsFragment;
21
+ busy: boolean;
22
+ onSubmit: (input: ReturnInstructionDraft) => Promise<unknown>;
23
+ }) {
24
+ const [evidence, setEvidence] = useState<SelectedEvidence[]>([]);
25
+ const [error, setError] = useState<string | null>(null);
26
+ return (
27
+ <form
28
+ className="space-y-4"
29
+ onSubmit={async (event) => {
30
+ event.preventDefault();
31
+ setError(null);
32
+ try {
33
+ const values = new FormData(event.currentTarget);
34
+ if (!evidence.length)
35
+ throw new Error('Select exact sourced return-instruction evidence.');
36
+ await onSubmit({
37
+ ownerReference: reuseText(values, 'ownerReference'),
38
+ bookingReference: reuseText(values, 'bookingReference'),
39
+ depotReference: reuseText(values, 'depotReference'),
40
+ locationReference: reuseText(values, 'locationReference'),
41
+ returnFrom: freeTimeIso(reuseText(values, 'returnFrom')),
42
+ returnUntil: freeTimeIso(reuseText(values, 'returnUntil')),
43
+ effectiveAt: freeTimeIso(reuseText(values, 'effectiveAt')),
44
+ sourceReference: reuseText(values, 'sourceReference'),
45
+ changeReason: reuseText(values, 'changeReason'),
46
+ evidence: evidence.map(({ fileId, versionId }) => ({ fileId, versionId })),
47
+ });
48
+ } catch (failure) {
49
+ setError(failure instanceof Error ? failure.message : 'Invalid instruction.');
50
+ }
51
+ }}
52
+ >
53
+ <fieldset disabled={busy} className="space-y-4">
54
+ <p>
55
+ {current
56
+ ? `Amending current instruction v${current.version}; retains the old immutable record.`
57
+ : 'Record initial owner/carrier return instruction.'}
58
+ </p>
59
+ <div className="grid gap-3 md:grid-cols-2">
60
+ <ReuseField
61
+ label="Equipment owner reference"
62
+ name="ownerReference"
63
+ value={current?.ownerReference}
64
+ />
65
+ <ReuseField
66
+ label="Import booking reference"
67
+ name="bookingReference"
68
+ value={current?.bookingReference}
69
+ />
70
+ <ReuseField
71
+ label="Return depot reference"
72
+ name="depotReference"
73
+ value={current?.depotReference}
74
+ />
75
+ <ReuseField
76
+ label="Return location reference"
77
+ name="locationReference"
78
+ value={current?.locationReference}
79
+ />
80
+ <ReuseField
81
+ label="Return window from (ISO with timezone)"
82
+ name="returnFrom"
83
+ value={current?.returnFrom}
84
+ />
85
+ <ReuseField
86
+ label="Return window until (ISO with timezone)"
87
+ name="returnUntil"
88
+ value={current?.returnUntil}
89
+ />
90
+ <ReuseField label="Effective at (ISO with timezone)" name="effectiveAt" />
91
+ <ReuseField label="Source reference" name="sourceReference" />
92
+ </div>
93
+ <ReuseField label="Change reason" name="changeReason" maxLength={2000} />
94
+ <ContainerEvidencePicker value={evidence} onChange={setEvidence} />
95
+ {error && <p role="alert">{error}</p>}
96
+ <Button type="submit" disabled={busy}>
97
+ Record sourced instruction
98
+ </Button>
99
+ </fieldset>
100
+ </form>
101
+ );
102
+ }