mirror of
https://github.com/grocy/grocy.git
synced 2025-04-28 17:23:56 +00:00
33 lines
641 B
JavaScript
33 lines
641 B
JavaScript
$(document).on('click', '.product-delete-button', function(e)
|
|
{
|
|
bootbox.confirm({
|
|
message: 'Delete product <strong>' + $(e.target).attr('data-product-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/products/' + $(e.target).attr('data-product-id'),
|
|
function(result)
|
|
{
|
|
window.location.href = '/products';
|
|
},
|
|
function(xhr)
|
|
{
|
|
console.error(xhr);
|
|
}
|
|
);
|
|
}
|
|
}
|
|
});
|
|
});
|