diff --git a/src/WorkFlowCheck.BL/Services/CheckListService.cs b/src/WorkFlowCheck.BL/Services/CheckListService.cs index d6ed01b..3e810c0 100644 --- a/src/WorkFlowCheck.BL/Services/CheckListService.cs +++ b/src/WorkFlowCheck.BL/Services/CheckListService.cs @@ -170,7 +170,7 @@ namespace WorkFlowCheck.BL.Services IsEditable = true, UserId = checkListHeaderNewDTO.UserId, ShortName = "", - Description = "", + Description = checkListTemplateHeader.Description ?? "", DocumentNumber = documentNumber, GuidNumber = Guid.NewGuid(), IsDeleted = false, @@ -227,7 +227,10 @@ namespace WorkFlowCheck.BL.Services checkListHeader.CheckStatus = CheckStatus.Signed; checkListHeader.IsEditable = false; checkListHeader.AcceptUserId = userid; - Log.ForContext("TAG", "BusinessFlow").Warning($"Ellenőrzési lap státuszváltozása, jóváhasyás: Ellenőrzés:{id}, Felhasználó:{userid}"); + + checkListHeader.DateExecution = DateTime.Now; + + Log.ForContext("TAG", "BusinessFlow").Warning($"Ellenőrzési lap státuszváltozása, jóváhagyás: Ellenőrzés:{checkListHeader.DocumentNumber}, Felhasználó: {checkListHeader.AcceptUser.LastName} {checkListHeader.AcceptUser.FirstName}"); await _dbContext.SaveChangesAsync(); var pdf = await CreateCheckListHeaderPDFAsync(id); diff --git a/src/WorkFlowCheck.BL/Services/SyncService.cs b/src/WorkFlowCheck.BL/Services/SyncService.cs index 85c8744..2f6f47d 100644 --- a/src/WorkFlowCheck.BL/Services/SyncService.cs +++ b/src/WorkFlowCheck.BL/Services/SyncService.cs @@ -349,9 +349,10 @@ namespace WorkFlowCheck.BL.Services try { var res = await _dbContext.CheckListHeaders - .Where(w => (w.IsEditable && - w.IsDeleted != true) || (w.CheckStatus == CheckStatus.Blocked) - ) + .Where(w => w.CheckStatus == CheckStatus.Open || + w.CheckStatus == CheckStatus.InProgress || + w.CheckStatus == CheckStatus.Blocked || + w.CheckStatus == CheckStatus.Sent) .Include(i => i.CheckListRows) //.ThenInclude(i => i.CheckListTemplateRow) .AsNoTracking() @@ -385,43 +386,6 @@ namespace WorkFlowCheck.BL.Services if (res != null && (res.CheckStatus == CheckStatus.Open || res.CheckStatus == CheckStatus.InProgress)) { - if (NeedBlocking(checkListHeaderDTO)) - { - /// TODO: blokkolás miatt - res.CheckStatus = CheckStatus.Blocked; - await _dbContext.SaveChangesAsync(); - - Log.ForContext("TAG", "BusinessFlow").Warning($"Ellenőrzési lap blokkolva: Ellenőrzés:{checkListHeaderDTO.Id}, Felhasználó:{_requestContext.CurrentUsername}"); - - var user = await _userService.GetUserAsync(_requestContext.CurrentUserId ?? 1); - - foreach (var item in user.RoleDTO) - { - var deviceMessageDTO = new DeviceMessageDTO() - { - IsReaded = false, - Message = $"Ellenőrző lap blokkolva! [{checkListHeaderDTO.DocumentNumber}]", - SendDate = DateTime.UtcNow, - ExtraDataJSON = "", - RoleId = item.ParentId, - DeviceIdFrom = "", - DeviceIdTo = "", - }; - - await this.DeviceMessageSend(deviceMessageDTO); - - var fCMMessageDTO = new FCMMessageDTO - { - Body = deviceMessageDTO.Message, - Title = "Blokkolási értesítés", - UserId = user.Id, - }; - await _messageService.SendFCMMessageToLastToken(fCMMessageDTO); - } - return retVal; - } - - res.CheckStatus = CheckStatus.InProgress; var ids = checkListHeaderDTO.CheckListRowDTO?.Select(r => r.Id).ToList(); if (ids != null && ids.Count > 0) { @@ -448,6 +412,47 @@ namespace WorkFlowCheck.BL.Services } } } + await _dbContext.SaveChangesAsync(); + retVal = _mapper.Map(res); + + if (NeedBlocking(checkListHeaderDTO)) + { + /// TODO: blokkolás miatt + res.CheckStatus = CheckStatus.Blocked; + await _dbContext.SaveChangesAsync(); + + Log.ForContext("TAG", "BusinessFlow").Warning($"Ellenőrzési lap blokkolva: Ellenőrzés:{checkListHeaderDTO.Id}, Felhasználó:{_requestContext.CurrentUsername}"); + + var user = await _userService.GetUserAsync(_requestContext.CurrentUserId ?? 1); + + foreach (var item in user.RoleDTO) + { + var deviceMessageDTO = new DeviceMessageDTO() + { + IsReaded = false, + Message = $"Ellenőrző lap blokkolva! [{checkListHeaderDTO.DocumentNumber}]", + SendDate = DateTime.UtcNow, + ExtraDataJSON = "", + RoleId = item.ParentId, + DeviceIdFrom = "", + DeviceIdTo = "", + }; + + await this.DeviceMessageSend(deviceMessageDTO); + + var fCMMessageDTO = new FCMMessageDTO + { + Body = deviceMessageDTO.Message, + Title = "Blokkolási értesítés", + UserId = user.Id, + }; + await _messageService.SendFCMMessageToLastToken(fCMMessageDTO); + } + return retVal; + } + + res.CheckStatus = CheckStatus.InProgress; + if (CheckIfLastReached(checkListHeaderDTO)) { /// TODO: most kell a CheckStatust állítani és menjen üzenet ! diff --git a/src/WorkFlowCheck.Common/DTO/RoleCheckListTemplateHeaderDTO.cs b/src/WorkFlowCheck.Common/DTO/RoleCheckListTemplateHeaderDTO.cs index a7f8f43..e8eafe5 100644 --- a/src/WorkFlowCheck.Common/DTO/RoleCheckListTemplateHeaderDTO.cs +++ b/src/WorkFlowCheck.Common/DTO/RoleCheckListTemplateHeaderDTO.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; using System.Data; using System.Linq; using System.Text; @@ -10,10 +12,19 @@ namespace WorkFlowCheck.Common.DTO public class RoleCheckListTemplateHeaderDTO { public int Id { get; set; } + + [Required(ErrorMessage = "A szabály megnevezésének megadása kötelező.")] + [DisplayName("Szabály")] public int RoleId { get; set; } public RoleDTO? RoleDTO { get; set; } = null!; + + [Required(ErrorMessage = "Az ellenőrzési sablon megadása kötelező.")] + [DisplayName("Ellenőrzési sablon")] public int CheckListTemplateHeaderId { get; set; } public CheckListTemplateHeaderDTO? CheckListTemplateHeaderDTO { get; set; } = null!; + + + [DisplayName("Engedélyezve?")] public bool Enabled { get; set; } = false; } } diff --git a/src/WorkFlowCheck.Common/DTO/RoleCheckPointDTO.cs b/src/WorkFlowCheck.Common/DTO/RoleCheckPointDTO.cs index f12040b..d07b23b 100644 --- a/src/WorkFlowCheck.Common/DTO/RoleCheckPointDTO.cs +++ b/src/WorkFlowCheck.Common/DTO/RoleCheckPointDTO.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; using System.Data; using System.Linq; using System.Text; @@ -10,10 +12,18 @@ namespace WorkFlowCheck.Common.DTO public class RoleCheckPointDTO { public int Id { get; set; } + + [Required(ErrorMessage = "A szabály megadása kötelező.")] + [DisplayName("Szabály")] public int RoleId { get; set; } public RoleDTO? RoleDTO { get; set; } = null!; + + [Required(ErrorMessage = "Az ellenőrzési pont megadása kötelező.")] + [DisplayName("Ellenőrzési pont")] public int CheckPointId { get; set; } public CheckPointDTO? CheckPointDTO { get; set; } = null!; + + [DisplayName("Engedélyezve?")] public bool Enabled { get; set; } = false; } } diff --git a/src/WorkFlowCheck.Common/DTO/UserChangePassword2FADTO.cs b/src/WorkFlowCheck.Common/DTO/UserChangePassword2FADTO.cs index d4f7cd9..f6522fe 100644 --- a/src/WorkFlowCheck.Common/DTO/UserChangePassword2FADTO.cs +++ b/src/WorkFlowCheck.Common/DTO/UserChangePassword2FADTO.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -16,9 +17,13 @@ namespace WorkFlowCheck.Common.DTO [DisplayName("Régi jelszó")] public string OldPassword { get; set; } = null!; + [Required(ErrorMessage = "A jelszó kötelező.")] + [RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).{6,}$", ErrorMessage = "Az új jelszónak legalább 6 karakter hosszúnak kell lennie, és tartalmaznia kell kis- és nagybetűt, számot és speciális karaktert.")] [DisplayName("Új jelszó")] public string NewPassword1 { get; set; } = null!; + [Required(ErrorMessage = "A jelszó kötelező.")] + [RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).{6,}$", ErrorMessage = "Az új jelszónak legalább 6 karakter hosszúnak kell lennie, és tartalmaznia kell kis- és nagybetűt, számot és speciális karaktert.")] [DisplayName("Jelszó megerősítése")] public string NewPassword2 { get; set; } = null!; diff --git a/src/WorkFlowCheck.Common/DTO/UserDTO.cs b/src/WorkFlowCheck.Common/DTO/UserDTO.cs index 705245b..3230ddf 100644 --- a/src/WorkFlowCheck.Common/DTO/UserDTO.cs +++ b/src/WorkFlowCheck.Common/DTO/UserDTO.cs @@ -25,9 +25,12 @@ namespace WorkFlowCheck.Common.DTO [DisplayName("Felhasználó neve")] public string UserName { get;set; } = null!; + [Required(ErrorMessage = "A jelszó kötelező.")] + [RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).{6,}$", ErrorMessage = "A jelszónak legalább 6 karakter hosszúnak kell lennie, és tartalmaznia kell kis- és nagybetűt, számot és speciális karaktert.")] [DisplayName("Jelszó")] - public string Password { get; set; } - + public string Password { get; set; } = null!; + + public string JwtToken { get; set; } = null!; [DisplayName("Aktív")] diff --git a/src/WorkFlowCheck.Web/Helpers/SystemHelper.cs b/src/WorkFlowCheck.Web/Helpers/SystemHelper.cs index 40cb4a8..7519383 100644 --- a/src/WorkFlowCheck.Web/Helpers/SystemHelper.cs +++ b/src/WorkFlowCheck.Web/Helpers/SystemHelper.cs @@ -7,7 +7,7 @@ namespace WorkFlowCheck.Web.Helpers public static class SystemHelper { public static string DatabaseName = ""; - public static string ProgramVersion = "v1.1.025"; + public static string ProgramVersion = "v1.1.027"; public async static Task GetAPIInfoAsync(IConfiguration configuration) { diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckListTemplateHeaderEditPage.cshtml b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckListTemplateHeaderEditPage.cshtml index 6f22ace..c17af80 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckListTemplateHeaderEditPage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckListTemplateHeaderEditPage.cshtml @@ -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"); } diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckListTemplateHeadersPage.cshtml b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckListTemplateHeadersPage.cshtml index 878e147..4b9363b 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckListTemplateHeadersPage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckListTemplateHeadersPage.cshtml @@ -15,18 +15,18 @@ ID - Role name - Template name - Enabled + Szabály neve + Ellenőrzési sablon neve + Engedélyezve? Action ID - Role name - Template name - Enabled + Szabály neve + Ellenőrzési sablon neve + Engedélyezve? Action @@ -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); }); } diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckListTemplateHeadersPage.cshtml.cs b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckListTemplateHeadersPage.cshtml.cs index 5018f89..19f94c3 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckListTemplateHeadersPage.cshtml.cs +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckListTemplateHeadersPage.cshtml.cs @@ -21,5 +21,10 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole var results = await _userService.GetAllRoleCheckListTemplates(); return new JsonResult(new { data = results }); } + public async Task OnGetDeleteRoleCheckListTemplateHeader(int id) + { + var isSuccess = await _userService.DeleteRoleCheckListTemplateHeader(id); + return new JsonResult(new { result = isSuccess }); + } } } diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckPointEditPage.cshtml b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckPointEditPage.cshtml index 6fd55d7..a0c45d5 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckPointEditPage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckPointEditPage.cshtml @@ -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"); diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckPointEditPage.cshtml.cs b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckPointEditPage.cshtml.cs index 758a06f..f06de1b 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckPointEditPage.cshtml.cs +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckPointEditPage.cshtml.cs @@ -71,5 +71,6 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole this.RoleCheckPoints.Add(new SelectListItem() { Value = CheckPoint.Id.ToString(), Text = CheckPoint.ShortName }); } } + } } diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckPointsPage.cshtml b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckPointsPage.cshtml index 6fb495e..6c574b7 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckPointsPage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckPointsPage.cshtml @@ -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"; }

@ViewData["Title"]

@@ -17,8 +17,8 @@ ID - >@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.RoleDTO.RoleName), typeof(RoleCheckPointDTO)) - @DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.CheckPointDTO.ShortName), typeof(RoleCheckPointDTO)) + Szabály @DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO)) + Ellenőrzési pont @DisplayNameHelper.GetDisplayName(nameof(CheckPointDTO.ShortName), typeof(CheckPointDTO)) @DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.Enabled), typeof(RoleCheckPointDTO)) Action @@ -26,8 +26,8 @@ ID - >@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.RoleDTO.RoleName), typeof(RoleCheckPointDTO)) - @DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.CheckPointDTO.ShortName), typeof(RoleCheckPointDTO)) + Szabály @DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO)) + Ellenőrzési pont @DisplayNameHelper.GetDisplayName(nameof(CheckPointDTO.ShortName), typeof(CheckPointDTO)) @DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.Enabled), typeof(RoleCheckPointDTO)) Action @@ -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); }); } diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckPointsPage.cshtml.cs b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckPointsPage.cshtml.cs index 23d0c7c..28dec09 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckPointsPage.cshtml.cs +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleCheckPointsPage.cshtml.cs @@ -21,5 +21,10 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole var results = await _userService.GetAllRoleCheckPoints(); return new JsonResult(new { data = results }); } + public async Task OnGetDeleteRoleCheckPoint(int id) + { + var isSuccess = await _userService.DeleteRoleCheckPoint(id); + return new JsonResult(new { result = isSuccess }); + } } } diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleEditPage.cshtml b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleEditPage.cshtml index f98be30..a2d4556 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleEditPage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleEditPage.cshtml @@ -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"); } diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/RolePage.cshtml b/src/WorkFlowCheck.Web/Pages/UserAndRole/RolePage.cshtml index 2876353..a5a6909 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/RolePage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/RolePage.cshtml @@ -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); }); } diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/UserEditPage.cshtml b/src/WorkFlowCheck.Web/Pages/UserAndRole/UserEditPage.cshtml index 0ed640e..3454d2d 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/UserEditPage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/UserEditPage.cshtml @@ -20,30 +20,46 @@ - - + + -
- - - -
+ @if (Model.UserDTO.Id == 0) + { +
+ + + +
+ } + else + { +
+ + + +
+ } @if (Model.UserDTO.Id == 0) {
-
- - +
+ +
+ + +
-
- - - -
} +
+ + + +
@@ -78,35 +94,38 @@
-

