Prospect filter
This commit is contained in:
9
FoodsharingSiegen.Contracts/Model/ProspectFilter.cs
Normal file
9
FoodsharingSiegen.Contracts/Model/ProspectFilter.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace FoodsharingSiegen.Contracts.Model
|
||||
{
|
||||
public class ProspectFilter
|
||||
{
|
||||
public string? Text { get; set; }
|
||||
|
||||
public bool WithoutStepInBriefing { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
@using FoodsharingSiegen.Contracts.Model
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public ProspectFilter Filter { get; set; } = new();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<ProspectFilter> FilterChanged { get; set; }
|
||||
|
||||
|
||||
private async Task WithoutStepInBriefingChangedAsync(bool arg)
|
||||
{
|
||||
Filter.WithoutStepInBriefing = arg;
|
||||
await FilterChanged.InvokeAsync(Filter);
|
||||
}
|
||||
|
||||
private async Task TextChanged(string arg)
|
||||
{
|
||||
Filter.Text = arg;
|
||||
await FilterChanged.InvokeAsync(Filter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header" style="padding: .5rem;">
|
||||
<i class="fa-solid fa-filter"></i> Suchfilter
|
||||
</div>
|
||||
<div class="card-body" style="padding: .5rem;">
|
||||
<div style="margin-left: 1rem;">
|
||||
<Switch TValue="bool" Checked="Filter.WithoutStepInBriefing" CheckedChanged="WithoutStepInBriefingChangedAsync">Ohne Neulingstreffen</Switch>
|
||||
</div>
|
||||
<TextEdit Text="@Filter.Text" TextChanged="TextChanged" Placeholder="Suchen..." Debounce="true" DebounceInterval="150"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -11,21 +11,31 @@
|
||||
Color="Color.Primary"
|
||||
Clicked="() => ProspectModal.Show()"
|
||||
Visibility="@(CurrentUser.IsInGroup(UserGroup.WelcomeTeam, UserGroup.Ambassador) ? Visibility.Default : Visibility.Invisible)"
|
||||
>Hinzufügen</Button>
|
||||
>Hinzufügen
|
||||
</Button>
|
||||
|
||||
@{
|
||||
var filterList = ProspectList;
|
||||
if(!string.IsNullOrWhiteSpace(FilterText))
|
||||
filterList = filterList?.Where(x =>
|
||||
x.Name.Contains(FilterText, StringComparison.OrdinalIgnoreCase) ||
|
||||
x.Memo?.Contains(FilterText, StringComparison.OrdinalIgnoreCase) == true ||
|
||||
x.FsId.ToString().Contains(FilterText, StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
var filterListQ = ProspectList?.AsQueryable();
|
||||
if (!string.IsNullOrWhiteSpace(Filter.Text))
|
||||
{
|
||||
filterListQ = filterListQ?
|
||||
.Where(x =>
|
||||
x.Name.Contains(Filter.Text, StringComparison.OrdinalIgnoreCase) ||
|
||||
(!string.IsNullOrWhiteSpace(x.Memo) && x.Memo.Contains(Filter.Text, StringComparison.OrdinalIgnoreCase) == true) ||
|
||||
x.FsId.ToString().Contains(Filter.Text, StringComparison.OrdinalIgnoreCase)).AsQueryable();
|
||||
}
|
||||
|
||||
if (Filter.WithoutStepInBriefing)
|
||||
filterListQ = filterListQ?.Where(x => x.Interactions.All(i => i.Type != InteractionType.StepInBriefing));
|
||||
|
||||
var filterList = filterListQ?.ToList();
|
||||
}
|
||||
|
||||
<hr/>
|
||||
<ProspectFilterControl @bind-Filter="Filter"></ProspectFilterControl>
|
||||
<hr />
|
||||
<h5>@(filterList?.Count ?? 0) Einträge</h5>
|
||||
<TextEdit TextChanged="FilterText_Changed" Placeholder="Suchen..." Debounce="true" DebounceInterval="150" />
|
||||
|
||||
@if (filterList?.Any() == true)
|
||||
{
|
||||
<div class="row m-0">
|
||||
|
||||
@@ -29,10 +29,7 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the filter text (ab)
|
||||
/// </summary>
|
||||
private string? FilterText { get; set; }
|
||||
private ProspectFilter Filter { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the interaction modal (ab)
|
||||
@@ -72,19 +69,6 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Method FilterText_Changed
|
||||
|
||||
/// <summary>
|
||||
/// Filters the text changed using the specified filter text (a. beging, 08.02.2023)
|
||||
/// </summary>
|
||||
/// <param name="filterText">The filter text</param>
|
||||
private void FilterText_Changed(string filterText)
|
||||
{
|
||||
FilterText = filterText;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Method LoadProspects
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -6,18 +6,26 @@
|
||||
<h2>Abgeschlossene Einarbeitungen</h2>
|
||||
|
||||
@{
|
||||
var filterList = ProspectList;
|
||||
if(!string.IsNullOrWhiteSpace(FilterText))
|
||||
filterList = filterList?.Where(x =>
|
||||
x.Name.Contains(FilterText, StringComparison.OrdinalIgnoreCase) ||
|
||||
x.Memo?.Contains(FilterText, StringComparison.OrdinalIgnoreCase) == true ||
|
||||
x.FsId.ToString().Contains(FilterText, StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
var filterListQ = ProspectList?.AsQueryable();
|
||||
if (!string.IsNullOrWhiteSpace(Filter.Text))
|
||||
{
|
||||
filterListQ = filterListQ?
|
||||
.Where(x =>
|
||||
x.Name.Contains(Filter.Text, StringComparison.OrdinalIgnoreCase) ||
|
||||
(!string.IsNullOrWhiteSpace(x.Memo) && x.Memo.Contains(Filter.Text, StringComparison.OrdinalIgnoreCase) == true) ||
|
||||
x.FsId.ToString().Contains(Filter.Text, StringComparison.OrdinalIgnoreCase)).AsQueryable();
|
||||
}
|
||||
|
||||
if (Filter.WithoutStepInBriefing)
|
||||
filterListQ = filterListQ?.Where(x => x.Interactions.All(i => i.Type != InteractionType.StepInBriefing));
|
||||
|
||||
var filterList = filterListQ?.ToList();
|
||||
}
|
||||
|
||||
<hr />
|
||||
<ProspectFilterControl @bind-Filter="Filter"></ProspectFilterControl>
|
||||
<hr />
|
||||
<h5>@(filterList?.Count ?? 0) Einträge</h5>
|
||||
<TextEdit TextChanged="FilterText_Changed" Placeholder="Suchen..." Debounce="true" DebounceInterval="150" />
|
||||
@if (filterList?.Any() == true)
|
||||
{
|
||||
|
||||
|
||||
@@ -22,10 +22,7 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the filter text (ab)
|
||||
/// </summary>
|
||||
private string? FilterText { get; set; }
|
||||
private ProspectFilter Filter { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the prospect list (ab)
|
||||
@@ -44,19 +41,6 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Method FilterText_Changed
|
||||
|
||||
/// <summary>
|
||||
/// Filters the text changed using the specified filter text (a. beging, 08.02.2023)
|
||||
/// </summary>
|
||||
/// <param name="filterText">The filter text</param>
|
||||
private void FilterText_Changed(string filterText)
|
||||
{
|
||||
FilterText = filterText;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Method LoadProspects
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -7,18 +7,26 @@
|
||||
<h2>Freischalten</h2>
|
||||
|
||||
@{
|
||||
var filterList = ProspectList;
|
||||
if(!string.IsNullOrWhiteSpace(FilterText))
|
||||
filterList = filterList?.Where(x =>
|
||||
x.Name.Contains(FilterText, StringComparison.OrdinalIgnoreCase) ||
|
||||
x.Memo?.Contains(FilterText, StringComparison.OrdinalIgnoreCase) == true ||
|
||||
x.FsId.ToString().Contains(FilterText, StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
var filterListQ = ProspectList?.AsQueryable();
|
||||
if (!string.IsNullOrWhiteSpace(Filter.Text))
|
||||
{
|
||||
filterListQ = filterListQ?
|
||||
.Where(x =>
|
||||
x.Name.Contains(Filter.Text, StringComparison.OrdinalIgnoreCase) ||
|
||||
(!string.IsNullOrWhiteSpace(x.Memo) && x.Memo.Contains(Filter.Text, StringComparison.OrdinalIgnoreCase) == true) ||
|
||||
x.FsId.ToString().Contains(Filter.Text, StringComparison.OrdinalIgnoreCase)).AsQueryable();
|
||||
}
|
||||
|
||||
if (Filter.WithoutStepInBriefing)
|
||||
filterListQ = filterListQ?.Where(x => x.Interactions.All(i => i.Type != InteractionType.StepInBriefing));
|
||||
|
||||
var filterList = filterListQ?.ToList();
|
||||
}
|
||||
|
||||
<hr/>
|
||||
<ProspectFilterControl @bind-Filter="Filter"></ProspectFilterControl>
|
||||
<hr />
|
||||
<h5>@(filterList?.Count ?? 0) Einträge</h5>
|
||||
<TextEdit TextChanged="FilterText_Changed" Placeholder="Suchen..." Debounce="true" DebounceInterval="150" />
|
||||
@if (filterList?.Any() == true)
|
||||
{
|
||||
<div class="row m-0">
|
||||
|
||||
@@ -29,10 +29,7 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the filter text (ab)
|
||||
/// </summary>
|
||||
private string? FilterText { get; set; }
|
||||
private ProspectFilter Filter { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the interaction modal (ab)
|
||||
@@ -69,19 +66,6 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Method FilterText_Changed
|
||||
|
||||
/// <summary>
|
||||
/// Filters the text changed using the specified filter text (a. beging, 08.02.2023)
|
||||
/// </summary>
|
||||
/// <param name="filterText">The filter text</param>
|
||||
private void FilterText_Changed(string filterText)
|
||||
{
|
||||
FilterText = filterText;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Method LoadProspects
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user