Make it possible to disable chores/tasks/batteries due soon filters/highlighting (closes #1485)

This commit is contained in:
Bernd Bestel
2022-01-23 19:20:23 +01:00
parent 04a3069294
commit cf52e5ec96
11 changed files with 26 additions and 12 deletions

View File

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

View File

@@ -94,7 +94,7 @@ class BatteriesController extends BaseController
{ {
$currentBattery->due_type = 'duetoday'; $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'; $currentBattery->due_type = 'duesoon';
} }

View File

@@ -108,7 +108,7 @@ class ChoresController extends BaseController
{ {
$currentChore->due_type = 'duetoday'; $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'; $currentChore->due_type = 'duesoon';
} }

View File

@@ -28,7 +28,7 @@ class TasksController extends BaseController
{ {
$task->due_type = 'duetoday'; $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'; $task->due_type = 'duesoon';
} }

View File

@@ -2277,3 +2277,6 @@ msgid "%s battery is due to be charged today"
msgid_plural "%s batteries are due to be charged today" msgid_plural "%s batteries are due to be charged today"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
msgid "Set to 0 to hide due soon filters/highlighting"
msgstr ""

View File

@@ -38,7 +38,7 @@
<div id="info-due-soon-batteries" <div id="info-due-soon-batteries"
data-status-filter="duesoon" data-status-filter="duesoon"
data-next-x-days="{{ $nextXDays }}" data-next-x-days="{{ $nextXDays }}"
class="warning-message status-filter-message responsive-button"></div> class="warning-message status-filter-message responsive-button @if($nextXDays == 0) d-none @endif"></div>
<div class="float-right"> <div class="float-right">
<a class="btn btn-sm btn-outline-info d-md-none mt-1" <a class="btn btn-sm btn-outline-info d-md-none mt-1"
data-toggle="collapse" data-toggle="collapse"
@@ -79,7 +79,9 @@
<option value="all">{{ $__t('All') }}</option> <option value="all">{{ $__t('All') }}</option>
<option value="overdue">{{ $__t('Overdue') }}</option> <option value="overdue">{{ $__t('Overdue') }}</option>
<option value="duetoday">{{ $__t('Due today') }}</option> <option value="duetoday">{{ $__t('Due today') }}</option>
@if($nextXDays > 0)
<option value="duesoon">{{ $__t('Due soon') }}</option> <option value="duesoon">{{ $__t('Due soon') }}</option>
@endif
</select> </select>
</div> </div>
</div> </div>

View File

@@ -20,8 +20,9 @@
'id' => 'batteries_due_soon_days', 'id' => 'batteries_due_soon_days',
'additionalAttributes' => 'data-setting-key="batteries_due_soon_days"', 'additionalAttributes' => 'data-setting-key="batteries_due_soon_days"',
'label' => 'Due soon days', 'label' => 'Due soon days',
'min' => 1, 'min' => 0,
'additionalCssClasses' => 'user-setting-control' 'additionalCssClasses' => 'user-setting-control',
'hint' => $__t('Set to 0 to hide due soon filters/highlighting')
)) ))
<a href="{{ $U('/batteriesoverview') }}" <a href="{{ $U('/batteriesoverview') }}"

View File

@@ -38,7 +38,7 @@
<div id="info-due-soon-chores" <div id="info-due-soon-chores"
data-status-filter="duesoon" data-status-filter="duesoon"
data-next-x-days="{{ $nextXDays }}" data-next-x-days="{{ $nextXDays }}"
class="warning-message status-filter-message responsive-message mr-2"></div> class="warning-message status-filter-message responsive-message mr-2 @if($nextXDays == 0) d-none @endif"></div>
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS) @if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
<div id="info-assigned-to-me-chores" <div id="info-assigned-to-me-chores"
data-user-filter="xx{{ GROCY_USER_ID }}xx" data-user-filter="xx{{ GROCY_USER_ID }}xx"
@@ -84,7 +84,9 @@
<option value="all">{{ $__t('All') }}</option> <option value="all">{{ $__t('All') }}</option>
<option value="overdue">{{ $__t('Overdue') }}</option> <option value="overdue">{{ $__t('Overdue') }}</option>
<option value="duetoday">{{ $__t('Due today') }}</option> <option value="duetoday">{{ $__t('Due today') }}</option>
@if($nextXDays > 0)
<option value="duesoon">{{ $__t('Due soon') }}</option> <option value="duesoon">{{ $__t('Due soon') }}</option>
@endif
</select> </select>
</div> </div>
</div> </div>

View File

@@ -16,12 +16,14 @@
<div class="row"> <div class="row">
<div class="col-lg-6 col-12"> <div class="col-lg-6 col-12">
<h4 class="mt-2">{{ $__t('Chores overview') }}</h4> <h4 class="mt-2">{{ $__t('Chores overview') }}</h4>
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'chores_due_soon_days', 'id' => 'chores_due_soon_days',
'additionalAttributes' => 'data-setting-key="chores_due_soon_days"', 'additionalAttributes' => 'data-setting-key="chores_due_soon_days"',
'label' => 'Due soon days', 'label' => 'Due soon days',
'min' => 1, 'min' => 0,
'additionalCssClasses' => 'user-setting-control' 'additionalCssClasses' => 'user-setting-control',
'hint' => $__t('Set to 0 to hide due soon filters/highlighting')
)) ))
<a href="{{ $U('/choresoverview') }}" <a href="{{ $U('/choresoverview') }}"

View File

@@ -38,7 +38,7 @@
<div id="info-due-soon-tasks" <div id="info-due-soon-tasks"
data-status-filter="duesoon" data-status-filter="duesoon"
data-next-x-days="{{ $nextXDays }}" data-next-x-days="{{ $nextXDays }}"
class="warning-message status-filter-message responsive-button mr-2"></div> class="warning-message status-filter-message responsive-button @if($nextXDays == 0) d-none @endif"></div>
<div class="float-right"> <div class="float-right">
<a class="btn btn-sm btn-outline-info d-md-none mt-1" <a class="btn btn-sm btn-outline-info d-md-none mt-1"
data-toggle="collapse" data-toggle="collapse"
@@ -79,7 +79,9 @@
<option value="all">{{ $__t('All') }}</option> <option value="all">{{ $__t('All') }}</option>
<option value="overdue">{{ $__t('Overdue') }}</option> <option value="overdue">{{ $__t('Overdue') }}</option>
<option value="duetoday">{{ $__t('Due today') }}</option> <option value="duetoday">{{ $__t('Due today') }}</option>
@if($nextXDays > 0)
<option value="duesoon">{{ $__t('Due soon') }}</option> <option value="duesoon">{{ $__t('Due soon') }}</option>
@endif
</select> </select>
</div> </div>
</div> </div>

View File

@@ -20,8 +20,9 @@
'id' => 'tasks_due_soon_days', 'id' => 'tasks_due_soon_days',
'additionalAttributes' => 'data-setting-key="tasks_due_soon_days"', 'additionalAttributes' => 'data-setting-key="tasks_due_soon_days"',
'label' => 'Due soon days', 'label' => 'Due soon days',
'min' => 1, 'min' => 0,
'additionalCssClasses' => 'user-setting-control' 'additionalCssClasses' => 'user-setting-control',
'hint' => $__t('Set to 0 to hide due soon filters/highlighting')
)) ))
<a href="{{ $U('/tasks') }}" <a href="{{ $U('/tasks') }}"