diff --git a/public/viewjs/mealplan.js b/public/viewjs/mealplan.js index f470719f..d0266e7f 100644 --- a/public/viewjs/mealplan.js +++ b/public/viewjs/mealplan.js @@ -135,9 +135,9 @@ var calendar = $("#calendar").fullCalendar({
\ \ \ - \ - \ - \ + \ + \ + \
\ '); @@ -561,6 +561,7 @@ $(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'); var button = $(this); + var servings = $(e.currentTarget).attr('data-mealplan-servings'); bootbox.confirm({ message: __t('Are you sure to put all missing ingredients for recipe "%s" on the shopping list?', objectName), @@ -581,6 +582,21 @@ $(document).on('click', '.recipe-order-missing-button', function(e) { Grocy.FrontendHelpers.BeginUiBusy(); + //set the recipes desired_servings so that the views resolve correctly + //based on the meal plan servings + var data = { }; + data.desired_servings = servings; + + Grocy.Api.Put('objects/recipes/' + objectId, data, + function(result) + { + }, + function(xhr) + { + console.error(xhr); + } + ); + Grocy.Api.Post('recipes/' + objectId + '/add-not-fulfilled-products-to-shoppinglist', { }, function(result) { @@ -653,6 +669,7 @@ $(document).on('click', '.recipe-consume-button', function(e) var objectName = $(e.currentTarget).attr('data-recipe-name'); var objectId = $(e.currentTarget).attr('data-recipe-id'); + var servings = $(e.currentTarget).attr('data-mealplan-servings'); bootbox.confirm({ message: __t('Are you sure to consume all ingredients needed by recipe "%s" (ingredients marked with "check only if a single unit is in stock" will be ignored)?', objectName), @@ -673,6 +690,21 @@ $(document).on('click', '.recipe-consume-button', function(e) { Grocy.FrontendHelpers.BeginUiBusy(); + //set the recipes desired_servings so that the views resolve correctly + //based on the meal plan servings + var data = { }; + data.desired_servings = servings; + + Grocy.Api.Put('objects/recipes/' + objectId, data, + function(result) + { + }, + function(xhr) + { + console.error(xhr); + } + ); + Grocy.Api.Post('recipes/' + objectId + '/consume', { }, function(result) { @@ -698,6 +730,22 @@ $(document).on("click", ".recipe-popup-button", function(e) document.activeElement.blur(); var objectId = $(e.currentTarget).attr('data-recipe-id'); + var servings = $(e.currentTarget).attr('data-mealplan-servings'); + + //set the recipes desired_servings so that the views resolve correctly + //based on the meal plan servings + var data = { }; + data.desired_servings = servings; + + Grocy.Api.Put('objects/recipes/' + objectId, data, + function(result) + { + }, + function(xhr) + { + console.error(xhr); + } + ); bootbox.dialog({ message: '',