btcpayserver/BTCPayServer/Views/Invoice/ListInvoicesPaymentsPartial.cshtml
Dennis Reimann 0cc24c8076
UI: Improve invoice view (#2144)
* UI: Improve invoice view

- General improvements for the spacings on the page
- Hides rows of data in case they aren't present
- Improved the PoS data view so that it renders complex objects nicely and adds links for URLs

TDB: For the last row "Links" there's now a special `_urls` property, which renders a list of urls with the key being the title and the value being the URL.

* Update BTCPayServer/Views/Invoice/Invoice.cshtml

Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>

* UI: Handle arrays in PosData view

Co-authored-by: Andrew Camilleri <evilkukka@gmail.com>
2020-12-16 09:15:33 +01:00

56 lines
2.1 KiB
Text

@using BTCPayServer.Client.Models
@model (InvoiceDetailsModel Invoice, bool ShowAddress)
@{ var invoice = Model.Invoice; }
@inject PaymentMethodHandlerDictionary PaymentMethodHandlerDictionary
<div class="row mb-4">
<div class="col-md-12 invoice-payments">
<h3 class="mb-0">Invoice Summary</h3>
<table class="table table-sm table-responsive-md">
<thead class="thead-inverse">
<tr>
<th>Payment method</th>
@if (Model.ShowAddress)
{
<th>Address</th>
}
<th class="text-right">Rate</th>
<th class="text-right">Paid</th>
<th class="text-right">Due</th>
@if (invoice.StatusException == InvoiceExceptionStatus.PaidOver)
{
<th class="text-right">Overpaid</th>
}
</tr>
</thead>
<tbody>
@foreach (var payment in invoice.CryptoPayments)
{
<tr>
<td>@payment.PaymentMethod</td>
@if (Model.ShowAddress)
{
<td title="@payment.Address">
<span class="text-truncate d-block" style="max-width: 400px">@payment.Address</span>
</td>
}
<td class="text-right">@payment.Rate</td>
<td class="text-right">@payment.Paid</td>
<td class="text-right">@payment.Due</td>
@if (invoice.StatusException == InvoiceExceptionStatus.PaidOver)
{
<td class="text-right">@payment.Overpaid</td>
}
</tr>
}
</tbody>
</table>
</div>
</div>
@{
var grouped = invoice.Payments.GroupBy(payment => payment.GetPaymentMethodId()?.PaymentType).Where(entities => entities.Key!= null);
}
@foreach (var paymentGroup in grouped)
{
<partial name="@paymentGroup.Key.InvoiceViewPaymentPartialName" model="@paymentGroup.ToList()" />
}