From cf52e5ec962390637ff0d833f616a8a2379d300e Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sun, 23 Jan 2022 19:20:23 +0100 Subject: [PATCH] Make it possible to disable chores/tasks/batteries due soon filters/highlighting (closes #1485) --- changelog/66_UNRELEASED_xxxx-xx-xx.md | 1 + controllers/BatteriesController.php | 2 +- controllers/ChoresController.php | 2 +- controllers/TasksController.php | 2 +- localization/strings.pot | 3 +++ views/batteriesoverview.blade.php | 4 +++- views/batteriessettings.blade.php | 5 +++-- views/choresoverview.blade.php | 4 +++- views/choressettings.blade.php | 6 ++++-- views/tasks.blade.php | 4 +++- views/taskssettings.blade.php | 5 +++-- 11 files changed, 26 insertions(+), 12 deletions(-) diff --git a/changelog/66_UNRELEASED_xxxx-xx-xx.md b/changelog/66_UNRELEASED_xxxx-xx-xx.md index 9de369d9..3ee0cb20 100644 --- a/changelog/66_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/66_UNRELEASED_xxxx-xx-xx.md @@ -1,5 +1,6 @@ - Stock entry labels get now also printed on inventory (only when adding products, same option "Stock entry label" like on the purchase page) - Added a separate status filter and table row highlighting (blue) on the chores, tasks and batteries overview pages for items due today + - Additionally, the "due soon" days of chores/tasks/batteries (top right corner settings menu) can be set to `0` to disable that filter/highlighting - Optimized relative time display (also fixed a phrasing problem for some languages, e.g. Hungarian) (thanks @Tallyrald) - When using LDAP authentication, the configured `LDAP_UID_ATTR` is now used to compare if the user already exists instead of the username entered on the login page (that prevents creating multiple users if you entere the username in different notations) (thanks @FloSet) - When using reverse proxy authentication (`ReverseProxyAuthMiddleware`), it's now also possible to pass the username in an environment variable instead of an HTTP header (new `config.php` option `REVERSE_PROXY_AUTH_USE_ENV`) (thanks @Forceu) diff --git a/controllers/BatteriesController.php b/controllers/BatteriesController.php index 4593a1c4..31fffe66 100644 --- a/controllers/BatteriesController.php +++ b/controllers/BatteriesController.php @@ -94,7 +94,7 @@ class BatteriesController extends BaseController { $currentBattery->due_type = 'duetoday'; } - elseif ($currentBattery->next_estimated_charge_time <= date('Y-m-d H:i:s', strtotime('+' . $nextXDays . ' days'))) + elseif ($nextXDays > 0 && $currentBattery->next_estimated_charge_time <= date('Y-m-d H:i:s', strtotime('+' . $nextXDays . ' days'))) { $currentBattery->due_type = 'duesoon'; } diff --git a/controllers/ChoresController.php b/controllers/ChoresController.php index 71ff9f50..6eed1a5d 100644 --- a/controllers/ChoresController.php +++ b/controllers/ChoresController.php @@ -108,7 +108,7 @@ class ChoresController extends BaseController { $currentChore->due_type = 'duetoday'; } - elseif ($currentChore->next_estimated_execution_time <= date('Y-m-d H:i:s', strtotime('+' . $nextXDays . ' days'))) + elseif ($nextXDays > 0 && $currentChore->next_estimated_execution_time <= date('Y-m-d H:i:s', strtotime('+' . $nextXDays . ' days'))) { $currentChore->due_type = 'duesoon'; } diff --git a/controllers/TasksController.php b/controllers/TasksController.php index 63a8d039..f0ed7863 100644 --- a/controllers/TasksController.php +++ b/controllers/TasksController.php @@ -28,7 +28,7 @@ class TasksController extends BaseController { $task->due_type = 'duetoday'; } - elseif ($task->due_date <= date('Y-m-d 23:59:59', strtotime('+' . $nextXDays . ' days'))) + elseif ($nextXDays > 0 && $task->due_date <= date('Y-m-d 23:59:59', strtotime('+' . $nextXDays . ' days'))) { $task->due_type = 'duesoon'; } diff --git a/localization/strings.pot b/localization/strings.pot index 9e1aa391..24298b3b 100644 --- a/localization/strings.pot +++ b/localization/strings.pot @@ -2277,3 +2277,6 @@ msgid "%s battery is due to be charged today" msgid_plural "%s batteries are due to be charged today" msgstr[0] "" msgstr[1] "" + +msgid "Set to 0 to hide due soon filters/highlighting" +msgstr "" diff --git a/views/batteriesoverview.blade.php b/views/batteriesoverview.blade.php index 2c04ffe4..098aa4f2 100644 --- a/views/batteriesoverview.blade.php +++ b/views/batteriesoverview.blade.php @@ -38,7 +38,7 @@
+ class="warning-message status-filter-message responsive-button @if($nextXDays == 0) d-none @endif">
{{ $__t('All') }} + @if($nextXDays > 0) + @endif
diff --git a/views/batteriessettings.blade.php b/views/batteriessettings.blade.php index 3ea2a2a5..865f04a2 100644 --- a/views/batteriessettings.blade.php +++ b/views/batteriessettings.blade.php @@ -20,8 +20,9 @@ 'id' => 'batteries_due_soon_days', 'additionalAttributes' => 'data-setting-key="batteries_due_soon_days"', 'label' => 'Due soon days', - 'min' => 1, - 'additionalCssClasses' => 'user-setting-control' + 'min' => 0, + 'additionalCssClasses' => 'user-setting-control', + 'hint' => $__t('Set to 0 to hide due soon filters/highlighting') )) + class="warning-message status-filter-message responsive-message mr-2 @if($nextXDays == 0) d-none @endif"> @if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
{{ $__t('All') }} + @if($nextXDays > 0) + @endif
diff --git a/views/choressettings.blade.php b/views/choressettings.blade.php index 339e4b02..62b214bd 100644 --- a/views/choressettings.blade.php +++ b/views/choressettings.blade.php @@ -16,12 +16,14 @@
+ class="warning-message status-filter-message responsive-button @if($nextXDays == 0) d-none @endif">
{{ $__t('All') }} + @if($nextXDays > 0) + @endif
diff --git a/views/taskssettings.blade.php b/views/taskssettings.blade.php index 043772cf..7f47994b 100644 --- a/views/taskssettings.blade.php +++ b/views/taskssettings.blade.php @@ -20,8 +20,9 @@ 'id' => 'tasks_due_soon_days', 'additionalAttributes' => 'data-setting-key="tasks_due_soon_days"', 'label' => 'Due soon days', - 'min' => 1, - 'additionalCssClasses' => 'user-setting-control' + 'min' => 0, + 'additionalCssClasses' => 'user-setting-control', + 'hint' => $__t('Set to 0 to hide due soon filters/highlighting') ))