From 007b427f1f90e6b969a8cb976f559758a80af909 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Mon, 7 Sep 2020 20:14:47 +0200 Subject: [PATCH] Allow replacing a product picture when removing it at first Right now, a preview image of a product doesn't get updated when pressing the delete-button at first and adding a new image the upload-form which can be quite confusing for an end-user. This patch allows to delete an image and add a new one in one go. --- public/viewjs/productform.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/viewjs/productform.js b/public/viewjs/productform.js index 157ad8d3..a0283f47 100644 --- a/public/viewjs/productform.js +++ b/public/viewjs/productform.js @@ -342,6 +342,12 @@ $("#allow_partial_units_in_stock").on("click", function() Grocy.FrontendHelpers.ValidateForm("product-form"); }); +$('#product-picture').change(function () { + if ($(this).val()) { + Grocy.DeleteProductPictureOnSave = false; + } +}); + Grocy.DeleteProductPictureOnSave = false; $('#delete-current-product-picture-button').on('click', function(e) {