Compare commits

..

2 Commits

Author SHA1 Message Date
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
OlgunR
8e329c2b50 Relocate "Result-PDF" success message in Upload.cshtml
The code block displaying the "Result-PDF" success message was removed from its original location and reintroduced in a different section of the `Upload.cshtml` file. The new placement is after the success message confirming that the invoice was saved in the database. The functionality and alert structure remain unchanged, displaying the file path of the generated PDF if `Model.ResultFilePath` is not empty.
2026-05-28 11:41:00 +02:00
4 changed files with 83 additions and 7 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>
}

View File

@@ -0,0 +1,22 @@
using DXApp.TemplateKitProject.Data;
using DXApp.TemplateKitProject.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
namespace DXApp.TemplateKitProject.Pages.Invoices;
public class DetailsModel(AppDbContext db) : PageModel
{
public ZugferdInvoice? Invoice { get; private set; }
public async Task<IActionResult> OnGetAsync(int id)
{
Invoice = await db.ZugferdInvoices.FirstOrDefaultAsync(i => i.Id == id);
if (Invoice is null)
return NotFound();
return Page();
}
}

View File

@@ -27,6 +27,16 @@ else
)
.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")

View File

@@ -40,13 +40,6 @@
{
<strong>⚠ Kein ZUGFeRD-XML gefunden.</strong>
}
@if (!string.IsNullOrEmpty(Model.ResultFilePath))
{
<div class="alert alert-success mt-2">
📦 <strong>Result-PDF erstellt:</strong>
<small class="text-muted">@Model.ResultFilePath</small>
</div>
}
</div>
@* PDF/A-Konformitätsstufe anzeigen *@
@@ -104,6 +97,13 @@
<tr><th>Importiert am</th><td>@Model.ImportedInvoice.ImportedAt.ToString("dd.MM.yyyy HH:mm")</td></tr>
</table>
<div class="alert alert-success mt-2">✔ Rechnung wurde in der Datenbank gespeichert (ID: @Model.ImportedInvoice.Id)</div>
@if (!string.IsNullOrEmpty(Model.ResultFilePath))
{
<div class="alert alert-success mt-2">
📦 <strong>Result-PDF erstellt:</strong>
<small class="text-muted">@Model.ResultFilePath</small>
</div>
}
@if (Model.IsDuplicate)
{
<div class="alert alert-warning mt-2">