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

View File

@@ -1,4 +1,4 @@
<div class="dialog-backdrop" @onclick="Cancel">
<div class="dialog-backdrop">
<div class="dialog-content" @onclick:stopPropagation="true">
<h5 class="mb-3">Neues Konto</h5>
<div class="form-container">

View File

@@ -1,6 +1,6 @@
@inject IEntryService EntryService
<div class="dialog-backdrop" @onclick="Cancel">
<div class="dialog-backdrop">
<div class="dialog-content" @onclick:stopPropagation="true">
<h5>@(EditEntry != null ? "Buchung bearbeiten" : "Neue Buchung")</h5>

View File

@@ -1,7 +1,7 @@
@inject IEntryService EntryService
@inject IAccountService AccountService
<div class="dialog-backdrop" @onclick="Cancel">
<div class="dialog-backdrop">
<div class="dialog-content" @onclick:stopPropagation="true">
<h5 class="mb-3">@(EditEntry != null ? "Umbuchung bearbeiten" : "Neue Umbuchung")</h5>

View File

@@ -1,4 +1,4 @@
<div class="dialog-backdrop" @onclick="Cancel">
<div class="dialog-backdrop">
<div class="dialog-content" @onclick:stopPropagation="true">
<h5>@Title</h5>
<p>@Message</p>

View File

@@ -1,4 +1,4 @@
<div class="dialog-backdrop" @onclick="Cancel">
<div class="dialog-backdrop">
<div class="dialog-content" @onclick:stopPropagation="true">
<h5 class="mb-3">Übertrag bearbeiten</h5>
<div class="form-container">

View File

@@ -1,4 +1,4 @@
<div class="dialog-backdrop" @onclick="Cancel">
<div class="dialog-backdrop">
<div class="dialog-content" @onclick:stopPropagation="true">
<h5 class="mb-3">@DialogTitle</h5>
<div class="form-container">

View File

@@ -19,7 +19,7 @@
@if (showAboutDialog)
{
<div class="dialog-backdrop" @onclick="CloseAboutDialog">
<div class="dialog-backdrop">
<div class="dialog-content" @onclick:stopPropagation="true">
<h5>Über Dümpelkas &middot; Version @AppVersion</h5>
<p class="mb-2">Entwickler: Andre Beging</p>

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()