diff --git a/src/WorkFlowCheck.Common/DTO/CheckListHeaderInfoDTO.cs b/src/WorkFlowCheck.Common/DTO/CheckListHeaderInfoDTO.cs new file mode 100644 index 0000000..f41ad5b --- /dev/null +++ b/src/WorkFlowCheck.Common/DTO/CheckListHeaderInfoDTO.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WorkFlowCheck.Common.DTO +{ + public class CheckListHeaderInfoDTO + { + public int Id { get; set; } + + [DisplayName("Összes ellenőrzési szám")] + public int TotalRowCount { get; set; } + + [DisplayName("Még ellenőrizendő száma")] + public int EmptyAnswerCount { get; set; } + + [DisplayName("Készültség %")] + public string ReadyPercent { get; set; } + + [DisplayName("Ellenőrzési pontok száma")] + public int CheckPointCount { get; set; } + } +} diff --git a/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderEditPage.cshtml b/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderEditPage.cshtml index 43cf1fc..22a75b2 100644 --- a/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderEditPage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderEditPage.cshtml @@ -34,16 +34,51 @@
+
+
+ + + +
+
+ + + +
+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
- - - + + +
+
@@ -63,20 +98,20 @@ ID @DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.CheckListTemplateRowDTO.RowIndex), typeof(CheckListTemplateRowDTO)) @DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.CheckListTemplateRowDTO.CheckPointDTO.ShortName), typeof(CheckPointDTO)) - OperationDescription - AnswerType - Answer + @DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.OperationDescription), typeof(CheckListTemplateRowDTO)) + @DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.AnswerType), typeof(CheckListTemplateRowDTO)) + @DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.Answer), typeof(CheckListRowDTO)) Action ID - Short Name - Checkpoint - OperationDescription - AnswerType - Answer + @DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.CheckListTemplateRowDTO.RowIndex), typeof(CheckListTemplateRowDTO)) + @DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.CheckListTemplateRowDTO.CheckPointDTO.ShortName), typeof(CheckPointDTO)) + @DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.OperationDescription), typeof(CheckListTemplateRowDTO)) + @DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.AnswerType), typeof(CheckListTemplateRowDTO)) + @DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.Answer), typeof(CheckListRowDTO)) Action diff --git a/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderEditPage.cshtml.cs b/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderEditPage.cshtml.cs index 9731715..1aebfc0 100644 --- a/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderEditPage.cshtml.cs +++ b/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderEditPage.cshtml.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.Rendering; +using System.Globalization; using WorkFlowCheck.Common.DTO; using WorkFlowCheck.Web.Services.Interfaces; @@ -13,6 +14,11 @@ namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader [BindProperty] public CheckListHeaderDTO CheckListHeaderDTO { get; set; } + + [BindProperty] + public CheckListHeaderInfoDTO CheckListHeaderInfoDTO { get; set; } + + [BindProperty] public List CheckStatus { get; set; } public CheckListHeaderEditPageModel(ILogger logger, ICheckListService checkListService) @@ -24,6 +30,32 @@ namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader { CheckListHeaderDTO = await _checkListService.GetCheckListHeader(id); CheckStatus = _checkListService.GetCheckStatus(); + BuildCheckListHeaderInfo(); + } + private void BuildCheckListHeaderInfo() + { + CheckListHeaderInfoDTO = new CheckListHeaderInfoDTO(); + + var result = CheckListHeaderDTO.CheckListRowDTO + .GroupBy(r => 1) + .Select(g => new + { + TotalRowCount = g.Count(), + EmptyAnswerCount = g.Count(r => string.IsNullOrEmpty(r.Answer)), + CheckPointCount = g.Select(r => r.CheckListTemplateRowDTO.CheckPointId).Distinct().Count() + }) + .FirstOrDefault(); + if (result != null) + { + CheckListHeaderInfoDTO.TotalRowCount = result.TotalRowCount; + CheckListHeaderInfoDTO.CheckPointCount = result.CheckPointCount; + CheckListHeaderInfoDTO.EmptyAnswerCount = result.EmptyAnswerCount; + if (CheckListHeaderInfoDTO.TotalRowCount > 0) + { + CheckListHeaderInfoDTO.ReadyPercent = ((CheckListHeaderInfoDTO.TotalRowCount - CheckListHeaderInfoDTO.EmptyAnswerCount) / CheckListHeaderInfoDTO.TotalRowCount * 100) + .ToString("0.00", new CultureInfo("hu-HU")) + " %"; ; + } + } } public async Task OnGetLoadCheckListRows(int id) {