Skip to content

Commit

Permalink
WatchList.MudBlazor - Change route page "WatchCinemaTable" and add Fu…
Browse files Browse the repository at this point in the history
…nc in MudSelects.
  • Loading branch information
Stan-Kudri committed Oct 22, 2024
1 parent e496943 commit 69b8086
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
3 changes: 0 additions & 3 deletions WatchList.MudBlazors/Pages/Home.razor

This file was deleted.

6 changes: 3 additions & 3 deletions WatchList.MudBlazors/Pages/WatchCinemaTable.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@using WatchList.Core.Model.ItemCinema.Components
@using WatchList.Core.Model.Sortable

@page "/watchlist"
@page "/"

<MudText Style="text-align:center; font-size:16px; color:navy;" Class="mt-6">List Cinema</MudText>

Expand Down Expand Up @@ -46,7 +46,7 @@

<div style="align-items:end; width:250px">
<MudSelect T="TypeCinema" Label="Type cinema" MultiSelection="true" @bind-SelectedValues="FilterWatchItem.FilterTypeField"
SelectAll="true" SelectAllText="All type" OnClose="@LoadData" Class="mr-1">
SelectAll="true" SelectAllText="All type" OnClose="@LoadData" Class="mr-1" MultiSelectionTextFunc="@(new Func<List<string>, string>(GetMultiSelectionTypeCinema))">
@foreach (var item in FilterWatchItem.TypeItems)
{
<MudSelectItem T="TypeCinema" Value="@item" />
Expand All @@ -56,7 +56,7 @@

<div style="align-items:end; width:300px">
<MudSelect T="StatusCinema" Label="Status" MultiSelection="true" @bind-SelectedValues="FilterWatchItem.FilterStatusField"
SelectAll="true" SelectAllText="All status" OnClose="@LoadData" Class="mr-1">
SelectAll="true" SelectAllText="All status" OnClose="@LoadData" Class="mr-1" MultiSelectionTextFunc="@(new Func<List<string>, string>(GetMultiSelectionStatusCinema))">
@foreach (var item in FilterWatchItem.StatusItems)
{
<MudSelectItem T="StatusCinema" Value="@item" />
Expand Down
11 changes: 11 additions & 0 deletions WatchList.MudBlazors/Pages/WatchCinemaTable.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using MudBlazor;
using WatchList.Core.Model.Filter;
using WatchList.Core.Model.ItemCinema;
using WatchList.Core.Model.ItemCinema.Components;
using WatchList.Core.Model.Sortable;
using WatchList.Core.PageItem;
using WatchList.Core.Service;
Expand Down Expand Up @@ -120,6 +121,16 @@ private void PageChanged(int i)
LoadData();
}

private string GetMultiSelectionTypeCinema(List<string> selectedValues)
=> selectedValues.Count == TypeCinema.List.Count
? "All type"
: string.Join(',', selectedValues);

private string GetMultiSelectionStatusCinema(List<string> selectedValues)
=> selectedValues.Count == StatusCinema.List.Count
? "All status"
: string.Join(',', selectedValues);

public void OnToggledChanged(bool toggled)
{
_itemsSearchRequest.IsAscending = toggled;
Expand Down
3 changes: 1 addition & 2 deletions WatchList.MudBlazors/Shared/NavMenu.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<MudNavMenu>
<MudNavLink Href="" Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.Home">Home</MudNavLink>
<MudNavLink Href="/watchlist" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.LocalMovies">Movie List</MudNavLink>
<MudNavLink Href="/" Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.LocalMovies">Movie List</MudNavLink>
</MudNavMenu>

0 comments on commit 69b8086

Please sign in to comment.