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.
This commit is contained in:
Maximilian Bosch 2020-09-07 20:14:47 +02:00
parent 2b0208e88c
commit 007b427f1f
No known key found for this signature in database
GPG Key ID: 091DBF4D1FC46B8E

View File

@ -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)
{