diff --git a/src/Duempelkas.App/Components/Dialogs/ConfirmDialog.razor b/src/Duempelkas.App/Components/Dialogs/ConfirmDialog.razor index d1f8d2e..f6ca716 100644 --- a/src/Duempelkas.App/Components/Dialogs/ConfirmDialog.razor +++ b/src/Duempelkas.App/Components/Dialogs/ConfirmDialog.razor @@ -4,7 +4,7 @@

@Message

- +
@@ -14,6 +14,8 @@ [Parameter] public string Message { get; set; } = "Sind Sie sicher?"; [Parameter] public string ConfirmText { get; set; } = "Ja, bestätigen"; [Parameter] public string CancelText { get; set; } = "Nein, abbrechen"; + [Parameter] public string ConfirmButtonClass { get; set; } = "btn btn-danger"; + [Parameter] public string ConfirmIconClass { get; set; } = "bi bi-trash"; [Parameter] public EventCallback OnConfirm { get; set; } [Parameter] public EventCallback OnCancel { get; set; } diff --git a/src/Duempelkas.App/Pages/Accounts/AccountDetail.razor b/src/Duempelkas.App/Pages/Accounts/AccountDetail.razor index 7718289..ccdc89d 100644 --- a/src/Duempelkas.App/Pages/Accounts/AccountDetail.razor +++ b/src/Duempelkas.App/Pages/Accounts/AccountDetail.razor @@ -144,6 +144,18 @@ OnCancel="CancelRestoreConfirm" /> } +@if (!string.IsNullOrWhiteSpace(savedPdfPath)) +{ + +} + @if (editingEntry != null) { $"{amount:N2} €"; diff --git a/src/Duempelkas.App/Services/IFileSaveService.cs b/src/Duempelkas.App/Services/IFileSaveService.cs index 85112ba..6137e1e 100644 --- a/src/Duempelkas.App/Services/IFileSaveService.cs +++ b/src/Duempelkas.App/Services/IFileSaveService.cs @@ -3,4 +3,5 @@ namespace Duempelkas.App.Services; public interface IFileSaveService { Task SaveFileAsync(byte[] content, string suggestedFileName); + Task OpenFileAsync(string filePath); } diff --git a/src/Duempelkas.Infrastructure/Services/FileSaveService.cs b/src/Duempelkas.Infrastructure/Services/FileSaveService.cs index b07fa89..55033fd 100644 --- a/src/Duempelkas.Infrastructure/Services/FileSaveService.cs +++ b/src/Duempelkas.Infrastructure/Services/FileSaveService.cs @@ -15,6 +15,36 @@ public class FileSaveService : IFileSaveService return filePath; } + public Task OpenFileAsync(string filePath) + { + if (string.IsNullOrWhiteSpace(filePath) || !File.Exists(filePath)) + { + return Task.CompletedTask; + } + + return Task.Run(() => + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + Process.Start(new ProcessStartInfo + { + FileName = filePath, + UseShellExecute = true + }); + + return; + } + + if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + Process.Start("open", filePath); + return; + } + + Process.Start("xdg-open", filePath); + }); + } + private static Task ShowSaveDialogAsync(string suggestedFileName) { return Task.Run(() =>