feat(warehouses): make dashboard date range + warehouse filter real

Backs the previously-dead header date-picker and Filters button with
an actual scoped query. getDashboard() takes optional dateFrom/dateTo/
warehouseId: received (renamed from receivedToday) is the only
activity counter and respects the date range, defaulting to today when
omitted; the 10 status-backlog counters respect warehouseId only;
totalWarehouses/emptyContainers/importTrains/exportTrains stay global
since nothing ties them to a specific warehouse in the schema. Adds a
warehouse Select + date-range picker to the dashboard header, with a
caption spelling out what is and isn't scoped.
This commit is contained in:
Hagernesh
2026-08-20 13:29:37 +00:00
parent 572b42343f
commit 7f772efcb3
6 changed files with 155 additions and 57 deletions

View File

@@ -43,9 +43,20 @@ export class WarehousesController {
@Get('dashboard')
@BookingStaff(FREIGHT_PERMS.warehouseDashboard.view)
@ApiOperation({ summary: 'Warehouse dashboard metrics' })
dashboard() {
return this.dashboardService.getDashboard();
@ApiOperation({
summary: 'Warehouse dashboard metrics',
description:
'dateFrom/dateTo scope only the activity counters (currently just "received"); ' +
'status-backlog and fleet counters are always current. Omit both for "received today" ' +
'(the original default). warehouseId scopes every warehouse_inventory-derived counter; ' +
'totalWarehouses/emptyContainers/importTrains/exportTrains are never warehouse-scoped.',
})
dashboard(
@Query('dateFrom') dateFrom?: string,
@Query('dateTo') dateTo?: string,
@Query('warehouseId') warehouseId?: string,
) {
return this.dashboardService.getDashboard({ dateFrom, dateTo, warehouseId });
}
@Post()