recipeform: bootbox the recipe pos edit button

This commit is contained in:
Kurt Riddlesperger 2019-12-20 11:27:39 -06:00
parent 73b2a44b9b
commit 26920185f1

View File

@ -192,20 +192,29 @@ $(document).on('click', '.recipe-pos-show-note-button', function(e)
bootbox.alert(note); bootbox.alert(note);
}); });
$(document).on('click', '.recipe-pos-edit-button', function (e) $(document).on('click', '.recipe-pos-edit-button', function(e)
{ {
e.preventDefault();
var productId = $(e.currentTarget).attr("data-product-id");
var recipePosId = $(e.currentTarget).attr('data-recipe-pos-id'); var recipePosId = $(e.currentTarget).attr('data-recipe-pos-id');
Grocy.Api.Put('objects/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), bootbox.dialog({
function(result) message: '<iframe height="650px" class="embed-responsive" src="' + U("/recipe/") + Grocy.EditObjectId.toString() + '/pos/' + recipePosId.toString() + '?embedded&product=' + productId.toString() + '"></iframe>',
{ size: 'large',
window.location.href = U('/recipe/' + Grocy.EditObjectId + '/pos/' + recipePosId); backdrop: true,
}, closeButton: false,
function(xhr) buttons: {
{ cancel: {
console.error(xhr); label: __t('Cancel'),
className: 'btn-secondary responsive-button',
callback: function()
{
bootbox.hideAll();
}
}
} }
); });
}); });
$(document).on('click', '.recipe-include-edit-button', function (e) $(document).on('click', '.recipe-include-edit-button', function (e)