btcpayserver/BTCPayServer/Views/UIInvoice/ListInvoicesPaymentsPartial.cshtml
2022-01-14 13:46:03 +09:00

63 lines
2.4 KiB
Plaintext

@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-hover table-responsive-md">
<thead class="thead-inverse">
<tr>
<th>Payment method</th>
@if (Model.ShowAddress)
{
<th>Address</th>
}
<th class="text-end">Rate</th>
<th class="text-end">Paid</th>
<th class="text-end">Due</th>
@if (invoice.StatusException == InvoiceExceptionStatus.PaidOver)
{
<th class="text-end">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-end">@payment.Rate</td>
<td class="text-end">@payment.Paid</td>
<td class="text-end">@payment.Due</td>
@if (invoice.StatusException == InvoiceExceptionStatus.PaidOver)
{
<td class="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>
</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()" />
}