NFC azonosítás is kész
This commit is contained in:
@@ -15,11 +15,39 @@
|
||||
<form method="post" id="RoleForm">
|
||||
<meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" />
|
||||
<input type="hidden" asp-for="RoleDTO.Id" />
|
||||
<div class="col-md-3">
|
||||
<label asp-for="RoleDTO.ParentId"></label>
|
||||
<select asp-for="RoleDTO.ParentId" class="form-control" asp-items="Model.Parents"></select>
|
||||
<span asp-validation-for="RoleDTO.ParentId" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label asp-for="RoleDTO.RoleName"></label>
|
||||
<input asp-for="RoleDTO.RoleName" class="form-control" />
|
||||
<span asp-validation-for="RoleDTO.RoleName" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="mb-3">
|
||||
<label asp-for="RoleDTO.IsAdmin"></label>
|
||||
<input type="checkbox" asp-for="RoleDTO.IsAdmin" class="form-check-input" />
|
||||
<span asp-validation-for="RoleDTO.IsAdmin" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mb-3">
|
||||
<label asp-for="RoleDTO.CanDownloadAPK"></label>
|
||||
<input type="checkbox" asp-for="RoleDTO.CanDownloadAPK" class="form-check-input" />
|
||||
<span asp-validation-for="RoleDTO.CanDownloadAPK" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mb-3">
|
||||
<label asp-for="RoleDTO.CanEnableBlocked"></label>
|
||||
<input type="checkbox" asp-for="RoleDTO.CanEnableBlocked" class="form-check-input" />
|
||||
<span asp-validation-for="RoleDTO.CanEnableBlocked" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 d-flex justify-content-between">
|
||||
<button type="button" id="saveRole" class="btn btn-primary">Mentés</button>
|
||||
<button type="button" class="btn btn-secondary" onclick="history.back()">Mégsem</button>
|
||||
@@ -34,47 +62,13 @@
|
||||
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
|
||||
var formData = getFormAsNestedObject('#RoleForm');
|
||||
const $form = $('#RoleForm');
|
||||
|
||||
|
||||
formData.RoleDTO.IsAdmin = $('#RoleForm input[name="RoleDTO.IsAdmin"]').is(':checked');
|
||||
formData.RoleDTO.CanDownloadAPK = $('#RoleForm input[name="RoleDTO.CanDownloadAPK"]').is(':checked');
|
||||
formData.RoleDTO.CanEnableBlocked = $('#RoleForm input[name="RoleDTO.CanEnableBlocked"]').is(':checked');
|
||||
|
||||
if ($form.valid())
|
||||
{
|
||||
$.ajax({
|
||||
url: $('#RoleEditPostUrl').val(),
|
||||
type: 'POST',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': csrfToken,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: JSON.stringify(formData.RoleDTO),
|
||||
success: function (response) {
|
||||
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
|
||||
console.error("Hiba: ", error);
|
||||
showMessageModal({
|
||||
title: 'Hiba!',
|
||||
message: 'A mentés NEM sikerült!',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
}
|
||||
});
|
||||
saveEntity(csrfToken, formData.RoleDTO, $('#RoleEditPostUrl').val());
|
||||
} else
|
||||
{
|
||||
$form[0].reportValidity();
|
||||
|
||||
Reference in New Issue
Block a user