mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 12:20:22 +00:00
Add a button to clear the whole shopping list
This commit is contained in:
@@ -48,3 +48,36 @@ $(document).on('click', '#add-products-below-min-stock-amount', function(e)
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$(document).on('click', '#clear-shopping-list', function(e)
|
||||
{
|
||||
bootbox.confirm({
|
||||
message: L('Are you sure to empty the shopping list?'),
|
||||
buttons: {
|
||||
confirm: {
|
||||
label: L('Yes'),
|
||||
className: 'btn-success'
|
||||
},
|
||||
cancel: {
|
||||
label: L('No'),
|
||||
className: 'btn-danger'
|
||||
}
|
||||
},
|
||||
callback: function(result)
|
||||
{
|
||||
if (result === true)
|
||||
{
|
||||
Grocy.Api.Get('stock/clear-shopping-list',
|
||||
function(result)
|
||||
{
|
||||
window.location.href = U('/shoppinglist');
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@@ -43,6 +43,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
{
|
||||
$('#amount_qu_unit').text(productDetails.quantity_unit_purchase.name);
|
||||
$('#amount').focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
|
Reference in New Issue
Block a user