Refactor dialog components to remove Cancel event from backdrop; enhance confirmation dialog for restore functionality

This commit is contained in:
2026-04-03 12:46:28 +02:00
parent 9aa1fee49e
commit 9807e4d61d
8 changed files with 31 additions and 13 deletions
+24 -6
View File
@@ -4,7 +4,6 @@
@inject ISettingsService SettingsService
@inject IPdfStatementService PdfStatementService
@inject IFileSaveService FileSaveService
@inject IJSRuntime JsRuntime
@inject NavigationManager NavigationManager
@using System.Globalization
@@ -97,10 +96,23 @@
OnCancel="CancelOpenSavedPdf" />
}
@if (showRestoreConfirm)
{
<ConfirmDialog Title="Restore bestätigen"
Message="Restore überschreibt die aktuelle Datenbank. Möchten Sie fortfahren?"
ConfirmText="Ja, wiederherstellen"
CancelText="Nein, abbrechen"
ConfirmButtonClass="btn btn-warning"
ConfirmIconClass="bi bi-arrow-counterclockwise"
OnConfirm="HandleConfirmRestore"
OnCancel="CancelRestoreConfirm" />
}
@code {
private List<AccountSummaryDto>? accounts;
private bool showAddAccount;
private bool showEditClubName;
private bool showRestoreConfirm;
private string clubName = string.Empty;
private string? operationMessage;
private string operationMessageClass = "alert-info";
@@ -147,13 +159,20 @@
}
private async Task HandleRestoreAsync()
private Task HandleRestoreAsync()
{
var confirmed = await JsRuntime.InvokeAsync<bool>("confirm",
"Restore überschreibt die aktuelle Datenbank. Möchten Sie fortfahren?");
showRestoreConfirm = true;
return Task.CompletedTask;
}
if (!confirmed) return;
private void CancelRestoreConfirm()
{
showRestoreConfirm = false;
}
private async Task HandleConfirmRestore()
{
showRestoreConfirm = false;
var message = await BackupService.RestoreBackupAsync();
var isSuccess = message.StartsWith("Wiederherstellung erfolgreich", StringComparison.OrdinalIgnoreCase);
@@ -164,7 +183,6 @@
} else {
SetOperationMessage(message, isSuccess);
}
}
private async Task HandleDashboardExportAsync()