Most működik az üzenetküldés Backenden
This commit is contained in:
@@ -27,6 +27,11 @@
|
||||
<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="CheckPointDTO.RoleId"></label>
|
||||
<select asp-for="CheckPointDTO.RoleId" class="form-control" asp-items="Model.Roles"></select>
|
||||
<span asp-validation-for="CheckPointDTO.RoleId" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label asp-for="CheckPointDTO.IsEnabled"></label>
|
||||
<input type="checkbox" asp-for="CheckPointDTO.IsEnabled" class="form-check-input" />
|
||||
@@ -117,16 +122,7 @@
|
||||
$('#tbCheckPointsEditPage').on('click', '.delete-btn', function ()
|
||||
{
|
||||
const row = table.row($(this).closest('tr')).data();
|
||||
showConfirmModal({
|
||||
title: 'Törlés megerősítése',
|
||||
message: 'Biztosan törölni szeretnéd ezt az elemet?',
|
||||
okText: 'Törlés',
|
||||
cancelText: 'Mégsem'
|
||||
}).then(function(result) {
|
||||
if(result === 'ok') {
|
||||
console.log('Törlés végrehajtva');
|
||||
}
|
||||
});
|
||||
deleteEntity(table, '/CheckListTemplate/CheckListTemplateRows/CheckListTemplateRowEditPage?handler=DeleteCheckPoint', row.id);
|
||||
});
|
||||
|
||||
$("#saveCheckPoint").click(function () {
|
||||
@@ -138,42 +134,6 @@
|
||||
|
||||
saveEntity(csrfToken, formData.CheckPointDTO, $('#checkPointEditPostUrl').val());
|
||||
|
||||
// $.ajax({
|
||||
// url: $('#checkPointEditPostUrl').val(),
|
||||
// type: 'POST',
|
||||
// headers: {
|
||||
// 'X-CSRF-TOKEN': csrfToken,
|
||||
// 'Content-Type': 'application/json'
|
||||
// },
|
||||
// data: JSON.stringify(formData.CheckPointDTO),
|
||||
// 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) {
|
||||
// console.error("Hiba: ", error);
|
||||
// showMessageModal({
|
||||
// title: 'Hiba!',
|
||||
// message: 'A mentés NEM sikerült!',
|
||||
// okText: 'Értettem'
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Serilog;
|
||||
using WorkFlowCheck.Common.DTO;
|
||||
using WorkFlowCheck.Web.Services.Interfaces;
|
||||
@@ -13,17 +14,24 @@ namespace WorkFlowCheck.Web.Pages.BaseStock.CheckPoints
|
||||
{
|
||||
private readonly ILogger<IndexModel> _logger;
|
||||
private readonly IBaseStockService _baseStockService;
|
||||
private readonly IUserService _userService;
|
||||
|
||||
[BindProperty]
|
||||
public CheckPointDTO CheckPointDTO { get; set; }
|
||||
[BindProperty]
|
||||
public List<SelectListItem> Roles { get; set; }
|
||||
|
||||
public CheckPointEditPageModel(ILogger<IndexModel> logger, IBaseStockService baseStockService)
|
||||
public CheckPointEditPageModel(ILogger<IndexModel> logger,
|
||||
IBaseStockService baseStockService,
|
||||
IUserService userService)
|
||||
{
|
||||
_baseStockService = baseStockService;
|
||||
_userService = userService;
|
||||
_logger = logger;
|
||||
}
|
||||
public async Task OnGet(int id)
|
||||
{
|
||||
await InitSelectItems();
|
||||
CheckPointDTO = await _baseStockService.GetCheckPoint(id);
|
||||
|
||||
}
|
||||
@@ -54,5 +62,15 @@ namespace WorkFlowCheck.Web.Pages.BaseStock.CheckPoints
|
||||
|
||||
return new JsonResult(new { success = false });
|
||||
}
|
||||
private async Task InitSelectItems()
|
||||
{
|
||||
var roles = await _userService.GetAllRoles();
|
||||
Roles = new List<SelectListItem>();
|
||||
Roles.Add(new SelectListItem() { Value = "-1", Text = "NINCS" });
|
||||
foreach (var role in roles)
|
||||
{
|
||||
Roles.Add(new SelectListItem() { Value = role.Id.ToString(), Text = role.RoleName });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
$('#tbEquipmentsPage').on('click', '.delete-btn', function ()
|
||||
{
|
||||
const row = table.row($(this).closest('tr')).data();
|
||||
deleteEntity(table, '/BaseStock/Equipments/EquipmentPage?handler=DeleteLocation', row.id);
|
||||
deleteEntity(table, '/BaseStock/Equipments/EquipmentPage?handler=DeleteEquipment', row.id);
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@page
|
||||
@model WorkFlowCheck.Web.Pages.UserAndRole.RoleCheckPointsPageModel
|
||||
@using WorkFlowCheck.Common.Helper
|
||||
@using WorkFlowCheck.Common.DTO
|
||||
@{
|
||||
ViewData["Title"] = "Szabályok - Ellenőrzési sablonok";
|
||||
}
|
||||
@@ -15,18 +17,18 @@
|
||||
<thead class="table-primary">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Role name</th>
|
||||
<th>Checkpoint name</th>
|
||||
<th>Enabled</th>
|
||||
<th>>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.RoleDTO.RoleName), typeof(RoleCheckPointDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.CheckPointDTO.ShortName), typeof(RoleCheckPointDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.Enabled), typeof(RoleCheckPointDTO))</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot class="table-light">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Role name</th>
|
||||
<th>Checkpoint name</th>
|
||||
<th>Enabled</th>
|
||||
<th>>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.RoleDTO.RoleName), typeof(RoleCheckPointDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.CheckPointDTO.ShortName), typeof(RoleCheckPointDTO))</th>
|
||||
<th>@DisplayNameHelper.GetDisplayName(nameof(RoleCheckPointDTO.Enabled), typeof(RoleCheckPointDTO))</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
Reference in New Issue
Block a user