Pending bookings: hide a row once it is booked
Booking or splitting a pending bank transaction now removes its row from the list instead of leaving it read-only. The list is not reloaded, so the booking rules are not re-evaluated and edits on other rows are kept. The now unused Transaction.ReadOnly flag is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9e38459e8a
commit
5b19972762
3 changed files with 7 additions and 10 deletions
|
|
@ -2,7 +2,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace Schaad.Accounting.Models
|
namespace Schaad.Accounting.Models
|
||||||
{
|
{
|
||||||
|
|
@ -44,9 +43,6 @@ namespace Schaad.Accounting.Models
|
||||||
[Display(Name = "Währungskurs")]
|
[Display(Name = "Währungskurs")]
|
||||||
public decimal? FxRate { get; set; }
|
public decimal? FxRate { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public bool ReadOnly {get; set;}
|
|
||||||
|
|
||||||
public Transaction()
|
public Transaction()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ else
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="text-column">
|
<div class="text-column">
|
||||||
<input list="texts" @bind="@transaction.Text" placeholder="Type or select..." readonly="@transaction.ReadOnly"/>
|
<input list="texts" @bind="@transaction.Text" placeholder="Type or select..."/>
|
||||||
<datalist id="texts">
|
<datalist id="texts">
|
||||||
@foreach (var text in bookingTexts.OrderBy(t => t))
|
@foreach (var text in bookingTexts.OrderBy(t => t))
|
||||||
{
|
{
|
||||||
|
|
@ -60,13 +60,12 @@ else
|
||||||
<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"
|
||||||
title="Aufteilen" aria-label="Aufteilen"
|
title="Aufteilen" aria-label="Aufteilen"
|
||||||
OnClick="@(() => SplitBankTransactionAsync(transaction))" Disabled="@(transaction.Value > 0 || transaction.ReadOnly)" />
|
OnClick="@(() => SplitBankTransactionAsync(transaction))" Disabled="@(transaction.Value > 0)" />
|
||||||
</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"
|
||||||
title="Buchen" aria-label="Buchen"
|
title="Buchen" aria-label="Buchen"
|
||||||
OnClick="@(() => BookBankTransactionAsync(transaction))"
|
OnClick="@(() => BookBankTransactionAsync(transaction))" />
|
||||||
Disabled="@transaction.ReadOnly" />
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,9 @@ public partial class PendingBookings : ComponentBase
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await transactionRepository.SaveTransactionAsync(transaction);
|
await transactionRepository.SaveTransactionAsync(transaction);
|
||||||
transaction.ReadOnly = true;
|
// Only drop the booked row: reloading would re-run the booking rules and
|
||||||
|
// discard edits on the other rows.
|
||||||
|
matchingBankTransactions?.Remove(transaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SplitBankTransactionAsync(Transaction transaction)
|
private async Task SplitBankTransactionAsync(Transaction transaction)
|
||||||
|
|
@ -75,7 +77,7 @@ public partial class PendingBookings : ComponentBase
|
||||||
var result = await dialog.Result;
|
var result = await dialog.Result;
|
||||||
if (!result.Cancelled && result.Data != null)
|
if (!result.Cancelled && result.Data != null)
|
||||||
{
|
{
|
||||||
await LoadDataAsync();
|
matchingBankTransactions?.Remove(transaction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue