Add Blazor application layer with UI components and pages

- Service interfaces and DTO models
- Dashboard page with account overview
- Account detail page with year/entry management
- Reusable components: AccountCard, EntryTable, YearSelector
- Dialog components: Add/Edit Account, Entry, Transfer, Year
- Main layout and routing configuration
This commit is contained in:
2026-03-31 17:13:09 +02:00
parent c3d68020d5
commit f5c2be9339
31 changed files with 886 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
@inject IEntryService EntryService
<div class="dialog-backdrop" @onclick="Cancel">
<div class="dialog-content" @onclick:stopPropagation="true">
<h5>@(EditEntry != null ? "Eintrag bearbeiten" : "Neuer Eintrag")</h5>
@if (EditEntry == null)
{
<div class="mb-3">
<label class="form-label">Art</label>
<select class="form-select" @bind="entryType">
<option value="@EntryType.Income">Einnahme</option>
<option value="@EntryType.Expense">Ausgabe</option>
</select>
</div>
}
<div class="mb-3">
<label class="form-label">Datum</label>
<input type="date" class="form-control" @bind="date" />
</div>
<div class="mb-3">
<label class="form-label">Bezeichnung</label>
<input type="text" class="form-control" @bind="title" placeholder="Beschreibung" />
</div>
<div class="mb-3">
<label class="form-label">Betrag (€)</label>
<input type="number" class="form-control" @bind="amount" step="0.01" min="0.01" />
</div>
<div class="d-flex justify-content-end gap-2">
<button class="btn btn-outline-secondary" @onclick="Cancel"><i class="bi bi-x-lg"></i> Abbrechen</button>
<button class="btn btn-primary" @onclick="Save"
disabled="@(string.IsNullOrWhiteSpace(title) || amount <= 0)">
<i class="bi bi-check-lg"></i> @(EditEntry != null ? "Speichern" : "Hinzufügen")
</button>
</div>
</div>
</div>
@code {
[Parameter] public int AccountId { get; set; }
[Parameter] public EntryDto? EditEntry { get; set; }
[Parameter] public EventCallback OnSave { get; set; }
[Parameter] public EventCallback OnCancel { get; set; }
private EntryType entryType = EntryType.Income;
private DateTime date = DateTime.Today;
private string title = string.Empty;
private decimal amount;
protected override void OnParametersSet()
{
if (EditEntry != null)
{
entryType = EditEntry.Type;
date = EditEntry.Date;
title = EditEntry.Title;
amount = EditEntry.Amount;
}
}
private async Task Save()
{
if (EditEntry != null)
await EntryService.UpdateEntryAsync(EditEntry.Id, date, title.Trim(), amount);
else
await EntryService.CreateEntryAsync(AccountId, entryType, date, title.Trim(), amount);
await OnSave.InvokeAsync();
}
private async Task Cancel() => await OnCancel.InvokeAsync();
}