Equipment, Lokáció de még csak a lista

This commit is contained in:
2025-03-15 14:05:05 +01:00
parent a72c9b342e
commit 9f1c3df5d6
41 changed files with 645 additions and 4 deletions
@@ -97,7 +97,7 @@
$('#tbCheckPointsEditPage').on('click', '.edit-btn', function ()
{
const row = table.row($(this).closest('tr')).data();
window.location.href = `@Url.Page("./CheckListTemplateRowEditPage")?id=${row.id}`;
});
$('#tbCheckPointsEditPage').on('click', '.delete-btn', function ()
@@ -1,5 +1,7 @@
@page
@model WorkFlowCheck.Web.Pages.BaseStock.CheckPoints.CheckPointsPageModel
@using Microsoft.AspNetCore.Antiforgery
@inject IAntiforgery Antiforgery
@{
ViewData["Title"] = "Ellenőrzési pontok";
}
@@ -0,0 +1,4 @@
@page
@model WorkFlowCheck.Web.Pages.BaseStock.Equipments.EquipmentEditPageModel
@{
}
@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WorkFlowCheck.Web.Pages.BaseStock.Equipments
{
public class EquipmentEditPageModel : PageModel
{
public void OnGet()
{
}
}
}
@@ -0,0 +1,84 @@
@page
@model WorkFlowCheck.Web.Pages.BaseStock.Equipments.EquipmentsPageModel
@{
ViewData["Title"] = "Berendezések";
}
<h1>@ViewData["Title"]</h1>
<div class="card shadow p-4">
<div class="d-flex justify-content-end">
<button class="btn btn-primary float-right">Új elem hozzáadása</button>
</div>
<table id="tbEquipmentsPage" class="table table-bordered table-hover table-sm" style="width:100%">
<thead class="table-primary">
<tr>
<th>ID</th>
<th>Short Name</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tfoot class="table-light">
<tr>
<th>ID</th>
<th>Short Name</th>
<th>Action</th>
</tr>
</tfoot>
</table>
</div>
@section Scripts {
<script>
const table = new DataTable('#tbEquipmentsPage', {
ajax: {
url: "@Url.Page("./EquipmentsPage", "LoadEquipments")",
type: "GET",
dataSrc : "data"
},
columns: [
{ data: "id" },
{ data: "shortName" },
{ data: null, render: function (data, type, row) {
return `<button class="btn btn-primary edit-btn" data-id="${row.id}">Módosítás</button>
<button class="btn btn-danger delete-btn" data-id="${row.id}">Törlés</button>
`;
}}
],
columnDefs: [
{
"targets": 0,
"visible": false
},
{
"targets": 2,
"className": "text-center",
"width": "15%"
}
],
processing:true
});
$('#tbEquipmentsPage').on('click', '.edit-btn', function ()
{
const row = table.row($(this).closest('tr')).data();
window.location.href = `@Url.Page("./EquipmentEditPage")?id=${row.id}`;
});
$('#tbEquipmentsPage').on('click', '.delete-btn', function ()
{
const row = table.row($(this).closest('tr')).data();
console.log(row);
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');
}
});
});
</script>
}
@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using WorkFlowCheck.Web.Services.Interfaces;
namespace WorkFlowCheck.Web.Pages.BaseStock.Equipments
{
[Authorize]
public class EquipmentsPageModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
private readonly IBaseStockService _baseStockService;
public EquipmentsPageModel(ILogger<IndexModel> logger, IBaseStockService baseStockService)
{
_logger = logger;
_baseStockService = baseStockService;
}
public async Task OnGet()
{
}
public async Task<JsonResult> OnGetLoadEquipments()
{
var results = await _baseStockService.GetAllEquipments();
return new JsonResult(new { data = results });
}
}
}
@@ -0,0 +1,4 @@
@page
@model WorkFlowCheck.Web.Pages.BaseStock.Locations.LocationEditPageModel
@{
}
@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WorkFlowCheck.Web.Pages.BaseStock.Locations
{
public class LocationEditPageModel : PageModel
{
public void OnGet()
{
}
}
}
@@ -0,0 +1,84 @@
@page
@model WorkFlowCheck.Web.Pages.BaseStock.Locations.LocationsPageModel
@{
ViewData["Title"] = "Lokációk";
}
<h1>@ViewData["Title"]</h1>
<div class="card shadow p-4">
<div class="d-flex justify-content-end">
<button class="btn btn-primary float-right">Új elem hozzáadása</button>
</div>
<table id="tbLocationsPage" class="table table-bordered table-hover table-sm" style="width:100%">
<thead class="table-primary">
<tr>
<th>ID</th>
<th>Full name</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tfoot class="table-light">
<tr>
<th>ID</th>
<th>Full name</th>
<th>Action</th>
</tr>
</tfoot>
</table>
</div>
@section Scripts {
<script>
const table = new DataTable('#tbLocationsPage', {
ajax: {
url: "@Url.Page("./LocationsPage", "LoadLocations")",
type: "GET",
dataSrc : "data"
},
columns: [
{ data: "id" },
{ data: "fullName" },
{ data: null, render: function (data, type, row) {
return `<button class="btn btn-primary edit-btn" data-id="${row.id}">Módosítás</button>
<button class="btn btn-danger delete-btn" data-id="${row.id}">Törlés</button>
`;
}}
],
columnDefs: [
{
"targets": 0,
"visible": false
},
{
"targets": 2,
"className": "text-center",
"width": "15%"
}
],
processing:true
});
$('#tbLocationsPage').on('click', '.edit-btn', function ()
{
const row = table.row($(this).closest('tr')).data();
window.location.href = `@Url.Page("./LocationEditPage")?id=${row.id}`;
});
$('#tbLocationsPage').on('click', '.delete-btn', function ()
{
const row = table.row($(this).closest('tr')).data();
console.log(row);
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');
}
});
});
</script>
}
@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using WorkFlowCheck.Web.Services.Interfaces;
namespace WorkFlowCheck.Web.Pages.BaseStock.Locations
{
[Authorize]
public class LocationsPageModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
private readonly IBaseStockService _baseStockService;
public LocationsPageModel(ILogger<IndexModel> logger, IBaseStockService baseStockService)
{
_logger = logger;
_baseStockService = baseStockService;
}
public async Task OnGet()
{
}
public async Task<JsonResult> OnGetLoadLocations()
{
var results = await _baseStockService.GetAllLocations();
return new JsonResult(new { data = results });
}
}
}
@@ -0,0 +1,4 @@
@page
@model WorkFlowCheck.Web.Pages.CheckList.CheckListHeader.CheckListHeaderEditPageModel
@{
}
@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader
{
public class CheckListHeaderEditPageModel : PageModel
{
public void OnGet()
{
}
}
}
@@ -0,0 +1,4 @@
@page
@model WorkFlowCheck.Web.Pages.CheckList.CheckListHeader.CheckListHeaderPageModel
@{
}
@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader
{
public class CheckListHeaderPageModel : PageModel
{
public void OnGet()
{
}
}
}
@@ -0,0 +1,4 @@
@page
@model WorkFlowCheck.Web.Pages.CheckList.CheckListRow.CheckListRowEditPageModel
@{
}
@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WorkFlowCheck.Web.Pages.CheckList.CheckListRow
{
public class CheckListRowEditPageModel : PageModel
{
public void OnGet()
{
}
}
}
@@ -0,0 +1,4 @@
@page
@model WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader.CheckListTemplateHeaderEditPageModel
@{
}
@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader
{
public class CheckListTemplateHeaderEditPageModel : PageModel
{
public void OnGet()
{
}
}
}
@@ -0,0 +1,4 @@
@page
@model WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader.CheckListTemplateHeaderPageModel
@{
}
@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateHeader
{
public class CheckListTemplateHeaderPageModel : PageModel
{
public void OnGet()
{
}
}
}
@@ -0,0 +1,74 @@
@page
@model WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateRows.CheckListTemplateRowEditPageModel
@using Microsoft.AspNetCore.Antiforgery
@inject IAntiforgery Antiforgery
@{
ViewData["Title"] = "Ellenőrzési pont";
var checklisttemplaterowId = Model.CheckListTemplateRow.Id;
var url = Url.Page("./CheckListTemplateRowEditPage", "LoadCheckListTemplateRows", new { id = checklisttemplaterowId });
var urlPost = Url.Page("./CheckListTemplateRowEditPage", "Save");
}
<h1>@ViewData["Title"]</h1>
<input type="hidden" id="checkListTemplateRowEditUrl" value="@url" />
<input type="hidden" id="checkListTemplateRowEditPostUrl" value="@urlPost" />
<div class="card shadow p-4">
<form method="post" id="checkListTemplateRowForm">
<meta name="csrf-token" content="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken" />
<input type="hidden" asp-for="CheckListTemplateRow.Id" />
<input type="hidden" asp-for="CheckListTemplateRow.CheckListTemplateHeaderId" />
<div class="mb-3">
<label asp-for="CheckListTemplateRow.OperationDescription"></label>
<input asp-for="CheckListTemplateRow.OperationDescription" class="form-control" />
<span asp-validation-for="CheckListTemplateRow.OperationDescription" class="text-danger"></span>
</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">
<button type="button" id="saveCheckListTemplateRow" class="btn btn-primary">Mentés</button>
</div>
</form>
</div>
@section Scripts {
<script>
$("#saveCheckListTemplateRow").click(function () {
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
var formData = getFormAsNestedObject('#checkListTemplateRowForm');
$.ajax({
url: $('#checkListTemplateRowEditPostUrl').val(),
type: 'POST',
headers: {
'X-CSRF-TOKEN': csrfToken,
'Content-Type': 'application/json'
},
data: JSON.stringify(formData.CheckPoint),
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'
});
}
});
});
</script>
}
@@ -0,0 +1,35 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.Web.Services.Interfaces;
namespace WorkFlowCheck.Web.Pages.CheckListTemplate.CheckListTemplateRows
{
public class CheckListTemplateRowEditPageModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
private readonly IBaseStockService _baseStockService;
[BindProperty]
public CheckListTemplateRowDTO CheckListTemplateRow { get; set; }
[BindProperty]
public List<SelectListItem> AnswerTypes { get; set; } =
new[] { "I-N", "P", "SI-N", "I-SN", "PI-N", "I-PN", "V" }
.Select(x => new SelectListItem { Value = x, Text = x })
.ToList();
public CheckListTemplateRowEditPageModel(ILogger<IndexModel> logger, IBaseStockService baseStockService)
{
_baseStockService = baseStockService;
_logger = logger;
}
public async Task OnGet(int id)
{
CheckListTemplateRow = await _baseStockService.GetCheckListTemplateRow(id);
}
}
}
@@ -29,8 +29,8 @@
</a>
<ul class="dropdown-menu" aria-labelledby="baseStockDropdown">
<li><a class="dropdown-item" asp-area="" asp-page="/BaseStock/CheckPoints/CheckPointsPage">Ellenőrzési pontok</a></li>
<li><a class="dropdown-item" asp-area="" asp-page="/BaseStock/Almenu2">Almenü 2</a></li>
<li><a class="dropdown-item" asp-area="" asp-page="/BaseStock/Almenu3">Almenü 3</a></li>
<li><a class="dropdown-item" asp-area="" asp-page="/BaseStock/Equipments/EquipmentsPage">Berendezések</a></li>
<li><a class="dropdown-item" asp-area="" asp-page="/BaseStock/Locations/LocationsPage">Lokációk</a></li>
</ul>
</li>
<li class="nav-item">
@@ -0,0 +1,4 @@
@page
@model WorkFlowCheck.Web.Pages.UserAnRole.RoleCheckListTemplateHeaderEditPageModel
@{
}
@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WorkFlowCheck.Web.Pages.UserAnRole
{
public class RoleCheckListTemplateHeaderEditPageModel : PageModel
{
public void OnGet()
{
}
}
}
@@ -0,0 +1,4 @@
@page
@model WorkFlowCheck.Web.Pages.UserAnRole.RoleCheckListTemplateHeadersPageModel
@{
}
@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WorkFlowCheck.Web.Pages.UserAnRole
{
public class RoleCheckListTemplateHeadersPageModel : PageModel
{
public void OnGet()
{
}
}
}
@@ -0,0 +1,4 @@
@page
@model WorkFlowCheck.Web.Pages.UserAnRole.RoleEditPageModel
@{
}
@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WorkFlowCheck.Web.Pages.UserAnRole
{
public class RoleEditPageModel : PageModel
{
public void OnGet()
{
}
}
}
@@ -0,0 +1,4 @@
@page
@model WorkFlowCheck.Web.Pages.UserAnRole.RolePageModel
@{
}
@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WorkFlowCheck.Web.Pages.UserAnRole
{
public class RolePageModel : PageModel
{
public void OnGet()
{
}
}
}
@@ -0,0 +1,4 @@
@page
@model WorkFlowCheck.Web.Pages.UserAnRole.UserEditPageModel
@{
}
@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WorkFlowCheck.Web.Pages.UserAnRole
{
public class UserEditPageModel : PageModel
{
public void OnGet()
{
}
}
}
@@ -0,0 +1,4 @@
@page
@model WorkFlowCheck.Web.Pages.UserAnRole.UserPageModel
@{
}
@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WorkFlowCheck.Web.Pages.UserAnRole
{
public class UserPageModel : PageModel
{
public void OnGet()
{
}
}
}
@@ -0,0 +1,4 @@
@page
@model WorkFlowCheck.Web.Pages.UserAnRole.UserRoleEditPageModel
@{
}
@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WorkFlowCheck.Web.Pages.UserAnRole
{
public class UserRoleEditPageModel : PageModel
{
public void OnGet()
{
}
}
}
@@ -0,0 +1,4 @@
@page
@model WorkFlowCheck.Web.Pages.UserAnRole.UserRolePageModel
@{
}
@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WorkFlowCheck.Web.Pages.UserAnRole
{
public class UserRolePageModel : PageModel
{
public void OnGet()
{
}
}
}