From 38a1fb65c5adcdf3e6066fe5724d370e98242d8f Mon Sep 17 00:00:00 2001 From: Claudio Schaad Date: Sun, 4 May 2025 21:49:01 +0200 Subject: [PATCH] Add year and mandator dropdown --- .../Components/Layout/MainLayout.razor | 2 +- .../Components/MyHeader.razor | 17 ++++++++++ .../Components/MyHeader.razor.cs | 31 +++++++++++++++++++ .../appsettings.Development.json | 4 +++ 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 Schaad.Accounting.UI/Components/MyHeader.razor create mode 100644 Schaad.Accounting.UI/Components/MyHeader.razor.cs diff --git a/Schaad.Accounting.UI/Components/Layout/MainLayout.razor b/Schaad.Accounting.UI/Components/Layout/MainLayout.razor index c4c3eb9..b9a19cb 100644 --- a/Schaad.Accounting.UI/Components/Layout/MainLayout.razor +++ b/Schaad.Accounting.UI/Components/Layout/MainLayout.razor @@ -2,7 +2,7 @@ - AccountingNext + diff --git a/Schaad.Accounting.UI/Components/MyHeader.razor b/Schaad.Accounting.UI/Components/MyHeader.razor new file mode 100644 index 0000000..7382bd9 --- /dev/null +++ b/Schaad.Accounting.UI/Components/MyHeader.razor @@ -0,0 +1,17 @@ +@rendermode InteractiveServer + +AccountingNext + + + + + + +@code { + +} \ No newline at end of file diff --git a/Schaad.Accounting.UI/Components/MyHeader.razor.cs b/Schaad.Accounting.UI/Components/MyHeader.razor.cs new file mode 100644 index 0000000..1ed53da --- /dev/null +++ b/Schaad.Accounting.UI/Components/MyHeader.razor.cs @@ -0,0 +1,31 @@ +using Microsoft.AspNetCore.Components; +using Schaad.Accounting.Interfaces; + +namespace Schaad.Accounting.UI.Components; + +public partial class MyHeader : ComponentBase +{ + [Inject] + private ISettingsService settingsService { get; set; } = null!; + + private List years = new (); + private int selectedYear; + + protected override Task OnInitializedAsync() + { + for (var year = DateTime.Now.Year; year >= 2015; year--) + { + years.Add(year); + } + + selectedYear = settingsService.GetYear(); + + return base.OnInitializedAsync(); + } + + public void YearChanged(string obj) + { + settingsService.SetYear(int.Parse(obj)); + } + +} \ No newline at end of file diff --git a/Schaad.Accounting.UI/appsettings.Development.json b/Schaad.Accounting.UI/appsettings.Development.json index 0c208ae..79a092d 100644 --- a/Schaad.Accounting.UI/appsettings.Development.json +++ b/Schaad.Accounting.UI/appsettings.Development.json @@ -4,5 +4,9 @@ "Default": "Information", "Microsoft.AspNetCore": "Warning" } + }, + "Settings": { + "DataPath": "D:\\Developer\\AccountingData\\", + "FixerIoApiKey": "ee23142f1120bb1223b0e76f98abfa97" } }