Pending bookings: hide a row once it is booked (#18)
Co-authored-by: Claudio Schaad <c.schaad@pog.ch> Co-committed-by: Claudio Schaad <c.schaad@pog.ch>
This commit is contained in:
parent
9e38459e8a
commit
9dcaf05414
3 changed files with 7 additions and 10 deletions
|
|
@ -2,7 +2,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Schaad.Accounting.Models
|
||||
{
|
||||
|
|
@ -44,9 +43,6 @@ namespace Schaad.Accounting.Models
|
|||
[Display(Name = "Währungskurs")]
|
||||
public decimal? FxRate { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public bool ReadOnly {get; set;}
|
||||
|
||||
public Transaction()
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ else
|
|||
</td>
|
||||
<td>
|
||||
<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">
|
||||
@foreach (var text in bookingTexts.OrderBy(t => t))
|
||||
{
|
||||
|
|
@ -60,13 +60,12 @@ else
|
|||
<td style="align-content: center">
|
||||
<FluentButton IconEnd="@(new Icons.Regular.Size16.SplitVertical())" Appearance="Appearance.Neutral"
|
||||
title="Aufteilen" aria-label="Aufteilen"
|
||||
OnClick="@(() => SplitBankTransactionAsync(transaction))" Disabled="@(transaction.Value > 0 || transaction.ReadOnly)" />
|
||||
OnClick="@(() => SplitBankTransactionAsync(transaction))" Disabled="@(transaction.Value > 0)" />
|
||||
</td>
|
||||
<td style="align-content: center">
|
||||
<FluentButton IconEnd="@(new Icons.Regular.Size16.Save())" Appearance="Appearance.Neutral"
|
||||
title="Buchen" aria-label="Buchen"
|
||||
OnClick="@(() => BookBankTransactionAsync(transaction))"
|
||||
Disabled="@transaction.ReadOnly" />
|
||||
OnClick="@(() => BookBankTransactionAsync(transaction))" />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,9 @@ public partial class PendingBookings : ComponentBase
|
|||
return;
|
||||
}
|
||||
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)
|
||||
|
|
@ -75,7 +77,7 @@ public partial class PendingBookings : ComponentBase
|
|||
var result = await dialog.Result;
|
||||
if (!result.Cancelled && result.Data != null)
|
||||
{
|
||||
await LoadDataAsync();
|
||||
matchingBankTransactions?.Remove(transaction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue