Added an option to hide the calendar on the shopping list (closes #531)

This commit is contained in:
Bernd Bestel 2020-02-01 12:54:05 +01:00
parent 683ea0984c
commit 23efe0c87a
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
11 changed files with 67 additions and 25 deletions

View File

@ -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

View File

@ -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

View File

@ -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', [

View File

@ -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 ""

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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

View File

@ -392,6 +392,9 @@
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item discrete-link" href="{{ $U('/stocksettings') }}"><i class="fas fa-box"></i>&nbsp;{{ $__t('Stock settings') }}</a>
@if(GROCY_FEATURE_FLAG_SHOPPINGLIST)
<a class="dropdown-item discrete-link" href="{{ $U('/shoppinglistsettings') }}"><i class="fas fa-shopping-cart"></i>&nbsp;{{ $__t('Shopping list settings') }}</a>
@endif
@if(GROCY_FEATURE_FLAG_CHORES)
<a class="dropdown-item discrete-link" href="{{ $U('/choressettings') }}"><i class="fas fa-home"></i>&nbsp;{{ $__t('Chores settings') }}</a>
@endif

View File

@ -94,7 +94,7 @@
</div>
<div id="shoppinglist-main" class="row d-print-none">
<div class="col-xs-12 col-md-8 pb-3">
<div class="@if(boolval($userSettings['shopping_list_show_calendar'])) col-xs-12 col-md-8 @else col-12 @endif pb-3">
<a id="shopping-list-normal-view-button" class="btn btn-outline-dark btn-block switch-view-mode-button d-none" href="#">
<i class="fas fa-expand-arrows-alt"></i> {{ $__t('Normal view') }}
</a>
@ -157,11 +157,13 @@
</table>
</div>
@if(boolval($userSettings['shopping_list_show_calendar']))
<div class="col-xs-12 col-md-4 mt-md-2 d-print-none">
@include('components.calendarcard')
</div>
@endif
<div class="col-xs-12 col-md-8 d-print-none pt-2">
<div class="@if(boolval($userSettings['shopping_list_show_calendar'])) col-xs-12 col-md-8 @else col-12 @endif d-print-none pt-2">
<div class="form-group">
<label class="text-larger font-weight-bold" for="notes">{{ $__t('Notes') }}</label>
<a id="save-description-button" class="btn btn-success btn-sm ml-1 mb-2" href="#">{{ $__t('Save') }}</a>

View File

@ -0,0 +1,33 @@
@extends('layout.default')
@section('title', $__t('Shopping list settings'))
@section('viewJsName', 'shoppinglistsettings')
@section('content')
<div class="row">
<div class="col-lg-6 col-xs-12">
<h1>@yield('title')</h1>
<h4 class="mt-2">{{ $__t('Shopping list') }}</h4>
<div class="form-group">
<div class="checkbox">
<label for="shopping-list-show-calendar">
<input type="checkbox" class="user-setting-control" id="shopping-list-show-calendar" name="shopping-list-show-calendar" data-setting-key="shopping_list_show_calendar"> {{ $__t('Show a month-view calendar') }}
</label>
</div>
</div>
<h4 class="mt-2">{{ $__t('Shopping list to stock workflow') }}</h4>
<div class="form-group">
<div class="checkbox">
<label for="shopping-list-to-stock-workflow-auto-submit-when-prefilled">
<input type="checkbox" class="user-setting-control" id="shopping-list-to-stock-workflow-auto-submit-when-prefilled" name="shopping-list-to-stock-workflow-auto-submit-when-prefilled" data-setting-key="shopping_list_to_stock_workflow_auto_submit_when_prefilled"> {{ $__t('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') }}
</label>
</div>
</div>
<a href="{{ $U('/shoppinglist') }}" class="btn btn-success">{{ $__t('OK') }}</a>
</div>
</div>
@stop

View File

@ -75,18 +75,6 @@
'additionalCssClasses' => 'user-setting-control'
))
@if(GROCY_FEATURE_FLAG_SHOPPINGLIST)
<h4 class="mt-2">{{ $__t('Shopping list to stock workflow') }}</h4>
<div class="form-group">
<div class="checkbox">
<label for="shopping-list-to-stock-workflow-auto-submit-when-prefilled">
<input type="checkbox" class="user-setting-control" id="shopping-list-to-stock-workflow-auto-submit-when-prefilled" name="shopping-list-to-stock-workflow-auto-submit-when-prefilled" data-setting-key="shopping_list_to_stock_workflow_auto_submit_when_prefilled"> {{ $__t('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') }}
</label>
</div>
</div>
@endif
<a href="{{ $U('/stockoverview') }}" class="btn btn-success">{{ $__t('OK') }}</a>
</div>
</div>