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()
|
||||
{
|
||||
var inputElement = $(this).parent().parent().find('input[type="number"]')[0];
|
||||
inputElement.stepDown();
|
||||
$(inputElement).trigger('keyup');
|
||||
$(inputElement).trigger('change');
|
||||
var inputElement = $(this).parent().parent().find('input[type="number"]');
|
||||
inputElement.val(parseFloat(inputElement.val()) - 1);
|
||||
inputElement.trigger('keyup');
|
||||
inputElement.trigger('change');
|
||||
});
|
||||
|
||||
$(".numberpicker-up-button").unbind('click').on("click", function()
|
||||
{
|
||||
var inputElement = $(this).parent().parent().find('input[type="number"]')[0];
|
||||
inputElement.stepUp();
|
||||
$(inputElement).trigger('keyup');
|
||||
$(inputElement).trigger('change');
|
||||
var inputElement = $(this).parent().parent().find('input[type="number"]');
|
||||
inputElement.val(parseFloat(inputElement.val()) + 1);
|
||||
inputElement.trigger('keyup');
|
||||
inputElement.trigger('change');
|
||||
});
|
||||
|
||||
$(".numberpicker").on("keyup", function()
|
||||
|
@@ -139,14 +139,7 @@ if (Grocy.EditMode === "edit")
|
||||
|
||||
$('#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();
|
||||
}
|
||||
});
|
||||
|
||||
$('#shoppinglist-form input').keyup(function(event)
|
||||
|
@@ -256,7 +256,6 @@
|
||||
'label' => 'Amount',
|
||||
'hintId' => 'amount_qu_unit',
|
||||
'min' => 0.0001,
|
||||
'step' => 0.0001,
|
||||
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
|
||||
'isRequired' => false,
|
||||
'value' => $value
|
||||
|
@@ -5,7 +5,6 @@
|
||||
@php if(!isset($value)) { $value = 1; } @endphp
|
||||
@php if(empty($min)) { $min = 0; } @endphp
|
||||
@php if(empty($max)) { $max = 999999; } @endphp
|
||||
@php if(empty($step)) { $step = 1; } @endphp
|
||||
@php if(empty($hint)) { $hint = ''; } @endphp
|
||||
@php if(empty($hintId)) { $hintId = ''; } @endphp
|
||||
@php if(empty($additionalCssClasses)) { $additionalCssClasses = ''; } @endphp
|
||||
@@ -36,7 +35,7 @@
|
||||
value="{{ $value }}"
|
||||
min="{{ $min }}"
|
||||
max="{{ $max }}"
|
||||
step="{{ $step }}"
|
||||
step="{{ $min }}"
|
||||
@if($isRequired)
|
||||
required
|
||||
@endif>
|
||||
|
@@ -42,7 +42,6 @@
|
||||
'label' => $userfield->caption,
|
||||
'noNameAttribute' => true,
|
||||
'min' => 0,
|
||||
'step' => 0.01,
|
||||
'isRequired' => false,
|
||||
'additionalCssClasses' => 'userfield-input',
|
||||
'additionalAttributes' => 'data-userfield-name="' . $userfield->name . '"'
|
||||
|
@@ -64,7 +64,6 @@
|
||||
'id' => 'price',
|
||||
'label' => 'Price',
|
||||
'min' => 0,
|
||||
'step' => 0.01,
|
||||
'value' => '',
|
||||
'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>',
|
||||
|
@@ -286,7 +286,6 @@
|
||||
'id' => 'tare_weight',
|
||||
'label' => 'Tare weight',
|
||||
'min' => 0,
|
||||
'step' => 0.01,
|
||||
'value' => $value,
|
||||
'invalidFeedback' => $__t('This cannot be lower than %s', '0'),
|
||||
'additionalAttributes' => $additionalAttributes,
|
||||
@@ -315,7 +314,6 @@
|
||||
'id' => 'calories',
|
||||
'label' => 'Energy (kcal)',
|
||||
'min' => 0,
|
||||
'step' => 0.01,
|
||||
'value' => $value,
|
||||
'invalidFeedback' => $__t('The amount cannot be lower than %s', '0'),
|
||||
'hint' => $__t('Per stock quantity unit'),
|
||||
|
@@ -94,7 +94,6 @@
|
||||
'id' => 'price',
|
||||
'label' => 'Price',
|
||||
'min' => 0,
|
||||
'step' => 0.01,
|
||||
'value' => '',
|
||||
'hintId' => 'price-hint',
|
||||
'invalidFeedback' => $__t('The price cannot be lower than %s', '0'),
|
||||
|
@@ -82,7 +82,6 @@
|
||||
'id' => 'factor',
|
||||
'label' => 'Factor',
|
||||
'min' => 0,
|
||||
'step' => 0.001,
|
||||
'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'),
|
||||
'additionalHtmlElements' => '<p id="qu-conversion-info"
|
||||
|
@@ -39,7 +39,6 @@
|
||||
'id' => 'amount',
|
||||
'label' => 'Amount',
|
||||
'min' => 0,
|
||||
'step' => 1,
|
||||
'isRequired' => false,
|
||||
'value' => 1
|
||||
))
|
||||
|
@@ -107,7 +107,6 @@
|
||||
'id' => 'price_factor',
|
||||
'label' => 'Price factor',
|
||||
'min' => 0,
|
||||
'step' => 0.01,
|
||||
'value' => '',
|
||||
'hint' => $__t('The resulting price of this ingredient will be multiplied by this factor'),
|
||||
'invalidFeedback' => $__t('This cannot be lower than %s', '0'),
|
||||
|
@@ -50,7 +50,7 @@
|
||||
value="1">
|
||||
@endif
|
||||
|
||||
<div class="@if(!GROCY_FEATURE_FLAG_STOCK) d-none @endif" >
|
||||
<div class="@if(!GROCY_FEATURE_FLAG_STOCK) d-none @endif">
|
||||
@php if($mode == 'edit') { $productId = $listItem->product_id; } else { $productId = ''; } @endphp
|
||||
@include('components.productpicker', array(
|
||||
'products' => $products,
|
||||
@@ -65,7 +65,6 @@
|
||||
'label' => 'Amount',
|
||||
'hintId' => 'amount_qu_unit',
|
||||
'min' => 0.01,
|
||||
'step' => 0.01,
|
||||
'value' => $value,
|
||||
'invalidFeedback' => $__t('The amount cannot be lower than %s', '0.01')
|
||||
))
|
||||
|
@@ -89,7 +89,6 @@
|
||||
'value' => $price,
|
||||
'label' => 'Price',
|
||||
'min' => 0,
|
||||
'step' => 0.01,
|
||||
'hint' => $__t('in %s per purchase quantity unit', GROCY_CURRENCY),
|
||||
'invalidFeedback' => $__t('The price cannot be lower than %s', '0'),
|
||||
'isRequired' => false
|
||||
|
Reference in New Issue
Block a user