InteractionModal umstellen

This commit is contained in:
Andre Beging
2025-03-28 19:22:51 +01:00
parent d754da76cd
commit 91bff3c127
8 changed files with 205 additions and 235 deletions

View File

@@ -1,4 +1,5 @@
using FoodsharingSiegen.Contracts.Entity;
using FoodsharingSiegen.Server.Data.Service;
using FoodsharingSiegen.Server.Dialogs;
using Microsoft.AspNetCore.Components;
@@ -8,18 +9,17 @@ namespace FoodsharingSiegen.Server.Controls
{
[Parameter] public Prospect? Prospect { get; set; }
[Parameter] public AddInteractionModal InteractionModal { get; set; } = null!;
[Parameter] public Func<Guid, Task>? RemoveInteraction { get; set; }
[Parameter] public ProspectStateFilter StateFilter { get; set; }
[Parameter] public string? CssClass { get; set; }
[Parameter] public Func<Task>? OnDataChanged { get; set; }
private async Task AddInteraction(InteractionType type)
{
await InteractionModal.ShowAsync(type, Prospect?.Id);
if (Prospect != null && OnDataChanged != null)
await AddInteractionModal.ShowAsync(ModalService, OnDataChanged, type, Prospect.Id);
}
private List<Interaction> GetTyped(InteractionType type)
@@ -31,5 +31,27 @@ namespace FoodsharingSiegen.Server.Controls
{
await EditProspectDialog.ShowAsync(ModalService, () => InvokeAsync(StateHasChanged), Prospect);
}
/// <summary>
/// Gets or sets the value of the prospect service (ab)
/// </summary>
[Inject]
public ProspectService ProspectService { get; set; } = null!;
private async Task RemoveInteraction(Guid arg)
{
var confirm = await Message.Confirm("Interaktion wirklich löschen?", "Bestätigen", o =>
{
o.ConfirmButtonText = "Ja, wirklich!";
o.CancelButtonText = "Abbrechen";
o.ShowMessageIcon = false;
});
if (confirm)
{
var removeR = await ProspectService.RemoveInteraction(arg);
if(removeR.Success && OnDataChanged != null) await OnDataChanged();
}
}
}
}