1.1.019 verzió kiadása

This commit is contained in:
2025-04-25 10:31:42 +02:00
parent 1294a00219
commit a324f5f852
13 changed files with 86 additions and 29 deletions
@@ -303,6 +303,28 @@ namespace WorkFlowCheck.API.Controllers
return retVal; 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")] [HttpPost("UpdateCheckListTemplateRow")]
public async Task<ApiResponseDTO<CheckListTemplateRowDTO>> UpdateCheckListTemplateRow([FromBody] CheckListTemplateRowDTO CheckListTemplateRowDTO) public async Task<ApiResponseDTO<CheckListTemplateRowDTO>> UpdateCheckListTemplateRow([FromBody] CheckListTemplateRowDTO CheckListTemplateRowDTO)
{ {
@@ -22,19 +22,16 @@ using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.BL.Services 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; private readonly INumberGeneratorService _numberGeneratorService;
public CheckListService(AppDbContext dbContext, public CheckListService(AppDbContext dbContext,
IMapper mapper, IMapper mapper,
INumberGeneratorService numberGeneratorService, INumberGeneratorService numberGeneratorService,
IUserService userService) IUserService userService) : base(dbContext, mapper)
{ {
_dbContext = dbContext;
_mapper = mapper;
_numberGeneratorService = numberGeneratorService; _numberGeneratorService = numberGeneratorService;
} }
@@ -397,6 +394,7 @@ namespace WorkFlowCheck.BL.Services
} }
return retVal; return retVal;
} }
public async Task<CheckListTemplateHeaderDTO> GetCheckListTemplateHeaderAsync(int Id) public async Task<CheckListTemplateHeaderDTO> GetCheckListTemplateHeaderAsync(int Id)
{ {
var retVal = new CheckListTemplateHeaderDTO() var retVal = new CheckListTemplateHeaderDTO()
@@ -517,6 +515,10 @@ namespace WorkFlowCheck.BL.Services
return retVal; return retVal;
} }
public async Task<bool> DeleteCheckListTemplateRowAsync(int id)
{
return await DeleteEntityByIdAsync<CheckListTemplateRow>(id);
}
public async Task<CheckListTemplateRowDTO> UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO) public async Task<CheckListTemplateRowDTO> UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO)
{ {
var retVal = new CheckListTemplateRowDTO() { }; var retVal = new CheckListTemplateRowDTO() { };
@@ -21,6 +21,7 @@ namespace WorkFlowCheck.BL.Services.Interfaces
Task<CheckListTemplateHeaderDTO> UpdateCheckListTemplateHeaderAsync(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO); Task<CheckListTemplateHeaderDTO> UpdateCheckListTemplateHeaderAsync(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO);
Task<CheckListTemplateRowDTO> GetCheckListTemplateRowAsync(int id); Task<CheckListTemplateRowDTO> GetCheckListTemplateRowAsync(int id);
Task<bool> DeleteCheckListTemplateRowAsync(int id);
Task<CheckListTemplateRowDTO> UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO); Task<CheckListTemplateRowDTO> UpdateCheckListTemplateRowAsync(CheckListTemplateRowDTO checkListTemplateRowDTO);
Task<CheckListRowDTO> GetCheckListRowAsync(int id); Task<CheckListRowDTO> GetCheckListRowAsync(int id);
@@ -1,14 +1,20 @@
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
namespace WorkFlowCheck.Common.DTO namespace WorkFlowCheck.Common.DTO
{ {
public class CheckListTemplateHeaderDTO public class CheckListTemplateHeaderDTO
{ {
public int Id { get; set; } public int Id { get; set; }
[DisplayName("Megnevezés")]
public string ShortName { get; set; } = null!; public string ShortName { get; set; } = null!;
[DisplayName("Leírás")]
public string Description { get; set; } = null!; public string Description { get; set; } = null!;
[DisplayName("Sorszám (munkalap)")]
public int? NumberGenerator1Id { get; set; } public int? NumberGenerator1Id { get; set; }
[DisplayName("Sorszám (dokumentum)")]
public int? NumberGenerator2Id { get; set; } public int? NumberGenerator2Id { get; set; }
public NumberGeneratorTemplateDTO? NumberGenerator1 { get; set; } public NumberGeneratorTemplateDTO? NumberGenerator1 { get; set; }
public NumberGeneratorTemplateDTO? NumberGenerator2 { get; set; } public NumberGeneratorTemplateDTO? NumberGenerator2 { get; set; }
public ICollection<CheckListTemplateRowDTO>? CheckListTemplateRowDTO { get; set; } = new List<CheckListTemplateRowDTO>(); public ICollection<CheckListTemplateRowDTO>? CheckListTemplateRowDTO { get; set; } = new List<CheckListTemplateRowDTO>();
@@ -35,6 +35,7 @@ namespace WorkFlowCheck.Common.DTO
/// V (Érték megadása) /// V (Érték megadása)
/// ///
/// </summary> /// </summary>
[DisplayName("Válasz tipus")]
public string AnswerType { get; set; } = null!; public string AnswerType { get; set; } = null!;
@@ -7,7 +7,7 @@ namespace WorkFlowCheck.Web.Helpers
public static class SystemHelper public static class SystemHelper
{ {
public static string DatabaseName = ""; 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) public async static Task GetAPIInfoAsync(IConfiguration configuration)
{ {
@@ -1,5 +1,7 @@
@page @page
@model WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader.CheckListTemplateHeaderEditPageModel @model WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader.CheckListTemplateHeaderEditPageModel
@using WorkFlowCheck.Common.Helper
@using WorkFlowCheck.Common.DTO
@using Microsoft.AspNetCore.Antiforgery @using Microsoft.AspNetCore.Antiforgery
@inject IAntiforgery Antiforgery @inject IAntiforgery Antiforgery
@{ @{
@@ -57,20 +59,20 @@
<thead class="table-primary"> <thead class="table-primary">
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Short Name</th> <th>@DisplayNameHelper.GetDisplayName(nameof(CheckListTemplateRowDTO.RowIndex), typeof(CheckListTemplateRowDTO))</th>
<th>Checkpoint</th> <th>@DisplayNameHelper.GetDisplayName(nameof(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 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(CheckListTemplateRowDTO.RowIndex), typeof(CheckListTemplateRowDTO))</th>
<th>Checkpoint</th> <th>@DisplayNameHelper.GetDisplayName(nameof(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 class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</tfoot> </tfoot>
@@ -134,17 +136,9 @@
$('#tbCheckListTemplateHeaderPage').on('click', '.delete-btn', function () $('#tbCheckListTemplateHeaderPage').on('click', '.delete-btn', function ()
{ {
const row = table.row($(this).closest('tr')).data(); const row = table.row($(this).closest('tr')).data();
showConfirmModal({ deleteEntity(table, '/CheckListTemplate/CheckListTemplateHeader/CheckListTemplateHeaderEditPage?handler=DeleteCheckListTemplateRow', row.id);
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');
}
});
}); });
$("#saveCheckListTemplateHeader").click(function () { $("#saveCheckListTemplateHeader").click(function () {
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content'); const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
var formData = getFormAsNestedObject('#CheckListTemplateHeaderForm'); 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; 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) public async Task<ApiResponseDTO<CheckListTemplateRowDTO>> UpdateCheckListTemplateRow(CheckListTemplateRowDTO checkListTemplateRowDTO)
{ {
try try
@@ -21,6 +21,7 @@ namespace WorkFlowCheck.Web.Services.Interfaces
Task<CheckListTemplateRowDTO> GetCheckListTemplateRow(int id); Task<CheckListTemplateRowDTO> GetCheckListTemplateRow(int id);
Task<bool> DeleteCheckListTemplateRow(int id);
Task<ApiResponseDTO<CheckListTemplateRowDTO>> UpdateCheckListTemplateRow(CheckListTemplateRowDTO checkListTemplateRowDTO); Task<ApiResponseDTO<CheckListTemplateRowDTO>> UpdateCheckListTemplateRow(CheckListTemplateRowDTO checkListTemplateRowDTO);
@@ -44,3 +44,7 @@ body {
.red-box { .red-box {
background-color: red; background-color: red;
} }
.icon-green {
color: green;
}
+3 -3
View File
@@ -29,7 +29,6 @@ function getFormAsNestedObject(formSelector) {
return result; return result;
} }
function showConfirmModal(options) { function showConfirmModal(options) {
return new Promise(function (resolve) { return new Promise(function (resolve) {
// Alapértelmezett értékek // Alapértelmezett értékek
@@ -72,7 +71,6 @@ function showConfirmModal(options) {
modal.show(); modal.show();
}); });
} }
function showConfirmModalWithMessage(options) { function showConfirmModalWithMessage(options) {
return new Promise(function (resolve) { return new Promise(function (resolve) {
// Alapértelmezett értékek // Alapértelmezett értékek
@@ -127,7 +125,6 @@ function showConfirmModalWithMessage(options) {
modal.show(); modal.show();
}); });
} }
function showMessageModal(options) { function showMessageModal(options) {
// Alapértelmezett értékek // Alapértelmezett értékek
var defaults = { var defaults = {
@@ -296,6 +293,9 @@ function renderAnswerType(data) {
if (data === 'P') { if (data === 'P') {
return '<div class="text-center"><i class="fas fa-camera fa-2x"></i></div>'; 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') { if (data === 'V') {
return '<div class="text-center"><span class="border border-dark rounded p-1">0,00</span></div>'; return '<div class="text-center"><span class="border border-dark rounded p-1">0,00</span></div>';
} }