-
- - - - - - - - - - - - - - - - - - - - - - - - - -
ID@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.ParentRoleName), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.IsAdmin), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanEnableBlocked), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanDownloadAPK), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseMobilApp), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseWebAdmin), typeof(RoleDTO))
ID@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.ParentRoleName), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.IsAdmin), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanEnableBlocked), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanDownloadAPK), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseMobilApp), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseWebAdmin), typeof(RoleDTO))
-
+@if (Model.UserDTO.Id != 0) +{ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
ID@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.ParentRoleName), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.IsAdmin), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanEnableBlocked), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanDownloadAPK), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseMobilApp), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseWebAdmin), typeof(RoleDTO))
ID@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.RoleName), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.ParentRoleName), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.IsAdmin), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanEnableBlocked), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanDownloadAPK), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseMobilApp), typeof(RoleDTO))@DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseWebAdmin), typeof(RoleDTO))
+
+} @section Scripts { } diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/UserRolePage.cshtml.cs b/src/WorkFlowCheck.Web/Pages/UserAndRole/UserRolePage.cshtml.cs index b0e3381..d55830f 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/UserRolePage.cshtml.cs +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/UserRolePage.cshtml.cs @@ -21,5 +21,10 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole var results = await _userService.GetAllUserRoles(); return new JsonResult(new { data = results }); } + public async Task OnGetDeleteUserRole(int id) + { + var results = await _userService.DeleteUserRole(id); + return new JsonResult(new { data = results }); + } } } diff --git a/src/WorkFlowCheck.Web/Services/Interfaces/IUserService.cs b/src/WorkFlowCheck.Web/Services/Interfaces/IUserService.cs index b61951d..86909dc 100644 --- a/src/WorkFlowCheck.Web/Services/Interfaces/IUserService.cs +++ b/src/WorkFlowCheck.Web/Services/Interfaces/IUserService.cs @@ -21,14 +21,16 @@ namespace WorkFlowCheck.Web.Services.Interfaces Task GetUserRole(int id); Task> GetAllUserRoles(); Task> UpdateUserRole(UserRoleDTO userRoleDTO); - + Task DeleteUserRole(int id); Task GetRoleCheckListTemplateHeader(int id); Task> GetAllRoleCheckListTemplates(); Task> UpdateRoleCheckListTemplateHeader(RoleCheckListTemplateHeaderDTO roleCheckListTemplateHeaderDTO); + Task DeleteRoleCheckListTemplateHeader(int id); Task GetRoleCheckPoint(int id); Task> GetAllRoleCheckPoints(); Task> UpdateRoleCheckPoint(RoleCheckPointDTO roleCheckPointDTO); + Task DeleteRoleCheckPoint(int id); } } diff --git a/src/WorkFlowCheck.Web/Services/UserService.cs b/src/WorkFlowCheck.Web/Services/UserService.cs index dbbec88..c0a6069 100644 --- a/src/WorkFlowCheck.Web/Services/UserService.cs +++ b/src/WorkFlowCheck.Web/Services/UserService.cs @@ -59,7 +59,12 @@ namespace WorkFlowCheck.Web.Services { try { - string endpoint = $"{_httpClient.BaseAddress}api/user/updateUser"; + if (userDTO.Id != null) + { + userDTO.Password = "xXyY3456!!!;;"; // Ez csak amiatt kell, hogy ne szálljon el a JSON + } + + string endpoint = $"{_httpClient.BaseAddress}api/user/UpdateUser"; using (HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync(endpoint, userDTO)) { @@ -131,7 +136,7 @@ namespace WorkFlowCheck.Web.Services { UserName = username, Password = password, - + }; @@ -161,7 +166,7 @@ namespace WorkFlowCheck.Web.Services { try { - + string endpoint = $"{_httpClient.BaseAddress}api/User/Authenticate2F2"; var userSimpleDTO = new User2FADTO() @@ -188,7 +193,7 @@ namespace WorkFlowCheck.Web.Services } catch (Exception ex) { - + return new ApiResponseDTO { IsSuccess = false @@ -206,7 +211,7 @@ namespace WorkFlowCheck.Web.Services { UserName = username, OldPassword = oldpassword, - NewPassword1 = newpassword, + NewPassword1 = newpassword, NewPassword2 = newpassword, Code = code, Token2FA = token2FA @@ -421,6 +426,27 @@ namespace WorkFlowCheck.Web.Services }; } } + public async Task DeleteUserRole(int id) + { + string endpoint = $"{_httpClient.BaseAddress}api/User/DeleteUserRole/{id}"; + var retVal = false; + try + { + var response = await _httpClient.GetFromJsonAsync>(endpoint); + if (response != null) + { + if (response.IsSuccess) + { + return response.Data; + } + } + } + catch (Exception ex) + { + Log.Error(ex.Message); + } + return retVal; + } public async Task GetRoleCheckListTemplateHeader(int id) { @@ -492,6 +518,27 @@ namespace WorkFlowCheck.Web.Services }; } } + public async Task DeleteRoleCheckListTemplateHeader(int id) + { + string endpoint = $"{_httpClient.BaseAddress}api/User/DeleteRoleCheckListTemplateHeader/{id}"; + var retVal = false; + try + { + var response = await _httpClient.GetFromJsonAsync>(endpoint); + if (response != null) + { + if (response.IsSuccess) + { + return response.Data; + } + } + } + catch (Exception ex) + { + Log.Error(ex.Message); + } + return retVal; + } public async Task GetRoleCheckPoint(int id) { @@ -563,7 +610,28 @@ namespace WorkFlowCheck.Web.Services }; } } + public async Task DeleteRoleCheckPoint(int id) + { + string endpoint = $"{_httpClient.BaseAddress}api/User/DeleteRoleCheckPoint/{id}"; + var retVal = false; + try + { + var response = await _httpClient.GetFromJsonAsync>(endpoint); + if (response != null) + { + if (response.IsSuccess) + { + return response.Data; + } + } + } + catch (Exception ex) + { + Log.Error(ex.Message); + } + return retVal; + } + - } } diff --git a/src/WorkFlowCheck.Web/wwwroot/js/site.js b/src/WorkFlowCheck.Web/wwwroot/js/site.js index d05f211..2634dee 100644 --- a/src/WorkFlowCheck.Web/wwwroot/js/site.js +++ b/src/WorkFlowCheck.Web/wwwroot/js/site.js @@ -434,4 +434,18 @@ function saveEntity(csrfToken, data, url) { }); } }); +} +function togglePasswordVisibility() { + const passwordInput = document.getElementById("passwordInput"); + const icon = document.getElementById("toggleIcon"); + + if (passwordInput.type === "password") { + passwordInput.type = "text"; + icon.classList.remove("bi-eye"); + icon.classList.add("bi-eye-slash"); + } else { + passwordInput.type = "password"; + icon.classList.remove("bi-eye-slash"); + icon.classList.add("bi-eye"); + } } \ No newline at end of file