From f74922d01e57751f6cda351539f60546a24ca533 Mon Sep 17 00:00:00 2001 From: ivanszabo Date: Wed, 19 Mar 2025 09:59:42 +0100 Subject: [PATCH] HU a datatables-hez --- src/WorkFlowCheck.BL/Services/UserService.cs | 5 ++- .../CheckPoints/CheckPointEditPage.cshtml | 15 ++++--- .../CheckPoints/CheckPointsPage.cshtml | 3 +- .../Equipments/EquipmentsPage.cshtml | 3 +- .../BaseStock/Locations/LocationsPage.cshtml | 3 +- .../Pages/UserAndRole/RolePage.cshtml | 3 +- .../Pages/UserAndRole/UserEditPage.cshtml | 45 ++++++++++++++++++- .../Pages/UserAndRole/UserEditPage.cshtml.cs | 5 +++ .../Pages/UserAndRole/UserPage.cshtml | 11 +++-- .../Pages/UserAndRole/UserRolePage.cshtml | 3 +- 10 files changed, 78 insertions(+), 18 deletions(-) diff --git a/src/WorkFlowCheck.BL/Services/UserService.cs b/src/WorkFlowCheck.BL/Services/UserService.cs index 8a22dc1..7bc7101 100644 --- a/src/WorkFlowCheck.BL/Services/UserService.cs +++ b/src/WorkFlowCheck.BL/Services/UserService.cs @@ -38,7 +38,10 @@ namespace WorkFlowCheck.BL.Services try { - var user = await _dbContext.Users.Where(w => w.Id == Id).FirstOrDefaultAsync(); + var user = await _dbContext.Users + .Include(i => i.UserRoles) + .ThenInclude(i => i.Role) + .Where(w => w.Id == Id).FirstOrDefaultAsync(); if (user != null) { retVal = _mapper.Map(user); diff --git a/src/WorkFlowCheck.Web/Pages/BaseStock/CheckPoints/CheckPointEditPage.cshtml b/src/WorkFlowCheck.Web/Pages/BaseStock/CheckPoints/CheckPointEditPage.cshtml index 254580d..deb2a21 100644 --- a/src/WorkFlowCheck.Web/Pages/BaseStock/CheckPoints/CheckPointEditPage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/BaseStock/CheckPoints/CheckPointEditPage.cshtml @@ -32,10 +32,12 @@ - +
- +
@@ -89,15 +91,16 @@ } ], - processing:true + processing:true, + language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',} }); - + $('#tbCheckPointsEditPage').on('click', '.edit-btn', function () { const row = table.row($(this).closest('tr')).data(); window.location.href = `@Url.Page("./CheckListTemplateRowEditPage")?id=${row.id}`; }); - + $('#tbCheckPointsEditPage').on('click', '.delete-btn', function () { const row = table.row($(this).closest('tr')).data(); @@ -112,7 +115,7 @@ } }); }); - + $("#saveCheckPoint").click(function () { const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content'); var formData = getFormAsNestedObject('#checkPointForm'); diff --git a/src/WorkFlowCheck.Web/Pages/BaseStock/CheckPoints/CheckPointsPage.cshtml b/src/WorkFlowCheck.Web/Pages/BaseStock/CheckPoints/CheckPointsPage.cshtml index 1fd7f78..8f4fe28 100644 --- a/src/WorkFlowCheck.Web/Pages/BaseStock/CheckPoints/CheckPointsPage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/BaseStock/CheckPoints/CheckPointsPage.cshtml @@ -59,7 +59,8 @@ } ], - processing:true + processing:true, + language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',} }); $('#tbCheckPointsPage').on('click', '.edit-btn', function () diff --git a/src/WorkFlowCheck.Web/Pages/BaseStock/Equipments/EquipmentsPage.cshtml b/src/WorkFlowCheck.Web/Pages/BaseStock/Equipments/EquipmentsPage.cshtml index 5c7a0ef..42dc065 100644 --- a/src/WorkFlowCheck.Web/Pages/BaseStock/Equipments/EquipmentsPage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/BaseStock/Equipments/EquipmentsPage.cshtml @@ -54,7 +54,8 @@ } ], - processing:true + processing:true, + language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',} }); $('#tbEquipmentsPage').on('click', '.edit-btn', function () diff --git a/src/WorkFlowCheck.Web/Pages/BaseStock/Locations/LocationsPage.cshtml b/src/WorkFlowCheck.Web/Pages/BaseStock/Locations/LocationsPage.cshtml index 4c9c519..15576b1 100644 --- a/src/WorkFlowCheck.Web/Pages/BaseStock/Locations/LocationsPage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/BaseStock/Locations/LocationsPage.cshtml @@ -54,7 +54,8 @@ } ], - processing:true + processing:true, + language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',} }); $('#tbLocationsPage').on('click', '.edit-btn', function () diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/RolePage.cshtml b/src/WorkFlowCheck.Web/Pages/UserAndRole/RolePage.cshtml index 9d75862..190fc93 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/RolePage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/RolePage.cshtml @@ -56,7 +56,8 @@ } ], - processing:true + processing:true, + language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',} }); $('#newRoleBtn').on('click', function () diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/UserEditPage.cshtml b/src/WorkFlowCheck.Web/Pages/UserAndRole/UserEditPage.cshtml index d749b2d..5f65c28 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/UserEditPage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/UserEditPage.cshtml @@ -5,10 +5,12 @@ @{ ViewData["Title"] = "Ellenőrzési pont"; var UserId = Model.UserDTO.Id; + var url = Url.Page("./UserEditPage", "LoadRoles", new { id = UserId }); var urlPost = Url.Page("./UserEditPage", "Save"); }

@ViewData["Title"]

+
@@ -52,9 +54,48 @@
- +

+
+
+ + + + + + + + + + + + +
IDRole Name
IDRole Name
+
@section Scripts {