Anzeige des Prospect Pages überarbeitet
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using FoodsharingSiegen.Contracts.Model;
|
||||
using FoodsharingSiegen.Server.Data.Service;
|
||||
using FoodsharingSiegen.Server.Dialogs;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace FoodsharingSiegen.Server.Pages
|
||||
@@ -8,7 +9,7 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
/// <summary>
|
||||
/// The prospects done class (a. beging, 07.02.2023)
|
||||
/// </summary>
|
||||
public partial class ProspectsTodo
|
||||
public partial class ProspectsDone
|
||||
{
|
||||
#region Dependencies
|
||||
|
||||
@@ -51,11 +52,7 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
/// </summary>
|
||||
private async Task LoadProspects()
|
||||
{
|
||||
var parameter = new GetProspectsParameter
|
||||
{
|
||||
CannotHaveInteractions = new List<InteractionType> { InteractionType.Complete },
|
||||
MustHaveInteractions = new List<InteractionType> { InteractionType.Verify }
|
||||
};
|
||||
var parameter = new GetProspectsParameter { MustHaveInteractions = new List<InteractionType> { InteractionType.Complete } };
|
||||
var prospectsR = await ProspectService.GetProspectsAsync(parameter);
|
||||
if (prospectsR.Success) ProspectList = prospectsR.Data;
|
||||
|
||||
|
||||
@@ -13,7 +13,10 @@
|
||||
<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">
|
||||
<Repeater Items="@ProspectList">
|
||||
<ProspectContainer Prospect="context" RemoveInteraction="RemoveInteraction"></ProspectContainer>
|
||||
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" ProspectModal="ProspectModal" RemoveInteraction="RemoveInteraction"></ProspectContainer>
|
||||
</Repeater>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
<AddProspectModal @ref="ProspectModal" OnUpdate="OnUpdateProspect"></AddProspectModal>
|
||||
<AddInteractionModal @ref="InteractionModal" OnAdd="OnAddInteraction" Users="Users"></AddInteractionModal>
|
||||
@@ -1,6 +1,7 @@
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using FoodsharingSiegen.Contracts.Model;
|
||||
using FoodsharingSiegen.Server.Data.Service;
|
||||
using FoodsharingSiegen.Server.Dialogs;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace FoodsharingSiegen.Server.Pages
|
||||
@@ -8,7 +9,7 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
/// <summary>
|
||||
/// The prospects done class (a. beging, 07.02.2023)
|
||||
/// </summary>
|
||||
public partial class ProspectsDone
|
||||
public partial class ProspectsTodo
|
||||
{
|
||||
#region Dependencies
|
||||
|
||||
@@ -17,14 +18,31 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
/// </summary>
|
||||
[Inject] public ProspectService ProspectService { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the user service (ab)
|
||||
/// </summary>
|
||||
[Inject] public UserService UserService { get; set; } = null!;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <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)
|
||||
/// </summary>
|
||||
private List<Prospect>? ProspectList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the users (ab)
|
||||
/// </summary>
|
||||
private List<User>? Users { get; set; }
|
||||
|
||||
private AddProspectModal? ProspectModal { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -51,7 +69,11 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
/// </summary>
|
||||
private async Task LoadProspects()
|
||||
{
|
||||
var parameter = new GetProspectsParameter {MustHaveInteractions = new List<InteractionType> { InteractionType.Complete }};
|
||||
var parameter = new GetProspectsParameter
|
||||
{
|
||||
CannotHaveInteractions = new List<InteractionType> { InteractionType.Complete },
|
||||
MustHaveInteractions = new List<InteractionType> { InteractionType.Verify }
|
||||
};
|
||||
var prospectsR = await ProspectService.GetProspectsAsync(parameter);
|
||||
if (prospectsR.Success) ProspectList = prospectsR.Data;
|
||||
|
||||
@@ -60,6 +82,29 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
|
||||
#endregion
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var getUsersR = await UserService.GetUsersAsync();
|
||||
if (getUsersR.Success)
|
||||
Users = getUsersR.Data;
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
#region Private Method OnAddInteraction
|
||||
|
||||
/// <summary>
|
||||
/// 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)
|
||||
{
|
||||
await ProspectService.AddInteraction(arg);
|
||||
await LoadProspects();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Method RemoveInteraction
|
||||
|
||||
/// <summary>
|
||||
@@ -85,5 +130,19 @@ namespace FoodsharingSiegen.Server.Pages
|
||||
}
|
||||
|
||||
#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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user