Add refund badge to invoice lists (#3918)

* Add refund badge to invoice lists

* fix badge
This commit is contained in:
Andrew Camilleri
2022-07-01 06:26:00 +02:00
committed by GitHub
parent 4eabe91cee
commit 0970944ee4
9 changed files with 19 additions and 4 deletions

View File

@@ -38,6 +38,12 @@
@($"({invoice.Status.ExceptionStatus.ToString()})")
}
</span>
@if (invoice.HasRefund)
{
<span class="badge bg-warning">
Refund
</span>
}
</td>
<td class="text-end">@invoice.AmountCurrency</td>
</tr>

View File

@@ -10,4 +10,5 @@ public class StoreRecentInvoiceViewModel
public string AmountCurrency { get; set; }
public InvoiceState Status { get; set; }
public DateTimeOffset Date { get; set; }
public bool HasRefund { get; set; }
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BTCPayServer.Data;
using BTCPayServer.Services.Invoices;
@@ -39,6 +40,7 @@ public class StoreRecentInvoices : ViewComponent
UserId = userId,
StoreId = new [] { store.Id },
IncludeArchived = false,
IncludeRefunds = true,
Take = 5
});
var invoices = new List<StoreRecentInvoiceViewModel>();
@@ -49,6 +51,7 @@ public class StoreRecentInvoices : ViewComponent
{
Date = invoice.InvoiceTime,
Status = state,
HasRefund = invoice.Refunds.Any(),
InvoiceId = invoice.Id,
OrderId = invoice.Metadata.OrderId ?? string.Empty,
AmountCurrency = _currencyNameTable.DisplayFormatCurrency(invoice.Price, invoice.Currency),