refactor(app): move account razor inline code to partial classes
This commit is contained in:
@@ -9,8 +9,3 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public AccountSummaryDto Account { get; set; } = default!;
|
||||
|
||||
private void Navigate() => Navigation.NavigateTo($"/accounts/{Account.Id}");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using Duempelkas.App.Services.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Duempelkas.App.Components.Accounts;
|
||||
|
||||
public partial class AccountCard
|
||||
{
|
||||
#region Parameters
|
||||
|
||||
[Parameter]
|
||||
public AccountSummaryDto Account { get; set; } = default!;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Actions
|
||||
|
||||
private void Navigate() => Navigation.NavigateTo($"/accounts/{Account.Id}");
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -7,6 +7,3 @@
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public List<AccountSummaryDto> Accounts { get; set; } = new();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using Duempelkas.App.Services.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Duempelkas.App.Components.Accounts;
|
||||
|
||||
public partial class AccountCardList
|
||||
{
|
||||
#region Parameters
|
||||
|
||||
[Parameter]
|
||||
public List<AccountSummaryDto> Accounts { get; set; } = new();
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -34,17 +34,3 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@code {
|
||||
[Parameter] public EntryDto Entry { get; set; } = default!;
|
||||
[Parameter] public EventCallback<int> OnDelete { get; set; }
|
||||
[Parameter] public EventCallback<int> OnRestore { get; set; }
|
||||
[Parameter] public EventCallback<int> OnEdit { get; set; }
|
||||
|
||||
private string GetRowClass()
|
||||
{
|
||||
var classes = new List<string>();
|
||||
if (Entry.IsTransfer) classes.Add("entry-row-transfer");
|
||||
if (Entry.IsDeleted) classes.Add("entry-deleted");
|
||||
return string.Join(" ", classes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
using Duempelkas.App.Services.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Duempelkas.App.Components.Accounts;
|
||||
|
||||
public partial class EntryRow
|
||||
{
|
||||
#region Parameters
|
||||
|
||||
[Parameter]
|
||||
public EntryDto Entry { get; set; } = default!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> OnDelete { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> OnRestore { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> OnEdit { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helpers
|
||||
|
||||
private string GetRowClass()
|
||||
{
|
||||
var classes = new List<string>();
|
||||
if (Entry.IsTransfer)
|
||||
{
|
||||
classes.Add("entry-row-transfer");
|
||||
}
|
||||
|
||||
if (Entry.IsDeleted)
|
||||
{
|
||||
classes.Add("entry-deleted");
|
||||
}
|
||||
|
||||
return string.Join(" ", classes);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -23,9 +23,3 @@
|
||||
<div class="text-center py-3 text-muted">Keine Buchungen vorhanden.</div>
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter] public List<EntryDto> Entries { get; set; } = new();
|
||||
[Parameter] public EventCallback<int> OnDeleteEntry { get; set; }
|
||||
[Parameter] public EventCallback<int> OnRestoreEntry { get; set; }
|
||||
[Parameter] public EventCallback<int> OnEditEntry { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using Duempelkas.App.Services.Models;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Duempelkas.App.Components.Accounts;
|
||||
|
||||
public partial class EntryTable
|
||||
{
|
||||
#region Parameters
|
||||
|
||||
[Parameter]
|
||||
public List<EntryDto> Entries { get; set; } = new();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> OnDeleteEntry { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> OnRestoreEntry { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> OnEditEntry { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user