Preselect the default serving size when adding a nested recipe (closes #500)

This commit is contained in:
Bernd Bestel 2020-01-21 21:42:52 +01:00
parent 6f035fd64d
commit 22c978c8dc
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

View File

@ -348,3 +348,23 @@ $(window).on("message", function(e)
window.location.href = U('/recipe/' + Grocy.EditObjectId); window.location.href = U('/recipe/' + Grocy.EditObjectId);
} }
}); });
Grocy.Components.RecipePicker.GetPicker().on('change', function (e)
{
var value = Grocy.Components.RecipePicker.GetValue();
if (value.toString().isEmpty())
{
return;
}
Grocy.Api.Get('objects/recipes/' + value,
function(recipe)
{
$("#includes_servings").val(recipe.servings);
},
function(xhr)
{
console.error(xhr);
}
);
});