Allow optional partial units of products in stock (closes #123)

This commit is contained in:
Bernd Bestel
2019-01-26 14:17:02 +01:00
parent 9e139e2b73
commit dfc05e0bec
10 changed files with 158 additions and 11 deletions

View File

@@ -52,6 +52,20 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
{
$("#qu_id").val(productDetails.quantity_unit_stock.id);
}
if (productDetails.product.allow_partial_units_in_stock == 1)
{
$("#amount").attr("min", "0.01");
$("#amount").attr("step", "0.01");
$("#amount").parent().find(".invalid-feedback").text(L('The amount cannot be lower than #1', 0.01.toLocaleString()));
}
else
{
$("#amount").attr("min", "1");
$("#amount").attr("step", "1");
$("#amount").parent().find(".invalid-feedback").text(L('The amount cannot be lower than #1', '1'));
}
$('#amount').focus();
Grocy.FrontendHelpers.ValidateForm('recipe-pos-form');
},