Enhance ConfirmDialog with customizable button styles and add PDF opening functionality in AccountDetail
This commit is contained in:
@@ -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} €";
|
||||
|
||||
Reference in New Issue
Block a user