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

@@ -7,9 +7,9 @@
<div class="@divClass">
<h5 class="mb-0">
@if (ProspectModal != null && CurrentUser.IsInGroup(UserGroup.WelcomeTeam, UserGroup.Ambassador))
@if (CurrentUser.IsInGroup(UserGroup.WelcomeTeam, UserGroup.Ambassador))
{
<a href=""><i class="fa-solid fa-pen-to-square" @onclick="() => ProspectModal.Show(Prospect)" @onclick:preventDefault></i> </a>
<a href=""><i class="fa-solid fa-pen-to-square" @onclick="EditProspectAsync" @onclick:preventDefault></i> </a>
}
@Prospect?.Name
@@ -28,7 +28,6 @@
</Alert>
}
<table style="width: 100%;">
<InteractionRow

View File

@@ -10,8 +10,6 @@ namespace FoodsharingSiegen.Server.Controls
[Parameter] public AddInteractionModal InteractionModal { get; set; } = null!;
[Parameter] public AddProspectModal? ProspectModal { get; set; } = null!;
[Parameter] public Func<Guid, Task>? RemoveInteraction { get; set; }
[Parameter] public ProspectStateFilter StateFilter { get; set; }
@@ -26,7 +24,12 @@ namespace FoodsharingSiegen.Server.Controls
private List<Interaction> GetTyped(InteractionType type)
{
return Prospect?.Interactions?.Where(x => x.Type == type).ToList() ?? new List<Interaction>();
return Prospect?.Interactions?.Where(x => x.Type == type).ToList() ?? [];
}
private async Task EditProspectAsync()
{
await EditProspectDialog.ShowAsync(ModalService, () => InvokeAsync(StateHasChanged), Prospect);
}
}
}

View File

@@ -7,9 +7,7 @@
[Parameter] public Func<Guid, Task>? OnRemoveInteraction { get; set; }
[Parameter] public AddInteractionModal InteractionModal { get; set; } = null!;
[Parameter] public AddProspectModal? ProspectModal { get; set; } = null!;
[Parameter] public ProspectStateFilter StateFilter { get; set; }
}
@@ -22,7 +20,6 @@
<ProspectContainer
Prospect="context"
InteractionModal="@InteractionModal"
ProspectModal="@ProspectModal"
RemoveInteraction="OnRemoveInteraction"
StateFilter="StateFilter"></ProspectContainer>
</Repeater>