Enhance ConfirmDialog with customizable button styles and add PDF opening functionality in AccountDetail

This commit is contained in:
2026-03-31 19:21:14 +02:00
parent 68e4e1aa4b
commit c376c70fec
4 changed files with 64 additions and 2 deletions

View File

@@ -144,6 +144,18 @@
OnCancel="CancelRestoreConfirm" />
}
@if (!string.IsNullOrWhiteSpace(savedPdfPath))
{
<ConfirmDialog Title="PDF öffnen"
Message="Die PDF wurde gespeichert. Möchten Sie sie jetzt öffnen?"
ConfirmText="Ja, öffnen"
CancelText="Nein"
ConfirmButtonClass="btn btn-primary"
ConfirmIconClass="bi bi-box-arrow-up-right"
OnConfirm="HandleOpenSavedPdf"
OnCancel="CancelOpenSavedPdf" />
}
@if (editingEntry != null)
{
<AddEntryDialog AccountId="AccountId"
@@ -176,6 +188,8 @@
private int? confirmRestoreEntryId;
private string? confirmRestoreEntryTitle;
private string? savedPdfPath;
private EntryDto? editingEntry;
private EntryDto? editingTransferEntry;
@@ -291,7 +305,22 @@
{
var pdf = await PdfStatementService.GenerateStatementAsync(AccountId, showCurrentYearOnly);
var suffix = showCurrentYearOnly ? $"_{DateTime.Now.Year}" : "_Gesamt";
await FileSaveService.SaveFileAsync(pdf, $"{account?.Name}{suffix}.pdf");
savedPdfPath = await FileSaveService.SaveFileAsync(pdf, $"{account?.Name}{suffix}.pdf");
}
private async Task HandleOpenSavedPdf()
{
if (!string.IsNullOrWhiteSpace(savedPdfPath))
{
await FileSaveService.OpenFileAsync(savedPdfPath);
}
savedPdfPath = null;
}
private void CancelOpenSavedPdf()
{
savedPdfPath = null;
}
private static string FormatAmount(decimal amount) => $"{amount:N2} €";