InteractionModal umstellen
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user