Add invoice details page and grid column link

Added a "Details" column to the grid in `Index.cshtml` with a button linking to the new invoice details page. The button dynamically generates the URL using the invoice ID.

Created `Details.cshtml` to display detailed invoice information, including metadata such as seller, buyer, amounts, and dates. Added a back button and error handling for missing invoices.

Introduced `DetailsModel` in `Details.cshtml.cs` to fetch invoice data using `AppDbContext`. Implemented the `OnGetAsync` method to retrieve data asynchronously and handle cases where the invoice is not found.
This commit is contained in:
OlgunR
2026-05-28 16:53:50 +02:00
parent 8e329c2b50
commit 9adc9ac4ed
3 changed files with 76 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
@page
@model DXApp.TemplateKitProject.Pages.Invoices.DetailsModel
@{
ViewData["Title"] = "Rechnungsdetails";
}
<h2>📄 Rechnungsdetails</h2>
<a href="/Invoices" class="btn btn-secondary mb-3">← Zurück zur Liste</a>
@if (Model.Invoice is null)
{
<div class="alert alert-danger">Rechnung nicht gefunden.</div>
}
else
{
<table class="table table-sm table-bordered w-auto">
<tr><th>ID</th><td>@Model.Invoice.Id</td></tr>
<tr><th>Rechnungsnummer</th><td>@Model.Invoice.InvoiceNumber</td></tr>
<tr><th>Rechnungsdatum</th><td>@Model.Invoice.InvoiceDate.ToString("dd.MM.yyyy")</td></tr>
<tr><th>Verkäufer</th><td>@Model.Invoice.SellerName</td></tr>
<tr><th>USt-ID Verkäufer</th><td>@Model.Invoice.SellerTaxId</td></tr>
<tr><th>Käufer</th><td>@Model.Invoice.BuyerName</td></tr>
<tr><th>Währung</th><td>@Model.Invoice.CurrencyCode</td></tr>
<tr><th>Steuerbetrag</th><td>@Model.Invoice.TaxAmount.ToString("N2")</td></tr>
<tr><th>Gesamtbetrag</th><td><strong>@Model.Invoice.TotalAmount.ToString("N2")</strong></td></tr>
<tr><th>IBAN</th><td>@Model.Invoice.Iban</td></tr>
<tr><th>Quelle</th><td>@Model.Invoice.SourceType</td></tr>
<tr><th>Guideline-ID</th><td><code>@Model.Invoice.GuidelineId</code></td></tr>
<tr><th>Importiert am</th><td>@Model.Invoice.ImportedAt.ToString("dd.MM.yyyy HH:mm")</td></tr>
<tr>
<th>Result-PDF</th>
<td>
@if (!string.IsNullOrEmpty(Model.Invoice.ResultFilePath))
{
<small class="text-muted">@Model.Invoice.ResultFilePath</small>
}
else
{
<span class="text-muted"> nicht vorhanden </span>
}
</td>
</tr>
</table>
}