Fixed the "Shopping list to stock workflow" with disabled FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING (fixes #537)

This commit is contained in:
Bernd Bestel
2020-02-02 13:01:31 +01:00
parent 5effa0c103
commit 890663bf63
13 changed files with 23 additions and 18 deletions

View File

@@ -4,6 +4,7 @@
### Shopping list improvements/fixes ### Shopping list improvements/fixes
- Added an option to hide the month-calendar (in the shopping list settings / top right corner settings menu) (defaults to disabled, so please enable this option if you still want to have the month-calendar on the shopping list) - Added an option to hide the month-calendar (in the shopping list settings / top right corner settings menu) (defaults to disabled, so please enable this option if you still want to have the month-calendar on the shopping list)
- Optimized the new compact view (there was a little too much white space at the sides of the page) - Optimized the new compact view (there was a little too much white space at the sides of the page)
- Fixed that the "Shopping list to stock workflow" did not work when `FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING` was set to `false`
### Recipe improvements/fixes ### Recipe improvements/fixes
- Optimized the ordering of the inputs on the recipe ingredient edit page (moved "Only check if a single unit is in stock" before the amount) - Optimized the ordering of the inputs on the recipe ingredient edit page (moved "Only check if a single unit is in stock" before the amount)

View File

@@ -178,6 +178,11 @@ if (Grocy.Components.ProductPicker !== undefined)
$("#tare-weight-handling-info").addClass("d-none"); $("#tare-weight-handling-info").addClass("d-none");
} }
if (!Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
{
Grocy.Components.DateTimePicker.SetValue(moment().format('YYYY-MM-DD'));
}
if (productDetails.product.default_best_before_days.toString() !== '0') if (productDetails.product.default_best_before_days.toString() !== '0')
{ {
if (productDetails.product.default_best_before_days == -1) if (productDetails.product.default_best_before_days == -1)
@@ -192,12 +197,6 @@ 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(); $('#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)
{
$("#save-purchase-button").click();
}
} }
else else
{ {
@@ -207,11 +206,16 @@ if (Grocy.Components.ProductPicker !== undefined)
} }
else else
{ {
Grocy.Components.DateTimePicker.SetValue(moment().format('YYYY-MM-DD'));
$('#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)
{
$("#save-purchase-button").click();
}
if (BoolVal(Grocy.UserSettings.scan_mode_purchase_enabled)) if (BoolVal(Grocy.UserSettings.scan_mode_purchase_enabled))
{ {
$("#amount").val(1); $("#amount").val(1);

View File

@@ -95,7 +95,7 @@ $(document).on('click', '.shoppinglist-delete-button', function(e)
var shoppingListItemId = $(e.currentTarget).attr('data-shoppinglist-id'); var shoppingListItemId = $(e.currentTarget).attr('data-shoppinglist-id');
Grocy.FrontendHelpers.BeginUiBusy(); Grocy.FrontendHelpers.BeginUiBusy();
Grocy.Api.Delete('objects/shopping_list/' + shoppingListItemId, {}, Grocy.Api.Delete('objects/shopping_list/' + shoppingListItemId, { },
function(result) function(result)
{ {
animateCSS("#shoppinglistitem-" + shoppingListItemId + "-row", "fadeOut", function() animateCSS("#shoppinglistitem-" + shoppingListItemId + "-row", "fadeOut", function()

View File

@@ -5,7 +5,7 @@
@section('viewJsName', 'barcodescannertesting') @section('viewJsName', 'barcodescannertesting')
@push('pageScripts') @push('pageScripts')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet">
@endpush @endpush
@section('content') @section('content')

View File

@@ -5,7 +5,7 @@
@section('viewJsName', 'batteriesoverview') @section('viewJsName', 'batteriesoverview')
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet">
@endpush @endpush
@section('content') @section('content')

View File

@@ -5,7 +5,7 @@
@section('viewJsName', 'choresoverview') @section('viewJsName', 'choresoverview')
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet">
@endpush @endpush
@section('content') @section('content')

View File

@@ -5,7 +5,7 @@
@section('viewJsName', 'manageapikeys') @section('viewJsName', 'manageapikeys')
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet">
@endpush @endpush
@section('content') @section('content')

View File

@@ -5,7 +5,7 @@
@section('viewJsName', 'quantityunitpluraltesting') @section('viewJsName', 'quantityunitpluraltesting')
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet">
@endpush @endpush
@section('content') @section('content')

View File

@@ -11,7 +11,7 @@
@endpush @endpush
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet">
<link href="{{ $U('/node_modules/datatables.net-rowgroup-bs4/css/rowGroup.bootstrap4.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/datatables.net-rowgroup-bs4/css/rowGroup.bootstrap4.min.css?v=', true) }}{{ $version }}" rel="stylesheet">
@endpush @endpush

View File

@@ -4,7 +4,7 @@
@section('viewJsName', 'stockentries') @section('viewJsName', 'stockentries')
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet">
@endpush @endpush
@push('pageScripts') @push('pageScripts')

View File

@@ -5,7 +5,7 @@
@section('viewJsName', 'stockoverview') @section('viewJsName', 'stockoverview')
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet">
@endpush @endpush
@push('pageScripts') @push('pageScripts')

View File

@@ -10,7 +10,7 @@
@endpush @endpush
@push('pageStyles') @push('pageStyles')
<link href="{{ $U('/node_modules/animate.css/animate.min.css?v', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/animate.css/animate.min.css?v=', true) }}{{ $version }}" rel="stylesheet">
<link href="{{ $U('/node_modules/datatables.net-rowgroup-bs4/css/rowGroup.bootstrap4.min.css?v=', true) }}{{ $version }}" rel="stylesheet"> <link href="{{ $U('/node_modules/datatables.net-rowgroup-bs4/css/rowGroup.bootstrap4.min.css?v=', true) }}{{ $version }}" rel="stylesheet">
@endpush @endpush