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

@@ -1,4 +1,3 @@
using Blazorise;
using FoodsharingSiegen.Contracts.Entity;
using FoodsharingSiegen.Contracts.Model;
using FoodsharingSiegen.Server.Data.Service;
@@ -8,43 +7,48 @@ using Microsoft.AspNetCore.Components;
namespace FoodsharingSiegen.Server.Pages
{
/// <summary>
/// The prospects class (a. beging, 11.04.2022)
/// The prospects class (a. beging, 11.04.2022)
/// </summary>
public partial class Prospects
{
#region Dependencies (Injected)
#region Dependencies
/// <summary>
/// Gets or sets the value of the prospect service (ab)
/// Gets or sets the value of the prospect service (ab)
/// </summary>
[Inject] public ProspectService ProspectService { get; set; } = null!;
/// <summary>
/// Gets or sets the value of the user service (ab)
/// Gets or sets the value of the user service (ab)
/// </summary>
[Inject] public UserService UserService { get; set; } = null!;
#endregion
#region Public Properties
#region Private Properties
/// <summary>
/// Gets or sets the value of the interaction modal (ab)
/// Gets or sets the value of the filter text (ab)
/// </summary>
private string? FilterText { get; set; }
/// <summary>
/// Gets or sets the value of the interaction modal (ab)
/// </summary>
private AddInteractionModal? InteractionModal { get; set; }
/// <summary>
/// Gets or sets the value of the prospect list (ab)
/// Gets or sets the value of the prospect list (ab)
/// </summary>
private List<Prospect>? ProspectList { get; set; }
/// <summary>
/// Gets or sets the value of the prospect modal (ab)
/// Gets or sets the value of the prospect modal (ab)
/// </summary>
private AddProspectModal ProspectModal { get; set; } = null!;
/// <summary>
/// Gets or sets the value of the users (ab)
/// Gets or sets the value of the users (ab)
/// </summary>
private List<User>? Users { get; set; }
@@ -53,7 +57,7 @@ namespace FoodsharingSiegen.Server.Pages
#region Override OnAfterRenderAsync
/// <summary>
/// Ons the after render using the specified first render (a. beging, 11.04.2022)
/// Ons the after render using the specified first render (a. beging, 11.04.2022)
/// </summary>
/// <param name="firstRender">The first render</param>
protected override async Task OnAfterRenderAsync(bool firstRender)
@@ -69,23 +73,36 @@ namespace FoodsharingSiegen.Server.Pages
#region Override OnInitializedAsync
/// <summary>
/// Ons the initialized (a. beging, 11.04.2022)
/// Ons the initialized (a. beging, 11.04.2022)
/// </summary>
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
/// <summary>
/// Loads the prospects (a. beging, 11.04.2022)
/// Loads the prospects (a. beging, 11.04.2022)
/// </summary>
private async Task LoadProspects()
{
@@ -95,7 +112,7 @@ namespace FoodsharingSiegen.Server.Pages
};
var prospectsR = await ProspectService.GetProspectsAsync(parameter);
if (prospectsR.Success) ProspectList = prospectsR.Data;
await InvokeAsync(StateHasChanged);
}
@@ -104,7 +121,7 @@ namespace FoodsharingSiegen.Server.Pages
#region Private Method OnAddInteraction
/// <summary>
/// Ons the add interaction using the specified arg (a. beging, 11.04.2022)
/// Ons the add interaction using the specified arg (a. beging, 11.04.2022)
/// </summary>
/// <param name="arg">The arg</param>
private async Task OnAddInteraction(Interaction arg)
@@ -118,7 +135,7 @@ namespace FoodsharingSiegen.Server.Pages
#region Private Method OnAddProspect
/// <summary>
/// Ons the add prospect using the specified arg (a. beging, 11.04.2022)
/// Ons the add prospect using the specified arg (a. beging, 11.04.2022)
/// </summary>
/// <param name="arg">The arg</param>
private async Task OnAddProspect(Prospect arg)
@@ -132,7 +149,7 @@ namespace FoodsharingSiegen.Server.Pages
#region Private Method OnUpdateProspect
/// <summary>
/// Ons the update prospect using the specified prospect (a. beging, 11.04.2022)
/// 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)
@@ -146,12 +163,13 @@ namespace FoodsharingSiegen.Server.Pages
#region Private Method RemoveInteraction
/// <summary>
/// Removes the interaction using the specified arg (a. beging, 11.04.2022)
/// Removes the interaction using the specified arg (a. beging, 11.04.2022)
/// </summary>
/// <param name="arg">The arg</param>
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.CancelButtonText = "Abbrechen";
o.ShowMessageIcon = false;