Files
DXApp/DXApp.TemplateKitProject/Pages/Invoices/Index.cshtml
OlgunR 9adc9ac4ed 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.
2026-05-28 16:53:50 +02:00

66 lines
2.4 KiB
Plaintext

@page
@model DXApp.TemplateKitProject.Pages.Invoices.IndexModel
@{
ViewData["Title"] = "Rechnungen";
}
<h2>Importierte Rechnungen</h2>
@if (!Model.Invoices.Any())
{
<div class="alert alert-info mt-3">Noch keine Rechnungen importiert.</div>
}
else
{
@(Html.DevExtreme().DataGrid<DXApp.TemplateKitProject.Models.ZugferdInvoice>()
.DataSource(Model.Invoices)
.KeyExpr("Id")
.ShowBorders(true)
.RowAlternationEnabled(true)
.FilterRow(f => f.Visible(true))
.HeaderFilter(h => h.Visible(true))
.Paging(p => p.PageSize(20))
.Pager(p => p
.ShowPageSizeSelector(true)
.AllowedPageSizes(new[] { 10, 20, 50 })
.ShowInfo(true)
)
.Columns(cols =>
{
cols.Add()
.Caption("Details")
.Width(80)
.CellTemplate(new JS(@"function(container, options) {
$('<a>')
.attr('href', '/Invoices/Details?id=' + options.data.Id)
.attr('class', 'btn btn-sm btn-outline-primary')
.text('Details')
.appendTo(container);
}"));
cols.Add().DataField("Id").Caption("ID").Width(60).AllowEditing(false);
cols.Add().DataField("InvoiceNumber").Caption("Rechnungsnr.");
cols.Add().DataField("InvoiceDate").Caption("Datum")
.DataType(GridColumnDataType.Date)
.Format("dd.MM.yyyy")
.Width(110);
cols.Add().DataField("SellerName").Caption("Verkäufer");
cols.Add().DataField("BuyerName").Caption("Käufer");
cols.Add().DataField("TotalAmount").Caption("Gesamt")
.DataType(GridColumnDataType.Number)
.Format("#,##0.00")
.Width(110);
cols.Add().DataField("TaxAmount").Caption("MwSt.")
.DataType(GridColumnDataType.Number)
.Format("#,##0.00")
.Width(100);
cols.Add().DataField("CurrencyCode").Caption("Währung").Width(80);
cols.Add().DataField("Iban").Caption("IBAN");
cols.Add().DataField("SourceType").Caption("Quelle").Width(90);
cols.Add().DataField("ImportedAt").Caption("Importiert am")
.DataType(GridColumnDataType.DateTime)
.Format("dd.MM.yyyy HH:mm")
.Width(150);
})
)
}