2022-06-12 18:47:26 -07:00
|
|
|
@model (InvoiceDetailsModel Invoice, bool ShowAddress)
|
2023-04-04 03:59:14 +02:00
|
|
|
@{
|
|
|
|
var invoice = Model.Invoice;
|
|
|
|
var grouped = invoice.Payments
|
|
|
|
.GroupBy(payment => payment.GetPaymentMethodId()?.PaymentType)
|
|
|
|
.Where(entities => entities.Key != null);
|
|
|
|
}
|
2019-04-29 22:45:33 -05:00
|
|
|
|
2023-10-10 05:28:00 +02:00
|
|
|
@if (invoice.Overpaid)
|
|
|
|
{
|
|
|
|
var usedPaymentMethods = invoice.CryptoPayments.Count(p => p.Paid != null);
|
|
|
|
<p class="d-flex align-items-center gap-2 mb-3 text-warning">
|
|
|
|
<vc:icon symbol="warning"/>
|
|
|
|
This invoice got overpaid.
|
|
|
|
@if (usedPaymentMethods > 1)
|
|
|
|
{
|
|
|
|
@("Each payment method shows the total excess amount.")
|
|
|
|
}
|
|
|
|
</p>
|
|
|
|
}
|
2023-04-04 03:59:14 +02:00
|
|
|
<div class="invoice-payments table-responsive mt-0">
|
|
|
|
<table class="table table-hover mb-0">
|
2023-10-10 05:28:00 +02:00
|
|
|
<thead>
|
2019-08-24 16:10:13 +02:00
|
|
|
<tr>
|
2023-04-04 03:59:14 +02:00
|
|
|
<th class="text-nowrap w-175px">Payment method</th>
|
2020-03-01 19:46:05 -06:00
|
|
|
@if (Model.ShowAddress)
|
|
|
|
{
|
2023-04-04 03:59:14 +02:00
|
|
|
<th>Destination</th>
|
2020-03-01 19:46:05 -06:00
|
|
|
}
|
2023-10-10 05:28:00 +02:00
|
|
|
@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)
|
2019-08-24 16:10:13 +02:00
|
|
|
{
|
2023-04-04 03:59:14 +02:00
|
|
|
<th class="w-150px text-end">Overpaid</th>
|
2019-08-24 16:10:13 +02:00
|
|
|
}
|
2023-10-10 05:28:00 +02:00
|
|
|
<th class="w-150px text-end">Paid</th>
|
2019-09-03 13:11:36 +02:00
|
|
|
</tr>
|
2022-06-12 18:47:26 -07:00
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
@foreach (var payment in invoice.CryptoPayments)
|
2019-08-24 16:10:13 +02:00
|
|
|
{
|
2022-06-12 18:47:26 -07:00
|
|
|
<tr>
|
2023-03-26 13:44:05 +02:00
|
|
|
<td class="text-nowrap">@payment.PaymentMethod</td>
|
2022-06-12 18:47:26 -07:00
|
|
|
@if (Model.ShowAddress)
|
|
|
|
{
|
|
|
|
<td title="@payment.Address">
|
2023-04-04 03:59:14 +02:00
|
|
|
<vc:truncate-center text="@payment.Address" classes="truncate-center-id" />
|
2022-06-12 18:47:26 -07:00
|
|
|
</td>
|
|
|
|
}
|
2023-10-10 05:28:00 +02:00
|
|
|
@if (invoice.HasRates)
|
2022-06-12 18:47:26 -07:00
|
|
|
{
|
2023-10-10 05:28:00 +02:00
|
|
|
<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>
|
2022-06-12 18:47:26 -07:00
|
|
|
}
|
2023-10-10 05:28:00 +02:00
|
|
|
<td class="text-nowrap text-end">
|
|
|
|
@if (payment.Paid != null)
|
|
|
|
{
|
|
|
|
<span data-sensitive class="text-success">@payment.Paid</span>
|
|
|
|
}
|
|
|
|
</td>
|
2022-06-12 18:47:26 -07:00
|
|
|
</tr>
|
|
|
|
var details = payment.PaymentMethodRaw.GetPaymentMethodDetails();
|
|
|
|
var name = details.GetAdditionalDataPartialName();
|
|
|
|
if (!string.IsNullOrEmpty(name))
|
|
|
|
{
|
|
|
|
<partial name="@name" model="@details" />
|
|
|
|
}
|
2019-08-24 16:10:13 +02:00
|
|
|
}
|
2022-05-09 10:38:17 +02:00
|
|
|
</tbody>
|
|
|
|
</table>
|
2022-06-12 18:47:26 -07:00
|
|
|
</div>
|
2023-04-04 03:59:14 +02:00
|
|
|
@foreach (var paymentGroup in grouped)
|
|
|
|
{
|
|
|
|
<partial name="@paymentGroup.Key.InvoiceViewPaymentPartialName" model="@paymentGroup.ToList()" />
|
|
|
|
}
|