RoleCheckListTemplateHeader lista nézet

This commit is contained in:
2025-03-27 12:11:34 +01:00
parent 04cca012f4
commit f119b196ea
3 changed files with 41 additions and 27 deletions
+21 -1
View File
@@ -340,6 +340,26 @@ namespace WorkFlowCheck.BL.Services
return retVal;
}
public Task<List<RoleCheckListTemplateHeaderDTO>> GetAllRoleCheckListTemplateHeadersAsync() => throw new NotImplementedException();
public async Task<List<RoleCheckListTemplateHeaderDTO>> GetAllRoleCheckListTemplateHeadersAsync()
{
var retVal = new List<RoleCheckListTemplateHeaderDTO>();
try
{
var results = await _dbContext.RoleCheckListTemplateHeaders
.Include(i => i.CheckListTemplateHeader)
.Include(i => i.Role)
.AsNoTracking()
.ToListAsync();
if (results != null)
{
retVal = _mapper.Map<List<RoleCheckListTemplateHeaderDTO>>(results);
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
}
}
@@ -1,5 +1,5 @@
@page
@model WorkFlowCheck.Web.Pages.RoleCheckListTemplateHeadersAndRole.RoleCheckListTemplateHeadersPageModel
@model WorkFlowCheck.Web.Pages.UserAndRole.RoleCheckListTemplateHeadersPageModel
@{
ViewData["Title"] = "Szabályok - Ellenőrzési sablonok";
}
@@ -11,25 +11,21 @@
<i class="bi bi-plus-square"></i>
</button>
</div>
<table id="tbRoleCheckListTemplateHeaderssPage" class="table table-bordered table-hover table-sm" style="width:100%">
<table id="tbRoleCheckListTemplateHeadersPage" class="table table-bordered table-hover table-sm" style="width:100%">
<thead class="table-primary">
<tr>
<th>ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>RoleCheckListTemplateHeaders Name</th>
<th>E-mail</th>
<th>Role name</th>
<th>Template name</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tfoot class="table-light">
<tr>
<th>ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>RoleCheckListTemplateHeaders Name</th>
<th>E-mail</th>
<th>Action</th>
<th>Role name</th>
<th>Template name</th>
<th class="text-center">Action</th>
</tr>
</tfoot>
</table>
@@ -37,18 +33,16 @@
@section Scripts {
<script>
const table = new DataTable('#tbRoleCheckListTemplateHeaderssPage', {
const table = new DataTable('#tbRoleCheckListTemplateHeadersPage', {
ajax: {
url: "@Url.Page("./RoleCheckListTemplateHeadersPage", "LoadRoleCheckListTemplateHeaderss")",
url: "@Url.Page("./RoleCheckListTemplateHeadersPage", "LoadRoleCheckListTemplateHeaders")",
type: "GET",
dataSrc : "data"
},
columns: [
{ data: "id" },
{ data: "firstName" },
{ data: "lastName" },
{ data: "RoleCheckListTemplateHeadersName" },
{ data: "email" },
{ data: "roleDTO.roleName" },
{ data: "checkListTemplateHeaderDTO.description" },
{ data: null, render: function (data, type, row) {
return renderActionButtons(row.id);
}}
@@ -59,7 +53,7 @@
"visible": false
},
{
"targets": 5,
"targets": 3,
"className": "text-center",
"width": "10%"
}
@@ -72,16 +66,16 @@
$('#newRoleCheckListTemplateHeadersBtn').on('click', function ()
{
console.log('New button clicked!"');
window.location.href = `@Url.Page("./RoleCheckListTemplateHeadersEditPage")?id=0`;
window.location.href = `@Url.Page("./RoleCheckListTemplateHeaderEditPage")?id=0`;
});
$('#tbRoleCheckListTemplateHeaderssPage').on('click', '.edit-btn', function ()
$('#tbRoleCheckListTemplateHeadersPage').on('click', '.edit-btn', function ()
{
const row = table.row($(this).closest('tr')).data();
window.location.href = `@Url.Page("./RoleCheckListTemplateHeadersEditPage")?id=${row.id}`;
window.location.href = `@Url.Page("./RoleCheckListTemplateHeaderEditPage")?id=${row.id}`;
});
$('#tbRoleCheckListTemplateHeaderssPage').on('click', '.delete-btn', function ()
$('#tbRoleCheckListTemplateHeadersPage').on('click', '.delete-btn', function ()
{
const row = table.row($(this).closest('tr')).data();
console.log(row);
@@ -4,11 +4,11 @@ using WorkFlowCheck.Web.Services.Interfaces;
namespace WorkFlowCheck.Web.Pages.UserAndRole
{
public class RoleCheckListTemplatesPageModel : PageModel
public class RoleCheckListTemplateHeadersPageModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
private readonly IUserService _userService;
public RoleCheckListTemplatesPageModel(ILogger<IndexModel> logger, IUserService userService)
public RoleCheckListTemplateHeadersPageModel(ILogger<IndexModel> logger, IUserService userService)
{
_logger = logger;
_userService = userService;
@@ -16,9 +16,9 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
public async Task OnGet()
{
}
public async Task<JsonResult> OnGetLoadRoleCheckListTemplates()
public async Task<JsonResult> OnGetLoadRoleCheckListTemplateHeaders()
{
var results = await _userService.getall();
var results = await _userService.GetAllRoleCheckListTemplates();
return new JsonResult(new { data = results });
}
}