mirror of
https://github.com/grocy/grocy.git
synced 2025-04-28 17:23:56 +00:00
44 lines
815 B
JavaScript
44 lines
815 B
JavaScript
$(document).on('click', '.location-delete-button', function(e)
|
|
{
|
|
bootbox.confirm({
|
|
message: 'Delete location <strong>' + $(e.target).attr('data-location-name') + '</strong>?',
|
|
buttons: {
|
|
confirm: {
|
|
label: 'Yes',
|
|
className: 'btn-success'
|
|
},
|
|
cancel: {
|
|
label: 'No',
|
|
className: 'btn-danger'
|
|
}
|
|
},
|
|
callback: function(result)
|
|
{
|
|
if (result === true)
|
|
{
|
|
Grocy.FetchJson('/api/delete-object/locations/' + $(e.target).attr('data-location-id'),
|
|
function(result)
|
|
{
|
|
window.location.href = '/locations';
|
|
},
|
|
function(xhr)
|
|
{
|
|
console.error(xhr);
|
|
}
|
|
);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
$(function()
|
|
{
|
|
$('#locations-table').DataTable({
|
|
'pageLength': 50,
|
|
'order': [[1, 'asc']],
|
|
'columnDefs': [
|
|
{ 'orderable': false, 'targets': 0 }
|
|
]
|
|
});
|
|
});
|