RoleCheckPoint

This commit is contained in:
2025-03-31 11:55:24 +02:00
parent d7c198acfa
commit 56f17681be
26 changed files with 1511 additions and 20 deletions
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.Web.Services.Interfaces;
@@ -12,7 +13,7 @@ namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader
[BindProperty]
public CheckListHeaderDTO CheckListHeaderDTO { get; set; }
public List<SelectListItem> CheckStatus { get; set; }
public CheckListHeaderEditPageModel(ILogger<IndexModel> logger, ICheckListService checkListService)
{
@@ -22,6 +23,7 @@ namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader
public async Task OnGet(int id)
{
CheckListHeaderDTO = await _checkListService.GetCheckListHeader(id);
CheckStatus = _checkListService.GetCheckStatus();
}
public async Task<JsonResult> OnGetLoadCheckListRows(int id)
{
@@ -1,7 +1,7 @@
@page
@model WorkFlowCheck.Web.Pages.CheckList.CheckListHeader.CheckListHeaderPageModel
@{
ViewData["Title"] = "Ellenőrzési sablonok";
ViewData["Title"] = "Ellenőrzések";
}
<h1>@ViewData["Title"]</h1>
@@ -1,5 +1,9 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using System.ComponentModel.DataAnnotations;
using System.Reflection;
using WorkFlowCheck.Common.Enums;
using WorkFlowCheck.Web.Services.Interfaces;
namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader
@@ -8,6 +12,9 @@ namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader
{
private readonly ILogger<IndexModel> _logger;
private readonly ICheckListService _checkListService;
public List<SelectListItem> CheckStatus { get; set; }
public CheckListHeaderPageModel(ILogger<IndexModel> logger, ICheckListService checkListService)
{
_logger = logger;
@@ -15,7 +22,10 @@ namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader
}
public async Task OnGet()
{
CheckStatus = _checkListService.GetCheckStatus();
}
public async Task<JsonResult> OnGetLoadCheckListHeaders()
{
var results = await _checkListService.GetAllCheckListHeaderAsync();
@@ -151,7 +151,7 @@
<script src="https://cdn.jsdelivr.net/npm/jquery-validation@1.19.5/dist/jquery.validate.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery-validation-unobtrusive@4.0.0/dist/jquery.validate.unobtrusive.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
@* <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script> *@
@await RenderSectionAsync("Scripts", required: false)
<partial name="_ValidationScriptsPartial" />
@@ -0,0 +1,112 @@
@page
@model WorkFlowCheck.Web.Pages.UserAndRole.RoleCheckPointsPageModel
@{
ViewData["Title"] = "Szabályok - Ellenőrzési sablonok";
}
<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>Role name</th>
<th>Checkpoint name</th>
<th>Enabled</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tfoot class="table-light">
<tr>
<th>ID</th>
<th>Role name</th>
<th>Checkpoint name</th>
<th>Enabled</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 ) {
if (data === true) {
return '<input type="checkbox" class="editor-active" disabled checked>';
}
if (data === false) {
return '<input type="checkbox" class="editor-active" disabled>';
}
return 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();
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');
}
});
});
</script>
}
@@ -0,0 +1,25 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using WorkFlowCheck.Web.Services.Interfaces;
namespace WorkFlowCheck.Web.Pages.UserAndRole
{
public class RoleCheckPointsPageModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
private readonly IUserService _userService;
public RoleCheckPointsPageModel(ILogger<IndexModel> logger, IUserService userService)
{
_logger = logger;
_userService = userService;
}
public async Task OnGet()
{
}
public async Task<JsonResult> OnGetLoadRoleCheckPoints()
{
var results = await _userService.GetAllRoleCheckListTemplates();
return new JsonResult(new { data = results });
}
}
}