btcpayserver/BTCPayServer/Views/Server/ListUsers.cshtml
2019-11-14 18:42:49 +01:00

91 lines
2.9 KiB
Plaintext

@model UsersViewModel
@{
ViewData.SetActivePageAndTitle(ServerNavPages.Users);
}
<partial name="_StatusMessage" />
<div class="row button-row">
<div class="col align-self-center">Total Users: @Model.Total</div>
<div class="col text-right">
<a asp-controller="Account"
asp-action="Register"
asp-route-returnUrl="@Context.Request.GetCurrentPath()"
asp-route-logon="false"
asp-route-useBasicLayout="true"
class="btn btn-primary"
role="button">
<span class="fa fa-plus"></span> Add User
</a>
</div>
</div>
<table class="table table-sm table-responsive-md">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach (var user in Model.Users)
{
<tr>
<td>@user.Name</td>
<td>@user.Email</td>
<td><a asp-action="User" asp-route-userId="@user.Id">Edit</a> <span> - </span> <a asp-action="DeleteUser" asp-route-userId="@user.Id">Remove</a></td>
</tr>
}
</tbody>
</table>
<nav aria-label="..." class="w-100">
<ul class="pagination float-left">
<li class="page-item @(Model.Skip == 0 ? "disabled" : null)">
<a class="page-link" tabindex="-1" href="@listUsers(-1, Model.Count)">&laquo;</a>
</li>
<li class="page-item disabled">
<span class="page-link">@(Model.Skip + 1) to @(Model.Skip + Model.Users.Count) of @Model.Total</span>
</li>
<li class="page-item @(Model.Total > (Model.Skip + Model.Users.Count) ? null : "disabled")">
<a class="page-link" href="@listUsers(1, Model.Count)">&raquo;</a>
</li>
</ul>
<ul class="pagination float-right">
<li class="page-item disabled">
<span class="page-link">Page Size:</span>
</li>
<li class="page-item @(Model.Count == 50 ? "active" : null)">
<a class="page-link" href="@listUsers(0, 50)">50</a>
</li>
<li class="page-item @(Model.Count == 100 ? "active" : null)">
<a class="page-link" href="@listUsers(0, 100)">100</a>
</li>
<li class="page-item @(Model.Count == 250 ? "active" : null)">
<a class="page-link" href="@listUsers(0, 250)">250</a>
</li>
<li class="page-item @(Model.Count == 500 ? "active" : null)">
<a class="page-link" href="@listUsers(0, 500)">500</a>
</li>
</ul>
</nav>
@{
string listUsers(int prevNext, int count)
{
var skip = Model.Skip;
if (prevNext == -1)
skip = Math.Max(0, Model.Skip - Model.Count);
else if (prevNext == 1)
skip = Model.Skip + count;
var act = Url.Action("ListUsers", new
{
skip = skip,
count = count,
});
return act;
}
}