Layout Updates
This commit is contained in:
@@ -21,9 +21,10 @@
|
||||
@($"{invoice.TotalNetto:N2} €") Netto<br />
|
||||
</p>
|
||||
<a href="@($"edit/{invoice.InvoiceId}")" class="btn btn-sm btn-primary">Bearbeiten</a>
|
||||
<button class="btn btn-sm btn-info" @onclick="() => GenerateDocumentAsync(invoice)"><i class="fas fa-file-pdf"></i></button>
|
||||
@if (invoice.DeletionAllowed)
|
||||
{
|
||||
<button class="btn btn-sm btn-danger" style="margin-left: .5rem;" @onclick="() => DeleteInvoiceAsync(invoice.InvoiceId)">Löschen</button>
|
||||
<button class="btn btn-sm btn-danger" style="margin-left: .5rem;" @onclick="() => DeleteInvoiceAsync(invoice.InvoiceId)"><i class="fas fa-trash"></i></button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using QuestPDF.Fluent;
|
||||
using QuestPDF.Infrastructure;
|
||||
using Server.Data;
|
||||
using Server.Model;
|
||||
|
||||
@@ -19,6 +21,7 @@ namespace Server.Components.Pages
|
||||
{
|
||||
parameters.SetParameterProperties(this);
|
||||
|
||||
await SettingsData.LoadAsync();
|
||||
Invoices = await InvoiceData.LoadAllAsync();
|
||||
|
||||
await base.SetParametersAsync(ParameterView.Empty);
|
||||
@@ -41,5 +44,22 @@ namespace Server.Components.Pages
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Method GenerateDocumentAsync
|
||||
|
||||
/// <summary>
|
||||
/// Generates a PDF document asynchronously for the given invoice.
|
||||
/// </summary>
|
||||
/// <param name="invoice">The invoice model for which to generate the document.</param>
|
||||
/// <returns>A task representing the asynchronous document generation operation.</returns>
|
||||
private Task GenerateDocumentAsync(InvoiceModel invoice)
|
||||
{
|
||||
QuestPDF.Settings.License = LicenseType.Community;
|
||||
var doc = new InvoiceDocument(invoice);
|
||||
doc.GeneratePdfAndShow();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user