Add overpaid column Fix #149

This commit is contained in:
nicolas.dorier 2018-05-04 02:01:43 +09:00
parent 6dc4bfaefe
commit 3ab69046b0
3 changed files with 18 additions and 7 deletions

View file

@ -75,6 +75,7 @@ namespace BTCPayServer.Controllers
cryptoPayment.PaymentMethod = ToString(paymentMethodId); cryptoPayment.PaymentMethod = ToString(paymentMethodId);
cryptoPayment.Due = accounting.Due.ToString() + $" {paymentMethodId.CryptoCode}"; cryptoPayment.Due = accounting.Due.ToString() + $" {paymentMethodId.CryptoCode}";
cryptoPayment.Paid = accounting.CryptoPaid.ToString() + $" {paymentMethodId.CryptoCode}"; cryptoPayment.Paid = accounting.CryptoPaid.ToString() + $" {paymentMethodId.CryptoCode}";
cryptoPayment.Overpaid = (accounting.DueUncapped > Money.Zero ? Money.Zero : -accounting.DueUncapped).ToString() + $" {paymentMethodId.CryptoCode}";
var onchainMethod = data.GetPaymentMethodDetails() as Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod; var onchainMethod = data.GetPaymentMethodDetails() as Payments.Bitcoin.BitcoinLikeOnChainPaymentMethod;
if (onchainMethod != null) if (onchainMethod != null)

View file

@ -18,6 +18,7 @@ namespace BTCPayServer.Models.InvoicingModels
public string Address { get; internal set; } public string Address { get; internal set; }
public string Rate { get; internal set; } public string Rate { get; internal set; }
public string PaymentUrl { get; internal set; } public string PaymentUrl { get; internal set; }
public string Overpaid { get; set; }
} }
public class AddressModel public class AddressModel
{ {

View file

@ -11,6 +11,7 @@
.smMaxWidth { .smMaxWidth {
max-width: 200px; max-width: 200px;
} }
@@media (min-width: 768px) { @@media (min-width: 768px) {
.smMaxWidth { .smMaxWidth {
max-width: 400px; max-width: 400px;
@ -166,10 +167,14 @@
<th class="text-right">Rate</th> <th class="text-right">Rate</th>
<th class="text-right">Paid</th> <th class="text-right">Paid</th>
<th class="text-right">Due</th> <th class="text-right">Due</th>
@if(Model.StatusException == "paidOver")
{
<th class="text-right">Overpaid</th>
}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach (var payment in Model.CryptoPayments) @foreach(var payment in Model.CryptoPayments)
{ {
<tr> <tr>
<td>@payment.PaymentMethod</td> <td>@payment.PaymentMethod</td>
@ -177,13 +182,17 @@
<td class="text-right">@payment.Rate</td> <td class="text-right">@payment.Rate</td>
<td class="text-right">@payment.Paid</td> <td class="text-right">@payment.Paid</td>
<td class="text-right">@payment.Due</td> <td class="text-right">@payment.Due</td>
@if(Model.StatusException == "paidOver")
{
<td class="text-right">@payment.Overpaid</td>
}
</tr> </tr>
} }
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
@if (Model.OnChainPayments.Count > 0) @if(Model.OnChainPayments.Count > 0)
{ {
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@ -198,7 +207,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach (var payment in Model.OnChainPayments) @foreach(var payment in Model.OnChainPayments)
{ {
var replaced = payment.Replaced ? "class='linethrough'" : ""; var replaced = payment.Replaced ? "class='linethrough'" : "";
<tr @replaced> <tr @replaced>
@ -217,7 +226,7 @@
</div> </div>
</div> </div>
} }
@if (Model.OffChainPayments.Count > 0) @if(Model.OffChainPayments.Count > 0)
{ {
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@ -230,7 +239,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach (var payment in Model.OffChainPayments) @foreach(var payment in Model.OffChainPayments)
{ {
<tr> <tr>
<td>@payment.Crypto</td> <td>@payment.Crypto</td>
@ -253,7 +262,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach (var address in Model.Addresses) @foreach(var address in Model.Addresses)
{ {
var current = address.Current ? "font-weight-bold" : ""; var current = address.Current ? "font-weight-bold" : "";
<tr> <tr>
@ -277,7 +286,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach (var evt in Model.Events) @foreach(var evt in Model.Events)
{ {
<tr> <tr>
<td>@evt.Timestamp</td> <td>@evt.Timestamp</td>