mirror of
https://github.com/grocy/grocy.git
synced 2025-08-17 11:06:36 +00:00
Allow no product for shopping list items & always in-/decrement by 1 when using the number input arrow buttons (fixes #964)
This commit is contained in:
@@ -1,17 +1,17 @@
|
|||||||
$(".numberpicker-down-button").unbind('click').on("click", function()
|
$(".numberpicker-down-button").unbind('click').on("click", function()
|
||||||
{
|
{
|
||||||
var inputElement = $(this).parent().parent().find('input[type="number"]')[0];
|
var inputElement = $(this).parent().parent().find('input[type="number"]');
|
||||||
inputElement.stepDown();
|
inputElement.val(parseFloat(inputElement.val()) - 1);
|
||||||
$(inputElement).trigger('keyup');
|
inputElement.trigger('keyup');
|
||||||
$(inputElement).trigger('change');
|
inputElement.trigger('change');
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".numberpicker-up-button").unbind('click').on("click", function()
|
$(".numberpicker-up-button").unbind('click').on("click", function()
|
||||||
{
|
{
|
||||||
var inputElement = $(this).parent().parent().find('input[type="number"]')[0];
|
var inputElement = $(this).parent().parent().find('input[type="number"]');
|
||||||
inputElement.stepUp();
|
inputElement.val(parseFloat(inputElement.val()) + 1);
|
||||||
$(inputElement).trigger('keyup');
|
inputElement.trigger('keyup');
|
||||||
$(inputElement).trigger('change');
|
inputElement.trigger('change');
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".numberpicker").on("keyup", function()
|
$(".numberpicker").on("keyup", function()
|
||||||
|
@@ -138,15 +138,8 @@ if (Grocy.EditMode === "edit")
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('#amount').on('focus', function(e)
|
$('#amount').on('focus', function(e)
|
||||||
{
|
|
||||||
if (Grocy.Components.ProductPicker.GetValue().length === 0 && Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK)
|
|
||||||
{
|
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$(this).select();
|
$(this).select();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#shoppinglist-form input').keyup(function(event)
|
$('#shoppinglist-form input').keyup(function(event)
|
||||||
|
@@ -256,7 +256,6 @@
|
|||||||
'label' => 'Amount',
|
'label' => 'Amount',
|
||||||
'hintId' => 'amount_qu_unit',
|
'hintId' => 'amount_qu_unit',
|
||||||
'min' => 0.0001,
|
'min' => 0.0001,
|
||||||
'step' => 0.0001,
|
|
||||||
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
|
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
|
||||||
'isRequired' => false,
|
'isRequired' => false,
|
||||||
'value' => $value
|
'value' => $value
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
@php if(!isset($value)) { $value = 1; } @endphp
|
@php if(!isset($value)) { $value = 1; } @endphp
|
||||||
@php if(empty($min)) { $min = 0; } @endphp
|
@php if(empty($min)) { $min = 0; } @endphp
|
||||||
@php if(empty($max)) { $max = 999999; } @endphp
|
@php if(empty($max)) { $max = 999999; } @endphp
|
||||||
@php if(empty($step)) { $step = 1; } @endphp
|
|
||||||
@php if(empty($hint)) { $hint = ''; } @endphp
|
@php if(empty($hint)) { $hint = ''; } @endphp
|
||||||
@php if(empty($hintId)) { $hintId = ''; } @endphp
|
@php if(empty($hintId)) { $hintId = ''; } @endphp
|
||||||
@php if(empty($additionalCssClasses)) { $additionalCssClasses = ''; } @endphp
|
@php if(empty($additionalCssClasses)) { $additionalCssClasses = ''; } @endphp
|
||||||
@@ -36,7 +35,7 @@
|
|||||||
value="{{ $value }}"
|
value="{{ $value }}"
|
||||||
min="{{ $min }}"
|
min="{{ $min }}"
|
||||||
max="{{ $max }}"
|
max="{{ $max }}"
|
||||||
step="{{ $step }}"
|
step="{{ $min }}"
|
||||||
@if($isRequired)
|
@if($isRequired)
|
||||||
required
|
required
|
||||||
@endif>
|
@endif>
|
||||||
|
@@ -42,7 +42,6 @@
|
|||||||
'label' => $userfield->caption,
|
'label' => $userfield->caption,
|
||||||
'noNameAttribute' => true,
|
'noNameAttribute' => true,
|
||||||
'min' => 0,
|
'min' => 0,
|
||||||
'step' => 0.01,
|
|
||||||
'isRequired' => false,
|
'isRequired' => false,
|
||||||
'additionalCssClasses' => 'userfield-input',
|
'additionalCssClasses' => 'userfield-input',
|
||||||
'additionalAttributes' => 'data-userfield-name="' . $userfield->name . '"'
|
'additionalAttributes' => 'data-userfield-name="' . $userfield->name . '"'
|
||||||
|
@@ -64,7 +64,6 @@
|
|||||||
'id' => 'price',
|
'id' => 'price',
|
||||||
'label' => 'Price',
|
'label' => 'Price',
|
||||||
'min' => 0,
|
'min' => 0,
|
||||||
'step' => 0.01,
|
|
||||||
'value' => '',
|
'value' => '',
|
||||||
'hint' => $__t('in %s per purchase quantity unit', GROCY_CURRENCY),
|
'hint' => $__t('in %s per purchase quantity unit', GROCY_CURRENCY),
|
||||||
'additionalHtmlContextHelp' => '<br><span class="small text-muted">' . $__t('This will apply to added products') . '</span>',
|
'additionalHtmlContextHelp' => '<br><span class="small text-muted">' . $__t('This will apply to added products') . '</span>',
|
||||||
|
@@ -286,7 +286,6 @@
|
|||||||
'id' => 'tare_weight',
|
'id' => 'tare_weight',
|
||||||
'label' => 'Tare weight',
|
'label' => 'Tare weight',
|
||||||
'min' => 0,
|
'min' => 0,
|
||||||
'step' => 0.01,
|
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
'invalidFeedback' => $__t('This cannot be lower than %s', '0'),
|
'invalidFeedback' => $__t('This cannot be lower than %s', '0'),
|
||||||
'additionalAttributes' => $additionalAttributes,
|
'additionalAttributes' => $additionalAttributes,
|
||||||
@@ -315,7 +314,6 @@
|
|||||||
'id' => 'calories',
|
'id' => 'calories',
|
||||||
'label' => 'Energy (kcal)',
|
'label' => 'Energy (kcal)',
|
||||||
'min' => 0,
|
'min' => 0,
|
||||||
'step' => 0.01,
|
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
'invalidFeedback' => $__t('The amount cannot be lower than %s', '0'),
|
'invalidFeedback' => $__t('The amount cannot be lower than %s', '0'),
|
||||||
'hint' => $__t('Per stock quantity unit'),
|
'hint' => $__t('Per stock quantity unit'),
|
||||||
|
@@ -94,7 +94,6 @@
|
|||||||
'id' => 'price',
|
'id' => 'price',
|
||||||
'label' => 'Price',
|
'label' => 'Price',
|
||||||
'min' => 0,
|
'min' => 0,
|
||||||
'step' => 0.01,
|
|
||||||
'value' => '',
|
'value' => '',
|
||||||
'hintId' => 'price-hint',
|
'hintId' => 'price-hint',
|
||||||
'invalidFeedback' => $__t('The price cannot be lower than %s', '0'),
|
'invalidFeedback' => $__t('The price cannot be lower than %s', '0'),
|
||||||
|
@@ -82,7 +82,6 @@
|
|||||||
'id' => 'factor',
|
'id' => 'factor',
|
||||||
'label' => 'Factor',
|
'label' => 'Factor',
|
||||||
'min' => 0,
|
'min' => 0,
|
||||||
'step' => 0.001,
|
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
'invalidFeedback' => $__t('This cannot be lower than %1$s and must be a valid number with max. %2$s decimal places', '0', '3'),
|
'invalidFeedback' => $__t('This cannot be lower than %1$s and must be a valid number with max. %2$s decimal places', '0', '3'),
|
||||||
'additionalHtmlElements' => '<p id="qu-conversion-info"
|
'additionalHtmlElements' => '<p id="qu-conversion-info"
|
||||||
|
@@ -39,7 +39,6 @@
|
|||||||
'id' => 'amount',
|
'id' => 'amount',
|
||||||
'label' => 'Amount',
|
'label' => 'Amount',
|
||||||
'min' => 0,
|
'min' => 0,
|
||||||
'step' => 1,
|
|
||||||
'isRequired' => false,
|
'isRequired' => false,
|
||||||
'value' => 1
|
'value' => 1
|
||||||
))
|
))
|
||||||
|
@@ -107,7 +107,6 @@
|
|||||||
'id' => 'price_factor',
|
'id' => 'price_factor',
|
||||||
'label' => 'Price factor',
|
'label' => 'Price factor',
|
||||||
'min' => 0,
|
'min' => 0,
|
||||||
'step' => 0.01,
|
|
||||||
'value' => '',
|
'value' => '',
|
||||||
'hint' => $__t('The resulting price of this ingredient will be multiplied by this factor'),
|
'hint' => $__t('The resulting price of this ingredient will be multiplied by this factor'),
|
||||||
'invalidFeedback' => $__t('This cannot be lower than %s', '0'),
|
'invalidFeedback' => $__t('This cannot be lower than %s', '0'),
|
||||||
|
@@ -65,7 +65,6 @@
|
|||||||
'label' => 'Amount',
|
'label' => 'Amount',
|
||||||
'hintId' => 'amount_qu_unit',
|
'hintId' => 'amount_qu_unit',
|
||||||
'min' => 0.01,
|
'min' => 0.01,
|
||||||
'step' => 0.01,
|
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
'invalidFeedback' => $__t('The amount cannot be lower than %s', '0.01')
|
'invalidFeedback' => $__t('The amount cannot be lower than %s', '0.01')
|
||||||
))
|
))
|
||||||
|
@@ -89,7 +89,6 @@
|
|||||||
'value' => $price,
|
'value' => $price,
|
||||||
'label' => 'Price',
|
'label' => 'Price',
|
||||||
'min' => 0,
|
'min' => 0,
|
||||||
'step' => 0.01,
|
|
||||||
'hint' => $__t('in %s per purchase quantity unit', GROCY_CURRENCY),
|
'hint' => $__t('in %s per purchase quantity unit', GROCY_CURRENCY),
|
||||||
'invalidFeedback' => $__t('The price cannot be lower than %s', '0'),
|
'invalidFeedback' => $__t('The price cannot be lower than %s', '0'),
|
||||||
'isRequired' => false
|
'isRequired' => false
|
||||||
|
Reference in New Issue
Block a user