From 3d3a6af1030ae461a1d81a63a73b45e5c1a5847a Mon Sep 17 00:00:00 2001 From: Claudio Schaad Date: Sat, 28 Jun 2025 11:18:51 +0200 Subject: [PATCH] Make line readonly after save --- Schaad.Accounting.Common/Models/Transaction.cs | 4 ++++ Schaad.Accounting.UI/Components/Pages/Home.razor | 7 ++++--- Schaad.Accounting.UI/Components/Pages/Home.razor.cs | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Schaad.Accounting.Common/Models/Transaction.cs b/Schaad.Accounting.Common/Models/Transaction.cs index 8dc7ee0..bd91f84 100644 --- a/Schaad.Accounting.Common/Models/Transaction.cs +++ b/Schaad.Accounting.Common/Models/Transaction.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; +using System.Xml.Serialization; namespace Schaad.Accounting.Models { @@ -42,6 +43,9 @@ namespace Schaad.Accounting.Models [Display(Name = "Währungskurs")] public decimal? FxRate { get; set; } + + [XmlIgnore] + public bool ReadOnly {get; set;} public Transaction() { diff --git a/Schaad.Accounting.UI/Components/Pages/Home.razor b/Schaad.Accounting.UI/Components/Pages/Home.razor index a3acae4..0993000 100644 --- a/Schaad.Accounting.UI/Components/Pages/Home.razor +++ b/Schaad.Accounting.UI/Components/Pages/Home.razor @@ -67,7 +67,7 @@ else
- + @foreach (var text in bookingTexts.OrderBy(t => t)) { @@ -88,11 +88,12 @@ else + OnClick="@(() => SplitBankTransactionAsync(transaction))" Disabled="@(transaction.Value > 0 || transaction.ReadOnly)" /> + OnClick="@(() => BookBankTransactionAsync(transaction))" + Disabled="@transaction.ReadOnly" /> } diff --git a/Schaad.Accounting.UI/Components/Pages/Home.razor.cs b/Schaad.Accounting.UI/Components/Pages/Home.razor.cs index f8ae71d..5a7bbbd 100644 --- a/Schaad.Accounting.UI/Components/Pages/Home.razor.cs +++ b/Schaad.Accounting.UI/Components/Pages/Home.razor.cs @@ -166,7 +166,7 @@ public partial class Home : ComponentBase return; } transactionRepository.SaveTransaction(transaction); - ReloadPage(); + transaction.ReadOnly = true; await Task.CompletedTask; }