feat(dashboard): add date filter and stat groups components
- Implemented DashboardDateFilter component for selecting date ranges. - Created DashboardStatGroups component to display various dashboard statistics. - Added dashboard chart data processing logic to support new chart specifications. - Introduced reusable Chart components for rendering different types of charts.
This commit is contained in:
@@ -12,12 +12,25 @@ namespace ERPCore.Controllers;
|
||||
public sealed class DashboardController : ApiControllerBase
|
||||
{
|
||||
private readonly IDashboardService _dashboard;
|
||||
private readonly IDashboardChartsService _charts;
|
||||
|
||||
public DashboardController(IDashboardService dashboard) => _dashboard = dashboard;
|
||||
public DashboardController(IDashboardService dashboard, IDashboardChartsService charts)
|
||||
{
|
||||
_dashboard = dashboard;
|
||||
_charts = charts;
|
||||
}
|
||||
|
||||
/// <summary>Aggregate counts for stock, GRN, and procurement.</summary>
|
||||
/// <summary>Aggregate counts for stock, GRN, procurement, sales, accounts, service, production and HR.</summary>
|
||||
[HttpGet("stats")]
|
||||
[ProducesResponseType(typeof(DashboardStatsDto), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<DashboardStatsDto>> GetStats([FromQuery] int? branchId, CancellationToken ct)
|
||||
=> Ok(await _dashboard.GetStatsAsync(branchId, ct));
|
||||
public async Task<ActionResult<DashboardStatsDto>> GetStats(
|
||||
[FromQuery] int? branchId, [FromQuery] DateOnly? from, [FromQuery] DateOnly? to, CancellationToken ct)
|
||||
=> Ok(await _dashboard.GetStatsAsync(branchId, from, to, ct));
|
||||
|
||||
/// <summary>Datasets for the dashboard graphs; the time-based ones follow the optional from / to period.</summary>
|
||||
[HttpGet("charts")]
|
||||
[ProducesResponseType(typeof(DashboardChartsDto), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<DashboardChartsDto>> GetCharts(
|
||||
[FromQuery] int? branchId, [FromQuery] DateOnly? from, [FromQuery] DateOnly? to, CancellationToken ct)
|
||||
=> Ok(await _charts.GetChartsAsync(branchId, from, to, ct));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user