Move edit prospect dialog logic

This commit is contained in:
Andre Beging
2025-03-28 18:49:38 +01:00
parent 97deed7d90
commit d754da76cd
15 changed files with 173 additions and 170 deletions

View File

@@ -10,7 +10,7 @@
<Button
Color="Color.Primary"
Clicked="() => ProspectModal.Show()"
Clicked="@CreateProspectAsync"
Visibility="@(CurrentUser.IsInGroup(UserGroup.WelcomeTeam, UserGroup.Ambassador) ? Visibility.Default : Visibility.Invisible)"
>Hinzufügen
</Button>
@@ -26,9 +26,7 @@
Prospects="filterList"
OnRemoveInteraction="RemoveInteractionAsync"
StateFilter="ProspectStateFilter.OnBoarding"
InteractionModal="InteractionModal"
ProspectModal="@ProspectModal">
InteractionModal="InteractionModal">
</ProspectGrid>
<AddProspectModal @ref="ProspectModal" OnAdd="OnAddProspect" OnUpdate="OnUpdateProspect"></AddProspectModal>
<AddInteractionModal @ref="InteractionModal" OnAdd="OnAddInteraction" Users="Users"></AddInteractionModal>

View File

@@ -30,7 +30,7 @@ namespace FoodsharingSiegen.Server.Pages
#region Private Properties
private ProspectFilter Filter { get; set; } = new();
/// <summary>
/// Gets or sets the value of the interaction modal (ab)
/// </summary>
@@ -41,11 +41,6 @@ namespace FoodsharingSiegen.Server.Pages
/// </summary>
private List<Prospect>? ProspectList { get; set; }
/// <summary>
/// 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)
/// </summary>
@@ -69,6 +64,19 @@ namespace FoodsharingSiegen.Server.Pages
#endregion
#region Private Method CreateProspectAsync
/// <summary>
/// Asynchronously creates a new prospect by displaying the AddProspectModal dialog and refreshing the prospect list.
/// </summary>
/// <returns>A task that represents the asynchronous operation.</returns>
private async Task CreateProspectAsync()
{
await EditProspectDialog.ShowAsync(ModalService, LoadProspects);
}
#endregion
#region Private Method LoadProspects
/// <summary>
@@ -80,7 +88,7 @@ namespace FoodsharingSiegen.Server.Pages
{
CannotHaveInteractions = [InteractionType.Complete, InteractionType.Verify, InteractionType.ReleasedForVerification]
};
var prospectsR = await ProspectService.GetProspectsAsync(parameter);
if (prospectsR.Success) ProspectList = prospectsR.Data;
@@ -132,7 +140,7 @@ namespace FoodsharingSiegen.Server.Pages
#endregion
#region Private Method RemoveInteraction
#region Private Method RemoveInteractionAsync
/// <summary>
/// Removes the interaction using the specified arg (a. beging, 11.04.2022)

View File

@@ -3,8 +3,8 @@
@using FoodsharingSiegen.Shared.Helper
@inherits FsBase
<PageTitle>Abgeschlossene Einarbeitungen - @AppSettings.Terms.Title</PageTitle>
<h2>Abgeschlossene Einarbeitungen</h2>
<PageTitle>Abgeschlossen - @AppSettings.Terms.Title</PageTitle>
<h2>Abgeschlossen</h2>
@{
var filterList = ProspectList.ApplyFilter(Filter);

View File

@@ -19,10 +19,9 @@
{
<div class="row m-0">
<Repeater Items="@filterList">
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" ProspectModal="ProspectModal" RemoveInteraction="RemoveInteraction" StateFilter="ProspectStateFilter.Verification"></ProspectContainer>
<ProspectContainer Prospect="context" InteractionModal="InteractionModal" RemoveInteraction="RemoveInteraction" StateFilter="ProspectStateFilter.Verification"></ProspectContainer>
</Repeater>
</div>
}
<AddProspectModal @ref="ProspectModal" OnUpdate="OnUpdateProspect"></AddProspectModal>
<AddInteractionModal @ref="InteractionModal" OnAdd="OnAddInteraction" Users="Users"></AddInteractionModal>

View File

@@ -40,9 +40,7 @@ namespace FoodsharingSiegen.Server.Pages
/// Gets or sets the value of the prospect list (ab)
/// </summary>
private List<Prospect>? ProspectList { get; set; }
private AddProspectModal? ProspectModal { get; set; }
/// <summary>
/// Gets or sets the value of the users (ab)
/// </summary>