Suche auf den Prospectseiten implementieren

This commit is contained in:
Andre Beging
2023-02-08 17:18:45 +01:00
parent c19db96b2c
commit e7b53f300a
6 changed files with 151 additions and 61 deletions

View File

@@ -13,13 +13,23 @@
Visibility="@(CurrentUser.IsInGroup(UserGroup.WelcomeTeam, UserGroup.Ambassador) ? Visibility.Default : Visibility.Invisible)" 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();
}
@if (ProspectList?.Any() == true) <hr />
<h5>@(filterList?.Count ?? 0) Einträge</h5>
<TextEdit TextChanged="FilterText_Changed" Placeholder="Suchen..." Debounce="true" DebounceInterval="150" />
@if (filterList?.Any() == true)
{ {
<hr />
<h5>@ProspectList.Count Einträge</h5>
<div class="row m-0"> <div class="row m-0">
<Repeater Items="@ProspectList"> <Repeater Items="@filterList">
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" ProspectModal="ProspectModal" RemoveInteraction="RemoveInteraction"></ProspectContainer> <ProspectContainer Prospect="context" InteractionModal="InteractionModal" ProspectModal="ProspectModal" RemoveInteraction="RemoveInteraction"></ProspectContainer>
</Repeater> </Repeater>
</div> </div>

View File

@@ -1,4 +1,3 @@
using Blazorise;
using FoodsharingSiegen.Contracts.Entity; using FoodsharingSiegen.Contracts.Entity;
using FoodsharingSiegen.Contracts.Model; using FoodsharingSiegen.Contracts.Model;
using FoodsharingSiegen.Server.Data.Service; using FoodsharingSiegen.Server.Data.Service;
@@ -12,7 +11,7 @@ namespace FoodsharingSiegen.Server.Pages
/// </summary> /// </summary>
public partial class Prospects public partial class Prospects
{ {
#region Dependencies (Injected) #region Dependencies
/// <summary> /// <summary>
/// Gets or sets the value of the prospect service (ab) /// Gets or sets the value of the prospect service (ab)
@@ -26,7 +25,12 @@ namespace FoodsharingSiegen.Server.Pages
#endregion #endregion
#region Public Properties #region Private Properties
/// <summary>
/// Gets or sets the value of the filter text (ab)
/// </summary>
private string? FilterText { get; set; }
/// <summary> /// <summary>
/// Gets or sets the value of the interaction modal (ab) /// Gets or sets the value of the interaction modal (ab)
@@ -82,6 +86,19 @@ namespace FoodsharingSiegen.Server.Pages
#endregion #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 #region Private Method LoadProspects
/// <summary> /// <summary>
@@ -151,7 +168,8 @@ namespace FoodsharingSiegen.Server.Pages
/// <param name="arg">The arg</param> /// <param name="arg">The arg</param>
private async Task RemoveInteraction(Guid arg) private async Task RemoveInteraction(Guid arg)
{ {
var confirm = await Message.Confirm("Interaktion wirklich löschen?", "Bestätigen", o => { var confirm = await Message.Confirm("Interaktion wirklich löschen?", "Bestätigen", o =>
{
o.ConfirmButtonText = "Ja, wirklich!"; o.ConfirmButtonText = "Ja, wirklich!";
o.CancelButtonText = "Abbrechen"; o.CancelButtonText = "Abbrechen";
o.ShowMessageIcon = false; o.ShowMessageIcon = false;

View File

@@ -5,12 +5,24 @@
<PageTitle>Abgeschlossene Einarbeitungen</PageTitle> <PageTitle>Abgeschlossene Einarbeitungen</PageTitle>
<h2>Abgeschlossene Einarbeitungen</h2> <h2>Abgeschlossene Einarbeitungen</h2>
@if (ProspectList?.Any() == true) @{
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();
}
<hr />
<h5>@(filterList?.Count ?? 0) Einträge</h5>
<TextEdit TextChanged="FilterText_Changed" Placeholder="Suchen..." Debounce="true" DebounceInterval="150" />
@if (filterList?.Any() == true)
{ {
<hr />
<h5>@ProspectList.Count Einträge</h5>
<div class="row m-0"> <div class="row m-0">
<Repeater Items="@ProspectList"> <Repeater Items="@filterList">
<ProspectContainer Prospect="context" RemoveInteraction="RemoveInteraction"></ProspectContainer> <ProspectContainer Prospect="context" RemoveInteraction="RemoveInteraction"></ProspectContainer>
</Repeater> </Repeater>
</div> </div>

View File

@@ -1,7 +1,6 @@
using FoodsharingSiegen.Contracts.Entity; using FoodsharingSiegen.Contracts.Entity;
using FoodsharingSiegen.Contracts.Model; using FoodsharingSiegen.Contracts.Model;
using FoodsharingSiegen.Server.Data.Service; using FoodsharingSiegen.Server.Data.Service;
using FoodsharingSiegen.Server.Dialogs;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
namespace FoodsharingSiegen.Server.Pages namespace FoodsharingSiegen.Server.Pages
@@ -22,6 +21,11 @@ namespace FoodsharingSiegen.Server.Pages
#region Private Properties #region Private Properties
/// <summary>
/// Gets or sets the value of the filter text (ab)
/// </summary>
private string? FilterText { get; set; }
/// <summary> /// <summary>
/// Gets or sets the value of the prospect list (ab) /// Gets or sets the value of the prospect list (ab)
/// </summary> /// </summary>
@@ -45,6 +49,19 @@ namespace FoodsharingSiegen.Server.Pages
#endregion #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 #region Private Method LoadProspects
/// <summary> /// <summary>

View File

@@ -6,13 +6,24 @@
<h2>Wartende Einarbeitungen</h2> <h2>Wartende Einarbeitungen</h2>
@if (ProspectList?.Any() == true) @{
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();
}
<hr />
<h5>@(filterList?.Count ?? 0) Einträge</h5>
<TextEdit TextChanged="FilterText_Changed" Placeholder="Suchen..." Debounce="true" DebounceInterval="150" />
@if (filterList?.Any() == true)
{ {
<hr />
<h5>@ProspectList.Count Einträge</h5>
<div class="text-center font-weight-bold">Bereits verifiziert, aber noch nicht abgeschlossen. Zum Beispiel, wenn noch der Druck-Ausweis fehlt o.ä.</div> <div class="text-center font-weight-bold">Bereits verifiziert, aber noch nicht abgeschlossen. Zum Beispiel, wenn noch der Druck-Ausweis fehlt o.ä.</div>
<div class="row m-0"> <div class="row m-0">
<Repeater Items="@ProspectList"> <Repeater Items="@filterList">
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" ProspectModal="ProspectModal" RemoveInteraction="RemoveInteraction"></ProspectContainer> <ProspectContainer Prospect="context" InteractionModal="InteractionModal" ProspectModal="ProspectModal" RemoveInteraction="RemoveInteraction"></ProspectContainer>
</Repeater> </Repeater>
</div> </div>

View File

@@ -27,6 +27,11 @@ namespace FoodsharingSiegen.Server.Pages
#region Private Properties #region Private Properties
/// <summary>
/// Gets or sets the value of the filter text (ab)
/// </summary>
private string? FilterText { get; set; }
/// <summary> /// <summary>
/// Gets or sets the value of the interaction modal (ab) /// Gets or sets the value of the interaction modal (ab)
/// </summary> /// </summary>
@@ -37,13 +42,13 @@ namespace FoodsharingSiegen.Server.Pages
/// </summary> /// </summary>
private List<Prospect>? ProspectList { get; set; } private List<Prospect>? ProspectList { get; set; }
private AddProspectModal? ProspectModal { get; set; }
/// <summary> /// <summary>
/// Gets or sets the value of the users (ab) /// Gets or sets the value of the users (ab)
/// </summary> /// </summary>
private List<User>? Users { get; set; } private List<User>? Users { get; set; }
private AddProspectModal? ProspectModal { get; set; }
#endregion #endregion
#region Override OnAfterRenderAsync #region Override OnAfterRenderAsync
@@ -62,6 +67,32 @@ namespace FoodsharingSiegen.Server.Pages
#endregion #endregion
#region Override OnInitializedAsync
protected override async Task OnInitializedAsync()
{
var getUsersR = await UserService.GetUsersAsync();
if (getUsersR.Success)
Users = getUsersR.Data;
await base.OnInitializedAsync();
}
#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 #region Private Method LoadProspects
/// <summary> /// <summary>
@@ -82,15 +113,6 @@ namespace FoodsharingSiegen.Server.Pages
#endregion #endregion
protected override async Task OnInitializedAsync()
{
var getUsersR = await UserService.GetUsersAsync();
if (getUsersR.Success)
Users = getUsersR.Data;
await base.OnInitializedAsync();
}
#region Private Method OnAddInteraction #region Private Method OnAddInteraction
/// <summary> /// <summary>
@@ -105,6 +127,20 @@ namespace FoodsharingSiegen.Server.Pages
#endregion #endregion
#region Private Method OnUpdateProspect
/// <summary>
/// Ons the update prospect using the specified prospect (a. beging, 11.04.2022)
/// </summary>
/// <param name="prospect">The prospect</param>
private async Task OnUpdateProspect(Prospect prospect)
{
var updateProspectR = await ProspectService.UpdateAsync(prospect);
if (updateProspectR.Success) await LoadProspects();
}
#endregion
#region Private Method RemoveInteraction #region Private Method RemoveInteraction
/// <summary> /// <summary>
@@ -130,19 +166,5 @@ namespace FoodsharingSiegen.Server.Pages
} }
#endregion #endregion
#region Private Method OnUpdateProspect
/// <summary>
/// Ons the update prospect using the specified prospect (a. beging, 11.04.2022)
/// </summary>
/// <param name="prospect">The prospect</param>
private async Task OnUpdateProspect(Prospect prospect)
{
var updateProspectR = await ProspectService.UpdateAsync(prospect);
if (updateProspectR.Success) await LoadProspects();
}
#endregion
} }
} }