diff --git a/src/WorkFlowCheck.API/Controllers/CheckListController.cs b/src/WorkFlowCheck.API/Controllers/CheckListController.cs index d8615c1..3fae01c 100644 --- a/src/WorkFlowCheck.API/Controllers/CheckListController.cs +++ b/src/WorkFlowCheck.API/Controllers/CheckListController.cs @@ -303,6 +303,28 @@ namespace WorkFlowCheck.API.Controllers return retVal; } + [HttpGet("DeleteCheckListTemplateRow/{id}")] + public async Task> DeleteCheckListTemplateRow(int id) + { + var retVal = new ApiResponseDTO() + { + IsSuccess = true, + }; + var result = await _checkListService.DeleteCheckListTemplateRowAsync(id); + + if (result != null) + { + retVal.IsSuccess = true; + retVal.Data = result; + } + else + { + retVal.IsSuccess = false; + retVal.Errors.Add("No data!"); + } + + return retVal; + } [HttpPost("UpdateCheckListTemplateRow")] public async Task> UpdateCheckListTemplateRow([FromBody] CheckListTemplateRowDTO CheckListTemplateRowDTO) { diff --git a/src/WorkFlowCheck.API/Downloads/APK/com.nuvolar.wfcapp-Signed.apk b/src/WorkFlowCheck.API/Downloads/APK/com.nuvolar.wfcapp-Signed.apk index d928926..c4ae6ff 100644 Binary files a/src/WorkFlowCheck.API/Downloads/APK/com.nuvolar.wfcapp-Signed.apk and b/src/WorkFlowCheck.API/Downloads/APK/com.nuvolar.wfcapp-Signed.apk differ diff --git a/src/WorkFlowCheck.BL/Services/CheckListService.cs b/src/WorkFlowCheck.BL/Services/CheckListService.cs index 04e8866..9782d8c 100644 --- a/src/WorkFlowCheck.BL/Services/CheckListService.cs +++ b/src/WorkFlowCheck.BL/Services/CheckListService.cs @@ -22,19 +22,16 @@ using WorkFlowCheck.DL.Entities; namespace WorkFlowCheck.BL.Services { - public class CheckListService : ICheckListService + public class CheckListService : BaseService, ICheckListService { - private readonly AppDbContext _dbContext; - private readonly IMapper _mapper; + private readonly INumberGeneratorService _numberGeneratorService; public CheckListService(AppDbContext dbContext, IMapper mapper, INumberGeneratorService numberGeneratorService, - IUserService userService) + IUserService userService) : base(dbContext, mapper) { - _dbContext = dbContext; - _mapper = mapper; _numberGeneratorService = numberGeneratorService; } @@ -397,6 +394,7 @@ namespace WorkFlowCheck.BL.Services } return retVal; } + public async Task GetCheckListTemplateHeaderAsync(int Id) { var retVal = new CheckListTemplateHeaderDTO() @@ -517,6 +515,10 @@ namespace WorkFlowCheck.BL.Services return retVal; } + public async Task DeleteCheckListTemplateRowAsync(int id) + { + return await DeleteEntityByIdAsync(id); + } public async Task UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO) { var retVal = new CheckListTemplateRowDTO() { }; diff --git a/src/WorkFlowCheck.BL/Services/Interfaces/ICheckListService.cs b/src/WorkFlowCheck.BL/Services/Interfaces/ICheckListService.cs index 5d8f237..b5bff47 100644 --- a/src/WorkFlowCheck.BL/Services/Interfaces/ICheckListService.cs +++ b/src/WorkFlowCheck.BL/Services/Interfaces/ICheckListService.cs @@ -21,6 +21,7 @@ namespace WorkFlowCheck.BL.Services.Interfaces Task UpdateCheckListTemplateHeaderAsync(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO); Task GetCheckListTemplateRowAsync(int id); + Task DeleteCheckListTemplateRowAsync(int id); Task UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO); Task GetCheckListRowAsync(int id); diff --git a/src/WorkFlowCheck.Common/DTO/CheckListTemplateHeaderDTO.cs b/src/WorkFlowCheck.Common/DTO/CheckListTemplateHeaderDTO.cs index 6e6f388..37f46b2 100644 --- a/src/WorkFlowCheck.Common/DTO/CheckListTemplateHeaderDTO.cs +++ b/src/WorkFlowCheck.Common/DTO/CheckListTemplateHeaderDTO.cs @@ -1,14 +1,20 @@ -using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; namespace WorkFlowCheck.Common.DTO { public class CheckListTemplateHeaderDTO { public int Id { get; set; } + [DisplayName("Megnevezés")] public string ShortName { get; set; } = null!; + [DisplayName("Leírás")] public string Description { get; set; } = null!; + [DisplayName("Sorszám (munkalap)")] public int? NumberGenerator1Id { get; set; } + [DisplayName("Sorszám (dokumentum)")] public int? NumberGenerator2Id { get; set; } + public NumberGeneratorTemplateDTO? NumberGenerator1 { get; set; } public NumberGeneratorTemplateDTO? NumberGenerator2 { get; set; } public ICollection? CheckListTemplateRowDTO { get; set; } = new List(); diff --git a/src/WorkFlowCheck.Common/DTO/CheckListTemplateRowDTO.cs b/src/WorkFlowCheck.Common/DTO/CheckListTemplateRowDTO.cs index d867e1b..b57ee6a 100644 --- a/src/WorkFlowCheck.Common/DTO/CheckListTemplateRowDTO.cs +++ b/src/WorkFlowCheck.Common/DTO/CheckListTemplateRowDTO.cs @@ -35,6 +35,7 @@ namespace WorkFlowCheck.Common.DTO /// V (Érték megadása) /// /// + [DisplayName("Válasz tipus")] public string AnswerType { get; set; } = null!; diff --git a/src/WorkFlowCheck.Web/Helpers/SystemHelper.cs b/src/WorkFlowCheck.Web/Helpers/SystemHelper.cs index 71729ec..9715705 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.018"; + public static string ProgramVersion = "v1.1.019"; public async static Task GetAPIInfoAsync(IConfiguration configuration) { diff --git a/src/WorkFlowCheck.Web/Pages/CheckListTemplate/CheckListTemplateHeader/CheckListTemplateHeaderEditPage.cshtml b/src/WorkFlowCheck.Web/Pages/CheckListTemplate/CheckListTemplateHeader/CheckListTemplateHeaderEditPage.cshtml index 7b5769a..3812493 100644 --- a/src/WorkFlowCheck.Web/Pages/CheckListTemplate/CheckListTemplateHeader/CheckListTemplateHeaderEditPage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/CheckListTemplate/CheckListTemplateHeader/CheckListTemplateHeaderEditPage.cshtml @@ -1,5 +1,7 @@ @page @model WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader.CheckListTemplateHeaderEditPageModel +@using WorkFlowCheck.Common.Helper +@using WorkFlowCheck.Common.DTO @using Microsoft.AspNetCore.Antiforgery @inject IAntiforgery Antiforgery @{ @@ -57,20 +59,20 @@ ID - Short Name - Checkpoint - OperationDescription - AnswerType + @DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.RowIndex), typeof(CheckListTemplateRowDTO)) + @DisplayNameHelper.GetDisplayName(nameof(CheckPointDTO.ShortName), typeof(CheckPointDTO)) + @DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.OperationDescription), typeof(CheckListTemplateRowDTO)) + @DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.AnswerType), typeof(CheckListTemplateRowDTO)) Action ID - Short Name - Checkpoint - OperationDescription - AnswerType + @DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.RowIndex), typeof(CheckListTemplateRowDTO)) + @DisplayNameHelper.GetDisplayName(nameof(CheckPointDTO.ShortName), typeof(CheckPointDTO)) + @DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.OperationDescription), typeof(CheckListTemplateRowDTO)) + @DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.AnswerType), typeof(CheckListTemplateRowDTO)) Action @@ -134,17 +136,9 @@ $('#tbCheckListTemplateHeaderPage').on('click', '.delete-btn', function () { const row = table.row($(this).closest('tr')).data(); - 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, '/CheckListTemplate/CheckListTemplateHeader/CheckListTemplateHeaderEditPage?handler=DeleteCheckListTemplateRow', row.id); }); + $("#saveCheckListTemplateHeader").click(function () { const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content'); var formData = getFormAsNestedObject('#CheckListTemplateHeaderForm'); diff --git a/src/WorkFlowCheck.Web/Pages/CheckListTemplate/CheckListTemplateHeader/CheckListTemplateHeaderEditPage.cshtml.cs b/src/WorkFlowCheck.Web/Pages/CheckListTemplate/CheckListTemplateHeader/CheckListTemplateHeaderEditPage.cshtml.cs index eb7555d..060041a 100644 --- a/src/WorkFlowCheck.Web/Pages/CheckListTemplate/CheckListTemplateHeader/CheckListTemplateHeaderEditPage.cshtml.cs +++ b/src/WorkFlowCheck.Web/Pages/CheckListTemplate/CheckListTemplateHeader/CheckListTemplateHeaderEditPage.cshtml.cs @@ -71,5 +71,10 @@ namespace WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader }); } } + public async Task OnGetDeleteCheckListTemplateRow(int id) + { + var isSuccess = await _checkListService.DeleteCheckListTemplateRow(id); + return new JsonResult(new { result = isSuccess }); + } } } diff --git a/src/WorkFlowCheck.Web/Services/CheckListService.cs b/src/WorkFlowCheck.Web/Services/CheckListService.cs index f90b23e..893cf4a 100644 --- a/src/WorkFlowCheck.Web/Services/CheckListService.cs +++ b/src/WorkFlowCheck.Web/Services/CheckListService.cs @@ -265,6 +265,27 @@ namespace WorkFlowCheck.Web.Services } return retVal; } + public async Task DeleteCheckListTemplateRow(int id) + { + string endpoint = $"{_httpClient.BaseAddress}api/CheckList/DeleteCheckListTemplateRow/{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> UpdateCheckListTemplateRow(CheckListTemplateRowDTO checkListTemplateRowDTO) { try diff --git a/src/WorkFlowCheck.Web/Services/Interfaces/ICheckListService.cs b/src/WorkFlowCheck.Web/Services/Interfaces/ICheckListService.cs index 813184a..aeb038f 100644 --- a/src/WorkFlowCheck.Web/Services/Interfaces/ICheckListService.cs +++ b/src/WorkFlowCheck.Web/Services/Interfaces/ICheckListService.cs @@ -21,6 +21,7 @@ namespace WorkFlowCheck.Web.Services.Interfaces Task GetCheckListTemplateRow(int id); + Task DeleteCheckListTemplateRow(int id); Task> UpdateCheckListTemplateRow(CheckListTemplateRowDTO checkListTemplateRowDTO); diff --git a/src/WorkFlowCheck.Web/wwwroot/css/site.css b/src/WorkFlowCheck.Web/wwwroot/css/site.css index 4af6283..2685e4a 100644 --- a/src/WorkFlowCheck.Web/wwwroot/css/site.css +++ b/src/WorkFlowCheck.Web/wwwroot/css/site.css @@ -44,3 +44,7 @@ body { .red-box { background-color: red; } + +.icon-green { + color: green; +} \ No newline at end of file diff --git a/src/WorkFlowCheck.Web/wwwroot/js/site.js b/src/WorkFlowCheck.Web/wwwroot/js/site.js index 77875f0..7a5ab1e 100644 --- a/src/WorkFlowCheck.Web/wwwroot/js/site.js +++ b/src/WorkFlowCheck.Web/wwwroot/js/site.js @@ -29,7 +29,6 @@ function getFormAsNestedObject(formSelector) { return result; } - function showConfirmModal(options) { return new Promise(function (resolve) { // Alapértelmezett értékek @@ -72,7 +71,6 @@ function showConfirmModal(options) { modal.show(); }); } - function showConfirmModalWithMessage(options) { return new Promise(function (resolve) { // Alapértelmezett értékek @@ -127,7 +125,6 @@ function showConfirmModalWithMessage(options) { modal.show(); }); } - function showMessageModal(options) { // Alapértelmezett értékek var defaults = { @@ -296,6 +293,9 @@ function renderAnswerType(data) { if (data === 'P') { return '
'; } + if (data === 'PN') { + return '
'; + } if (data === 'V') { return '
0,00
'; }