Allow price up to 4 decimals instead of 2 (#1077)

* Allow price to be 4 decimals

* remove logging

* Finalize custom decimal places by user setting

* Typo

Co-authored-by: Bernd Bestel <bernd@berrnd.de>
This commit is contained in:
kriddles
2020-10-20 13:08:54 -05:00
committed by GitHub
parent 9e982979c3
commit 46e8123477
31 changed files with 147 additions and 128 deletions

View File

@@ -47,8 +47,8 @@
'id' => 'amount',
'label' => 'Amount',
'hintId' => 'amount_qu_unit',
'min' => 0.0001,
'decimals' => 4,
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1',
'decimals' => $userSettings['stock_decimal_places_amounts'],
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info"
class="text-info font-italic d-none">' . $__t('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '</div>'
@@ -85,7 +85,6 @@
'shortcutLabel' => 'Never expires',
'earlierThanInfoLimit' => date('Y-m-d'),
'earlierThanInfoText' => $__t('The given date is earlier than today, are you sure?'),
'additionalGroupCssClasses' => $additionalGroupCssClasses,
'activateNumberPad' => GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_FIELD_NUMBER_PAD
))
@endif
@@ -94,14 +93,15 @@
@include('components.numberpicker', array(
'id' => 'price',
'label' => 'Price',
'min' => 0.01,
'decimals' => 2,
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_prices'] - 1) . '1',
'decimals' => $userSettings['stock_decimal_places_prices'],
'value' => '',
'hintId' => 'price-hint',
'invalidFeedback' => $__t('The price cannot be lower than %s', '0'),
'isRequired' => false,
'additionalGroupCssClasses' => 'mb-1'
))
<div class="form-check form-check-inline mb-3">
<input class="form-check-input"
type="radio"
@@ -135,8 +135,8 @@
@include('components.numberpicker', array(
'id' => 'qu_factor_purchase_to_stock',
'label' => 'Factor purchase to stock quantity unit',
'min' => 0.0001,
'decimals' => 4,
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1',
'decimals' => $userSettings['stock_decimal_places_amounts'],
'additionalGroupCssClasses' => 'd-none',
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
'additionalCssClasses' => 'input-group-qu',