2022-04-12 09:55:10 +02:00
|
|
|
@using BTCPayServer.Abstractions.Extensions
|
|
|
|
@using BTCPayServer.Client.Models
|
2023-03-13 02:12:58 +01:00
|
|
|
@using BTCPayServer.Services
|
2022-04-12 09:55:10 +02:00
|
|
|
@using BTCPayServer.Services.Invoices
|
2023-03-13 02:12:58 +01:00
|
|
|
@inject DisplayFormatter DisplayFormatter
|
2023-07-08 17:33:13 +02:00
|
|
|
@inject PaymentMethodHandlerDictionary PaymentMethodHandlerDictionary
|
2022-04-12 09:55:10 +02:00
|
|
|
@model BTCPayServer.Components.StoreRecentInvoices.StoreRecentInvoicesViewModel
|
|
|
|
|
2022-07-06 05:40:16 +02:00
|
|
|
<div class="widget store-recent-invoices" id="StoreRecentInvoices-@Model.Store.Id">
|
2022-04-12 09:55:10 +02:00
|
|
|
<header>
|
|
|
|
<h3>Recent Invoices</h3>
|
|
|
|
@if (Model.Invoices.Any())
|
|
|
|
{
|
|
|
|
<a asp-controller="UIInvoice" asp-action="ListInvoices" asp-route-storeId="@Model.Store.Id">View All</a>
|
|
|
|
}
|
|
|
|
</header>
|
2022-07-06 05:40:16 +02:00
|
|
|
@if (Model.InitialRendering)
|
|
|
|
{
|
|
|
|
<div class="loading d-flex justify-content-center p-3">
|
|
|
|
<div class="spinner-border text-light" role="status">
|
|
|
|
<span class="visually-hidden">Loading...</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
(async () => {
|
|
|
|
const url = @Safe.Json(Url.Action("RecentInvoices", "UIStores", new { storeId = Model.Store.Id, cryptoCode = Model.CryptoCode }));
|
|
|
|
const storeId = @Safe.Json(Model.Store.Id);
|
|
|
|
const response = await fetch(url);
|
|
|
|
if (response.ok) {
|
|
|
|
document.getElementById(`StoreRecentInvoices-${storeId}`).outerHTML = await response.text();
|
|
|
|
}
|
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
}
|
|
|
|
else if (Model.Invoices.Any())
|
2022-04-12 09:55:10 +02:00
|
|
|
{
|
2022-06-12 18:48:36 -07:00
|
|
|
<table class="table table-hover mt-3 mb-0">
|
2022-04-12 09:55:10 +02:00
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th class="w-125px">Date</th>
|
|
|
|
<th class="text-nowrap">Invoice Id</th>
|
|
|
|
<th>Status</th>
|
|
|
|
<th class="text-end">Amount</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
@foreach (var invoice in Model.Invoices)
|
|
|
|
{
|
|
|
|
<tr>
|
|
|
|
<td>@invoice.Date.ToTimeAgo()</td>
|
|
|
|
<td>
|
|
|
|
<a asp-controller="UIInvoice" asp-action="Invoice" asp-route-invoiceId="@invoice.InvoiceId" class="text-break">@invoice.InvoiceId</a>
|
|
|
|
</td>
|
|
|
|
<td>
|
2023-10-11 16:12:45 +02:00
|
|
|
<vc:invoice-status state="invoice.Status" payments="invoice.Details.Payments" invoice-id="@invoice.InvoiceId"
|
|
|
|
is-archived="invoice.Details.Archived" has-refund="invoice.HasRefund" />
|
2022-04-12 09:55:10 +02:00
|
|
|
</td>
|
2023-05-11 10:35:51 +02:00
|
|
|
<td class="text-end">
|
|
|
|
<span data-sensitive>@DisplayFormatter.Currency(invoice.Amount, invoice.Currency)</span>
|
|
|
|
</td>
|
2022-04-12 09:55:10 +02:00
|
|
|
</tr>
|
|
|
|
}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<p class="text-secondary my-3">
|
|
|
|
There are no recent invoices.
|
|
|
|
</p>
|
|
|
|
<a asp-controller="UIInvoice" asp-action="CreateInvoice" asp-route-storeId="@Model.Store.Id" class="fw-semibold">
|
|
|
|
Create Invoice
|
|
|
|
</a>
|
|
|
|
}
|
|
|
|
</div>
|