feat: tanks table ready

This commit is contained in:
Mikhail Shabanov committed 2021-07-15 22:14:41 +02:00
1 parent 3093b5ce38
commit 08946996a5
8 files changed
+340 -72

No files matched your search

@@ -1,19 +1,67 @@
@using WotBlitzStatisticsPro.Blazor.Helpers
@inject TooltipService TooltipService
@inject IStringLocalizer<App> Localize
@inherits PlayerInfoTanksListBase;
<div class="row">
<div class="col-lg-2 col-md-2">
<RadzenDropDown @bind-Value="@FilteredTiers" Multiple="true" TextProperty="ItemName" ValueProperty="ItemId" Style="width: 100%"
AllowClear="false"
Change=@OnFilterChange
Placeholder="@Localize["Filter tier..."]"
Data="@TierFilter"/>
</div>
<div class="col-lg-2 col-md-2">
<RadzenDropDown @bind-Value="@FilteredTankTypes" Multiple="true" TextProperty="ItemName" ValueProperty="ItemId" Style="width: 100%"
AllowClear="false"
Change=@OnFilterChange
Placeholder="@Localize["Filter tank types..."]"
Data="@TankTypesFilter">
<Template Context="data">
<RadzenImage Path="@data.ItemName" style="width: 24px; height: 24px;" />
</Template>
</RadzenDropDown>
</div>
<div class="col-lg-2 col-md-2">
<RadzenCheckBox @bind-Value=@FilterIsPremium TriState="true" TValue="bool?" Change=@(args => OnFilterChange(args)) /><RadzenLabel Text="@Localize["Premium tanks"]" Style="margin-left: 5px" Component="CheckBox" />
</div>
<div class="col-lg-2 col-md-2">
<RadzenDropDown @bind-Value="@FilteredNations" Multiple="true" TextProperty="ItemName" ValueProperty="ItemId" Style="width: 100%"
AllowClear="false"
Change=@OnFilterChange
Placeholder="@Localize["Filter nations..."]"
Data="@NationsFilter">
<Template Context="data">
<RadzenImage Path="@data.ItemName" style="width: 35px; height: 23px; border-radius: 4px;" />
</Template>
</RadzenDropDown>
</div>
<div class="col-lg-2 col-md-2">
<RadzenDropDown @bind-Value="@FilteredMastery" Multiple="true" TextProperty="ItemName" ValueProperty="ItemId" Style="width: 100%"
AllowClear="false"
Change=@OnFilterChange
Placeholder="@Localize["Filter mark of mastery..."]"
Data="@MasteryFilter">
<Template Context="data">
<RadzenImage Path="@data.ItemName" style="width: 24px; height: 24px;" />
</Template>
</RadzenDropDown>
</div>
<div class="col-lg-2 col-md-2">
<RadzenNumeric TValue="int?" @bind-Value=@MinBattles Placeholder="@Localize["Min battles"]" Change=@(args => OnFilterChange(args)) />
</div>
</div>
<RadzenDataGrid AllowFiltering="true"
AllowColumnResize="true"
FilterMode="FilterMode.Advanced"
FilterMode="FilterMode.Simple"
PageSize="10"
AllowPaging="true"
AllowSorting="true"
Data="@TanksList"
Data="@FilteredTankList"
TItem="ITank"
ColumnWidth="300px"
LogicalFilterOperator="LogicalFilterOperator.Or">
LogicalFilterOperator="LogicalFilterOperator.Or"
@ref="TanksGrid">
<Columns>
<RadzenDataGridColumn TItem="ITank" Property="Tier" Filterable="false" Sortable="true" Title="" Frozen="true" Width="34px" TextAlign="TextAlign.Center">
<RadzenDataGridColumn TItem="ITank" Property="Tier" Sortable="true" Filterable="false" Title="" Frozen="true" Width="34px" TextAlign="TextAlign.Center">
<Template Context="data">
<b>@data.Tier.RomanNumber()</b>
</Template>
@@ -38,8 +86,16 @@
<RadzenImage Path="@data.PreviewImage" style="width: 50px; height: 40px; border-radius: 8px;" />
</Template>
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="ITank" Property="Name" Filterable="false" Sortable="true" Title="@Localize["Tank"]" Frozen="true" Width="100px" TextAlign="TextAlign.Left" />
<RadzenDataGridColumn TItem="ITank" Property="Battles" Filterable="false" Sortable="true" Title="⚔" Frozen="false" Width="70px" TextAlign="TextAlign.Center" />
<RadzenDataGridColumn TItem="ITank" Property="Name" Filterable="false" Sortable="true" Title="@Localize["Tank"]" Frozen="true" Width="100px" TextAlign="TextAlign.Left">
<FooterTemplate>
@Localize["Tanks"]: <b>@TanksGrid.View.Count()</b> @Localize["of"] <b>@TanksList.Count()</b>
</FooterTemplate>
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="ITank" Property="Battles" Filterable="false" Sortable="true" Title="⚔" Frozen="false" Width="70px" TextAlign="TextAlign.Center">
<FooterTemplate>
<b>@TotalBattles.ToString("N0")</b>
</FooterTemplate>
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="ITank" Property="WinRate"
Filterable="false"
Sortable="true"
@@ -51,6 +107,10 @@
@data.WinRate.ToString("N0")%
<div style="background-color: @data.WinRate.ScaleColor(); width: 100%; height: 5px; margin-left: 2px; margin-right: 2px;"></div>
</Template>
<FooterTemplate>
<b>∼@AvgWinRate%</b>
<div style="background-color: @AvgWinRate.ScaleColor(); width: 100%; height: 5px; margin-left: 2px; margin-right: 2px;"></div>
</FooterTemplate>
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="ITank" Property="Wn7"
Filterable="false"
@@ -64,39 +124,55 @@
@data.Wn7.ToString("N0")
<div style="background-color: @data.Wn7.Wn7ScaleColor(); width: 100%; height: 5px; margin-left: 2px; margin-right: 2px;"></div>
</Template>
<FooterTemplate>
<b>∼@AvgWn7.ToString("N0")%</b>
<div style="background-color: @AvgWn7.Wn7ScaleColor(); width: 100%; height: 5px; margin-left: 2px; margin-right: 2px;"></div>
</FooterTemplate>
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="ITank" Property="AvgDamage"
Filterable="false"
Sortable="true"
Title="💣"
Frozen="false"
Width="80px"
TextAlign="TextAlign.Center"
FormatString="{0:N0}">
<FooterTemplate>
<b>∼@AvgTotalDamage.ToString("N0")</b>
</FooterTemplate>
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="ITank" Property="AvgXp"
Filterable="false"
Sortable="true"
Title="⭐"
Frozen="false"
Width="80px"
TextAlign="TextAlign.Center"
FormatString="{0:N0}">
<FooterTemplate>
<b>∼@AvgTotalXp.ToString("N0")</b>
</FooterTemplate>
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="ITank" Property="AvgDamage"
Filterable="false"
Sortable="true"
Title="💣"
Frozen="false"
Width="50px"
TextAlign="TextAlign.Center"
FormatString="{0:N0}"/>
<RadzenDataGridColumn TItem="ITank" Property="AvgXp"
Filterable="false"
Sortable="true"
Title="⭐"
Frozen="false"
Width="50px"
TextAlign="TextAlign.Center"
FormatString="{0:N0}"/>
<RadzenDataGridColumn TItem="ITank" Property="MaxXp"
Filterable="false"
Sortable="true"
Title="🌟"
Frozen="false"
Width="50px"
Width="80px"
TextAlign="TextAlign.Center"
FormatString="{0:N0}"/>
<RadzenDataGridColumn TItem="ITank" Property="SurvivalRate"
Filterable="false"
Sortable="true"
Title="⚰"
Frozen="false"
Width="50px"
<RadzenDataGridColumn TItem="ITank" Property="SurvivalRate"
Filterable="false"
Sortable="true"
Title="⚰"
Frozen="false"
Width="50px"
TextAlign="TextAlign.Center"
FormatString="{0:N0}%"/>
FormatString="{0:N0}%">
<FooterTemplate>
<b>∼@AvgSurvivalRate.ToString("N0")%</b>
</FooterTemplate>
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="ITank" Property="LastBattleTime"
Filterable="false"
Sortable="true"
@@ -108,18 +184,3 @@
SortOrder="SortOrder.Descending"/>
</Columns>
</RadzenDataGrid>
@code {
[Parameter]
public IEnumerable<ITank> TanksList { get; set; }
void ShowTooltip(ElementReference elementReference, string message, TooltipOptions options = null) => TooltipService.Open(elementReference, message, options);
void OnChange()
{
// Filter - dropdown with multiselect
// https://blazor.radzen.com/datagrid-filter-template
// TanksList = TanksList.Where(e => currentTOC >= 0 ? e.TitleOfCourtesy == currentTOC : true);
}
}