77 lines
1.9 KiB
Plaintext
77 lines
1.9 KiB
Plaintext
@page
|
|
@using AfRApay.Web.Backend
|
|
@model IndexModel
|
|
@{
|
|
ViewData["Title"] = "Index";
|
|
var db = new Database.DbConn();
|
|
}
|
|
|
|
@section Stylesheets {
|
|
<link rel="stylesheet" href="~/lib/datatables/dataTables.bootstrap5.min.css"/>
|
|
}
|
|
|
|
@section Scripts {
|
|
<script src="~/lib/datatables/jquery.dataTables.min.js"></script>
|
|
<script src="~/lib/datatables/dataTables.bootstrap5.min.js"></script>
|
|
<script>
|
|
$(document).ready( function () {
|
|
let search = "";
|
|
if (window.location.hash.startsWith("#")) {
|
|
search = decodeURI(window.location.hash.substring(1));
|
|
}
|
|
|
|
$('#users').DataTable({
|
|
lengthMenu: [10, 25, 50, 100, -1],
|
|
pageLength: 25,
|
|
search: {
|
|
search: search,
|
|
}
|
|
});
|
|
} );
|
|
</script>
|
|
}
|
|
|
|
<div class="text-center">
|
|
<h1 class="display-5">
|
|
Users
|
|
<a class="btn btn-lg btn-primary" href="/AddUser">Add</a>
|
|
|
|
</h1>
|
|
</div>
|
|
<div>
|
|
<table class="table table-striped table-hover" id="users">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Nickame</th>
|
|
<th scope="col">Balance</th>
|
|
<th scope="col">Cards</th>
|
|
<th scope="col">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var user in db.Users.OrderBy(p => p.Nickname.ToLower())) {
|
|
<tr id="user_@user.Id">
|
|
<td>
|
|
<b>@user.Nickname</b>
|
|
</td>
|
|
<td>
|
|
@($"{user.Balance:C}")
|
|
</td>
|
|
<td>
|
|
<b>@db.Cards.Count(p => p.UserId == user.Id)</b> cards linked.
|
|
</td>
|
|
<td>
|
|
<div class="btn-group" role="group">
|
|
<a class="btn btn-sm btn-danger" href="/UpdateBalance/@user.Id/-1.50">-1.50€</a>
|
|
<a class="btn btn-sm btn-success" href="/UpdateBalance/@user.Id/5">+5€</a>
|
|
<a class="btn btn-sm btn-success" href="/UpdateBalance/@user.Id/10">+10€</a>
|
|
<a class="btn btn-sm btn-secondary" href="/LinkCard/@user.Id">Link card</a>
|
|
<a class="btn btn-sm btn-primary" href="/EditUser/@user.Id">Edit</a>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|