Módosítások fejlesztéshez

This commit is contained in:
2025-03-20 09:00:01 +01:00
parent 7a158ed10d
commit bd60138a89
4 changed files with 55 additions and 7 deletions
@@ -160,6 +160,9 @@ namespace WorkFlowCheck.BL.Services
var res = await _dbContext.CheckListTemplateHeaders var res = await _dbContext.CheckListTemplateHeaders
.Where(w => w.Id == Id) .Where(w => w.Id == Id)
.Include(i => i.CheckListTemplateRows) .Include(i => i.CheckListTemplateRows)
.ThenInclude(i=> i.CheckPoint)
.Include(i => i.CheckListTemplateRows)
.ThenInclude(i => i.Equipment)
.AsNoTracking() .AsNoTracking()
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
@@ -40,6 +40,7 @@
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Short Name</th> <th>Short Name</th>
<th>Checkpoint</th>
<th>OperationDescription</th> <th>OperationDescription</th>
<th>AnswerType</th> <th>AnswerType</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
@@ -49,6 +50,7 @@
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Short Name</th> <th>Short Name</th>
<th>Checkpoint</th>
<th>OperationDescription</th> <th>OperationDescription</th>
<th>AnswerType</th> <th>AnswerType</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
@@ -67,6 +69,7 @@
columns: [ columns: [
{ data: "id" }, { data: "id" },
{ data: "rowIndex" }, { data: "rowIndex" },
{ data: "checkPointDTO.shortName" },
{ data: "operationDescription" }, { data: "operationDescription" },
{ data: "answerType" }, { data: "answerType" },
{ data: null, render: function (data, type, row) { { data: null, render: function (data, type, row) {
@@ -79,7 +82,7 @@
"visible": false "visible": false
}, },
{ {
"targets": 4, "targets": 5,
"className": "text-center", "className": "text-center",
"width": "10%" "width": "10%"
} }
@@ -18,22 +18,42 @@
<meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" /> <meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" />
<input type="hidden" asp-for="CheckListTemplateRow.Id" /> <input type="hidden" asp-for="CheckListTemplateRow.Id" />
<input type="hidden" asp-for="CheckListTemplateRow.CheckListTemplateHeaderId" /> <input type="hidden" asp-for="CheckListTemplateRow.CheckListTemplateHeaderId" />
<div class="row mb-3">
<div class="col-md-3">
<label asp-for="CheckListTemplateRow.RowIndex"></label>
<input asp-for="CheckListTemplateRow.RowIndex" class="form-control" />
<span asp-validation-for="CheckListTemplateRow.RowIndex" class="text-danger"></span>
</div>
<div class="col-md-3">
<label asp-for="CheckListTemplateRow.CheckPointId"></label>
<select asp-for="CheckListTemplateRow.CheckPointId" class="form-control" asp-items="Model.CheckPoints"></select>
<span asp-validation-for="CheckListTemplateRow.CheckPointId" class="text-danger"></span>
</div>
<div class="col-md-3">
<label asp-for="CheckListTemplateRow.EquipmentId"></label>
<select asp-for="CheckListTemplateRow.EquipmentId" class="form-control" asp-items="Model.Equipments"></select>
<span asp-validation-for="CheckListTemplateRow.EquipmentId" class="text-danger"></span>
</div>
<div class="col-md-3">
<label asp-for="CheckListTemplateRow.AnswerType"></label>
<select asp-for="CheckListTemplateRow.AnswerType" class="form-control" asp-items="Model.AnswerTypes"></select>
<span asp-validation-for="CheckListTemplateRow.AnswerType" class="text-danger"></span>
</div>
</div>
<div class="mb-3"> <div class="mb-3">
<label asp-for="CheckListTemplateRow.OperationDescription"></label> <label asp-for="CheckListTemplateRow.OperationDescription"></label>
<textarea asp-for="CheckListTemplateRow.OperationDescription" class="form-control" rows="4"></textarea> <textarea asp-for="CheckListTemplateRow.OperationDescription" class="form-control" rows="4"></textarea>
<span asp-validation-for="CheckListTemplateRow.OperationDescription" class="text-danger"></span> <span asp-validation-for="CheckListTemplateRow.OperationDescription" class="text-danger"></span>
</div> </div>
<div class="mb-3">
<label asp-for="CheckListTemplateRow.AnswerType"></label>
<select asp-for="CheckListTemplateRow.AnswerType" class="form-control" asp-items="Model.AnswerTypes"></select>
<span asp-validation-for="CheckListTemplateRow.AnswerType" class="text-danger"></span>
</div>
<div class="mb-3"> <div class="mb-3">
<button type="button" id="saveCheckListTemplateRow" class="btn btn-primary">Mentés</button> <button type="button" id="saveCheckListTemplateRow" class="btn btn-primary">Mentés</button>
<button type="button" class="btn btn-secondary" onclick="history.back()">Mégsem</button> <button type="button" class="btn btn-secondary" onclick="history.back()">Mégsem</button>
</div> </div>
</form> </form>
</div> </div>
@section Scripts { @section Scripts {
@@ -21,6 +21,12 @@ namespace WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateRows
.Select(x => new SelectListItem { Value = x, Text = x }) .Select(x => new SelectListItem { Value = x, Text = x })
.ToList(); .ToList();
[BindProperty]
public List<SelectListItem> CheckPoints { get; set; }
[BindProperty]
public List<SelectListItem> Equipments { get; set; }
public CheckListTemplateRowEditPageModel(ILogger<IndexModel> logger, IBaseStockService baseStockService) public CheckListTemplateRowEditPageModel(ILogger<IndexModel> logger, IBaseStockService baseStockService)
{ {
_baseStockService = baseStockService; _baseStockService = baseStockService;
@@ -29,7 +35,23 @@ namespace WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateRows
public async Task OnGet(int id) public async Task OnGet(int id)
{ {
CheckListTemplateRow = await _baseStockService.GetCheckListTemplateRow(id); await InitSelectItems();
CheckListTemplateRow = await _baseStockService.GetCheckListTemplateRow(id);
}
private async Task InitSelectItems()
{
var checkPoints = await _baseStockService.GetAllCheckPoints();
this.CheckPoints = new List<SelectListItem>();
foreach (var checkPoint in checkPoints)
{
this.CheckPoints.Add(new SelectListItem() { Value = checkPoint.Id.ToString(), Text = checkPoint.ShortName });
}
var equipments = await _baseStockService.GetAllEquipments();
this.Equipments = new List<SelectListItem>();
foreach (var equipment in equipments)
{
this.Equipments.Add(new SelectListItem() { Value = equipment.Id.ToString(), Text = equipment.ShortName });
}
} }
} }
} }