2017-04-15 23:16:20 +02:00
|
|
|
|
$(document).on('click', '.quantityunit-delete-button', function(e)
|
|
|
|
|
{
|
|
|
|
|
bootbox.confirm({
|
|
|
|
|
message: 'Delete quantity unit <strong>' + $(e.target).attr('data-quantityunit-name') + '</strong>?',
|
|
|
|
|
buttons: {
|
|
|
|
|
confirm: {
|
|
|
|
|
label: 'Yes',
|
|
|
|
|
className: 'btn-success'
|
|
|
|
|
},
|
|
|
|
|
cancel: {
|
|
|
|
|
label: 'No',
|
|
|
|
|
className: 'btn-danger'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
callback: function(result)
|
|
|
|
|
{
|
2017-04-20 22:01:14 +02:00
|
|
|
|
if (result === true)
|
2017-04-15 23:16:20 +02:00
|
|
|
|
{
|
|
|
|
|
Grocy.FetchJson('/api/delete-object/quantity_units/' + $(e.target).attr('data-quantityunit-id'),
|
|
|
|
|
function(result)
|
|
|
|
|
{
|
|
|
|
|
window.location.href = '/quantityunits';
|
|
|
|
|
},
|
|
|
|
|
function(xhr)
|
|
|
|
|
{
|
|
|
|
|
console.error(xhr);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
2017-04-16 23:11:03 +02:00
|
|
|
|
|
2018-04-16 19:11:32 +02:00
|
|
|
|
$('#quantityunits-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
|
|
|
|
});
|