Merge pull request #3

* Make line readonly after save

* Cleanup CSS

* Reorder columns
This commit is contained in:
Claudio Schaad 2025-06-28 11:26:34 +02:00 committed by GitHub
parent 2d59684469
commit 37d568cbc2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 21 deletions

View file

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Xml.Serialization;
namespace Schaad.Accounting.Models namespace Schaad.Accounting.Models
{ {
@ -43,6 +44,9 @@ namespace Schaad.Accounting.Models
[Display(Name = "Währungskurs")] [Display(Name = "Währungskurs")]
public decimal? FxRate { get; set; } public decimal? FxRate { get; set; }
[XmlIgnore]
public bool ReadOnly {get; set;}
public Transaction() public Transaction()
{ {
} }

View file

@ -41,10 +41,10 @@ else
<tr> <tr>
<th>Buchungsdatum</th> <th>Buchungsdatum</th>
<th>Valutadatum</th> <th>Valutadatum</th>
<th>Betrag</th>
<th>Zusatzinfo</th> <th>Zusatzinfo</th>
<th>Text</th> <th>Text</th>
<th>Konto</th> <th>Konto</th>
<th>Betrag</th>
<th></th> <th></th>
<th></th> <th></th>
</tr> </tr>
@ -59,15 +59,12 @@ else
<td> <td>
<div>@transaction.ValueDate.ToString("dd.MM.yyyy")</div> <div>@transaction.ValueDate.ToString("dd.MM.yyyy")</div>
</td> </td>
<td class="betrag-column">
<div>@Math.Abs(transaction.Value).ToFormattedString()</div>
</td>
<td class="zusatzinfo-column" title="@transaction.BankTransactionText"> <td class="zusatzinfo-column" title="@transaction.BankTransactionText">
<div>@transaction.BankTransactionText</div> <div>@transaction.BankTransactionText</div>
</td> </td>
<td> <td>
<div class="text-column"> <div class="text-column">
<input list="texts" @bind="@transaction.Text" placeholder="Type or select..."/> <input list="texts" @bind="@transaction.Text" placeholder="Type or select..." readonly="@transaction.ReadOnly"/>
<datalist id="texts"> <datalist id="texts">
@foreach (var text in bookingTexts.OrderBy(t => t)) @foreach (var text in bookingTexts.OrderBy(t => t))
{ {
@ -86,13 +83,17 @@ else
<AccountSelector Accounts="accounts" @bind-AccountId="@transaction.TargetAccountId" /> <AccountSelector Accounts="accounts" @bind-AccountId="@transaction.TargetAccountId" />
} }
</td> </td>
<td>
<div>@Math.Abs(transaction.Value).ToFormattedString()</div>
</td>
<td style="align-content: center"> <td style="align-content: center">
<FluentButton IconEnd="@(new Icons.Regular.Size16.SplitVertical())" Appearance="Appearance.Neutral" <FluentButton IconEnd="@(new Icons.Regular.Size16.SplitVertical())" Appearance="Appearance.Neutral"
OnClick="@(() => SplitBankTransactionAsync(transaction))" Disabled="@(transaction.Value > 0)"/> OnClick="@(() => SplitBankTransactionAsync(transaction))" Disabled="@(transaction.Value > 0 || transaction.ReadOnly)" />
</td> </td>
<td style="align-content: center"> <td style="align-content: center">
<FluentButton IconEnd="@(new Icons.Regular.Size16.Save())" Appearance="Appearance.Neutral" <FluentButton IconEnd="@(new Icons.Regular.Size16.Save())" Appearance="Appearance.Neutral"
OnClick="@(() => BookBankTransactionAsync(transaction))"/> OnClick="@(() => BookBankTransactionAsync(transaction))"
Disabled="@transaction.ReadOnly" />
</td> </td>
</tr> </tr>
} }

View file

@ -166,7 +166,7 @@ public partial class Home : ComponentBase
return; return;
} }
transactionRepository.SaveTransaction(transaction); transactionRepository.SaveTransaction(transaction);
ReloadPage(); transaction.ReadOnly = true;
await Task.CompletedTask; await Task.CompletedTask;
} }

View file

@ -16,13 +16,14 @@ th {
background-color: #f8f8f8; background-color: #f8f8f8;
} }
th:nth-child(1), td:nth-child(1) { width: 120px; } th:nth-child(1), td:nth-child(1) { width: 120px; } /* Booking Date */
th:nth-child(2), td:nth-child(2) { width: 120px; } th:nth-child(2), td:nth-child(2) { width: 120px; } /* Valuta Date */
th:nth-child(3), td:nth-child(3) { width: 100px; text-align: right; } th:nth-child(3), td:nth-child(3) { } /* Zusatzinfo */
th:nth-child(5), td:nth-child(5) { width: 240px; } th:nth-child(4), td:nth-child(4) { width: 240px; } /* Text */
th:nth-child(6), td:nth-child(6) { width: 300px; } th:nth-child(5), td:nth-child(5) { width: 300px; } /* Account */
th:nth-child(7), td:nth-child(7), th:nth-child(6), td:nth-child(6) { width: 100px; text-align: right; } /* Amount */
th:nth-child(8), td:nth-child(8) { width: 40px; text-align: center; } th:nth-child(7), td:nth-child(7) { width: 40px; text-align: center; } /* Split */
th:nth-child(8), td:nth-child(8) { width: 40px; text-align: center; } /* Save */
.text-column input { .text-column input {
width: 100%; width: 100%;
@ -36,8 +37,3 @@ th:nth-child(8), td:nth-child(8) { width: 40px; text-align: center; }
text-overflow: ellipsis; text-overflow: ellipsis;
width: 100%; width: 100%;
} }
.betrag-column {
text-align: right;
white-space: nowrap;
}