Add confirmation popup for clearing signature fields

Added a confirmation popup to `SenderEditorPage.razor` for clearing all signature fields, requiring user confirmation before proceeding. Updated resource files (`Resource.de-DE.resx`, `Resource.en-US.resx`, `Resource.fr-FR.resx`) with localized confirmation messages. Modified the "Remove all signature fields" button to trigger the popup instead of directly invoking the clear action.

Introduced a new `_clearFieldsConfirmVisible` variable to manage popup visibility. Updated the `ClearAllFieldsAsync` method to close the popup before clearing fields. Added new CSS styles in `envelope-viewer.css` to style the confirmation popup and its elements.
This commit is contained in:
2026-11-10 21:00:36 +01:00
parent f6dc454193
commit e1f24249a9
5 changed files with 47 additions and 1 deletions

View File

@@ -289,7 +289,7 @@
@if (_pdfLoaded && _signatureFields.Count > 0)
{
<button class="pdf-toolbar__btn pdf-toolbar__btn--reset"
@onclick="ClearAllFieldsAsync"
@onclick='() => _clearFieldsConfirmVisible = true'
title='@L("SenderEditor_RemoveAllSignatureFields", "Alle Signaturfelder entfernen")'>
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
<path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z" />
@@ -506,6 +506,29 @@
</FooterContentTemplate>
</DxPopup>
@* ── Clear all fields confirmation popup ── *@
<DxPopup @bind-Visible="_clearFieldsConfirmVisible"
Width="400px"
MaxWidth="95vw"
ShowHeader="false"
ShowFooter="false"
CloseOnEscape="true"
CloseOnOutsideClick="true">
<BodyContentTemplate>
<div class="sender-confirm-popup">
<p class="sender-confirm-popup__message">@L("SenderEditor_RemoveAllSignatureFieldsConfirm", "Diese Aktion entfernt alle platzierten Signaturfelder unwiderruflich. Fortfahren?")</p>
<div class="sender-confirm-popup__actions">
<DxButton Text='@L("Cancel", "Abbrechen")'
RenderStyle="ButtonRenderStyle.Secondary"
Click='() => _clearFieldsConfirmVisible = false' />
<DxButton Text='@L("Delete", "Löschen")'
RenderStyle="ButtonRenderStyle.Danger"
Click="ClearAllFieldsAsync" />
</div>
</div>
</BodyContentTemplate>
</DxPopup>
@* ── Save result popup (success + error) ── *@
<DxPopup @bind-Visible="_savePopupVisible"
HeaderText='@(_saveErrorMessage is null ? _saveSuccessHeader : L("Error", "Fehler"))'
@@ -620,6 +643,7 @@
// ── Save state ──
bool _isSaving = false;
bool _savePopupVisible = false;
bool _clearFieldsConfirmVisible = false;
string? _saveErrorMessage = null;
string _saveSuccessHeader = "Erfolg";
string _saveSuccessTitle = "Vorgang erfolgreich abgeschlossen.";
@@ -1060,6 +1084,7 @@
// ── Clear all fields ──
async Task ClearAllFieldsAsync()
{
_clearFieldsConfirmVisible = false;
_signatureFields.Clear();
_pendingReceiverForPlacement = null;
await Task.CompletedTask;