Improve handling of not in-stock but valid manually entered products on the consume and transfer page (references #1429)

This commit is contained in:
Bernd Bestel
2021-07-09 22:16:08 +02:00
parent 72e6ed76bf
commit 2638bce851
5 changed files with 81 additions and 57 deletions

View File

@@ -249,19 +249,9 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
$('#display_amount').attr("data-stock-amount", productDetails.stock_amount);
if ((parseFloat(productDetails.stock_amount) || 0) === 0)
{
Grocy.Components.ProductPicker.Clear();
Grocy.FrontendHelpers.ValidateForm('transfer-form');
Grocy.Components.ProductPicker.ShowCustomError(__t('This product is not in stock'));
Grocy.Components.ProductPicker.GetInputElement().focus();
}
else
{
Grocy.Components.ProductPicker.HideCustomError();
Grocy.FrontendHelpers.ValidateForm('transfer-form');
$('#display_amount').focus();
}
Grocy.Components.ProductPicker.HideCustomError();
Grocy.FrontendHelpers.ValidateForm('transfer-form');
$('#display_amount').focus();
},
function(xhr)
{