@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.
- package/dist/MoveTheWheelsRoot.js +177 -102
- package/dist/MoveTheWheelsRoutes.js +55 -11
- package/dist/_virtual/_rolldown/runtime.js +1 -1
- package/dist/components/ContainerEvidencePicker.js +143 -0
- package/dist/components/FreeTimeAgreementForm.js +496 -0
- package/dist/components/ReturnInstructionForm.js +108 -0
- package/dist/components/ReuseControls.js +91 -0
- package/dist/components/ReusePermissionForm.js +114 -0
- package/dist/components/ReuseProposalForm.js +455 -0
- package/dist/components/ReuseSourceFields.js +78 -0
- package/dist/components/consolidation/ConsolidationHistory.js +244 -0
- package/dist/components/consolidation/ConsolidationLotEditor.js +133 -0
- package/dist/components/consolidation/ConsolidationManifestWorkbench.js +143 -0
- package/dist/components/consolidation/ConsolidationPlanForm.js +172 -0
- package/dist/components/consolidation/ConsolidationPlanWorkbench.js +321 -0
- package/dist/components/consolidation/ConsolidationReportForm.js +94 -0
- package/dist/components/consolidation/ConsolidationReportsWorkbench.js +195 -0
- package/dist/components/consolidation/ConsolidationSummary.js +76 -0
- package/dist/components/consolidation/OriginalConsolidationHistory.js +112 -0
- package/dist/components/freight-cost/FreightDraftForm.js +213 -0
- package/dist/components/freight-cost/FreightFields.js +70 -0
- package/dist/components/freight-cost/FreightFxEditor.js +90 -0
- package/dist/components/freight-cost/FreightHistory.js +164 -0
- package/dist/components/freight-cost/FreightLineEditor.js +191 -0
- package/dist/components/freight-cost/FreightScopeEditor.js +72 -0
- package/dist/components/freight-cost/FreightTotals.js +66 -0
- package/dist/components/logistics-procedure/ProcedureDecisionForm.js +197 -0
- package/dist/components/logistics-procedure/ProcedureFields.js +31 -0
- package/dist/components/logistics-procedure/ProcedureHistory.js +177 -0
- package/dist/components/logistics-procedure/ProcedurePolicyForm.js +227 -0
- package/dist/components/logistics-procedure/ProcedurePolicyWorkbench.js +155 -0
- package/dist/components/logistics-procedure/ProcedureReviewWorkbench.js +221 -0
- package/dist/components/logistics-procedure/ProcedureRunWorkbench.js +190 -0
- package/dist/components/logistics-procedure/ProcedureSubjectPicker.js +130 -0
- package/dist/components/pending-pick/PendingPickDraft.js +84 -0
- package/dist/components/pending-pick/PendingPickHistory.js +113 -0
- package/dist/components/pending-pick/PickCapture.js +166 -0
- package/dist/components/pending-pick/PickLineSelection.js +111 -0
- package/dist/components/stock-binding/StockAssessmentDraft.js +48 -0
- package/dist/components/stock-binding/StockAssessmentHistory.js +61 -0
- package/dist/components/stock-binding/StockAssessmentSummary.js +199 -0
- package/dist/components/stock-binding/StockFactForm.js +232 -0
- package/dist/components/stock-observation/StockIssueForm.js +148 -0
- package/dist/components/stock-observation/StockIssueHistory.js +116 -0
- package/dist/components/stock-observation/StockIssueReadPanel.js +70 -0
- package/dist/components/trip-utilization/TripReportForm.js +118 -0
- package/dist/components/trip-utilization/TripReportHistory.js +54 -0
- package/dist/components/trip-utilization/TripReportSummary.js +216 -0
- package/dist/components/trip-utilization/TripSegmentFields.js +166 -0
- package/dist/generated/consolidation-operations.d.ts +1060 -0
- package/dist/generated/container-condition-operations.d.ts +868 -0
- package/dist/generated/container-operations.d.ts +356 -0
- package/dist/generated/empty-reuse-operations.d.ts +1578 -0
- package/dist/generated/free-time-operations.d.ts +938 -0
- package/dist/generated/freight-cost-operations.d.ts +716 -0
- package/dist/generated/logistics-procedure-operations.d.ts +938 -0
- package/dist/generated/pending-pick-operations.d.ts +1969 -0
- package/dist/generated/stock-binding-operations.d.ts +930 -0
- package/dist/generated/stock-observation-operations.d.ts +476 -0
- package/dist/generated/trip-utilization-operations.d.ts +651 -0
- package/dist/generated/wspace-operations.d.ts +143 -50
- package/dist/hooks/useConsolidationAction.js +119 -0
- package/dist/hooks/useContainerCondition.js +105 -0
- package/dist/hooks/useContainerLifecycle.js +192 -0
- package/dist/hooks/useEmptyReuseAction.js +45 -0
- package/dist/hooks/useFreightRecoveryAction.js +117 -0
- package/dist/hooks/useInventory.js +12 -1
- package/dist/hooks/useProcedureAction.js +119 -0
- package/dist/hooks/useProcedureSelection.js +53 -0
- package/dist/hooks/useReuseRecoveryAction.js +116 -0
- package/dist/movethewheels/components/ContainerEvidencePicker.d.ts +10 -0
- package/dist/movethewheels/components/FreeTimeAgreementForm.d.ts +14 -0
- package/dist/movethewheels/components/ReturnInstructionForm.d.ts +8 -0
- package/dist/movethewheels/components/ReuseControls.d.ts +42 -0
- package/dist/movethewheels/components/ReusePermissionForm.d.ts +9 -0
- package/dist/movethewheels/components/ReuseProposalForm.d.ts +11 -0
- package/dist/movethewheels/components/ReuseSourceFields.d.ts +9 -0
- package/dist/movethewheels/components/consolidation/ConsolidationHistory.d.ts +13 -0
- package/dist/movethewheels/components/consolidation/ConsolidationLotEditor.d.ts +6 -0
- package/dist/movethewheels/components/consolidation/ConsolidationManifestWorkbench.d.ts +8 -0
- package/dist/movethewheels/components/consolidation/ConsolidationPlanForm.d.ts +8 -0
- package/dist/movethewheels/components/consolidation/ConsolidationPlanWorkbench.d.ts +5 -0
- package/dist/movethewheels/components/consolidation/ConsolidationReportForm.d.ts +9 -0
- package/dist/movethewheels/components/consolidation/ConsolidationReportsWorkbench.d.ts +7 -0
- package/dist/movethewheels/components/consolidation/ConsolidationSummary.d.ts +6 -0
- package/dist/movethewheels/components/consolidation/OriginalConsolidationHistory.d.ts +8 -0
- package/dist/movethewheels/components/freight-cost/FreightDraftForm.d.ts +8 -0
- package/dist/movethewheels/components/freight-cost/FreightFields.d.ts +23 -0
- package/dist/movethewheels/components/freight-cost/FreightFxEditor.d.ts +6 -0
- package/dist/movethewheels/components/freight-cost/FreightHistory.d.ts +5 -0
- package/dist/movethewheels/components/freight-cost/FreightLineEditor.d.ts +8 -0
- package/dist/movethewheels/components/freight-cost/FreightScopeEditor.d.ts +6 -0
- package/dist/movethewheels/components/freight-cost/FreightTotals.d.ts +6 -0
- package/dist/movethewheels/components/logistics-procedure/ProcedureDecisionForm.d.ts +20 -0
- package/dist/movethewheels/components/logistics-procedure/ProcedureFields.d.ts +17 -0
- package/dist/movethewheels/components/logistics-procedure/ProcedureHistory.d.ts +7 -0
- package/dist/movethewheels/components/logistics-procedure/ProcedurePolicyForm.d.ts +10 -0
- package/dist/movethewheels/components/logistics-procedure/ProcedurePolicyWorkbench.d.ts +5 -0
- package/dist/movethewheels/components/logistics-procedure/ProcedureReviewWorkbench.d.ts +5 -0
- package/dist/movethewheels/components/logistics-procedure/ProcedureRunWorkbench.d.ts +6 -0
- package/dist/movethewheels/components/logistics-procedure/ProcedureSubjectPicker.d.ts +7 -0
- package/dist/movethewheels/components/pending-pick/PendingPickDraft.d.ts +16 -0
- package/dist/movethewheels/components/pending-pick/PendingPickHistory.d.ts +5 -0
- package/dist/movethewheels/components/pending-pick/PickCapture.d.ts +6 -0
- package/dist/movethewheels/components/pending-pick/PickLineSelection.d.ts +17 -0
- package/dist/movethewheels/components/stock-binding/StockAssessmentDraft.d.ts +13 -0
- package/dist/movethewheels/components/stock-binding/StockAssessmentHistory.d.ts +18 -0
- package/dist/movethewheels/components/stock-binding/StockAssessmentSummary.d.ts +9 -0
- package/dist/movethewheels/components/stock-binding/StockFactForm.d.ts +6 -0
- package/dist/movethewheels/components/stock-observation/StockIssueForm.d.ts +7 -0
- package/dist/movethewheels/components/stock-observation/StockIssueHistory.d.ts +7 -0
- package/dist/movethewheels/components/stock-observation/StockIssueReadPanel.d.ts +5 -0
- package/dist/movethewheels/components/trip-utilization/TripReportForm.d.ts +6 -0
- package/dist/movethewheels/components/trip-utilization/TripReportHistory.d.ts +14 -0
- package/dist/movethewheels/components/trip-utilization/TripReportSummary.d.ts +5 -0
- package/dist/movethewheels/components/trip-utilization/TripSegmentFields.d.ts +9 -0
- package/dist/movethewheels/hooks/useConsolidationAction.d.ts +19 -0
- package/dist/movethewheels/hooks/useContainerCondition.d.ts +21 -0
- package/dist/movethewheels/hooks/useContainerLifecycle.d.ts +40 -0
- package/dist/movethewheels/hooks/useEmptyReuseAction.d.ts +14 -0
- package/dist/movethewheels/hooks/useFreightRecoveryAction.d.ts +23 -0
- package/dist/movethewheels/hooks/useProcedureAction.d.ts +18 -0
- package/dist/movethewheels/hooks/useProcedureSelection.d.ts +51 -0
- package/dist/movethewheels/hooks/useReuseRecoveryAction.d.ts +18 -0
- package/dist/movethewheels/pages/ConsolidationPage.d.ts +1 -0
- package/dist/movethewheels/pages/ContainerConditionPage.d.ts +1 -0
- package/dist/movethewheels/pages/ContainersPage.d.ts +2 -0
- package/dist/movethewheels/pages/EmptyReusePage.d.ts +1 -0
- package/dist/movethewheels/pages/FreeTimePage.d.ts +1 -0
- package/dist/movethewheels/pages/FreightEstimatePage.d.ts +1 -0
- package/dist/movethewheels/pages/LogisticsProceduresPage.d.ts +1 -0
- package/dist/movethewheels/pages/PendingPickPage.d.ts +1 -0
- package/dist/movethewheels/pages/StockBindingPage.d.ts +1 -0
- package/dist/movethewheels/pages/StockObservationsPage.d.ts +1 -0
- package/dist/movethewheels/pages/TripUtilizationPage.d.ts +1 -0
- package/dist/movethewheels/utils/consolidationHistoryTarget.d.ts +12 -0
- package/dist/movethewheels/utils/consolidationInput.d.ts +15 -0
- package/dist/movethewheels/utils/consolidationLot.d.ts +3 -0
- package/dist/movethewheels/utils/consolidationPins.d.ts +20 -0
- package/dist/movethewheels/utils/consolidationRecovery.d.ts +5 -0
- package/dist/movethewheels/utils/consolidationReportHead.d.ts +5 -0
- package/dist/movethewheels/utils/freeTimeDate.d.ts +1 -0
- package/dist/movethewheels/utils/freightAcknowledgement.d.ts +2 -0
- package/dist/movethewheels/utils/freightDraft.d.ts +36 -0
- package/dist/movethewheels/utils/freightRecovery.d.ts +5 -0
- package/dist/movethewheels/utils/graphqlClient.d.ts +2 -1
- package/dist/movethewheels/utils/pendingPickDraft.d.ts +8 -0
- package/dist/movethewheels/utils/procedureInput.d.ts +18 -0
- package/dist/movethewheels/utils/procedureRecovery.d.ts +5 -0
- package/dist/movethewheels/utils/reuseAttempt.d.ts +7 -0
- package/dist/movethewheels/utils/reuseForm.d.ts +6 -0
- package/dist/movethewheels/utils/reuseRecovery.d.ts +26 -0
- package/dist/movethewheels/utils/stockBindingForm.d.ts +23 -0
- package/dist/movethewheels/utils/stockBindingLabels.d.ts +10 -0
- package/dist/movethewheels/utils/stockObservationForm.d.ts +5 -0
- package/dist/movethewheels/utils/tripDraftContext.d.ts +25 -0
- package/dist/movethewheels/utils/tripUtilizationForm.d.ts +6 -0
- package/dist/node_modules/@react-leaflet/core/lib/component.js +5 -5
- package/dist/node_modules/fast-equals/dist/es/index.js +87 -74
- package/dist/node_modules/leaflet/dist/leaflet-src.js +8 -5
- package/dist/node_modules/lodash/_Stack.js +2 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/clipboard-list.js +35 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/repeat-2.js +22 -0
- package/dist/node_modules/react-leaflet/lib/MapContainer.js +3 -3
- package/dist/node_modules/react-smooth/es6/Animate.js +2 -2
- package/dist/node_modules/recharts/es6/cartesian/Area.js +13 -13
- package/dist/node_modules/recharts/es6/cartesian/Bar.js +9 -9
- package/dist/node_modules/recharts/es6/cartesian/Brush.js +12 -12
- package/dist/node_modules/recharts/es6/cartesian/CartesianAxis.js +7 -7
- package/dist/node_modules/recharts/es6/cartesian/CartesianGrid.js +13 -13
- package/dist/node_modules/recharts/es6/cartesian/ErrorBar.js +4 -4
- package/dist/node_modules/recharts/es6/cartesian/Line.js +10 -10
- package/dist/node_modules/recharts/es6/cartesian/ReferenceArea.js +3 -3
- package/dist/node_modules/recharts/es6/cartesian/ReferenceDot.js +3 -3
- package/dist/node_modules/recharts/es6/cartesian/ReferenceLine.js +4 -4
- package/dist/node_modules/recharts/es6/cartesian/XAxis.js +3 -3
- package/dist/node_modules/recharts/es6/cartesian/YAxis.js +3 -3
- package/dist/node_modules/recharts/es6/chart/AccessibilityManager.js +1 -1
- package/dist/node_modules/recharts/es6/chart/generateCategoricalChart.js +22 -22
- package/dist/node_modules/recharts/es6/component/Cursor.js +1 -1
- package/dist/node_modules/recharts/es6/component/DefaultLegendContent.js +11 -11
- package/dist/node_modules/recharts/es6/component/DefaultTooltipContent.js +6 -6
- package/dist/node_modules/recharts/es6/component/Label.js +14 -14
- package/dist/node_modules/recharts/es6/component/LabelList.js +6 -6
- package/dist/node_modules/recharts/es6/component/Legend.js +5 -5
- package/dist/node_modules/recharts/es6/component/ResponsiveContainer.js +3 -3
- package/dist/node_modules/recharts/es6/component/Text.js +2 -2
- package/dist/node_modules/recharts/es6/component/Tooltip.js +3 -3
- package/dist/node_modules/recharts/es6/component/TooltipBoundingBox.js +2 -2
- package/dist/node_modules/recharts/es6/container/Layer.js +2 -2
- package/dist/node_modules/recharts/es6/container/Surface.js +2 -2
- package/dist/node_modules/recharts/es6/context/chartLayoutContext.js +2 -2
- package/dist/node_modules/recharts/es6/polar/Pie.js +13 -13
- package/dist/node_modules/recharts/es6/polar/PolarAngleAxis.js +8 -8
- package/dist/node_modules/recharts/es6/polar/PolarRadiusAxis.js +6 -6
- package/dist/node_modules/recharts/es6/shape/Cross.js +1 -1
- package/dist/node_modules/recharts/es6/shape/Curve.js +1 -1
- package/dist/node_modules/recharts/es6/shape/Dot.js +1 -1
- package/dist/node_modules/recharts/es6/shape/Polygon.js +4 -4
- package/dist/node_modules/recharts/es6/shape/Rectangle.js +4 -4
- package/dist/node_modules/recharts/es6/shape/Sector.js +1 -1
- package/dist/node_modules/recharts/es6/shape/Symbols.js +1 -1
- package/dist/node_modules/recharts/es6/shape/Trapezoid.js +4 -4
- package/dist/node_modules/recharts/es6/util/ActiveShapeUtils.js +9 -9
- package/dist/node_modules/recharts/es6/util/BarUtils.js +1 -1
- package/dist/node_modules/recharts/es6/util/CartesianUtils.js +1 -1
- package/dist/node_modules/recharts/es6/util/PolarUtils.js +1 -1
- package/dist/node_modules/recharts/es6/util/ReactUtils.js +2 -2
- package/dist/node_modules/recharts/es6/util/ReduceCSSCalc.js +1 -1
- package/dist/node_modules/recharts/es6/util/types.js +1 -1
- package/dist/node_modules/{react-is → recharts/node_modules/react-is}/cjs/react-is.development.js +2 -2
- package/dist/node_modules/{react-is → recharts/node_modules/react-is}/cjs/react-is.production.min.js +2 -2
- package/dist/node_modules/{react-is → recharts/node_modules/react-is}/index.js +2 -2
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +97 -18
- package/dist/node_modules/zustand/esm/middleware.js +2 -2
- package/dist/pages/ConsolidationPage.js +76 -0
- package/dist/pages/ContainerConditionPage.js +972 -0
- package/dist/pages/ContainersPage.js +522 -0
- package/dist/pages/EmptyReusePage.js +777 -0
- package/dist/pages/FreeTimePage.js +657 -0
- package/dist/pages/FreightEstimatePage.js +284 -0
- package/dist/pages/InventoryPage.js +77 -73
- package/dist/pages/LogisticsProceduresPage.js +100 -0
- package/dist/pages/PendingPickPage.js +155 -0
- package/dist/pages/StockBindingPage.js +236 -0
- package/dist/pages/StockObservationsPage.js +168 -0
- package/dist/pages/TripUtilizationPage.js +227 -0
- package/dist/src/generated/consolidation-operations.js +505 -0
- package/dist/src/generated/container-condition-operations.js +208 -0
- package/dist/src/generated/container-operations.js +101 -0
- package/dist/src/generated/empty-reuse-operations.js +749 -0
- package/dist/src/generated/free-time-operations.js +235 -0
- package/dist/src/generated/freight-cost-operations.js +325 -0
- package/dist/src/generated/logistics-procedure-operations.js +362 -0
- package/dist/src/generated/pending-pick-operations.js +1128 -0
- package/dist/src/generated/stock-binding-operations.js +175 -0
- package/dist/src/generated/stock-observation-operations.js +93 -0
- package/dist/src/generated/trip-utilization-operations.js +140 -0
- package/dist/src/generated/wspace-operations.js +708 -0
- package/dist/utils/consolidationHistoryTarget.js +27 -0
- package/dist/utils/consolidationInput.js +21 -0
- package/dist/utils/consolidationLot.js +29 -0
- package/dist/utils/consolidationPins.js +13 -0
- package/dist/utils/consolidationRecovery.js +40 -0
- package/dist/utils/consolidationReportHead.js +18 -0
- package/dist/utils/freeTimeDate.js +26 -0
- package/dist/utils/freightAcknowledgement.js +8 -0
- package/dist/utils/freightDraft.js +125 -0
- package/dist/utils/freightRecovery.js +36 -0
- package/dist/utils/graphqlClient.js +28 -28
- package/dist/utils/pendingPickDraft.js +46 -0
- package/dist/utils/procedureInput.js +43 -0
- package/dist/utils/procedureRecovery.js +42 -0
- package/dist/utils/reuseAttempt.js +20 -0
- package/dist/utils/reuseForm.js +25 -0
- package/dist/utils/reuseRecovery.js +71 -0
- package/dist/utils/stockBindingForm.js +142 -0
- package/dist/utils/stockBindingLabels.js +23 -0
- package/dist/utils/stockObservationForm.js +55 -0
- package/dist/utils/tripDraftContext.js +19 -0
- package/dist/utils/tripUtilizationForm.js +60 -0
- package/package.json +19 -5
- package/src/generated/consolidation-operations.ts +1138 -0
- package/src/generated/container-condition-operations.ts +771 -0
- package/src/generated/container-operations.ts +376 -0
- package/src/generated/empty-reuse-operations.ts +1648 -0
- package/src/generated/free-time-operations.ts +814 -0
- package/src/generated/freight-cost-operations.ts +753 -0
- package/src/generated/logistics-procedure-operations.ts +1047 -0
- package/src/generated/pending-pick-operations.ts +1508 -0
- package/src/generated/stock-binding-operations.ts +631 -0
- package/src/generated/stock-observation-operations.ts +373 -0
- package/src/generated/trip-utilization-operations.ts +500 -0
- package/src/generated/wspace-operations.ts +116 -0
- package/src/movethewheels/MoveTheWheelsRoot.tsx +79 -0
- package/src/movethewheels/MoveTheWheelsRoutes.tsx +22 -0
- package/src/movethewheels/components/ContainerEvidencePicker.tsx +146 -0
- package/src/movethewheels/components/FreeTimeAgreementForm.tsx +483 -0
- package/src/movethewheels/components/ReturnInstructionForm.tsx +102 -0
- package/src/movethewheels/components/ReuseControls.tsx +138 -0
- package/src/movethewheels/components/ReusePermissionForm.tsx +123 -0
- package/src/movethewheels/components/ReuseProposalForm.tsx +484 -0
- package/src/movethewheels/components/ReuseSourceFields.tsx +80 -0
- package/src/movethewheels/components/consolidation/ConsolidationHistory.tsx +159 -0
- package/src/movethewheels/components/consolidation/ConsolidationLotEditor.tsx +144 -0
- package/src/movethewheels/components/consolidation/ConsolidationManifestWorkbench.tsx +168 -0
- package/src/movethewheels/components/consolidation/ConsolidationPlanForm.tsx +185 -0
- package/src/movethewheels/components/consolidation/ConsolidationPlanWorkbench.tsx +395 -0
- package/src/movethewheels/components/consolidation/ConsolidationReportForm.tsx +124 -0
- package/src/movethewheels/components/consolidation/ConsolidationReportsWorkbench.tsx +233 -0
- package/src/movethewheels/components/consolidation/ConsolidationSummary.tsx +84 -0
- package/src/movethewheels/components/consolidation/OriginalConsolidationHistory.tsx +133 -0
- package/src/movethewheels/components/freight-cost/FreightDraftForm.tsx +224 -0
- package/src/movethewheels/components/freight-cost/FreightFields.tsx +91 -0
- package/src/movethewheels/components/freight-cost/FreightFxEditor.tsx +98 -0
- package/src/movethewheels/components/freight-cost/FreightHistory.tsx +91 -0
- package/src/movethewheels/components/freight-cost/FreightLineEditor.tsx +192 -0
- package/src/movethewheels/components/freight-cost/FreightScopeEditor.tsx +64 -0
- package/src/movethewheels/components/freight-cost/FreightTotals.tsx +68 -0
- package/src/movethewheels/components/logistics-procedure/ProcedureDecisionForm.tsx +204 -0
- package/src/movethewheels/components/logistics-procedure/ProcedureFields.tsx +43 -0
- package/src/movethewheels/components/logistics-procedure/ProcedureHistory.tsx +102 -0
- package/src/movethewheels/components/logistics-procedure/ProcedurePolicyForm.tsx +226 -0
- package/src/movethewheels/components/logistics-procedure/ProcedurePolicyWorkbench.tsx +174 -0
- package/src/movethewheels/components/logistics-procedure/ProcedureReviewWorkbench.tsx +278 -0
- package/src/movethewheels/components/logistics-procedure/ProcedureRunWorkbench.tsx +292 -0
- package/src/movethewheels/components/logistics-procedure/ProcedureSubjectPicker.tsx +111 -0
- package/src/movethewheels/components/pending-pick/PendingPickDraft.tsx +82 -0
- package/src/movethewheels/components/pending-pick/PendingPickHistory.tsx +93 -0
- package/src/movethewheels/components/pending-pick/PickCapture.tsx +70 -0
- package/src/movethewheels/components/pending-pick/PickLineSelection.tsx +130 -0
- package/src/movethewheels/components/stock-binding/StockAssessmentDraft.tsx +52 -0
- package/src/movethewheels/components/stock-binding/StockAssessmentHistory.tsx +56 -0
- package/src/movethewheels/components/stock-binding/StockAssessmentSummary.tsx +108 -0
- package/src/movethewheels/components/stock-binding/StockFactForm.tsx +186 -0
- package/src/movethewheels/components/stock-observation/StockIssueForm.tsx +103 -0
- package/src/movethewheels/components/stock-observation/StockIssueHistory.tsx +96 -0
- package/src/movethewheels/components/stock-observation/StockIssueReadPanel.tsx +72 -0
- package/src/movethewheels/components/trip-utilization/TripReportForm.tsx +116 -0
- package/src/movethewheels/components/trip-utilization/TripReportHistory.tsx +51 -0
- package/src/movethewheels/components/trip-utilization/TripReportSummary.tsx +127 -0
- package/src/movethewheels/components/trip-utilization/TripSegmentFields.tsx +118 -0
- package/src/movethewheels/hooks/useConsolidationAction.ts +196 -0
- package/src/movethewheels/hooks/useContainerCondition.ts +129 -0
- package/src/movethewheels/hooks/useContainerLifecycle.ts +291 -0
- package/src/movethewheels/hooks/useEmptyReuseAction.ts +72 -0
- package/src/movethewheels/hooks/useFreightRecoveryAction.ts +201 -0
- package/src/movethewheels/hooks/useInventory.ts +2 -20
- package/src/movethewheels/hooks/useProcedureAction.ts +196 -0
- package/src/movethewheels/hooks/useProcedureSelection.ts +75 -0
- package/src/movethewheels/hooks/useReuseRecoveryAction.ts +192 -0
- package/src/movethewheels/pages/ConsolidationPage.tsx +70 -0
- package/src/movethewheels/pages/ContainerConditionPage.tsx +959 -0
- package/src/movethewheels/pages/ContainersPage.tsx +490 -0
- package/src/movethewheels/pages/EmptyReusePage.tsx +823 -0
- package/src/movethewheels/pages/FreeTimePage.tsx +720 -0
- package/src/movethewheels/pages/FreightEstimatePage.tsx +353 -0
- package/src/movethewheels/pages/InventoryPage.tsx +16 -2
- package/src/movethewheels/pages/LogisticsProceduresPage.tsx +86 -0
- package/src/movethewheels/pages/PendingPickPage.tsx +226 -0
- package/src/movethewheels/pages/StockBindingPage.tsx +299 -0
- package/src/movethewheels/pages/StockObservationsPage.tsx +181 -0
- package/src/movethewheels/pages/TripUtilizationPage.tsx +315 -0
- package/src/movethewheels/utils/consolidationHistoryTarget.ts +39 -0
- package/src/movethewheels/utils/consolidationInput.ts +70 -0
- package/src/movethewheels/utils/consolidationLot.ts +24 -0
- package/src/movethewheels/utils/consolidationPins.ts +52 -0
- package/src/movethewheels/utils/consolidationRecovery.ts +88 -0
- package/src/movethewheels/utils/consolidationReportHead.ts +29 -0
- package/src/movethewheels/utils/freeTimeDate.ts +31 -0
- package/src/movethewheels/utils/freightAcknowledgement.ts +31 -0
- package/src/movethewheels/utils/freightDraft.ts +170 -0
- package/src/movethewheels/utils/freightRecovery.ts +79 -0
- package/src/movethewheels/utils/graphqlClient.ts +14 -5
- package/src/movethewheels/utils/pendingPickDraft.ts +61 -0
- package/src/movethewheels/utils/procedureInput.ts +98 -0
- package/src/movethewheels/utils/procedureRecovery.ts +92 -0
- package/src/movethewheels/utils/reuseAttempt.ts +29 -0
- package/src/movethewheels/utils/reuseForm.ts +30 -0
- package/src/movethewheels/utils/reuseRecovery.ts +151 -0
- package/src/movethewheels/utils/stockBindingForm.ts +209 -0
- package/src/movethewheels/utils/stockBindingLabels.ts +41 -0
- package/src/movethewheels/utils/stockObservationForm.ts +73 -0
- package/src/movethewheels/utils/tripDraftContext.ts +61 -0
- package/src/movethewheels/utils/tripUtilizationForm.ts +105 -0
- package/src/operations/condition/container-condition.graphql +41 -0
- package/src/operations/consolidation/consolidation.graphql +490 -0
- package/src/operations/container/container-lifecycle.graphql +80 -0
- package/src/operations/empty-reuse/empty-reuse.graphql +737 -0
- package/src/operations/free-time/free-time.graphql +47 -0
- package/src/operations/freight-cost/freight.graphql +6 -0
- package/src/operations/logistics-procedure/procedure.graphql +15 -0
- package/src/operations/pending-pick/pending-pick.graphql +1122 -0
- package/src/operations/stock-binding/stock-binding.graphql +160 -0
- package/src/operations/stock-observation/stock-observation.graphql +20 -0
- package/src/operations/trip-utilization/trip-utilization.graphql +126 -0
- package/src/operations/wspace/container-evidence.graphql +6 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ConsolidationObservationsDocument,
|
|
4
|
+
ConsolidationObservationDocument,
|
|
5
|
+
type ConsolidationObservationQuery,
|
|
6
|
+
RecordConsolidationObservationDocument,
|
|
7
|
+
type ConsolidationObservationsQuery,
|
|
8
|
+
type ConsolidationPlanQuery,
|
|
9
|
+
type MtwConsolidationReportKind,
|
|
10
|
+
type RecordMtwConsolidationObservationInput,
|
|
11
|
+
} from '../../../generated/consolidation-operations';
|
|
12
|
+
import { useConditionApi, useConditionQuery } from '../../hooks/useContainerCondition';
|
|
13
|
+
import type { useConsolidationAction } from '../../hooks/useConsolidationAction';
|
|
14
|
+
import { ConsolidationReportForm, type ConsolidationReportPin } from './ConsolidationReportForm';
|
|
15
|
+
import { ConsolidationReportHistory } from './ConsolidationHistory';
|
|
16
|
+
import { ConsolidationManifestWorkbench } from './ConsolidationManifestWorkbench';
|
|
17
|
+
import { ProcedureField as Field } from '../logistics-procedure/ProcedureFields';
|
|
18
|
+
import { findConsolidationReportHead } from '../../utils/consolidationReportHead';
|
|
19
|
+
import { assertConsolidationPredecessor } from '../../utils/consolidationPins';
|
|
20
|
+
import { ReusePager, ReuseState, reuseCard, reuseSelect } from '../ReuseControls';
|
|
21
|
+
import { Button } from '../ui';
|
|
22
|
+
type Report = ConsolidationObservationsQuery['mtwConsolidationObservationPage']['items'][number];
|
|
23
|
+
export function ConsolidationReportsWorkbench({
|
|
24
|
+
plan,
|
|
25
|
+
actions,
|
|
26
|
+
}: {
|
|
27
|
+
plan: ConsolidationPlanQuery['mtwConsolidationPlan'];
|
|
28
|
+
actions: ReturnType<typeof useConsolidationAction>;
|
|
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 [lotId, setLot] = useState(''),
|
|
39
|
+
[kind, setKind] = useState<MtwConsolidationReportKind>('RECEIPT_REPORT'),
|
|
40
|
+
[issueReference, setIssue] = useState(''),
|
|
41
|
+
[offset, setOffset] = useState(0),
|
|
42
|
+
[selectedReport, setSelectedReport] = useState(''),
|
|
43
|
+
[checking, setChecking] = useState(false),
|
|
44
|
+
[error, setError] = useState<string | null>(null),
|
|
45
|
+
[draft, setDraft] = useState<{
|
|
46
|
+
pin: ConsolidationReportPin;
|
|
47
|
+
head: Report | null;
|
|
48
|
+
generation: string;
|
|
49
|
+
} | null>(null);
|
|
50
|
+
const history = useConditionQuery<ConsolidationObservationsQuery>(
|
|
51
|
+
ConsolidationObservationsDocument,
|
|
52
|
+
{ planId: plan.id, pagination: { limit: 10, offset } },
|
|
53
|
+
actions.revision
|
|
54
|
+
);
|
|
55
|
+
const selected = useConditionQuery<ConsolidationObservationQuery>(
|
|
56
|
+
ConsolidationObservationDocument,
|
|
57
|
+
selectedReport ? { planId: plan.id, id: selectedReport } : null,
|
|
58
|
+
actions.revision
|
|
59
|
+
);
|
|
60
|
+
const labels = Object.fromEntries(
|
|
61
|
+
plan.facts.lots.map((lot) => [
|
|
62
|
+
lot.id,
|
|
63
|
+
`${lot.supplierReference} · ${lot.lotReference} · ${lot.unitReference ?? 'Unknown unit'}`,
|
|
64
|
+
])
|
|
65
|
+
),
|
|
66
|
+
lot = plan.facts.lots.find((row) => row.id === lotId),
|
|
67
|
+
paused = checking || actions.busy || actions.uncertain;
|
|
68
|
+
const review = async () => {
|
|
69
|
+
if (!lot || paused) return;
|
|
70
|
+
setChecking(true);
|
|
71
|
+
setError(null);
|
|
72
|
+
try {
|
|
73
|
+
const head =
|
|
74
|
+
kind === 'ISSUE' ? null : await findConsolidationReportHead(request, plan.id, lot.id, kind);
|
|
75
|
+
if (!active.current) return;
|
|
76
|
+
setDraft({
|
|
77
|
+
head,
|
|
78
|
+
generation: crypto.randomUUID(),
|
|
79
|
+
pin: {
|
|
80
|
+
planId: plan.id,
|
|
81
|
+
lotId: lot.id,
|
|
82
|
+
kind,
|
|
83
|
+
issueReference: kind === 'ISSUE' ? issueReference.trim() : null,
|
|
84
|
+
expectedPreviousVersionId: head?.id ?? null,
|
|
85
|
+
expectedVersion: head?.version ?? 0,
|
|
86
|
+
unitReference: lot.unitReference ?? null,
|
|
87
|
+
unitRevision: lot.unitRevision ?? null,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
} catch (f) {
|
|
91
|
+
setError(f instanceof Error ? f.message : 'Unable to review history.');
|
|
92
|
+
} finally {
|
|
93
|
+
setChecking(false);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const save = async (input: Omit<RecordMtwConsolidationObservationInput, 'idempotencyKey'>) => {
|
|
97
|
+
if (!draft || paused) throw new Error('Review the current report chain first.');
|
|
98
|
+
setChecking(true);
|
|
99
|
+
try {
|
|
100
|
+
const head =
|
|
101
|
+
draft.pin.kind === 'ISSUE'
|
|
102
|
+
? null
|
|
103
|
+
: await findConsolidationReportHead(request, plan.id, draft.pin.lotId, draft.pin.kind);
|
|
104
|
+
if (!active.current) throw new Error('Context changed. Nothing was sent.');
|
|
105
|
+
assertConsolidationPredecessor(draft.head, head);
|
|
106
|
+
const result = await actions.run(
|
|
107
|
+
RecordConsolidationObservationDocument,
|
|
108
|
+
{ ...input },
|
|
109
|
+
'Reported observation recorded.'
|
|
110
|
+
);
|
|
111
|
+
if (result) {
|
|
112
|
+
setDraft(null);
|
|
113
|
+
setOffset(0);
|
|
114
|
+
}
|
|
115
|
+
} finally {
|
|
116
|
+
setChecking(false);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
return (
|
|
120
|
+
<>
|
|
121
|
+
<section className={reuseCard}>
|
|
122
|
+
<h2 className="text-lg font-semibold">Record a cumulative total or issue</h2>
|
|
123
|
+
<fieldset disabled={paused} className="space-y-3">
|
|
124
|
+
<label className="block">
|
|
125
|
+
Supplier lot
|
|
126
|
+
<select
|
|
127
|
+
className={reuseSelect}
|
|
128
|
+
value={lotId}
|
|
129
|
+
onChange={(e) => {
|
|
130
|
+
setLot(e.target.value);
|
|
131
|
+
setDraft(null);
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
<option value="">Choose a captured lot</option>
|
|
135
|
+
{plan.facts.lots.map((row) => (
|
|
136
|
+
<option key={row.id} value={row.id}>
|
|
137
|
+
{labels[row.id]}
|
|
138
|
+
</option>
|
|
139
|
+
))}
|
|
140
|
+
</select>
|
|
141
|
+
</label>
|
|
142
|
+
<label className="block">
|
|
143
|
+
Report kind
|
|
144
|
+
<select
|
|
145
|
+
className={reuseSelect}
|
|
146
|
+
value={kind}
|
|
147
|
+
onChange={(e) => {
|
|
148
|
+
setKind(
|
|
149
|
+
e.target.value === 'ISSUE'
|
|
150
|
+
? 'ISSUE'
|
|
151
|
+
: e.target.value === 'STUFFING_REPORT'
|
|
152
|
+
? 'STUFFING_REPORT'
|
|
153
|
+
: 'RECEIPT_REPORT'
|
|
154
|
+
);
|
|
155
|
+
setDraft(null);
|
|
156
|
+
}}
|
|
157
|
+
>
|
|
158
|
+
<option value="RECEIPT_REPORT">Cumulative receipt total</option>
|
|
159
|
+
<option value="STUFFING_REPORT">Cumulative stuffing total</option>
|
|
160
|
+
<option value="ISSUE">Unresolved reported issue</option>
|
|
161
|
+
</select>
|
|
162
|
+
</label>
|
|
163
|
+
{kind === 'ISSUE' && (
|
|
164
|
+
<Field
|
|
165
|
+
label="Unique issue reference"
|
|
166
|
+
value={issueReference}
|
|
167
|
+
onChange={(value) => {
|
|
168
|
+
setIssue(value);
|
|
169
|
+
setDraft(null);
|
|
170
|
+
}}
|
|
171
|
+
/>
|
|
172
|
+
)}
|
|
173
|
+
<Button
|
|
174
|
+
disabled={!lot || paused || (kind === 'ISSUE' && !issueReference.trim())}
|
|
175
|
+
onClick={() => void review()}
|
|
176
|
+
>
|
|
177
|
+
Review current total and open form
|
|
178
|
+
</Button>
|
|
179
|
+
</fieldset>
|
|
180
|
+
{draft && lot && (
|
|
181
|
+
<ConsolidationReportForm
|
|
182
|
+
key={draft.generation}
|
|
183
|
+
pin={draft.pin}
|
|
184
|
+
lot={lot}
|
|
185
|
+
busy={paused}
|
|
186
|
+
onSave={async (input) => {
|
|
187
|
+
try {
|
|
188
|
+
await save(input);
|
|
189
|
+
} catch (f) {
|
|
190
|
+
setError(f instanceof Error ? f.message : 'Unable to record report.');
|
|
191
|
+
throw f;
|
|
192
|
+
}
|
|
193
|
+
}}
|
|
194
|
+
/>
|
|
195
|
+
)}{' '}
|
|
196
|
+
{error && <p role="alert">{error}</p>}
|
|
197
|
+
<ReuseState loading={history.loading} error={history.error} />
|
|
198
|
+
<div className="flex flex-wrap gap-2">
|
|
199
|
+
{history.data?.mtwConsolidationObservationPage.items.map((row) => (
|
|
200
|
+
<Button
|
|
201
|
+
key={row.id}
|
|
202
|
+
variant="outline"
|
|
203
|
+
disabled={paused}
|
|
204
|
+
onClick={() => setSelectedReport(row.id)}
|
|
205
|
+
>
|
|
206
|
+
View {labels[row.lotId]} · report {row.receiptSequence}
|
|
207
|
+
</Button>
|
|
208
|
+
))}
|
|
209
|
+
</div>
|
|
210
|
+
<ConsolidationReportHistory
|
|
211
|
+
rows={history.data?.mtwConsolidationObservationPage.items ?? []}
|
|
212
|
+
labels={labels}
|
|
213
|
+
/>
|
|
214
|
+
<ReusePager
|
|
215
|
+
offset={offset}
|
|
216
|
+
page={history.data?.mtwConsolidationObservationPage}
|
|
217
|
+
busy={paused}
|
|
218
|
+
onChange={setOffset}
|
|
219
|
+
/>
|
|
220
|
+
<ReuseState loading={selected.loading} error={selected.error} />
|
|
221
|
+
{selected.data && (
|
|
222
|
+
<section aria-label="Selected exact report">
|
|
223
|
+
<ConsolidationReportHistory
|
|
224
|
+
rows={[selected.data.mtwConsolidationObservation]}
|
|
225
|
+
labels={labels}
|
|
226
|
+
/>
|
|
227
|
+
</section>
|
|
228
|
+
)}
|
|
229
|
+
</section>
|
|
230
|
+
<ConsolidationManifestWorkbench plan={plan} actions={actions} labels={labels} />
|
|
231
|
+
</>
|
|
232
|
+
);
|
|
233
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { ConsolidationPreviewQuery } from '../../../generated/consolidation-operations';
|
|
2
|
+
export function ConsolidationSummary({
|
|
3
|
+
snapshot,
|
|
4
|
+
labels,
|
|
5
|
+
}: {
|
|
6
|
+
snapshot: ConsolidationPreviewQuery['previewMtwConsolidationManifest'];
|
|
7
|
+
labels: Record<string, string>;
|
|
8
|
+
}) {
|
|
9
|
+
return (
|
|
10
|
+
<section className="space-y-3">
|
|
11
|
+
<h3 className="font-semibold">Reported reconciliation</h3>
|
|
12
|
+
<p>
|
|
13
|
+
Receipt sequence {snapshot.observationSequence} · {snapshot.unresolvedIssueCount} unresolved
|
|
14
|
+
reported issues
|
|
15
|
+
</p>
|
|
16
|
+
<p>
|
|
17
|
+
These comparisons do not reserve goods, confirm stuffing, establish fit or authorize customs
|
|
18
|
+
or carrier acceptance.
|
|
19
|
+
</p>
|
|
20
|
+
{snapshot.rows.map((row) => (
|
|
21
|
+
<article key={row.lotId} className="min-w-0 space-y-2 rounded-lg border p-3">
|
|
22
|
+
<h4 className="break-words font-medium">{labels[row.lotId] ?? 'Captured lot'}</h4>
|
|
23
|
+
<dl className="grid gap-2 sm:grid-cols-2">
|
|
24
|
+
{(
|
|
25
|
+
[
|
|
26
|
+
'plannedQuantity',
|
|
27
|
+
'reportedAvailableQuantity',
|
|
28
|
+
'receivedQuantity',
|
|
29
|
+
'stuffedQuantity',
|
|
30
|
+
'availabilityDeficit',
|
|
31
|
+
'receiptDeficit',
|
|
32
|
+
'receiptExcess',
|
|
33
|
+
'stuffingExcess',
|
|
34
|
+
'receivedMinusStuffed',
|
|
35
|
+
] as const
|
|
36
|
+
).map((key) => (
|
|
37
|
+
<div key={key}>
|
|
38
|
+
<dt>
|
|
39
|
+
{
|
|
40
|
+
{
|
|
41
|
+
plannedQuantity: 'Planned',
|
|
42
|
+
reportedAvailableQuantity: 'Reported available',
|
|
43
|
+
receivedQuantity: 'Cumulative received report',
|
|
44
|
+
stuffedQuantity: 'Cumulative stuffing report',
|
|
45
|
+
availabilityDeficit: 'Availability shortfall',
|
|
46
|
+
receiptDeficit: 'Receipt shortfall',
|
|
47
|
+
receiptExcess: 'Receipt excess',
|
|
48
|
+
stuffingExcess: 'Stuffing excess',
|
|
49
|
+
receivedMinusStuffed: 'Received minus stuffed',
|
|
50
|
+
}[key]
|
|
51
|
+
}
|
|
52
|
+
</dt>
|
|
53
|
+
<dd>{row[key] ?? 'Unknown'}</dd>
|
|
54
|
+
</div>
|
|
55
|
+
))}
|
|
56
|
+
</dl>
|
|
57
|
+
{row.unknownReasons.length > 0 && (
|
|
58
|
+
<p>
|
|
59
|
+
Missing facts:{' '}
|
|
60
|
+
{row.unknownReasons
|
|
61
|
+
.map((value) => value.toLowerCase().replaceAll('_', ' '))
|
|
62
|
+
.join('; ')}
|
|
63
|
+
</p>
|
|
64
|
+
)}
|
|
65
|
+
<details>
|
|
66
|
+
<summary>Exact report references</summary>
|
|
67
|
+
<p className="break-all">
|
|
68
|
+
Receipt: {row.receiptObservationId ?? 'None'}; stuffing:{' '}
|
|
69
|
+
{row.stuffingObservationId ?? 'None'}
|
|
70
|
+
</p>
|
|
71
|
+
</details>
|
|
72
|
+
</article>
|
|
73
|
+
))}
|
|
74
|
+
{snapshot.reviewReasons.length > 0 && (
|
|
75
|
+
<p>
|
|
76
|
+
Review:{' '}
|
|
77
|
+
{snapshot.reviewReasons
|
|
78
|
+
.map((value) => value.toLowerCase().replaceAll('_', ' '))
|
|
79
|
+
.join('; ')}
|
|
80
|
+
</p>
|
|
81
|
+
)}
|
|
82
|
+
</section>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ConsolidationPlansDocument,
|
|
4
|
+
ConsolidationPlanDocument,
|
|
5
|
+
ConsolidationObservationsDocument,
|
|
6
|
+
ConsolidationObservationDocument,
|
|
7
|
+
ConsolidationManifestsDocument,
|
|
8
|
+
ConsolidationManifestDocument,
|
|
9
|
+
type ConsolidationPlansQuery,
|
|
10
|
+
type ConsolidationPlanQuery,
|
|
11
|
+
type ConsolidationObservationsQuery,
|
|
12
|
+
type ConsolidationObservationQuery,
|
|
13
|
+
type ConsolidationManifestsQuery,
|
|
14
|
+
type ConsolidationManifestQuery,
|
|
15
|
+
} from '../../../generated/consolidation-operations';
|
|
16
|
+
import { useConditionQuery } from '../../hooks/useContainerCondition';
|
|
17
|
+
import type { OriginalConsolidationHistoryTarget } from '../../utils/consolidationHistoryTarget';
|
|
18
|
+
import { ReusePager, ReuseState, reuseSelect } from '../ReuseControls';
|
|
19
|
+
import { Button } from '../ui';
|
|
20
|
+
import {
|
|
21
|
+
ConsolidationPlanHistory,
|
|
22
|
+
ConsolidationReportHistory,
|
|
23
|
+
ConsolidationManifestHistory,
|
|
24
|
+
} from './ConsolidationHistory';
|
|
25
|
+
|
|
26
|
+
/** Read the retained request's history without changing its input, key or draft selections. */
|
|
27
|
+
export function OriginalConsolidationHistory({
|
|
28
|
+
target,
|
|
29
|
+
revision,
|
|
30
|
+
refresh,
|
|
31
|
+
}: {
|
|
32
|
+
target: OriginalConsolidationHistoryTarget;
|
|
33
|
+
revision: number;
|
|
34
|
+
refresh: () => void;
|
|
35
|
+
}) {
|
|
36
|
+
const [offset, setOffset] = useState(0);
|
|
37
|
+
const [selected, setSelected] = useState('');
|
|
38
|
+
const pagination = { limit: 5, offset };
|
|
39
|
+
const plans = useConditionQuery<ConsolidationPlansQuery>(
|
|
40
|
+
ConsolidationPlansDocument,
|
|
41
|
+
target.kind === 'plan'
|
|
42
|
+
? { shipmentId: target.shipmentId, planReference: target.planReference, pagination }
|
|
43
|
+
: null,
|
|
44
|
+
revision
|
|
45
|
+
);
|
|
46
|
+
const plan = useConditionQuery<ConsolidationPlanQuery>(
|
|
47
|
+
ConsolidationPlanDocument,
|
|
48
|
+
target.kind === 'plan' && selected ? { shipmentId: target.shipmentId, id: selected } : null,
|
|
49
|
+
revision
|
|
50
|
+
);
|
|
51
|
+
const reports = useConditionQuery<ConsolidationObservationsQuery>(
|
|
52
|
+
ConsolidationObservationsDocument,
|
|
53
|
+
target.kind === 'observation' ? { planId: target.planId, pagination } : null,
|
|
54
|
+
revision
|
|
55
|
+
);
|
|
56
|
+
const report = useConditionQuery<ConsolidationObservationQuery>(
|
|
57
|
+
ConsolidationObservationDocument,
|
|
58
|
+
target.kind === 'observation' && selected ? { planId: target.planId, id: selected } : null,
|
|
59
|
+
revision
|
|
60
|
+
);
|
|
61
|
+
const manifests = useConditionQuery<ConsolidationManifestsQuery>(
|
|
62
|
+
ConsolidationManifestsDocument,
|
|
63
|
+
target.kind === 'manifest' ? { planId: target.planId, pagination } : null,
|
|
64
|
+
revision
|
|
65
|
+
);
|
|
66
|
+
const manifest = useConditionQuery<ConsolidationManifestQuery>(
|
|
67
|
+
ConsolidationManifestDocument,
|
|
68
|
+
target.kind === 'manifest' && selected ? { planId: target.planId, id: selected } : null,
|
|
69
|
+
revision
|
|
70
|
+
);
|
|
71
|
+
const page =
|
|
72
|
+
target.kind === 'plan'
|
|
73
|
+
? plans.data?.mtwConsolidationPlanPage
|
|
74
|
+
: target.kind === 'observation'
|
|
75
|
+
? reports.data?.mtwConsolidationObservationPage
|
|
76
|
+
: manifests.data?.mtwConsolidationManifestPage;
|
|
77
|
+
const reads = [plans, plan, reports, report, manifests, manifest];
|
|
78
|
+
const loading = reads.some((read) => read.loading);
|
|
79
|
+
const error = reads.find((read) => read.error)?.error ?? null;
|
|
80
|
+
return (
|
|
81
|
+
<section className="min-w-0 space-y-3 rounded-lg border p-4">
|
|
82
|
+
<h2 className="font-semibold">Original request history (read only)</h2>
|
|
83
|
+
<p className="break-all">
|
|
84
|
+
{target.kind === 'plan'
|
|
85
|
+
? `Shipment ${target.shipmentId}; plan reference ${target.planReference}`
|
|
86
|
+
: `Original plan ${target.planId}; ${target.kind} history`}
|
|
87
|
+
</p>
|
|
88
|
+
<p>
|
|
89
|
+
Reading a record does not confirm or clear the unresolved save. Compare its revisions and
|
|
90
|
+
attribution before deciding whether to retry.
|
|
91
|
+
</p>
|
|
92
|
+
<Button variant="outline" disabled={loading} onClick={refresh}>
|
|
93
|
+
Refresh original request history
|
|
94
|
+
</Button>
|
|
95
|
+
<ReuseState loading={loading} error={error}>
|
|
96
|
+
<label className="block">
|
|
97
|
+
Original request recorded version
|
|
98
|
+
<select
|
|
99
|
+
className={reuseSelect}
|
|
100
|
+
value={selected}
|
|
101
|
+
disabled={loading}
|
|
102
|
+
onChange={(event) => setSelected(event.target.value)}
|
|
103
|
+
>
|
|
104
|
+
<option value="">Choose a recorded version</option>
|
|
105
|
+
{selected && !page?.items.some((row) => row.id === selected) && (
|
|
106
|
+
<option value={selected}>Selected record (outside this page)</option>
|
|
107
|
+
)}
|
|
108
|
+
{page?.items.map((row) => (
|
|
109
|
+
<option key={row.id} value={row.id}>
|
|
110
|
+
Version {row.version} · {row.id}
|
|
111
|
+
</option>
|
|
112
|
+
))}
|
|
113
|
+
</select>
|
|
114
|
+
</label>
|
|
115
|
+
<ReusePager page={page} offset={offset} onChange={setOffset} busy={loading} />
|
|
116
|
+
{page?.total === 0 && <p>No recorded versions found for the original request.</p>}
|
|
117
|
+
{plan.data && <ConsolidationPlanHistory plan={plan.data.mtwConsolidationPlan} />}
|
|
118
|
+
{report.data && (
|
|
119
|
+
<ConsolidationReportHistory
|
|
120
|
+
rows={[report.data.mtwConsolidationObservation]}
|
|
121
|
+
labels={{}}
|
|
122
|
+
/>
|
|
123
|
+
)}
|
|
124
|
+
{manifest.data && (
|
|
125
|
+
<ConsolidationManifestHistory
|
|
126
|
+
manifest={manifest.data.mtwConsolidationManifest}
|
|
127
|
+
labels={{}}
|
|
128
|
+
/>
|
|
129
|
+
)}
|
|
130
|
+
</ReuseState>
|
|
131
|
+
</section>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { useRef, useState } from 'react';
|
|
2
|
+
import type {
|
|
3
|
+
MtwFreightFactsInput,
|
|
4
|
+
PreviewFreightCostsQuery,
|
|
5
|
+
} from '../../../generated/freight-cost-operations';
|
|
6
|
+
import { ContainerEvidencePicker, type SelectedEvidence } from '../ContainerEvidencePicker';
|
|
7
|
+
import { Button } from '../ui';
|
|
8
|
+
import { FreightCurrency, FreightSelect, FreightText } from './FreightFields';
|
|
9
|
+
import { FreightLineEditor } from './FreightLineEditor';
|
|
10
|
+
import { FreightScopeEditor } from './FreightScopeEditor';
|
|
11
|
+
import { FreightFxEditor } from './FreightFxEditor';
|
|
12
|
+
import { FreightTotals } from './FreightTotals';
|
|
13
|
+
import {
|
|
14
|
+
freightInstant,
|
|
15
|
+
freightLocalTime,
|
|
16
|
+
newFreightFacts,
|
|
17
|
+
newFreightLine,
|
|
18
|
+
} from '../../utils/freightDraft';
|
|
19
|
+
export function FreightDraftForm({
|
|
20
|
+
disabled,
|
|
21
|
+
onPreview,
|
|
22
|
+
onSave,
|
|
23
|
+
}: {
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
onPreview: (
|
|
26
|
+
facts: MtwFreightFactsInput
|
|
27
|
+
) => Promise<PreviewFreightCostsQuery['previewMtwFreightTotal']>;
|
|
28
|
+
onSave: (facts: MtwFreightFactsInput, evidence: SelectedEvidence[]) => Promise<void>;
|
|
29
|
+
}) {
|
|
30
|
+
const [facts, setFacts] = useState(newFreightFacts);
|
|
31
|
+
const [evidence, setEvidence] = useState<SelectedEvidence[]>([]);
|
|
32
|
+
const [preview, setPreview] = useState<{
|
|
33
|
+
body: string;
|
|
34
|
+
value: PreviewFreightCostsQuery['previewMtwFreightTotal'];
|
|
35
|
+
} | null>(null);
|
|
36
|
+
const [error, setError] = useState<string | null>(null);
|
|
37
|
+
const [previewing, setPreviewing] = useState(false);
|
|
38
|
+
const pendingPreview = useRef(false);
|
|
39
|
+
const body = JSON.stringify(facts);
|
|
40
|
+
const currentPreview = preview?.body === body ? preview.value : null;
|
|
41
|
+
const patch = (values: Partial<MtwFreightFactsInput>) => setFacts({ ...facts, ...values });
|
|
42
|
+
const previewNow = async () => {
|
|
43
|
+
if (pendingPreview.current) return;
|
|
44
|
+
pendingPreview.current = true;
|
|
45
|
+
setPreviewing(true);
|
|
46
|
+
setError(null);
|
|
47
|
+
const original = structuredClone(facts);
|
|
48
|
+
try {
|
|
49
|
+
const value = await onPreview(original);
|
|
50
|
+
setPreview({ body: JSON.stringify(original), value });
|
|
51
|
+
} catch (failure) {
|
|
52
|
+
setError(failure instanceof Error ? failure.message : 'Unable to preview these costs.');
|
|
53
|
+
} finally {
|
|
54
|
+
pendingPreview.current = false;
|
|
55
|
+
setPreviewing(false);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
return (
|
|
59
|
+
<form
|
|
60
|
+
className="space-y-6"
|
|
61
|
+
onSubmit={(event) => {
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
if (!currentPreview) {
|
|
64
|
+
void previewNow();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
setError(null);
|
|
68
|
+
void onSave(structuredClone(facts), structuredClone(evidence)).catch((failure) =>
|
|
69
|
+
setError(failure instanceof Error ? failure.message : 'Unable to save this cost record.')
|
|
70
|
+
);
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
<fieldset disabled={disabled || previewing} className="space-y-5">
|
|
74
|
+
<legend className="text-lg font-semibold">Sourced cost draft</legend>
|
|
75
|
+
<div className="grid gap-3 md:grid-cols-2">
|
|
76
|
+
<FreightText
|
|
77
|
+
label="Estimate title"
|
|
78
|
+
value={facts.title}
|
|
79
|
+
required
|
|
80
|
+
onChange={(title) => patch({ title })}
|
|
81
|
+
/>
|
|
82
|
+
<FreightSelect
|
|
83
|
+
label="Record type"
|
|
84
|
+
value={facts.kind}
|
|
85
|
+
onChange={(kind) => {
|
|
86
|
+
if (kind === 'ESTIMATE' || kind === 'QUOTE') patch({ kind });
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
<option value="ESTIMATE">Estimate</option>
|
|
90
|
+
<option value="QUOTE">Reported quote</option>
|
|
91
|
+
</FreightSelect>
|
|
92
|
+
<FreightText
|
|
93
|
+
label="Commercial source"
|
|
94
|
+
value={facts.sourceReference}
|
|
95
|
+
required
|
|
96
|
+
onChange={(sourceReference) => patch({ sourceReference })}
|
|
97
|
+
/>
|
|
98
|
+
<FreightText
|
|
99
|
+
label="Source version"
|
|
100
|
+
value={facts.sourceRevision}
|
|
101
|
+
required
|
|
102
|
+
onChange={(sourceRevision) => patch({ sourceRevision })}
|
|
103
|
+
/>
|
|
104
|
+
</div>
|
|
105
|
+
<FreightText
|
|
106
|
+
label="Shipment and services covered by this source"
|
|
107
|
+
value={facts.commercialScope}
|
|
108
|
+
required
|
|
109
|
+
onChange={(commercialScope) => patch({ commercialScope })}
|
|
110
|
+
/>
|
|
111
|
+
<p className="text-sm">
|
|
112
|
+
Dates use your local time zone: {Intl.DateTimeFormat().resolvedOptions().timeZone}. They
|
|
113
|
+
are recorded as exact UTC instants.
|
|
114
|
+
</p>
|
|
115
|
+
<FreightText
|
|
116
|
+
label="Price applies at"
|
|
117
|
+
type="datetime-local"
|
|
118
|
+
value={freightLocalTime(facts.pricingAt)}
|
|
119
|
+
required
|
|
120
|
+
onChange={(value) => {
|
|
121
|
+
if (value) patch({ pricingAt: freightInstant(value) });
|
|
122
|
+
}}
|
|
123
|
+
/>
|
|
124
|
+
<section className="space-y-4">
|
|
125
|
+
<h3 className="font-semibold">Cost items</h3>
|
|
126
|
+
<p className="text-sm">
|
|
127
|
+
Blank amounts are unknown. Currency codes and decimal places are recorded conventions.
|
|
128
|
+
</p>
|
|
129
|
+
{facts.lines.map((line) => (
|
|
130
|
+
<FreightLineEditor
|
|
131
|
+
key={line.id}
|
|
132
|
+
line={line}
|
|
133
|
+
others={facts.lines}
|
|
134
|
+
onChange={(updated) =>
|
|
135
|
+
patch({ lines: facts.lines.map((item) => (item.id === line.id ? updated : item)) })
|
|
136
|
+
}
|
|
137
|
+
onRemove={() => patch({ lines: facts.lines.filter((item) => item.id !== line.id) })}
|
|
138
|
+
/>
|
|
139
|
+
))}
|
|
140
|
+
<Button
|
|
141
|
+
type="button"
|
|
142
|
+
variant="outline"
|
|
143
|
+
disabled={facts.lines.length >= 100}
|
|
144
|
+
onClick={() => patch({ lines: [...facts.lines, newFreightLine()] })}
|
|
145
|
+
>
|
|
146
|
+
Add cost item
|
|
147
|
+
</Button>
|
|
148
|
+
</section>
|
|
149
|
+
<details className="space-y-4 rounded border p-4">
|
|
150
|
+
<summary className="min-h-11 cursor-pointer font-medium">
|
|
151
|
+
Review cost scope, dates and conversion
|
|
152
|
+
</summary>
|
|
153
|
+
<FreightScopeEditor
|
|
154
|
+
value={facts.requirements}
|
|
155
|
+
onChange={(requirements) => patch({ requirements })}
|
|
156
|
+
/>
|
|
157
|
+
<section className="space-y-3">
|
|
158
|
+
<h3 className="font-semibold">Recorded quote dates</h3>
|
|
159
|
+
{(['quotedAt', 'validFrom', 'validUntil'] as const).map((field) => (
|
|
160
|
+
<FreightText
|
|
161
|
+
key={field}
|
|
162
|
+
label={
|
|
163
|
+
field === 'quotedAt'
|
|
164
|
+
? 'Quote received at'
|
|
165
|
+
: field === 'validFrom'
|
|
166
|
+
? 'Quote valid from'
|
|
167
|
+
: 'Quote valid until'
|
|
168
|
+
}
|
|
169
|
+
type="datetime-local"
|
|
170
|
+
value={facts[field] ? freightLocalTime(facts[field]) : ''}
|
|
171
|
+
onChange={(value) => patch({ [field]: value ? freightInstant(value) : null })}
|
|
172
|
+
/>
|
|
173
|
+
))}
|
|
174
|
+
</section>
|
|
175
|
+
<FreightSelect
|
|
176
|
+
label="Reporting total"
|
|
177
|
+
value={facts.reportingCurrency ? 'RECORDED' : 'UNKNOWN'}
|
|
178
|
+
onChange={(value) =>
|
|
179
|
+
patch({
|
|
180
|
+
reportingCurrency:
|
|
181
|
+
value === 'RECORDED' ? { code: 'USD', minorUnitDigits: 2 } : null,
|
|
182
|
+
})
|
|
183
|
+
}
|
|
184
|
+
>
|
|
185
|
+
<option value="UNKNOWN">No reporting currency yet</option>
|
|
186
|
+
<option value="RECORDED">Use a recorded currency convention</option>
|
|
187
|
+
</FreightSelect>
|
|
188
|
+
{facts.reportingCurrency && (
|
|
189
|
+
<FreightCurrency
|
|
190
|
+
label="Reporting currency convention"
|
|
191
|
+
value={facts.reportingCurrency}
|
|
192
|
+
onChange={(reportingCurrency) => patch({ reportingCurrency })}
|
|
193
|
+
/>
|
|
194
|
+
)}
|
|
195
|
+
<FreightFxEditor value={facts.fx} onChange={(fx) => patch({ fx })} />
|
|
196
|
+
</details>
|
|
197
|
+
<ContainerEvidencePicker
|
|
198
|
+
value={evidence}
|
|
199
|
+
onChange={setEvidence}
|
|
200
|
+
description="Choose the exact source document versions. A readable document supports this reported record; it does not accept a quote or confirm capacity."
|
|
201
|
+
/>
|
|
202
|
+
</fieldset>
|
|
203
|
+
{error && <p role="alert">{error}</p>}
|
|
204
|
+
{currentPreview && (
|
|
205
|
+
<FreightTotals value={currentPreview} currency={facts.reportingCurrency} />
|
|
206
|
+
)}
|
|
207
|
+
<Button
|
|
208
|
+
type="submit"
|
|
209
|
+
disabled={
|
|
210
|
+
disabled ||
|
|
211
|
+
previewing ||
|
|
212
|
+
facts.lines.length === 0 ||
|
|
213
|
+
(!!currentPreview && evidence.length === 0)
|
|
214
|
+
}
|
|
215
|
+
>
|
|
216
|
+
{previewing
|
|
217
|
+
? 'Previewing…'
|
|
218
|
+
: currentPreview
|
|
219
|
+
? 'Save immutable cost version'
|
|
220
|
+
: 'Preview costs and missing facts'}
|
|
221
|
+
</Button>
|
|
222
|
+
</form>
|
|
223
|
+
);
|
|
224
|
+
}
|