diff --git a/views/choreform.blade.php b/views/choreform.blade.php index a844a625..3ebb9651 100644 --- a/views/choreform.blade.php +++ b/views/choreform.blade.php @@ -255,7 +255,8 @@ 'id' => 'product_amount', 'label' => 'Amount', 'hintId' => 'amount_qu_unit', - 'min' => 0.0001, + 'min' => 0.01, + 'decimals' => 2, 'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'), 'isRequired' => false, 'value' => $value diff --git a/views/components/numberpicker.blade.php b/views/components/numberpicker.blade.php index 0ad4543a..ee647cae 100644 --- a/views/components/numberpicker.blade.php +++ b/views/components/numberpicker.blade.php @@ -5,6 +5,7 @@ @php if(!isset($value)) { $value = 1; } @endphp @php if(empty($min)) { $min = 0; } @endphp @php if(empty($max)) { $max = 999999; } @endphp +@php if(empty($decimals)) { $decimals = 0; } @endphp @php if(empty($hint)) { $hint = ''; } @endphp @php if(empty($hintId)) { $hintId = ''; } @endphp @php if(empty($additionalCssClasses)) { $additionalCssClasses = ''; } @endphp @@ -33,9 +34,9 @@ name="{{ $id }}" @endif value="{{ $value }}" - min="{{ $min }}" - max="{{ $max }}" - step="{{ $min }}" + min="{{ number_format($min, $decimals, '.', '') }}" + max="{{ number_format($max, $decimals, '.', '') }}" + step="@if($decimals == 0){{1}}@else{{'.' . substr('0000000001', -$decimals)}}@endif" @if($isRequired) required @endif> diff --git a/views/components/productamountpicker.blade.php b/views/components/productamountpicker.blade.php index 2864f644..d94cb21b 100644 --- a/views/components/productamountpicker.blade.php +++ b/views/components/productamountpicker.blade.php @@ -11,7 +11,8 @@ @include('components.numberpicker', array( 'id' => 'display_amount', 'label' => 'Amount', - 'min' => 0, + 'min' => 0.01, + 'decimals' => 2, 'value' => $value, 'invalidFeedback' => $__t('This cannot be negative and must be an integral number'), 'additionalGroupCssClasses' => 'col-4 mb-1', diff --git a/views/components/userfieldsform.blade.php b/views/components/userfieldsform.blade.php index 9b0dbf57..f8311384 100644 --- a/views/components/userfieldsform.blade.php +++ b/views/components/userfieldsform.blade.php @@ -41,7 +41,8 @@ 'id' => '', 'label' => $userfield->caption, 'noNameAttribute' => true, - 'min' => 0, + 'min' => 0.01, + 'decimals' => 2, 'isRequired' => false, 'additionalCssClasses' => 'userfield-input', 'additionalAttributes' => 'data-userfield-name="' . $userfield->name . '"' diff --git a/views/consume.blade.php b/views/consume.blade.php index 82bb1c8b..2f40f018 100644 --- a/views/consume.blade.php +++ b/views/consume.blade.php @@ -43,15 +43,19 @@ 'nextInputSelector' => '#amount', 'disallowAddProductWorkflows' => true )) -