diff --git a/FoodsharingSiegen.Contracts/Model/ProspectFilter.cs b/FoodsharingSiegen.Contracts/Model/ProspectFilter.cs index 6b76034..212ef99 100644 --- a/FoodsharingSiegen.Contracts/Model/ProspectFilter.cs +++ b/FoodsharingSiegen.Contracts/Model/ProspectFilter.cs @@ -9,5 +9,7 @@ public bool WithoutIdCheck { get; set; } public bool NoActivity { get; set; } + + public bool DeletedOnly { get; set; } } } \ No newline at end of file diff --git a/FoodsharingSiegen.Server/Controls/ProspectFilterControl.razor b/FoodsharingSiegen.Server/Controls/ProspectFilterControl.razor index 5e53a5b..8f6d787 100644 --- a/FoodsharingSiegen.Server/Controls/ProspectFilterControl.razor +++ b/FoodsharingSiegen.Server/Controls/ProspectFilterControl.razor @@ -33,6 +33,12 @@ await FilterChanged.InvokeAsync(Filter); } + private async Task DeletedOnlyChangedAsync(bool arg) + { + Filter.DeletedOnly = arg; + await FilterChanged.InvokeAsync(Filter); + } + }
@@ -40,24 +46,39 @@ Suchfilter
- @if (StateFilter is ProspectStateFilter.OnBoarding or ProspectStateFilter.All) + + @* WITHOUT STEP IN BRIEFING *@ + @if (new[] { ProspectStateFilter.All, ProspectStateFilter.OnBoarding, ProspectStateFilter.Completed }.Contains(StateFilter)) {
Ohne @AppSettings.Terms.StepInName
} - @if (StateFilter is ProspectStateFilter.Verification or ProspectStateFilter.All) + + @* WITHOUT ID CHECK *@ + @if (new[] { ProspectStateFilter.All, ProspectStateFilter.Verification, ProspectStateFilter.Completed }.Contains(StateFilter)) {
Perso noch nicht geprüft
} - @if (StateFilter is ProspectStateFilter.OnBoarding or ProspectStateFilter.Verification or ProspectStateFilter.All) + + @* NO ACTIVITY *@ + @if (new[] { ProspectStateFilter.All, ProspectStateFilter.OnBoarding, ProspectStateFilter.Verification }.Contains(StateFilter)) {
Lange keine Aktivität (6 Monate)
} - + + @* DELETED ONLY *@ + @if (new[] { ProspectStateFilter.All }.Contains(StateFilter)) + { +
+ Gelöschte +
+ } + +
\ No newline at end of file diff --git a/FoodsharingSiegen.Shared/Helper/FilterHelper.cs b/FoodsharingSiegen.Shared/Helper/FilterHelper.cs index 78b8974..ab968ed 100644 --- a/FoodsharingSiegen.Shared/Helper/FilterHelper.cs +++ b/FoodsharingSiegen.Shared/Helper/FilterHelper.cs @@ -32,20 +32,21 @@ namespace FoodsharingSiegen.Shared.Helper (!string.IsNullOrWhiteSpace(x.Memo) && x.Memo.Contains(filter.Text, StringComparison.OrdinalIgnoreCase) == true) || x.FsId.ToString().Contains(filter.Text, StringComparison.OrdinalIgnoreCase)).AsQueryable(); + // Show only prospect with missing StepIn Briefing if (filter.WithoutStepInBriefing) filterListQ = filterListQ.Where(x => x.Interactions.All(i => i.Type != InteractionType.StepInBriefing)); + // Show only prospect with missing IdCheck if (filter.WithoutIdCheck) filterListQ = filterListQ.Where(x => x.Interactions.All(i => i.Type != InteractionType.IdCheck)); + + // Show only deleted prospects + if (filter.DeletedOnly) + filterListQ = filterListQ.Where(x => x.RecordState == RecordState.Deleted); - if (filter.NoActivity) - { - var days = 180; // Half year - Func q1 = x => x.Interactions.Any() && x.Interactions.All(i => DateTime.Now - i.Date > TimeSpan.FromDays(days)); - Func q2 = x => DateTime.Now - x.Created > TimeSpan.FromDays(days); - - filterListQ = filterListQ.Where(x => q1(x) && q2(x)); - } + // No Activity Filter + if (filter.NoActivity) + filterListQ = filterListQ.Where(x => DateTime.Now - x.Modified > TimeSpan.FromDays(180)); return filterListQ.ToList(); }