This commit is contained in:
2025-04-25 10:32:08 +02:00
17 changed files with 191 additions and 40 deletions
+1
View File
@@ -341,3 +341,4 @@ ASALocalRun/
healthchecksdb
/src/WorkFlowCheck.API/Images
*.pdf
/src/WorkFlowCheck.API/Pdf/c86f3a6a-c646-4627-823c-7e24134b7725.docx
@@ -303,6 +303,28 @@ namespace WorkFlowCheck.API.Controllers
return retVal;
}
[HttpGet("DeleteCheckListTemplateRow/{id}")]
public async Task<ApiResponseDTO<bool>> DeleteCheckListTemplateRow(int id)
{
var retVal = new ApiResponseDTO<bool>()
{
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<ApiResponseDTO<CheckListTemplateRowDTO>> UpdateCheckListTemplateRow([FromBody] CheckListTemplateRowDTO CheckListTemplateRowDTO)
{
@@ -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<CheckListTemplateHeaderDTO> GetCheckListTemplateHeaderAsync(int Id)
{
var retVal = new CheckListTemplateHeaderDTO()
@@ -517,6 +515,10 @@ namespace WorkFlowCheck.BL.Services
return retVal;
}
public async Task<bool> DeleteCheckListTemplateRowAsync(int id)
{
return await DeleteEntityByIdAsync<CheckListTemplateRow>(id);
}
public async Task<CheckListTemplateRowDTO> UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO)
{
var retVal = new CheckListTemplateRowDTO() { };
@@ -21,6 +21,7 @@ namespace WorkFlowCheck.BL.Services.Interfaces
Task<CheckListTemplateHeaderDTO> UpdateCheckListTemplateHeaderAsync(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO);
Task<CheckListTemplateRowDTO> GetCheckListTemplateRowAsync(int id);
Task<bool> DeleteCheckListTemplateRowAsync(int id);
Task<CheckListTemplateRowDTO> UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO);
Task<CheckListRowDTO> GetCheckListRowAsync(int id);
@@ -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; }
}
}
@@ -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>? CheckListTemplateRowDTO { get; set; } = new List<CheckListTemplateRowDTO>();
@@ -35,6 +35,7 @@ namespace WorkFlowCheck.Common.DTO
/// V (Érték megadása)
///
/// </summary>
[DisplayName("Válasz tipus")]
public string AnswerType { get; set; } = null!;
@@ -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)
{
@@ -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>
@@ -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)
{
@@ -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 @@
<thead class="table-primary">
<tr>
<th>ID</th>
<th>Short Name</th>
<th>Checkpoint</th>
<th>OperationDescription</th>
<th>AnswerType</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.RowIndex), typeof(CheckListTemplateRowDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckPointDTO.ShortName), typeof(CheckPointDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.OperationDescription), typeof(CheckListTemplateRowDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.AnswerType), typeof(CheckListTemplateRowDTO))</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>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.RowIndex), typeof(CheckListTemplateRowDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckPointDTO.ShortName), typeof(CheckPointDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.OperationDescription), typeof(CheckListTemplateRowDTO))</th>
<th>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.AnswerType), typeof(CheckListTemplateRowDTO))</th>
<th class="text-center">Action</th>
</tr>
</tfoot>
@@ -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');
@@ -71,5 +71,10 @@ namespace WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader
});
}
}
public async Task<JsonResult> OnGetDeleteCheckListTemplateRow(int id)
{
var isSuccess = await _checkListService.DeleteCheckListTemplateRow(id);
return new JsonResult(new { result = isSuccess });
}
}
}
@@ -265,6 +265,27 @@ namespace WorkFlowCheck.Web.Services
}
return retVal;
}
public async Task<bool> DeleteCheckListTemplateRow(int id)
{
string endpoint = $"{_httpClient.BaseAddress}api/CheckList/DeleteCheckListTemplateRow/{id}";
var retVal = false;
try
{
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<bool>>(endpoint);
if (response != null)
{
if (response.IsSuccess)
{
return response.Data;
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<ApiResponseDTO<CheckListTemplateRowDTO>> UpdateCheckListTemplateRow(CheckListTemplateRowDTO checkListTemplateRowDTO)
{
try
@@ -21,6 +21,7 @@ namespace WorkFlowCheck.Web.Services.Interfaces
Task<CheckListTemplateRowDTO> GetCheckListTemplateRow(int id);
Task<bool> DeleteCheckListTemplateRow(int id);
Task<ApiResponseDTO<CheckListTemplateRowDTO>> UpdateCheckListTemplateRow(CheckListTemplateRowDTO checkListTemplateRowDTO);
@@ -44,3 +44,7 @@ body {
.red-box {
background-color: red;
}
.icon-green {
color: green;
}
+3 -3
View File
@@ -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 '<div class="text-center"><i class="fas fa-camera fa-2x"></i></div>';
}
if (data === 'PN') {
return '<div class="text-center"><i class="fas fa-camera fa-2x icon-green"></i></div>';
}
if (data === 'V') {
return '<div class="text-center"><span class="border border-dark rounded p-1">0,00</span></div>';
}