diff --git a/public/viewjs/purchase.js b/public/viewjs/purchase.js index b76aa44f..ea2245aa 100644 --- a/public/viewjs/purchase.js +++ b/public/viewjs/purchase.js @@ -222,20 +222,10 @@ if (Grocy.Components.ProductPicker !== undefined) { Grocy.Components.DateTimePicker.SetValue(moment().add(productDetails.product.default_best_before_days, 'days').format('YYYY-MM-DD')); } - $('#amount').focus(); - } - else - { - if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) - { - Grocy.Components.DateTimePicker.GetInputElement().focus(); - } - else - { - $('#amount').focus(); - } } + $("#amount").focus(); + Grocy.FrontendHelpers.ValidateForm('purchase-form'); if (GetUriParam("flow") === "shoppinglistitemtostock" && BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled) && document.getElementById("purchase-form").checkValidity() === true) { diff --git a/views/purchase.blade.php b/views/purchase.blade.php index 05872a42..d9068c07 100644 --- a/views/purchase.blade.php +++ b/views/purchase.blade.php @@ -30,9 +30,17 @@ @include('components.productpicker', array( 'products' => $products, - 'nextInputSelector' => '#best_before_date .datetimepicker-input' + 'nextInputSelector' => '#amount' )) + @include('components.numberpicker', array( + 'id' => 'amount', + 'label' => 'Amount', + 'hintId' => 'amount_qu_unit', + 'min' => 1, + 'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'), + 'additionalHtmlContextHelp' => '
' . $__t('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '
' + )) @php $additionalGroupCssClasses = ''; @@ -49,7 +57,7 @@ 'limitEndToNow' => false, 'limitStartToNow' => false, 'invalidFeedback' => $__t('A best before date is required'), - 'nextInputSelector' => '#amount', + 'nextInputSelector' => '#price', 'additionalCssClasses' => 'date-only-datetimepicker', 'shortcutValue' => '2999-12-31', 'shortcutLabel' => 'Never expires', @@ -60,15 +68,6 @@ )) @php $additionalGroupCssClasses = ''; @endphp - @include('components.numberpicker', array( - 'id' => 'amount', - 'label' => 'Amount', - 'hintId' => 'amount_qu_unit', - 'min' => 1, - 'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'), - 'additionalHtmlContextHelp' => '
' . $__t('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '
' - )) - @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) @include('components.numberpicker', array( 'id' => 'price',