Refactor prospect filtering and sorting components; remove obsolete ProspectFilterControl and enhance ProspectSortControl with filtering capabilities.
All checks were successful
Build And Push Dev Docker Image / docker (push) Successful in 1m31s
All checks were successful
Build And Push Dev Docker Image / docker (push) Successful in 1m31s
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Blazorise;
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using FoodsharingSiegen.Contracts.Enums;
|
||||
using FoodsharingSiegen.Contracts.Model;
|
||||
using FoodsharingSiegen.Server.Data.Service;
|
||||
using FoodsharingSiegen.Server.Dialogs;
|
||||
using FoodsharingSiegen.Server.Service;
|
||||
@@ -26,6 +27,10 @@ public partial class ProspectSortControl
|
||||
[Parameter]
|
||||
public string? StorageKey { get; set; }
|
||||
|
||||
[Parameter] public ProspectFilter Filter { get; set; } = new();
|
||||
[Parameter] public EventCallback<ProspectFilter> FilterChanged { get; set; }
|
||||
[Parameter] public ProspectStateFilter StateFilter { get; set; } = ProspectStateFilter.All;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(StorageKey))
|
||||
@@ -48,6 +53,35 @@ public partial class ProspectSortControl
|
||||
});
|
||||
}
|
||||
|
||||
private async Task OpenFilterDialogAsync()
|
||||
{
|
||||
await ProspectFilterDialog.ShowAsync(ModalService, Filter, StateFilter, async (f) =>
|
||||
{
|
||||
Filter = f;
|
||||
await FilterChanged.InvokeAsync(Filter);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
});
|
||||
}
|
||||
|
||||
private async Task TextChangedAsync(string text)
|
||||
{
|
||||
Filter.Text = text;
|
||||
await FilterChanged.InvokeAsync(Filter);
|
||||
}
|
||||
|
||||
private async Task DisableFilterAsync(string filterPropName)
|
||||
{
|
||||
switch (filterPropName)
|
||||
{
|
||||
case nameof(Filter.WithoutStepInBriefing): Filter.WithoutStepInBriefing = false; break;
|
||||
case nameof(Filter.WithoutIdCheck): Filter.WithoutIdCheck = false; break;
|
||||
case nameof(Filter.RecentActivity): Filter.RecentActivity = false; break;
|
||||
case nameof(Filter.NoActivity): Filter.NoActivity = false; break;
|
||||
case nameof(Filter.DeletedOnly): Filter.DeletedOnly = false; break;
|
||||
}
|
||||
await FilterChanged.InvokeAsync(Filter);
|
||||
}
|
||||
|
||||
private bool HasCustomSort => CurrentSort != ProspectSortOption.NameAscending;
|
||||
|
||||
private string CurrentSortText => CurrentSort switch
|
||||
|
||||
Reference in New Issue
Block a user