From 26920185f11a7b62e4f72de81cdea08a19ae93df Mon Sep 17 00:00:00 2001 From: Kurt Riddlesperger Date: Fri, 20 Dec 2019 11:27:39 -0600 Subject: [PATCH] recipeform: bootbox the recipe pos edit button --- public/viewjs/recipeform.js | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/public/viewjs/recipeform.js b/public/viewjs/recipeform.js index 334f0418..e2bfd6e7 100644 --- a/public/viewjs/recipeform.js +++ b/public/viewjs/recipeform.js @@ -192,20 +192,29 @@ $(document).on('click', '.recipe-pos-show-note-button', function(e) bootbox.alert(note); }); -$(document).on('click', '.recipe-pos-edit-button', function (e) +$(document).on('click', '.recipe-pos-edit-button', function(e) { - var recipePosId = $(e.currentTarget).attr('data-recipe-pos-id'); + e.preventDefault(); - Grocy.Api.Put('objects/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), - function(result) - { - window.location.href = U('/recipe/' + Grocy.EditObjectId + '/pos/' + recipePosId); - }, - function(xhr) - { - console.error(xhr); + var productId = $(e.currentTarget).attr("data-product-id"); + var recipePosId = $(e.currentTarget).attr('data-recipe-pos-id'); + + bootbox.dialog({ + message: '', + size: 'large', + backdrop: true, + closeButton: false, + buttons: { + cancel: { + label: __t('Cancel'), + className: 'btn-secondary responsive-button', + callback: function() + { + bootbox.hideAll(); + } + } } - ); + }); }); $(document).on('click', '.recipe-include-edit-button', function (e)