Files
WorkFlowCheck/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckPointsPage.cshtml
T
2025-06-04 11:05:29 +02:00

99 lines
3.9 KiB
Plaintext

@page
@model WorkFlowCheck.Web.Pages.UserAndRole.RoleCheckPointsPageModel
@using WorkFlowCheck.Common.Helper
@using WorkFlowCheck.Common.DTO
@{
ViewData["Title"] = "Szabályok - Ellenőrzési pontok";
}
<h1>@ViewData["Title"]</h1>
<div class="card shadow p-4">
<div class="d-flex justify-content-end">
<button id="newRoleCheckPointsBtn" 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="tbRoleCheckPointsPage" class="table table-bordered table-hover table-sm" style="width:100%">
<thead class="table-primary">
<tr>
<th>ID</th>
<th>Szabály @DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))</th>
<th>Ellenőrzési pont @DisplayNameHelper.GetDisplayName(nameof(CheckPointDTO.ShortName), typeof(CheckPointDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.Enabled), typeof(RoleCheckPointDTO))</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tfoot class="table-light">
<tr>
<th>ID</th>
<th>Szabály @DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))</th>
<th>Ellenőrzési pont @DisplayNameHelper.GetDisplayName(nameof(CheckPointDTO.ShortName), typeof(CheckPointDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.Enabled), typeof(RoleCheckPointDTO))</th>
<th class="text-center">Action</th>
</tr>
</tfoot>
</table>
</div>
@section Scripts {
<script>
const table = new DataTable('#tbRoleCheckPointsPage', {
ajax: {
url: "@Url.Page("./RoleCheckPointsPage", "LoadRoleCheckPoints")",
type: "GET",
dataSrc : "data"
},
columns: [
{ data: "id" },
{ data: "roleDTO.roleName" },
{ data: "CheckPointDTO.description" },
{
data: "enabled",
searchable: false,
sortable: false,
className: "text-center",
render: function ( data, type, row ) {
return renderCheckBox(data);
}
},
{ data: null, render: function (data, type, row) {
return renderActionButtons(row.id);
}}
],
columnDefs: [
{
"targets": 0,
"visible": false
},
{
"targets": 4,
"className": "text-center",
"width": "10%"
}
],
processing:true,
language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
});
$('#newRoleCheckPointsBtn').on('click', function ()
{
console.log('New button clicked!"');
window.location.href = `@Url.Page("./RoleCheckPointEditPage")?id=0`;
});
$('#tbRoleCheckPointsPage').on('click', '.edit-btn', function ()
{
const row = table.row($(this).closest('tr')).data();
window.location.href = `@Url.Page("./RoleCheckPointEditPage")?id=${row.id}`;
});
$('#tbRoleCheckPointsPage').on('click', '.delete-btn', function ()
{
const row = table.row($(this).closest('tr')).data();
deleteEntity(table, '/UserAndRole/RoleCheckPointsPage?handler=DeleteRoleCheckPoint', row.id);
});
</script>
}