diff --git a/changelog/62_UNRELEASED_xxxx-xx-xx.md b/changelog/62_UNRELEASED_xxxx-xx-xx.md index bb6f1a60..9e8b1c0e 100644 --- a/changelog/62_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/62_UNRELEASED_xxxx-xx-xx.md @@ -2,4 +2,5 @@ - Fixed that editing stock entries was not possible - Fixed that shopping list prints had a grey background (thanks @Forceu) - Improved/fixed the form validation on the shopping list item page (thanks @Forceu) +- Fixed that consuming with Scan Mode was not possible - Some night mode style improvements (thanks @BlizzWave) diff --git a/public/viewjs/consume.js b/public/viewjs/consume.js index 5a3ea2f4..25196b51 100644 --- a/public/viewjs/consume.js +++ b/public/viewjs/consume.js @@ -265,6 +265,11 @@ $("#location_id").on('change', function(e) console.error(xhr); } ); + + if (document.getElementById("product_id").getAttribute("barcode") == "null") + { + ScanModeSubmit(); + } }, function(xhr) { @@ -369,10 +374,9 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e) $(".input-group-productamountpicker").trigger("change"); Grocy.FrontendHelpers.ValidateForm('consume-form'); RefreshLocaleNumberInput(); + ScanModeSubmit(false); } } - - ScanModeSubmit(false); }, function(xhr) { @@ -380,10 +384,6 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e) } ); } - else - { - ScanModeSubmit(); - } }, function(xhr) { @@ -612,6 +612,11 @@ var current_productDetails; function RefreshForm() { var productDetails = current_productDetails; + if (!productDetails) + { + return; + } + if (productDetails.product.enable_tare_weight_handling == 1) { $("#consume-exact-amount-group").removeClass("d-none"); @@ -650,12 +655,10 @@ function ScanModeSubmit(singleUnit = true) if (singleUnit) { $("#display_amount").val(1); + $(".input-group-productamountpicker").trigger("change"); } - RefreshLocaleNumberInput(); - $(".input-group-productamountpicker").trigger("change"); Grocy.FrontendHelpers.ValidateForm("consume-form"); - if (document.getElementById("consume-form").checkValidity() === true) { $('#save-consume-button').click();