2022-04-12 09:55:10 +02:00
|
|
|
@using BTCPayServer.Abstractions.Extensions
|
2023-03-13 02:12:58 +01:00
|
|
|
@using BTCPayServer.Services
|
|
|
|
@inject DisplayFormatter DisplayFormatter
|
2022-04-12 09:55:10 +02:00
|
|
|
@model BTCPayServer.Components.StoreRecentTransactions.StoreRecentTransactionsViewModel
|
|
|
|
|
2022-07-06 05:40:16 +02:00
|
|
|
<div class="widget store-recent-transactions" id="StoreRecentTransactions-@Model.Store.Id">
|
2022-04-12 09:55:10 +02:00
|
|
|
<header>
|
|
|
|
<h3>Recent Transactions</h3>
|
|
|
|
@if (Model.Transactions.Any())
|
|
|
|
{
|
|
|
|
<a asp-controller="UIWallets" asp-action="WalletTransactions" asp-route-walletId="@Model.WalletId">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("RecentTransactions", "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(`StoreRecentTransactions-${storeId}`).outerHTML = await response.text();
|
|
|
|
}
|
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
}
|
|
|
|
else if (Model.Transactions.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>Transaction</th>
|
|
|
|
<th class="text-end">Amount</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
@foreach (var tx in Model.Transactions)
|
|
|
|
{
|
|
|
|
<tr>
|
|
|
|
<td>@tx.Timestamp.ToTimeAgo()</td>
|
|
|
|
<td>
|
|
|
|
<a href="@tx.Link" target="_blank" rel="noreferrer noopener" class="text-break">
|
|
|
|
@tx.Id
|
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
@if (tx.Positive)
|
|
|
|
{
|
2023-03-13 02:12:58 +01:00
|
|
|
<td class="text-end text-success">@DisplayFormatter.Currency(tx.Balance, tx.Currency)</td>
|
2022-04-12 09:55:10 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-03-13 02:12:58 +01:00
|
|
|
<td class="text-end text-danger">@DisplayFormatter.Currency(tx.Balance, tx.Currency)</td>
|
2022-04-12 09:55:10 +02:00
|
|
|
}
|
|
|
|
</tr>
|
|
|
|
}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<p class="text-secondary mt-3 mb-0">
|
|
|
|
There are no recent transactions.
|
|
|
|
</p>
|
|
|
|
}
|
|
|
|
</div>
|