diff --git a/changelog/56_UNRELEASED_2020-xx-xx.md b/changelog/56_UNRELEASED_2020-xx-xx.md index ae921cbc..6e50540e 100644 --- a/changelog/56_UNRELEASED_2020-xx-xx.md +++ b/changelog/56_UNRELEASED_2020-xx-xx.md @@ -1,7 +1,8 @@ ### Stock fixes - Fixed purchase/consume/inventory problems when `FEATURE_FLAG_STOCK_LOCATION_TRACKING` was set to `false` -### Shopping list 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) - Optimized the new compact view (there was a little too much white space at the sides of the page) ### Recipe improvements/fixes diff --git a/config-dist.php b/config-dist.php index 208bb59a..f6b98fb9 100644 --- a/config-dist.php +++ b/config-dist.php @@ -94,6 +94,10 @@ DefaultUserSetting('stock_default_consume_amount', 1); DefaultUserSetting('scan_mode_consume_enabled', false); DefaultUserSetting('scan_mode_purchase_enabled', false); +# Shopping list settings +DefaultUserSetting('shopping_list_to_stock_workflow_auto_submit_when_prefilled', false); // Automatically do the booking using the last price and the amount of the shopping list item, if the product has "Default best before days" set +DefaultUserSetting('shopping_list_show_calendar', false); + # Chores settings DefaultUserSetting('chores_due_soon_days', 5); @@ -110,11 +114,6 @@ DefaultUserSetting('auto_reload_on_db_change', true); # Show a clock in the header next to the logo or not DefaultUserSetting('show_clock_in_header', false); -# Shopping list to stock workflow: -# Automatically do the booking using the last price and the amount -# of the shopping list item, if the product has "Default best before days" set -DefaultUserSetting('shopping_list_to_stock_workflow_auto_submit_when_prefilled', false); - # Feature flags # grocy was initially about "stock management for your household", many other things diff --git a/controllers/StockController.php b/controllers/StockController.php index 6a33a803..656e1990 100644 --- a/controllers/StockController.php +++ b/controllers/StockController.php @@ -303,6 +303,11 @@ class StockController extends BaseController } } + public function ShoppingListSettings(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args) + { + return $this->AppContainer->view->render($response, 'shoppinglistsettings'); + } + public function Journal(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args) { return $this->AppContainer->view->render($response, 'stockjournal', [ diff --git a/localization/strings.pot b/localization/strings.pot index 331e97a6..04f116c0 100644 --- a/localization/strings.pot +++ b/localization/strings.pot @@ -1711,3 +1711,9 @@ msgstr "" msgid "Are you sure to delete userentity \"%s\"?" msgstr "" + +msgid "Shopping list settings" +msgstr "" + +msgid "Show a month-view calendar" +msgstr "" diff --git a/public/viewjs/shoppinglistsettings.js b/public/viewjs/shoppinglistsettings.js new file mode 100644 index 00000000..68460c61 --- /dev/null +++ b/public/viewjs/shoppinglistsettings.js @@ -0,0 +1,9 @@ +if (BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled)) +{ + $("#shopping-list-to-stock-workflow-auto-submit-when-prefilled").prop("checked", true); +} + +if (BoolVal(Grocy.UserSettings.shopping_list_show_calendar)) +{ + $("#shopping-list-show-calendar").prop("checked", true); +} diff --git a/public/viewjs/stocksettings.js b/public/viewjs/stocksettings.js index 2a963e3e..cdd60ca8 100644 --- a/public/viewjs/stocksettings.js +++ b/public/viewjs/stocksettings.js @@ -4,8 +4,3 @@ $("#product_presets_qu_id").val(Grocy.UserSettings.product_presets_qu_id); $("#stock_expring_soon_days").val(Grocy.UserSettings.stock_expring_soon_days); $("#stock_default_purchase_amount").val(Grocy.UserSettings.stock_default_purchase_amount); $("#stock_default_consume_amount").val(Grocy.UserSettings.stock_default_consume_amount); - -if (BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled)) -{ - $("#shopping-list-to-stock-workflow-auto-submit-when-prefilled").prop("checked", true); -} diff --git a/routes.php b/routes.php index 9a02f309..df35f7e5 100644 --- a/routes.php +++ b/routes.php @@ -60,6 +60,7 @@ $app->group('', function() $this->get('/shoppinglist', '\Grocy\Controllers\StockController:ShoppingList'); $this->get('/shoppinglistitem/{itemId}', '\Grocy\Controllers\StockController:ShoppingListItemEditForm'); $this->get('/shoppinglist/{listId}', '\Grocy\Controllers\StockController:ShoppingListEditForm'); + $this->get('/shoppinglistsettings', '\Grocy\Controllers\StockController:ShoppingListSettings'); } // Recipe routes diff --git a/views/layout/default.blade.php b/views/layout/default.blade.php index cfad5fda..74469d3a 100644 --- a/views/layout/default.blade.php +++ b/views/layout/default.blade.php @@ -392,6 +392,9 @@
-
+
{{ $__t('Normal view') }} @@ -157,11 +157,13 @@
+ @if(boolval($userSettings['shopping_list_show_calendar']))
@include('components.calendarcard')
+ @endif -
+
{{ $__t('Save') }} diff --git a/views/shoppinglistsettings.blade.php b/views/shoppinglistsettings.blade.php new file mode 100644 index 00000000..a0cff48c --- /dev/null +++ b/views/shoppinglistsettings.blade.php @@ -0,0 +1,33 @@ +@extends('layout.default') + +@section('title', $__t('Shopping list settings')) + +@section('viewJsName', 'shoppinglistsettings') + +@section('content') +
+
+

@yield('title')

+ +

{{ $__t('Shopping list') }}

+
+
+ +
+
+ +

{{ $__t('Shopping list to stock workflow') }}

+
+
+ +
+
+ + {{ $__t('OK') }} +
+
+@stop diff --git a/views/stocksettings.blade.php b/views/stocksettings.blade.php index 1aa7ad27..02677772 100644 --- a/views/stocksettings.blade.php +++ b/views/stocksettings.blade.php @@ -75,18 +75,6 @@ 'additionalCssClasses' => 'user-setting-control' )) - @if(GROCY_FEATURE_FLAG_SHOPPINGLIST) -

{{ $__t('Shopping list to stock workflow') }}

- -
-
- -
-
- @endif - {{ $__t('OK') }}