CheckListHeader-be új infók
This commit is contained in:
+46
-11
@@ -34,16 +34,51 @@
|
||||
<form method="post" id="CheckListHeaderForm">
|
||||
<meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" />
|
||||
<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">
|
||||
<label asp-for="CheckListHeaderDTO.ShortName"></label>
|
||||
<input asp-for="CheckListHeaderDTO.ShortName" class="form-control" />
|
||||
<span asp-validation-for="CheckListHeaderDTO.ShortName" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label asp-for="CheckListHeaderDTO.DocumentNumber"></label>
|
||||
<input asp-for="CheckListHeaderDTO.DocumentNumber" class="form-control" />
|
||||
<span asp-validation-for="CheckListHeaderDTO.DocumentNumber" class="text-danger"></span>
|
||||
<label asp-for="CheckListHeaderDTO.Description"></label>
|
||||
<textarea asp-for="CheckListHeaderDTO.Description" class="form-control" rows="4"></textarea>
|
||||
<span asp-validation-for="CheckListHeaderDTO.Description" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<hr class="mt-4 mb-3 border-secondary">
|
||||
<div class="mb-3 d-flex justify-content-between">
|
||||
<button type="button" id="saveCheckListHeader" class="btn btn-primary">Mentés</button>
|
||||
@@ -63,20 +98,20 @@
|
||||
<th>ID</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.CheckListTemplateRowDTO.RowIndex), typeof(CheckListTemplateRowDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.CheckListTemplateRowDTO.CheckPointDTO.ShortName), typeof(CheckPointDTO))</th>
|
||||
<th>OperationDescription</th>
|
||||
<th>AnswerType</th>
|
||||
<th>Answer</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.OperationDescription), typeof(CheckListTemplateRowDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.AnswerType), typeof(CheckListTemplateRowDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.Answer), typeof(CheckListRowDTO))</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot class="table-light">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Short Name</th>
|
||||
<th>Checkpoint</th>
|
||||
<th>OperationDescription</th>
|
||||
<th>AnswerType</th>
|
||||
<th>Answer</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(CheckListTemplateRowDTO.OperationDescription), typeof(CheckListTemplateRowDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.AnswerType), typeof(CheckListTemplateRowDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListRowDTO.Answer), typeof(CheckListRowDTO))</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
+32
@@ -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<SelectListItem> CheckStatus { get; set; }
|
||||
|
||||
public CheckListHeaderEditPageModel(ILogger<IndexModel> 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<JsonResult> OnGetLoadCheckListRows(int id)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user