@open-mercato/core 0.6.7-develop.6661.1.0043ed1d03 → 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.
Files changed (494) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/dist/generated/entities/inventory_balance/index.js +21 -0
  3. package/dist/generated/entities/inventory_balance/index.js.map +7 -0
  4. package/dist/generated/entities/inventory_lot/index.js +19 -0
  5. package/dist/generated/entities/inventory_lot/index.js.map +7 -0
  6. package/dist/generated/entities/inventory_movement/index.js +35 -0
  7. package/dist/generated/entities/inventory_movement/index.js.map +7 -0
  8. package/dist/generated/entities/inventory_reservation/index.js +23 -0
  9. package/dist/generated/entities/inventory_reservation/index.js.map +7 -0
  10. package/dist/generated/entities/product_inventory_profile/index.js +21 -0
  11. package/dist/generated/entities/product_inventory_profile/index.js.map +7 -0
  12. package/dist/generated/entities/sales_order_warehouse_assignment/index.js +11 -0
  13. package/dist/generated/entities/sales_order_warehouse_assignment/index.js.map +7 -0
  14. package/dist/generated/entities/warehouse/index.js +25 -0
  15. package/dist/generated/entities/warehouse/index.js.map +7 -0
  16. package/dist/generated/entities/warehouse_location/index.js +21 -0
  17. package/dist/generated/entities/warehouse_location/index.js.map +7 -0
  18. package/dist/generated/entities/warehouse_zone/index.js +11 -0
  19. package/dist/generated/entities/warehouse_zone/index.js.map +7 -0
  20. package/dist/generated/entities.ids.generated.js +12 -0
  21. package/dist/generated/entities.ids.generated.js.map +2 -2
  22. package/dist/generated/entity-fields-registry.js +98 -0
  23. package/dist/generated/entity-fields-registry.js.map +2 -2
  24. package/dist/modules/auth/backend/roles/page.js +12 -4
  25. package/dist/modules/auth/backend/roles/page.js.map +2 -2
  26. package/dist/modules/auth/lib/backendChrome.js +1 -0
  27. package/dist/modules/auth/lib/backendChrome.js.map +2 -2
  28. package/dist/modules/auth/services/rbacService.js +16 -17
  29. package/dist/modules/auth/services/rbacService.js.map +2 -2
  30. package/dist/modules/catalog/api/products/route.js +3 -0
  31. package/dist/modules/catalog/api/products/route.js.map +2 -2
  32. package/dist/modules/catalog/api/variants/route.js +3 -0
  33. package/dist/modules/catalog/api/variants/route.js.map +2 -2
  34. package/dist/modules/customer_accounts/migrations/Migration20260724120000_customer_accounts.js +56 -0
  35. package/dist/modules/customer_accounts/migrations/Migration20260724120000_customer_accounts.js.map +7 -0
  36. package/dist/modules/directory/api/organizations/route.js +1 -1
  37. package/dist/modules/directory/api/organizations/route.js.map +1 -1
  38. package/dist/modules/entities/api/definitions.js +2 -0
  39. package/dist/modules/entities/api/definitions.js.map +2 -2
  40. package/dist/modules/entities/lib/helpers.js +1 -0
  41. package/dist/modules/entities/lib/helpers.js.map +2 -2
  42. package/dist/modules/query_index/lib/engine.js +6 -6
  43. package/dist/modules/query_index/lib/engine.js.map +2 -2
  44. package/dist/modules/sales/api/documents/factory.js +1 -0
  45. package/dist/modules/sales/api/documents/factory.js.map +2 -2
  46. package/dist/modules/sales/api/quotes/accept/route.js +7 -2
  47. package/dist/modules/sales/api/quotes/accept/route.js.map +2 -2
  48. package/dist/modules/sales/api/quotes/public/[token]/route.js +2 -1
  49. package/dist/modules/sales/api/quotes/public/[token]/route.js.map +2 -2
  50. package/dist/modules/sales/commands/documents.js +53 -0
  51. package/dist/modules/sales/commands/documents.js.map +2 -2
  52. package/dist/modules/sales/components/documents/ItemsSection.js +51 -2
  53. package/dist/modules/sales/components/documents/ItemsSection.js.map +2 -2
  54. package/dist/modules/sales/events.js +2 -0
  55. package/dist/modules/sales/events.js.map +2 -2
  56. package/dist/modules/sales/lib/publicQuoteTenantScope.js +24 -0
  57. package/dist/modules/sales/lib/publicQuoteTenantScope.js.map +7 -0
  58. package/dist/modules/sales/widgets/injection/order-items-context.js +11 -0
  59. package/dist/modules/sales/widgets/injection/order-items-context.js.map +7 -0
  60. package/dist/modules/wms/acl.js +18 -0
  61. package/dist/modules/wms/acl.js.map +7 -0
  62. package/dist/modules/wms/analytics.js +11 -0
  63. package/dist/modules/wms/analytics.js.map +7 -0
  64. package/dist/modules/wms/api/dashboard/operational/route.js +80 -0
  65. package/dist/modules/wms/api/dashboard/operational/route.js.map +7 -0
  66. package/dist/modules/wms/api/interceptors.js +90 -0
  67. package/dist/modules/wms/api/interceptors.js.map +7 -0
  68. package/dist/modules/wms/api/inventory/adjust/route.js +51 -0
  69. package/dist/modules/wms/api/inventory/adjust/route.js.map +7 -0
  70. package/dist/modules/wms/api/inventory/allocate/route.js +51 -0
  71. package/dist/modules/wms/api/inventory/allocate/route.js.map +7 -0
  72. package/dist/modules/wms/api/inventory/balances/route.js +172 -0
  73. package/dist/modules/wms/api/inventory/balances/route.js.map +7 -0
  74. package/dist/modules/wms/api/inventory/cycle-count/route.js +52 -0
  75. package/dist/modules/wms/api/inventory/cycle-count/route.js.map +7 -0
  76. package/dist/modules/wms/api/inventory/helpers.js +113 -0
  77. package/dist/modules/wms/api/inventory/helpers.js.map +7 -0
  78. package/dist/modules/wms/api/inventory/import/apply/route.js +46 -0
  79. package/dist/modules/wms/api/inventory/import/apply/route.js.map +7 -0
  80. package/dist/modules/wms/api/inventory/import/helpers.js +195 -0
  81. package/dist/modules/wms/api/inventory/import/helpers.js.map +7 -0
  82. package/dist/modules/wms/api/inventory/import/template/route.js +32 -0
  83. package/dist/modules/wms/api/inventory/import/template/route.js.map +7 -0
  84. package/dist/modules/wms/api/inventory/import/validate/route.js +54 -0
  85. package/dist/modules/wms/api/inventory/import/validate/route.js.map +7 -0
  86. package/dist/modules/wms/api/inventory/move/route.js +51 -0
  87. package/dist/modules/wms/api/inventory/move/route.js.map +7 -0
  88. package/dist/modules/wms/api/inventory/movements/route.js +164 -0
  89. package/dist/modules/wms/api/inventory/movements/route.js.map +7 -0
  90. package/dist/modules/wms/api/inventory/receive/route.js +50 -0
  91. package/dist/modules/wms/api/inventory/receive/route.js.map +7 -0
  92. package/dist/modules/wms/api/inventory/release/route.js +44 -0
  93. package/dist/modules/wms/api/inventory/release/route.js.map +7 -0
  94. package/dist/modules/wms/api/inventory/reservations/route.js +128 -0
  95. package/dist/modules/wms/api/inventory/reservations/route.js.map +7 -0
  96. package/dist/modules/wms/api/inventory/reserve/route.js +59 -0
  97. package/dist/modules/wms/api/inventory/reserve/route.js.map +7 -0
  98. package/dist/modules/wms/api/inventory-profiles/route.js +178 -0
  99. package/dist/modules/wms/api/inventory-profiles/route.js.map +7 -0
  100. package/dist/modules/wms/api/listEnrichers.js +181 -0
  101. package/dist/modules/wms/api/listEnrichers.js.map +7 -0
  102. package/dist/modules/wms/api/listSearch.js +77 -0
  103. package/dist/modules/wms/api/listSearch.js.map +7 -0
  104. package/dist/modules/wms/api/locations/route.js +172 -0
  105. package/dist/modules/wms/api/locations/route.js.map +7 -0
  106. package/dist/modules/wms/api/lots/route.js +204 -0
  107. package/dist/modules/wms/api/lots/route.js.map +7 -0
  108. package/dist/modules/wms/api/openapi.js +27 -0
  109. package/dist/modules/wms/api/openapi.js.map +7 -0
  110. package/dist/modules/wms/api/sales-orders/[salesOrderId]/re-run-reservation/route.js +54 -0
  111. package/dist/modules/wms/api/sales-orders/[salesOrderId]/re-run-reservation/route.js.map +7 -0
  112. package/dist/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.js +279 -0
  113. package/dist/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.js.map +7 -0
  114. package/dist/modules/wms/api/sales-orders/assign-warehouse/route.js +56 -0
  115. package/dist/modules/wms/api/sales-orders/assign-warehouse/route.js.map +7 -0
  116. package/dist/modules/wms/api/sales-orders/unassign-warehouse/route.js +43 -0
  117. package/dist/modules/wms/api/sales-orders/unassign-warehouse/route.js.map +7 -0
  118. package/dist/modules/wms/api/warehouses/route.js +181 -0
  119. package/dist/modules/wms/api/warehouses/route.js.map +7 -0
  120. package/dist/modules/wms/api/zones/route.js +159 -0
  121. package/dist/modules/wms/api/zones/route.js.map +7 -0
  122. package/dist/modules/wms/backend/config/wms/page.js +9 -0
  123. package/dist/modules/wms/backend/config/wms/page.js.map +7 -0
  124. package/dist/modules/wms/backend/config/wms/page.meta.js +18 -0
  125. package/dist/modules/wms/backend/config/wms/page.meta.js.map +7 -0
  126. package/dist/modules/wms/backend/page.js +9 -0
  127. package/dist/modules/wms/backend/page.js.map +7 -0
  128. package/dist/modules/wms/backend/page.meta.js +16 -0
  129. package/dist/modules/wms/backend/page.meta.js.map +7 -0
  130. package/dist/modules/wms/backend/wms/inventory/page.js +9 -0
  131. package/dist/modules/wms/backend/wms/inventory/page.js.map +7 -0
  132. package/dist/modules/wms/backend/wms/inventory/page.meta.js +18 -0
  133. package/dist/modules/wms/backend/wms/inventory/page.meta.js.map +7 -0
  134. package/dist/modules/wms/backend/wms/location/[id]/page.js +9 -0
  135. package/dist/modules/wms/backend/wms/location/[id]/page.js.map +7 -0
  136. package/dist/modules/wms/backend/wms/location/[id]/page.meta.js +18 -0
  137. package/dist/modules/wms/backend/wms/location/[id]/page.meta.js.map +7 -0
  138. package/dist/modules/wms/backend/wms/locations/page.js +10 -0
  139. package/dist/modules/wms/backend/wms/locations/page.js.map +7 -0
  140. package/dist/modules/wms/backend/wms/locations/page.meta.js +18 -0
  141. package/dist/modules/wms/backend/wms/locations/page.meta.js.map +7 -0
  142. package/dist/modules/wms/backend/wms/lot/[id]/page.js +9 -0
  143. package/dist/modules/wms/backend/wms/lot/[id]/page.js.map +7 -0
  144. package/dist/modules/wms/backend/wms/lot/[id]/page.meta.js +18 -0
  145. package/dist/modules/wms/backend/wms/lot/[id]/page.meta.js.map +7 -0
  146. package/dist/modules/wms/backend/wms/lots/page.js +9 -0
  147. package/dist/modules/wms/backend/wms/lots/page.js.map +7 -0
  148. package/dist/modules/wms/backend/wms/lots/page.meta.js +18 -0
  149. package/dist/modules/wms/backend/wms/lots/page.meta.js.map +7 -0
  150. package/dist/modules/wms/backend/wms/movements/page.js +22 -0
  151. package/dist/modules/wms/backend/wms/movements/page.js.map +7 -0
  152. package/dist/modules/wms/backend/wms/movements/page.meta.js +18 -0
  153. package/dist/modules/wms/backend/wms/movements/page.meta.js.map +7 -0
  154. package/dist/modules/wms/backend/wms/reservations/page.js +23 -0
  155. package/dist/modules/wms/backend/wms/reservations/page.js.map +7 -0
  156. package/dist/modules/wms/backend/wms/reservations/page.meta.js +18 -0
  157. package/dist/modules/wms/backend/wms/reservations/page.meta.js.map +7 -0
  158. package/dist/modules/wms/backend/wms/sku/[id]/page.js +9 -0
  159. package/dist/modules/wms/backend/wms/sku/[id]/page.js.map +7 -0
  160. package/dist/modules/wms/backend/wms/sku/[id]/page.meta.js +18 -0
  161. package/dist/modules/wms/backend/wms/sku/[id]/page.meta.js.map +7 -0
  162. package/dist/modules/wms/backend/wms/warehouses/page.js +10 -0
  163. package/dist/modules/wms/backend/wms/warehouses/page.js.map +7 -0
  164. package/dist/modules/wms/backend/wms/warehouses/page.meta.js +18 -0
  165. package/dist/modules/wms/backend/wms/warehouses/page.meta.js.map +7 -0
  166. package/dist/modules/wms/backend/wms/zones/page.js +10 -0
  167. package/dist/modules/wms/backend/wms/zones/page.js.map +7 -0
  168. package/dist/modules/wms/backend/wms/zones/page.meta.js +18 -0
  169. package/dist/modules/wms/backend/wms/zones/page.meta.js.map +7 -0
  170. package/dist/modules/wms/ce.js +80 -0
  171. package/dist/modules/wms/ce.js.map +7 -0
  172. package/dist/modules/wms/cli.js +83 -0
  173. package/dist/modules/wms/cli.js.map +7 -0
  174. package/dist/modules/wms/commands/configuration.js +1519 -0
  175. package/dist/modules/wms/commands/configuration.js.map +7 -0
  176. package/dist/modules/wms/commands/index.js +4 -0
  177. package/dist/modules/wms/commands/index.js.map +7 -0
  178. package/dist/modules/wms/commands/inventory-actions.js +1539 -0
  179. package/dist/modules/wms/commands/inventory-actions.js.map +7 -0
  180. package/dist/modules/wms/commands/sales-order-assignment.js +277 -0
  181. package/dist/modules/wms/commands/sales-order-assignment.js.map +7 -0
  182. package/dist/modules/wms/commands/shared.js +82 -0
  183. package/dist/modules/wms/commands/shared.js.map +7 -0
  184. package/dist/modules/wms/components/backend/AdjustInventoryDialog.js +755 -0
  185. package/dist/modules/wms/components/backend/AdjustInventoryDialog.js.map +7 -0
  186. package/dist/modules/wms/components/backend/ChangeLotStatusDialog.js +269 -0
  187. package/dist/modules/wms/components/backend/ChangeLotStatusDialog.js.map +7 -0
  188. package/dist/modules/wms/components/backend/CycleCountWizardDialog.js +1783 -0
  189. package/dist/modules/wms/components/backend/CycleCountWizardDialog.js.map +7 -0
  190. package/dist/modules/wms/components/backend/ImportInventoryDialog.js +766 -0
  191. package/dist/modules/wms/components/backend/ImportInventoryDialog.js.map +7 -0
  192. package/dist/modules/wms/components/backend/InventoryOperationsSection.js +119 -0
  193. package/dist/modules/wms/components/backend/InventoryOperationsSection.js.map +7 -0
  194. package/dist/modules/wms/components/backend/LocationEditDialog.js +140 -0
  195. package/dist/modules/wms/components/backend/LocationEditDialog.js.map +7 -0
  196. package/dist/modules/wms/components/backend/MoveInventoryDialog.js +791 -0
  197. package/dist/modules/wms/components/backend/MoveInventoryDialog.js.map +7 -0
  198. package/dist/modules/wms/components/backend/ReceiveInventoryDialog.js +656 -0
  199. package/dist/modules/wms/components/backend/ReceiveInventoryDialog.js.map +7 -0
  200. package/dist/modules/wms/components/backend/ReleaseReservationDialog.js +344 -0
  201. package/dist/modules/wms/components/backend/ReleaseReservationDialog.js.map +7 -0
  202. package/dist/modules/wms/components/backend/ReserveInventoryDialog.js +475 -0
  203. package/dist/modules/wms/components/backend/ReserveInventoryDialog.js.map +7 -0
  204. package/dist/modules/wms/components/backend/WmsConfigurationPage.js +1112 -0
  205. package/dist/modules/wms/components/backend/WmsConfigurationPage.js.map +7 -0
  206. package/dist/modules/wms/components/backend/WmsInventoryConsolePage.js +908 -0
  207. package/dist/modules/wms/components/backend/WmsInventoryConsolePage.js.map +7 -0
  208. package/dist/modules/wms/components/backend/WmsLocationDetailPage.js +1015 -0
  209. package/dist/modules/wms/components/backend/WmsLocationDetailPage.js.map +7 -0
  210. package/dist/modules/wms/components/backend/WmsLotDetailPage.js +1049 -0
  211. package/dist/modules/wms/components/backend/WmsLotDetailPage.js.map +7 -0
  212. package/dist/modules/wms/components/backend/WmsLotsListPage.js +297 -0
  213. package/dist/modules/wms/components/backend/WmsLotsListPage.js.map +7 -0
  214. package/dist/modules/wms/components/backend/WmsOperationalDashboardPage.js +757 -0
  215. package/dist/modules/wms/components/backend/WmsOperationalDashboardPage.js.map +7 -0
  216. package/dist/modules/wms/components/backend/WmsSkuDetailPage.js +975 -0
  217. package/dist/modules/wms/components/backend/WmsSkuDetailPage.js.map +7 -0
  218. package/dist/modules/wms/components/backend/inventoryMutationLoaders.js +710 -0
  219. package/dist/modules/wms/components/backend/inventoryMutationLoaders.js.map +7 -0
  220. package/dist/modules/wms/components/backend/useWmsInventoryMutationAccess.js +79 -0
  221. package/dist/modules/wms/components/backend/useWmsInventoryMutationAccess.js.map +7 -0
  222. package/dist/modules/wms/components/backend/useWmsInventoryScopeFromSearchParams.js +24 -0
  223. package/dist/modules/wms/components/backend/useWmsInventoryScopeFromSearchParams.js.map +7 -0
  224. package/dist/modules/wms/components/backend/wmsLookupLoaders.js +55 -0
  225. package/dist/modules/wms/components/backend/wmsLookupLoaders.js.map +7 -0
  226. package/dist/modules/wms/data/enrichers.js +501 -0
  227. package/dist/modules/wms/data/enrichers.js.map +7 -0
  228. package/dist/modules/wms/data/entities.js +467 -0
  229. package/dist/modules/wms/data/entities.js.map +7 -0
  230. package/dist/modules/wms/data/validators.js +399 -0
  231. package/dist/modules/wms/data/validators.js.map +7 -0
  232. package/dist/modules/wms/di.js +27 -0
  233. package/dist/modules/wms/di.js.map +7 -0
  234. package/dist/modules/wms/events.js +42 -0
  235. package/dist/modules/wms/events.js.map +7 -0
  236. package/dist/modules/wms/index.js +17 -0
  237. package/dist/modules/wms/index.js.map +7 -0
  238. package/dist/modules/wms/lib/catalogInventoryProfileIntent.js +54 -0
  239. package/dist/modules/wms/lib/catalogInventoryProfileIntent.js.map +7 -0
  240. package/dist/modules/wms/lib/catalogInventoryProfileSync.js +144 -0
  241. package/dist/modules/wms/lib/catalogInventoryProfileSync.js.map +7 -0
  242. package/dist/modules/wms/lib/expiry.js +29 -0
  243. package/dist/modules/wms/lib/expiry.js.map +7 -0
  244. package/dist/modules/wms/lib/flashMutationError.js +51 -0
  245. package/dist/modules/wms/lib/flashMutationError.js.map +7 -0
  246. package/dist/modules/wms/lib/inventoryDisplayUi.js +188 -0
  247. package/dist/modules/wms/lib/inventoryDisplayUi.js.map +7 -0
  248. package/dist/modules/wms/lib/inventoryIdempotency.js +37 -0
  249. package/dist/modules/wms/lib/inventoryIdempotency.js.map +7 -0
  250. package/dist/modules/wms/lib/inventoryImportCsv.js +173 -0
  251. package/dist/modules/wms/lib/inventoryImportCsv.js.map +7 -0
  252. package/dist/modules/wms/lib/inventoryImportService.js +468 -0
  253. package/dist/modules/wms/lib/inventoryImportService.js.map +7 -0
  254. package/dist/modules/wms/lib/inventoryMutationUi.js +25 -0
  255. package/dist/modules/wms/lib/inventoryMutationUi.js.map +7 -0
  256. package/dist/modules/wms/lib/inventoryPolicy.js +61 -0
  257. package/dist/modules/wms/lib/inventoryPolicy.js.map +7 -0
  258. package/dist/modules/wms/lib/inventoryReconciliation.js +193 -0
  259. package/dist/modules/wms/lib/inventoryReconciliation.js.map +7 -0
  260. package/dist/modules/wms/lib/inventoryTrackingValidation.js +13 -0
  261. package/dist/modules/wms/lib/inventoryTrackingValidation.js.map +7 -0
  262. package/dist/modules/wms/lib/loadOperationalDashboard.js +580 -0
  263. package/dist/modules/wms/lib/loadOperationalDashboard.js.map +7 -0
  264. package/dist/modules/wms/lib/lowStockBalanceFilter.js +49 -0
  265. package/dist/modules/wms/lib/lowStockBalanceFilter.js.map +7 -0
  266. package/dist/modules/wms/lib/primaryWarehousePolicy.js +32 -0
  267. package/dist/modules/wms/lib/primaryWarehousePolicy.js.map +7 -0
  268. package/dist/modules/wms/lib/roleFeatures.js +30 -0
  269. package/dist/modules/wms/lib/roleFeatures.js.map +7 -0
  270. package/dist/modules/wms/lib/salesOrderInventoryAutomation.js +291 -0
  271. package/dist/modules/wms/lib/salesOrderInventoryAutomation.js.map +7 -0
  272. package/dist/modules/wms/lib/salesOrderWarehouseAssignment.js +54 -0
  273. package/dist/modules/wms/lib/salesOrderWarehouseAssignment.js.map +7 -0
  274. package/dist/modules/wms/lib/wmsIntegrationToggles.js +71 -0
  275. package/dist/modules/wms/lib/wmsIntegrationToggles.js.map +7 -0
  276. package/dist/modules/wms/migrations/Migration20260428110546.js +78 -0
  277. package/dist/modules/wms/migrations/Migration20260428110546.js.map +7 -0
  278. package/dist/modules/wms/migrations/Migration20260527120000.js +15 -0
  279. package/dist/modules/wms/migrations/Migration20260527120000.js.map +7 -0
  280. package/dist/modules/wms/migrations/Migration20260527140000.js +37 -0
  281. package/dist/modules/wms/migrations/Migration20260527140000.js.map +7 -0
  282. package/dist/modules/wms/migrations/Migration20260613120000.js +23 -0
  283. package/dist/modules/wms/migrations/Migration20260613120000.js.map +7 -0
  284. package/dist/modules/wms/migrations/Migration20260616090000.js +13 -0
  285. package/dist/modules/wms/migrations/Migration20260616090000.js.map +7 -0
  286. package/dist/modules/wms/migrations/Migration20260707180000.js +15 -0
  287. package/dist/modules/wms/migrations/Migration20260707180000.js.map +7 -0
  288. package/dist/modules/wms/notifications.client.js +18 -0
  289. package/dist/modules/wms/notifications.client.js.map +7 -0
  290. package/dist/modules/wms/notifications.js +53 -0
  291. package/dist/modules/wms/notifications.js.map +7 -0
  292. package/dist/modules/wms/search.js +196 -0
  293. package/dist/modules/wms/search.js.map +7 -0
  294. package/dist/modules/wms/setup.js +30 -0
  295. package/dist/modules/wms/setup.js.map +7 -0
  296. package/dist/modules/wms/subscribers/low-stock-notification.js +40 -0
  297. package/dist/modules/wms/subscribers/low-stock-notification.js.map +7 -0
  298. package/dist/modules/wms/subscribers/reservation-shortfall-notification.js +69 -0
  299. package/dist/modules/wms/subscribers/reservation-shortfall-notification.js.map +7 -0
  300. package/dist/modules/wms/subscribers/sales-order-cancelled-release.js +14 -0
  301. package/dist/modules/wms/subscribers/sales-order-cancelled-release.js.map +7 -0
  302. package/dist/modules/wms/subscribers/sales-order-confirmed-reserve.js +14 -0
  303. package/dist/modules/wms/subscribers/sales-order-confirmed-reserve.js.map +7 -0
  304. package/dist/modules/wms/translations.js +10 -0
  305. package/dist/modules/wms/translations.js.map +7 -0
  306. package/dist/modules/wms/vector.js +9 -0
  307. package/dist/modules/wms/vector.js.map +7 -0
  308. package/dist/modules/wms/widgets/injection/catalog-inventory-profile/widget.js +200 -0
  309. package/dist/modules/wms/widgets/injection/catalog-inventory-profile/widget.js.map +7 -0
  310. package/dist/modules/wms/widgets/injection/order-items-stock-column/widget.js +104 -0
  311. package/dist/modules/wms/widgets/injection/order-items-stock-column/widget.js.map +7 -0
  312. package/dist/modules/wms/widgets/injection/sales-order-stock-context/widget.client.js +389 -0
  313. package/dist/modules/wms/widgets/injection/sales-order-stock-context/widget.client.js.map +7 -0
  314. package/dist/modules/wms/widgets/injection/sales-order-stock-context/widget.js +16 -0
  315. package/dist/modules/wms/widgets/injection/sales-order-stock-context/widget.js.map +7 -0
  316. package/dist/modules/wms/widgets/injection-table.js +36 -0
  317. package/dist/modules/wms/widgets/injection-table.js.map +7 -0
  318. package/dist/modules/wms/widgets/notifications/WmsLowStockRenderer.js +150 -0
  319. package/dist/modules/wms/widgets/notifications/WmsLowStockRenderer.js.map +7 -0
  320. package/dist/modules/wms/widgets/notifications/WmsReservationShortfallRenderer.js +186 -0
  321. package/dist/modules/wms/widgets/notifications/WmsReservationShortfallRenderer.js.map +7 -0
  322. package/dist/modules/wms/widgets/notifications/index.js +7 -0
  323. package/dist/modules/wms/widgets/notifications/index.js.map +7 -0
  324. package/generated/entities/inventory_balance/index.ts +9 -0
  325. package/generated/entities/inventory_lot/index.ts +8 -0
  326. package/generated/entities/inventory_movement/index.ts +16 -0
  327. package/generated/entities/inventory_reservation/index.ts +10 -0
  328. package/generated/entities/product_inventory_profile/index.ts +9 -0
  329. package/generated/entities/sales_order_warehouse_assignment/index.ts +4 -0
  330. package/generated/entities/warehouse/index.ts +11 -0
  331. package/generated/entities/warehouse_location/index.ts +9 -0
  332. package/generated/entities/warehouse_zone/index.ts +4 -0
  333. package/generated/entities.ids.generated.ts +12 -0
  334. package/generated/entity-fields-registry.ts +98 -0
  335. package/package.json +7 -7
  336. package/src/modules/auth/backend/roles/page.tsx +13 -4
  337. package/src/modules/auth/i18n/de.json +2 -0
  338. package/src/modules/auth/i18n/en.json +2 -0
  339. package/src/modules/auth/i18n/es.json +2 -0
  340. package/src/modules/auth/i18n/pl.json +2 -0
  341. package/src/modules/auth/lib/backendChrome.tsx +1 -0
  342. package/src/modules/auth/services/rbacService.ts +25 -21
  343. package/src/modules/catalog/api/products/route.ts +3 -0
  344. package/src/modules/catalog/api/variants/route.ts +3 -0
  345. package/src/modules/customer_accounts/migrations/Migration20260724120000_customer_accounts.ts +96 -0
  346. package/src/modules/directory/api/organizations/route.ts +1 -1
  347. package/src/modules/entities/api/definitions.ts +2 -0
  348. package/src/modules/entities/lib/helpers.ts +1 -0
  349. package/src/modules/query_index/lib/engine.ts +18 -6
  350. package/src/modules/sales/api/documents/factory.ts +1 -0
  351. package/src/modules/sales/api/quotes/accept/route.ts +9 -2
  352. package/src/modules/sales/api/quotes/public/[token]/route.ts +2 -1
  353. package/src/modules/sales/commands/documents.ts +71 -0
  354. package/src/modules/sales/components/documents/ItemsSection.tsx +58 -0
  355. package/src/modules/sales/events.ts +2 -0
  356. package/src/modules/sales/lib/publicQuoteTenantScope.ts +49 -0
  357. package/src/modules/sales/widgets/injection/order-items-context.ts +15 -0
  358. package/src/modules/wms/acl.ts +14 -0
  359. package/src/modules/wms/analytics.ts +9 -0
  360. package/src/modules/wms/api/dashboard/operational/route.ts +83 -0
  361. package/src/modules/wms/api/interceptors.ts +108 -0
  362. package/src/modules/wms/api/inventory/adjust/route.ts +50 -0
  363. package/src/modules/wms/api/inventory/allocate/route.ts +50 -0
  364. package/src/modules/wms/api/inventory/balances/route.ts +178 -0
  365. package/src/modules/wms/api/inventory/cycle-count/route.ts +51 -0
  366. package/src/modules/wms/api/inventory/helpers.ts +128 -0
  367. package/src/modules/wms/api/inventory/import/apply/route.ts +47 -0
  368. package/src/modules/wms/api/inventory/import/helpers.ts +223 -0
  369. package/src/modules/wms/api/inventory/import/template/route.ts +31 -0
  370. package/src/modules/wms/api/inventory/import/validate/route.ts +56 -0
  371. package/src/modules/wms/api/inventory/move/route.ts +50 -0
  372. package/src/modules/wms/api/inventory/movements/route.ts +164 -0
  373. package/src/modules/wms/api/inventory/receive/route.ts +49 -0
  374. package/src/modules/wms/api/inventory/release/route.ts +43 -0
  375. package/src/modules/wms/api/inventory/reservations/route.ts +128 -0
  376. package/src/modules/wms/api/inventory/reserve/route.ts +59 -0
  377. package/src/modules/wms/api/inventory-profiles/route.ts +177 -0
  378. package/src/modules/wms/api/listEnrichers.ts +312 -0
  379. package/src/modules/wms/api/listSearch.ts +121 -0
  380. package/src/modules/wms/api/locations/route.ts +171 -0
  381. package/src/modules/wms/api/lots/route.ts +205 -0
  382. package/src/modules/wms/api/openapi.ts +28 -0
  383. package/src/modules/wms/api/sales-orders/[salesOrderId]/re-run-reservation/route.ts +58 -0
  384. package/src/modules/wms/api/sales-orders/[salesOrderId]/warehouse-assignment/route.ts +306 -0
  385. package/src/modules/wms/api/sales-orders/assign-warehouse/route.ts +57 -0
  386. package/src/modules/wms/api/sales-orders/unassign-warehouse/route.ts +43 -0
  387. package/src/modules/wms/api/warehouses/route.ts +181 -0
  388. package/src/modules/wms/api/zones/route.ts +158 -0
  389. package/src/modules/wms/backend/config/wms/page.meta.ts +14 -0
  390. package/src/modules/wms/backend/config/wms/page.tsx +5 -0
  391. package/src/modules/wms/backend/page.meta.ts +12 -0
  392. package/src/modules/wms/backend/page.tsx +5 -0
  393. package/src/modules/wms/backend/wms/inventory/page.meta.ts +14 -0
  394. package/src/modules/wms/backend/wms/inventory/page.tsx +5 -0
  395. package/src/modules/wms/backend/wms/location/[id]/page.meta.ts +14 -0
  396. package/src/modules/wms/backend/wms/location/[id]/page.tsx +5 -0
  397. package/src/modules/wms/backend/wms/locations/page.meta.ts +14 -0
  398. package/src/modules/wms/backend/wms/locations/page.tsx +12 -0
  399. package/src/modules/wms/backend/wms/lot/[id]/page.meta.ts +14 -0
  400. package/src/modules/wms/backend/wms/lot/[id]/page.tsx +5 -0
  401. package/src/modules/wms/backend/wms/lots/page.meta.ts +14 -0
  402. package/src/modules/wms/backend/wms/lots/page.tsx +5 -0
  403. package/src/modules/wms/backend/wms/movements/page.meta.ts +14 -0
  404. package/src/modules/wms/backend/wms/movements/page.tsx +23 -0
  405. package/src/modules/wms/backend/wms/reservations/page.meta.ts +14 -0
  406. package/src/modules/wms/backend/wms/reservations/page.tsx +24 -0
  407. package/src/modules/wms/backend/wms/sku/[id]/page.meta.ts +14 -0
  408. package/src/modules/wms/backend/wms/sku/[id]/page.tsx +5 -0
  409. package/src/modules/wms/backend/wms/warehouses/page.meta.ts +14 -0
  410. package/src/modules/wms/backend/wms/warehouses/page.tsx +12 -0
  411. package/src/modules/wms/backend/wms/zones/page.meta.ts +14 -0
  412. package/src/modules/wms/backend/wms/zones/page.tsx +12 -0
  413. package/src/modules/wms/ce.ts +76 -0
  414. package/src/modules/wms/cli.ts +96 -0
  415. package/src/modules/wms/commands/configuration.ts +1844 -0
  416. package/src/modules/wms/commands/index.ts +3 -0
  417. package/src/modules/wms/commands/inventory-actions.ts +1866 -0
  418. package/src/modules/wms/commands/sales-order-assignment.ts +346 -0
  419. package/src/modules/wms/commands/shared.ts +90 -0
  420. package/src/modules/wms/components/backend/AdjustInventoryDialog.tsx +820 -0
  421. package/src/modules/wms/components/backend/ChangeLotStatusDialog.tsx +312 -0
  422. package/src/modules/wms/components/backend/CycleCountWizardDialog.tsx +2007 -0
  423. package/src/modules/wms/components/backend/ImportInventoryDialog.tsx +1018 -0
  424. package/src/modules/wms/components/backend/InventoryOperationsSection.tsx +159 -0
  425. package/src/modules/wms/components/backend/LocationEditDialog.tsx +185 -0
  426. package/src/modules/wms/components/backend/MoveInventoryDialog.tsx +907 -0
  427. package/src/modules/wms/components/backend/ReceiveInventoryDialog.tsx +695 -0
  428. package/src/modules/wms/components/backend/ReleaseReservationDialog.tsx +424 -0
  429. package/src/modules/wms/components/backend/ReserveInventoryDialog.tsx +511 -0
  430. package/src/modules/wms/components/backend/WmsConfigurationPage.tsx +1340 -0
  431. package/src/modules/wms/components/backend/WmsInventoryConsolePage.tsx +1132 -0
  432. package/src/modules/wms/components/backend/WmsLocationDetailPage.tsx +1310 -0
  433. package/src/modules/wms/components/backend/WmsLotDetailPage.tsx +1355 -0
  434. package/src/modules/wms/components/backend/WmsLotsListPage.tsx +359 -0
  435. package/src/modules/wms/components/backend/WmsOperationalDashboardPage.tsx +958 -0
  436. package/src/modules/wms/components/backend/WmsSkuDetailPage.tsx +1245 -0
  437. package/src/modules/wms/components/backend/inventoryMutationLoaders.ts +960 -0
  438. package/src/modules/wms/components/backend/useWmsInventoryMutationAccess.ts +89 -0
  439. package/src/modules/wms/components/backend/useWmsInventoryScopeFromSearchParams.ts +32 -0
  440. package/src/modules/wms/components/backend/wmsLookupLoaders.ts +78 -0
  441. package/src/modules/wms/data/enrichers.ts +718 -0
  442. package/src/modules/wms/data/entities.ts +436 -0
  443. package/src/modules/wms/data/validators.ts +463 -0
  444. package/src/modules/wms/di.ts +25 -0
  445. package/src/modules/wms/events.ts +41 -0
  446. package/src/modules/wms/i18n/de.json +1051 -0
  447. package/src/modules/wms/i18n/en.json +1051 -0
  448. package/src/modules/wms/i18n/es.json +1051 -0
  449. package/src/modules/wms/i18n/pl.json +1051 -0
  450. package/src/modules/wms/index.ts +15 -0
  451. package/src/modules/wms/lib/catalogInventoryProfileIntent.ts +65 -0
  452. package/src/modules/wms/lib/catalogInventoryProfileSync.ts +199 -0
  453. package/src/modules/wms/lib/expiry.ts +30 -0
  454. package/src/modules/wms/lib/flashMutationError.ts +74 -0
  455. package/src/modules/wms/lib/inventoryDisplayUi.ts +249 -0
  456. package/src/modules/wms/lib/inventoryIdempotency.ts +54 -0
  457. package/src/modules/wms/lib/inventoryImportCsv.ts +212 -0
  458. package/src/modules/wms/lib/inventoryImportService.ts +629 -0
  459. package/src/modules/wms/lib/inventoryMutationUi.ts +21 -0
  460. package/src/modules/wms/lib/inventoryPolicy.ts +111 -0
  461. package/src/modules/wms/lib/inventoryReconciliation.ts +263 -0
  462. package/src/modules/wms/lib/inventoryTrackingValidation.ts +23 -0
  463. package/src/modules/wms/lib/loadOperationalDashboard.ts +776 -0
  464. package/src/modules/wms/lib/lowStockBalanceFilter.ts +74 -0
  465. package/src/modules/wms/lib/primaryWarehousePolicy.ts +46 -0
  466. package/src/modules/wms/lib/roleFeatures.ts +32 -0
  467. package/src/modules/wms/lib/salesOrderInventoryAutomation.ts +390 -0
  468. package/src/modules/wms/lib/salesOrderWarehouseAssignment.ts +78 -0
  469. package/src/modules/wms/lib/wmsIntegrationToggles.ts +81 -0
  470. package/src/modules/wms/migrations/.snapshot-open-mercato.json +2880 -0
  471. package/src/modules/wms/migrations/Migration20260428110546.ts +91 -0
  472. package/src/modules/wms/migrations/Migration20260527120000.ts +15 -0
  473. package/src/modules/wms/migrations/Migration20260527140000.ts +35 -0
  474. package/src/modules/wms/migrations/Migration20260613120000.ts +21 -0
  475. package/src/modules/wms/migrations/Migration20260616090000.ts +11 -0
  476. package/src/modules/wms/migrations/Migration20260707180000.ts +13 -0
  477. package/src/modules/wms/notifications.client.ts +18 -0
  478. package/src/modules/wms/notifications.ts +51 -0
  479. package/src/modules/wms/search.ts +230 -0
  480. package/src/modules/wms/setup.ts +29 -0
  481. package/src/modules/wms/subscribers/low-stock-notification.ts +54 -0
  482. package/src/modules/wms/subscribers/reservation-shortfall-notification.ts +98 -0
  483. package/src/modules/wms/subscribers/sales-order-cancelled-release.ts +21 -0
  484. package/src/modules/wms/subscribers/sales-order-confirmed-reserve.ts +21 -0
  485. package/src/modules/wms/translations.ts +6 -0
  486. package/src/modules/wms/vector.ts +7 -0
  487. package/src/modules/wms/widgets/injection/catalog-inventory-profile/widget.ts +238 -0
  488. package/src/modules/wms/widgets/injection/order-items-stock-column/widget.tsx +153 -0
  489. package/src/modules/wms/widgets/injection/sales-order-stock-context/widget.client.tsx +476 -0
  490. package/src/modules/wms/widgets/injection/sales-order-stock-context/widget.ts +15 -0
  491. package/src/modules/wms/widgets/injection-table.ts +34 -0
  492. package/src/modules/wms/widgets/notifications/WmsLowStockRenderer.tsx +153 -0
  493. package/src/modules/wms/widgets/notifications/WmsReservationShortfallRenderer.tsx +194 -0
  494. package/src/modules/wms/widgets/notifications/index.ts +2 -0
