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' => '