feat(usability): preserve reporting year and locate outside-period bookings (U04)
This commit is contained in:
@@ -15,13 +15,18 @@ public partial class AddEntryDialog
|
||||
public EntryDto? EditEntry { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback OnSave { get; set; }
|
||||
public EventCallback<DateTime> OnSave { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback OnCancel { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
[Parameter] public int? ContextYear { get; set; }
|
||||
private bool confirmDifferentYear;
|
||||
private int? confirmedYear;
|
||||
private bool OutsideYear => ContextYear.HasValue && date.Year != ContextYear.Value;
|
||||
|
||||
#region Fields
|
||||
|
||||
private EntryType entryType = EntryType.Income;
|
||||
@@ -50,6 +55,7 @@ public partial class AddEntryDialog
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
if (OutsideYear && (!confirmDifferentYear || confirmedYear != date.Year)) return;
|
||||
if (EditEntry != null)
|
||||
{
|
||||
await EntryService.UpdateEntryAsync(EditEntry.Id, date, title.Trim(), amount);
|
||||
@@ -59,7 +65,7 @@ public partial class AddEntryDialog
|
||||
await EntryService.CreateEntryAsync(AccountId, entryType, date, title.Trim(), amount);
|
||||
}
|
||||
|
||||
await OnSave.InvokeAsync();
|
||||
await OnSave.InvokeAsync(date);
|
||||
}
|
||||
|
||||
private async Task Cancel() => await OnCancel.InvokeAsync();
|
||||
|
||||
Reference in New Issue
Block a user