CheckListHeader-be új infók
This commit is contained in:
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
+46
-11
@@ -34,16 +34,51 @@
|
|||||||
<form method="post" id="CheckListHeaderForm">
|
<form method="post" id="CheckListHeaderForm">
|
||||||
<meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" />
|
<meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" />
|
||||||
<input type="hidden" asp-for="CheckListHeaderDTO.Id" />
|
<input type="hidden" asp-for="CheckListHeaderDTO.Id" />
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<label asp-for="CheckListHeaderDTO.DocumentNumber"></label>
|
||||||
|
<input asp-for="CheckListHeaderDTO.DocumentNumber" class="form-control" readonly/>
|
||||||
|
<span asp-validation-for="CheckListHeaderDTO.DocumentNumber" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<label asp-for="CheckListHeaderDTO.CheckStatus"></label>
|
||||||
|
<select asp-for="CheckListHeaderDTO.CheckStatus" class="form-control" asp-items="Model.CheckStatus" readonly></select>
|
||||||
|
<span asp-validation-for="CheckListHeaderDTO.CheckStatus" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<label asp-for="CheckListHeaderInfoDTO.TotalRowCount"></label>
|
||||||
|
<input asp-for="CheckListHeaderInfoDTO.TotalRowCount" class="form-control" readonly />
|
||||||
|
<span asp-validation-for="CheckListHeaderInfoDTO.TotalRowCount" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<label asp-for="CheckListHeaderInfoDTO.CheckPointCount"></label>
|
||||||
|
<input asp-for="CheckListHeaderInfoDTO.CheckPointCount" class="form-control" readonly />
|
||||||
|
<span asp-validation-for="CheckListHeaderInfoDTO.CheckPointCount" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<label asp-for="CheckListHeaderInfoDTO.EmptyAnswerCount"></label>
|
||||||
|
<input asp-for="CheckListHeaderInfoDTO.EmptyAnswerCount" class="form-control" readonly />
|
||||||
|
<span asp-validation-for="CheckListHeaderInfoDTO.EmptyAnswerCount" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<label asp-for="CheckListHeaderInfoDTO.ReadyPercent"></label>
|
||||||
|
<input asp-for="CheckListHeaderInfoDTO.ReadyPercent" class="form-control" readonly />
|
||||||
|
<span asp-validation-for="CheckListHeaderInfoDTO.ReadyPercent" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label asp-for="CheckListHeaderDTO.ShortName"></label>
|
<label asp-for="CheckListHeaderDTO.ShortName"></label>
|
||||||
<input asp-for="CheckListHeaderDTO.ShortName" class="form-control" />
|
<input asp-for="CheckListHeaderDTO.ShortName" class="form-control" />
|
||||||
<span asp-validation-for="CheckListHeaderDTO.ShortName" class="text-danger"></span>
|
<span asp-validation-for="CheckListHeaderDTO.ShortName" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label asp-for="CheckListHeaderDTO.DocumentNumber"></label>
|
<label asp-for="CheckListHeaderDTO.Description"></label>
|
||||||
<input asp-for="CheckListHeaderDTO.DocumentNumber" class="form-control" />
|
<textarea asp-for="CheckListHeaderDTO.Description" class="form-control" rows="4"></textarea>
|
||||||
<span asp-validation-for="CheckListHeaderDTO.DocumentNumber" class="text-danger"></span>
|
<span asp-validation-for="CheckListHeaderDTO.Description" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr class="mt-4 mb-3 border-secondary">
|
<hr class="mt-4 mb-3 border-secondary">
|
||||||
<div class="mb-3 d-flex justify-content-between">
|
<div class="mb-3 d-flex justify-content-between">
|
||||||
<button type="button" id="saveCheckListHeader" class="btn btn-primary">Mentés</button>
|
<button type="button" id="saveCheckListHeader" class="btn btn-primary">Mentés</button>
|
||||||
@@ -63,20 +98,20 @@
|
|||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.CheckListTemplateRowDTO.RowIndex), typeof(CheckListTemplateRowDTO))</th>
|
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.CheckListTemplateRowDTO.RowIndex), typeof(CheckListTemplateRowDTO))</th>
|
||||||
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.CheckListTemplateRowDTO.CheckPointDTO.ShortName), typeof(CheckPointDTO))</th>
|
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.CheckListTemplateRowDTO.CheckPointDTO.ShortName), typeof(CheckPointDTO))</th>
|
||||||
<th>OperationDescription</th>
|
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.OperationDescription), typeof(CheckListTemplateRowDTO))</th>
|
||||||
<th>AnswerType</th>
|
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.AnswerType), typeof(CheckListTemplateRowDTO))</th>
|
||||||
<th>Answer</th>
|
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.Answer), typeof(CheckListRowDTO))</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>Short Name</th>
|
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.CheckListTemplateRowDTO.RowIndex), typeof(CheckListTemplateRowDTO))</th>
|
||||||
<th>Checkpoint</th>
|
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.CheckListTemplateRowDTO.CheckPointDTO.ShortName), typeof(CheckPointDTO))</th>
|
||||||
<th>OperationDescription</th>
|
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.OperationDescription), typeof(CheckListTemplateRowDTO))</th>
|
||||||
<th>AnswerType</th>
|
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.AnswerType), typeof(CheckListTemplateRowDTO))</th>
|
||||||
<th>Answer</th>
|
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.Answer), typeof(CheckListRowDTO))</th>
|
||||||
<th class="text-center">Action</th>
|
<th class="text-center">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
|
|||||||
+32
@@ -1,6 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
|
using System.Globalization;
|
||||||
using WorkFlowCheck.Common.DTO;
|
using WorkFlowCheck.Common.DTO;
|
||||||
using WorkFlowCheck.Web.Services.Interfaces;
|
using WorkFlowCheck.Web.Services.Interfaces;
|
||||||
|
|
||||||
@@ -13,6 +14,11 @@ namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader
|
|||||||
|
|
||||||
[BindProperty]
|
[BindProperty]
|
||||||
public CheckListHeaderDTO CheckListHeaderDTO { get; set; }
|
public CheckListHeaderDTO CheckListHeaderDTO { get; set; }
|
||||||
|
|
||||||
|
[BindProperty]
|
||||||
|
public CheckListHeaderInfoDTO CheckListHeaderInfoDTO { get; set; }
|
||||||
|
|
||||||
|
[BindProperty]
|
||||||
public List<SelectListItem> CheckStatus { get; set; }
|
public List<SelectListItem> CheckStatus { get; set; }
|
||||||
|
|
||||||
public CheckListHeaderEditPageModel(ILogger<IndexModel> logger, ICheckListService checkListService)
|
public CheckListHeaderEditPageModel(ILogger<IndexModel> logger, ICheckListService checkListService)
|
||||||
@@ -24,6 +30,32 @@ namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader
|
|||||||
{
|
{
|
||||||
CheckListHeaderDTO = await _checkListService.GetCheckListHeader(id);
|
CheckListHeaderDTO = await _checkListService.GetCheckListHeader(id);
|
||||||
CheckStatus = _checkListService.GetCheckStatus();
|
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<JsonResult> OnGetLoadCheckListRows(int id)
|
public async Task<JsonResult> OnGetLoadCheckListRows(int id)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user