diff --git a/Lieb/Pages/Raids/RaidEdit/RaidTemplateEdit.razor b/Lieb/Pages/Raids/RaidEdit/RaidTemplateEdit.razor index ee92287..70bb4fb 100644 --- a/Lieb/Pages/Raids/RaidEdit/RaidTemplateEdit.razor +++ b/Lieb/Pages/Raids/RaidEdit/RaidTemplateEdit.razor @@ -16,7 +16,7 @@ @inject IJSRuntime JsRuntime -

CreateRaid

+

Create or edit Template

@@ -81,7 +81,7 @@

RaidTemplateOverview

+

Event Templates

- + -@foreach (var raid in _templates.OrderBy(r => r.StartTime)) +
+ + + + + +
+ +@foreach (var raid in _templatesToShow.OrderBy(r => r.StartTime)) {
@@ -29,6 +53,9 @@ { private List _templates; private LiebUser? _user; + private string _filterRole = string.Empty; + private string _filterEventType = string.Empty; + private List _templatesToShow; protected override async Task OnInitializedAsync() { @@ -40,5 +67,38 @@ ulong discordId = ulong.Parse(authState.User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value); _user = UserService.GetLiebUser(discordId); } + ApplyFilter(); + } + + private void GroupFilterChanged(ChangeEventArgs e) + { + _filterRole = e.Value?.ToString(); + ApplyFilter(); + } + + private void EventTypeFilterChanged(ChangeEventArgs e) + { + _filterEventType = e.Value?.ToString(); + ApplyFilter(); + } + + private void ApplyFilter() + { + if(String.IsNullOrEmpty(_filterRole)) + { + _templatesToShow = _templates; + } + else if(_filterRole == "No Group") + { + _templatesToShow = _templates.Where(r => string.IsNullOrEmpty(r.RequiredRole)).ToList(); + } + else + { + _templatesToShow = _templates.Where(r => r.RequiredRole == _filterRole).ToList(); + } + if(!String.IsNullOrEmpty(_filterEventType)) + { + _templatesToShow = _templatesToShow.Where(r => r.EventType.ToString() == _filterEventType).ToList(); + } } } diff --git a/Lieb/Shared/NavMenu.razor b/Lieb/Shared/NavMenu.razor index e28443a..7952c5b 100644 --- a/Lieb/Shared/NavMenu.razor +++ b/Lieb/Shared/NavMenu.razor @@ -36,7 +36,7 @@