Role lista hozzáadása
This commit is contained in:
@@ -1,4 +1,90 @@
|
||||
@page
|
||||
@model WorkFlowCheck.Web.Pages.UserAndRole.RolePageModel
|
||||
@{
|
||||
ViewData["Title"] = "Szabályok";
|
||||
}
|
||||
<h1>@ViewData["Title"]</h1>
|
||||
|
||||
<div class="card shadow p-4">
|
||||
<div class="d-flex justify-content-end">
|
||||
<button id="newRoleBtn" class="btn btn-primary float-right new-btn">Új elem hozzáadása</button>
|
||||
</div>
|
||||
<table id="tbRolesPage" class="table table-bordered table-hover table-sm" style="width:100%">
|
||||
<thead class="table-primary">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Role Name</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot class="table-light">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Role Name</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
<script>
|
||||
const table = new DataTable('#tbRolesPage', {
|
||||
ajax: {
|
||||
url: "@Url.Page("./RolePage", "LoadRoles")",
|
||||
type: "GET",
|
||||
dataSrc : "data"
|
||||
},
|
||||
columns: [
|
||||
{ data: "id" },
|
||||
{ data: "roleName" },
|
||||
{ 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
|
||||
});
|
||||
|
||||
$('#newRoleBtn').on('click', function ()
|
||||
{
|
||||
console.log('New button clicked!"');
|
||||
window.location.href = `@Url.Page("./RoleEditPage")?id=0`;
|
||||
});
|
||||
|
||||
$('#tbRolesPage').on('click', '.edit-btn', function ()
|
||||
{
|
||||
const row = table.row($(this).closest('tr')).data();
|
||||
window.location.href = `@Url.Page("./RoleEditPage")?id=${row.id}`;
|
||||
});
|
||||
|
||||
$('#tbRolesPage').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>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user