Fixed consuming Scan Mode timing (fixes #1292)

This commit is contained in:
Bernd Bestel 2021-01-30 13:06:44 +01:00
parent 42689ecefe
commit a1adc80c29
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 13 additions and 9 deletions

View File

@ -2,4 +2,5 @@
- Fixed that editing stock entries was not possible - Fixed that editing stock entries was not possible
- Fixed that shopping list prints had a grey background (thanks @Forceu) - Fixed that shopping list prints had a grey background (thanks @Forceu)
- Improved/fixed the form validation on the shopping list item page (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) - Some night mode style improvements (thanks @BlizzWave)

View File

@ -265,6 +265,11 @@ $("#location_id").on('change', function(e)
console.error(xhr); console.error(xhr);
} }
); );
if (document.getElementById("product_id").getAttribute("barcode") == "null")
{
ScanModeSubmit();
}
}, },
function(xhr) function(xhr)
{ {
@ -369,10 +374,9 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
$(".input-group-productamountpicker").trigger("change"); $(".input-group-productamountpicker").trigger("change");
Grocy.FrontendHelpers.ValidateForm('consume-form'); Grocy.FrontendHelpers.ValidateForm('consume-form');
RefreshLocaleNumberInput(); RefreshLocaleNumberInput();
ScanModeSubmit(false);
} }
} }
ScanModeSubmit(false);
}, },
function(xhr) function(xhr)
{ {
@ -380,10 +384,6 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
} }
); );
} }
else
{
ScanModeSubmit();
}
}, },
function(xhr) function(xhr)
{ {
@ -612,6 +612,11 @@ var current_productDetails;
function RefreshForm() function RefreshForm()
{ {
var productDetails = current_productDetails; var productDetails = current_productDetails;
if (!productDetails)
{
return;
}
if (productDetails.product.enable_tare_weight_handling == 1) if (productDetails.product.enable_tare_weight_handling == 1)
{ {
$("#consume-exact-amount-group").removeClass("d-none"); $("#consume-exact-amount-group").removeClass("d-none");
@ -650,12 +655,10 @@ function ScanModeSubmit(singleUnit = true)
if (singleUnit) if (singleUnit)
{ {
$("#display_amount").val(1); $("#display_amount").val(1);
$(".input-group-productamountpicker").trigger("change");
} }
RefreshLocaleNumberInput();
$(".input-group-productamountpicker").trigger("change");
Grocy.FrontendHelpers.ValidateForm("consume-form"); Grocy.FrontendHelpers.ValidateForm("consume-form");
if (document.getElementById("consume-form").checkValidity() === true) if (document.getElementById("consume-form").checkValidity() === true)
{ {
$('#save-consume-button').click(); $('#save-consume-button').click();