Allow partial minimum stock amount when enabled (closes #203)

This commit is contained in:
Bernd Bestel 2019-04-06 15:27:00 +02:00
parent 0496ae9e00
commit 25c257bb2c
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

View File

@ -215,6 +215,22 @@ $("#enable_tare_weight_handling").on("click", function()
Grocy.FrontendHelpers.ValidateForm("product-form");
});
$("#allow_partial_units_in_stock").on("click", function()
{
if (this.checked)
{
$("#min_stock_amount").attr("min", "0.00");
$("#min_stock_amount").attr("step", "0.01");
}
else
{
$("#min_stock_amount").attr("min", "0");
$("#min_stock_amount").attr("step", "1");
}
Grocy.FrontendHelpers.ValidateForm("product-form");
});
Grocy.DeleteProductPictureOnSave = false;
$('#delete-current-product-picture-button').on('click', function (e)
{
@ -245,3 +261,7 @@ if (Grocy.EditMode === 'create')
$('#name').focus();
$('.input-group-qu').trigger('change');
Grocy.FrontendHelpers.ValidateForm('product-form');
// Click twice to trigger on-click but not change the actual checked state
$("#allow_partial_units_in_stock").click();
$("#allow_partial_units_in_stock").click();