included build filters to BuildOverview and ManageGW2Account
This commit is contained in:
parent
3d7d409646
commit
8afe8af4c5
3 changed files with 72 additions and 19 deletions
|
@ -13,7 +13,6 @@
|
||||||
<AuthorizeView Policy="@Constants.Roles.Admin" Context="authorizationContext">
|
<AuthorizeView Policy="@Constants.Roles.Admin" Context="authorizationContext">
|
||||||
<EditForm Model="@_build" OnValidSubmit="@HandleValidSubmit">
|
<EditForm Model="@_build" OnValidSubmit="@HandleValidSubmit">
|
||||||
<DataAnnotationsValidator />
|
<DataAnnotationsValidator />
|
||||||
<ValidationSummary />
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<label>
|
<label>
|
||||||
|
@ -69,7 +68,9 @@
|
||||||
</InputSelect>
|
</InputSelect>
|
||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
<button type="submit">Submit</button>
|
|
||||||
|
<ValidationSummary />
|
||||||
|
<button type="submit">Submit</button>
|
||||||
|
|
||||||
</EditForm>
|
</EditForm>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
|
@ -14,6 +14,17 @@
|
||||||
<span class="oi oi-plus" aria-hidden="true"></span> Add Build
|
<span class="oi oi-plus" aria-hidden="true"></span> Add Build
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
Filter:
|
||||||
|
<select @onchange="args => ChangeFilter(args)" >
|
||||||
|
<option value="All">All</option>
|
||||||
|
@foreach(GuildWars2Class gw2Class in Enum.GetValues(typeof(GuildWars2Class)))
|
||||||
|
{
|
||||||
|
<option value="@gw2Class">@gw2Class.ToString()</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -25,22 +36,21 @@
|
||||||
<th>Quick</th>
|
<th>Quick</th>
|
||||||
<th>Alac</th>
|
<th>Alac</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@foreach (var build in _buildsToShow.OrderBy(b => b.Class).ThenBy(b => b.EliteSpecialization))
|
||||||
@foreach (var build in _builds.OrderBy(b => b.Class).ThenBy(b => b.EliteSpecialization))
|
{
|
||||||
{
|
<tr>
|
||||||
<tr>
|
<td class="nav-item px-3">
|
||||||
<td class="nav-item px-3">
|
@{string navLink = $"buildedit/{@build.GuildWars2BuildId}";}
|
||||||
@{string navLink = $"buildedit/{@build.GuildWars2BuildId}";}
|
<NavLink class="nav-link" href="@navLink">@build.BuildName</NavLink>
|
||||||
<NavLink class="nav-link" href="@navLink">@build.BuildName</NavLink>
|
</td>
|
||||||
</td>
|
<td>@build.Class.ToString()</td>
|
||||||
<td>@build.Class.ToString()</td>
|
<td>@build.EliteSpecialization.ToString()</td>
|
||||||
<td>@build.EliteSpecialization.ToString()</td>
|
<td><input type="checkbox" checked="@(build.Might > 0)" disabled="disabled" /></td>
|
||||||
<td><input type="checkbox" checked="@(build.Might > 0)" disabled="disabled" /></td>
|
<td><input type="checkbox" checked="@(build.Heal > 0)" disabled="disabled" /></td>
|
||||||
<td><input type="checkbox" checked="@(build.Heal > 0)" disabled="disabled" /></td>
|
<td><input type="checkbox" checked="@(build.Quickness > 0)" disabled="disabled" /></td>
|
||||||
<td><input type="checkbox" checked="@(build.Quickness > 0)" disabled="disabled" /></td>
|
<td><input type="checkbox" checked="@(build.Alacrity > 0)" disabled="disabled" /></td>
|
||||||
<td><input type="checkbox" checked="@(build.Alacrity > 0)" disabled="disabled" /></td>
|
</tr>
|
||||||
</tr>
|
}
|
||||||
}
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</Authorized>
|
</Authorized>
|
||||||
|
@ -49,9 +59,23 @@
|
||||||
@code
|
@code
|
||||||
{
|
{
|
||||||
private List<GuildWars2Build> _builds;
|
private List<GuildWars2Build> _builds;
|
||||||
|
private List<GuildWars2Build> _buildsToShow;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
_builds = GuildWars2BuildService.GetBuilds();
|
_builds = GuildWars2BuildService.GetBuilds();
|
||||||
|
_buildsToShow = _builds;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ChangeFilter( ChangeEventArgs e)
|
||||||
|
{
|
||||||
|
if(Enum.TryParse<GuildWars2Class>(e.Value?.ToString(),out GuildWars2Class selectedClass))
|
||||||
|
{
|
||||||
|
_buildsToShow = _builds.Where(b => b.Class == selectedClass).ToList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_buildsToShow = _builds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,16 @@
|
||||||
@if (_account.GuildWars2AccountId != 0)
|
@if (_account.GuildWars2AccountId != 0)
|
||||||
{
|
{
|
||||||
<br />
|
<br />
|
||||||
|
<label>
|
||||||
|
Filter:
|
||||||
|
<select @onchange="args => ChangeBuildFilter(args)" >
|
||||||
|
<option value="All">All</option>
|
||||||
|
@foreach(GuildWars2Class gw2Class in Enum.GetValues(typeof(GuildWars2Class)))
|
||||||
|
{
|
||||||
|
<option value="@gw2Class">@gw2Class.ToString()</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Equipped</th>
|
<th>Equipped</th>
|
||||||
|
@ -54,7 +64,7 @@
|
||||||
<th>Quick</th>
|
<th>Quick</th>
|
||||||
<th>Alac</th>
|
<th>Alac</th>
|
||||||
</tr>
|
</tr>
|
||||||
@foreach (GuildWars2Build build in GuildWars2BuildService.GetBuilds())
|
@foreach (GuildWars2Build build in _buildsToShow.OrderBy(b => b.Class).ThenBy(b => b.EliteSpecialization))
|
||||||
{
|
{
|
||||||
Equipped? equippedBuild = _account.EquippedBuilds.FirstOrDefault(e => e.GuildWars2BuildId == build.GuildWars2BuildId);
|
Equipped? equippedBuild = _account.EquippedBuilds.FirstOrDefault(e => e.GuildWars2BuildId == build.GuildWars2BuildId);
|
||||||
bool isEquipped = equippedBuild != null;
|
bool isEquipped = equippedBuild != null;
|
||||||
|
@ -97,6 +107,10 @@
|
||||||
|
|
||||||
private string _saveMessage = string.Empty;
|
private string _saveMessage = string.Empty;
|
||||||
|
|
||||||
|
private List<GuildWars2Build> _builds;
|
||||||
|
|
||||||
|
private List<GuildWars2Build> _buildsToShow;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||||
|
@ -111,6 +125,8 @@
|
||||||
{
|
{
|
||||||
_account = new GuildWars2Account();
|
_account = new GuildWars2Account();
|
||||||
}
|
}
|
||||||
|
_builds = GuildWars2BuildService.GetBuilds();
|
||||||
|
_buildsToShow = _builds;
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task EquippedStatusChanged(int buildId, ChangeEventArgs args)
|
async Task EquippedStatusChanged(int buildId, ChangeEventArgs args)
|
||||||
|
@ -149,4 +165,16 @@
|
||||||
_account = GuildWars2AccountService.GetAccount(_account.GuildWars2AccountId);
|
_account = GuildWars2AccountService.GetAccount(_account.GuildWars2AccountId);
|
||||||
_saveMessage = "changes saved successfully";
|
_saveMessage = "changes saved successfully";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ChangeBuildFilter( ChangeEventArgs e)
|
||||||
|
{
|
||||||
|
if(Enum.TryParse<GuildWars2Class>(e.Value?.ToString(),out GuildWars2Class selectedClass))
|
||||||
|
{
|
||||||
|
_buildsToShow = _builds.Where(b => b.Class == selectedClass).ToList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_buildsToShow = _builds;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue