Files
WorkFlowCheck/src/WorkFlowCheck.Web/Pages/BaseStock/Equipments/EquipmentsPage.cshtml
T
2025-04-04 12:42:47 +02:00

84 lines
2.8 KiB
Plaintext

@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 id="newEquipmentBtn" class="btn btn-primary float-right new-btn" data-bs-toggle="tooltip" data-bs-placement="top" title="Új berendezés">
<i class="bi bi-plus-square"></i>
</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>Equipment Number</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tfoot class="table-light">
<tr>
<th>ID</th>
<th>Short Name</th>
<th>Equipment Number</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: "equipmentNumber" },
{ data: null, render: function (data, type, row) {
return renderActionButtons(row.id);
}}
],
columnDefs: [
{
"targets": 0,
"visible": false
},
{
"targets": 3,
"className": "text-center",
"width": "10%"
}
],
processing:true,
language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
});
$('#newEquipmentBtn').on('click', function ()
{
window.location.href = `@Url.Page("/BaseStock/Equipments/EquipmentEditPage")?id=0`;
});
$('#tbEquipmentsPage').on('click', '.edit-btn', function ()
{
const row = table.row($(this).closest('tr')).data();
window.location.href = `@Url.Page("/BaseStock/Equipments/EquipmentEditPage")?id=${row.id}`;
});
$('#tbEquipmentsPage').on('click', '.delete-btn', function ()
{
const row = table.row($(this).closest('tr')).data();
deleteEntity(table, '/BaseStock/Equipments/EquipmentPage?handler=DeleteLocation', row.id);
});
</script>
}