From 83980667d7d94776a614818f28ca4e64300ae3c5 Mon Sep 17 00:00:00 2001 From: ivanszabo Date: Wed, 26 Mar 2025 09:14:27 +0100 Subject: [PATCH] =?UTF-8?q?CheckListRow=20megjelen=C3=ADt=C3=A9se?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/CheckListService.cs | 13 ++ .../DTO/CheckListRowDTO.cs | 2 +- .../CheckListHeaderEditPage.cshtml | 180 ++++++++++++++++++ .../CheckListHeaderEditPage.cshtml.cs | 22 ++- 4 files changed, 215 insertions(+), 2 deletions(-) diff --git a/src/WorkFlowCheck.BL/Services/CheckListService.cs b/src/WorkFlowCheck.BL/Services/CheckListService.cs index 0322744..51ddbf8 100644 --- a/src/WorkFlowCheck.BL/Services/CheckListService.cs +++ b/src/WorkFlowCheck.BL/Services/CheckListService.cs @@ -38,9 +38,22 @@ namespace WorkFlowCheck.BL.Services var res = await _dbContext.CheckListHeaders .Where(w => w.Id == Id) .Include(i => i.CheckListRows) + .ThenInclude(r => r.CheckListTemplateRow) + .ThenInclude(r => r.CheckPoint) + .Include(i => i.CheckListRows) + .ThenInclude(r => r.CheckListTemplateRow) + .ThenInclude(r => r.Equipment) .AsNoTracking() .FirstOrDefaultAsync(); + if (res != null) + { + res.CheckListRows = res.CheckListRows + .OrderBy(r => r.CheckListTemplateRow.CheckPoint?.ShortName ?? string.Empty) + .ThenBy(r => r.CheckListTemplateRow.RowIndex) + .ToList(); + + } if (res != null) { retVal = _mapper.Map(res); diff --git a/src/WorkFlowCheck.Common/DTO/CheckListRowDTO.cs b/src/WorkFlowCheck.Common/DTO/CheckListRowDTO.cs index ccbc98a..8bbdf90 100644 --- a/src/WorkFlowCheck.Common/DTO/CheckListRowDTO.cs +++ b/src/WorkFlowCheck.Common/DTO/CheckListRowDTO.cs @@ -12,7 +12,7 @@ namespace WorkFlowCheck.Common.DTO public int CheckListHeaderId { get; set; } public int CheckListTemplateRowId { get; set; } public CheckListTemplateRowDTO CheckListTemplateRowDTO { get; set; } - public string GroupName => $"AnswerGroup_{CheckListTemplateRowDTO.RowIndex}"; + public string GroupName => $"AnswerGroup_{CheckListTemplateRowDTO?.RowIndex ?? 0}"; public string Answer { get; set; } = null!; public bool? AnswerYes { get; set; } = null!; public bool? AnswerNo { get; set; } = null!; diff --git a/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderEditPage.cshtml b/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderEditPage.cshtml index feae9e5..246ccb4 100644 --- a/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderEditPage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderEditPage.cshtml @@ -1,4 +1,184 @@ @page @model WorkFlowCheck.Web.Pages.CheckList.CheckListHeader.CheckListHeaderEditPageModel +@using Microsoft.AspNetCore.Antiforgery +@inject IAntiforgery Antiforgery @{ + ViewData["Title"] = "Ellenőrzés sablon"; + var CheckListHeaderId = Model.CheckListHeaderDTO.Id; + var url = Url.Page("./CheckListHeaderEditPage", "LoadCheckListRows", new { id = CheckListHeaderId }); + var urlPost = Url.Page("./CheckListHeaderEditPage", "Save"); +} +

@ViewData["Title"]

+ + + + +
+
+ + +
+ + + +
+
+ + +
+
+
+

+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
IDShort NameCheckpointOperationDescriptionAnswerTypeAnswerAction
IDShort NameCheckpointOperationDescriptionAnswerTypeAnswerAction
+
+@section Scripts { + } diff --git a/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderEditPage.cshtml.cs b/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderEditPage.cshtml.cs index 29fc490..8159f34 100644 --- a/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderEditPage.cshtml.cs +++ b/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderEditPage.cshtml.cs @@ -1,12 +1,32 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; +using WorkFlowCheck.Common.DTO; +using WorkFlowCheck.Web.Services.Interfaces; namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader { public class CheckListHeaderEditPageModel : PageModel { - public void OnGet() + private readonly ILogger _logger; + private readonly ICheckListService _checkListService; + + [BindProperty] + public CheckListHeaderDTO CheckListHeaderDTO { get; set; } + + + public CheckListHeaderEditPageModel(ILogger logger, ICheckListService checkListService) { + _logger = logger; + _checkListService = checkListService; + } + public async Task OnGet(int id) + { + CheckListHeaderDTO = await _checkListService.GetCheckListHeader(id); + } + public async Task OnGetLoadCheckListRows(int id) + { + CheckListHeaderDTO = await _checkListService.GetCheckListHeader(id); + return new JsonResult(new { data = CheckListHeaderDTO.CheckListRowDTO }); } } }