mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 12:20:22 +00:00
Implemented scalable recipes (closes #127)
This commit is contained in:
@@ -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');
|
||||
|
@@ -168,8 +168,34 @@ recipesTables.on('select', function(e, dt, type, indexes)
|
||||
|
||||
$("#selectedRecipeToggleFullscreenButton").on('click', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
$("#selectedRecipeCard").toggleClass("fullscreen");
|
||||
$("body").toggleClass("fullscreen-card");
|
||||
$("#selectedRecipeCard .card-header").toggleClass("fixed-top");
|
||||
$("#selectedRecipeCard .card-body").toggleClass("mt-5");
|
||||
|
||||
window.location.hash = "fullscreen";
|
||||
});
|
||||
|
||||
$('#servings-scale').keyup(function(event)
|
||||
{
|
||||
var data = { };
|
||||
data.desired_servings = $(this).val();
|
||||
|
||||
Grocy.Api.Put('objects/recipes/' + $(this).data("recipe-id"), data,
|
||||
function(result)
|
||||
{
|
||||
window.location.reload();
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
if (window.location.hash === "#fullscreen")
|
||||
{
|
||||
$("#selectedRecipeToggleFullscreenButton").click();
|
||||
}
|
||||
|
Reference in New Issue
Block a user