-
Notifications
You must be signed in to change notification settings - Fork 3
/
Index.razor
77 lines (74 loc) · 3.05 KB
/
Index.razor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
@page "/"
@inject SaleInfoService SaleInfoService
@if(salesData == null) {
<LoadingPanel />
} else {
<DxLayoutBreakpoint MaxWidth="779" @bind-IsActive="@isSmallScreen" />
<DxLayoutBreakpoint MinWidth="780" MaxWidth="1199" @bind-IsActive="@isMediumScreen" />
<div class="p-3 w-100 h-100 overflow-auto">
<DxGridLayout ColumnSpacing="1rem" RowSpacing="1rem">
<Rows>
@if(isLargeScreen) {
<DxGridLayoutRow Areas="salesDataTable salesByCountry salesInUS" Height="508px" />
<DxGridLayoutRow Areas="salesByCity salesByCity salesByCity" />
}
@if(isMediumScreen) {
<DxGridLayoutRow Areas="salesDataTable salesByCountry" Height="250px" />
<DxGridLayoutRow Areas="salesDataTable salesInUS" Height="250px" />
<DxGridLayoutRow Areas="salesByCity salesByCity" Height="1fr" />
}
@if(isSmallScreen) {
<DxGridLayoutRow Areas="salesDataTable" Height="auto" />
<DxGridLayoutRow Areas="salesByCity" Height="auto" />
<DxGridLayoutRow Areas="salesByCountry" Height="auto" />
<DxGridLayoutRow Areas="salesInUS" Height="auto" />
}
</Rows>
<Columns>
@if(isLargeScreen) {
<DxGridLayoutColumn />
<DxGridLayoutColumn />
<DxGridLayoutColumn />
}
@if(isMediumScreen) {
<DxGridLayoutColumn />
<DxGridLayoutColumn />
}
@if(isSmallScreen) {
<DxGridLayoutColumn />
}
</Columns>
<Items>
<DxGridLayoutItem Area="salesDataTable">
<Template>
<SalesDataGrid Sales="salesData" />
</Template>
</DxGridLayoutItem>
<DxGridLayoutItem Area="salesByCountry">
<Template>
<SalesByCountryChart Sales="salesData" />
</Template>
</DxGridLayoutItem>
<DxGridLayoutItem Area="salesInUS">
<Template>
<SalesInUSChart Sales="salesData" />
</Template>
</DxGridLayoutItem>
<DxGridLayoutItem Area="salesByCity">
<Template>
<SalesByCityChart Sales="salesData" />
</Template>
</DxGridLayoutItem>
</Items>
</DxGridLayout>
</div>
}
@code {
System.Collections.ObjectModel.ObservableCollection<SaleInfo> salesData;
bool isSmallScreen;
bool isMediumScreen;
bool isLargeScreen => !(isSmallScreen || isMediumScreen);
protected override void OnInitialized() {
salesData = new System.Collections.ObjectModel.ObservableCollection<SaleInfo>(SaleInfoService.GetSaleInfos());
}
}