Jó kis javítás, fejlesztés TESZT-hez
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
@inject IAntiforgery Antiforgery
|
||||
@{
|
||||
ViewData["Title"] = "Ellenőrzési pont";
|
||||
var checkpointId = Model.CheckPoint.Id;
|
||||
var checkpointId = Model.CheckPointDTO.Id;
|
||||
var url = Url.Page("./CheckPointEditPage", "LoadCheckListTemplateRows", new { id = checkpointId });
|
||||
var urlPost = Url.Page("./CheckPointEditPage", "Save");
|
||||
}
|
||||
@@ -16,21 +16,21 @@
|
||||
<div class="card shadow p-4">
|
||||
<form method="post" id="checkPointForm">
|
||||
<meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" />
|
||||
<input type="hidden" asp-for="CheckPoint.Id" />
|
||||
<input type="hidden" asp-for="CheckPointDTO.Id" />
|
||||
<div class="mb-3">
|
||||
<label asp-for="CheckPoint.ShortName"></label>
|
||||
<input asp-for="CheckPoint.ShortName" class="form-control" />
|
||||
<span asp-validation-for="CheckPoint.ShortName" class="text-danger"></span>
|
||||
<label asp-for="CheckPointDTO.ShortName"></label>
|
||||
<input asp-for="CheckPointDTO.ShortName" class="form-control" />
|
||||
<span asp-validation-for="CheckPointDTO.ShortName" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label asp-for="CheckPoint.Code"></label>
|
||||
<input asp-for="CheckPoint.Code" class="form-control" />
|
||||
<span asp-validation-for="CheckPoint.Code" class="text-danger"></span>
|
||||
<label asp-for="CheckPointDTO.Code"></label>
|
||||
<input asp-for="CheckPointDTO.Code" class="form-control" />
|
||||
<span asp-validation-for="CheckPointDTO.Code" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label asp-for="CheckPoint.IsEnabled"></label>
|
||||
<input type="checkbox" asp-for="CheckPoint.IsEnabled" class="form-check-input" />
|
||||
<span asp-validation-for="CheckPoint.IsEnabled" class="text-danger"></span>
|
||||
<label asp-for="CheckPointDTO.IsEnabled"></label>
|
||||
<input type="checkbox" asp-for="CheckPointDTO.IsEnabled" class="form-check-input" />
|
||||
<span asp-validation-for="CheckPointDTO.IsEnabled" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<button type="button" id="saveCheckPoint" class="btn btn-primary">Mentés</button>
|
||||
@@ -66,27 +66,7 @@
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<style>
|
||||
.box {
|
||||
display: inline-block;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
margin: 1px;
|
||||
text-align: center;
|
||||
line-height: 25px;
|
||||
font-size: 15px;
|
||||
border: 1px solid black;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.yellow-box {
|
||||
background-color: yellow;
|
||||
}
|
||||
|
||||
.red-box {
|
||||
background-color: red;
|
||||
}
|
||||
</style>
|
||||
@section Scripts {
|
||||
<script>
|
||||
|
||||
@@ -101,28 +81,12 @@
|
||||
{ data: "rowIndex" },
|
||||
{ data: "operationDescription" },
|
||||
{
|
||||
data: "answerType",
|
||||
searchable: false,
|
||||
sortable: false,
|
||||
render: function ( data, type, row ) {
|
||||
if (data === 'SI-N') {
|
||||
return '<div class="text-center"><div class="box yellow-box">I</div><div class="box">N</div></div>';
|
||||
}
|
||||
if (data === 'I-SN') {
|
||||
return '<div class="text-center"><div class="box">I</div><div class="box yellow-box">N</div></div>';
|
||||
}
|
||||
if (data === 'PI-N') {
|
||||
return '<div class="text-center"><div class="box red-box">I</div><div class="box">N</div></div>';
|
||||
}
|
||||
if (data === 'I-PN') {
|
||||
return '<div class="text-center"><div class="box">I</div><div class="box red-box">N</div></div>';
|
||||
}
|
||||
if (data==='P'){
|
||||
return '<div class="text-center"><i class="fas fa-camera fa-2x"></i></div>';
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
data: "answerType",
|
||||
searchable: false,
|
||||
sortable: false,
|
||||
render: function ( data, type, row ) {
|
||||
return renderAnswerType(data);
|
||||
}
|
||||
},
|
||||
{ data: null, render: function (data, type, row) {
|
||||
return renderActionButtons(row.id);
|
||||
@@ -169,6 +133,9 @@
|
||||
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
|
||||
var formData = getFormAsNestedObject('#checkPointForm');
|
||||
|
||||
formData.CheckPointDTO.CheckListTemplateRowDTO = [];
|
||||
formData.CheckPointDTO.IsEnabled = $('#CheckPointDTO_IsEnabled').is(':checked');
|
||||
|
||||
$.ajax({
|
||||
url: $('#checkPointEditPostUrl').val(),
|
||||
type: 'POST',
|
||||
@@ -176,13 +143,24 @@
|
||||
'X-CSRF-TOKEN': csrfToken,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: JSON.stringify(formData.CheckPoint),
|
||||
data: JSON.stringify(formData.CheckPointDTO),
|
||||
success: function (response) {
|
||||
showMessageModal({
|
||||
title: 'Figyelmem!',
|
||||
message: 'Sikeres mentés.',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
if (response.success)
|
||||
{
|
||||
showMessageModal({
|
||||
title: 'Figyelmem!',
|
||||
message: 'Sikeres mentés.',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
showMessageModal({
|
||||
title: 'Figyelmem, HIBA!',
|
||||
message: 'Sikertelen mentés.',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
// Hiba esetén
|
||||
|
||||
Reference in New Issue
Block a user