Hibajavítás hegyek

This commit is contained in:
2025-06-04 11:05:29 +02:00
parent 11aea1eb5d
commit 6839fc0b78
23 changed files with 284 additions and 146 deletions
@@ -3,7 +3,7 @@
@using Microsoft.AspNetCore.Antiforgery
@inject IAntiforgery Antiforgery
@{
ViewData["Title"] = "Ellenőrzési pont";
ViewData["Title"] = "Szabály - ellenőrzési sablon";
var RoleCheckListTemplateHeaderId = Model.RoleCheckListTemplateHeaderDTO.Id;
var urlPost = Url.Page("./RoleCheckListTemplateHeaderEditPage", "Save");
}
@@ -15,18 +15,18 @@
<thead class="table-primary">
<tr>
<th>ID</th>
<th>Role name</th>
<th>Template name</th>
<th>Enabled</th>
<th>Szabály neve</th>
<th>Ellenőrzési sablon neve</th>
<th>Engedélyezve?</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tfoot class="table-light">
<tr>
<th>ID</th>
<th>Role name</th>
<th>Template name</th>
<th>Enabled</th>
<th>Szabály neve</th>
<th>Ellenőrzési sablon neve</th>
<th>Engedélyezve?</th>
<th class="text-center">Action</th>
</tr>
</tfoot>
@@ -90,17 +90,7 @@
$('#tbRoleCheckListTemplateHeadersPage').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/RoleCheckListTemplateHeadersPage?handler=DeleteRoleCheckListTemplateHeader', row.id);
});
</script>
}
@@ -21,5 +21,10 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
var results = await _userService.GetAllRoleCheckListTemplates();
return new JsonResult(new { data = results });
}
public async Task<JsonResult> OnGetDeleteRoleCheckListTemplateHeader(int id)
{
var isSuccess = await _userService.DeleteRoleCheckListTemplateHeader(id);
return new JsonResult(new { result = isSuccess });
}
}
}
@@ -3,7 +3,7 @@
@using Microsoft.AspNetCore.Antiforgery
@inject IAntiforgery Antiforgery
@{
ViewData["Title"] = "Ellenőrzési pont";
ViewData["Title"] = "Szabály - Ellenőrzési pont";
var RoleCheckPointId = Model.RoleCheckPointDTO.Id;
var urlPost = Url.Page("./RoleCheckPointEditPage", "Save");
}
@@ -96,6 +96,8 @@
}
});
$(document).ready(function () {
const $form = $("#RoleCheckPointForm");
@@ -71,5 +71,6 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
this.RoleCheckPoints.Add(new SelectListItem() { Value = CheckPoint.Id.ToString(), Text = CheckPoint.ShortName });
}
}
}
}
@@ -3,7 +3,7 @@
@using WorkFlowCheck.Common.Helper
@using WorkFlowCheck.Common.DTO
@{
ViewData["Title"] = "Szabályok - Ellenőrzési sablonok";
ViewData["Title"] = "Szabályok - Ellenőrzési pontok";
}
<h1>@ViewData["Title"]</h1>
@@ -17,8 +17,8 @@
<thead class="table-primary">
<tr>
<th>ID</th>
<th>>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.RoleDTO.RoleName), typeof(RoleCheckPointDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.CheckPointDTO.ShortName), typeof(RoleCheckPointDTO))</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>
@@ -26,8 +26,8 @@
<tfoot class="table-light">
<tr>
<th>ID</th>
<th>>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.RoleDTO.RoleName), typeof(RoleCheckPointDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.CheckPointDTO.ShortName), typeof(RoleCheckPointDTO))</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>
@@ -91,18 +91,8 @@
$('#tbRoleCheckPointsPage').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');
}
});
const row = table.row($(this).closest('tr')).data();
deleteEntity(table, '/UserAndRole/RoleCheckPointsPage?handler=DeleteRoleCheckPoint', row.id);
});
</script>
}
@@ -21,5 +21,10 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
var results = await _userService.GetAllRoleCheckPoints();
return new JsonResult(new { data = results });
}
public async Task<JsonResult> OnGetDeleteRoleCheckPoint(int id)
{
var isSuccess = await _userService.DeleteRoleCheckPoint(id);
return new JsonResult(new { result = isSuccess });
}
}
}
@@ -3,7 +3,7 @@
@using Microsoft.AspNetCore.Antiforgery
@inject IAntiforgery Antiforgery
@{
ViewData["Title"] = "Ellenőrzési pont";
ViewData["Title"] = "Szabály szerkesztése";
var RoleId = Model.RoleDTO.Id;
var urlPost = Url.Page("./RoleEditPage", "Save");
}
@@ -140,7 +140,7 @@
$('#tbRolesPage').on('click', '.delete-btn', function ()
{
const row = table.row($(this).closest('tr')).data();
deleteEntity(table, '/UserAndRole/UserRole?handler=DeleteUser', row.id);
deleteEntity(table, '/UserAndRole/RolePage?handler=DeleteRole', row.id);
});
</script>
}
@@ -20,30 +20,46 @@
<meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" />
<input type="hidden" asp-for="UserDTO.Id" />
<input type="hidden" asp-for="UserDTO.Password" value="" />
<input type="hidden" asp-for="UserDTO.NFCCode" value="" />
<input type="hidden" asp-for="UserDTO.JwtToken" value="" />
<input type="hidden" asp-for="UserDTO.RoleDTO" value="" />
<div class="mb-3">
<label asp-for="UserDTO.UserName"></label>
<input asp-for="UserDTO.UserName" class="form-control" />
<span asp-validation-for="UserDTO.UserName" class="text-danger"></span>
</div>
@if (Model.UserDTO.Id == 0)
{
<div class="mb-3">
<label asp-for="UserDTO.UserName"></label>
<input asp-for="UserDTO.UserName" class="form-control" autocomplete="off" />
<span asp-validation-for="UserDTO.UserName" class="text-danger"></span>
</div>
}
else
{
<div class="mb-3">
<label asp-for="UserDTO.UserName"></label>
<input asp-for="UserDTO.UserName" class="form-control" readonly />
<span asp-validation-for="UserDTO.UserName" class="text-danger"></span>
</div>
}
@if (Model.UserDTO.Id == 0)
{
<div class="row">
<div class="mb-6">
<label asp-for="UserDTO.Password"></label>
<input asp-for="UserDTO.Password" class="form-control" type="password" />
<div class="mb-3">
<label asp-for="UserDTO.Password" class="form-label"></label>
<div class="input-group">
<input asp-for="UserDTO.Password" class="form-control" type="password" id="passwordInput" autocomplete="off" />
<button class="btn btn-outline-secondary" type="button" onclick="togglePasswordVisibility()" tabindex="-1">
<i class="bi bi-eye" id="toggleIcon"></i>
</button>
</div>
<span asp-validation-for="UserDTO.Password" class="text-danger"></span>
</div>
<div class="mb-6">
<label asp-for="UserDTO.NFCCode"></label>
<input asp-for="UserDTO.NFCCode" class="form-control" type="password" />
<span asp-validation-for="UserDTO.NFCCode" class="text-danger"></span>
</div>
</div>
}
<div class="mb-3">
<label asp-for="UserDTO.NFCCode"></label>
<input asp-for="UserDTO.NFCCode" class="form-control" />
<span asp-validation-for="UserDTO.NFCCode" class="text-danger"></span>
</div>
<div class="mb-3">
<label asp-for="UserDTO.Email"></label>
<input asp-for="UserDTO.Email" class="form-control" />
@@ -78,35 +94,38 @@
</div>
</form>
</div>
<br></br>
<div class="card shadow p-4">
<table id="tbUserPage" class="table table-bordered table-hover table-sm" style="width:100%">
<thead class="table-primary">
<tr>
<th>ID</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.ParentRoleName), typeof(RoleDTO))</th>
<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>
</tr>
</thead>
<tfoot class="table-light">
<tr>
<th>ID</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.ParentRoleName), typeof(RoleDTO))</th>
<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>
</tr>
</tfoot>
</table>
</div>
@if (Model.UserDTO.Id != 0)
{
<br></br>
<div class="card shadow p-4">
<table id="tbUserPage" class="table table-bordered table-hover table-sm" style="width:100%">
<thead class="table-primary">
<tr>
<th>ID</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.ParentRoleName), typeof(RoleDTO))</th>
<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>
</tr>
</thead>
<tfoot class="table-light">
<tr>
<th>ID</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.ParentRoleName), typeof(RoleDTO))</th>
<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>
</tr>
</tfoot>
</table>
</div>
}
@section Scripts {
<script>
@@ -189,6 +208,7 @@
const $form = $('#UserForm');
formData.UserDTO.RoleDTO=[];
formData.UserDTO.JwtToken='';
formData.UserDTO.Active = $('#UserForm input[name="UserDTO.Active"]').is(':checked');
formData.UserDTO.NFCActive = $('#UserForm input[name="UserDTO.NFCActive"]').is(':checked');
@@ -23,8 +23,17 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
public async Task OnGet(int id)
{
UserDTO = await _userService.GetUser(id);
if (id == 0)
{
UserDTO = new UserDTO();
}
else
{
UserDTO = await _userService.GetUser(id);
}
}
public async Task<IActionResult> OnPostSave([FromBody] UserDTO userDTO)
{
try
@@ -78,17 +78,7 @@
$('#tbUserRolesPage').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/UserRolePage?handler=DeleteUserRole', row.id);
});
</script>
}
@@ -21,5 +21,10 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
var results = await _userService.GetAllUserRoles();
return new JsonResult(new { data = results });
}
public async Task<JsonResult> OnGetDeleteUserRole(int id)
{
var results = await _userService.DeleteUserRole(id);
return new JsonResult(new { data = results });
}
}
}