Files
WorkFlowCheck/src/WorkFlowCheck.Web/Pages/UserAndRole/UserPage.cshtml
T

117 lines
4.5 KiB
Plaintext

@page
@model WorkFlowCheck.Web.Pages.UserAndRole.UserPageModel
@using WorkFlowCheck.Common.Helper
@using WorkFlowCheck.Common.DTO
@{
ViewData["Title"] = "Felhasználók";
}
<h1>@ViewData["Title"]</h1>
<div class="card shadow p-4">
<div class="d-flex justify-content-end">
<button id="newUserBtn" class="btn btn-primary float-right new-btn" data-bs-toggle="tooltip" data-bs-placement="top" title="Új felhasználó">
<i class="bi bi-plus-square"></i>
</button>
</div>
<table id="tbUsersPage" class="table table-bordered table-hover table-sm" style="width:100%">
<thead class="table-primary">
<tr>
<th>ID</th>
<th>@DisplayNameHelper.GetDisplayName("Active", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("NFCActive", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("FirstName", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("LastName", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("UserName", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("Email", typeof(UserDTO))</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tfoot class="table-light">
<tr>
<th>ID</th>
<th>@DisplayNameHelper.GetDisplayName("Active", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("NFCActive", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("FirstName", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("LastName", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("UserName", typeof(UserDTO))</th>
<th>@DisplayNameHelper.GetDisplayName("Email", typeof(UserDTO))</th>
<th>Action</th>
</tr>
</tfoot>
</table>
</div>
@section Scripts {
<script>
const table = new DataTable('#tbUsersPage', {
ajax: {
url: "@Url.Page("./UserPage", "LoadUsers")",
type: "GET",
dataSrc : "data"
},
columns: [
{ data: "id" },
{
data: "active",
searchable: false,
sortable: false,
className: "text-center",
render: function ( data, type, row ) {
return renderCheckBox(data);
}
},
{
data: "nfcActive",
searchable: false,
sortable: false,
className: "text-center",
render: function ( data, type, row ) {
return renderCheckBox(data);
}
},
{ data: "firstName" },
{ data: "lastName" },
{ data: "userName" },
{ data: "email" },
{ data: null, render: function (data, type, row) {
return renderActionButtons(row.id);
}}
],
columnDefs: [
{
"targets": 0,
"visible": false
},
{
"targets": 7,
"className": "text-center",
"width": "10%"
}
],
processing:true,
language: { url: '/lib/datatables/datatables.hu.json',}
});
$('#newUserBtn').on('click', function ()
{
console.log('New button clicked!"');
window.location.href = `@Url.Page("./UserEditPage")?id=0`;
});
$('#tbUsersPage').on('click', '.edit-btn', function ()
{
const row = table.row($(this).closest('tr')).data();
window.location.href = `@Url.Page("./UserEditPage")?id=${row.id}`;
});
$('#tbUsersPage').on('click', '.delete-btn', function ()
{
const row = table.row($(this).closest('tr')).data();
deleteEntity(table, '/UserAndRole/UserPage?handler=DeleteUser', row.id);
});
</script>
}