Files
btcpayserver/BTCPayServer/Views/UIWallets/_WalletTransactionsList.cshtml
d11n cd051d4093 Update transaction label display (#4700)
* Update transaction label display

* Fix test
2023-02-26 11:01:46 +09:00

108 lines
5.8 KiB
Plaintext

@model ListTransactionsViewModel
@foreach (var transaction in Model.Transactions)
{
<tr>
<td class="only-for-js">
<input name="selectedTransactions" type="checkbox" class="selector form-check-input" form="WalletActions" value="@transaction.Id" />
</td>
<td>
@transaction.Timestamp.ToBrowserDate()
</td>
<td class="text-start">
@if (transaction.Tags.Any())
{
<div class="d-flex flex-wrap gap-2 align-items-center">
@foreach (var label in transaction.Tags)
{
<div class="transaction-label" style="--label-bg:@label.Color;--label-fg:@label.TextColor;">
<a asp-route-labelFilter="@label.Text">@label.Text</a>
<form method="post" asp-action="ModifyTransaction" asp-route-walletId="@Context.GetRouteValue("walletId")">
<input type="hidden" name="transactionId" value="@transaction.Id" />
<button name="removelabel" type="submit" value="@label.Text" class="transaction-label-action">
<vc:icon symbol="remove"/>
</button>
</form>
@if (!string.IsNullOrEmpty(label.Link))
{
<a href="@label.Link" target="_blank" rel="noreferrer noopener" class="transaction-label-info transaction-details-icon"
title="@label.Tooltip"
data-bs-html="true"
data-bs-toggle="tooltip"
data-bs-custom-class="transaction-label-tooltip">
<vc:icon symbol="info"/>
</a>
}
</div>
}
</div>
}
</td>
<td class="smMaxWidth text-truncate@(transaction.IsConfirmed ? "" : " unconf")">
<a href="@transaction.Link" target="_blank" rel="noreferrer noopener">
@transaction.Id
</a>
</td>
@if (transaction.Positive)
{
<td class="text-end text-success">@transaction.Balance</td>
}
else
{
<td class="text-end text-danger">@transaction.Balance</td>
}
<td class="text-end">
<div class="dropstart d-inline-block me-2">
<span class="fa fa-tags cursor-pointer" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span>
<div class="dropdown-menu">
<form asp-action="ModifyTransaction" method="post" style="width:260px;" asp-route-walletId="@Context.GetRouteValue("walletId")">
<input type="hidden" name="transactionId" value="@transaction.Id" />
<div class="input-group input-group-sm p-2">
<input name="addlabel" placeholder="Label name" maxlength="20" type="text" class="form-control form-control-sm" />
<button type="submit" class="btn btn-primary btn-sm"><span class="fa fa-plus"></span></button>
</div>
@if (Model.Labels.Count > 0)
{
<div class="dropdown-divider"></div>
<div class="py-2 px-3 d-flex flex-wrap gap-2">
@foreach (var label in Model.Labels)
{
var isActive = transaction.Tags.Any(l => l.Text == label.Text);
<button name="@(isActive ? "removelabel" : "addlabelclick")" type="submit" value="@label.Text"
class="transaction-label@(isActive ? " active" : string.Empty)" style="--label-bg:@label.Color;--label-fg:@label.TextColor">
<span>@label.Text</span>
<span class="transaction-label-action">
<vc:icon symbol="@(isActive ? "remove" : "new")"/>
</span>
</button>
}
</div>
}
</form>
</div>
</div>
<div class="dropstart d-inline-block">
@if (string.IsNullOrEmpty(transaction.Comment))
{
<span class="fa fa-comment cursor-pointer" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span>
}
else
{
<span class="fa fa-commenting cursor-pointer" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span>
}
<div class="dropdown-menu">
<form asp-action="ModifyTransaction" method="post" style="width:260px;" asp-route-walletId="@Context.GetRouteValue("walletId")">
<input type="hidden" name="transactionId" value="@transaction.Id" />
<div class="input-group p-2">
<textarea name="addcomment" maxlength="200" rows="2" cols="20" class="form-control form-control-sm p-1">@transaction.Comment</textarea>
</div>
<div class="p-2">
<button type="submit" class="btn btn-primary btn-sm w-100">Save comment</button>
</div>
</form>
</div>
</div>
</td>
</tr>
}