btcpayserver/BTCPayServer/Views/UIInvoice/ListInvoicesPaymentsPartial.cshtml
d11n 11f05285a1
Invoice Details: Improve payments list and print view (#4817)
Closes #4729.

Co-authored-by: Nicolas Dorier <nicolas.dorier@gmail.com>
2023-04-04 10:59:14 +09:00

59 lines
2.2 KiB
Text

@model (InvoiceDetailsModel Invoice, bool ShowAddress)
@{
var invoice = Model.Invoice;
var grouped = invoice.Payments
.GroupBy(payment => payment.GetPaymentMethodId()?.PaymentType)
.Where(entities => entities.Key != null);
}
<div class="invoice-payments table-responsive mt-0">
<table class="table table-hover mb-0">
<thead class="thead-inverse">
<tr>
<th class="text-nowrap w-175px">Payment method</th>
@if (Model.ShowAddress)
{
<th>Destination</th>
}
<th class="w-150px text-end">Rate</th>
<th class="w-150px text-end">Paid</th>
<th class="w-150px text-end">Due</th>
@if (invoice.Overpaid)
{
<th class="w-150px text-end">Overpaid</th>
}
</tr>
</thead>
<tbody>
@foreach (var payment in invoice.CryptoPayments)
{
<tr>
<td class="text-nowrap">@payment.PaymentMethod</td>
@if (Model.ShowAddress)
{
<td title="@payment.Address">
<vc:truncate-center text="@payment.Address" classes="truncate-center-id" />
</td>
}
<td class="text-nowrap text-end">@payment.Rate</td>
<td class="text-nowrap text-end">@payment.Paid</td>
<td class="text-nowrap text-end">@payment.Due</td>
@if (invoice.Overpaid)
{
<td class="text-nowrap text-end">@payment.Overpaid</td>
}
</tr>
var details = payment.PaymentMethodRaw.GetPaymentMethodDetails();
var name = details.GetAdditionalDataPartialName();
if (!string.IsNullOrEmpty(name))
{
<partial name="@name" model="@details" />
}
}
</tbody>
</table>
</div>
@foreach (var paymentGroup in grouped)
{
<partial name="@paymentGroup.Key.InvoiceViewPaymentPartialName" model="@paymentGroup.ToList()" />
}