purchase- move amount above best buy date and focus amount after product selection

This commit is contained in:
Kurt Riddlesperger 2020-04-21 09:13:37 -05:00
parent 1be868ebd8
commit 3925912f48
2 changed files with 12 additions and 23 deletions

View File

@ -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')); 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'); 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) if (GetUriParam("flow") === "shoppinglistitemtostock" && BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled) && document.getElementById("purchase-form").checkValidity() === true)
{ {

View File

@ -30,9 +30,17 @@
@include('components.productpicker', array( @include('components.productpicker', array(
'products' => $products, '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' => '<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>'
))
@php @php
$additionalGroupCssClasses = ''; $additionalGroupCssClasses = '';
@ -49,7 +57,7 @@
'limitEndToNow' => false, 'limitEndToNow' => false,
'limitStartToNow' => false, 'limitStartToNow' => false,
'invalidFeedback' => $__t('A best before date is required'), 'invalidFeedback' => $__t('A best before date is required'),
'nextInputSelector' => '#amount', 'nextInputSelector' => '#price',
'additionalCssClasses' => 'date-only-datetimepicker', 'additionalCssClasses' => 'date-only-datetimepicker',
'shortcutValue' => '2999-12-31', 'shortcutValue' => '2999-12-31',
'shortcutLabel' => 'Never expires', 'shortcutLabel' => 'Never expires',
@ -60,15 +68,6 @@
)) ))
@php $additionalGroupCssClasses = ''; @endphp @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' => '<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>'
))
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) @if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'price', 'id' => 'price',