Update Filter Behaviour
This commit is contained in:
@@ -9,5 +9,7 @@
|
|||||||
public bool WithoutIdCheck { get; set; }
|
public bool WithoutIdCheck { get; set; }
|
||||||
|
|
||||||
public bool NoActivity { get; set; }
|
public bool NoActivity { get; set; }
|
||||||
|
|
||||||
|
public bool DeletedOnly { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,6 +33,12 @@
|
|||||||
await FilterChanged.InvokeAsync(Filter);
|
await FilterChanged.InvokeAsync(Filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task DeletedOnlyChangedAsync(bool arg)
|
||||||
|
{
|
||||||
|
Filter.DeletedOnly = arg;
|
||||||
|
await FilterChanged.InvokeAsync(Filter);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
@@ -40,24 +46,39 @@
|
|||||||
<i class="fa-solid fa-filter"></i> Suchfilter
|
<i class="fa-solid fa-filter"></i> Suchfilter
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body" style="padding: .5rem;">
|
<div class="card-body" style="padding: .5rem;">
|
||||||
@if (StateFilter is ProspectStateFilter.OnBoarding or ProspectStateFilter.All)
|
|
||||||
|
@* WITHOUT STEP IN BRIEFING *@
|
||||||
|
@if (new[] { ProspectStateFilter.All, ProspectStateFilter.OnBoarding, ProspectStateFilter.Completed }.Contains(StateFilter))
|
||||||
{
|
{
|
||||||
<div style="margin-left: 1rem;">
|
<div style="margin-left: 1rem;">
|
||||||
<Switch TValue="bool" Checked="Filter.WithoutStepInBriefing" CheckedChanged="WithoutStepInBriefingChangedAsync">Ohne @AppSettings.Terms.StepInName</Switch>
|
<Switch TValue="bool" Checked="Filter.WithoutStepInBriefing" CheckedChanged="WithoutStepInBriefingChangedAsync">Ohne @AppSettings.Terms.StepInName</Switch>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (StateFilter is ProspectStateFilter.Verification or ProspectStateFilter.All)
|
|
||||||
|
@* WITHOUT ID CHECK *@
|
||||||
|
@if (new[] { ProspectStateFilter.All, ProspectStateFilter.Verification, ProspectStateFilter.Completed }.Contains(StateFilter))
|
||||||
{
|
{
|
||||||
<div style="margin-left: 1rem;">
|
<div style="margin-left: 1rem;">
|
||||||
<Switch TValue="bool" Checked="Filter.WithoutIdCheck" CheckedChanged="WithoutIdCheckChangedAsync">Perso noch nicht geprüft</Switch>
|
<Switch TValue="bool" Checked="Filter.WithoutIdCheck" CheckedChanged="WithoutIdCheckChangedAsync">Perso noch nicht geprüft</Switch>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (StateFilter is ProspectStateFilter.OnBoarding or ProspectStateFilter.Verification or ProspectStateFilter.All)
|
|
||||||
|
@* NO ACTIVITY *@
|
||||||
|
@if (new[] { ProspectStateFilter.All, ProspectStateFilter.OnBoarding, ProspectStateFilter.Verification }.Contains(StateFilter))
|
||||||
{
|
{
|
||||||
<div style="margin-left: 1rem;">
|
<div style="margin-left: 1rem;">
|
||||||
<Switch TValue="bool" Checked="Filter.NoActivity" CheckedChanged="NoActivityChangedAsync">Lange keine Aktivität (6 Monate)</Switch>
|
<Switch TValue="bool" Checked="Filter.NoActivity" CheckedChanged="NoActivityChangedAsync">Lange keine Aktivität (6 Monate)</Switch>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<TextEdit Text="@Filter.Text" TextChanged="TextChanged" Placeholder="Suchen..." Debounce="true" DebounceInterval="150"/>
|
|
||||||
|
@* DELETED ONLY *@
|
||||||
|
@if (new[] { ProspectStateFilter.All }.Contains(StateFilter))
|
||||||
|
{
|
||||||
|
<div style="margin-left: 1rem;">
|
||||||
|
<Switch TValue="bool" Checked="Filter.DeletedOnly" CheckedChanged="DeletedOnlyChangedAsync">Gelöschte</Switch>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<TextEdit Text="@Filter.Text" TextChanged="TextChanged" Placeholder="Suchen..." Debounce="true" DebounceInterval="200"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -32,20 +32,21 @@ namespace FoodsharingSiegen.Shared.Helper
|
|||||||
(!string.IsNullOrWhiteSpace(x.Memo) && x.Memo.Contains(filter.Text, StringComparison.OrdinalIgnoreCase) == true) ||
|
(!string.IsNullOrWhiteSpace(x.Memo) && x.Memo.Contains(filter.Text, StringComparison.OrdinalIgnoreCase) == true) ||
|
||||||
x.FsId.ToString().Contains(filter.Text, StringComparison.OrdinalIgnoreCase)).AsQueryable();
|
x.FsId.ToString().Contains(filter.Text, StringComparison.OrdinalIgnoreCase)).AsQueryable();
|
||||||
|
|
||||||
|
// Show only prospect with missing StepIn Briefing
|
||||||
if (filter.WithoutStepInBriefing)
|
if (filter.WithoutStepInBriefing)
|
||||||
filterListQ = filterListQ.Where(x => x.Interactions.All(i => i.Type != InteractionType.StepInBriefing));
|
filterListQ = filterListQ.Where(x => x.Interactions.All(i => i.Type != InteractionType.StepInBriefing));
|
||||||
|
|
||||||
|
// Show only prospect with missing IdCheck
|
||||||
if (filter.WithoutIdCheck)
|
if (filter.WithoutIdCheck)
|
||||||
filterListQ = filterListQ.Where(x => x.Interactions.All(i => i.Type != InteractionType.IdCheck));
|
filterListQ = filterListQ.Where(x => x.Interactions.All(i => i.Type != InteractionType.IdCheck));
|
||||||
|
|
||||||
if (filter.NoActivity)
|
// Show only deleted prospects
|
||||||
{
|
if (filter.DeletedOnly)
|
||||||
var days = 180; // Half year
|
filterListQ = filterListQ.Where(x => x.RecordState == RecordState.Deleted);
|
||||||
Func<Prospect, bool> q1 = x => x.Interactions.Any() && x.Interactions.All(i => DateTime.Now - i.Date > TimeSpan.FromDays(days));
|
|
||||||
Func<Prospect, bool> 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();
|
return filterListQ.ToList();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user