mirror of
https://github.com/grocy/grocy.git
synced 2025-10-12 08:34:48 +00:00
Improved number input initial value decimal handling
This commit is contained in:
@@ -256,6 +256,9 @@ $("#allow_partial_units_in_stock").on("click", function()
|
||||
$("#qu_factor_purchase_to_stock").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
||||
$("#qu_factor_purchase_to_stock").attr("step", "." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
||||
$("#qu_factor_purchase_to_stock").parent().find(".invalid-feedback").text(__t('This cannot be lower than %1$s and must be a valid number with max. %2$s decimal places', "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1", Grocy.UserSettings.stock_decimal_places_amounts));
|
||||
$("#quick_consume_amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
||||
$("#quick_consume_amount").attr("step", "." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1");
|
||||
$("#quick_consume_amount").parent().find(".invalid-feedback").text(__t('This cannot be lower than %1$s and must be a valid number with max. %2$s decimal places', "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1", Grocy.UserSettings.stock_decimal_places_amounts));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -264,6 +267,9 @@ $("#allow_partial_units_in_stock").on("click", function()
|
||||
$("#qu_factor_purchase_to_stock").attr("min", "1");
|
||||
$("#qu_factor_purchase_to_stock").attr("step", "1");
|
||||
$("#qu_factor_purchase_to_stock").parent().find(".invalid-feedback").text(__t('This cannot be lower than %1$s and must be a valid number with max. %2$s decimal places', '1', '0'));
|
||||
$("#quick_consume_amount").attr("min", "1");
|
||||
$("#quick_consume_amount").attr("step", "1");
|
||||
$("#quick_consume_amount").parent().find(".invalid-feedback").text(__t('This cannot be lower than %1$s and must be a valid number with max. %2$s decimal places', '1', '0'));
|
||||
}
|
||||
|
||||
Grocy.FrontendHelpers.ValidateForm("product-form");
|
||||
|
Reference in New Issue
Block a user