@open-mercato/core 0.6.7-develop.6669.1.40b669666b → 0.6.7-develop.6671.1.4b925c5096
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/inventory_balance/index.js +21 -0
- package/dist/generated/entities/inventory_balance/index.js.map +7 -0
- package/dist/generated/entities/inventory_lot/index.js +19 -0
- package/dist/generated/entities/inventory_lot/index.js.map +7 -0
- package/dist/generated/entities/inventory_movement/index.js +35 -0
- package/dist/generated/entities/inventory_movement/index.js.map +7 -0
- package/dist/generated/entities/inventory_reservation/index.js +23 -0
- package/dist/generated/entities/inventory_reservation/index.js.map +7 -0
- package/dist/generated/entities/product_inventory_profile/index.js +21 -0
- package/dist/generated/entities/product_inventory_profile/index.js.map +7 -0
- package/dist/generated/entities/sales_order_warehouse_assignment/index.js +11 -0
- package/dist/generated/entities/sales_order_warehouse_assignment/index.js.map +7 -0
- package/dist/generated/entities/warehouse/index.js +25 -0
- package/dist/generated/entities/warehouse/index.js.map +7 -0
- package/dist/generated/entities/warehouse_location/index.js +21 -0
- package/dist/generated/entities/warehouse_location/index.js.map +7 -0
- package/dist/generated/entities/warehouse_zone/index.js +11 -0
- package/dist/generated/entities/warehouse_zone/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +12 -0
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +98 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/modules/auth/backend/roles/page.js +12 -4
- package/dist/modules/auth/backend/roles/page.js.map +2 -2
- package/dist/modules/auth/lib/backendChrome.js +1 -0
- package/dist/modules/auth/lib/backendChrome.js.map +2 -2
- package/dist/modules/auth/services/rbacService.js +16 -17
- package/dist/modules/auth/services/rbacService.js.map +2 -2
- package/dist/modules/catalog/api/products/route.js +3 -0
- package/dist/modules/catalog/api/products/route.js.map +2 -2
- package/dist/modules/catalog/api/variants/route.js +3 -0
- package/dist/modules/catalog/api/variants/route.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +6 -6
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/sales/api/documents/factory.js +1 -0
- package/dist/modules/sales/api/documents/factory.js.map +2 -2
- package/dist/modules/sales/commands/documents.js +53 -0
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/sales/components/documents/ItemsSection.js +51 -2
- package/dist/modules/sales/components/documents/ItemsSection.js.map +2 -2
- package/dist/modules/sales/events.js +2 -0
- package/dist/modules/sales/events.js.map +2 -2
- package/dist/modules/sales/widgets/injection/order-items-context.js +11 -0
- package/dist/modules/sales/widgets/injection/order-items-context.js.map +7 -0
- package/dist/modules/wms/acl.js +18 -0
- package/dist/modules/wms/acl.js.map +7 -0
- package/dist/modules/wms/analytics.js +11 -0
- package/dist/modules/wms/analytics.js.map +7 -0
- package/dist/modules/wms/api/dashboard/operational/route.js +80 -0
- package/dist/modules/wms/api/dashboard/operational/route.js.map +7 -0
- package/dist/modules/wms/api/interceptors.js +90 -0
- package/dist/modules/wms/api/interceptors.js.map +7 -0
- package/dist/modules/wms/api/inventory/adjust/route.js +51 -0
- package/dist/modules/wms/api/inventory/adjust/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/allocate/route.js +51 -0
- package/dist/modules/wms/api/inventory/allocate/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/balances/route.js +172 -0
- package/dist/modules/wms/api/inventory/balances/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/cycle-count/route.js +52 -0
- package/dist/modules/wms/api/inventory/cycle-count/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/helpers.js +113 -0
- package/dist/modules/wms/api/inventory/helpers.js.map +7 -0
- package/dist/modules/wms/api/inventory/import/apply/route.js +46 -0
- package/dist/modules/wms/api/inventory/import/apply/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/import/helpers.js +195 -0
- package/dist/modules/wms/api/inventory/import/helpers.js.map +7 -0
- package/dist/modules/wms/api/inventory/import/template/route.js +32 -0
- package/dist/modules/wms/api/inventory/import/template/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/import/validate/route.js +54 -0
- package/dist/modules/wms/api/inventory/import/validate/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/move/route.js +51 -0
- package/dist/modules/wms/api/inventory/move/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/movements/route.js +164 -0
- package/dist/modules/wms/api/inventory/movements/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/receive/route.js +50 -0
- package/dist/modules/wms/api/inventory/receive/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/release/route.js +44 -0
- package/dist/modules/wms/api/inventory/release/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/reservations/route.js +128 -0
- package/dist/modules/wms/api/inventory/reservations/route.js.map +7 -0
- package/dist/modules/wms/api/inventory/reserve/route.js +59 -0
- package/dist/modules/wms/api/inventory/reserve/route.js.map +7 -0
- package/dist/modules/wms/api/inventory-profiles/route.js +178 -0
- package/dist/modules/wms/api/inventory-profiles/route.js.map +7 -0
- package/dist/modules/wms/api/listEnrichers.js +181 -0
- package/dist/modules/wms/api/listEnrichers.js.map +7 -0
- package/dist/modules/wms/api/listSearch.js +77 -0
- package/dist/modules/wms/api/listSearch.js.map +7 -0
- package/dist/modules/wms/api/locations/route.js +172 -0
- package/dist/modules/wms/api/locations/route.js.map +7 -0
- package/dist/modules/wms/api/lots/route.js +204 -0
- package/dist/modules/wms/api/lots/route.js.map +7 -0
- package/dist/modules/wms/api/openapi.js +27 -0
- package/dist/modules/wms/api/openapi.js.map +7 -0
- package/dist/modules/wms/api/sales-orders/[salesOrderId]/re-run-reservation/route.js +54 -0
- package/dist/modules/wms/api/sales-orders/[salesOrderId]/re-run-reservation/route.js.map +7 -0
- package/dist/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.js +279 -0
- package/dist/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.js.map +7 -0
- package/dist/modules/wms/api/sales-orders/assign-warehouse/route.js +56 -0
- package/dist/modules/wms/api/sales-orders/assign-warehouse/route.js.map +7 -0
- package/dist/modules/wms/api/sales-orders/unassign-warehouse/route.js +43 -0
- package/dist/modules/wms/api/sales-orders/unassign-warehouse/route.js.map +7 -0
- package/dist/modules/wms/api/warehouses/route.js +181 -0
- package/dist/modules/wms/api/warehouses/route.js.map +7 -0
- package/dist/modules/wms/api/zones/route.js +159 -0
- package/dist/modules/wms/api/zones/route.js.map +7 -0
- package/dist/modules/wms/backend/config/wms/page.js +9 -0
- package/dist/modules/wms/backend/config/wms/page.js.map +7 -0
- package/dist/modules/wms/backend/config/wms/page.meta.js +18 -0
- package/dist/modules/wms/backend/config/wms/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/page.js +9 -0
- package/dist/modules/wms/backend/page.js.map +7 -0
- package/dist/modules/wms/backend/page.meta.js +16 -0
- package/dist/modules/wms/backend/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/inventory/page.js +9 -0
- package/dist/modules/wms/backend/wms/inventory/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/inventory/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/inventory/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/location/[id]/page.js +9 -0
- package/dist/modules/wms/backend/wms/location/[id]/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/location/[id]/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/location/[id]/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/locations/page.js +10 -0
- package/dist/modules/wms/backend/wms/locations/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/locations/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/locations/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/lot/[id]/page.js +9 -0
- package/dist/modules/wms/backend/wms/lot/[id]/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/lot/[id]/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/lot/[id]/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/lots/page.js +9 -0
- package/dist/modules/wms/backend/wms/lots/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/lots/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/lots/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/movements/page.js +22 -0
- package/dist/modules/wms/backend/wms/movements/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/movements/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/movements/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/reservations/page.js +23 -0
- package/dist/modules/wms/backend/wms/reservations/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/reservations/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/reservations/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/sku/[id]/page.js +9 -0
- package/dist/modules/wms/backend/wms/sku/[id]/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/sku/[id]/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/sku/[id]/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/warehouses/page.js +10 -0
- package/dist/modules/wms/backend/wms/warehouses/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/warehouses/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/warehouses/page.meta.js.map +7 -0
- package/dist/modules/wms/backend/wms/zones/page.js +10 -0
- package/dist/modules/wms/backend/wms/zones/page.js.map +7 -0
- package/dist/modules/wms/backend/wms/zones/page.meta.js +18 -0
- package/dist/modules/wms/backend/wms/zones/page.meta.js.map +7 -0
- package/dist/modules/wms/ce.js +80 -0
- package/dist/modules/wms/ce.js.map +7 -0
- package/dist/modules/wms/cli.js +83 -0
- package/dist/modules/wms/cli.js.map +7 -0
- package/dist/modules/wms/commands/configuration.js +1519 -0
- package/dist/modules/wms/commands/configuration.js.map +7 -0
- package/dist/modules/wms/commands/index.js +4 -0
- package/dist/modules/wms/commands/index.js.map +7 -0
- package/dist/modules/wms/commands/inventory-actions.js +1539 -0
- package/dist/modules/wms/commands/inventory-actions.js.map +7 -0
- package/dist/modules/wms/commands/sales-order-assignment.js +277 -0
- package/dist/modules/wms/commands/sales-order-assignment.js.map +7 -0
- package/dist/modules/wms/commands/shared.js +82 -0
- package/dist/modules/wms/commands/shared.js.map +7 -0
- package/dist/modules/wms/components/backend/AdjustInventoryDialog.js +755 -0
- package/dist/modules/wms/components/backend/AdjustInventoryDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/ChangeLotStatusDialog.js +269 -0
- package/dist/modules/wms/components/backend/ChangeLotStatusDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/CycleCountWizardDialog.js +1783 -0
- package/dist/modules/wms/components/backend/CycleCountWizardDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/ImportInventoryDialog.js +766 -0
- package/dist/modules/wms/components/backend/ImportInventoryDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/InventoryOperationsSection.js +119 -0
- package/dist/modules/wms/components/backend/InventoryOperationsSection.js.map +7 -0
- package/dist/modules/wms/components/backend/LocationEditDialog.js +140 -0
- package/dist/modules/wms/components/backend/LocationEditDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/MoveInventoryDialog.js +791 -0
- package/dist/modules/wms/components/backend/MoveInventoryDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/ReceiveInventoryDialog.js +656 -0
- package/dist/modules/wms/components/backend/ReceiveInventoryDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/ReleaseReservationDialog.js +344 -0
- package/dist/modules/wms/components/backend/ReleaseReservationDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/ReserveInventoryDialog.js +475 -0
- package/dist/modules/wms/components/backend/ReserveInventoryDialog.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsConfigurationPage.js +1112 -0
- package/dist/modules/wms/components/backend/WmsConfigurationPage.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsInventoryConsolePage.js +908 -0
- package/dist/modules/wms/components/backend/WmsInventoryConsolePage.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsLocationDetailPage.js +1015 -0
- package/dist/modules/wms/components/backend/WmsLocationDetailPage.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsLotDetailPage.js +1049 -0
- package/dist/modules/wms/components/backend/WmsLotDetailPage.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsLotsListPage.js +297 -0
- package/dist/modules/wms/components/backend/WmsLotsListPage.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsOperationalDashboardPage.js +757 -0
- package/dist/modules/wms/components/backend/WmsOperationalDashboardPage.js.map +7 -0
- package/dist/modules/wms/components/backend/WmsSkuDetailPage.js +975 -0
- package/dist/modules/wms/components/backend/WmsSkuDetailPage.js.map +7 -0
- package/dist/modules/wms/components/backend/inventoryMutationLoaders.js +710 -0
- package/dist/modules/wms/components/backend/inventoryMutationLoaders.js.map +7 -0
- package/dist/modules/wms/components/backend/useWmsInventoryMutationAccess.js +79 -0
- package/dist/modules/wms/components/backend/useWmsInventoryMutationAccess.js.map +7 -0
- package/dist/modules/wms/components/backend/useWmsInventoryScopeFromSearchParams.js +24 -0
- package/dist/modules/wms/components/backend/useWmsInventoryScopeFromSearchParams.js.map +7 -0
- package/dist/modules/wms/components/backend/wmsLookupLoaders.js +55 -0
- package/dist/modules/wms/components/backend/wmsLookupLoaders.js.map +7 -0
- package/dist/modules/wms/data/enrichers.js +501 -0
- package/dist/modules/wms/data/enrichers.js.map +7 -0
- package/dist/modules/wms/data/entities.js +467 -0
- package/dist/modules/wms/data/entities.js.map +7 -0
- package/dist/modules/wms/data/validators.js +399 -0
- package/dist/modules/wms/data/validators.js.map +7 -0
- package/dist/modules/wms/di.js +27 -0
- package/dist/modules/wms/di.js.map +7 -0
- package/dist/modules/wms/events.js +42 -0
- package/dist/modules/wms/events.js.map +7 -0
- package/dist/modules/wms/index.js +17 -0
- package/dist/modules/wms/index.js.map +7 -0
- package/dist/modules/wms/lib/catalogInventoryProfileIntent.js +54 -0
- package/dist/modules/wms/lib/catalogInventoryProfileIntent.js.map +7 -0
- package/dist/modules/wms/lib/catalogInventoryProfileSync.js +144 -0
- package/dist/modules/wms/lib/catalogInventoryProfileSync.js.map +7 -0
- package/dist/modules/wms/lib/expiry.js +29 -0
- package/dist/modules/wms/lib/expiry.js.map +7 -0
- package/dist/modules/wms/lib/flashMutationError.js +51 -0
- package/dist/modules/wms/lib/flashMutationError.js.map +7 -0
- package/dist/modules/wms/lib/inventoryDisplayUi.js +188 -0
- package/dist/modules/wms/lib/inventoryDisplayUi.js.map +7 -0
- package/dist/modules/wms/lib/inventoryIdempotency.js +37 -0
- package/dist/modules/wms/lib/inventoryIdempotency.js.map +7 -0
- package/dist/modules/wms/lib/inventoryImportCsv.js +173 -0
- package/dist/modules/wms/lib/inventoryImportCsv.js.map +7 -0
- package/dist/modules/wms/lib/inventoryImportService.js +468 -0
- package/dist/modules/wms/lib/inventoryImportService.js.map +7 -0
- package/dist/modules/wms/lib/inventoryMutationUi.js +25 -0
- package/dist/modules/wms/lib/inventoryMutationUi.js.map +7 -0
- package/dist/modules/wms/lib/inventoryPolicy.js +61 -0
- package/dist/modules/wms/lib/inventoryPolicy.js.map +7 -0
- package/dist/modules/wms/lib/inventoryReconciliation.js +193 -0
- package/dist/modules/wms/lib/inventoryReconciliation.js.map +7 -0
- package/dist/modules/wms/lib/inventoryTrackingValidation.js +13 -0
- package/dist/modules/wms/lib/inventoryTrackingValidation.js.map +7 -0
- package/dist/modules/wms/lib/loadOperationalDashboard.js +580 -0
- package/dist/modules/wms/lib/loadOperationalDashboard.js.map +7 -0
- package/dist/modules/wms/lib/lowStockBalanceFilter.js +49 -0
- package/dist/modules/wms/lib/lowStockBalanceFilter.js.map +7 -0
- package/dist/modules/wms/lib/primaryWarehousePolicy.js +32 -0
- package/dist/modules/wms/lib/primaryWarehousePolicy.js.map +7 -0
- package/dist/modules/wms/lib/roleFeatures.js +30 -0
- package/dist/modules/wms/lib/roleFeatures.js.map +7 -0
- package/dist/modules/wms/lib/salesOrderInventoryAutomation.js +291 -0
- package/dist/modules/wms/lib/salesOrderInventoryAutomation.js.map +7 -0
- package/dist/modules/wms/lib/salesOrderWarehouseAssignment.js +54 -0
- package/dist/modules/wms/lib/salesOrderWarehouseAssignment.js.map +7 -0
- package/dist/modules/wms/lib/wmsIntegrationToggles.js +71 -0
- package/dist/modules/wms/lib/wmsIntegrationToggles.js.map +7 -0
- package/dist/modules/wms/migrations/Migration20260428110546.js +78 -0
- package/dist/modules/wms/migrations/Migration20260428110546.js.map +7 -0
- package/dist/modules/wms/migrations/Migration20260527120000.js +15 -0
- package/dist/modules/wms/migrations/Migration20260527120000.js.map +7 -0
- package/dist/modules/wms/migrations/Migration20260527140000.js +37 -0
- package/dist/modules/wms/migrations/Migration20260527140000.js.map +7 -0
- package/dist/modules/wms/migrations/Migration20260613120000.js +23 -0
- package/dist/modules/wms/migrations/Migration20260613120000.js.map +7 -0
- package/dist/modules/wms/migrations/Migration20260616090000.js +13 -0
- package/dist/modules/wms/migrations/Migration20260616090000.js.map +7 -0
- package/dist/modules/wms/migrations/Migration20260707180000.js +15 -0
- package/dist/modules/wms/migrations/Migration20260707180000.js.map +7 -0
- package/dist/modules/wms/notifications.client.js +18 -0
- package/dist/modules/wms/notifications.client.js.map +7 -0
- package/dist/modules/wms/notifications.js +53 -0
- package/dist/modules/wms/notifications.js.map +7 -0
- package/dist/modules/wms/search.js +196 -0
- package/dist/modules/wms/search.js.map +7 -0
- package/dist/modules/wms/setup.js +30 -0
- package/dist/modules/wms/setup.js.map +7 -0
- package/dist/modules/wms/subscribers/low-stock-notification.js +40 -0
- package/dist/modules/wms/subscribers/low-stock-notification.js.map +7 -0
- package/dist/modules/wms/subscribers/reservation-shortfall-notification.js +69 -0
- package/dist/modules/wms/subscribers/reservation-shortfall-notification.js.map +7 -0
- package/dist/modules/wms/subscribers/sales-order-cancelled-release.js +14 -0
- package/dist/modules/wms/subscribers/sales-order-cancelled-release.js.map +7 -0
- package/dist/modules/wms/subscribers/sales-order-confirmed-reserve.js +14 -0
- package/dist/modules/wms/subscribers/sales-order-confirmed-reserve.js.map +7 -0
- package/dist/modules/wms/translations.js +10 -0
- package/dist/modules/wms/translations.js.map +7 -0
- package/dist/modules/wms/vector.js +9 -0
- package/dist/modules/wms/vector.js.map +7 -0
- package/dist/modules/wms/widgets/injection/catalog-inventory-profile/widget.js +200 -0
- package/dist/modules/wms/widgets/injection/catalog-inventory-profile/widget.js.map +7 -0
- package/dist/modules/wms/widgets/injection/order-items-stock-column/widget.js +104 -0
- package/dist/modules/wms/widgets/injection/order-items-stock-column/widget.js.map +7 -0
- package/dist/modules/wms/widgets/injection/sales-order-stock-context/widget.client.js +389 -0
- package/dist/modules/wms/widgets/injection/sales-order-stock-context/widget.client.js.map +7 -0
- package/dist/modules/wms/widgets/injection/sales-order-stock-context/widget.js +16 -0
- package/dist/modules/wms/widgets/injection/sales-order-stock-context/widget.js.map +7 -0
- package/dist/modules/wms/widgets/injection-table.js +36 -0
- package/dist/modules/wms/widgets/injection-table.js.map +7 -0
- package/dist/modules/wms/widgets/notifications/WmsLowStockRenderer.js +150 -0
- package/dist/modules/wms/widgets/notifications/WmsLowStockRenderer.js.map +7 -0
- package/dist/modules/wms/widgets/notifications/WmsReservationShortfallRenderer.js +186 -0
- package/dist/modules/wms/widgets/notifications/WmsReservationShortfallRenderer.js.map +7 -0
- package/dist/modules/wms/widgets/notifications/index.js +7 -0
- package/dist/modules/wms/widgets/notifications/index.js.map +7 -0
- package/generated/entities/inventory_balance/index.ts +9 -0
- package/generated/entities/inventory_lot/index.ts +8 -0
- package/generated/entities/inventory_movement/index.ts +16 -0
- package/generated/entities/inventory_reservation/index.ts +10 -0
- package/generated/entities/product_inventory_profile/index.ts +9 -0
- package/generated/entities/sales_order_warehouse_assignment/index.ts +4 -0
- package/generated/entities/warehouse/index.ts +11 -0
- package/generated/entities/warehouse_location/index.ts +9 -0
- package/generated/entities/warehouse_zone/index.ts +4 -0
- package/generated/entities.ids.generated.ts +12 -0
- package/generated/entity-fields-registry.ts +98 -0
- package/package.json +7 -7
- package/src/modules/auth/backend/roles/page.tsx +13 -4
- 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/pl.json +2 -0
- package/src/modules/auth/lib/backendChrome.tsx +1 -0
- package/src/modules/auth/services/rbacService.ts +25 -21
- package/src/modules/catalog/api/products/route.ts +3 -0
- package/src/modules/catalog/api/variants/route.ts +3 -0
- package/src/modules/query_index/lib/engine.ts +18 -6
- package/src/modules/sales/api/documents/factory.ts +1 -0
- package/src/modules/sales/commands/documents.ts +71 -0
- package/src/modules/sales/components/documents/ItemsSection.tsx +58 -0
- package/src/modules/sales/events.ts +2 -0
- package/src/modules/sales/widgets/injection/order-items-context.ts +15 -0
- package/src/modules/wms/acl.ts +14 -0
- package/src/modules/wms/analytics.ts +9 -0
- package/src/modules/wms/api/dashboard/operational/route.ts +83 -0
- package/src/modules/wms/api/interceptors.ts +108 -0
- package/src/modules/wms/api/inventory/adjust/route.ts +50 -0
- package/src/modules/wms/api/inventory/allocate/route.ts +50 -0
- package/src/modules/wms/api/inventory/balances/route.ts +178 -0
- package/src/modules/wms/api/inventory/cycle-count/route.ts +51 -0
- package/src/modules/wms/api/inventory/helpers.ts +128 -0
- package/src/modules/wms/api/inventory/import/apply/route.ts +47 -0
- package/src/modules/wms/api/inventory/import/helpers.ts +223 -0
- package/src/modules/wms/api/inventory/import/template/route.ts +31 -0
- package/src/modules/wms/api/inventory/import/validate/route.ts +56 -0
- package/src/modules/wms/api/inventory/move/route.ts +50 -0
- package/src/modules/wms/api/inventory/movements/route.ts +164 -0
- package/src/modules/wms/api/inventory/receive/route.ts +49 -0
- package/src/modules/wms/api/inventory/release/route.ts +43 -0
- package/src/modules/wms/api/inventory/reservations/route.ts +128 -0
- package/src/modules/wms/api/inventory/reserve/route.ts +59 -0
- package/src/modules/wms/api/inventory-profiles/route.ts +177 -0
- package/src/modules/wms/api/listEnrichers.ts +312 -0
- package/src/modules/wms/api/listSearch.ts +121 -0
- package/src/modules/wms/api/locations/route.ts +171 -0
- package/src/modules/wms/api/lots/route.ts +205 -0
- package/src/modules/wms/api/openapi.ts +28 -0
- package/src/modules/wms/api/sales-orders/[salesOrderId]/re-run-reservation/route.ts +58 -0
- package/src/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.ts +306 -0
- package/src/modules/wms/api/sales-orders/assign-warehouse/route.ts +57 -0
- package/src/modules/wms/api/sales-orders/unassign-warehouse/route.ts +43 -0
- package/src/modules/wms/api/warehouses/route.ts +181 -0
- package/src/modules/wms/api/zones/route.ts +158 -0
- package/src/modules/wms/backend/config/wms/page.meta.ts +14 -0
- package/src/modules/wms/backend/config/wms/page.tsx +5 -0
- package/src/modules/wms/backend/page.meta.ts +12 -0
- package/src/modules/wms/backend/page.tsx +5 -0
- package/src/modules/wms/backend/wms/inventory/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/inventory/page.tsx +5 -0
- package/src/modules/wms/backend/wms/location/[id]/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/location/[id]/page.tsx +5 -0
- package/src/modules/wms/backend/wms/locations/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/locations/page.tsx +12 -0
- package/src/modules/wms/backend/wms/lot/[id]/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/lot/[id]/page.tsx +5 -0
- package/src/modules/wms/backend/wms/lots/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/lots/page.tsx +5 -0
- package/src/modules/wms/backend/wms/movements/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/movements/page.tsx +23 -0
- package/src/modules/wms/backend/wms/reservations/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/reservations/page.tsx +24 -0
- package/src/modules/wms/backend/wms/sku/[id]/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/sku/[id]/page.tsx +5 -0
- package/src/modules/wms/backend/wms/warehouses/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/warehouses/page.tsx +12 -0
- package/src/modules/wms/backend/wms/zones/page.meta.ts +14 -0
- package/src/modules/wms/backend/wms/zones/page.tsx +12 -0
- package/src/modules/wms/ce.ts +76 -0
- package/src/modules/wms/cli.ts +96 -0
- package/src/modules/wms/commands/configuration.ts +1844 -0
- package/src/modules/wms/commands/index.ts +3 -0
- package/src/modules/wms/commands/inventory-actions.ts +1866 -0
- package/src/modules/wms/commands/sales-order-assignment.ts +346 -0
- package/src/modules/wms/commands/shared.ts +90 -0
- package/src/modules/wms/components/backend/AdjustInventoryDialog.tsx +820 -0
- package/src/modules/wms/components/backend/ChangeLotStatusDialog.tsx +312 -0
- package/src/modules/wms/components/backend/CycleCountWizardDialog.tsx +2007 -0
- package/src/modules/wms/components/backend/ImportInventoryDialog.tsx +1018 -0
- package/src/modules/wms/components/backend/InventoryOperationsSection.tsx +159 -0
- package/src/modules/wms/components/backend/LocationEditDialog.tsx +185 -0
- package/src/modules/wms/components/backend/MoveInventoryDialog.tsx +907 -0
- package/src/modules/wms/components/backend/ReceiveInventoryDialog.tsx +695 -0
- package/src/modules/wms/components/backend/ReleaseReservationDialog.tsx +424 -0
- package/src/modules/wms/components/backend/ReserveInventoryDialog.tsx +511 -0
- package/src/modules/wms/components/backend/WmsConfigurationPage.tsx +1340 -0
- package/src/modules/wms/components/backend/WmsInventoryConsolePage.tsx +1132 -0
- package/src/modules/wms/components/backend/WmsLocationDetailPage.tsx +1310 -0
- package/src/modules/wms/components/backend/WmsLotDetailPage.tsx +1355 -0
- package/src/modules/wms/components/backend/WmsLotsListPage.tsx +359 -0
- package/src/modules/wms/components/backend/WmsOperationalDashboardPage.tsx +958 -0
- package/src/modules/wms/components/backend/WmsSkuDetailPage.tsx +1245 -0
- package/src/modules/wms/components/backend/inventoryMutationLoaders.ts +960 -0
- package/src/modules/wms/components/backend/useWmsInventoryMutationAccess.ts +89 -0
- package/src/modules/wms/components/backend/useWmsInventoryScopeFromSearchParams.ts +32 -0
- package/src/modules/wms/components/backend/wmsLookupLoaders.ts +78 -0
- package/src/modules/wms/data/enrichers.ts +718 -0
- package/src/modules/wms/data/entities.ts +436 -0
- package/src/modules/wms/data/validators.ts +463 -0
- package/src/modules/wms/di.ts +25 -0
- package/src/modules/wms/events.ts +41 -0
- package/src/modules/wms/i18n/de.json +1051 -0
- package/src/modules/wms/i18n/en.json +1051 -0
- package/src/modules/wms/i18n/es.json +1051 -0
- package/src/modules/wms/i18n/pl.json +1051 -0
- package/src/modules/wms/index.ts +15 -0
- package/src/modules/wms/lib/catalogInventoryProfileIntent.ts +65 -0
- package/src/modules/wms/lib/catalogInventoryProfileSync.ts +199 -0
- package/src/modules/wms/lib/expiry.ts +30 -0
- package/src/modules/wms/lib/flashMutationError.ts +74 -0
- package/src/modules/wms/lib/inventoryDisplayUi.ts +249 -0
- package/src/modules/wms/lib/inventoryIdempotency.ts +54 -0
- package/src/modules/wms/lib/inventoryImportCsv.ts +212 -0
- package/src/modules/wms/lib/inventoryImportService.ts +629 -0
- package/src/modules/wms/lib/inventoryMutationUi.ts +21 -0
- package/src/modules/wms/lib/inventoryPolicy.ts +111 -0
- package/src/modules/wms/lib/inventoryReconciliation.ts +263 -0
- package/src/modules/wms/lib/inventoryTrackingValidation.ts +23 -0
- package/src/modules/wms/lib/loadOperationalDashboard.ts +776 -0
- package/src/modules/wms/lib/lowStockBalanceFilter.ts +74 -0
- package/src/modules/wms/lib/primaryWarehousePolicy.ts +46 -0
- package/src/modules/wms/lib/roleFeatures.ts +32 -0
- package/src/modules/wms/lib/salesOrderInventoryAutomation.ts +390 -0
- package/src/modules/wms/lib/salesOrderWarehouseAssignment.ts +78 -0
- package/src/modules/wms/lib/wmsIntegrationToggles.ts +81 -0
- package/src/modules/wms/migrations/.snapshot-open-mercato.json +2880 -0
- package/src/modules/wms/migrations/Migration20260428110546.ts +91 -0
- package/src/modules/wms/migrations/Migration20260527120000.ts +15 -0
- package/src/modules/wms/migrations/Migration20260527140000.ts +35 -0
- package/src/modules/wms/migrations/Migration20260613120000.ts +21 -0
- package/src/modules/wms/migrations/Migration20260616090000.ts +11 -0
- package/src/modules/wms/migrations/Migration20260707180000.ts +13 -0
- package/src/modules/wms/notifications.client.ts +18 -0
- package/src/modules/wms/notifications.ts +51 -0
- package/src/modules/wms/search.ts +230 -0
- package/src/modules/wms/setup.ts +29 -0
- package/src/modules/wms/subscribers/low-stock-notification.ts +54 -0
- package/src/modules/wms/subscribers/reservation-shortfall-notification.ts +98 -0
- package/src/modules/wms/subscribers/sales-order-cancelled-release.ts +21 -0
- package/src/modules/wms/subscribers/sales-order-confirmed-reserve.ts +21 -0
- package/src/modules/wms/translations.ts +6 -0
- package/src/modules/wms/vector.ts +7 -0
- package/src/modules/wms/widgets/injection/catalog-inventory-profile/widget.ts +238 -0
- package/src/modules/wms/widgets/injection/order-items-stock-column/widget.tsx +153 -0
- package/src/modules/wms/widgets/injection/sales-order-stock-context/widget.client.tsx +476 -0
- package/src/modules/wms/widgets/injection/sales-order-stock-context/widget.ts +15 -0
- package/src/modules/wms/widgets/injection-table.ts +34 -0
- package/src/modules/wms/widgets/notifications/WmsLowStockRenderer.tsx +153 -0
- package/src/modules/wms/widgets/notifications/WmsReservationShortfallRenderer.tsx +194 -0
- package/src/modules/wms/widgets/notifications/index.ts +2 -0
|
@@ -0,0 +1,908 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import Link from "next/link";
|
|
5
|
+
import { useQuery } from "@tanstack/react-query";
|
|
6
|
+
import { Page, PageBody } from "@open-mercato/ui/backend/Page";
|
|
7
|
+
import { DataTable } from "@open-mercato/ui/backend/DataTable";
|
|
8
|
+
import { EmptyState } from "@open-mercato/ui/backend/EmptyState";
|
|
9
|
+
import { RowActions } from "@open-mercato/ui/backend/RowActions";
|
|
10
|
+
import { ComboboxInput } from "@open-mercato/ui/backend/inputs/ComboboxInput";
|
|
11
|
+
import { apiCall } from "@open-mercato/ui/backend/utils/apiCall";
|
|
12
|
+
import { raiseCrudError } from "@open-mercato/ui/backend/utils/serverErrors";
|
|
13
|
+
import { flash } from "@open-mercato/ui/backend/FlashMessages";
|
|
14
|
+
import { useGuardedMutation } from "@open-mercato/ui/backend/injection/useGuardedMutation";
|
|
15
|
+
import { useLocale, useT } from "@open-mercato/shared/lib/i18n/context";
|
|
16
|
+
import { StatusBadge } from "@open-mercato/ui/primitives/status-badge";
|
|
17
|
+
import { Boxes, Package, Route, ShieldCheck, Warehouse as WarehouseIcon, X } from "lucide-react";
|
|
18
|
+
import { E } from "../../../../generated/entities.ids.generated.js";
|
|
19
|
+
import {
|
|
20
|
+
createInventoryDateTimeFormatter,
|
|
21
|
+
createInventoryQuantityFormatter,
|
|
22
|
+
formatCatalogVariantLabel,
|
|
23
|
+
formatInventoryDateTime,
|
|
24
|
+
formatInventoryQuantity,
|
|
25
|
+
formatReservationSourceLabel,
|
|
26
|
+
inventoryMovementTypeLabel,
|
|
27
|
+
inventoryReferenceTypeLabel,
|
|
28
|
+
inventoryReservationSourceTypeLabel,
|
|
29
|
+
inventoryReservationStatusLabel
|
|
30
|
+
} from "../../lib/inventoryDisplayUi.js";
|
|
31
|
+
import { parseInventoryQuantity } from "../../lib/inventoryMutationUi.js";
|
|
32
|
+
import { ImportInventoryDialog } from "./ImportInventoryDialog.js";
|
|
33
|
+
import { InventoryOperationsSection } from "./InventoryOperationsSection.js";
|
|
34
|
+
import { MoveInventoryDialog } from "./MoveInventoryDialog.js";
|
|
35
|
+
import { ReceiveInventoryDialog } from "./ReceiveInventoryDialog.js";
|
|
36
|
+
import { ReleaseReservationDialog } from "./ReleaseReservationDialog.js";
|
|
37
|
+
import {
|
|
38
|
+
useWmsInventoryMutationAccess
|
|
39
|
+
} from "./useWmsInventoryMutationAccess.js";
|
|
40
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
41
|
+
import {
|
|
42
|
+
loadCatalogVariantOptions,
|
|
43
|
+
loadWarehouseOptions,
|
|
44
|
+
resolveCatalogVariantLabel,
|
|
45
|
+
resolveWarehouseLabel
|
|
46
|
+
} from "./inventoryMutationLoaders.js";
|
|
47
|
+
import { mergeLabelCacheEntries } from "./wmsLookupLoaders.js";
|
|
48
|
+
import {
|
|
49
|
+
useWmsInventoryScopeFromSearchParams
|
|
50
|
+
} from "./useWmsInventoryScopeFromSearchParams.js";
|
|
51
|
+
function formatVariantLabel(row) {
|
|
52
|
+
return formatCatalogVariantLabel(row);
|
|
53
|
+
}
|
|
54
|
+
const movementStatusMap = {
|
|
55
|
+
receipt: "success",
|
|
56
|
+
return_receive: "success",
|
|
57
|
+
adjust: "warning",
|
|
58
|
+
transfer: "info",
|
|
59
|
+
pick: "info",
|
|
60
|
+
pack: "info",
|
|
61
|
+
cycle_count: "neutral",
|
|
62
|
+
putaway: "info",
|
|
63
|
+
ship: "success"
|
|
64
|
+
};
|
|
65
|
+
const reservationStatusMap = {
|
|
66
|
+
active: "info",
|
|
67
|
+
released: "neutral",
|
|
68
|
+
fulfilled: "success"
|
|
69
|
+
};
|
|
70
|
+
function useInventoryDisplayFormatters() {
|
|
71
|
+
const locale = useLocale();
|
|
72
|
+
const quantityFormatter = React.useMemo(
|
|
73
|
+
() => createInventoryQuantityFormatter(locale),
|
|
74
|
+
[locale]
|
|
75
|
+
);
|
|
76
|
+
const dateTimeFormatter = React.useMemo(
|
|
77
|
+
() => createInventoryDateTimeFormatter(locale),
|
|
78
|
+
[locale]
|
|
79
|
+
);
|
|
80
|
+
return { quantityFormatter, dateTimeFormatter };
|
|
81
|
+
}
|
|
82
|
+
function formatWarehouseLabel(row) {
|
|
83
|
+
return row.warehouse_name?.trim() || row.warehouse_code?.trim() || row.warehouse_id || "\u2014";
|
|
84
|
+
}
|
|
85
|
+
function formatLocationLabel(row, prefix) {
|
|
86
|
+
const code = String(row[`${prefix}_code`] ?? "").trim();
|
|
87
|
+
if (code) return code;
|
|
88
|
+
const id = row[`${prefix}_id`];
|
|
89
|
+
return typeof id === "string" && id ? id : "\u2014";
|
|
90
|
+
}
|
|
91
|
+
function SectionCard({
|
|
92
|
+
title,
|
|
93
|
+
description,
|
|
94
|
+
icon,
|
|
95
|
+
children
|
|
96
|
+
}) {
|
|
97
|
+
return /* @__PURE__ */ jsxs("section", { className: "rounded-lg border bg-card p-5 text-card-foreground shadow-sm", children: [
|
|
98
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-4 flex items-start gap-3", children: [
|
|
99
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-md border bg-muted/40 p-2 text-muted-foreground", children: icon }),
|
|
100
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
101
|
+
/* @__PURE__ */ jsx("h2", { className: "text-xl font-semibold", children: title }),
|
|
102
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description })
|
|
103
|
+
] })
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children })
|
|
106
|
+
] });
|
|
107
|
+
}
|
|
108
|
+
function buildInventoryQuery(search, page, pageSize, sorting, scope) {
|
|
109
|
+
const sortCol = sorting[0];
|
|
110
|
+
const params = new URLSearchParams({
|
|
111
|
+
page: String(page),
|
|
112
|
+
pageSize: String(pageSize),
|
|
113
|
+
sortField: sortCol ? sortCol.id : "updatedAt",
|
|
114
|
+
sortDir: sortCol ? sortCol.desc ? "desc" : "asc" : "desc"
|
|
115
|
+
});
|
|
116
|
+
if (search.trim()) params.set("search", search.trim());
|
|
117
|
+
if (scope.warehouseId.trim()) params.set("warehouseId", scope.warehouseId.trim());
|
|
118
|
+
if (scope.variantId.trim()) params.set("catalogVariantId", scope.variantId.trim());
|
|
119
|
+
if (scope.lotId.trim()) params.set("lotId", scope.lotId.trim());
|
|
120
|
+
if (scope.lowStock) params.set("lowStock", scope.lowStock);
|
|
121
|
+
return params.toString();
|
|
122
|
+
}
|
|
123
|
+
function InventoryDataTableSection({
|
|
124
|
+
sectionQueryKey,
|
|
125
|
+
endpoint,
|
|
126
|
+
titleKey,
|
|
127
|
+
titleFallback,
|
|
128
|
+
descriptionKey,
|
|
129
|
+
descriptionFallback,
|
|
130
|
+
errorKey,
|
|
131
|
+
errorFallback,
|
|
132
|
+
searchKey,
|
|
133
|
+
searchFallback,
|
|
134
|
+
emptyTitleKey,
|
|
135
|
+
emptyTitleFallback,
|
|
136
|
+
emptyDescriptionKey,
|
|
137
|
+
emptyDescriptionFallback,
|
|
138
|
+
tableId,
|
|
139
|
+
entityId,
|
|
140
|
+
icon,
|
|
141
|
+
columns,
|
|
142
|
+
rowActions,
|
|
143
|
+
warehouseId = "",
|
|
144
|
+
variantId = "",
|
|
145
|
+
lotId = "",
|
|
146
|
+
lowStock = null,
|
|
147
|
+
extraParams,
|
|
148
|
+
toolbarActions,
|
|
149
|
+
emptyStateAction
|
|
150
|
+
}) {
|
|
151
|
+
const t = useT();
|
|
152
|
+
const [page, setPage] = React.useState(1);
|
|
153
|
+
const [search, setSearch] = React.useState("");
|
|
154
|
+
const [sorting, setSorting] = React.useState([]);
|
|
155
|
+
const handleSortingChange = React.useCallback((nextSorting) => {
|
|
156
|
+
setSorting(nextSorting);
|
|
157
|
+
setPage(1);
|
|
158
|
+
}, []);
|
|
159
|
+
const params = React.useMemo(() => {
|
|
160
|
+
const base = buildInventoryQuery(search, page, 20, sorting, {
|
|
161
|
+
warehouseId,
|
|
162
|
+
variantId,
|
|
163
|
+
lotId,
|
|
164
|
+
lowStock
|
|
165
|
+
});
|
|
166
|
+
if (!extraParams || Object.keys(extraParams).length === 0) return base;
|
|
167
|
+
const urlParams = new URLSearchParams(base);
|
|
168
|
+
for (const [key, value] of Object.entries(extraParams)) {
|
|
169
|
+
urlParams.set(key, value);
|
|
170
|
+
}
|
|
171
|
+
return urlParams.toString();
|
|
172
|
+
}, [extraParams, lowStock, lotId, page, search, sorting, variantId, warehouseId]);
|
|
173
|
+
React.useEffect(() => {
|
|
174
|
+
setPage(1);
|
|
175
|
+
}, [warehouseId, variantId, lotId, lowStock]);
|
|
176
|
+
const query = useQuery({
|
|
177
|
+
queryKey: ["wms-inventory-console", sectionQueryKey, params],
|
|
178
|
+
queryFn: async () => {
|
|
179
|
+
const call = await apiCall(`${endpoint}?${params}`);
|
|
180
|
+
if (!call.ok) {
|
|
181
|
+
await raiseCrudError(call.response, t(errorKey, errorFallback));
|
|
182
|
+
}
|
|
183
|
+
return call.result ?? { items: [], total: 0, totalPages: 1 };
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
return /* @__PURE__ */ jsx(
|
|
187
|
+
SectionCard,
|
|
188
|
+
{
|
|
189
|
+
title: t(titleKey, titleFallback),
|
|
190
|
+
description: t(descriptionKey, descriptionFallback),
|
|
191
|
+
icon,
|
|
192
|
+
children: /* @__PURE__ */ jsx(
|
|
193
|
+
DataTable,
|
|
194
|
+
{
|
|
195
|
+
embedded: true,
|
|
196
|
+
title: t(titleKey, titleFallback),
|
|
197
|
+
columns,
|
|
198
|
+
data: query.data?.items ?? [],
|
|
199
|
+
isLoading: query.isLoading,
|
|
200
|
+
error: query.isError ? t(errorKey, errorFallback) : null,
|
|
201
|
+
entityId,
|
|
202
|
+
searchValue: search,
|
|
203
|
+
onSearchChange: (value) => {
|
|
204
|
+
setSearch(value);
|
|
205
|
+
setPage(1);
|
|
206
|
+
},
|
|
207
|
+
searchPlaceholder: t(searchKey, searchFallback),
|
|
208
|
+
pagination: {
|
|
209
|
+
page,
|
|
210
|
+
pageSize: 20,
|
|
211
|
+
total: query.data?.total ?? 0,
|
|
212
|
+
totalPages: query.data?.totalPages ?? 1,
|
|
213
|
+
onPageChange: setPage
|
|
214
|
+
},
|
|
215
|
+
perspective: { tableId },
|
|
216
|
+
sortable: true,
|
|
217
|
+
manualSorting: true,
|
|
218
|
+
sorting,
|
|
219
|
+
onSortingChange: handleSortingChange,
|
|
220
|
+
rowActions,
|
|
221
|
+
emptyState: /* @__PURE__ */ jsx(
|
|
222
|
+
EmptyState,
|
|
223
|
+
{
|
|
224
|
+
title: t(emptyTitleKey, emptyTitleFallback),
|
|
225
|
+
description: t(emptyDescriptionKey, emptyDescriptionFallback),
|
|
226
|
+
actions: emptyStateAction
|
|
227
|
+
}
|
|
228
|
+
),
|
|
229
|
+
actions: toolbarActions
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
function InventoryScopeBar({
|
|
236
|
+
warehouseId,
|
|
237
|
+
variantId,
|
|
238
|
+
onWarehouseChange,
|
|
239
|
+
onVariantChange
|
|
240
|
+
}) {
|
|
241
|
+
const t = useT();
|
|
242
|
+
const [warehouseLabelCache, setWarehouseLabelCache] = React.useState({});
|
|
243
|
+
const [variantLabelCache, setVariantLabelCache] = React.useState({});
|
|
244
|
+
const warehouseLabelCacheRef = React.useRef(warehouseLabelCache);
|
|
245
|
+
warehouseLabelCacheRef.current = warehouseLabelCache;
|
|
246
|
+
const variantLabelCacheRef = React.useRef(variantLabelCache);
|
|
247
|
+
variantLabelCacheRef.current = variantLabelCache;
|
|
248
|
+
React.useEffect(() => {
|
|
249
|
+
if (!warehouseId.trim() || warehouseLabelCacheRef.current[warehouseId]) return;
|
|
250
|
+
let cancelled = false;
|
|
251
|
+
void resolveWarehouseLabel(warehouseId).then((label) => {
|
|
252
|
+
if (cancelled || !label) return;
|
|
253
|
+
setWarehouseLabelCache((c) => ({ ...c, [warehouseId]: label }));
|
|
254
|
+
});
|
|
255
|
+
return () => {
|
|
256
|
+
cancelled = true;
|
|
257
|
+
};
|
|
258
|
+
}, [warehouseId]);
|
|
259
|
+
React.useEffect(() => {
|
|
260
|
+
if (!variantId.trim() || variantLabelCacheRef.current[variantId]) return;
|
|
261
|
+
let cancelled = false;
|
|
262
|
+
void resolveCatalogVariantLabel(variantId).then((label) => {
|
|
263
|
+
if (cancelled || !label) return;
|
|
264
|
+
setVariantLabelCache((c) => ({ ...c, [variantId]: label }));
|
|
265
|
+
});
|
|
266
|
+
return () => {
|
|
267
|
+
cancelled = true;
|
|
268
|
+
};
|
|
269
|
+
}, [variantId]);
|
|
270
|
+
const loadWarehouseSuggestions = React.useCallback(async (query) => {
|
|
271
|
+
const options = await loadWarehouseOptions(query);
|
|
272
|
+
setWarehouseLabelCache((c) => mergeLabelCacheEntries(c, options));
|
|
273
|
+
return options.map((o) => ({ value: o.value, label: o.label }));
|
|
274
|
+
}, []);
|
|
275
|
+
const loadVariantSuggestions = React.useCallback(async (query) => {
|
|
276
|
+
const options = await loadCatalogVariantOptions(query);
|
|
277
|
+
setVariantLabelCache((c) => mergeLabelCacheEntries(c, options));
|
|
278
|
+
return options.map((o) => ({ value: o.value, label: o.label }));
|
|
279
|
+
}, []);
|
|
280
|
+
const hasScope = warehouseId.trim() || variantId.trim();
|
|
281
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3 rounded-lg border bg-card px-4 py-3 shadow-sm", children: [
|
|
282
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
283
|
+
/* @__PURE__ */ jsx(WarehouseIcon, { className: "size-4 shrink-0" }),
|
|
284
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: t("wms.backend.inventory.console.scopeBar.label", "Scope") })
|
|
285
|
+
] }),
|
|
286
|
+
/* @__PURE__ */ jsx("div", { className: "w-56", children: /* @__PURE__ */ jsx(
|
|
287
|
+
ComboboxInput,
|
|
288
|
+
{
|
|
289
|
+
value: warehouseId,
|
|
290
|
+
onChange: (next) => onWarehouseChange(next.trim()),
|
|
291
|
+
loadSuggestions: loadWarehouseSuggestions,
|
|
292
|
+
resolveLabel: (value) => warehouseLabelCache[value] ?? value,
|
|
293
|
+
placeholder: t("wms.backend.inventory.console.scopeBar.allWarehouses", "All warehouses"),
|
|
294
|
+
allowCustomValues: false,
|
|
295
|
+
clearable: true
|
|
296
|
+
}
|
|
297
|
+
) }),
|
|
298
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 text-muted-foreground", children: /* @__PURE__ */ jsx(Package, { className: "size-4 shrink-0" }) }),
|
|
299
|
+
/* @__PURE__ */ jsx("div", { className: "w-56", children: /* @__PURE__ */ jsx(
|
|
300
|
+
ComboboxInput,
|
|
301
|
+
{
|
|
302
|
+
value: variantId,
|
|
303
|
+
onChange: (next) => onVariantChange(next.trim()),
|
|
304
|
+
loadSuggestions: loadVariantSuggestions,
|
|
305
|
+
resolveLabel: (value) => variantLabelCache[value] ?? value,
|
|
306
|
+
placeholder: t("wms.backend.inventory.console.scopeBar.allVariants", "All SKUs"),
|
|
307
|
+
allowCustomValues: false,
|
|
308
|
+
clearable: true
|
|
309
|
+
}
|
|
310
|
+
) }),
|
|
311
|
+
hasScope ? /* @__PURE__ */ jsxs(
|
|
312
|
+
Button,
|
|
313
|
+
{
|
|
314
|
+
type: "button",
|
|
315
|
+
variant: "ghost",
|
|
316
|
+
size: "sm",
|
|
317
|
+
className: "h-auto px-2 py-1 text-xs",
|
|
318
|
+
onClick: () => {
|
|
319
|
+
onWarehouseChange("");
|
|
320
|
+
onVariantChange("");
|
|
321
|
+
},
|
|
322
|
+
children: [
|
|
323
|
+
/* @__PURE__ */ jsx(X, { className: "size-3" }),
|
|
324
|
+
t("wms.backend.inventory.console.scopeBar.clearAll", "Clear")
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
) : null
|
|
328
|
+
] });
|
|
329
|
+
}
|
|
330
|
+
function InventoryBalancesSection({
|
|
331
|
+
access,
|
|
332
|
+
warehouseId = "",
|
|
333
|
+
variantId = "",
|
|
334
|
+
lotId = "",
|
|
335
|
+
lowStock = null
|
|
336
|
+
}) {
|
|
337
|
+
const t = useT();
|
|
338
|
+
const { quantityFormatter } = useInventoryDisplayFormatters();
|
|
339
|
+
const [moveOpen, setMoveOpen] = React.useState(false);
|
|
340
|
+
const [movePreset, setMovePreset] = React.useState(null);
|
|
341
|
+
const [receiveOpen, setReceiveOpen] = React.useState(false);
|
|
342
|
+
const [importOpen, setImportOpen] = React.useState(false);
|
|
343
|
+
const openMoveDialog = React.useCallback((row) => {
|
|
344
|
+
setMovePreset(row);
|
|
345
|
+
setMoveOpen(true);
|
|
346
|
+
}, []);
|
|
347
|
+
const columns = React.useMemo(
|
|
348
|
+
() => [
|
|
349
|
+
{
|
|
350
|
+
accessorKey: "catalog_variant_id",
|
|
351
|
+
id: "catalogVariantId",
|
|
352
|
+
header: t("wms.backend.inventory.balances.columns.variant", "Variant"),
|
|
353
|
+
enableSorting: true,
|
|
354
|
+
cell: ({ row }) => {
|
|
355
|
+
const variantId2 = row.original.catalog_variant_id?.trim();
|
|
356
|
+
const label = formatVariantLabel(row.original);
|
|
357
|
+
if (!variantId2) return label;
|
|
358
|
+
return /* @__PURE__ */ jsx(
|
|
359
|
+
Link,
|
|
360
|
+
{
|
|
361
|
+
href: `/backend/wms/sku/${encodeURIComponent(variantId2)}`,
|
|
362
|
+
className: "font-medium text-primary hover:underline",
|
|
363
|
+
children: label
|
|
364
|
+
}
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
accessorKey: "warehouse_id",
|
|
370
|
+
id: "warehouseId",
|
|
371
|
+
header: t(
|
|
372
|
+
"wms.backend.inventory.balances.columns.warehouse",
|
|
373
|
+
"Warehouse"
|
|
374
|
+
),
|
|
375
|
+
enableSorting: true,
|
|
376
|
+
cell: ({ row }) => formatWarehouseLabel(row.original)
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
accessorKey: "location_id",
|
|
380
|
+
id: "locationId",
|
|
381
|
+
header: t(
|
|
382
|
+
"wms.backend.inventory.balances.columns.location",
|
|
383
|
+
"Location"
|
|
384
|
+
),
|
|
385
|
+
enableSorting: true,
|
|
386
|
+
cell: ({ row }) => {
|
|
387
|
+
const locationId = row.original.location_id?.trim();
|
|
388
|
+
const label = formatLocationLabel(row.original, "location");
|
|
389
|
+
if (!locationId || label === "\u2014") return label;
|
|
390
|
+
return /* @__PURE__ */ jsx(
|
|
391
|
+
Link,
|
|
392
|
+
{
|
|
393
|
+
href: `/backend/wms/location/${encodeURIComponent(locationId)}`,
|
|
394
|
+
className: "font-medium text-primary hover:underline",
|
|
395
|
+
children: label
|
|
396
|
+
}
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
accessorKey: "lot_id",
|
|
402
|
+
header: t("wms.backend.inventory.balances.columns.lot", "Lot"),
|
|
403
|
+
enableSorting: false,
|
|
404
|
+
cell: ({ row }) => {
|
|
405
|
+
const lotId2 = row.original.lot_id?.trim();
|
|
406
|
+
if (!lotId2) return "\u2014";
|
|
407
|
+
return /* @__PURE__ */ jsx(
|
|
408
|
+
Link,
|
|
409
|
+
{
|
|
410
|
+
href: `/backend/wms/lot/${encodeURIComponent(lotId2)}`,
|
|
411
|
+
className: "font-medium text-primary hover:underline",
|
|
412
|
+
children: t("wms.backend.inventory.balances.lotLink", "View lot")
|
|
413
|
+
}
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
accessorKey: "quantity_available",
|
|
419
|
+
id: "quantityAvailable",
|
|
420
|
+
header: t(
|
|
421
|
+
"wms.backend.inventory.balances.columns.available",
|
|
422
|
+
"Available"
|
|
423
|
+
),
|
|
424
|
+
enableSorting: true,
|
|
425
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "tabular-nums", children: formatInventoryQuantity(row.original.quantity_available, quantityFormatter) })
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
accessorKey: "quantity_reserved",
|
|
429
|
+
id: "quantityReserved",
|
|
430
|
+
header: t(
|
|
431
|
+
"wms.backend.inventory.balances.columns.reserved",
|
|
432
|
+
"Reserved"
|
|
433
|
+
),
|
|
434
|
+
enableSorting: true,
|
|
435
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "tabular-nums", children: formatInventoryQuantity(row.original.quantity_reserved, quantityFormatter) })
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
accessorKey: "quantity_allocated",
|
|
439
|
+
id: "quantityAllocated",
|
|
440
|
+
header: t(
|
|
441
|
+
"wms.backend.inventory.balances.columns.allocated",
|
|
442
|
+
"Allocated"
|
|
443
|
+
),
|
|
444
|
+
enableSorting: true,
|
|
445
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "tabular-nums", children: formatInventoryQuantity(row.original.quantity_allocated, quantityFormatter) })
|
|
446
|
+
}
|
|
447
|
+
],
|
|
448
|
+
[quantityFormatter, t]
|
|
449
|
+
);
|
|
450
|
+
const rowActions = React.useCallback(
|
|
451
|
+
(row) => {
|
|
452
|
+
if (!access.canMove) return null;
|
|
453
|
+
const available = parseInventoryQuantity(row.quantity_available);
|
|
454
|
+
if (available <= 0) return null;
|
|
455
|
+
return /* @__PURE__ */ jsx(
|
|
456
|
+
RowActions,
|
|
457
|
+
{
|
|
458
|
+
items: [
|
|
459
|
+
{
|
|
460
|
+
id: "move",
|
|
461
|
+
label: t("wms.backend.inventory.balances.actions.move", "Move"),
|
|
462
|
+
onSelect: () => openMoveDialog(row)
|
|
463
|
+
}
|
|
464
|
+
]
|
|
465
|
+
}
|
|
466
|
+
);
|
|
467
|
+
},
|
|
468
|
+
[access.canMove, openMoveDialog, t]
|
|
469
|
+
);
|
|
470
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
471
|
+
/* @__PURE__ */ jsx(
|
|
472
|
+
InventoryDataTableSection,
|
|
473
|
+
{
|
|
474
|
+
sectionQueryKey: "balances",
|
|
475
|
+
endpoint: "/api/wms/inventory/balances",
|
|
476
|
+
titleKey: "wms.backend.inventory.balances.title",
|
|
477
|
+
titleFallback: "Inventory balances",
|
|
478
|
+
descriptionKey: "wms.backend.inventory.balances.description",
|
|
479
|
+
descriptionFallback: "Current on-hand, reserved, allocated, and available quantities by bucket.",
|
|
480
|
+
errorKey: "wms.backend.inventory.errors.balances",
|
|
481
|
+
errorFallback: "Failed to load balances.",
|
|
482
|
+
searchKey: "wms.backend.inventory.balances.search",
|
|
483
|
+
searchFallback: "Search balances",
|
|
484
|
+
emptyTitleKey: "wms.backend.inventory.balances.empty.title",
|
|
485
|
+
emptyTitleFallback: "No balance buckets",
|
|
486
|
+
emptyDescriptionKey: "wms.backend.inventory.balances.empty.description",
|
|
487
|
+
emptyDescriptionFallback: "Balances appear after receipts, adjustments, or moves create inventory buckets.",
|
|
488
|
+
tableId: "wms.inventory.balances",
|
|
489
|
+
entityId: E.wms.inventory_balance,
|
|
490
|
+
icon: /* @__PURE__ */ jsx(Boxes, { className: "size-5" }),
|
|
491
|
+
columns,
|
|
492
|
+
rowActions,
|
|
493
|
+
warehouseId,
|
|
494
|
+
variantId,
|
|
495
|
+
lotId,
|
|
496
|
+
lowStock,
|
|
497
|
+
emptyStateAction: access.canReceive || access.canImport ? /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-center gap-2", children: [
|
|
498
|
+
access.canReceive ? /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => setReceiveOpen(true), children: t("wms.backend.inventory.balances.empty.receive", "Receive stock") }) : null,
|
|
499
|
+
access.canImport ? /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => setImportOpen(true), children: t("wms.backend.inventory.balances.empty.importCsv", "Import CSV") }) : null
|
|
500
|
+
] }) : null
|
|
501
|
+
}
|
|
502
|
+
),
|
|
503
|
+
access.canReceive ? /* @__PURE__ */ jsx(
|
|
504
|
+
ReceiveInventoryDialog,
|
|
505
|
+
{
|
|
506
|
+
open: receiveOpen,
|
|
507
|
+
onOpenChange: setReceiveOpen,
|
|
508
|
+
access
|
|
509
|
+
}
|
|
510
|
+
) : null,
|
|
511
|
+
access.canImport ? /* @__PURE__ */ jsx(ImportInventoryDialog, { open: importOpen, onOpenChange: setImportOpen, access }) : null,
|
|
512
|
+
access.canMove ? /* @__PURE__ */ jsx(
|
|
513
|
+
MoveInventoryDialog,
|
|
514
|
+
{
|
|
515
|
+
open: moveOpen,
|
|
516
|
+
onOpenChange: setMoveOpen,
|
|
517
|
+
access,
|
|
518
|
+
initialCatalogVariantId: movePreset?.catalog_variant_id ?? void 0,
|
|
519
|
+
initialWarehouseId: movePreset?.warehouse_id ?? void 0,
|
|
520
|
+
initialFromLocationId: movePreset?.location_id ?? void 0,
|
|
521
|
+
initialLotId: movePreset?.lot_id ?? void 0,
|
|
522
|
+
initialAvailable: movePreset ? parseInventoryQuantity(movePreset.quantity_available) : null,
|
|
523
|
+
lockSourceContext: true
|
|
524
|
+
}
|
|
525
|
+
) : null
|
|
526
|
+
] });
|
|
527
|
+
}
|
|
528
|
+
function InventoryReservationsSection({
|
|
529
|
+
access,
|
|
530
|
+
warehouseId = "",
|
|
531
|
+
variantId = "",
|
|
532
|
+
lotId = ""
|
|
533
|
+
}) {
|
|
534
|
+
const t = useT();
|
|
535
|
+
const { quantityFormatter } = useInventoryDisplayFormatters();
|
|
536
|
+
const [releaseOpen, setReleaseOpen] = React.useState(false);
|
|
537
|
+
const [releasePreset, setReleasePreset] = React.useState(null);
|
|
538
|
+
const [activeOnly, setActiveOnly] = React.useState(true);
|
|
539
|
+
const { runMutation: runAllocateMutation, retryLastMutation: retryAllocate } = useGuardedMutation({
|
|
540
|
+
contextId: "wms-inventory-allocate"
|
|
541
|
+
});
|
|
542
|
+
const allocateMutationContext = React.useMemo(
|
|
543
|
+
() => ({ retryLastMutation: retryAllocate }),
|
|
544
|
+
[retryAllocate]
|
|
545
|
+
);
|
|
546
|
+
const handleAllocate = React.useCallback(
|
|
547
|
+
async (row) => {
|
|
548
|
+
if (!access.organizationId || !access.tenantId || !row.id) return;
|
|
549
|
+
const payload = {
|
|
550
|
+
organizationId: access.organizationId,
|
|
551
|
+
tenantId: access.tenantId,
|
|
552
|
+
reservationId: row.id
|
|
553
|
+
};
|
|
554
|
+
try {
|
|
555
|
+
await runAllocateMutation({
|
|
556
|
+
operation: async () => {
|
|
557
|
+
const call = await apiCall("/api/wms/inventory/allocate", {
|
|
558
|
+
method: "POST",
|
|
559
|
+
headers: { "content-type": "application/json" },
|
|
560
|
+
body: JSON.stringify(payload)
|
|
561
|
+
});
|
|
562
|
+
if (!call.ok) await raiseCrudError(call.response, t("wms.backend.inventory.allocate.errors.submit", "Failed to allocate reservation."));
|
|
563
|
+
return call.result ?? {};
|
|
564
|
+
},
|
|
565
|
+
context: allocateMutationContext,
|
|
566
|
+
mutationPayload: payload
|
|
567
|
+
});
|
|
568
|
+
flash(t("wms.backend.inventory.allocate.flash.success", "Reservation allocated"), "success");
|
|
569
|
+
} catch {
|
|
570
|
+
flash(t("wms.backend.inventory.allocate.errors.submit", "Failed to allocate reservation."), "error");
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
[access.organizationId, access.tenantId, allocateMutationContext, runAllocateMutation, t]
|
|
574
|
+
);
|
|
575
|
+
const openReleaseDialog = React.useCallback((row) => {
|
|
576
|
+
setReleasePreset(row);
|
|
577
|
+
setReleaseOpen(true);
|
|
578
|
+
}, []);
|
|
579
|
+
const columns = React.useMemo(
|
|
580
|
+
() => [
|
|
581
|
+
{
|
|
582
|
+
accessorKey: "catalog_variant_id",
|
|
583
|
+
header: t(
|
|
584
|
+
"wms.backend.inventory.reservations.columns.variant",
|
|
585
|
+
"Variant"
|
|
586
|
+
),
|
|
587
|
+
enableSorting: true,
|
|
588
|
+
cell: ({ row }) => formatVariantLabel(row.original)
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
accessorKey: "warehouse_id",
|
|
592
|
+
header: t(
|
|
593
|
+
"wms.backend.inventory.reservations.columns.warehouse",
|
|
594
|
+
"Warehouse"
|
|
595
|
+
),
|
|
596
|
+
enableSorting: true,
|
|
597
|
+
cell: ({ row }) => formatWarehouseLabel(row.original)
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
accessorKey: "quantity",
|
|
601
|
+
header: t(
|
|
602
|
+
"wms.backend.inventory.reservations.columns.quantity",
|
|
603
|
+
"Quantity"
|
|
604
|
+
),
|
|
605
|
+
enableSorting: true,
|
|
606
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "tabular-nums", children: formatInventoryQuantity(row.original.quantity, quantityFormatter) })
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
accessorKey: "source_type",
|
|
610
|
+
header: t(
|
|
611
|
+
"wms.backend.inventory.reservations.columns.sourceType",
|
|
612
|
+
"Source type"
|
|
613
|
+
),
|
|
614
|
+
enableSorting: true,
|
|
615
|
+
cell: ({ row }) => {
|
|
616
|
+
const sourceType = row.original.source_type?.trim();
|
|
617
|
+
if (!sourceType) return "\u2014";
|
|
618
|
+
return inventoryReservationSourceTypeLabel(sourceType, t);
|
|
619
|
+
}
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
accessorKey: "source_id",
|
|
623
|
+
header: t(
|
|
624
|
+
"wms.backend.inventory.reservations.columns.sourceId",
|
|
625
|
+
"Source"
|
|
626
|
+
),
|
|
627
|
+
enableSorting: false,
|
|
628
|
+
cell: ({ row }) => formatReservationSourceLabel(row.original, t)
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
accessorKey: "status",
|
|
632
|
+
header: t(
|
|
633
|
+
"wms.backend.inventory.reservations.columns.status",
|
|
634
|
+
"Status"
|
|
635
|
+
),
|
|
636
|
+
enableSorting: true,
|
|
637
|
+
cell: ({ row }) => {
|
|
638
|
+
const status = row.original.status?.trim();
|
|
639
|
+
if (!status) return "\u2014";
|
|
640
|
+
return /* @__PURE__ */ jsx(StatusBadge, { variant: reservationStatusMap[status] ?? "neutral", dot: true, children: inventoryReservationStatusLabel(status, t) });
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
],
|
|
644
|
+
[quantityFormatter, t]
|
|
645
|
+
);
|
|
646
|
+
const rowActions = React.useCallback(
|
|
647
|
+
(row) => {
|
|
648
|
+
const status = (row.status ?? "").trim().toLowerCase();
|
|
649
|
+
const items = [];
|
|
650
|
+
if (access.canAllocate && status === "active") {
|
|
651
|
+
items.push({
|
|
652
|
+
id: "allocate",
|
|
653
|
+
label: t("wms.backend.inventory.reservations.actions.allocate", "Allocate"),
|
|
654
|
+
onSelect: () => void handleAllocate(row)
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
if (access.canRelease && status === "active") {
|
|
658
|
+
items.push({
|
|
659
|
+
id: "release",
|
|
660
|
+
label: t("wms.backend.inventory.reservations.actions.release", "Release"),
|
|
661
|
+
destructive: true,
|
|
662
|
+
onSelect: () => openReleaseDialog(row)
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
if (items.length === 0) return null;
|
|
666
|
+
return /* @__PURE__ */ jsx(RowActions, { items });
|
|
667
|
+
},
|
|
668
|
+
[access.canAllocate, access.canRelease, handleAllocate, openReleaseDialog, t]
|
|
669
|
+
);
|
|
670
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
671
|
+
/* @__PURE__ */ jsx(
|
|
672
|
+
InventoryDataTableSection,
|
|
673
|
+
{
|
|
674
|
+
sectionQueryKey: "reservations",
|
|
675
|
+
endpoint: "/api/wms/inventory/reservations",
|
|
676
|
+
titleKey: "wms.backend.inventory.reservations.title",
|
|
677
|
+
titleFallback: "Inventory reservations",
|
|
678
|
+
descriptionKey: "wms.backend.inventory.reservations.description",
|
|
679
|
+
descriptionFallback: "Active and historical reservation records created by manual API calls or sales lifecycle automation.",
|
|
680
|
+
errorKey: "wms.backend.inventory.errors.reservations",
|
|
681
|
+
errorFallback: "Failed to load reservations.",
|
|
682
|
+
searchKey: "wms.backend.inventory.reservations.search",
|
|
683
|
+
searchFallback: "Search reservations",
|
|
684
|
+
emptyTitleKey: "wms.backend.inventory.reservations.empty.title",
|
|
685
|
+
emptyTitleFallback: "No reservations",
|
|
686
|
+
emptyDescriptionKey: "wms.backend.inventory.reservations.empty.description",
|
|
687
|
+
emptyDescriptionFallback: "Reservations show stock committed to orders, transfers, or manual holds.",
|
|
688
|
+
tableId: "wms.inventory.reservations",
|
|
689
|
+
entityId: E.wms.inventory_reservation,
|
|
690
|
+
icon: /* @__PURE__ */ jsx(ShieldCheck, { className: "size-5" }),
|
|
691
|
+
columns,
|
|
692
|
+
rowActions,
|
|
693
|
+
warehouseId,
|
|
694
|
+
variantId,
|
|
695
|
+
lotId,
|
|
696
|
+
extraParams: activeOnly ? { status: "active" } : void 0,
|
|
697
|
+
toolbarActions: /* @__PURE__ */ jsx(
|
|
698
|
+
Button,
|
|
699
|
+
{
|
|
700
|
+
type: "button",
|
|
701
|
+
variant: activeOnly ? "outline" : "ghost",
|
|
702
|
+
size: "sm",
|
|
703
|
+
onClick: () => setActiveOnly((prev) => !prev),
|
|
704
|
+
children: activeOnly ? t("wms.backend.inventory.reservations.filter.showAll", "Show all") : t("wms.backend.inventory.reservations.filter.activeOnly", "Active only")
|
|
705
|
+
}
|
|
706
|
+
)
|
|
707
|
+
}
|
|
708
|
+
),
|
|
709
|
+
access.canRelease ? /* @__PURE__ */ jsx(
|
|
710
|
+
ReleaseReservationDialog,
|
|
711
|
+
{
|
|
712
|
+
open: releaseOpen,
|
|
713
|
+
onOpenChange: setReleaseOpen,
|
|
714
|
+
access,
|
|
715
|
+
reservation: releasePreset
|
|
716
|
+
}
|
|
717
|
+
) : null
|
|
718
|
+
] });
|
|
719
|
+
}
|
|
720
|
+
function InventoryMovementsSection({
|
|
721
|
+
warehouseId = "",
|
|
722
|
+
variantId = "",
|
|
723
|
+
lotId = ""
|
|
724
|
+
}) {
|
|
725
|
+
const t = useT();
|
|
726
|
+
const { quantityFormatter, dateTimeFormatter } = useInventoryDisplayFormatters();
|
|
727
|
+
const columns = React.useMemo(
|
|
728
|
+
() => [
|
|
729
|
+
{
|
|
730
|
+
accessorKey: "type",
|
|
731
|
+
header: t("wms.backend.inventory.movements.columns.type", "Type"),
|
|
732
|
+
enableSorting: true,
|
|
733
|
+
cell: ({ row }) => {
|
|
734
|
+
const type = row.original.type?.trim();
|
|
735
|
+
if (!type) return "\u2014";
|
|
736
|
+
return /* @__PURE__ */ jsx(StatusBadge, { variant: movementStatusMap[type] ?? "neutral", dot: true, children: inventoryMovementTypeLabel(type, t) });
|
|
737
|
+
}
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
accessorKey: "catalog_variant_id",
|
|
741
|
+
header: t(
|
|
742
|
+
"wms.backend.inventory.movements.columns.variant",
|
|
743
|
+
"Variant"
|
|
744
|
+
),
|
|
745
|
+
enableSorting: true,
|
|
746
|
+
cell: ({ row }) => formatVariantLabel(row.original)
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
accessorKey: "warehouse_id",
|
|
750
|
+
header: t(
|
|
751
|
+
"wms.backend.inventory.movements.columns.warehouse",
|
|
752
|
+
"Warehouse"
|
|
753
|
+
),
|
|
754
|
+
enableSorting: true,
|
|
755
|
+
cell: ({ row }) => formatWarehouseLabel(row.original)
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
accessorKey: "location_from_id",
|
|
759
|
+
header: t(
|
|
760
|
+
"wms.backend.inventory.movements.columns.locationFrom",
|
|
761
|
+
"From"
|
|
762
|
+
),
|
|
763
|
+
enableSorting: false,
|
|
764
|
+
cell: ({ row }) => formatLocationLabel(row.original, "location_from")
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
accessorKey: "location_to_id",
|
|
768
|
+
header: t(
|
|
769
|
+
"wms.backend.inventory.movements.columns.locationTo",
|
|
770
|
+
"To"
|
|
771
|
+
),
|
|
772
|
+
enableSorting: false,
|
|
773
|
+
cell: ({ row }) => formatLocationLabel(row.original, "location_to")
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
accessorKey: "quantity",
|
|
777
|
+
header: t(
|
|
778
|
+
"wms.backend.inventory.movements.columns.quantity",
|
|
779
|
+
"Quantity"
|
|
780
|
+
),
|
|
781
|
+
enableSorting: true,
|
|
782
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "tabular-nums", children: formatInventoryQuantity(row.original.quantity, quantityFormatter) })
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
accessorKey: "reference_type",
|
|
786
|
+
header: t(
|
|
787
|
+
"wms.backend.inventory.movements.columns.referenceType",
|
|
788
|
+
"Reference type"
|
|
789
|
+
),
|
|
790
|
+
enableSorting: true,
|
|
791
|
+
cell: ({ row }) => {
|
|
792
|
+
const referenceType = row.original.reference_type?.trim();
|
|
793
|
+
if (!referenceType) return "\u2014";
|
|
794
|
+
return inventoryReferenceTypeLabel(referenceType, t);
|
|
795
|
+
}
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
accessorKey: "performed_at",
|
|
799
|
+
header: t(
|
|
800
|
+
"wms.backend.inventory.movements.columns.performedAt",
|
|
801
|
+
"Performed at"
|
|
802
|
+
),
|
|
803
|
+
enableSorting: true,
|
|
804
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: formatInventoryDateTime(
|
|
805
|
+
row.original.performed_at || row.original.received_at,
|
|
806
|
+
dateTimeFormatter
|
|
807
|
+
) })
|
|
808
|
+
}
|
|
809
|
+
],
|
|
810
|
+
[dateTimeFormatter, quantityFormatter, t]
|
|
811
|
+
);
|
|
812
|
+
return /* @__PURE__ */ jsx(
|
|
813
|
+
InventoryDataTableSection,
|
|
814
|
+
{
|
|
815
|
+
sectionQueryKey: "movements",
|
|
816
|
+
endpoint: "/api/wms/inventory/movements",
|
|
817
|
+
titleKey: "wms.backend.inventory.movements.title",
|
|
818
|
+
titleFallback: "Inventory movement ledger",
|
|
819
|
+
descriptionKey: "wms.backend.inventory.movements.description",
|
|
820
|
+
descriptionFallback: "Immutable movement history for receipts, transfers, adjustments, and cycle counts.",
|
|
821
|
+
errorKey: "wms.backend.inventory.errors.movements",
|
|
822
|
+
errorFallback: "Failed to load movements.",
|
|
823
|
+
searchKey: "wms.backend.inventory.movements.search",
|
|
824
|
+
searchFallback: "Search movement ledger",
|
|
825
|
+
emptyTitleKey: "wms.backend.inventory.movements.empty.title",
|
|
826
|
+
emptyTitleFallback: "No inventory movements",
|
|
827
|
+
emptyDescriptionKey: "wms.backend.inventory.movements.empty.description",
|
|
828
|
+
emptyDescriptionFallback: "Movement rows are created by receipts, reservations, moves, and reconciliation actions.",
|
|
829
|
+
tableId: "wms.inventory.movements",
|
|
830
|
+
entityId: E.wms.inventory_movement,
|
|
831
|
+
icon: /* @__PURE__ */ jsx(Route, { className: "size-5" }),
|
|
832
|
+
columns,
|
|
833
|
+
warehouseId,
|
|
834
|
+
variantId,
|
|
835
|
+
lotId
|
|
836
|
+
}
|
|
837
|
+
);
|
|
838
|
+
}
|
|
839
|
+
function WmsInventoryConsolePage() {
|
|
840
|
+
const access = useWmsInventoryMutationAccess();
|
|
841
|
+
const scopeFromUrl = useWmsInventoryScopeFromSearchParams();
|
|
842
|
+
const [warehouseId, setWarehouseId] = React.useState(scopeFromUrl.warehouseId);
|
|
843
|
+
const [variantId, setVariantId] = React.useState(scopeFromUrl.catalogVariantId);
|
|
844
|
+
const [lotId, setLotId] = React.useState(scopeFromUrl.lotId);
|
|
845
|
+
const [lowStock, setLowStock] = React.useState(scopeFromUrl.lowStock);
|
|
846
|
+
React.useEffect(() => {
|
|
847
|
+
setWarehouseId(scopeFromUrl.warehouseId);
|
|
848
|
+
setVariantId(scopeFromUrl.catalogVariantId);
|
|
849
|
+
setLotId(scopeFromUrl.lotId);
|
|
850
|
+
setLowStock(scopeFromUrl.lowStock);
|
|
851
|
+
}, [scopeFromUrl.catalogVariantId, scopeFromUrl.warehouseId, scopeFromUrl.lotId, scopeFromUrl.lowStock]);
|
|
852
|
+
const handleWarehouseChange = React.useCallback((next) => {
|
|
853
|
+
setWarehouseId(next);
|
|
854
|
+
setLotId("");
|
|
855
|
+
setLowStock(null);
|
|
856
|
+
}, []);
|
|
857
|
+
const handleVariantChange = React.useCallback((next) => {
|
|
858
|
+
setVariantId(next);
|
|
859
|
+
setLotId("");
|
|
860
|
+
setLowStock(null);
|
|
861
|
+
}, []);
|
|
862
|
+
return /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsx(PageBody, { children: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
863
|
+
/* @__PURE__ */ jsx(InventoryOperationsSection, { access }),
|
|
864
|
+
/* @__PURE__ */ jsx(
|
|
865
|
+
InventoryScopeBar,
|
|
866
|
+
{
|
|
867
|
+
warehouseId,
|
|
868
|
+
variantId,
|
|
869
|
+
onWarehouseChange: handleWarehouseChange,
|
|
870
|
+
onVariantChange: handleVariantChange
|
|
871
|
+
}
|
|
872
|
+
),
|
|
873
|
+
/* @__PURE__ */ jsx(
|
|
874
|
+
InventoryBalancesSection,
|
|
875
|
+
{
|
|
876
|
+
access,
|
|
877
|
+
warehouseId,
|
|
878
|
+
variantId,
|
|
879
|
+
lotId,
|
|
880
|
+
lowStock
|
|
881
|
+
}
|
|
882
|
+
),
|
|
883
|
+
/* @__PURE__ */ jsx(
|
|
884
|
+
InventoryReservationsSection,
|
|
885
|
+
{
|
|
886
|
+
access,
|
|
887
|
+
warehouseId,
|
|
888
|
+
variantId,
|
|
889
|
+
lotId
|
|
890
|
+
}
|
|
891
|
+
),
|
|
892
|
+
/* @__PURE__ */ jsx(
|
|
893
|
+
InventoryMovementsSection,
|
|
894
|
+
{
|
|
895
|
+
warehouseId,
|
|
896
|
+
variantId,
|
|
897
|
+
lotId
|
|
898
|
+
}
|
|
899
|
+
)
|
|
900
|
+
] }) }) });
|
|
901
|
+
}
|
|
902
|
+
export {
|
|
903
|
+
InventoryBalancesSection,
|
|
904
|
+
InventoryMovementsSection,
|
|
905
|
+
InventoryReservationsSection,
|
|
906
|
+
WmsInventoryConsolePage as default
|
|
907
|
+
};
|
|
908
|
+
//# sourceMappingURL=WmsInventoryConsolePage.js.map
|