@open-mercato/core 0.10.1-develop.7709.1.046124599c → 0.10.1-develop.7714.1.9dbb8200d8
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/.turbo/turbo-build.log +2 -2
- package/dist/generated/entities/asn/index.js +19 -0
- package/dist/generated/entities/asn/index.js.map +7 -0
- package/dist/generated/entities/putaway_task/index.js +25 -0
- package/dist/generated/entities/putaway_task/index.js.map +7 -0
- package/dist/generated/entities/receiving_line/index.js +21 -0
- package/dist/generated/entities/receiving_line/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +4 -1
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +34 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/modules/communication_channels/lib/sanitize-channel-html.js +22 -3
- package/dist/modules/communication_channels/lib/sanitize-channel-html.js.map +2 -2
- package/dist/modules/communication_channels/widgets/injection/channel-payload-renderer/widget.client.js +40 -11
- package/dist/modules/communication_channels/widgets/injection/channel-payload-renderer/widget.client.js.map +2 -2
- package/dist/modules/customers/components/calendar/CalendarEventEditor.js +13 -2
- package/dist/modules/customers/components/calendar/CalendarEventEditor.js.map +2 -2
- package/dist/modules/wms/acl.js +2 -0
- package/dist/modules/wms/acl.js.map +2 -2
- package/dist/modules/wms/api/asns/[id]/complete/route.js +61 -0
- package/dist/modules/wms/api/asns/[id]/complete/route.js.map +7 -0
- package/dist/modules/wms/api/asns/[id]/receive/route.js +68 -0
- package/dist/modules/wms/api/asns/[id]/receive/route.js.map +7 -0
- package/dist/modules/wms/api/asns/route.js +197 -0
- package/dist/modules/wms/api/asns/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/helpers.js +42 -34
- package/dist/modules/wms/api/inventory/helpers.js.map +2 -2
- package/dist/modules/wms/api/inventory/receive/route.js +1 -1
- package/dist/modules/wms/api/inventory/receive/route.js.map +2 -2
- package/dist/modules/wms/api/listEnrichers.js +23 -0
- package/dist/modules/wms/api/listEnrichers.js.map +2 -2
- package/dist/modules/wms/api/putaway-tasks/[id]/assign/route.js +56 -0
- package/dist/modules/wms/api/putaway-tasks/[id]/assign/route.js.map +7 -0
- package/dist/modules/wms/api/putaway-tasks/[id]/cancel/route.js +56 -0
- package/dist/modules/wms/api/putaway-tasks/[id]/cancel/route.js.map +7 -0
- package/dist/modules/wms/api/putaway-tasks/[id]/complete/route.js +65 -0
- package/dist/modules/wms/api/putaway-tasks/[id]/complete/route.js.map +7 -0
- package/dist/modules/wms/api/putaway-tasks/[id]/start/route.js +56 -0
- package/dist/modules/wms/api/putaway-tasks/[id]/start/route.js.map +7 -0
- package/dist/modules/wms/api/putaway-tasks/create-from-balance/route.js +51 -0
- package/dist/modules/wms/api/putaway-tasks/create-from-balance/route.js.map +7 -0
- package/dist/modules/wms/api/putaway-tasks/route.js +192 -0
- package/dist/modules/wms/api/putaway-tasks/route.js.map +7 -0
- package/dist/modules/wms/api/receiving-lines/route.js +180 -0
- package/dist/modules/wms/api/receiving-lines/route.js.map +7 -0
- package/dist/modules/wms/api/scan/putaway/route.js +104 -0
- package/dist/modules/wms/api/scan/putaway/route.js.map +7 -0
- package/dist/modules/wms/api/scan/receive/route.js +109 -0
- package/dist/modules/wms/api/scan/receive/route.js.map +7 -0
- package/dist/modules/wms/api/scan/resolve-location/route.js +89 -0
- package/dist/modules/wms/api/scan/resolve-location/route.js.map +7 -0
- package/dist/modules/wms/api/scan/resolve-lot/route.js +89 -0
- package/dist/modules/wms/api/scan/resolve-lot/route.js.map +7 -0
- package/dist/modules/wms/backend/wms/asns/[id]/page.js +9 -0
- package/dist/modules/wms/backend/wms/asns/[id]/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/asns/[id]/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/asns/[id]/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/asns/page.js +9 -0
- package/dist/modules/wms/backend/wms/asns/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/asns/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/asns/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/putaway/page.js +9 -0
- package/dist/modules/wms/backend/wms/putaway/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/putaway/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/putaway/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/receiving/page.js +8 -0
- package/dist/modules/wms/backend/wms/receiving/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/receiving/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/receiving/page.meta.js.map +7 -0
- package/dist/modules/wms/ce.js +27 -0
- package/dist/modules/wms/ce.js.map +2 -2
- package/dist/modules/wms/commands/asn.js +1746 -0
- package/dist/modules/wms/commands/asn.js.map +7 -0
- package/dist/modules/wms/commands/index.js +2 -0
- package/dist/modules/wms/commands/index.js.map +2 -2
- package/dist/modules/wms/commands/inventory-actions.js +347 -243
- package/dist/modules/wms/commands/inventory-actions.js.map +2 -2
- package/dist/modules/wms/commands/putaway.js +945 -0
- package/dist/modules/wms/commands/putaway.js.map +7 -0
- package/dist/modules/wms/commands/shared.js +51 -0
- package/dist/modules/wms/commands/shared.js.map +2 -2
- package/dist/modules/wms/components/backend/AssignPutawayTaskDialog.js +278 -0
- package/dist/modules/wms/components/backend/AssignPutawayTaskDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/CompletePutawayTaskDialog.js +327 -0
- package/dist/modules/wms/components/backend/CompletePutawayTaskDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/CreateAsnDialog.js +404 -0
- package/dist/modules/wms/components/backend/CreateAsnDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/InventoryOperationsSection.js +16 -3
- package/dist/modules/wms/components/backend/InventoryOperationsSection.js.map +2 -2
- package/dist/modules/wms/components/backend/ReceiveAsnLineDialog.js +476 -0
- package/dist/modules/wms/components/backend/ReceiveAsnLineDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/ReceiveInventoryDialog.js +2 -2
- package/dist/modules/wms/components/backend/ReceiveInventoryDialog.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsAsnDetailPage.js +524 -0
- package/dist/modules/wms/components/backend/WmsAsnDetailPage.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsAsnsListPage.js +339 -0
- package/dist/modules/wms/components/backend/WmsAsnsListPage.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsLocationDetailPage.js +5 -6
- package/dist/modules/wms/components/backend/WmsLocationDetailPage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsLotDetailPage.js +5 -6
- package/dist/modules/wms/components/backend/WmsLotDetailPage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsOperationalDashboardPage.js +14 -10
- package/dist/modules/wms/components/backend/WmsOperationalDashboardPage.js.map +2 -2
- package/dist/modules/wms/components/backend/WmsPutawayQueuePage.js +598 -0
- package/dist/modules/wms/components/backend/WmsPutawayQueuePage.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsSkuDetailPage.js +5 -6
- package/dist/modules/wms/components/backend/WmsSkuDetailPage.js.map +2 -2
- package/dist/modules/wms/components/backend/asnCompleteOptimisticLock.js +32 -0
- package/dist/modules/wms/components/backend/asnCompleteOptimisticLock.js.map +7 -0
- package/dist/modules/wms/components/backend/asnReceivingLinesLoader.js +36 -0
- package/dist/modules/wms/components/backend/asnReceivingLinesLoader.js.map +7 -0
- package/dist/modules/wms/components/backend/inboundStatusUi.js +106 -0
- package/dist/modules/wms/components/backend/inboundStatusUi.js.map +7 -0
- package/dist/modules/wms/components/backend/inventoryMutationLoaders.js +17 -0
- package/dist/modules/wms/components/backend/inventoryMutationLoaders.js.map +2 -2
- package/dist/modules/wms/components/backend/putawayQueueOptimisticLock.js +14 -0
- package/dist/modules/wms/components/backend/putawayQueueOptimisticLock.js.map +7 -0
- package/dist/modules/wms/components/backend/useWmsInventoryMutationAccess.js +4 -0
- package/dist/modules/wms/components/backend/useWmsInventoryMutationAccess.js.map +2 -2
- package/dist/modules/wms/data/enrichers.js +117 -12
- package/dist/modules/wms/data/enrichers.js.map +2 -2
- package/dist/modules/wms/data/entities.js +150 -1
- package/dist/modules/wms/data/entities.js.map +2 -2
- package/dist/modules/wms/data/validators.js +214 -0
- package/dist/modules/wms/data/validators.js.map +2 -2
- package/dist/modules/wms/events.js +12 -1
- package/dist/modules/wms/events.js.map +2 -2
- package/dist/modules/wms/extension-points.js +3 -1
- package/dist/modules/wms/extension-points.js.map +2 -2
- package/dist/modules/wms/lib/asnReceiving.js +124 -0
- package/dist/modules/wms/lib/asnReceiving.js.map +7 -0
- package/dist/modules/wms/lib/asnVendor.js +52 -0
- package/dist/modules/wms/lib/asnVendor.js.map +7 -0
- package/dist/modules/wms/lib/flashMutationError.js +4 -0
- package/dist/modules/wms/lib/flashMutationError.js.map +2 -2
- package/dist/modules/wms/lib/inventoryDisplayUi.js +24 -0
- package/dist/modules/wms/lib/inventoryDisplayUi.js.map +2 -2
- package/dist/modules/wms/lib/inventoryPolicy.js +17 -0
- package/dist/modules/wms/lib/inventoryPolicy.js.map +2 -2
- package/dist/modules/wms/lib/loadOperationalDashboard.js +67 -1
- package/dist/modules/wms/lib/loadOperationalDashboard.js.map +2 -2
- package/dist/modules/wms/lib/putaway.js +141 -0
- package/dist/modules/wms/lib/putaway.js.map +7 -0
- package/dist/modules/wms/lib/roleFeatures.js +3 -1
- package/dist/modules/wms/lib/roleFeatures.js.map +2 -2
- package/dist/modules/wms/lib/salesOrderInventoryAutomation.js +99 -1
- package/dist/modules/wms/lib/salesOrderInventoryAutomation.js.map +2 -2
- package/dist/modules/wms/lib/scanResolve.js +147 -0
- package/dist/modules/wms/lib/scanResolve.js.map +7 -0
- package/dist/modules/wms/lib/wmsIntegrationToggles.js +1 -1
- package/dist/modules/wms/lib/wmsIntegrationToggles.js.map +2 -2
- package/dist/modules/wms/migrations/Migration20260812120000.js +43 -0
- package/dist/modules/wms/migrations/Migration20260812120000.js.map +7 -0
- package/dist/modules/wms/migrations/Migration20260812130000.js +30 -0
- package/dist/modules/wms/migrations/Migration20260812130000.js.map +7 -0
- package/dist/modules/wms/migrations/Migration20260822120000.js +17 -0
- package/dist/modules/wms/migrations/Migration20260822120000.js.map +7 -0
- package/dist/modules/wms/migrations/Migration20260822130000.js +17 -0
- package/dist/modules/wms/migrations/Migration20260822130000.js.map +7 -0
- package/dist/modules/wms/migrations/Migration20261029120000.js +13 -0
- package/dist/modules/wms/migrations/Migration20261029120000.js.map +7 -0
- package/dist/modules/wms/search.js +85 -0
- package/dist/modules/wms/search.js.map +2 -2
- package/dist/modules/wms/subscribers/asn-line-received-reevaluate-reservations.js +14 -0
- package/dist/modules/wms/subscribers/asn-line-received-reevaluate-reservations.js.map +7 -0
- package/dist/modules/wms/subscribers/invalidate-enricher-cache-asn.js +12 -0
- package/dist/modules/wms/subscribers/invalidate-enricher-cache-asn.js.map +7 -0
- package/dist/modules/wms/subscribers/procurement-goods-receipt-created.js +163 -0
- package/dist/modules/wms/subscribers/procurement-goods-receipt-created.js.map +7 -0
- package/dist/modules/wms/subscribers/putaway-completed-reevaluate-reservations.js +14 -0
- package/dist/modules/wms/subscribers/putaway-completed-reevaluate-reservations.js.map +7 -0
- package/dist/modules/wms/widgets/injection/sales-order-stock-context/widget.client.js +37 -8
- package/dist/modules/wms/widgets/injection/sales-order-stock-context/widget.client.js.map +2 -2
- package/generated/entities/asn/index.ts +8 -0
- package/generated/entities/putaway_task/index.ts +11 -0
- package/generated/entities/receiving_line/index.ts +9 -0
- package/generated/entities.ids.generated.ts +4 -1
- package/generated/entity-fields-registry.ts +34 -0
- package/package.json +7 -7
- package/src/modules/auth/i18n/de.json +2 -0
- package/src/modules/auth/i18n/en.json +2 -0
- package/src/modules/auth/i18n/es.json +2 -0
- package/src/modules/auth/i18n/ko.json +2 -0
- package/src/modules/auth/i18n/pl.json +2 -0
- package/src/modules/communication_channels/i18n/de.json +2 -0
- package/src/modules/communication_channels/i18n/en.json +2 -0
- package/src/modules/communication_channels/i18n/es.json +2 -0
- package/src/modules/communication_channels/i18n/ko.json +2 -0
- package/src/modules/communication_channels/i18n/pl.json +2 -0
- package/src/modules/communication_channels/lib/sanitize-channel-html.ts +23 -3
- package/src/modules/communication_channels/widgets/injection/channel-payload-renderer/widget.client.tsx +44 -12
- package/src/modules/customers/components/calendar/CalendarEventEditor.tsx +16 -2
- package/src/modules/wms/acl.ts +2 -0
- package/src/modules/wms/api/asns/[id]/complete/route.ts +62 -0
- package/src/modules/wms/api/asns/[id]/receive/route.ts +74 -0
- package/src/modules/wms/api/asns/route.ts +200 -0
- package/src/modules/wms/api/inventory/helpers.ts +57 -34
- package/src/modules/wms/api/inventory/receive/route.ts +2 -1
- package/src/modules/wms/api/listEnrichers.ts +38 -0
- package/src/modules/wms/api/putaway-tasks/[id]/assign/route.ts +56 -0
- package/src/modules/wms/api/putaway-tasks/[id]/cancel/route.ts +56 -0
- package/src/modules/wms/api/putaway-tasks/[id]/complete/route.ts +66 -0
- package/src/modules/wms/api/putaway-tasks/[id]/start/route.ts +56 -0
- package/src/modules/wms/api/putaway-tasks/create-from-balance/route.ts +50 -0
- package/src/modules/wms/api/putaway-tasks/route.ts +199 -0
- package/src/modules/wms/api/receiving-lines/route.ts +180 -0
- package/src/modules/wms/api/scan/putaway/route.ts +108 -0
- package/src/modules/wms/api/scan/receive/route.ts +118 -0
- package/src/modules/wms/api/scan/resolve-location/route.ts +92 -0
- package/src/modules/wms/api/scan/resolve-lot/route.ts +92 -0
- package/src/modules/wms/backend/wms/asns/[id]/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/asns/[id]/page.tsx +5 -0
- package/src/modules/wms/backend/wms/asns/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/asns/page.tsx +5 -0
- package/src/modules/wms/backend/wms/putaway/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/putaway/page.tsx +5 -0
- package/src/modules/wms/backend/wms/receiving/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/receiving/page.tsx +5 -0
- package/src/modules/wms/ce.ts +27 -0
- package/src/modules/wms/commands/asn.ts +2122 -0
- package/src/modules/wms/commands/index.ts +2 -0
- package/src/modules/wms/commands/inventory-actions.ts +413 -243
- package/src/modules/wms/commands/putaway.ts +1169 -0
- package/src/modules/wms/commands/shared.ts +51 -0
- package/src/modules/wms/components/backend/AssignPutawayTaskDialog.tsx +328 -0
- package/src/modules/wms/components/backend/CompletePutawayTaskDialog.tsx +366 -0
- package/src/modules/wms/components/backend/CreateAsnDialog.tsx +427 -0
- package/src/modules/wms/components/backend/InventoryOperationsSection.tsx +20 -2
- package/src/modules/wms/components/backend/ReceiveAsnLineDialog.tsx +535 -0
- package/src/modules/wms/components/backend/ReceiveInventoryDialog.tsx +2 -2
- package/src/modules/wms/components/backend/WmsAsnDetailPage.tsx +647 -0
- package/src/modules/wms/components/backend/WmsAsnsListPage.tsx +407 -0
- package/src/modules/wms/components/backend/WmsLocationDetailPage.tsx +4 -5
- package/src/modules/wms/components/backend/WmsLotDetailPage.tsx +4 -5
- package/src/modules/wms/components/backend/WmsOperationalDashboardPage.tsx +12 -8
- package/src/modules/wms/components/backend/WmsPutawayQueuePage.tsx +677 -0
- package/src/modules/wms/components/backend/WmsSkuDetailPage.tsx +4 -5
- package/src/modules/wms/components/backend/asnCompleteOptimisticLock.ts +52 -0
- package/src/modules/wms/components/backend/asnReceivingLinesLoader.ts +83 -0
- package/src/modules/wms/components/backend/inboundStatusUi.ts +154 -0
- package/src/modules/wms/components/backend/inventoryMutationLoaders.ts +20 -0
- package/src/modules/wms/components/backend/putawayQueueOptimisticLock.ts +20 -0
- package/src/modules/wms/components/backend/useWmsInventoryMutationAccess.ts +4 -0
- package/src/modules/wms/data/enrichers.ts +175 -13
- package/src/modules/wms/data/entities.ts +155 -0
- package/src/modules/wms/data/validators.ts +256 -0
- package/src/modules/wms/events.ts +11 -0
- package/src/modules/wms/extension-points.ts +2 -0
- package/src/modules/wms/i18n/de.json +205 -3
- package/src/modules/wms/i18n/en.json +205 -3
- package/src/modules/wms/i18n/es.json +205 -3
- package/src/modules/wms/i18n/ko.json +205 -3
- package/src/modules/wms/i18n/pl.json +205 -3
- package/src/modules/wms/lib/asnReceiving.ts +226 -0
- package/src/modules/wms/lib/asnVendor.ts +80 -0
- package/src/modules/wms/lib/flashMutationError.ts +4 -0
- package/src/modules/wms/lib/inventoryDisplayUi.ts +46 -0
- package/src/modules/wms/lib/inventoryPolicy.ts +31 -1
- package/src/modules/wms/lib/loadOperationalDashboard.ts +89 -1
- package/src/modules/wms/lib/putaway.ts +210 -0
- package/src/modules/wms/lib/roleFeatures.ts +2 -0
- package/src/modules/wms/lib/salesOrderInventoryAutomation.ts +150 -1
- package/src/modules/wms/lib/scanResolve.ts +185 -0
- package/src/modules/wms/lib/wmsIntegrationToggles.ts +2 -1
- package/src/modules/wms/migrations/.snapshot-open-mercato.json +1000 -0
- package/src/modules/wms/migrations/Migration20260812120000.ts +43 -0
- package/src/modules/wms/migrations/Migration20260812130000.ts +28 -0
- package/src/modules/wms/migrations/Migration20260822120000.ts +17 -0
- package/src/modules/wms/migrations/Migration20260822130000.ts +15 -0
- package/src/modules/wms/migrations/Migration20261029120000.ts +11 -0
- package/src/modules/wms/search.ts +95 -0
- package/src/modules/wms/subscribers/asn-line-received-reevaluate-reservations.ts +21 -0
- package/src/modules/wms/subscribers/invalidate-enricher-cache-asn.ts +12 -0
- package/src/modules/wms/subscribers/procurement-goods-receipt-created.ts +238 -0
- package/src/modules/wms/subscribers/putaway-completed-reevaluate-reservations.ts +21 -0
- package/src/modules/wms/widgets/injection/sales-order-stock-context/widget.client.tsx +63 -13
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import { flash } from "@open-mercato/ui/backend/FlashMessages";
|
|
7
|
+
import { flashMutationError } from "../../lib/flashMutationError.js";
|
|
8
|
+
import { useGuardedMutation } from "@open-mercato/ui/backend/injection/useGuardedMutation";
|
|
9
|
+
import { ComboboxInput } from "@open-mercato/ui/backend/inputs/ComboboxInput";
|
|
10
|
+
import { apiCall } from "@open-mercato/ui/backend/utils/apiCall";
|
|
11
|
+
import {
|
|
12
|
+
buildOptimisticLockHeader,
|
|
13
|
+
extractOptimisticLockConflict
|
|
14
|
+
} from "@open-mercato/ui/backend/utils/optimisticLock";
|
|
15
|
+
import { raiseCrudError } from "@open-mercato/ui/backend/utils/serverErrors";
|
|
16
|
+
import { surfaceRecordConflict } from "@open-mercato/ui/backend/conflicts";
|
|
17
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
18
|
+
import {
|
|
19
|
+
Dialog,
|
|
20
|
+
DialogContent,
|
|
21
|
+
DialogDescription,
|
|
22
|
+
DialogFooter,
|
|
23
|
+
DialogHeader,
|
|
24
|
+
DialogTitle
|
|
25
|
+
} from "@open-mercato/ui/primitives/dialog";
|
|
26
|
+
import { FormField } from "@open-mercato/ui/primitives/form-field";
|
|
27
|
+
import { Input } from "@open-mercato/ui/primitives/input";
|
|
28
|
+
import { KbdShortcut } from "@open-mercato/ui/primitives/kbd";
|
|
29
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
30
|
+
import {
|
|
31
|
+
loadBinLocationOptions,
|
|
32
|
+
resolveLocationLabel
|
|
33
|
+
} from "./inventoryMutationLoaders.js";
|
|
34
|
+
const formSchema = z.object({
|
|
35
|
+
confirmedQuantity: z.number().positive(),
|
|
36
|
+
targetLocationId: z.string().uuid()
|
|
37
|
+
});
|
|
38
|
+
function CompletePutawayTaskDialog({
|
|
39
|
+
open,
|
|
40
|
+
onOpenChange,
|
|
41
|
+
access,
|
|
42
|
+
task,
|
|
43
|
+
onSuccess
|
|
44
|
+
}) {
|
|
45
|
+
const t = useT();
|
|
46
|
+
const queryClient = useQueryClient();
|
|
47
|
+
const { runMutation, retryLastMutation } = useGuardedMutation({
|
|
48
|
+
contextId: "wms-putaway-complete"
|
|
49
|
+
});
|
|
50
|
+
const mutationContext = React.useMemo(
|
|
51
|
+
() => ({ retryLastMutation }),
|
|
52
|
+
[retryLastMutation]
|
|
53
|
+
);
|
|
54
|
+
const [confirmedQuantity, setConfirmedQuantity] = React.useState(1);
|
|
55
|
+
const [targetLocationId, setTargetLocationId] = React.useState("");
|
|
56
|
+
const [serialConfirmation, setSerialConfirmation] = React.useState("");
|
|
57
|
+
const [fieldErrors, setFieldErrors] = React.useState({});
|
|
58
|
+
const [submitting, setSubmitting] = React.useState(false);
|
|
59
|
+
const [lockUpdatedAt, setLockUpdatedAt] = React.useState(null);
|
|
60
|
+
const lockUpdatedAtRef = React.useRef(null);
|
|
61
|
+
const closeDialog = React.useCallback(() => {
|
|
62
|
+
if (submitting) return;
|
|
63
|
+
onOpenChange(false);
|
|
64
|
+
}, [onOpenChange, submitting]);
|
|
65
|
+
const warehouseId = task?.warehouseId?.trim() || "";
|
|
66
|
+
const expectedSerial = task?.serialNumber?.trim() ?? "";
|
|
67
|
+
const loadTargetLocationSuggestions = React.useCallback(
|
|
68
|
+
async (query) => warehouseId ? loadBinLocationOptions(warehouseId, query) : [],
|
|
69
|
+
[warehouseId]
|
|
70
|
+
);
|
|
71
|
+
const resolveTargetLocationLabel = React.useCallback(
|
|
72
|
+
async (value) => await resolveLocationLabel(value) ?? value,
|
|
73
|
+
[]
|
|
74
|
+
);
|
|
75
|
+
React.useEffect(() => {
|
|
76
|
+
if (!open || !task) return;
|
|
77
|
+
setConfirmedQuantity(task.quantity > 0 ? task.quantity : 1);
|
|
78
|
+
setTargetLocationId(task.targetLocationId?.trim() || "");
|
|
79
|
+
setSerialConfirmation("");
|
|
80
|
+
setFieldErrors({});
|
|
81
|
+
setSubmitting(false);
|
|
82
|
+
const seed = task.updatedAt ?? null;
|
|
83
|
+
lockUpdatedAtRef.current = seed;
|
|
84
|
+
setLockUpdatedAt(seed);
|
|
85
|
+
}, [open, task]);
|
|
86
|
+
const handleSubmit = React.useCallback(
|
|
87
|
+
async (event) => {
|
|
88
|
+
event?.preventDefault();
|
|
89
|
+
if (!task) return;
|
|
90
|
+
if (!access.scopeReady || !access.organizationId || !access.tenantId || !access.userId) {
|
|
91
|
+
flash(
|
|
92
|
+
t(
|
|
93
|
+
"wms.backend.inventory.mutations.errors.scope",
|
|
94
|
+
"Select an organization and sign in before posting inventory changes."
|
|
95
|
+
),
|
|
96
|
+
"error"
|
|
97
|
+
);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const parsed = formSchema.safeParse({
|
|
101
|
+
confirmedQuantity,
|
|
102
|
+
targetLocationId: targetLocationId.trim()
|
|
103
|
+
});
|
|
104
|
+
const nextErrors = {};
|
|
105
|
+
if (!parsed.success) {
|
|
106
|
+
for (const issue of parsed.error.issues) {
|
|
107
|
+
const key = String(issue.path[0] ?? "form");
|
|
108
|
+
if (!nextErrors[key]) nextErrors[key] = t(issue.message, issue.message);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (expectedSerial && serialConfirmation.trim() !== expectedSerial) {
|
|
112
|
+
nextErrors.serialConfirmation = t(
|
|
113
|
+
"wms.backend.putaway.complete.errors.serialMismatch",
|
|
114
|
+
"The scanned serial does not match this task."
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
if (!parsed.success || nextErrors.serialConfirmation) {
|
|
118
|
+
setFieldErrors(nextErrors);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
setSubmitting(true);
|
|
122
|
+
setFieldErrors({});
|
|
123
|
+
const payload = {
|
|
124
|
+
organizationId: access.organizationId,
|
|
125
|
+
tenantId: access.tenantId,
|
|
126
|
+
confirmedQuantity: parsed.data.confirmedQuantity,
|
|
127
|
+
targetLocationId: parsed.data.targetLocationId,
|
|
128
|
+
performedBy: access.userId
|
|
129
|
+
};
|
|
130
|
+
try {
|
|
131
|
+
let conflictHandled = false;
|
|
132
|
+
await runMutation({
|
|
133
|
+
operation: async () => {
|
|
134
|
+
const call = await apiCall(
|
|
135
|
+
`/api/wms/putaway-tasks/${encodeURIComponent(task.id)}/complete`,
|
|
136
|
+
{
|
|
137
|
+
method: "POST",
|
|
138
|
+
headers: {
|
|
139
|
+
"content-type": "application/json",
|
|
140
|
+
...buildOptimisticLockHeader(lockUpdatedAtRef.current ?? void 0)
|
|
141
|
+
},
|
|
142
|
+
body: JSON.stringify(payload)
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
if (!call.ok) {
|
|
146
|
+
const refreshLockFromConflict = () => {
|
|
147
|
+
const conflict = extractOptimisticLockConflict({
|
|
148
|
+
status: call.status,
|
|
149
|
+
body: call.result
|
|
150
|
+
});
|
|
151
|
+
if (conflict?.currentUpdatedAt) {
|
|
152
|
+
lockUpdatedAtRef.current = conflict.currentUpdatedAt;
|
|
153
|
+
setLockUpdatedAt(conflict.currentUpdatedAt);
|
|
154
|
+
}
|
|
155
|
+
void queryClient.invalidateQueries({ queryKey: ["wms-putaway-queue"] });
|
|
156
|
+
};
|
|
157
|
+
if (surfaceRecordConflict({ status: call.status, body: call.result }, t, {
|
|
158
|
+
onRefresh: refreshLockFromConflict
|
|
159
|
+
})) {
|
|
160
|
+
refreshLockFromConflict();
|
|
161
|
+
conflictHandled = true;
|
|
162
|
+
return {};
|
|
163
|
+
}
|
|
164
|
+
await raiseCrudError(
|
|
165
|
+
call.response,
|
|
166
|
+
t("wms.backend.putaway.complete.errors.submit", "Failed to complete putaway task.")
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
return call.result ?? {};
|
|
170
|
+
},
|
|
171
|
+
context: mutationContext,
|
|
172
|
+
mutationPayload: payload
|
|
173
|
+
});
|
|
174
|
+
if (conflictHandled) return;
|
|
175
|
+
flash(t("wms.backend.putaway.complete.flash.success", "Putaway completed"), "success");
|
|
176
|
+
await queryClient.invalidateQueries({ queryKey: ["wms-putaway-queue"] });
|
|
177
|
+
closeDialog();
|
|
178
|
+
onSuccess?.();
|
|
179
|
+
} catch (error) {
|
|
180
|
+
flashMutationError(
|
|
181
|
+
error,
|
|
182
|
+
t("wms.backend.putaway.complete.errors.submit", "Failed to complete putaway task."),
|
|
183
|
+
t
|
|
184
|
+
);
|
|
185
|
+
} finally {
|
|
186
|
+
setSubmitting(false);
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
[
|
|
190
|
+
access,
|
|
191
|
+
closeDialog,
|
|
192
|
+
confirmedQuantity,
|
|
193
|
+
expectedSerial,
|
|
194
|
+
lockUpdatedAt,
|
|
195
|
+
serialConfirmation,
|
|
196
|
+
mutationContext,
|
|
197
|
+
onSuccess,
|
|
198
|
+
queryClient,
|
|
199
|
+
runMutation,
|
|
200
|
+
t,
|
|
201
|
+
targetLocationId,
|
|
202
|
+
task
|
|
203
|
+
]
|
|
204
|
+
);
|
|
205
|
+
const handleKeyDown = React.useCallback(
|
|
206
|
+
(event) => {
|
|
207
|
+
if (event.key === "Escape") {
|
|
208
|
+
event.preventDefault();
|
|
209
|
+
closeDialog();
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if ((event.metaKey || event.ctrlKey) && event.key === "Enter") {
|
|
213
|
+
event.preventDefault();
|
|
214
|
+
if (!submitting) void handleSubmit();
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
[closeDialog, handleSubmit, submitting]
|
|
218
|
+
);
|
|
219
|
+
if (!task) return null;
|
|
220
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (next) => next ? onOpenChange(true) : closeDialog(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-lg gap-0 overflow-hidden p-0", onKeyDown: handleKeyDown, children: [
|
|
221
|
+
/* @__PURE__ */ jsx("div", { className: "border-b px-6 py-4 pr-12", children: /* @__PURE__ */ jsxs(DialogHeader, { className: "space-y-1 text-left", children: [
|
|
222
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: t("wms.backend.putaway.complete.dialog.title", "Complete putaway") }),
|
|
223
|
+
/* @__PURE__ */ jsx(DialogDescription, { children: t(
|
|
224
|
+
"wms.backend.putaway.complete.dialog.description",
|
|
225
|
+
"Confirm quantity and destination bin to move stock from staging."
|
|
226
|
+
) })
|
|
227
|
+
] }) }),
|
|
228
|
+
/* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "flex min-h-0 flex-1 flex-col", children: [
|
|
229
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5 overflow-y-auto px-6 py-6", children: [
|
|
230
|
+
expectedSerial ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
231
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", "data-testid": "complete-putaway-expected-serial", children: [
|
|
232
|
+
t("wms.backend.putaway.complete.form.serial", "Serial"),
|
|
233
|
+
": ",
|
|
234
|
+
expectedSerial
|
|
235
|
+
] }),
|
|
236
|
+
/* @__PURE__ */ jsx(
|
|
237
|
+
FormField,
|
|
238
|
+
{
|
|
239
|
+
label: t("wms.backend.putaway.complete.form.serialConfirm", "Confirm serial"),
|
|
240
|
+
required: true,
|
|
241
|
+
disabled: submitting,
|
|
242
|
+
error: fieldErrors.serialConfirmation,
|
|
243
|
+
description: t(
|
|
244
|
+
"wms.backend.putaway.complete.form.serialConfirmHint",
|
|
245
|
+
"Scan or type the serial on the unit. It must match this task."
|
|
246
|
+
),
|
|
247
|
+
children: /* @__PURE__ */ jsx(
|
|
248
|
+
Input,
|
|
249
|
+
{
|
|
250
|
+
value: serialConfirmation,
|
|
251
|
+
onChange: (event) => setSerialConfirmation(event.target.value),
|
|
252
|
+
"data-testid": "complete-putaway-serial"
|
|
253
|
+
}
|
|
254
|
+
)
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
] }) : null,
|
|
258
|
+
/* @__PURE__ */ jsx(
|
|
259
|
+
FormField,
|
|
260
|
+
{
|
|
261
|
+
label: t("wms.backend.putaway.complete.form.quantity", "Confirmed quantity"),
|
|
262
|
+
required: true,
|
|
263
|
+
error: fieldErrors.confirmedQuantity,
|
|
264
|
+
children: /* @__PURE__ */ jsx(
|
|
265
|
+
Input,
|
|
266
|
+
{
|
|
267
|
+
type: "number",
|
|
268
|
+
min: 1e-4,
|
|
269
|
+
step: "any",
|
|
270
|
+
value: confirmedQuantity,
|
|
271
|
+
onChange: (event) => setConfirmedQuantity(Number(event.target.value)),
|
|
272
|
+
disabled: submitting,
|
|
273
|
+
"data-testid": "complete-putaway-qty"
|
|
274
|
+
}
|
|
275
|
+
)
|
|
276
|
+
}
|
|
277
|
+
),
|
|
278
|
+
/* @__PURE__ */ jsx(
|
|
279
|
+
FormField,
|
|
280
|
+
{
|
|
281
|
+
label: t("wms.backend.putaway.complete.form.target", "Target location"),
|
|
282
|
+
required: true,
|
|
283
|
+
error: fieldErrors.targetLocationId,
|
|
284
|
+
children: /* @__PURE__ */ jsx(
|
|
285
|
+
ComboboxInput,
|
|
286
|
+
{
|
|
287
|
+
value: targetLocationId,
|
|
288
|
+
onChange: setTargetLocationId,
|
|
289
|
+
loadSuggestions: loadTargetLocationSuggestions,
|
|
290
|
+
resolveLabel: resolveTargetLocationLabel,
|
|
291
|
+
placeholder: t(
|
|
292
|
+
"wms.backend.putaway.complete.form.targetPlaceholder",
|
|
293
|
+
"Select destination bin"
|
|
294
|
+
),
|
|
295
|
+
allowCustomValues: false,
|
|
296
|
+
disabled: submitting
|
|
297
|
+
}
|
|
298
|
+
)
|
|
299
|
+
}
|
|
300
|
+
)
|
|
301
|
+
] }),
|
|
302
|
+
/* @__PURE__ */ jsxs(DialogFooter, { bordered: false, className: "border-t px-6 py-4 sm:justify-between", children: [
|
|
303
|
+
/* @__PURE__ */ jsxs("span", { className: "hidden text-xs text-muted-foreground sm:inline", children: [
|
|
304
|
+
/* @__PURE__ */ jsx(KbdShortcut, { keys: ["Ctrl/\u2318", "Enter"] }),
|
|
305
|
+
" ",
|
|
306
|
+
t("wms.backend.putaway.complete.dialog.shortcutHint", "to complete")
|
|
307
|
+
] }),
|
|
308
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
309
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: closeDialog, disabled: submitting, children: t("wms.backend.putaway.complete.dialog.cancel", "Cancel") }),
|
|
310
|
+
/* @__PURE__ */ jsx(
|
|
311
|
+
Button,
|
|
312
|
+
{
|
|
313
|
+
type: "submit",
|
|
314
|
+
disabled: submitting || access.loading || !access.scopeReady,
|
|
315
|
+
"data-testid": "complete-putaway-submit",
|
|
316
|
+
children: t("wms.backend.putaway.complete.dialog.submit", "Complete putaway")
|
|
317
|
+
}
|
|
318
|
+
)
|
|
319
|
+
] })
|
|
320
|
+
] })
|
|
321
|
+
] })
|
|
322
|
+
] }) });
|
|
323
|
+
}
|
|
324
|
+
export {
|
|
325
|
+
CompletePutawayTaskDialog
|
|
326
|
+
};
|
|
327
|
+
//# sourceMappingURL=CompletePutawayTaskDialog.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/modules/wms/components/backend/CompletePutawayTaskDialog.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { z } from 'zod'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { flashMutationError } from '../../lib/flashMutationError'\nimport { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'\nimport { ComboboxInput } from '@open-mercato/ui/backend/inputs/ComboboxInput'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport {\n buildOptimisticLockHeader,\n extractOptimisticLockConflict,\n} from '@open-mercato/ui/backend/utils/optimisticLock'\nimport { raiseCrudError } from '@open-mercato/ui/backend/utils/serverErrors'\nimport { surfaceRecordConflict } from '@open-mercato/ui/backend/conflicts'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '@open-mercato/ui/primitives/dialog'\nimport { FormField } from '@open-mercato/ui/primitives/form-field'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { KbdShortcut } from '@open-mercato/ui/primitives/kbd'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport {\n loadBinLocationOptions,\n resolveLocationLabel,\n} from './inventoryMutationLoaders'\nimport type { WmsInventoryMutationAccess } from './useWmsInventoryMutationAccess'\n\nexport type PutawayTaskTarget = {\n id: string\n warehouseId: string\n quantity: number\n targetLocationId?: string | null\n catalogVariantId?: string | null\n sourceLocationId?: string | null\n serialNumber?: string | null\n updatedAt?: string | null\n}\n\ntype CompletePutawayTaskDialogProps = {\n open: boolean\n onOpenChange: (open: boolean) => void\n access: WmsInventoryMutationAccess\n task: PutawayTaskTarget | null\n onSuccess?: () => void\n}\n\nconst formSchema = z.object({\n confirmedQuantity: z.number().positive(),\n targetLocationId: z.string().uuid(),\n})\n\nexport function CompletePutawayTaskDialog({\n open,\n onOpenChange,\n access,\n task,\n onSuccess,\n}: CompletePutawayTaskDialogProps) {\n const t = useT()\n const queryClient = useQueryClient()\n const { runMutation, retryLastMutation } = useGuardedMutation<{\n retryLastMutation: () => Promise<boolean>\n }>({\n contextId: 'wms-putaway-complete',\n })\n const mutationContext = React.useMemo(\n () => ({ retryLastMutation }),\n [retryLastMutation],\n )\n\n const [confirmedQuantity, setConfirmedQuantity] = React.useState(1)\n const [targetLocationId, setTargetLocationId] = React.useState('')\n const [serialConfirmation, setSerialConfirmation] = React.useState('')\n const [fieldErrors, setFieldErrors] = React.useState<Record<string, string>>({})\n const [submitting, setSubmitting] = React.useState(false)\n const [lockUpdatedAt, setLockUpdatedAt] = React.useState<string | null>(null)\n /** Fresh If-Match after 409; ref so guarded retry reads latest without re-seed. */\n const lockUpdatedAtRef = React.useRef<string | null>(null)\n\n const closeDialog = React.useCallback(() => {\n if (submitting) return\n onOpenChange(false)\n }, [onOpenChange, submitting])\n\n const warehouseId = task?.warehouseId?.trim() || ''\n const expectedSerial = task?.serialNumber?.trim() ?? ''\n\n // Stable identity so ComboboxInput's debounced suggestion effect is not torn\n // down on every parent re-render (queue refetch / access churn) \u2014 an inline\n // arrow would recreate each render and can starve the fetch, leaving the\n // portaled list stuck on \"Loading suggestions\u2026\" with no selectable options.\n const loadTargetLocationSuggestions = React.useCallback(\n async (query?: string) => (warehouseId ? loadBinLocationOptions(warehouseId, query) : []),\n [warehouseId],\n )\n\n const resolveTargetLocationLabel = React.useCallback(\n async (value: string) => (await resolveLocationLabel(value)) ?? value,\n [],\n )\n\n React.useEffect(() => {\n if (!open || !task) return\n setConfirmedQuantity(task.quantity > 0 ? task.quantity : 1)\n setTargetLocationId(task.targetLocationId?.trim() || '')\n setSerialConfirmation('')\n setFieldErrors({})\n setSubmitting(false)\n const seed = task.updatedAt ?? null\n lockUpdatedAtRef.current = seed\n setLockUpdatedAt(seed)\n }, [open, task])\n\n const handleSubmit = React.useCallback(\n async (event?: React.FormEvent) => {\n event?.preventDefault()\n if (!task) return\n if (!access.scopeReady || !access.organizationId || !access.tenantId || !access.userId) {\n flash(\n t(\n 'wms.backend.inventory.mutations.errors.scope',\n 'Select an organization and sign in before posting inventory changes.',\n ),\n 'error',\n )\n return\n }\n\n const parsed = formSchema.safeParse({\n confirmedQuantity,\n targetLocationId: targetLocationId.trim(),\n })\n const nextErrors: Record<string, string> = {}\n if (!parsed.success) {\n for (const issue of parsed.error.issues) {\n const key = String(issue.path[0] ?? 'form')\n if (!nextErrors[key]) nextErrors[key] = t(issue.message, issue.message)\n }\n }\n if (expectedSerial && serialConfirmation.trim() !== expectedSerial) {\n nextErrors.serialConfirmation = t(\n 'wms.backend.putaway.complete.errors.serialMismatch',\n 'The scanned serial does not match this task.',\n )\n }\n if (!parsed.success || nextErrors.serialConfirmation) {\n setFieldErrors(nextErrors)\n return\n }\n\n setSubmitting(true)\n setFieldErrors({})\n const payload = {\n organizationId: access.organizationId,\n tenantId: access.tenantId,\n confirmedQuantity: parsed.data.confirmedQuantity,\n targetLocationId: parsed.data.targetLocationId,\n performedBy: access.userId,\n }\n\n try {\n let conflictHandled = false\n await runMutation({\n operation: async () => {\n const call = await apiCall<{ ok?: boolean }>(\n `/api/wms/putaway-tasks/${encodeURIComponent(task.id)}/complete`,\n {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n ...buildOptimisticLockHeader(lockUpdatedAtRef.current ?? undefined),\n },\n body: JSON.stringify(payload),\n },\n )\n if (!call.ok) {\n const refreshLockFromConflict = () => {\n const conflict = extractOptimisticLockConflict({\n status: call.status,\n body: call.result,\n })\n if (conflict?.currentUpdatedAt) {\n lockUpdatedAtRef.current = conflict.currentUpdatedAt\n setLockUpdatedAt(conflict.currentUpdatedAt)\n }\n void queryClient.invalidateQueries({ queryKey: ['wms-putaway-queue'] })\n }\n if (\n surfaceRecordConflict({ status: call.status, body: call.result }, t, {\n onRefresh: refreshLockFromConflict,\n })\n ) {\n refreshLockFromConflict()\n conflictHandled = true\n return {}\n }\n await raiseCrudError(\n call.response,\n t('wms.backend.putaway.complete.errors.submit', 'Failed to complete putaway task.'),\n )\n }\n return call.result ?? {}\n },\n context: mutationContext,\n mutationPayload: payload,\n })\n\n if (conflictHandled) return\n\n flash(t('wms.backend.putaway.complete.flash.success', 'Putaway completed'), 'success')\n await queryClient.invalidateQueries({ queryKey: ['wms-putaway-queue'] })\n closeDialog()\n onSuccess?.()\n } catch (error) {\n flashMutationError(\n error,\n t('wms.backend.putaway.complete.errors.submit', 'Failed to complete putaway task.'),\n t,\n )\n } finally {\n setSubmitting(false)\n }\n },\n [\n access,\n closeDialog,\n confirmedQuantity,\n expectedSerial,\n lockUpdatedAt,\n serialConfirmation,\n mutationContext,\n onSuccess,\n queryClient,\n runMutation,\n t,\n targetLocationId,\n task,\n ],\n )\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Escape') {\n event.preventDefault()\n closeDialog()\n return\n }\n if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') {\n event.preventDefault()\n if (!submitting) void handleSubmit()\n }\n },\n [closeDialog, handleSubmit, submitting],\n )\n\n if (!task) return null\n\n return (\n <Dialog open={open} onOpenChange={(next) => (next ? onOpenChange(true) : closeDialog())}>\n <DialogContent className=\"max-w-lg gap-0 overflow-hidden p-0\" onKeyDown={handleKeyDown}>\n <div className=\"border-b px-6 py-4 pr-12\">\n <DialogHeader className=\"space-y-1 text-left\">\n <DialogTitle>\n {t('wms.backend.putaway.complete.dialog.title', 'Complete putaway')}\n </DialogTitle>\n <DialogDescription>\n {t(\n 'wms.backend.putaway.complete.dialog.description',\n 'Confirm quantity and destination bin to move stock from staging.',\n )}\n </DialogDescription>\n </DialogHeader>\n </div>\n\n <form onSubmit={handleSubmit} className=\"flex min-h-0 flex-1 flex-col\">\n <div className=\"flex flex-col gap-5 overflow-y-auto px-6 py-6\">\n {expectedSerial ? (\n <>\n <p className=\"text-sm text-muted-foreground\" data-testid=\"complete-putaway-expected-serial\">\n {t('wms.backend.putaway.complete.form.serial', 'Serial')}: {expectedSerial}\n </p>\n <FormField\n label={t('wms.backend.putaway.complete.form.serialConfirm', 'Confirm serial')}\n required\n disabled={submitting}\n error={fieldErrors.serialConfirmation}\n description={t(\n 'wms.backend.putaway.complete.form.serialConfirmHint',\n 'Scan or type the serial on the unit. It must match this task.',\n )}\n >\n <Input\n value={serialConfirmation}\n onChange={(event) => setSerialConfirmation(event.target.value)}\n data-testid=\"complete-putaway-serial\"\n />\n </FormField>\n </>\n ) : null}\n <FormField\n label={t('wms.backend.putaway.complete.form.quantity', 'Confirmed quantity')}\n required\n error={fieldErrors.confirmedQuantity}\n >\n <Input\n type=\"number\"\n min={0.0001}\n step=\"any\"\n value={confirmedQuantity}\n onChange={(event) => setConfirmedQuantity(Number(event.target.value))}\n disabled={submitting}\n data-testid=\"complete-putaway-qty\"\n />\n </FormField>\n\n <FormField\n label={t('wms.backend.putaway.complete.form.target', 'Target location')}\n required\n error={fieldErrors.targetLocationId}\n >\n <ComboboxInput\n value={targetLocationId}\n onChange={setTargetLocationId}\n loadSuggestions={loadTargetLocationSuggestions}\n resolveLabel={resolveTargetLocationLabel}\n placeholder={t(\n 'wms.backend.putaway.complete.form.targetPlaceholder',\n 'Select destination bin',\n )}\n allowCustomValues={false}\n disabled={submitting}\n />\n </FormField>\n </div>\n\n <DialogFooter bordered={false} className=\"border-t px-6 py-4 sm:justify-between\">\n <span className=\"hidden text-xs text-muted-foreground sm:inline\">\n <KbdShortcut keys={['Ctrl/\u2318', 'Enter']} />{' '}\n {t('wms.backend.putaway.complete.dialog.shortcutHint', 'to complete')}\n </span>\n <div className=\"flex gap-2\">\n <Button type=\"button\" variant=\"outline\" onClick={closeDialog} disabled={submitting}>\n {t('wms.backend.putaway.complete.dialog.cancel', 'Cancel')}\n </Button>\n <Button\n type=\"submit\"\n disabled={submitting || access.loading || !access.scopeReady}\n data-testid=\"complete-putaway-submit\"\n >\n {t('wms.backend.putaway.complete.dialog.submit', 'Complete putaway')}\n </Button>\n </div>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AA6QU,SAgBI,UAfF,KADF;AA3QV,YAAY,WAAW;AACvB,SAAS,SAAS;AAClB,SAAS,sBAAsB;AAC/B,SAAS,aAAa;AACtB,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,6BAA6B;AACtC,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AACtB,SAAS,mBAAmB;AAC5B,SAAS,Y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