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
@@ -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>
}