DisplayNameHelper kifejlesztése
This commit is contained in:
@@ -48,6 +48,16 @@
|
||||
<input asp-for="UserDTO.LastName" class="form-control" />
|
||||
<span asp-validation-for="UserDTO.LastName" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label asp-for="UserDTO.Active"></label>
|
||||
<input type="checkbox" asp-for="UserDTO.Active" class="form-check-input" />
|
||||
<span asp-validation-for="UserDTO.Active" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label asp-for="UserDTO.NFCActive"></label>
|
||||
<input type="checkbox" asp-for="UserDTO.NFCActive" class="form-check-input" />
|
||||
<span asp-validation-for="UserDTO.NFCActive" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3 d-flex justify-content-between">
|
||||
<button type="button" id="saveUser" class="btn btn-primary">Mentés</button>
|
||||
<button type="button" class="btn btn-secondary" onclick="history.back()">Mégsem</button>
|
||||
@@ -102,35 +112,13 @@
|
||||
var formData = getFormAsNestedObject('#UserForm');
|
||||
const $form = $('#UserForm');
|
||||
|
||||
formData.User.RoleDTO=[];
|
||||
formData.UserDTO.RoleDTO=[];
|
||||
formData.UserDTO.Active = $('#UserForm input[name="UserDTO.Active"]').is(':checked');
|
||||
formData.UserDTO.NFCActive = $('#UserForm input[name="UserDTO.NFCActive"]').is(':checked');
|
||||
|
||||
if ($form.valid())
|
||||
{
|
||||
$.ajax({
|
||||
url: $('#UserEditPostUrl').val(),
|
||||
type: 'POST',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': csrfToken,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: JSON.stringify(formData.User),
|
||||
success: function (response) {
|
||||
showMessageModal({
|
||||
title: 'Figyelmem!',
|
||||
message: 'Sikeres 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.UserDTO, $('#UserEditPostUrl').val());
|
||||
} else
|
||||
{
|
||||
$form[0].reportValidity();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@page
|
||||
@model WorkFlowCheck.Web.Pages.UserAndRole.UserPageModel
|
||||
@using WorkFlowCheck.Common.Helper
|
||||
@using WorkFlowCheck.Common.DTO
|
||||
@{
|
||||
ViewData["Title"] = "Felhasználók";
|
||||
}
|
||||
@@ -15,20 +17,24 @@
|
||||
<thead class="table-primary">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>First Name</th>
|
||||
<th>Last Name</th>
|
||||
<th>User Name</th>
|
||||
<th>E-mail</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName("Active", typeof(UserDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName("NFCActive", typeof(UserDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName("FirstName", typeof(UserDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName("LastName", typeof(UserDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName("UserName", typeof(UserDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName("Email", typeof(UserDTO))</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot class="table-light">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>First Name</th>
|
||||
<th>Last Name</th>
|
||||
<th>User Name</th>
|
||||
<th>E-mail</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName("Active", typeof(UserDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName("NFCActive", typeof(UserDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName("FirstName", typeof(UserDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName("LastName", typeof(UserDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName("UserName", typeof(UserDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName("Email", typeof(UserDTO))</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
@@ -45,6 +51,26 @@
|
||||
},
|
||||
columns: [
|
||||
{ data: "id" },
|
||||
{
|
||||
data: "active",
|
||||
searchable: false,
|
||||
sortable: false,
|
||||
className: "text-center",
|
||||
render: function ( data, type, row ) {
|
||||
return renderCheckBox(data);
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
data: "nfcActive",
|
||||
searchable: false,
|
||||
sortable: false,
|
||||
className: "text-center",
|
||||
render: function ( data, type, row ) {
|
||||
return renderCheckBox(data);
|
||||
}
|
||||
|
||||
},
|
||||
{ data: "firstName" },
|
||||
{ data: "lastName" },
|
||||
{ data: "userName" },
|
||||
@@ -59,7 +85,7 @@
|
||||
"visible": false
|
||||
},
|
||||
{
|
||||
"targets": 5,
|
||||
"targets": 7,
|
||||
"className": "text-center",
|
||||
"width": "10%"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user