@@ -0,0 +1,757 @@
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 {
7
+ ArrowDown,
8
+ ClipboardList,
9
+ ExternalLink,
10
+ MapPin,
11
+ Package,
12
+ RefreshCw,
13
+ SlidersHorizontal,
14
+ Warehouse as WarehouseIcon2
15
+ } from "lucide-react";
16
+ import { Page, PageBody, PageHeader } from "@open-mercato/ui/backend/Page";
17
+ import { BarChart } from "@open-mercato/ui/backend/charts";
18
+ import { DataTable } from "@open-mercato/ui/backend/DataTable";
19
+ import { LoadingMessage, ErrorMessage } from "@open-mercato/ui/backend/detail";
20
+ import { RowActions } from "@open-mercato/ui/backend/RowActions";
21
+ import { apiCall } from "@open-mercato/ui/backend/utils/apiCall";
22
+ import { raiseCrudError } from "@open-mercato/ui/backend/utils/serverErrors";
23
+ import { useLocale, useT } from "@open-mercato/shared/lib/i18n/context";
24
+ import { Button } from "@open-mercato/ui/primitives/button";
25
+ import { LinkButton } from "@open-mercato/ui/primitives/link-button";
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 {
35
+ inventoryMovementReasonLabel
36
+ } from "../../lib/inventoryDisplayUi.js";
37
+ import { AdjustInventoryDialog } from "./AdjustInventoryDialog.js";
38
+ import { ChangeLotStatusDialog } from "./ChangeLotStatusDialog.js";
39
+ import { CycleCountWizardDialog } from "./CycleCountWizardDialog.js";
40
+ import { MoveInventoryDialog } from "./MoveInventoryDialog.js";
41
+ import { ReceiveInventoryDialog } from "./ReceiveInventoryDialog.js";
42
+ import { useWmsInventoryMutationAccess } from "./useWmsInventoryMutationAccess.js";
43
+ const AUTO_REFRESH_MS = 6e4;
44
+ function Sparkline({ values, className }) {
45
+ const width = 160;
46
+ const height = 36;
47
+ const max = Math.max(...values, 1);
48
+ const points = values.map((value, index) => {
49
+ const x = values.length <= 1 ? width / 2 : index / (values.length - 1) * width;
50
+ const y = height - value / max * (height - 4) - 2;
51
+ return `${x},${y}`;
52
+ });
53
+ return /* @__PURE__ */ jsx(
54
+ "svg",
55
+ {
56
+ viewBox: `0 0 ${width} ${height}`,
57
+ className,
58
+ "aria-hidden": "true",
59
+ preserveAspectRatio: "none",
60
+ children: /* @__PURE__ */ jsx(
61
+ "polyline",
62
+ {
63
+ fill: "none",
64
+ stroke: "currentColor",
65
+ strokeWidth: "1.5",
66
+ strokeLinecap: "round",
67
+ strokeLinejoin: "round",
68
+ points: points.join(" "),
69
+ className: "text-status-info-icon"
70
+ }
71
+ )
72
+ }
73
+ );
74
+ }
75
+ function formatActivityTitle(row, t) {
76
+ const sku = row.variantSku?.trim() || row.variantId;
77
+ const quantity = Math.abs(row.quantity);
78
+ const signedQuantity = row.quantity;
79
+ switch (row.movementType) {
80
+ case "receipt":
81
+ case "return_receive":
82
+ return t("wms.backend.dashboard.activity.titles.received", "Received {quantity}\xD7 {sku}", {
83
+ quantity,
84
+ sku
85
+ });
86
+ case "adjust":
87
+ return t("wms.backend.dashboard.activity.titles.adjusted", "Adjusted {quantity}\xD7 {sku}", {
88
+ quantity: `${signedQuantity >= 0 ? "+" : ""}${signedQuantity}`,
89
+ sku
90
+ });
91
+ case "transfer":
92
+ return t("wms.backend.dashboard.activity.titles.moved", "Moved {quantity}\xD7 {sku}", {
93
+ quantity,
94
+ sku
95
+ });
96
+ case "pick":
97
+ case "pack":
98
+ return t("wms.backend.dashboard.activity.titles.allocated", "Allocated {quantity}\xD7 {sku}", {
99
+ quantity,
100
+ sku
101
+ });
102
+ case "cycle_count":
103
+ return t("wms.backend.dashboard.activity.titles.reconciled", "Inventory reconciled \u2014 {sku}", {
104
+ sku
105
+ });
106
+ default:
107
+ return t("wms.backend.dashboard.activity.titles.generic", "{type} {quantity}\xD7 {sku}", {
108
+ type: row.movementType,
109
+ quantity,
110
+ sku
111
+ });
112
+ }
113
+ }
114
+ function formatActivitySubtitle(row, t) {
115
+ const reasonLabel = inventoryMovementReasonLabel(
116
+ {
117
+ reasonCode: row.reasonCode,
118
+ reason: row.reason,
119
+ movementType: row.movementType
120
+ },
121
+ t
122
+ );
123
+ if (reasonLabel) return reasonLabel;
124
+ if (row.referenceType && row.referenceId) return `${row.referenceType} \xB7 ${row.referenceId}`;
125
+ return null;
126
+ }
127
+ function createDateTimeFormatter(locale, options) {
128
+ return new Intl.DateTimeFormat(locale, options);
129
+ }
130
+ function resolveDashboardFirstRunMode(input) {
131
+ if (input.warehousesLoading || input.warehousesError) return null;
132
+ if (!input.hasWarehouses) return "no-warehouses";
133
+ if (input.locationsLoading || input.locationsError) return null;
134
+ if (input.locationsCount === 0) return "no-locations";
135
+ return null;
136
+ }
137
+ function DashboardKpiCard({
138
+ kpi,
139
+ title,
140
+ caption,
141
+ badgeLabel,
142
+ badgeVariant,
143
+ ctaLabel,
144
+ href
145
+ }) {
146
+ return /* @__PURE__ */ jsxs("section", { className: "flex min-h-52 flex-col rounded-lg border bg-card p-5 text-card-foreground shadow-sm", children: [
147
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: title }),
148
+ /* @__PURE__ */ jsx("p", { className: "mt-3 text-xs text-muted-foreground", children: caption }),
149
+ /* @__PURE__ */ jsxs("div", { className: "mt-2 flex items-end gap-3", children: [
150
+ /* @__PURE__ */ jsx("p", { className: "text-3xl font-semibold tracking-tight", children: kpi.count }),
151
+ badgeLabel ? /* @__PURE__ */ jsx(StatusBadge, { variant: badgeVariant, dot: true, children: badgeLabel }) : null
152
+ ] }),
153
+ /* @__PURE__ */ jsx(Sparkline, { values: kpi.sparkline, className: "mt-3 h-9 w-full max-w-40" }),
154
+ /* @__PURE__ */ jsx(LinkButton, { asChild: true, variant: "primary", size: "sm", className: "mt-4 w-fit", children: /* @__PURE__ */ jsx(Link, { href, children: ctaLabel }) })
155
+ ] });
156
+ }
157
+ function ExpiryLotList({
158
+ title,
159
+ emptyLabel,
160
+ viewAllLabel,
161
+ viewAllHref,
162
+ rows,
163
+ expiryFormatter,
164
+ quantityFormatter,
165
+ canAdjust,
166
+ onChangeStatus,
167
+ onMove,
168
+ t
169
+ }) {
170
+ return /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
171
+ /* @__PURE__ */ jsxs("div", { className: "mb-3 flex items-center justify-between gap-3", children: [
172
+ /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: title }),
173
+ /* @__PURE__ */ jsx(LinkButton, { asChild: true, variant: "gray", size: "sm", className: "h-8 px-2", children: /* @__PURE__ */ jsx(Link, { href: viewAllHref, children: viewAllLabel }) })
174
+ ] }),
175
+ rows.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: emptyLabel }) : /* @__PURE__ */ jsx("ul", { className: "divide-y divide-border", children: rows.map((row) => {
176
+ const badgeVariant = row.category === "pastDue" ? "error" : "warning";
177
+ return /* @__PURE__ */ jsxs("li", { className: "flex items-start justify-between gap-3 py-3 first:pt-0 last:pb-0", children: [
178
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
179
+ /* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium", children: row.lotNumber }),
180
+ /* @__PURE__ */ jsx("p", { className: "truncate text-xs text-muted-foreground", children: row.sku }),
181
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 flex flex-wrap items-center gap-2", children: [
182
+ /* @__PURE__ */ jsx(StatusBadge, { variant: badgeVariant, dot: true, children: expiryFormatter.format(new Date(row.expiresAt)) }),
183
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: t(
184
+ "wms.backend.dashboard.expiry.available",
185
+ "{quantity} available",
186
+ { quantity: quantityFormatter.format(row.availableQuantity) }
187
+ ) })
188
+ ] })
189
+ ] }),
190
+ /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [
191
+ canAdjust ? /* @__PURE__ */ jsx(
192
+ RowActions,
193
+ {
194
+ items: [
195
+ {
196
+ id: "change-status",
197
+ label: t("wms.backend.lots.actions.changeStatus", "Change status"),
198
+ onSelect: () => onChangeStatus(row)
199
+ },
200
+ {
201
+ id: "move",
202
+ label: t("wms.backend.lots.actions.move", "Move"),
203
+ onSelect: () => onMove(row)
204
+ }
205
+ ]
206
+ }
207
+ ) : null,
208
+ /* @__PURE__ */ jsx(Button, { asChild: true, type: "button", variant: "ghost", size: "icon", className: "size-7 shrink-0", children: /* @__PURE__ */ jsx(
209
+ Link,
210
+ {
211
+ href: `/backend/wms/lot/${row.id}`,
212
+ "aria-label": t("wms.backend.dashboard.expiry.openLot", "Open lot"),
213
+ children: /* @__PURE__ */ jsx(ExternalLink, { className: "size-3.5" })
214
+ }
215
+ ) })
216
+ ] })
217
+ ] }, row.id);
218
+ }) })
219
+ ] });
220
+ }
221
+ const movementStatusMap = {
222
+ receipt: "success",
223
+ return_receive: "success",
224
+ adjust: "warning",
225
+ transfer: "info",
226
+ pick: "info",
227
+ pack: "info",
228
+ cycle_count: "neutral",
229
+ putaway: "info",
230
+ ship: "success"
231
+ };
232
+ function WmsOperationalDashboardPage() {
233
+ const t = useT();
234
+ const locale = useLocale();
235
+ const access = useWmsInventoryMutationAccess();
236
+ const [warehouseId, setWarehouseId] = React.useState("all");
237
+ const [adjustOpen, setAdjustOpen] = React.useState(false);
238
+ const [cycleOpen, setCycleOpen] = React.useState(false);
239
+ const [changeStatusOpen, setChangeStatusOpen] = React.useState(false);
240
+ const [moveOpen, setMoveOpen] = React.useState(false);
241
+ const [receiveOpen, setReceiveOpen] = React.useState(false);
242
+ const [activeExpiryLot, setActiveExpiryLot] = React.useState(null);
243
+ const openExpiryChangeStatus = React.useCallback((row) => {
244
+ setActiveExpiryLot(row);
245
+ setChangeStatusOpen(true);
246
+ }, []);
247
+ const openExpiryMove = React.useCallback((row) => {
248
+ setActiveExpiryLot(row);
249
+ setMoveOpen(true);
250
+ }, []);
251
+ const activityTimeFormatter = React.useMemo(
252
+ () => createDateTimeFormatter(locale, {
253
+ month: "2-digit",
254
+ day: "2-digit",
255
+ hour: "2-digit",
256
+ minute: "2-digit"
257
+ }),
258
+ [locale]
259
+ );
260
+ const lastUpdatedFormatter = React.useMemo(
261
+ () => createDateTimeFormatter(locale, {
262
+ hour: "2-digit",
263
+ minute: "2-digit"
264
+ }),
265
+ [locale]
266
+ );
267
+ const expiryDateFormatter = React.useMemo(
268
+ () => createDateTimeFormatter(locale, {
269
+ month: "2-digit",
270
+ day: "2-digit",
271
+ year: "2-digit"
272
+ }),
273
+ [locale]
274
+ );
275
+ const quantityFormatter = React.useMemo(
276
+ () => new Intl.NumberFormat(locale, { maximumFractionDigits: 2 }),
277
+ [locale]
278
+ );
279
+ const warehousesQuery = useQuery({
280
+ queryKey: ["wms-dashboard", "warehouses"],
281
+ queryFn: async () => {
282
+ const params = new URLSearchParams({ page: "1", pageSize: "100", sortField: "name", sortDir: "asc" });
283
+ const call = await apiCall(`/api/wms/warehouses?${params.toString()}`);
284
+ if (!call.ok) {
285
+ await raiseCrudError(call.response, t("wms.backend.dashboard.errors.warehouses", "Failed to load warehouses."));
286
+ }
287
+ return call.result?.items ?? [];
288
+ }
289
+ });
290
+ const hasWarehouses = (warehousesQuery.data ?? []).length > 0;
291
+ const locationsCountQuery = useQuery({
292
+ queryKey: ["wms-dashboard", "locations-count"],
293
+ queryFn: async () => {
294
+ const params = new URLSearchParams({ page: "1", pageSize: "1" });
295
+ const call = await apiCall(`/api/wms/locations?${params.toString()}`);
296
+ if (!call.ok) {
297
+ await raiseCrudError(call.response, t("wms.backend.dashboard.errors.locations", "Failed to load locations."));
298
+ }
299
+ return call.result?.total ?? 0;
300
+ },
301
+ enabled: hasWarehouses
302
+ });
303
+ const dashboardQuery = useQuery({
304
+ queryKey: ["wms-dashboard", "operational", warehouseId],
305
+ queryFn: async () => {
306
+ const params = new URLSearchParams();
307
+ if (warehouseId !== "all") params.set("warehouseId", warehouseId);
308
+ const call = await apiCall(
309
+ `/api/wms/dashboard/operational?${params.toString()}`
310
+ );
311
+ if (!call.ok) {
312
+ await raiseCrudError(call.response, t("wms.backend.dashboard.errors.load", "Failed to load dashboard."));
313
+ }
314
+ return call.result;
315
+ },
316
+ refetchInterval: AUTO_REFRESH_MS
317
+ });
318
+ const selectedWarehouse = warehousesQuery.data?.find((warehouse) => warehouse.id === warehouseId);
319
+ const warehouseLabel = warehouseId === "all" ? t("wms.backend.dashboard.filters.allWarehouses", "All warehouses") : selectedWarehouse?.name || selectedWarehouse?.code || warehouseId;
320
+ const firstRunMode = React.useMemo(
321
+ () => resolveDashboardFirstRunMode({
322
+ warehousesLoading: warehousesQuery.isLoading,
323
+ warehousesError: warehousesQuery.isError,
324
+ hasWarehouses,
325
+ locationsLoading: locationsCountQuery.isLoading,
326
+ locationsError: locationsCountQuery.isError,
327
+ locationsCount: locationsCountQuery.data ?? 0
328
+ }),
329
+ [
330
+ warehousesQuery.isLoading,
331
+ warehousesQuery.isError,
332
+ hasWarehouses,
333
+ locationsCountQuery.isLoading,
334
+ locationsCountQuery.isError,
335
+ locationsCountQuery.data
336
+ ]
337
+ );
338
+ const kpiConfig = React.useMemo(() => {
339
+ const buildLotsHref = (expiryWindow) => {
340
+ const params = new URLSearchParams({ expiryWindow });
341
+ if (warehouseId !== "all") params.set("warehouseId", warehouseId);
342
+ return `/backend/wms/lots?${params.toString()}`;
343
+ };
344
+ const buildInventoryHref = (lowStock) => {
345
+ const params = new URLSearchParams();
346
+ if (warehouseId !== "all") params.set("warehouseId", warehouseId);
347
+ if (lowStock) params.set("lowStock", lowStock);
348
+ const query = params.toString();
349
+ return query ? `/backend/wms/inventory?${query}` : "/backend/wms/inventory";
350
+ };
351
+ const inventoryHref = buildInventoryHref();
352
+ const reservationsHref = warehouseId === "all" ? "/backend/wms/reservations" : `/backend/wms/reservations?warehouseId=${encodeURIComponent(warehouseId)}`;
353
+ const movementsHref2 = warehouseId === "all" ? "/backend/wms/movements" : `/backend/wms/movements?warehouseId=${encodeURIComponent(warehouseId)}`;
354
+ return {
355
+ lowStock: {
356
+ title: t("wms.backend.dashboard.kpis.lowStock.title", "Low stock"),
357
+ caption: t("wms.backend.dashboard.kpis.lowStock.caption", "Below reorder point"),
358
+ ctaLabel: t("wms.backend.dashboard.kpis.lowStock.cta", "View low stock"),
359
+ href: buildInventoryHref("belowReorder"),
360
+ resolveBadge: (kpi) => ({
361
+ variant: "warning",
362
+ label: t("wms.backend.dashboard.kpis.lowStock.badgeActive", "{count} active", { count: kpi.count })
363
+ })
364
+ },
365
+ reorderCritical: {
366
+ title: t("wms.backend.dashboard.kpis.reorderCritical.title", "Reorder critical"),
367
+ caption: t("wms.backend.dashboard.kpis.reorderCritical.caption", "Below safety stock"),
368
+ ctaLabel: t("wms.backend.dashboard.kpis.reorderCritical.cta", "View critical"),
369
+ href: buildInventoryHref("belowSafety"),
370
+ resolveBadge: (kpi) => ({
371
+ variant: "error",
372
+ label: t("wms.backend.dashboard.kpis.reorderCritical.badge", "{count} critical", { count: kpi.count })
373
+ })
374
+ },
375
+ expiringSoon: {
376
+ title: t("wms.backend.dashboard.kpis.expiringSoon.title", "Expiring soon"),
377
+ caption: t("wms.backend.dashboard.kpis.expiringSoon.caption", "Lots expiring in 30 days"),
378
+ ctaLabel: t("wms.backend.dashboard.kpis.expiringSoon.cta", "View expiry"),
379
+ href: buildLotsHref("expiringSoon"),
380
+ resolveBadge: (kpi) => ({
381
+ variant: "warning",
382
+ label: t("wms.backend.dashboard.kpis.expiringSoon.badge", "{count} lots", { count: kpi.count })
383
+ })
384
+ },
385
+ pastDue: {
386
+ title: t("wms.backend.dashboard.kpis.pastDue.title", "Past due"),
387
+ caption: t("wms.backend.dashboard.kpis.pastDue.caption", "Expired lots with on-hand stock"),
388
+ ctaLabel: t("wms.backend.dashboard.kpis.pastDue.cta", "View past due"),
389
+ href: buildLotsHref("pastDue"),
390
+ resolveBadge: (kpi) => ({
391
+ variant: "error",
392
+ label: t("wms.backend.dashboard.kpis.pastDue.badge", "{count} lots", { count: kpi.count })
393
+ })
394
+ },
395
+ agingReservations: {
396
+ title: t("wms.backend.dashboard.kpis.agingReservations.title", "Aging reservations"),
397
+ caption: t("wms.backend.dashboard.kpis.agingReservations.caption", "Active holds older than 7 days"),
398
+ ctaLabel: t("wms.backend.dashboard.kpis.agingReservations.cta", "View reservations"),
399
+ href: reservationsHref,
400
+ resolveBadge: (kpi) => ({
401
+ variant: "warning",
402
+ label: t("wms.backend.dashboard.kpis.agingReservations.badge", "{count} aging", { count: kpi.count })
403
+ })
404
+ },
405
+ todaysMoves: {
406
+ title: t("wms.backend.dashboard.kpis.todaysMoves.title", "Today's moves"),
407
+ caption: t("wms.backend.dashboard.kpis.todaysMoves.caption", "Movements posted today"),
408
+ ctaLabel: t("wms.backend.dashboard.kpis.todaysMoves.cta", "View ledger"),
409
+ href: movementsHref2,
410
+ resolveBadge: (kpi) => {
411
+ if (kpi.deltaSinceYesterday === null) {
412
+ return { variant: "neutral", label: null };
413
+ }
414
+ return {
415
+ variant: kpi.deltaSinceYesterday >= 0 ? "success" : "neutral",
416
+ label: kpi.deltaSinceYesterday >= 0 ? t("wms.backend.dashboard.kpis.todaysMoves.badgeUp", "+{count} vs yesterday", {
417
+ count: kpi.deltaSinceYesterday
418
+ }) : t("wms.backend.dashboard.kpis.todaysMoves.badgeDown", "{count} vs yesterday", {
419
+ count: kpi.deltaSinceYesterday
420
+ })
421
+ };
422
+ }
423
+ }
424
+ };
425
+ }, [t, warehouseId]);
426
+ const monthlyTrendData = React.useMemo(
427
+ () => (dashboardQuery.data?.monthlyTrends ?? []).map((point) => ({
428
+ month: point.month,
429
+ receive: point.receive,
430
+ allocate: point.allocate
431
+ })),
432
+ [dashboardQuery.data?.monthlyTrends]
433
+ );
434
+ const expiryLotsByCategory = React.useMemo(() => {
435
+ const lots = dashboardQuery.data?.expiryLots ?? [];
436
+ return {
437
+ expiringSoon: lots.filter((lot) => lot.category === "expiringSoon"),
438
+ pastDue: lots.filter((lot) => lot.category === "pastDue")
439
+ };
440
+ }, [dashboardQuery.data?.expiryLots]);
441
+ const movementsHref = kpiConfig.todaysMoves.href;
442
+ const activityColumns = React.useMemo(
443
+ () => [
444
+ {
445
+ id: "event",
446
+ header: t("wms.backend.dashboard.activity.columns.event", "Event"),
447
+ accessorKey: "movementType",
448
+ cell: ({ row }) => {
449
+ const movementLabel = t(
450
+ `wms.backend.dashboard.activity.types.${row.original.movementType}`,
451
+ row.original.movementType
452
+ );
453
+ const badgeVariant = movementStatusMap[row.original.movementType] ?? "neutral";
454
+ return /* @__PURE__ */ jsx(StatusBadge, { variant: badgeVariant, dot: true, children: movementLabel });
455
+ },
456
+ meta: { maxWidth: "7rem" }
457
+ },
458
+ {
459
+ id: "details",
460
+ header: t("wms.backend.dashboard.activity.columns.details", "Details"),
461
+ cell: ({ row }) => {
462
+ const subtitle2 = formatActivitySubtitle(row.original, t);
463
+ return /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
464
+ /* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium", children: formatActivityTitle(row.original, t) }),
465
+ subtitle2 ? /* @__PURE__ */ jsx("p", { className: "truncate text-sm text-muted-foreground", children: subtitle2 }) : null
466
+ ] });
467
+ }
468
+ },
469
+ {
470
+ id: "location",
471
+ header: t("wms.backend.dashboard.activity.columns.location", "Location"),
472
+ accessorKey: "locationLabel",
473
+ cell: ({ row }) => /* @__PURE__ */ jsx("p", { className: "truncate text-sm text-muted-foreground", children: row.original.locationLabel }),
474
+ meta: { maxWidth: "11rem", truncate: true }
475
+ },
476
+ {
477
+ id: "time",
478
+ header: t("wms.backend.dashboard.activity.columns.time", "Time"),
479
+ accessorKey: "performedAt",
480
+ cell: ({ row }) => /* @__PURE__ */ jsx("p", { className: "text-xs leading-4 text-muted-foreground", children: activityTimeFormatter.format(new Date(row.original.performedAt)) }),
481
+ meta: { maxWidth: "5rem" }
482
+ },
483
+ {
484
+ id: "actions",
485
+ header: t("wms.backend.dashboard.activity.columns.actions", "Actions"),
486
+ cell: ({ row }) => /* @__PURE__ */ jsx(Button, { asChild: true, type: "button", variant: "ghost", size: "icon", className: "size-7", children: /* @__PURE__ */ jsx(
487
+ Link,
488
+ {
489
+ href: `${movementsHref}#${row.original.id}`,
490
+ "aria-label": t("wms.backend.dashboard.activity.open", "Open movement"),
491
+ children: /* @__PURE__ */ jsx(ExternalLink, { className: "size-3.5" })
492
+ }
493
+ ) }),
494
+ meta: { maxWidth: "2.5rem" }
495
+ }
496
+ ],
497
+ [activityTimeFormatter, movementsHref, t]
498
+ );
499
+ const subtitle = dashboardQuery.data?.lastUpdatedAt ? t("wms.backend.dashboard.subtitle", "Live activity for today \xB7 auto-refresh 60s \xB7 last update {time}", {
500
+ time: lastUpdatedFormatter.format(new Date(dashboardQuery.data.lastUpdatedAt))
501
+ }) : t("wms.backend.dashboard.subtitleLoading", "Live activity for today \xB7 auto-refresh 60s");
502
+ return /* @__PURE__ */ jsxs(Page, { children: [
503
+ /* @__PURE__ */ jsxs(PageBody, { className: "space-y-6", children: [
504
+ /* @__PURE__ */ jsx(
505
+ PageHeader,
506
+ {
507
+ title: t("wms.backend.dashboard.title", "Operational dashboard"),
508
+ description: subtitle,
509
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [
510
+ /* @__PURE__ */ jsxs(Select, { value: warehouseId, onValueChange: setWarehouseId, children: [
511
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "w-full max-w-xs sm:w-56", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: warehouseLabel }) }),
512
+ /* @__PURE__ */ jsxs(SelectContent, { children: [
513
+ /* @__PURE__ */ jsx(SelectItem, { value: "all", children: t("wms.backend.dashboard.filters.allWarehouses", "All warehouses") }),
514
+ (warehousesQuery.data ?? []).map((warehouse) => /* @__PURE__ */ jsx(SelectItem, { value: warehouse.id, children: warehouse.name || warehouse.code || warehouse.id }, warehouse.id))
515
+ ] })
516
+ ] }),
517
+ /* @__PURE__ */ jsxs(
518
+ Button,
519
+ {
520
+ type: "button",
521
+ variant: "outline",
522
+ onClick: () => {
523
+ void dashboardQuery.refetch();
524
+ },
525
+ disabled: dashboardQuery.isFetching,
526
+ children: [
527
+ /* @__PURE__ */ jsx(RefreshCw, { className: `size-4 ${dashboardQuery.isFetching ? "animate-spin" : ""}` }),
528
+ t("wms.backend.dashboard.actions.refresh", "Refresh")
529
+ ]
530
+ }
531
+ )
532
+ ] })
533
+ }
534
+ ),
535
+ dashboardQuery.isLoading ? /* @__PURE__ */ jsx(LoadingMessage, { label: t("wms.backend.dashboard.loading", "Loading dashboard\u2026") }) : null,
536
+ dashboardQuery.isError ? /* @__PURE__ */ jsx(
537
+ ErrorMessage,
538
+ {
539
+ label: t("wms.backend.dashboard.errors.load", "Failed to load dashboard."),
540
+ action: /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => {
541
+ void dashboardQuery.refetch();
542
+ }, children: t("wms.backend.dashboard.actions.refresh", "Refresh") })
543
+ }
544
+ ) : null,
545
+ firstRunMode === "no-warehouses" ? /* @__PURE__ */ jsx("section", { className: "rounded-lg border-2 border-dashed border-border bg-card p-8 text-center shadow-sm", children: /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-sm", children: [
546
+ /* @__PURE__ */ jsx("div", { className: "mx-auto mb-4 flex size-14 items-center justify-center rounded-full bg-muted", children: /* @__PURE__ */ jsx(WarehouseIcon2, { className: "size-7 text-muted-foreground" }) }),
547
+ /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: t("wms.backend.dashboard.firstRun.title", "Set up your warehouse") }),
548
+ /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: t(
549
+ "wms.backend.dashboard.firstRun.description",
550
+ "Create a warehouse, add storage locations, then receive your first stock to start tracking inventory."
551
+ ) }),
552
+ /* @__PURE__ */ jsxs("div", { className: "mt-6 flex flex-col items-center gap-3 sm:flex-row sm:justify-center", children: [
553
+ /* @__PURE__ */ jsx(LinkButton, { asChild: true, variant: "primary", size: "sm", children: /* @__PURE__ */ jsxs(Link, { href: "/backend/config/wms", children: [
554
+ /* @__PURE__ */ jsx(WarehouseIcon2, { className: "size-4" }),
555
+ t("wms.backend.dashboard.firstRun.actions.createWarehouse", "Create warehouse")
556
+ ] }) }),
557
+ /* @__PURE__ */ jsx(LinkButton, { asChild: true, variant: "gray", size: "sm", children: /* @__PURE__ */ jsxs(Link, { href: "/backend/config/wms", children: [
558
+ /* @__PURE__ */ jsx(MapPin, { className: "size-4" }),
559
+ t("wms.backend.dashboard.firstRun.actions.addLocations", "Add locations")
560
+ ] }) }),
561
+ access.canReceive ? /* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", size: "sm", onClick: () => setReceiveOpen(true), children: [
562
+ /* @__PURE__ */ jsx(ArrowDown, { className: "size-4" }),
563
+ t("wms.backend.dashboard.firstRun.actions.receiveStock", "Receive first stock")
564
+ ] }) : null
565
+ ] })
566
+ ] }) }) : null,
567
+ firstRunMode === "no-locations" ? /* @__PURE__ */ jsx("section", { className: "rounded-lg border-2 border-dashed border-border bg-card p-8 text-center shadow-sm", children: /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-sm", children: [
568
+ /* @__PURE__ */ jsx("div", { className: "mx-auto mb-4 flex size-14 items-center justify-center rounded-full bg-muted", children: /* @__PURE__ */ jsx(MapPin, { className: "size-7 text-muted-foreground" }) }),
569
+ /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: t("wms.backend.dashboard.firstRun.noLocations.title", "Add storage locations") }),
570
+ /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: t(
571
+ "wms.backend.dashboard.firstRun.noLocations.description",
572
+ "Your warehouse is set up \u2014 add at least one storage location before you can receive stock."
573
+ ) }),
574
+ /* @__PURE__ */ jsx("div", { className: "mt-6 flex flex-col items-center gap-3 sm:flex-row sm:justify-center", children: /* @__PURE__ */ jsx(LinkButton, { asChild: true, variant: "primary", size: "sm", children: /* @__PURE__ */ jsxs(Link, { href: "/backend/config/wms", children: [
575
+ /* @__PURE__ */ jsx(MapPin, { className: "size-4" }),
576
+ t("wms.backend.dashboard.firstRun.actions.addLocations", "Add locations")
577
+ ] }) }) })
578
+ ] }) }) : null,
579
+ dashboardQuery.data ? /* @__PURE__ */ jsxs(Fragment, { children: [
580
+ /* @__PURE__ */ jsx("section", { className: "grid gap-4 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6", children: dashboardQuery.data.kpis.map((kpi) => {
581
+ const config = kpiConfig[kpi.id];
582
+ const badge = config.resolveBadge(kpi);
583
+ return /* @__PURE__ */ jsx(
584
+ DashboardKpiCard,
585
+ {
586
+ kpi,
587
+ title: config.title,
588
+ caption: config.caption,
589
+ badgeLabel: badge.label,
590
+ badgeVariant: badge.variant,
591
+ ctaLabel: config.ctaLabel,
592
+ href: config.href
593
+ },
594
+ kpi.id
595
+ );
596
+ }) }),
597
+ /* @__PURE__ */ jsxs("section", { className: "rounded-lg border bg-card shadow-sm", children: [
598
+ /* @__PURE__ */ jsxs("div", { className: "border-b px-5 py-4", children: [
599
+ /* @__PURE__ */ jsx("h2", { className: "text-base font-semibold", children: t("wms.backend.dashboard.expiry.title", "Expiry watch") }),
600
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: t(
601
+ "wms.backend.dashboard.expiry.description",
602
+ "Upcoming and overdue lots with on-hand stock in the selected warehouse scope."
603
+ ) })
604
+ ] }),
605
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-6 p-5 md:grid-cols-2", children: [
606
+ /* @__PURE__ */ jsx(
607
+ ExpiryLotList,
608
+ {
609
+ title: t("wms.backend.dashboard.expiry.expiringSoon.title", "Expiring soon"),
610
+ emptyLabel: t(
611
+ "wms.backend.dashboard.expiry.expiringSoon.empty",
612
+ "No lots expiring within the next 30 days."
613
+ ),
614
+ viewAllLabel: t(
615
+ "wms.backend.dashboard.expiry.expiringSoon.viewAll",
616
+ "View all expiring \u2192"
617
+ ),
618
+ viewAllHref: kpiConfig.expiringSoon.href,
619
+ rows: expiryLotsByCategory.expiringSoon,
620
+ expiryFormatter: expiryDateFormatter,
621
+ quantityFormatter,
622
+ canAdjust: access.canAdjust,
623
+ onChangeStatus: openExpiryChangeStatus,
624
+ onMove: openExpiryMove,
625
+ t
626
+ }
627
+ ),
628
+ /* @__PURE__ */ jsx(
629
+ ExpiryLotList,
630
+ {
631
+ title: t("wms.backend.dashboard.expiry.pastDue.title", "Past due"),
632
+ emptyLabel: t(
633
+ "wms.backend.dashboard.expiry.pastDue.empty",
634
+ "No expired lots with available stock."
635
+ ),
636
+ viewAllLabel: t(
637
+ "wms.backend.dashboard.expiry.pastDue.viewAll",
638
+ "View all past due \u2192"
639
+ ),
640
+ viewAllHref: kpiConfig.pastDue.href,
641
+ rows: expiryLotsByCategory.pastDue,
642
+ expiryFormatter: expiryDateFormatter,
643
+ quantityFormatter,
644
+ canAdjust: access.canAdjust,
645
+ onChangeStatus: openExpiryChangeStatus,
646
+ onMove: openExpiryMove,
647
+ t
648
+ }
649
+ )
650
+ ] })
651
+ ] }),
652
+ /* @__PURE__ */ jsxs("section", { className: "rounded-lg border bg-card shadow-sm", children: [
653
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 border-b px-5 py-4", children: [
654
+ /* @__PURE__ */ jsx("h2", { className: "text-base font-semibold", children: t("wms.backend.dashboard.trends.title", "Monthly trends") }),
655
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
656
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2", children: [
657
+ /* @__PURE__ */ jsx("span", { className: "size-2.5 rounded-sm bg-chart-1", "aria-hidden": "true" }),
658
+ t("wms.backend.dashboard.trends.receive", "Receive")
659
+ ] }),
660
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2", children: [
661
+ /* @__PURE__ */ jsx("span", { className: "size-2.5 rounded-sm bg-chart-2", "aria-hidden": "true" }),
662
+ t("wms.backend.dashboard.trends.allocate", "Allocate")
663
+ ] })
664
+ ] })
665
+ ] }),
666
+ /* @__PURE__ */ jsx("div", { className: "p-5", children: /* @__PURE__ */ jsx(
667
+ BarChart,
668
+ {
669
+ data: monthlyTrendData,
670
+ index: "month",
671
+ categories: ["receive", "allocate"],
672
+ showLegend: false,
673
+ categoryLabels: {
674
+ receive: t("wms.backend.dashboard.trends.receive", "Receive"),
675
+ allocate: t("wms.backend.dashboard.trends.allocate", "Allocate")
676
+ },
677
+ emptyMessage: t("wms.backend.dashboard.trends.empty", "No movement trends yet."),
678
+ className: "border-0 bg-transparent p-0 shadow-none"
679
+ }
680
+ ) })
681
+ ] }),
682
+ /* @__PURE__ */ jsx(
683
+ DataTable,
684
+ {
685
+ title: t("wms.backend.dashboard.activity.title", "Recent activity"),
686
+ columns: activityColumns,
687
+ data: dashboardQuery.data.recentActivity,
688
+ disableRowClick: true,
689
+ emptyState: t("wms.backend.dashboard.activity.empty", "No recent movements yet."),
690
+ actions: /* @__PURE__ */ jsx(Button, { asChild: true, type: "button", variant: "ghost", size: "sm", children: /* @__PURE__ */ jsx(Link, { href: movementsHref, children: t("wms.backend.dashboard.activity.viewAll", "View all movements \u2192") }) })
691
+ }
692
+ ),
693
+ /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-4 rounded-lg border bg-card px-5 py-4 shadow-sm lg:flex-row lg:items-center lg:justify-between", children: [
694
+ /* @__PURE__ */ jsxs("div", { children: [
695
+ /* @__PURE__ */ jsx("h2", { className: "text-base font-semibold", children: t("wms.backend.dashboard.quickActions.title", "Quick actions") }),
696
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t(
697
+ "wms.backend.dashboard.quickActions.description",
698
+ "Open a drawer without leaving the dashboard"
699
+ ) })
700
+ ] }),
701
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
702
+ /* @__PURE__ */ jsx(Button, { asChild: true, type: "button", variant: "outline", children: /* @__PURE__ */ jsxs(Link, { href: kpiConfig.lowStock.href, children: [
703
+ /* @__PURE__ */ jsx(Package, { className: "size-4" }),
704
+ t("wms.backend.dashboard.quickActions.inventory", "Open inventory console")
705
+ ] }) }),
706
+ access.canAdjust ? /* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", onClick: () => setAdjustOpen(true), children: [
707
+ /* @__PURE__ */ jsx(SlidersHorizontal, { className: "size-4" }),
708
+ t("wms.backend.dashboard.quickActions.adjust", "Adjust inventory")
709
+ ] }) : null,
710
+ access.canCycleCount ? /* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", onClick: () => setCycleOpen(true), children: [
711
+ /* @__PURE__ */ jsx(ClipboardList, { className: "size-4" }),
712
+ t("wms.backend.dashboard.quickActions.cycleCount", "Cycle count")
713
+ ] }) : null,
714
+ /* @__PURE__ */ jsx(Button, { asChild: true, type: "button", variant: "outline", children: /* @__PURE__ */ jsx(Link, { href: movementsHref, children: t("wms.backend.dashboard.quickActions.movements", "View movements") }) })
715
+ ] })
716
+ ] })
717
+ ] }) : null
718
+ ] }),
719
+ access.canReceive ? /* @__PURE__ */ jsx(ReceiveInventoryDialog, { open: receiveOpen, onOpenChange: setReceiveOpen, access }) : null,
720
+ access.canAdjust ? /* @__PURE__ */ jsx(AdjustInventoryDialog, { open: adjustOpen, onOpenChange: setAdjustOpen, access }) : null,
721
+ access.canCycleCount ? /* @__PURE__ */ jsx(CycleCountWizardDialog, { open: cycleOpen, onOpenChange: setCycleOpen, access }) : null,
722
+ access.canAdjust && activeExpiryLot ? /* @__PURE__ */ jsxs(Fragment, { children: [
723
+ /* @__PURE__ */ jsx(
724
+ ChangeLotStatusDialog,
725
+ {
726
+ open: changeStatusOpen,
727
+ onOpenChange: setChangeStatusOpen,
728
+ access,
729
+ lotId: activeExpiryLot.id,
730
+ currentStatus: activeExpiryLot.status,
731
+ lotUpdatedAt: activeExpiryLot.updatedAt,
732
+ onSuccess: () => {
733
+ void dashboardQuery.refetch();
734
+ }
735
+ }
736
+ ),
737
+ /* @__PURE__ */ jsx(
738
+ MoveInventoryDialog,
739
+ {
740
+ open: moveOpen,
741
+ onOpenChange: setMoveOpen,
742
+ access,
743
+ initialCatalogVariantId: activeExpiryLot.catalogVariantId,
744
+ initialWarehouseId: warehouseId === "all" ? void 0 : warehouseId,
745
+ initialLotId: activeExpiryLot.id,
746
+ initialAvailable: activeExpiryLot.availableQuantity,
747
+ lockSourceContext: true
748
+ }
749
+ )
750
+ ] }) : null
751
+ ] });
752
+ }
753
+ export {
754
+ WmsOperationalDashboardPage as default,
755
+ resolveDashboardFirstRunMode
756
+ };
757
+ //# sourceMappingURL=WmsOperationalDashboardPage.js.map