btcpayserver/BTCPayServer/Views/Notifications/Index.cshtml
2020-06-14 23:49:08 -05:00

83 lines
3.3 KiB
Text

@model BTCPayServer.Models.NotificationViewModels.IndexViewModel
@{
ViewData["Title"] = "Notifications";
}
@section HeadScripts {
<script src="~/modal/btcpay.js" asp-append-version="true"></script>
}
<section>
<div class="container">
@if (TempData.HasStatusMessage())
{
<div class="row">
<div class="col-lg-12 text-center">
<partial name="_StatusMessage" />
</div>
</div>
}
<div class="row">
<div class="col-lg-12 section-heading">
<h2>@ViewData["Title"]</h2>
<hr class="primary">
</div>
</div>
<div class="row button-row">
<div class="col-lg-6">
<a asp-action="Generate" class="btn btn-primary" role="button" id="Generate"><span class="fa fa-plus"></span> Generate Test Notification</a>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<table class="table table-sm table-responsive-md">
<thead>
<tr>
<th width="165px">Date</th>
<th>Message</th>
<th width="70px">&nbsp;</th>
<th width="70px">&nbsp;</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Items)
{
@* TODO: Multiselect akin to Gmail *@
<tr onclick="rowseen(this)" data-guid="@item.Id">
<td class="cursor-pointer @(item.Seen ? "": "font-weight-bold")">@item.Created.ToBrowserDate()</td>
<td class="cursor-pointer @(item.Seen ? "": "font-weight-bold")">@item.Body</td>
<td>
@if (!String.IsNullOrEmpty(item.ActionLink))
{
<a href="@item.ActionLink">Action</a>
}
else
{
<span>&nbsp;</span>
}
</td>
<td>
<a asp-action="Delete" asp-route-id="@item.Id" onclick="return confirm('Are you sure you want to delete this notification');"><span class="fa fa-trash-o" title="Delete"></span></a>
</td>
</tr>
}
</tbody>
</table>
<nav aria-label="...">
<ul class="pagination">
</ul>
</nav>
</div>
</div>
</div>
</section>
<script type="text/javascript">
function rowseen(sender) {
var weightClassName = "font-weight-bold";
$(sender).children().eq(0).toggleClass(weightClassName);
$(sender).children().eq(1).toggleClass(weightClassName);
$.post("/Notifications/FlipRead/" + $(sender).data("guid"), function (data) {
});
}
</script>