Implemented scalable recipes (closes #127)

This commit is contained in:
Bernd Bestel
2019-03-03 13:27:10 +01:00
parent ee38d626aa
commit 89ad25c904
6 changed files with 131 additions and 32 deletions

View File

@@ -110,7 +110,7 @@ $('#recipes-includes-table tbody').removeClass("d-none");
Grocy.FrontendHelpers.ValidateForm('recipe-form');
$("#name").focus();
$('#recipe-form input').keyup(function (event)
$('#recipe-form input').keyup(function(event)
{
Grocy.FrontendHelpers.ValidateForm('recipe-form');
});
@@ -206,31 +206,6 @@ $(document).on('click', '.recipe-include-delete-button', function(e)
});
});
$(document).on('click', '.recipe-pos-order-missing-button', function(e)
{
var productName = $(e.currentTarget).attr('data-product-name');
var productId = $(e.currentTarget).attr('data-product-id');
var productAmount = $(e.currentTarget).attr('data-product-amount');
var recipeName = $(e.currentTarget).attr('data-recipe-name');
var jsonData = {};
jsonData.product_id = productId;
jsonData.amount = productAmount;
jsonData.note = L('Added for recipe #1', recipeName);
Grocy.Api.Post('objects/shopping_list', jsonData,
function(result)
{
Grocy.Api.Put('objects/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function () { }, function () { });
window.location.href = U('/recipe/' + Grocy.EditObjectId);
},
function(xhr)
{
console.error(xhr);
}
);
});
$(document).on('click', '.recipe-pos-show-note-button', function(e)
{
var note = $(e.currentTarget).attr('data-recipe-pos-note');