Files
CartriX/CartriX.Web/Pages/Dashboard.razor
T
2026-05-22 01:21:04 +09:00

46 lines
1.5 KiB
Plaintext

@page "/"
@page "/Dashboard"
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Administrator")]
@inject HttpClient httpClient
<RadzenCard Variant="Variant.Flat">
<RadzenStack>
<RadzenLabel />
<RadzenChart>
<RadzenAreaSeries Smooth="false"
Data="@dataPerPrinteds"
Interpolation="Interpolation.Spline"
CategoryProperty="DateString"
LineType="LineType.Solid"
ValueProperty="countPrinted"
Title="Страниц распечатано">
<RadzenCategoryAxis LabelRotation="45"/>
<RadzenLegend Visible="false"/>
<RadzenMarkers Visible="true" MarkerType="MarkerType.Auto"/>
<RadzenSeriesDataLabels Visible="@(dataPerPrinteds?.Any() ?? false)" />
</RadzenAreaSeries>
</RadzenChart>
</RadzenStack>
</RadzenCard>
@code {
List<DTOs.PrinterCounterRecord.noId>? dataPerPrinteds;
protected override async Task OnInitializedAsync()
{
var response = await httpClient.GetAsync(ApiRoutes.Report.GetReportToDatePerCountPrinted);
dataPerPrinteds = JsonConvert.DeserializeObject<List<DTOs.PrinterCounterRecord.noId>>(await response.Content.ReadAsStringAsync());
dataPerPrinteds = dataPerPrinteds?.OrderBy(x => x.date).ToList();
}
}