84 lines
2.8 KiB
Plaintext
84 lines
2.8 KiB
Plaintext
@page
|
|
@model WorkFlowCheck.Web.Pages.BaseStock.Locations.LocationsPageModel
|
|
@using WorkFlowCheck.Common.Helper
|
|
@using WorkFlowCheck.Common.DTO
|
|
@{
|
|
ViewData["Title"] = "Lokációk";
|
|
}
|
|
<h1>@ViewData["Title"]</h1>
|
|
|
|
<div class="card shadow p-4">
|
|
<div class="d-flex justify-content-end">
|
|
<button id="newLocationBtn" class="btn btn-primary float-right new-btn" data-bs-toggle="tooltip" data-bs-placement="top" title="Új lokáció">
|
|
<i class="bi bi-plus-square"></i>
|
|
</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>@DisplayNameHelper.GetDisplayName(nameof(LocationDTO.FullName), typeof(LocationDTO))</th>
|
|
<th class="text-center">Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tfoot class="table-light">
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>@DisplayNameHelper.GetDisplayName(nameof(LocationDTO.FullName), typeof(LocationDTO))</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 renderActionButtons(row.id);
|
|
}}
|
|
],
|
|
columnDefs: [
|
|
{
|
|
"targets": 0,
|
|
"visible": false
|
|
},
|
|
{
|
|
"targets": 2,
|
|
"className": "text-center",
|
|
"width": "10%"
|
|
}
|
|
],
|
|
|
|
processing:true,
|
|
language: { url: '/lib/datatables/datatables.hu.json',}
|
|
});
|
|
|
|
$('#newLocationBtn').on('click', function ()
|
|
{
|
|
window.location.href = `@Url.Page("/BaseStock/Locations/LocationEditPage")?id=0`;
|
|
});
|
|
|
|
$('#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 ()
|
|
{
|
|
var row = table.row($(this).closest('tr')).data();
|
|
|
|
deleteEntity(table, '/BaseStock/Locations/LocationsPage?handler=DeleteLocation', row.id);
|
|
});
|
|
</script>
|
|
}
|