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; 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 @page
@model WorkFlowCheck.Web.Pages.RoleCheckListTemplateHeadersAndRole.RoleCheckListTemplateHeadersPageModel @model WorkFlowCheck.Web.Pages.UserAndRole.RoleCheckListTemplateHeadersPageModel
@{ @{
ViewData["Title"] = "Szabályok - Ellenőrzési sablonok"; ViewData["Title"] = "Szabályok - Ellenőrzési sablonok";
} }
@@ -11,25 +11,21 @@
<i class="bi bi-plus-square"></i> <i class="bi bi-plus-square"></i>
</button> </button>
</div> </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"> <thead class="table-primary">
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>First Name</th> <th>Role name</th>
<th>Last Name</th> <th>Template name</th>
<th>RoleCheckListTemplateHeaders Name</th>
<th>E-mail</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tfoot class="table-light"> <tfoot class="table-light">
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>First Name</th> <th>Role name</th>
<th>Last Name</th> <th>Template name</th>
<th>RoleCheckListTemplateHeaders Name</th> <th class="text-center">Action</th>
<th>E-mail</th>
<th>Action</th>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
@@ -37,18 +33,16 @@
@section Scripts { @section Scripts {
<script> <script>
const table = new DataTable('#tbRoleCheckListTemplateHeaderssPage', { const table = new DataTable('#tbRoleCheckListTemplateHeadersPage', {
ajax: { ajax: {
url: "@Url.Page("./RoleCheckListTemplateHeadersPage", "LoadRoleCheckListTemplateHeaderss")", url: "@Url.Page("./RoleCheckListTemplateHeadersPage", "LoadRoleCheckListTemplateHeaders")",
type: "GET", type: "GET",
dataSrc : "data" dataSrc : "data"
}, },
columns: [ columns: [
{ data: "id" }, { data: "id" },
{ data: "firstName" }, { data: "roleDTO.roleName" },
{ data: "lastName" }, { data: "checkListTemplateHeaderDTO.description" },
{ data: "RoleCheckListTemplateHeadersName" },
{ data: "email" },
{ data: null, render: function (data, type, row) { { data: null, render: function (data, type, row) {
return renderActionButtons(row.id); return renderActionButtons(row.id);
}} }}
@@ -59,7 +53,7 @@
"visible": false "visible": false
}, },
{ {
"targets": 5, "targets": 3,
"className": "text-center", "className": "text-center",
"width": "10%" "width": "10%"
} }
@@ -72,16 +66,16 @@
$('#newRoleCheckListTemplateHeadersBtn').on('click', function () $('#newRoleCheckListTemplateHeadersBtn').on('click', function ()
{ {
console.log('New button clicked!"'); 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(); 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(); const row = table.row($(this).closest('tr')).data();
console.log(row); console.log(row);
@@ -4,11 +4,11 @@ using WorkFlowCheck.Web.Services.Interfaces;
namespace WorkFlowCheck.Web.Pages.UserAndRole namespace WorkFlowCheck.Web.Pages.UserAndRole
{ {
public class RoleCheckListTemplatesPageModel : PageModel public class RoleCheckListTemplateHeadersPageModel : PageModel
{ {
private readonly ILogger<IndexModel> _logger; private readonly ILogger<IndexModel> _logger;
private readonly IUserService _userService; private readonly IUserService _userService;
public RoleCheckListTemplatesPageModel(ILogger<IndexModel> logger, IUserService userService) public RoleCheckListTemplateHeadersPageModel(ILogger<IndexModel> logger, IUserService userService)
{ {
_logger = logger; _logger = logger;
_userService = userService; _userService = userService;
@@ -16,9 +16,9 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole
public async Task OnGet() 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 }); return new JsonResult(new { data = results });
} }
} }