Files
grocy/public/viewjs/locations.js

42 lines
854 B
JavaScript
Raw Normal View History

2017-04-15 23:16:20 +02:00
$(document).on('click', '.location-delete-button', function(e)
{
bootbox.confirm({
message: 'Delete location <strong>' + $(e.currentTarget).attr('data-location-name') + '</strong>?',
2017-04-15 23:16:20 +02:00
buttons: {
confirm: {
label: 'Yes',
className: 'btn-success'
},
cancel: {
label: 'No',
className: 'btn-danger'
}
},
callback: function(result)
{
if (result === true)
2017-04-15 23:16:20 +02:00
{
Grocy.Api.Get('delete-object/locations/' + $(e.currentTarget).attr('data-location-id'),
2017-04-15 23:16:20 +02:00
function(result)
{
window.location.href = U('/locations');
2017-04-15 23:16:20 +02:00
},
function(xhr)
{
console.error(xhr);
}
);
}
}
});
});
2017-04-16 23:11:03 +02:00
2018-04-16 19:11:32 +02:00
$('#locations-table').DataTable({
'pageLength': 50,
'order': [[1, 'asc']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 }
],
'language': JSON.parse(L('datatables_localization'))
2017-04-16 23:11:03 +02:00
});