More or less finalize recipes feature

This commit is contained in:
Bernd Bestel
2018-07-14 22:49:42 +02:00
parent d9246b9b42
commit 734814d96b
16 changed files with 171 additions and 24 deletions

View File

@@ -7,7 +7,8 @@
'language': JSON.parse(L('datatables_localization')),
'scrollY': false,
'colReorder': true,
'stateSave': true
'stateSave': true,
'select': 'single'
});
$("#search").on("keyup", function()
@@ -56,3 +57,39 @@ $(document).on('click', '.recipe-delete-button', function(e)
}
});
});
$(document).on('click', '.recipe-order-missing-button', function(e)
{
var objectName = $(e.currentTarget).attr('data-recipe-name');
var objectId = $(e.currentTarget).attr('data-recipe-id');
bootbox.confirm({
message: L('Are you sure to put all missing ingredients for recipe "#1" on the shopping list?', objectName),
buttons: {
confirm: {
label: L('Yes'),
className: 'btn-success'
},
cancel: {
label: L('No'),
className: 'btn-danger'
}
},
callback: function(result)
{
if (result === true)
{
Grocy.Api.Get('recipes/add-not-fulfilled-products-to-shopping-list/' + objectId,
function(result)
{
window.location.href = U('/recipes');
},
function(xhr)
{
console.error(xhr);
}
);
}
}
});
});