btcpayserver/BTCPayServer/Views/UIInvoice/ListInvoicesPaymentsPartial.cshtml
2024-04-04 16:31:04 +09:00

100 lines
3.6 KiB
Text

@using BTCPayServer.Payments
@inject PaymentMethodViewProvider paymentMethodViewProvider
@model (InvoiceDetailsModel Invoice, bool ShowAddress)
@{
var invoice = Model.Invoice;
}
@if (invoice.Overpaid)
{
var usedPaymentMethods = invoice.CryptoPayments.Count(p => p.Paid != null);
<p class="info-note text-warning">
<vc:icon symbol="warning"/>
This invoice got overpaid.
@if (usedPaymentMethods > 1)
{
@("Each payment method shows the total excess amount.")
}
</p>
}
<div class="invoice-payments table-responsive mt-0">
<table class="table table-hover mb-0">
<thead>
<tr>
<th class="text-nowrap w-175px">Payment method</th>
@if (Model.ShowAddress)
{
<th>Destination</th>
}
@if (invoice.HasRates)
{
<th class="w-150px text-end">Rate</th>
}
<th class="w-150px text-end">Total due</th>
@if (invoice.StillDue)
{
<th class="w-150px text-end">Still due</th>
}
else if (invoice.Overpaid)
{
<th class="w-150px text-end">Overpaid</th>
}
<th class="w-150px text-end">Paid</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>
}
@if (invoice.HasRates)
{
<td class="text-nowrap text-end">
<span data-sensitive>@payment.Rate</span>
</td>
}
<td class="text-nowrap text-end">
<span data-sensitive>@payment.TotalDue</span>
</td>
@if (invoice.StillDue)
{
<td class="text-nowrap text-end">
@if (payment.Due != null)
{
<span data-sensitive>@payment.Due</span>
}
</td>
}
else if (invoice.Overpaid)
{
<td class="text-nowrap text-end">
@if (payment.Overpaid != null)
{
<span data-sensitive class="text-warning">@payment.Overpaid</span>
}
</td>
}
<td class="text-nowrap text-end">
@if (payment.Paid != null)
{
<span data-sensitive class="text-success">@payment.Paid</span>
}
</td>
</tr>
var vvm = paymentMethodViewProvider.TryGetViewViewModel(payment.PaymentMethodRaw, "AdditionalPaymentMethodDetails");;
if (vvm != null)
{
<partial name="@((string)vvm.View)" model="@vvm.ViewModel" />
}
}
</tbody>
</table>
</div>
<vc:ui-extension-point location="store-invoices-payments" model="@invoice.Payments" />