@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,598 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import Link from "next/link";
|
|
5
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import { ArrowLeftRight, Package } from "lucide-react";
|
|
7
|
+
import { Page, PageBody, PageHeader } from "@open-mercato/ui/backend/Page";
|
|
8
|
+
import { DataTable } from "@open-mercato/ui/backend/DataTable";
|
|
9
|
+
import { EmptyState } from "@open-mercato/ui/backend/EmptyState";
|
|
10
|
+
import { RowActions } from "@open-mercato/ui/backend/RowActions";
|
|
11
|
+
import { LoadingMessage, ErrorMessage } from "@open-mercato/ui/backend/detail";
|
|
12
|
+
import { flash } from "@open-mercato/ui/backend/FlashMessages";
|
|
13
|
+
import { useConfirmDialog } from "@open-mercato/ui/backend/confirm-dialog";
|
|
14
|
+
import { useGuardedMutation } from "@open-mercato/ui/backend/injection/useGuardedMutation";
|
|
15
|
+
import { apiCall } from "@open-mercato/ui/backend/utils/apiCall";
|
|
16
|
+
import { buildOptimisticLockHeader } from "@open-mercato/ui/backend/utils/optimisticLock";
|
|
17
|
+
import { raiseCrudError } from "@open-mercato/ui/backend/utils/serverErrors";
|
|
18
|
+
import { surfaceRecordConflict } from "@open-mercato/ui/backend/conflicts";
|
|
19
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
20
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
21
|
+
import {
|
|
22
|
+
Select,
|
|
23
|
+
SelectContent,
|
|
24
|
+
SelectItem,
|
|
25
|
+
SelectTrigger,
|
|
26
|
+
SelectValue
|
|
27
|
+
} from "@open-mercato/ui/primitives/select";
|
|
28
|
+
import { StatusBadge } from "@open-mercato/ui/primitives/status-badge";
|
|
29
|
+
import { E } from "../../../../generated/entities.ids.generated.js";
|
|
30
|
+
import { extensionPoints } from "@open-mercato/core/modules/wms/extension-points";
|
|
31
|
+
import { flashMutationError } from "../../lib/flashMutationError.js";
|
|
32
|
+
import {
|
|
33
|
+
AssignPutawayTaskDialog
|
|
34
|
+
} from "./AssignPutawayTaskDialog.js";
|
|
35
|
+
import {
|
|
36
|
+
CompletePutawayTaskDialog
|
|
37
|
+
} from "./CompletePutawayTaskDialog.js";
|
|
38
|
+
import {
|
|
39
|
+
canShowPutawayCompleteAction,
|
|
40
|
+
formatAgingLabel,
|
|
41
|
+
mapPutawayQueueSortDir,
|
|
42
|
+
mapPutawayQueueSortField,
|
|
43
|
+
putawayStatusVariant
|
|
44
|
+
} from "./inboundStatusUi.js";
|
|
45
|
+
import { applyPutawayLockTokenFromConflict } from "./putawayQueueOptimisticLock.js";
|
|
46
|
+
import { MoveInventoryDialog } from "./MoveInventoryDialog.js";
|
|
47
|
+
import { useWmsInventoryMutationAccess } from "./useWmsInventoryMutationAccess.js";
|
|
48
|
+
import {
|
|
49
|
+
resolveCatalogVariantLabel,
|
|
50
|
+
resolveLocationLabel
|
|
51
|
+
} from "./inventoryMutationLoaders.js";
|
|
52
|
+
function toNumber(value) {
|
|
53
|
+
const parsed = Number(value ?? 0);
|
|
54
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
55
|
+
}
|
|
56
|
+
function WmsPutawayQueuePage() {
|
|
57
|
+
const t = useT();
|
|
58
|
+
const access = useWmsInventoryMutationAccess();
|
|
59
|
+
const queryClient = useQueryClient();
|
|
60
|
+
const { confirm, ConfirmDialogElement } = useConfirmDialog();
|
|
61
|
+
const { runMutation, retryLastMutation } = useGuardedMutation({
|
|
62
|
+
contextId: "wms-putaway-queue"
|
|
63
|
+
});
|
|
64
|
+
const mutationContext = React.useMemo(
|
|
65
|
+
() => ({ retryLastMutation }),
|
|
66
|
+
[retryLastMutation]
|
|
67
|
+
);
|
|
68
|
+
const [page, setPage] = React.useState(1);
|
|
69
|
+
const [statusFilter, setStatusFilter] = React.useState(
|
|
70
|
+
"active"
|
|
71
|
+
);
|
|
72
|
+
const [sorting, setSorting] = React.useState([{ id: "createdAt", desc: false }]);
|
|
73
|
+
const [completeOpen, setCompleteOpen] = React.useState(false);
|
|
74
|
+
const [activeTask, setActiveTask] = React.useState(null);
|
|
75
|
+
const [assignOpen, setAssignOpen] = React.useState(false);
|
|
76
|
+
const [assignTask, setAssignTask] = React.useState(null);
|
|
77
|
+
const [manualPutawayOpen, setManualPutawayOpen] = React.useState(false);
|
|
78
|
+
const [labelCache, setLabelCache] = React.useState({});
|
|
79
|
+
const [nowMs, setNowMs] = React.useState(() => Date.now());
|
|
80
|
+
const lockTokensRef = React.useRef({});
|
|
81
|
+
const [lockOverrides, setLockOverrides] = React.useState({});
|
|
82
|
+
React.useEffect(() => {
|
|
83
|
+
const timer = window.setInterval(() => setNowMs(Date.now()), 6e4);
|
|
84
|
+
return () => window.clearInterval(timer);
|
|
85
|
+
}, []);
|
|
86
|
+
const queryKey = React.useMemo(
|
|
87
|
+
() => ["wms-putaway-queue", page, statusFilter, sorting],
|
|
88
|
+
[page, sorting, statusFilter]
|
|
89
|
+
);
|
|
90
|
+
const tasksQuery = useQuery({
|
|
91
|
+
queryKey,
|
|
92
|
+
queryFn: async () => {
|
|
93
|
+
const sortCol = sorting[0];
|
|
94
|
+
const base = {
|
|
95
|
+
page: String(page),
|
|
96
|
+
pageSize: "50",
|
|
97
|
+
sortField: sortCol ? mapPutawayQueueSortField(sortCol.id) : "createdAt",
|
|
98
|
+
sortDir: sortCol ? mapPutawayQueueSortDir(sortCol.id, Boolean(sortCol.desc)) : "asc"
|
|
99
|
+
};
|
|
100
|
+
const load = async (status) => {
|
|
101
|
+
const params = new URLSearchParams(base);
|
|
102
|
+
if (status) params.set("status", status);
|
|
103
|
+
const call = await apiCall(
|
|
104
|
+
`/api/wms/putaway-tasks?${params.toString()}`
|
|
105
|
+
);
|
|
106
|
+
if (!call.ok) {
|
|
107
|
+
await raiseCrudError(
|
|
108
|
+
call.response,
|
|
109
|
+
t("wms.backend.putaway.errors.load", "Failed to load putaway tasks.")
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
return call.result ?? { items: [], total: 0, totalPages: 1 };
|
|
113
|
+
};
|
|
114
|
+
if (statusFilter === "active") return load("open,in_progress");
|
|
115
|
+
if (statusFilter === "all") return load();
|
|
116
|
+
return load(statusFilter);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
React.useEffect(() => {
|
|
120
|
+
const ids = /* @__PURE__ */ new Set();
|
|
121
|
+
for (const row of tasksQuery.data?.items ?? []) {
|
|
122
|
+
if (row.catalog_variant_id) ids.add(row.catalog_variant_id);
|
|
123
|
+
if (row.source_location_id) ids.add(row.source_location_id);
|
|
124
|
+
if (row.target_location_id) ids.add(row.target_location_id);
|
|
125
|
+
}
|
|
126
|
+
const missing = [...ids].filter((id) => !labelCache[id]);
|
|
127
|
+
if (missing.length === 0) return;
|
|
128
|
+
let cancelled = false;
|
|
129
|
+
void Promise.all(
|
|
130
|
+
missing.map(async (id) => {
|
|
131
|
+
const [variant, location] = await Promise.all([
|
|
132
|
+
resolveCatalogVariantLabel(id),
|
|
133
|
+
resolveLocationLabel(id)
|
|
134
|
+
]);
|
|
135
|
+
return [id, variant || location];
|
|
136
|
+
})
|
|
137
|
+
).then((entries) => {
|
|
138
|
+
if (cancelled) return;
|
|
139
|
+
setLabelCache((prev) => {
|
|
140
|
+
const next = { ...prev };
|
|
141
|
+
for (const [id, label] of entries) {
|
|
142
|
+
if (label) next[id] = label;
|
|
143
|
+
}
|
|
144
|
+
return next;
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
return () => {
|
|
148
|
+
cancelled = true;
|
|
149
|
+
};
|
|
150
|
+
}, [labelCache, tasksQuery.data?.items]);
|
|
151
|
+
const applyLockTokenFromConflict = React.useCallback(
|
|
152
|
+
(taskId, status, body) => {
|
|
153
|
+
const refreshed = applyPutawayLockTokenFromConflict(lockTokensRef.current, taskId, {
|
|
154
|
+
status,
|
|
155
|
+
body
|
|
156
|
+
});
|
|
157
|
+
if (!refreshed) return;
|
|
158
|
+
setLockOverrides((prev) => ({ ...prev, [taskId]: refreshed }));
|
|
159
|
+
queryClient.setQueriesData(
|
|
160
|
+
{ queryKey: ["wms-putaway-queue"] },
|
|
161
|
+
(previous) => {
|
|
162
|
+
if (!previous?.items) return previous;
|
|
163
|
+
return {
|
|
164
|
+
...previous,
|
|
165
|
+
items: previous.items.map(
|
|
166
|
+
(row) => row.id === taskId ? { ...row, updated_at: refreshed } : row
|
|
167
|
+
)
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
},
|
|
172
|
+
[queryClient]
|
|
173
|
+
);
|
|
174
|
+
const postTaskAction = React.useCallback(
|
|
175
|
+
async (taskId, action, body, updatedAt) => {
|
|
176
|
+
if (typeof updatedAt === "string" && updatedAt.trim()) {
|
|
177
|
+
lockTokensRef.current[taskId] = updatedAt.trim();
|
|
178
|
+
}
|
|
179
|
+
let conflictHandled = false;
|
|
180
|
+
await runMutation({
|
|
181
|
+
operation: async () => {
|
|
182
|
+
const call = await apiCall(
|
|
183
|
+
`/api/wms/putaway-tasks/${encodeURIComponent(taskId)}/${action}`,
|
|
184
|
+
{
|
|
185
|
+
method: "POST",
|
|
186
|
+
headers: {
|
|
187
|
+
"content-type": "application/json",
|
|
188
|
+
...buildOptimisticLockHeader(lockTokensRef.current[taskId])
|
|
189
|
+
},
|
|
190
|
+
body: JSON.stringify(body)
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
if (!call.ok) {
|
|
194
|
+
const refreshLockFromConflict = () => {
|
|
195
|
+
applyLockTokenFromConflict(taskId, call.status, call.result);
|
|
196
|
+
void queryClient.invalidateQueries({ queryKey: ["wms-putaway-queue"] });
|
|
197
|
+
};
|
|
198
|
+
if (surfaceRecordConflict({ status: call.status, body: call.result }, t, {
|
|
199
|
+
onRefresh: refreshLockFromConflict
|
|
200
|
+
})) {
|
|
201
|
+
refreshLockFromConflict();
|
|
202
|
+
conflictHandled = true;
|
|
203
|
+
return {};
|
|
204
|
+
}
|
|
205
|
+
await raiseCrudError(
|
|
206
|
+
call.response,
|
|
207
|
+
t("wms.backend.putaway.errors.action", "Failed to update putaway task.")
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
return call.result ?? {};
|
|
211
|
+
},
|
|
212
|
+
context: mutationContext,
|
|
213
|
+
mutationPayload: body
|
|
214
|
+
});
|
|
215
|
+
if (conflictHandled) return "conflict";
|
|
216
|
+
await queryClient.invalidateQueries({ queryKey: ["wms-putaway-queue"] });
|
|
217
|
+
return "ok";
|
|
218
|
+
},
|
|
219
|
+
[applyLockTokenFromConflict, mutationContext, queryClient, runMutation, t]
|
|
220
|
+
);
|
|
221
|
+
const resolveRowUpdatedAt = React.useCallback(
|
|
222
|
+
(row) => lockOverrides[row.id] ?? row.updated_at ?? null,
|
|
223
|
+
[lockOverrides]
|
|
224
|
+
);
|
|
225
|
+
const handleAssignSelf = React.useCallback(
|
|
226
|
+
async (row) => {
|
|
227
|
+
if (!access.userId || !access.organizationId || !access.tenantId) return;
|
|
228
|
+
try {
|
|
229
|
+
const result = await postTaskAction(
|
|
230
|
+
row.id,
|
|
231
|
+
"assign",
|
|
232
|
+
{
|
|
233
|
+
organizationId: access.organizationId,
|
|
234
|
+
tenantId: access.tenantId,
|
|
235
|
+
assignedTo: access.userId
|
|
236
|
+
},
|
|
237
|
+
resolveRowUpdatedAt(row)
|
|
238
|
+
);
|
|
239
|
+
if (result === "conflict") return;
|
|
240
|
+
flash(t("wms.backend.putaway.flash.assigned", "Putaway task assigned"), "success");
|
|
241
|
+
} catch (error) {
|
|
242
|
+
flashMutationError(error, t("wms.backend.putaway.errors.action", "Failed to update putaway task."), t);
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
[access, postTaskAction, resolveRowUpdatedAt, t]
|
|
246
|
+
);
|
|
247
|
+
const handleStart = React.useCallback(
|
|
248
|
+
async (row) => {
|
|
249
|
+
if (!access.organizationId || !access.tenantId) return;
|
|
250
|
+
try {
|
|
251
|
+
const result = await postTaskAction(
|
|
252
|
+
row.id,
|
|
253
|
+
"start",
|
|
254
|
+
{
|
|
255
|
+
organizationId: access.organizationId,
|
|
256
|
+
tenantId: access.tenantId
|
|
257
|
+
},
|
|
258
|
+
resolveRowUpdatedAt(row)
|
|
259
|
+
);
|
|
260
|
+
if (result === "conflict") return;
|
|
261
|
+
flash(t("wms.backend.putaway.flash.started", "Putaway task started"), "success");
|
|
262
|
+
} catch (error) {
|
|
263
|
+
flashMutationError(error, t("wms.backend.putaway.errors.action", "Failed to update putaway task."), t);
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
[access, postTaskAction, resolveRowUpdatedAt, t]
|
|
267
|
+
);
|
|
268
|
+
const handleCancel = React.useCallback(
|
|
269
|
+
async (row) => {
|
|
270
|
+
if (!access.organizationId || !access.tenantId) return;
|
|
271
|
+
const confirmed = await confirm({
|
|
272
|
+
title: t("wms.backend.putaway.cancel.confirm.title", "Cancel putaway task?"),
|
|
273
|
+
description: t(
|
|
274
|
+
"wms.backend.putaway.cancel.confirm.description",
|
|
275
|
+
"The task will be cancelled and will no longer appear in the active queue."
|
|
276
|
+
),
|
|
277
|
+
confirmText: t("wms.backend.putaway.cancel.confirm.submit", "Cancel task"),
|
|
278
|
+
cancelText: t("wms.backend.putaway.cancel.confirm.keep", "Keep task"),
|
|
279
|
+
variant: "destructive"
|
|
280
|
+
});
|
|
281
|
+
if (!confirmed) return;
|
|
282
|
+
try {
|
|
283
|
+
const result = await postTaskAction(
|
|
284
|
+
row.id,
|
|
285
|
+
"cancel",
|
|
286
|
+
{
|
|
287
|
+
organizationId: access.organizationId,
|
|
288
|
+
tenantId: access.tenantId
|
|
289
|
+
},
|
|
290
|
+
resolveRowUpdatedAt(row)
|
|
291
|
+
);
|
|
292
|
+
if (result === "conflict") return;
|
|
293
|
+
flash(t("wms.backend.putaway.flash.cancelled", "Putaway task cancelled"), "success");
|
|
294
|
+
} catch (error) {
|
|
295
|
+
flashMutationError(error, t("wms.backend.putaway.errors.action", "Failed to update putaway task."), t);
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
[access, confirm, postTaskAction, resolveRowUpdatedAt, t]
|
|
299
|
+
);
|
|
300
|
+
const openComplete = React.useCallback(
|
|
301
|
+
(row) => {
|
|
302
|
+
setActiveTask({
|
|
303
|
+
id: row.id,
|
|
304
|
+
warehouseId: row.warehouse_id ?? "",
|
|
305
|
+
quantity: toNumber(row.quantity),
|
|
306
|
+
targetLocationId: row.target_location_id,
|
|
307
|
+
catalogVariantId: row.catalog_variant_id,
|
|
308
|
+
sourceLocationId: row.source_location_id,
|
|
309
|
+
serialNumber: row.serial_number,
|
|
310
|
+
updatedAt: resolveRowUpdatedAt(row)
|
|
311
|
+
});
|
|
312
|
+
setCompleteOpen(true);
|
|
313
|
+
},
|
|
314
|
+
[resolveRowUpdatedAt]
|
|
315
|
+
);
|
|
316
|
+
const openAssign = React.useCallback(
|
|
317
|
+
(row) => {
|
|
318
|
+
setAssignTask({
|
|
319
|
+
id: row.id,
|
|
320
|
+
assignedTo: row.assigned_to,
|
|
321
|
+
updatedAt: resolveRowUpdatedAt(row)
|
|
322
|
+
});
|
|
323
|
+
setAssignOpen(true);
|
|
324
|
+
},
|
|
325
|
+
[resolveRowUpdatedAt]
|
|
326
|
+
);
|
|
327
|
+
const columns = React.useMemo(
|
|
328
|
+
() => [
|
|
329
|
+
{
|
|
330
|
+
id: "status",
|
|
331
|
+
accessorKey: "status",
|
|
332
|
+
header: t("wms.backend.putaway.columns.status", "Status"),
|
|
333
|
+
enableSorting: true,
|
|
334
|
+
cell: ({ row }) => {
|
|
335
|
+
const status = row.original.status?.trim();
|
|
336
|
+
if (!status) return "\u2014";
|
|
337
|
+
return /* @__PURE__ */ jsx(StatusBadge, { variant: putawayStatusVariant(status), dot: true, children: t(`wms.backend.putaway.status.${status}`, status) });
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
id: "variant",
|
|
342
|
+
header: t("wms.backend.putaway.columns.variant", "Variant"),
|
|
343
|
+
cell: ({ row }) => {
|
|
344
|
+
const id = row.original.catalog_variant_id;
|
|
345
|
+
if (!id) return "\u2014";
|
|
346
|
+
return labelCache[id] || id.slice(0, 8);
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
id: "quantity",
|
|
351
|
+
accessorKey: "quantity",
|
|
352
|
+
header: t("wms.backend.putaway.columns.quantity", "Qty"),
|
|
353
|
+
enableSorting: true,
|
|
354
|
+
cell: ({ row }) => toNumber(row.original.quantity)
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
id: "serial",
|
|
358
|
+
accessorKey: "serial_number",
|
|
359
|
+
header: t("wms.backend.putaway.columns.serial", "Serial"),
|
|
360
|
+
cell: ({ row }) => {
|
|
361
|
+
const serial = row.original.serial_number?.trim();
|
|
362
|
+
if (!serial) return "\u2014";
|
|
363
|
+
return serial;
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
id: "source",
|
|
368
|
+
header: t("wms.backend.putaway.columns.source", "Source"),
|
|
369
|
+
cell: ({ row }) => {
|
|
370
|
+
const id = row.original.source_location_id;
|
|
371
|
+
if (!id) return "\u2014";
|
|
372
|
+
return labelCache[id] || id.slice(0, 8);
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
id: "target",
|
|
377
|
+
header: t("wms.backend.putaway.columns.target", "Target"),
|
|
378
|
+
cell: ({ row }) => {
|
|
379
|
+
const id = row.original.target_location_id;
|
|
380
|
+
if (!id) return "\u2014";
|
|
381
|
+
return labelCache[id] || id.slice(0, 8);
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
id: "assignee",
|
|
386
|
+
header: t("wms.backend.putaway.columns.assignee", "Assignee"),
|
|
387
|
+
cell: ({ row }) => {
|
|
388
|
+
const id = row.original.assigned_to;
|
|
389
|
+
if (!id) return t("wms.backend.putaway.assignee.unassigned", "Unassigned");
|
|
390
|
+
if (id === access.userId) return t("wms.backend.putaway.assignee.me", "Me");
|
|
391
|
+
return id.slice(0, 8);
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
id: "aging",
|
|
396
|
+
accessorKey: "created_at",
|
|
397
|
+
header: t("wms.backend.putaway.columns.aging", "Aging"),
|
|
398
|
+
enableSorting: true,
|
|
399
|
+
cell: ({ row }) => formatAgingLabel(row.original.created_at, nowMs) ?? "\u2014"
|
|
400
|
+
}
|
|
401
|
+
],
|
|
402
|
+
[access.userId, labelCache, nowMs, t]
|
|
403
|
+
);
|
|
404
|
+
const rowActions = React.useCallback(
|
|
405
|
+
(row) => {
|
|
406
|
+
const status = row.status;
|
|
407
|
+
if (status !== "open" && status !== "in_progress") return null;
|
|
408
|
+
const isAssignee = Boolean(access.userId && row.assigned_to === access.userId);
|
|
409
|
+
const canComplete = canShowPutawayCompleteAction({
|
|
410
|
+
canManagePutaway: access.canManagePutaway,
|
|
411
|
+
canAdjustInventory: access.canAdjust,
|
|
412
|
+
isAssignee
|
|
413
|
+
});
|
|
414
|
+
if (!access.canManagePutaway && !canComplete) return null;
|
|
415
|
+
const items = [];
|
|
416
|
+
if (access.canManagePutaway) {
|
|
417
|
+
items.push({
|
|
418
|
+
id: "assign",
|
|
419
|
+
label: t("wms.backend.putaway.actions.assign", "Assign\u2026"),
|
|
420
|
+
onSelect: () => openAssign(row)
|
|
421
|
+
});
|
|
422
|
+
if (!row.assigned_to || row.assigned_to !== access.userId) {
|
|
423
|
+
items.push({
|
|
424
|
+
id: "assign-me",
|
|
425
|
+
label: t("wms.backend.putaway.actions.assignMe", "Assign to me"),
|
|
426
|
+
onSelect: () => void handleAssignSelf(row)
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
if (status === "open") {
|
|
430
|
+
items.push({
|
|
431
|
+
id: "start",
|
|
432
|
+
label: t("wms.backend.putaway.actions.start", "Start"),
|
|
433
|
+
onSelect: () => void handleStart(row)
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
if (canComplete) {
|
|
438
|
+
items.push({
|
|
439
|
+
id: "complete",
|
|
440
|
+
label: t("wms.backend.putaway.actions.complete", "Complete"),
|
|
441
|
+
onSelect: () => openComplete(row)
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
if (access.canManagePutaway) {
|
|
445
|
+
items.push({
|
|
446
|
+
id: "cancel",
|
|
447
|
+
label: t("wms.backend.putaway.actions.cancel", "Cancel"),
|
|
448
|
+
onSelect: () => void handleCancel(row)
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
if (items.length === 0) return null;
|
|
452
|
+
return /* @__PURE__ */ jsx(RowActions, { items });
|
|
453
|
+
},
|
|
454
|
+
[
|
|
455
|
+
access.canAdjust,
|
|
456
|
+
access.canManagePutaway,
|
|
457
|
+
access.userId,
|
|
458
|
+
handleAssignSelf,
|
|
459
|
+
handleCancel,
|
|
460
|
+
handleStart,
|
|
461
|
+
openAssign,
|
|
462
|
+
openComplete,
|
|
463
|
+
t
|
|
464
|
+
]
|
|
465
|
+
);
|
|
466
|
+
return /* @__PURE__ */ jsxs(Page, { children: [
|
|
467
|
+
/* @__PURE__ */ jsxs(PageBody, { className: "space-y-6", children: [
|
|
468
|
+
/* @__PURE__ */ jsx(
|
|
469
|
+
PageHeader,
|
|
470
|
+
{
|
|
471
|
+
title: t("wms.backend.putaway.title", "Putaway queue"),
|
|
472
|
+
description: t(
|
|
473
|
+
"wms.backend.putaway.description",
|
|
474
|
+
"Open and in-progress putaway tasks from accepted receipts."
|
|
475
|
+
),
|
|
476
|
+
actions: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
477
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", asChild: true, children: /* @__PURE__ */ jsx(Link, { href: "/backend/wms/asns", children: t("wms.backend.putaway.actions.asns", "ASNs") }) }),
|
|
478
|
+
access.canMove ? /* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", onClick: () => setManualPutawayOpen(true), children: [
|
|
479
|
+
/* @__PURE__ */ jsx(ArrowLeftRight, { className: "size-4" }),
|
|
480
|
+
t("wms.backend.putaway.actions.manualPutaway", "Manual put away")
|
|
481
|
+
] }) : null
|
|
482
|
+
] })
|
|
483
|
+
}
|
|
484
|
+
),
|
|
485
|
+
tasksQuery.isLoading ? /* @__PURE__ */ jsx(LoadingMessage, { label: t("wms.backend.putaway.loading", "Loading putaway tasks\u2026") }) : null,
|
|
486
|
+
tasksQuery.isError ? /* @__PURE__ */ jsx(ErrorMessage, { label: t("wms.backend.putaway.errors.load", "Failed to load putaway tasks.") }) : null,
|
|
487
|
+
tasksQuery.data ? /* @__PURE__ */ jsxs("section", { className: "rounded-lg border bg-card p-5 text-card-foreground shadow-sm", children: [
|
|
488
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between", children: [
|
|
489
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
490
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-md border bg-muted/40 p-2 text-muted-foreground", children: /* @__PURE__ */ jsx(Package, { className: "size-5" }) }),
|
|
491
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
492
|
+
/* @__PURE__ */ jsx("h2", { className: "text-xl font-semibold", children: t("wms.backend.putaway.section.title", "Tasks") }),
|
|
493
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t(
|
|
494
|
+
"wms.backend.putaway.section.description",
|
|
495
|
+
"Filter and complete open or in-progress putaway work."
|
|
496
|
+
) })
|
|
497
|
+
] })
|
|
498
|
+
] }),
|
|
499
|
+
/* @__PURE__ */ jsxs(
|
|
500
|
+
Select,
|
|
501
|
+
{
|
|
502
|
+
value: statusFilter,
|
|
503
|
+
onValueChange: (value) => {
|
|
504
|
+
setPage(1);
|
|
505
|
+
setStatusFilter(value);
|
|
506
|
+
},
|
|
507
|
+
children: [
|
|
508
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "w-[200px]", "data-testid": "putaway-status-filter", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
509
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
510
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "active", children: t("wms.backend.putaway.filters.active", "Open + in progress") }),
|
|
511
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "open", children: t("wms.backend.putaway.status.open", "Open") }),
|
|
512
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "in_progress", children: t("wms.backend.putaway.status.in_progress", "In progress") }),
|
|
513
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "done", children: t("wms.backend.putaway.status.done", "Done") }),
|
|
514
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "cancelled", children: t("wms.backend.putaway.status.cancelled", "Cancelled") }),
|
|
515
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "all", children: t("wms.backend.putaway.filters.all", "All statuses") })
|
|
516
|
+
] })
|
|
517
|
+
]
|
|
518
|
+
}
|
|
519
|
+
)
|
|
520
|
+
] }),
|
|
521
|
+
/* @__PURE__ */ jsx(
|
|
522
|
+
DataTable,
|
|
523
|
+
{
|
|
524
|
+
embedded: true,
|
|
525
|
+
columns,
|
|
526
|
+
data: tasksQuery.data.items,
|
|
527
|
+
isLoading: tasksQuery.isFetching,
|
|
528
|
+
entityId: E.wms.putaway_task,
|
|
529
|
+
sortable: true,
|
|
530
|
+
manualSorting: true,
|
|
531
|
+
sorting,
|
|
532
|
+
onSortingChange: (next) => {
|
|
533
|
+
setSorting(next);
|
|
534
|
+
setPage(1);
|
|
535
|
+
},
|
|
536
|
+
rowActions,
|
|
537
|
+
pagination: {
|
|
538
|
+
page,
|
|
539
|
+
pageSize: 50,
|
|
540
|
+
total: tasksQuery.data.total,
|
|
541
|
+
totalPages: tasksQuery.data.totalPages,
|
|
542
|
+
totalIsCapped: tasksQuery.data?.totalIsCapped === true,
|
|
543
|
+
onPageChange: setPage
|
|
544
|
+
},
|
|
545
|
+
perspective: { tableId: extensionPoints.hosts.putawayTasksTable.tableId },
|
|
546
|
+
emptyState: /* @__PURE__ */ jsx(
|
|
547
|
+
EmptyState,
|
|
548
|
+
{
|
|
549
|
+
title: t("wms.backend.putaway.empty.title", "No putaway tasks"),
|
|
550
|
+
description: t(
|
|
551
|
+
"wms.backend.putaway.empty.description",
|
|
552
|
+
"Tasks appear after ASN lines are received with QC pass."
|
|
553
|
+
)
|
|
554
|
+
}
|
|
555
|
+
)
|
|
556
|
+
}
|
|
557
|
+
)
|
|
558
|
+
] }) : null
|
|
559
|
+
] }),
|
|
560
|
+
access.canManagePutaway ? /* @__PURE__ */ jsx(
|
|
561
|
+
AssignPutawayTaskDialog,
|
|
562
|
+
{
|
|
563
|
+
open: assignOpen,
|
|
564
|
+
onOpenChange: setAssignOpen,
|
|
565
|
+
access,
|
|
566
|
+
task: assignTask,
|
|
567
|
+
onConflict: (taskId, status, body) => {
|
|
568
|
+
applyLockTokenFromConflict(taskId, status, body);
|
|
569
|
+
},
|
|
570
|
+
onSuccess: () => void tasksQuery.refetch()
|
|
571
|
+
}
|
|
572
|
+
) : null,
|
|
573
|
+
access.canAdjust ? /* @__PURE__ */ jsx(
|
|
574
|
+
CompletePutawayTaskDialog,
|
|
575
|
+
{
|
|
576
|
+
open: completeOpen,
|
|
577
|
+
onOpenChange: setCompleteOpen,
|
|
578
|
+
access,
|
|
579
|
+
task: activeTask,
|
|
580
|
+
onSuccess: () => void tasksQuery.refetch()
|
|
581
|
+
}
|
|
582
|
+
) : null,
|
|
583
|
+
access.canMove ? /* @__PURE__ */ jsx(
|
|
584
|
+
MoveInventoryDialog,
|
|
585
|
+
{
|
|
586
|
+
open: manualPutawayOpen,
|
|
587
|
+
onOpenChange: setManualPutawayOpen,
|
|
588
|
+
access,
|
|
589
|
+
movementType: "putaway"
|
|
590
|
+
}
|
|
591
|
+
) : null,
|
|
592
|
+
ConfirmDialogElement
|
|
593
|
+
] });
|
|
594
|
+
}
|
|
595
|
+
export {
|
|
596
|
+
WmsPutawayQueuePage as default
|
|
597
|
+
};
|
|
598
|
+
//# sourceMappingURL=WmsPutawayQueuePage.js.map
|