diff --git a/DXApp.TemplateKitProject/Pages/Invoices/Index.cshtml b/DXApp.TemplateKitProject/Pages/Invoices/Index.cshtml new file mode 100644 index 0000000..9ad1c6c --- /dev/null +++ b/DXApp.TemplateKitProject/Pages/Invoices/Index.cshtml @@ -0,0 +1,55 @@ +@page +@model DXApp.TemplateKitProject.Pages.Invoices.IndexModel +@{ + ViewData["Title"] = "Rechnungen"; +} + +

Importierte Rechnungen

+ +@if (!Model.Invoices.Any()) +{ +
Noch keine Rechnungen importiert.
+} +else +{ + @(Html.DevExtreme().DataGrid() + .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().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); + }) + ) +} diff --git a/DXApp.TemplateKitProject/Pages/Invoices/Index.cshtml.cs b/DXApp.TemplateKitProject/Pages/Invoices/Index.cshtml.cs new file mode 100644 index 0000000..c49647a --- /dev/null +++ b/DXApp.TemplateKitProject/Pages/Invoices/Index.cshtml.cs @@ -0,0 +1,18 @@ +using DXApp.TemplateKitProject.Data; +using DXApp.TemplateKitProject.Models; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.EntityFrameworkCore; + +namespace DXApp.TemplateKitProject.Pages.Invoices; + +public class IndexModel(AppDbContext db) : PageModel +{ + public List Invoices { get; private set; } = []; + + public async Task OnGetAsync() + { + Invoices = await db.ZugferdInvoices + .OrderByDescending(i => i.ImportedAt) + .ToListAsync(); + } +} diff --git a/DXApp.TemplateKitProject/Pages/Shared/_Layout.cshtml b/DXApp.TemplateKitProject/Pages/Shared/_Layout.cshtml index 70ff7e9..e52490f 100644 --- a/DXApp.TemplateKitProject/Pages/Shared/_Layout.cshtml +++ b/DXApp.TemplateKitProject/Pages/Shared/_Layout.cshtml @@ -84,6 +84,18 @@ .Icon("info") .Option("path", GetUrl("/About")) .Selected(IsCurrentUrl("/About")); + + items.Add() + .Text("Rechnungen") + .Icon("doc") + .Option("path", GetUrl("/Invoices/Index")) + .Selected(IsCurrentUrl("/Invoices/Index")); + + items.Add() + .Text("PDF hochladen") + .Icon("upload") + .Option("path", GetUrl("/Invoices/Upload")) + .Selected(IsCurrentUrl("/Invoices/Upload")); }) .ExpandEvent(TreeViewExpandEvent.Click) .SelectionMode(NavSelectionMode.Single)