@open-mercato/core 0.6.7-develop.6669.1.40b669666b → 0.6.7-develop.6670.1.4efa7961c6
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,755 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import { Minus, Package, Plus } from "lucide-react";
|
|
7
|
+
import { flash } from "@open-mercato/ui/backend/FlashMessages";
|
|
8
|
+
import { useGuardedMutation } from "@open-mercato/ui/backend/injection/useGuardedMutation";
|
|
9
|
+
import { flashMutationError } from "../../lib/flashMutationError.js";
|
|
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 { Button } from "@open-mercato/ui/primitives/button";
|
|
14
|
+
import {
|
|
15
|
+
Dialog,
|
|
16
|
+
DialogContent,
|
|
17
|
+
DialogDescription,
|
|
18
|
+
DialogFooter,
|
|
19
|
+
DialogHeader,
|
|
20
|
+
DialogTitle
|
|
21
|
+
} from "@open-mercato/ui/primitives/dialog";
|
|
22
|
+
import { FormField } from "@open-mercato/ui/primitives/form-field";
|
|
23
|
+
import { IconButton } from "@open-mercato/ui/primitives/icon-button";
|
|
24
|
+
import { Input } from "@open-mercato/ui/primitives/input";
|
|
25
|
+
import { KbdShortcut } from "@open-mercato/ui/primitives/kbd";
|
|
26
|
+
import {
|
|
27
|
+
Select,
|
|
28
|
+
SelectContent,
|
|
29
|
+
SelectItem,
|
|
30
|
+
SelectTrigger,
|
|
31
|
+
SelectValue
|
|
32
|
+
} from "@open-mercato/ui/primitives/select";
|
|
33
|
+
import { StatusBadge } from "@open-mercato/ui/primitives/status-badge";
|
|
34
|
+
import { Textarea } from "@open-mercato/ui/primitives/textarea";
|
|
35
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
36
|
+
import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
37
|
+
import { buildInventoryMutationReferenceId } from "../../lib/inventoryMutationUi.js";
|
|
38
|
+
import {
|
|
39
|
+
BalanceLookupError,
|
|
40
|
+
ensureLotIdForInventoryMutation,
|
|
41
|
+
fetchBalanceOnHand,
|
|
42
|
+
fetchVariantReorderPoint,
|
|
43
|
+
findLotIdByNumber,
|
|
44
|
+
InventoryLotMutationError,
|
|
45
|
+
loadCatalogVariantOptions,
|
|
46
|
+
loadLocationOptions,
|
|
47
|
+
loadLotNumberOptions,
|
|
48
|
+
loadWarehouseOptions,
|
|
49
|
+
resolveCatalogVariantLabel,
|
|
50
|
+
resolveLocationLabel,
|
|
51
|
+
resolveLotNumberFromId,
|
|
52
|
+
resolveWarehouseLabel
|
|
53
|
+
} from "./inventoryMutationLoaders.js";
|
|
54
|
+
const logger = createLogger("wms");
|
|
55
|
+
const ADJUST_REASON_CODES = ["damaged", "shrinkage", "found", "correction", "other"];
|
|
56
|
+
const EMPTY_FORM = {
|
|
57
|
+
catalogVariantId: "",
|
|
58
|
+
warehouseId: "",
|
|
59
|
+
locationId: "",
|
|
60
|
+
lotNumber: "",
|
|
61
|
+
delta: 1,
|
|
62
|
+
reasonCode: "",
|
|
63
|
+
notes: "",
|
|
64
|
+
serialNumber: ""
|
|
65
|
+
};
|
|
66
|
+
function parseDeltaInput(value) {
|
|
67
|
+
const trimmed = value.trim();
|
|
68
|
+
if (!trimmed || trimmed === "-" || trimmed === "+") return null;
|
|
69
|
+
const parsed = Number(trimmed);
|
|
70
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
71
|
+
}
|
|
72
|
+
function AdjustInventoryDialog({
|
|
73
|
+
open,
|
|
74
|
+
onOpenChange,
|
|
75
|
+
access,
|
|
76
|
+
initialCatalogVariantId,
|
|
77
|
+
initialWarehouseId,
|
|
78
|
+
initialLocationId,
|
|
79
|
+
initialLotId
|
|
80
|
+
}) {
|
|
81
|
+
const t = useT();
|
|
82
|
+
const queryClient = useQueryClient();
|
|
83
|
+
const formRef = React.useRef(null);
|
|
84
|
+
const { runMutation, retryLastMutation } = useGuardedMutation({
|
|
85
|
+
contextId: "wms-inventory-adjust"
|
|
86
|
+
});
|
|
87
|
+
const mutationContext = React.useMemo(
|
|
88
|
+
() => ({ retryLastMutation }),
|
|
89
|
+
[retryLastMutation]
|
|
90
|
+
);
|
|
91
|
+
const adjustFormSchema = React.useMemo(
|
|
92
|
+
() => z.object({
|
|
93
|
+
catalogVariantId: z.string().uuid(),
|
|
94
|
+
warehouseId: z.string().uuid(),
|
|
95
|
+
locationId: z.string().uuid(),
|
|
96
|
+
lotNumber: z.string().trim().max(120).optional(),
|
|
97
|
+
delta: z.coerce.number().refine((value) => value !== 0, {
|
|
98
|
+
message: t(
|
|
99
|
+
"wms.backend.inventory.adjust.errors.deltaZero",
|
|
100
|
+
"Inventory delta must be non-zero."
|
|
101
|
+
)
|
|
102
|
+
}),
|
|
103
|
+
reasonCode: z.enum(ADJUST_REASON_CODES),
|
|
104
|
+
notes: z.string().trim().max(500).optional(),
|
|
105
|
+
serialNumber: z.string().trim().max(120).optional()
|
|
106
|
+
}),
|
|
107
|
+
[t]
|
|
108
|
+
);
|
|
109
|
+
const [submitting, setSubmitting] = React.useState(false);
|
|
110
|
+
const [form, setForm] = React.useState(EMPTY_FORM);
|
|
111
|
+
const [fieldErrors, setFieldErrors] = React.useState({});
|
|
112
|
+
const [onHand, setOnHand] = React.useState(null);
|
|
113
|
+
const [previewError, setPreviewError] = React.useState(null);
|
|
114
|
+
const [reorderPoint, setReorderPoint] = React.useState(0);
|
|
115
|
+
const [loadingPreview, setLoadingPreview] = React.useState(false);
|
|
116
|
+
const [optionLabelByValue, setOptionLabelByValue] = React.useState({});
|
|
117
|
+
const registerOptionLabels = React.useCallback(
|
|
118
|
+
(options) => {
|
|
119
|
+
setOptionLabelByValue((current) => {
|
|
120
|
+
let changed = false;
|
|
121
|
+
const next = { ...current };
|
|
122
|
+
for (const option of options) {
|
|
123
|
+
const value = option.value.trim();
|
|
124
|
+
const label = option.label.trim();
|
|
125
|
+
if (!value || !label || next[value] === label) continue;
|
|
126
|
+
next[value] = label;
|
|
127
|
+
changed = true;
|
|
128
|
+
}
|
|
129
|
+
return changed ? next : current;
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
[]
|
|
133
|
+
);
|
|
134
|
+
const resolveOptionLabel = React.useCallback(
|
|
135
|
+
(value) => optionLabelByValue[value] ?? value,
|
|
136
|
+
[optionLabelByValue]
|
|
137
|
+
);
|
|
138
|
+
const optionLabelByValueRef = React.useRef(optionLabelByValue);
|
|
139
|
+
optionLabelByValueRef.current = optionLabelByValue;
|
|
140
|
+
const reasonLabel = React.useCallback(
|
|
141
|
+
(code) => {
|
|
142
|
+
const fallbacks = {
|
|
143
|
+
damaged: "Damaged",
|
|
144
|
+
shrinkage: "Shrinkage",
|
|
145
|
+
found: "Found stock",
|
|
146
|
+
correction: "Correction",
|
|
147
|
+
other: "Other"
|
|
148
|
+
};
|
|
149
|
+
return t(`wms.backend.inventory.adjust.reasons.${code}`, fallbacks[code]);
|
|
150
|
+
},
|
|
151
|
+
[t]
|
|
152
|
+
);
|
|
153
|
+
const resetDialog = React.useCallback(() => {
|
|
154
|
+
setForm(EMPTY_FORM);
|
|
155
|
+
setFieldErrors({});
|
|
156
|
+
setOnHand(null);
|
|
157
|
+
setPreviewError(null);
|
|
158
|
+
setReorderPoint(0);
|
|
159
|
+
setLoadingPreview(false);
|
|
160
|
+
setSubmitting(false);
|
|
161
|
+
setOptionLabelByValue({});
|
|
162
|
+
}, []);
|
|
163
|
+
const closeDialog = React.useCallback(() => {
|
|
164
|
+
onOpenChange(false);
|
|
165
|
+
resetDialog();
|
|
166
|
+
}, [onOpenChange, resetDialog]);
|
|
167
|
+
const patchForm = React.useCallback((patch) => {
|
|
168
|
+
setForm((current) => ({ ...current, ...patch }));
|
|
169
|
+
setFieldErrors({});
|
|
170
|
+
}, []);
|
|
171
|
+
React.useEffect(() => {
|
|
172
|
+
if (!open) return;
|
|
173
|
+
const catalogVariantId = initialCatalogVariantId?.trim();
|
|
174
|
+
const warehouseId = initialWarehouseId?.trim();
|
|
175
|
+
const locationId = initialLocationId?.trim();
|
|
176
|
+
const lotId = initialLotId?.trim();
|
|
177
|
+
if (!catalogVariantId && !warehouseId && !locationId && !lotId) return;
|
|
178
|
+
setForm((current) => ({
|
|
179
|
+
...current,
|
|
180
|
+
...catalogVariantId ? { catalogVariantId } : {},
|
|
181
|
+
...warehouseId ? { warehouseId, locationId: locationId ?? "" } : {},
|
|
182
|
+
...locationId ? { locationId } : {}
|
|
183
|
+
}));
|
|
184
|
+
if (!lotId) return;
|
|
185
|
+
let cancelled = false;
|
|
186
|
+
void resolveLotNumberFromId(lotId).then((lotNumber) => {
|
|
187
|
+
if (cancelled || !lotNumber) return;
|
|
188
|
+
setForm((current) => ({ ...current, lotNumber }));
|
|
189
|
+
registerOptionLabels([{ value: lotNumber, label: lotNumber }]);
|
|
190
|
+
});
|
|
191
|
+
return () => {
|
|
192
|
+
cancelled = true;
|
|
193
|
+
};
|
|
194
|
+
}, [
|
|
195
|
+
initialCatalogVariantId,
|
|
196
|
+
initialLocationId,
|
|
197
|
+
initialLotId,
|
|
198
|
+
initialWarehouseId,
|
|
199
|
+
open,
|
|
200
|
+
registerOptionLabels
|
|
201
|
+
]);
|
|
202
|
+
React.useEffect(() => {
|
|
203
|
+
if (!open) return;
|
|
204
|
+
let cancelled = false;
|
|
205
|
+
const ensureLabel = async (value, resolve) => {
|
|
206
|
+
const id = value.trim();
|
|
207
|
+
if (!id || optionLabelByValueRef.current[id]) return;
|
|
208
|
+
const label = await resolve(id);
|
|
209
|
+
if (cancelled || !label) return;
|
|
210
|
+
registerOptionLabels([{ value: id, label }]);
|
|
211
|
+
};
|
|
212
|
+
void Promise.all([
|
|
213
|
+
ensureLabel(form.catalogVariantId, resolveCatalogVariantLabel),
|
|
214
|
+
ensureLabel(form.warehouseId, resolveWarehouseLabel),
|
|
215
|
+
ensureLabel(form.locationId, resolveLocationLabel)
|
|
216
|
+
]);
|
|
217
|
+
return () => {
|
|
218
|
+
cancelled = true;
|
|
219
|
+
};
|
|
220
|
+
}, [
|
|
221
|
+
form.catalogVariantId,
|
|
222
|
+
form.locationId,
|
|
223
|
+
form.warehouseId,
|
|
224
|
+
open,
|
|
225
|
+
registerOptionLabels
|
|
226
|
+
]);
|
|
227
|
+
React.useEffect(() => {
|
|
228
|
+
if (!open) return;
|
|
229
|
+
const variantId = form.catalogVariantId.trim();
|
|
230
|
+
if (!variantId) {
|
|
231
|
+
setReorderPoint(0);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
let cancelled = false;
|
|
235
|
+
void fetchVariantReorderPoint(variantId).then((value) => {
|
|
236
|
+
if (!cancelled) setReorderPoint(value);
|
|
237
|
+
});
|
|
238
|
+
return () => {
|
|
239
|
+
cancelled = true;
|
|
240
|
+
};
|
|
241
|
+
}, [form.catalogVariantId, open]);
|
|
242
|
+
const previewContextReady = Boolean(
|
|
243
|
+
form.catalogVariantId.trim() && form.warehouseId.trim() && form.locationId.trim()
|
|
244
|
+
);
|
|
245
|
+
React.useEffect(() => {
|
|
246
|
+
if (!open) return;
|
|
247
|
+
const warehouseId = form.warehouseId.trim();
|
|
248
|
+
const locationId = form.locationId.trim();
|
|
249
|
+
const catalogVariantId = form.catalogVariantId.trim();
|
|
250
|
+
const lotNumber = form.lotNumber.trim();
|
|
251
|
+
if (!warehouseId || !locationId || !catalogVariantId) {
|
|
252
|
+
setOnHand(null);
|
|
253
|
+
setPreviewError(null);
|
|
254
|
+
setLoadingPreview(false);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
let cancelled = false;
|
|
258
|
+
setLoadingPreview(true);
|
|
259
|
+
setPreviewError(null);
|
|
260
|
+
void (async () => {
|
|
261
|
+
try {
|
|
262
|
+
const lotId = lotNumber ? await findLotIdByNumber(catalogVariantId, lotNumber) : null;
|
|
263
|
+
if (cancelled) return;
|
|
264
|
+
const value = await fetchBalanceOnHand({
|
|
265
|
+
warehouseId,
|
|
266
|
+
locationId,
|
|
267
|
+
catalogVariantId,
|
|
268
|
+
lotId
|
|
269
|
+
});
|
|
270
|
+
if (!cancelled) {
|
|
271
|
+
setOnHand(value);
|
|
272
|
+
setPreviewError(null);
|
|
273
|
+
}
|
|
274
|
+
} catch (error) {
|
|
275
|
+
if (cancelled) return;
|
|
276
|
+
setOnHand(null);
|
|
277
|
+
if (error instanceof BalanceLookupError) {
|
|
278
|
+
setPreviewError(
|
|
279
|
+
t(
|
|
280
|
+
"wms.backend.inventory.adjust.errors.previewBalance",
|
|
281
|
+
"Failed to load balance preview."
|
|
282
|
+
)
|
|
283
|
+
);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
logger.error("fetchBalanceOnHand failed", { component: "AdjustInventoryDialog", err: error });
|
|
287
|
+
setPreviewError(
|
|
288
|
+
t(
|
|
289
|
+
"wms.backend.inventory.adjust.errors.previewBalance",
|
|
290
|
+
"Failed to load balance preview."
|
|
291
|
+
)
|
|
292
|
+
);
|
|
293
|
+
} finally {
|
|
294
|
+
if (!cancelled) setLoadingPreview(false);
|
|
295
|
+
}
|
|
296
|
+
})();
|
|
297
|
+
return () => {
|
|
298
|
+
cancelled = true;
|
|
299
|
+
};
|
|
300
|
+
}, [
|
|
301
|
+
form.catalogVariantId,
|
|
302
|
+
form.locationId,
|
|
303
|
+
form.lotNumber,
|
|
304
|
+
form.warehouseId,
|
|
305
|
+
open,
|
|
306
|
+
t
|
|
307
|
+
]);
|
|
308
|
+
const projectedOnHand = onHand != null && form.delta !== 0 ? onHand + form.delta : null;
|
|
309
|
+
const showBelowReorder = projectedOnHand != null && reorderPoint > 0 && projectedOnHand <= reorderPoint;
|
|
310
|
+
const handleSubmit = React.useCallback(
|
|
311
|
+
async (event) => {
|
|
312
|
+
event?.preventDefault();
|
|
313
|
+
const parsed = adjustFormSchema.safeParse({
|
|
314
|
+
...form,
|
|
315
|
+
lotNumber: form.lotNumber.trim() || void 0,
|
|
316
|
+
notes: form.notes.trim() || void 0,
|
|
317
|
+
serialNumber: form.serialNumber.trim() || void 0
|
|
318
|
+
});
|
|
319
|
+
if (!parsed.success) {
|
|
320
|
+
const nextErrors = {};
|
|
321
|
+
for (const issue of parsed.error.issues) {
|
|
322
|
+
const key = String(issue.path[0] ?? "form");
|
|
323
|
+
if (!nextErrors[key]) nextErrors[key] = issue.message;
|
|
324
|
+
}
|
|
325
|
+
setFieldErrors(nextErrors);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
if (!access.scopeReady || !access.organizationId || !access.tenantId || !access.userId) {
|
|
329
|
+
flash(
|
|
330
|
+
t(
|
|
331
|
+
"wms.backend.inventory.mutations.errors.scope",
|
|
332
|
+
"Select an organization and sign in before posting inventory changes."
|
|
333
|
+
),
|
|
334
|
+
"error"
|
|
335
|
+
);
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
setSubmitting(true);
|
|
339
|
+
try {
|
|
340
|
+
const reason = parsed.data.reasonCode;
|
|
341
|
+
const notes = parsed.data.notes?.trim();
|
|
342
|
+
const lotNumber = parsed.data.lotNumber?.trim();
|
|
343
|
+
let lotId;
|
|
344
|
+
if (lotNumber) {
|
|
345
|
+
try {
|
|
346
|
+
lotId = await ensureLotIdForInventoryMutation({
|
|
347
|
+
catalogVariantId: parsed.data.catalogVariantId,
|
|
348
|
+
lotNumber,
|
|
349
|
+
organizationId: access.organizationId,
|
|
350
|
+
tenantId: access.tenantId
|
|
351
|
+
});
|
|
352
|
+
} catch (error) {
|
|
353
|
+
const message = error instanceof InventoryLotMutationError ? error.message : t(
|
|
354
|
+
"wms.backend.inventory.adjust.errors.lot",
|
|
355
|
+
"Failed to resolve inventory lot."
|
|
356
|
+
);
|
|
357
|
+
setFieldErrors({ lotNumber: message });
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
const payload = {
|
|
362
|
+
organizationId: access.organizationId,
|
|
363
|
+
tenantId: access.tenantId,
|
|
364
|
+
warehouseId: parsed.data.warehouseId,
|
|
365
|
+
locationId: parsed.data.locationId,
|
|
366
|
+
catalogVariantId: parsed.data.catalogVariantId,
|
|
367
|
+
delta: parsed.data.delta,
|
|
368
|
+
reason,
|
|
369
|
+
reasonCode: parsed.data.reasonCode,
|
|
370
|
+
referenceType: "manual",
|
|
371
|
+
referenceId: buildInventoryMutationReferenceId(),
|
|
372
|
+
performedBy: access.userId
|
|
373
|
+
};
|
|
374
|
+
if (lotId) payload.lotId = lotId;
|
|
375
|
+
const serial = parsed.data.serialNumber?.trim();
|
|
376
|
+
if (serial) payload.serialNumber = serial;
|
|
377
|
+
if (notes) payload.metadata = { notes };
|
|
378
|
+
await runMutation({
|
|
379
|
+
operation: async () => {
|
|
380
|
+
const call = await apiCall(
|
|
381
|
+
"/api/wms/inventory/adjust",
|
|
382
|
+
{
|
|
383
|
+
method: "POST",
|
|
384
|
+
headers: { "content-type": "application/json" },
|
|
385
|
+
body: JSON.stringify(payload)
|
|
386
|
+
}
|
|
387
|
+
);
|
|
388
|
+
if (!call.ok) {
|
|
389
|
+
await raiseCrudError(
|
|
390
|
+
call.response,
|
|
391
|
+
t("wms.backend.inventory.adjust.errors.submit", "Failed to adjust inventory.")
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
return call.result ?? {};
|
|
395
|
+
},
|
|
396
|
+
context: mutationContext,
|
|
397
|
+
mutationPayload: payload
|
|
398
|
+
});
|
|
399
|
+
flash(t("wms.backend.inventory.adjust.flash.success", "Inventory adjusted"), "success");
|
|
400
|
+
await queryClient.invalidateQueries({ queryKey: ["wms-inventory-console"] });
|
|
401
|
+
await queryClient.invalidateQueries({ queryKey: ["wms-sku-detail"] });
|
|
402
|
+
closeDialog();
|
|
403
|
+
} catch (error) {
|
|
404
|
+
flashMutationError(error, t("wms.backend.inventory.adjust.errors.submit", "Failed to adjust inventory."), t);
|
|
405
|
+
} finally {
|
|
406
|
+
setSubmitting(false);
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
[
|
|
410
|
+
access,
|
|
411
|
+
adjustFormSchema,
|
|
412
|
+
closeDialog,
|
|
413
|
+
form,
|
|
414
|
+
mutationContext,
|
|
415
|
+
queryClient,
|
|
416
|
+
runMutation,
|
|
417
|
+
t
|
|
418
|
+
]
|
|
419
|
+
);
|
|
420
|
+
const handleDialogKeyDown = React.useCallback(
|
|
421
|
+
(event) => {
|
|
422
|
+
if (event.key === "Escape") {
|
|
423
|
+
event.preventDefault();
|
|
424
|
+
closeDialog();
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
if ((event.metaKey || event.ctrlKey) && event.key === "Enter") {
|
|
428
|
+
event.preventDefault();
|
|
429
|
+
if (!submitting) void handleSubmit();
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
[closeDialog, handleSubmit, submitting]
|
|
433
|
+
);
|
|
434
|
+
const adjustDelta = React.useCallback((step) => {
|
|
435
|
+
setForm((current) => {
|
|
436
|
+
const next = current.delta + step;
|
|
437
|
+
return { ...current, delta: next === 0 ? step : next };
|
|
438
|
+
});
|
|
439
|
+
setFieldErrors({});
|
|
440
|
+
}, []);
|
|
441
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (next) => next ? onOpenChange(true) : closeDialog(), children: /* @__PURE__ */ jsxs(
|
|
442
|
+
DialogContent,
|
|
443
|
+
{
|
|
444
|
+
className: "max-w-lg gap-0 overflow-hidden p-0",
|
|
445
|
+
onKeyDown: handleDialogKeyDown,
|
|
446
|
+
children: [
|
|
447
|
+
/* @__PURE__ */ jsx("div", { className: "border-b px-6 py-4 pr-12", children: /* @__PURE__ */ jsxs(DialogHeader, { className: "space-y-1 text-left", children: [
|
|
448
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: t("wms.backend.inventory.adjust.dialog.title", "Adjust inventory") }),
|
|
449
|
+
/* @__PURE__ */ jsx(DialogDescription, { children: t(
|
|
450
|
+
"wms.backend.inventory.adjust.dialog.description",
|
|
451
|
+
"Append a signed delta to the ledger"
|
|
452
|
+
) })
|
|
453
|
+
] }) }),
|
|
454
|
+
/* @__PURE__ */ jsxs("form", { ref: formRef, onSubmit: handleSubmit, className: "flex min-h-0 flex-1 flex-col", children: [
|
|
455
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5 overflow-y-auto px-6 py-6", children: [
|
|
456
|
+
/* @__PURE__ */ jsx(
|
|
457
|
+
FormField,
|
|
458
|
+
{
|
|
459
|
+
label: t("wms.backend.inventory.adjust.form.variant", "Variant"),
|
|
460
|
+
required: true,
|
|
461
|
+
error: fieldErrors.catalogVariantId,
|
|
462
|
+
children: /* @__PURE__ */ jsxs("div", { className: "relative [&_input]:pl-9", children: [
|
|
463
|
+
/* @__PURE__ */ jsx(
|
|
464
|
+
Package,
|
|
465
|
+
{
|
|
466
|
+
className: "pointer-events-none absolute left-3 top-1/2 z-10 size-4 -translate-y-1/2 text-muted-foreground",
|
|
467
|
+
"aria-hidden": "true"
|
|
468
|
+
}
|
|
469
|
+
),
|
|
470
|
+
/* @__PURE__ */ jsx(
|
|
471
|
+
ComboboxInput,
|
|
472
|
+
{
|
|
473
|
+
value: form.catalogVariantId,
|
|
474
|
+
onChange: (next) => {
|
|
475
|
+
patchForm({
|
|
476
|
+
catalogVariantId: next.trim(),
|
|
477
|
+
lotNumber: ""
|
|
478
|
+
});
|
|
479
|
+
},
|
|
480
|
+
loadSuggestions: async (query) => {
|
|
481
|
+
const options = await loadCatalogVariantOptions(query);
|
|
482
|
+
registerOptionLabels(options);
|
|
483
|
+
return options.map((option) => ({
|
|
484
|
+
value: option.value,
|
|
485
|
+
label: option.label,
|
|
486
|
+
description: option.description
|
|
487
|
+
}));
|
|
488
|
+
},
|
|
489
|
+
resolveLabel: resolveOptionLabel,
|
|
490
|
+
placeholder: t(
|
|
491
|
+
"wms.backend.inventory.adjust.form.variantPlaceholder",
|
|
492
|
+
"Search variant or SKU"
|
|
493
|
+
),
|
|
494
|
+
allowCustomValues: false,
|
|
495
|
+
disabled: submitting
|
|
496
|
+
}
|
|
497
|
+
)
|
|
498
|
+
] })
|
|
499
|
+
}
|
|
500
|
+
),
|
|
501
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-5 sm:grid-cols-2", children: [
|
|
502
|
+
/* @__PURE__ */ jsx(
|
|
503
|
+
FormField,
|
|
504
|
+
{
|
|
505
|
+
label: t("wms.backend.inventory.adjust.form.warehouse", "Warehouse"),
|
|
506
|
+
required: true,
|
|
507
|
+
error: fieldErrors.warehouseId,
|
|
508
|
+
children: /* @__PURE__ */ jsx(
|
|
509
|
+
ComboboxInput,
|
|
510
|
+
{
|
|
511
|
+
value: form.warehouseId,
|
|
512
|
+
onChange: (next) => {
|
|
513
|
+
patchForm({
|
|
514
|
+
warehouseId: next.trim(),
|
|
515
|
+
locationId: ""
|
|
516
|
+
});
|
|
517
|
+
},
|
|
518
|
+
loadSuggestions: async (query) => {
|
|
519
|
+
const options = await loadWarehouseOptions(query);
|
|
520
|
+
registerOptionLabels(options);
|
|
521
|
+
return options.map((option) => ({
|
|
522
|
+
value: option.value,
|
|
523
|
+
label: option.label
|
|
524
|
+
}));
|
|
525
|
+
},
|
|
526
|
+
resolveLabel: resolveOptionLabel,
|
|
527
|
+
placeholder: t(
|
|
528
|
+
"wms.backend.inventory.adjust.form.warehousePlaceholder",
|
|
529
|
+
"Select warehouse"
|
|
530
|
+
),
|
|
531
|
+
allowCustomValues: false,
|
|
532
|
+
disabled: submitting
|
|
533
|
+
}
|
|
534
|
+
)
|
|
535
|
+
}
|
|
536
|
+
),
|
|
537
|
+
/* @__PURE__ */ jsx(
|
|
538
|
+
FormField,
|
|
539
|
+
{
|
|
540
|
+
label: t("wms.backend.inventory.adjust.form.location", "Location"),
|
|
541
|
+
required: true,
|
|
542
|
+
error: fieldErrors.locationId,
|
|
543
|
+
children: /* @__PURE__ */ jsx(
|
|
544
|
+
ComboboxInput,
|
|
545
|
+
{
|
|
546
|
+
value: form.locationId,
|
|
547
|
+
onChange: (next) => patchForm({ locationId: next.trim() }),
|
|
548
|
+
loadSuggestions: async (query) => {
|
|
549
|
+
const options = await loadLocationOptions(form.warehouseId, query);
|
|
550
|
+
registerOptionLabels(options);
|
|
551
|
+
return options.map((option) => ({
|
|
552
|
+
value: option.value,
|
|
553
|
+
label: option.label
|
|
554
|
+
}));
|
|
555
|
+
},
|
|
556
|
+
resolveLabel: resolveOptionLabel,
|
|
557
|
+
placeholder: t(
|
|
558
|
+
"wms.backend.inventory.adjust.form.locationPlaceholder",
|
|
559
|
+
"Select location"
|
|
560
|
+
),
|
|
561
|
+
allowCustomValues: false,
|
|
562
|
+
disabled: submitting || !form.warehouseId
|
|
563
|
+
}
|
|
564
|
+
)
|
|
565
|
+
}
|
|
566
|
+
)
|
|
567
|
+
] }),
|
|
568
|
+
/* @__PURE__ */ jsx(
|
|
569
|
+
FormField,
|
|
570
|
+
{
|
|
571
|
+
label: t("wms.backend.inventory.adjust.form.lot", "Lot"),
|
|
572
|
+
error: fieldErrors.lotNumber,
|
|
573
|
+
children: /* @__PURE__ */ jsx(
|
|
574
|
+
ComboboxInput,
|
|
575
|
+
{
|
|
576
|
+
value: form.lotNumber,
|
|
577
|
+
onChange: (next) => patchForm({ lotNumber: next.trim() }),
|
|
578
|
+
loadSuggestions: async (query) => {
|
|
579
|
+
const options = await loadLotNumberOptions(form.catalogVariantId, query);
|
|
580
|
+
registerOptionLabels(options);
|
|
581
|
+
return options.map((option) => ({
|
|
582
|
+
value: option.value,
|
|
583
|
+
label: option.label
|
|
584
|
+
}));
|
|
585
|
+
},
|
|
586
|
+
resolveLabel: resolveOptionLabel,
|
|
587
|
+
placeholder: t(
|
|
588
|
+
"wms.backend.inventory.adjust.form.lotPlaceholder",
|
|
589
|
+
"Select lot (optional)"
|
|
590
|
+
),
|
|
591
|
+
allowCustomValues: true,
|
|
592
|
+
disabled: submitting || !form.catalogVariantId
|
|
593
|
+
}
|
|
594
|
+
)
|
|
595
|
+
}
|
|
596
|
+
),
|
|
597
|
+
/* @__PURE__ */ jsxs(
|
|
598
|
+
FormField,
|
|
599
|
+
{
|
|
600
|
+
label: t("wms.backend.inventory.adjust.form.serial", "Serial number"),
|
|
601
|
+
error: fieldErrors.serialNumber,
|
|
602
|
+
children: [
|
|
603
|
+
/* @__PURE__ */ jsx(
|
|
604
|
+
Input,
|
|
605
|
+
{
|
|
606
|
+
value: form.serialNumber,
|
|
607
|
+
onChange: (event) => patchForm({ serialNumber: event.target.value }),
|
|
608
|
+
placeholder: t(
|
|
609
|
+
"wms.backend.inventory.adjust.form.serialPlaceholder",
|
|
610
|
+
"Optional \u2014 for serial-tracked variants"
|
|
611
|
+
),
|
|
612
|
+
disabled: submitting
|
|
613
|
+
}
|
|
614
|
+
),
|
|
615
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: t(
|
|
616
|
+
"wms.backend.inventory.adjust.form.serialHelp",
|
|
617
|
+
"Use when the variant profile tracks serials."
|
|
618
|
+
) })
|
|
619
|
+
]
|
|
620
|
+
}
|
|
621
|
+
),
|
|
622
|
+
/* @__PURE__ */ jsx(
|
|
623
|
+
FormField,
|
|
624
|
+
{
|
|
625
|
+
label: t("wms.backend.inventory.adjust.form.delta", "Adjustment"),
|
|
626
|
+
required: true,
|
|
627
|
+
error: fieldErrors.delta,
|
|
628
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex w-32 items-center gap-2 rounded-md border bg-background p-2 shadow-xs", children: [
|
|
629
|
+
/* @__PURE__ */ jsx(
|
|
630
|
+
IconButton,
|
|
631
|
+
{
|
|
632
|
+
type: "button",
|
|
633
|
+
variant: "ghost",
|
|
634
|
+
size: "sm",
|
|
635
|
+
"aria-label": t("wms.backend.inventory.adjust.form.decrease", "Decrease quantity"),
|
|
636
|
+
onClick: () => adjustDelta(-1),
|
|
637
|
+
disabled: submitting,
|
|
638
|
+
children: /* @__PURE__ */ jsx(Minus, { className: "size-4" })
|
|
639
|
+
}
|
|
640
|
+
),
|
|
641
|
+
/* @__PURE__ */ jsx(
|
|
642
|
+
Input,
|
|
643
|
+
{
|
|
644
|
+
type: "text",
|
|
645
|
+
inputMode: "decimal",
|
|
646
|
+
value: String(form.delta),
|
|
647
|
+
onChange: (event) => {
|
|
648
|
+
const parsed = parseDeltaInput(event.target.value);
|
|
649
|
+
if (parsed == null) return;
|
|
650
|
+
patchForm({ delta: parsed });
|
|
651
|
+
},
|
|
652
|
+
className: "h-8 w-auto min-w-0 flex-1 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0",
|
|
653
|
+
inputClassName: "text-center [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
|
|
654
|
+
disabled: submitting
|
|
655
|
+
}
|
|
656
|
+
),
|
|
657
|
+
/* @__PURE__ */ jsx(
|
|
658
|
+
IconButton,
|
|
659
|
+
{
|
|
660
|
+
type: "button",
|
|
661
|
+
variant: "ghost",
|
|
662
|
+
size: "sm",
|
|
663
|
+
"aria-label": t("wms.backend.inventory.adjust.form.increase", "Increase quantity"),
|
|
664
|
+
onClick: () => adjustDelta(1),
|
|
665
|
+
disabled: submitting,
|
|
666
|
+
children: /* @__PURE__ */ jsx(Plus, { className: "size-4" })
|
|
667
|
+
}
|
|
668
|
+
)
|
|
669
|
+
] })
|
|
670
|
+
}
|
|
671
|
+
),
|
|
672
|
+
/* @__PURE__ */ jsx(
|
|
673
|
+
FormField,
|
|
674
|
+
{
|
|
675
|
+
label: t("wms.backend.inventory.adjust.form.reason", "Reason"),
|
|
676
|
+
required: true,
|
|
677
|
+
error: fieldErrors.reasonCode,
|
|
678
|
+
children: /* @__PURE__ */ jsxs(
|
|
679
|
+
Select,
|
|
680
|
+
{
|
|
681
|
+
value: form.reasonCode || void 0,
|
|
682
|
+
onValueChange: (next) => patchForm({ reasonCode: next }),
|
|
683
|
+
disabled: submitting,
|
|
684
|
+
children: [
|
|
685
|
+
/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(
|
|
686
|
+
SelectValue,
|
|
687
|
+
{
|
|
688
|
+
placeholder: t(
|
|
689
|
+
"wms.backend.inventory.adjust.form.reasonPlaceholder",
|
|
690
|
+
"Select reason"
|
|
691
|
+
)
|
|
692
|
+
}
|
|
693
|
+
) }),
|
|
694
|
+
/* @__PURE__ */ jsx(SelectContent, { children: ADJUST_REASON_CODES.map((code) => /* @__PURE__ */ jsx(SelectItem, { value: code, children: reasonLabel(code) }, code)) })
|
|
695
|
+
]
|
|
696
|
+
}
|
|
697
|
+
)
|
|
698
|
+
}
|
|
699
|
+
),
|
|
700
|
+
/* @__PURE__ */ jsx(FormField, { label: t("wms.backend.inventory.adjust.form.notes", "Notes"), children: /* @__PURE__ */ jsx(
|
|
701
|
+
Textarea,
|
|
702
|
+
{
|
|
703
|
+
value: form.notes,
|
|
704
|
+
onChange: (event) => patchForm({ notes: event.target.value }),
|
|
705
|
+
placeholder: t(
|
|
706
|
+
"wms.backend.inventory.adjust.form.notesPlaceholder",
|
|
707
|
+
"Optional \u2014 context for auditors"
|
|
708
|
+
),
|
|
709
|
+
rows: 3,
|
|
710
|
+
disabled: submitting
|
|
711
|
+
}
|
|
712
|
+
) }),
|
|
713
|
+
previewContextReady ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-muted/40 px-4 py-3.5", children: [
|
|
714
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: t("wms.backend.inventory.adjust.preview.title", "Balance preview") }),
|
|
715
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-2 flex items-center justify-between gap-3", children: [
|
|
716
|
+
previewError ? /* @__PURE__ */ jsx("p", { className: "text-sm text-status-warning-fg", children: previewError }) : loadingPreview && onHand == null ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("wms.backend.inventory.adjust.preview.loading", "Refreshing balance\u2026") }) : onHand != null && projectedOnHand != null ? /* @__PURE__ */ jsxs("p", { className: "text-sm font-semibold tabular-nums text-foreground", children: [
|
|
717
|
+
t("wms.backend.inventory.adjust.preview.onHandLabel", "On hand"),
|
|
718
|
+
" ",
|
|
719
|
+
onHand,
|
|
720
|
+
" \u2192 ",
|
|
721
|
+
projectedOnHand
|
|
722
|
+
] }) : onHand != null ? /* @__PURE__ */ jsxs("p", { className: "text-sm font-semibold tabular-nums text-foreground", children: [
|
|
723
|
+
t("wms.backend.inventory.adjust.preview.onHandLabel", "On hand"),
|
|
724
|
+
" ",
|
|
725
|
+
onHand
|
|
726
|
+
] }) : null,
|
|
727
|
+
showBelowReorder ? /* @__PURE__ */ jsx(StatusBadge, { variant: "warning", children: t(
|
|
728
|
+
"wms.backend.inventory.adjust.preview.belowReorder",
|
|
729
|
+
"Below reorder"
|
|
730
|
+
) }) : null
|
|
731
|
+
] }),
|
|
732
|
+
loadingPreview && onHand != null ? /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: t("wms.backend.inventory.adjust.preview.loading", "Refreshing balance\u2026") }) : null
|
|
733
|
+
] }) : null
|
|
734
|
+
] }),
|
|
735
|
+
/* @__PURE__ */ jsxs(DialogFooter, { bordered: false, className: "border-t px-6 py-4 sm:justify-between", children: [
|
|
736
|
+
/* @__PURE__ */ jsxs("p", { className: "hidden text-xs text-muted-foreground sm:inline-flex sm:items-center sm:gap-1.5", children: [
|
|
737
|
+
/* @__PURE__ */ jsx(KbdShortcut, { keys: ["\u2318", "Enter"] }),
|
|
738
|
+
/* @__PURE__ */ jsx("span", { children: "/" }),
|
|
739
|
+
/* @__PURE__ */ jsx(KbdShortcut, { keys: ["Ctrl", "Enter"] }),
|
|
740
|
+
/* @__PURE__ */ jsx("span", { children: t("wms.backend.inventory.adjust.dialog.shortcutSave", "to save") })
|
|
741
|
+
] }),
|
|
742
|
+
/* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row", children: [
|
|
743
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: closeDialog, disabled: submitting, children: t("common.cancel", "Cancel") }),
|
|
744
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", disabled: submitting, children: t("wms.backend.inventory.adjust.dialog.submit", "Save adjustment") })
|
|
745
|
+
] })
|
|
746
|
+
] })
|
|
747
|
+
] })
|
|
748
|
+
]
|
|
749
|
+
}
|
|
750
|
+
) });
|
|
751
|
+
}
|
|
752
|
+
export {
|
|
753
|
+
AdjustInventoryDialog
|
|
754
|
+
};
|
|
755
|
+
//# sourceMappingURL=AdjustInventoryDialog.js.map
|