From f4f04e4a429be35aa0fc6c937ec5ce581c152e2f Mon Sep 17 00:00:00 2001 From: "a.beging@eas-solutions.de" Date: Wed, 29 Apr 2026 16:17:11 +0200 Subject: [PATCH] Enhance interaction handling: add confirmation dialog for deleting verification images and ensure OnSuccess callback is invoked after adding interactions Co-authored-by: Copilot --- .../Controls/ProspectContainer.razor.cs | 15 ++++++++++++++- .../Dialogs/InteractionDialog.razor.cs | 3 ++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/FoodsharingSiegen.Server/Controls/ProspectContainer.razor.cs b/FoodsharingSiegen.Server/Controls/ProspectContainer.razor.cs index f951770..a49fc20 100644 --- a/FoodsharingSiegen.Server/Controls/ProspectContainer.razor.cs +++ b/FoodsharingSiegen.Server/Controls/ProspectContainer.razor.cs @@ -43,7 +43,20 @@ namespace FoodsharingSiegen.Server.Controls { var headerText = $"{type.Translate(AppSettings)} für {Prospect.Name} eintragen"; - await InteractionDialog.ShowAsync(ModalService, new(type, Prospect.Id, headerText, OnDataChanged)); + Func onSuccess = async () => + { + if (type == InteractionType.IdCheck && Prospect.Images != null && Prospect.Images.Count > 0) + { + await ConfirmDialog.ShowAsync(ModalService, "Personalausweisbilder löschen?", $"Möchtest du die Personalausweisbilder von {Prospect.Name} löschen? Diese werden für die weitere Bearbeitung nicht mehr benötigt und enthalten persönliche Daten.", async () => + { + var result = await ProspectService.DeleteVerificationImagesAsync(Prospect.Id); + await OnDataChanged(); + }); + } + await OnDataChanged(); + }; + + await InteractionDialog.ShowAsync(ModalService, new(type, Prospect.Id, headerText, onSuccess)); } } diff --git a/FoodsharingSiegen.Server/Dialogs/InteractionDialog.razor.cs b/FoodsharingSiegen.Server/Dialogs/InteractionDialog.razor.cs index e5ce1ce..621876e 100644 --- a/FoodsharingSiegen.Server/Dialogs/InteractionDialog.razor.cs +++ b/FoodsharingSiegen.Server/Dialogs/InteractionDialog.razor.cs @@ -127,9 +127,10 @@ namespace FoodsharingSiegen.Server.Dialogs Interaction.UserID = CurrentUser.Id; var addR = await ProspectService.AddInteraction(Interaction); - if (addR.Success && OnSuccess != null) await OnSuccess.Invoke(); await ModalService.Hide(); + + if (addR.Success && OnSuccess != null) await OnSuccess.Invoke(); } #endregion