Felhasználó és szabály törlésének befejezése

This commit is contained in:
2025-04-10 13:37:39 +02:00
parent 7109da0d95
commit cd57fc46bc
16 changed files with 1218 additions and 39 deletions
@@ -26,14 +26,14 @@
<span asp-validation-for="RoleDTO.RoleName" class="text-danger"></span>
</div>
<div class="row">
<div class="col-4">
<div class="col-2">
<div class="mb-3">
<label asp-for="RoleDTO.IsAdmin"></label>
<input type="checkbox" asp-for="RoleDTO.IsAdmin" class="form-check-input" />
<span asp-validation-for="RoleDTO.IsAdmin" class="text-danger"></span>
</div>
</div>
<div class="col-4">
<div class="col-2">
<div class="mb-3">
<label asp-for="RoleDTO.CanDownloadAPK"></label>
<input type="checkbox" asp-for="RoleDTO.CanDownloadAPK" class="form-check-input" />
@@ -47,6 +47,20 @@
<span asp-validation-for="RoleDTO.CanEnableBlocked" class="text-danger"></span>
</div>
</div>
<div class="col-2">
<div class="mb-3">
<label asp-for="RoleDTO.CanUseMobilApp"></label>
<input type="checkbox" asp-for="RoleDTO.CanUseMobilApp" class="form-check-input" />
<span asp-validation-for="RoleDTO.CanUseMobilApp" class="text-danger"></span>
</div>
</div>
<div class="col-2">
<div class="mb-3">
<label asp-for="RoleDTO.CanUseWebAdmin"></label>
<input type="checkbox" asp-for="RoleDTO.CanUseWebAdmin" class="form-check-input" />
<span asp-validation-for="RoleDTO.CanUseWebAdmin" class="text-danger"></span>
</div>
</div>
</div>
<hr class="mt-4 mb-3 border-secondary">
<div class="mb-3 d-flex justify-content-between">
@@ -66,6 +80,8 @@
formData.RoleDTO.IsAdmin = $('#RoleForm input[name="RoleDTO.IsAdmin"]').is(':checked');
formData.RoleDTO.CanDownloadAPK = $('#RoleForm input[name="RoleDTO.CanDownloadAPK"]').is(':checked');
formData.RoleDTO.CanEnableBlocked = $('#RoleForm input[name="RoleDTO.CanEnableBlocked"]').is(':checked');
formData.RoleDTO.CanUseMobilApp = $('#RoleForm input[name="RoleDTO.CanUseMobilApp"]').is(':checked');
formData.RoleDTO.CanUseWebAdmin = $('#RoleForm input[name="RoleDTO.CanUseWebAdmin"]').is(':checked');
if ($form.valid())
{
@@ -23,6 +23,8 @@
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.IsAdmin), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanEnableBlocked), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanDownloadAPK), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseMobilApp), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseWebAdmin), typeof(RoleDTO))</th>
<th class="text-center">Action</th>
</tr>
</thead>
@@ -34,6 +36,8 @@
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.IsAdmin), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanEnableBlocked), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanDownloadAPK), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseMobilApp), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseWebAdmin), typeof(RoleDTO))</th>
<th>Action</th>
</tr>
</tfoot>
@@ -82,6 +86,25 @@
}
},
{
data: "canUseMobilApp",
searchable: false,
sortable: false,
className: "text-center",
render: function ( data, type, row ) {
return renderCheckBox(data);
}
},
{
data: "canUseWebAdmin",
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);
}}
@@ -92,7 +115,7 @@
"visible": false
},
{
"targets": 6,
"targets": 8,
"className": "text-center",
"width": "10%"
}
@@ -117,17 +140,7 @@
$('#tbRolesPage').on('click', '.delete-btn', function ()
{
const row = table.row($(this).closest('tr')).data();
console.log(row);
showConfirmModal({
title: 'Törlés megerősítése',
message: 'Biztosan törölni szeretnéd ezt az elemet?',
okText: 'Törlés',
cancelText: 'Mégsem'
}).then(function(result) {
if(result === 'ok') {
console.log('Törlés végrehajtva');
}
});
deleteEntity(table, '/UserAndRole/UserRole?handler=DeleteUser', row.id);
});
</script>
}
@@ -21,5 +21,10 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
var results = await _userService.GetAllRoles();
return new JsonResult(new { data = results });
}
public async Task<JsonResult> OnGetDeleteRole(int id)
{
var isSuccess = await _userService.DeleteRole(id);
return new JsonResult(new { result = isSuccess });
}
}
}
@@ -110,17 +110,7 @@
$('#tbUsersPage').on('click', '.delete-btn', function ()
{
const row = table.row($(this).closest('tr')).data();
console.log(row);
showConfirmModal({
title: 'Törlés megerősítése',
message: 'Biztosan törölni szeretnéd ezt az elemet?',
okText: 'Törlés',
cancelText: 'Mégsem'
}).then(function(result) {
if(result === 'ok') {
console.log('Törlés végrehajtva');
}
});
deleteEntity(table, '/UserAndRole/UserPage?handler=DeleteUser', row.id);
});
</script>
}
@@ -22,5 +22,10 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
var results = await _userService.GetAllUsers();
return new JsonResult(new { data = results });
}
public async Task<JsonResult> OnGetDeleteUser(int id)
{
var isSuccess = await _userService.DeleteUser(id);
return new JsonResult(new { result = isSuccess });
}
}
}