Replace the single user (defined in /data/config.php) with a multi user management thing

This commit is contained in:
Bernd Bestel
2018-07-24 19:31:43 +02:00
parent b52ab91606
commit 7f8540ff4e
19 changed files with 695 additions and 23 deletions

58
public/viewjs/users.js Normal file
View File

@@ -0,0 +1,58 @@
var usersTable = $('#users-table').DataTable({
'paginate': false,
'order': [[1, 'asc']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 }
],
'language': JSON.parse(L('datatables_localization')),
'scrollY': false,
'colReorder': true,
'stateSave': true
});
$("#search").on("keyup", function()
{
var value = $(this).val();
if (value === "all")
{
value = "";
}
usersTable.search(value).draw();
});
$(document).on('click', '.user-delete-button', function (e)
{
var objectName = $(e.currentTarget).attr('data-user-username');
var objectId = $(e.currentTarget).attr('data-user-id');
bootbox.confirm({
message: L('Are you sure to delete user "#1"?', objectName),
buttons: {
confirm: {
label: L('Yes'),
className: 'btn-success'
},
cancel: {
label: L('No'),
className: 'btn-danger'
}
},
callback: function(result)
{
if (result === true)
{
Grocy.Api.Get('users/delete' + objectId,
function(result)
{
window.location.href = U('/users');
},
function(xhr)
{
console.error(xhr);
}
);
}
}
});
});