Make track now / next schedule buttons on /choresoverview swappable (closes #2424)

This commit is contained in:
Bernd Bestel
2025-01-14 19:43:12 +01:00
parent 11d28622e8
commit 9cac3b2311
6 changed files with 42 additions and 11 deletions

View File

@@ -42,7 +42,7 @@
### Chores ### Chores
- xxx - Added a new option "Swap track next schedule / track now buttons" (stock settings / top right corner settings menu) to swap the "Track next chore schedule" and "Track chore execution now" buttons/menu items on the chores overview page (defaults to disabled, so no changed behavior when not configured)
### Calendar ### Calendar

View File

@@ -207,6 +207,7 @@ DefaultUserSetting('recipes_show_ingredient_checkbox', false); // When enabled,
// Chores settings // Chores settings
DefaultUserSetting('chores_due_soon_days', 5); // The "due soon" days DefaultUserSetting('chores_due_soon_days', 5); // The "due soon" days
DefaultUserSetting('chores_overview_swap_tracking_buttons', false); // When enabled, the "Track next chore schedule" and "Track chore execution now" buttons/menu items are swapped
// Batteries settings // Batteries settings
DefaultUserSetting('batteries_due_soon_days', 5); // The "due soon" days DefaultUserSetting('batteries_due_soon_days', 5); // The "due soon" days

View File

@@ -2437,3 +2437,6 @@ msgstr ""
msgid "Configure colors" msgid "Configure colors"
msgstr "" msgstr ""
msgid "Swap track next schedule / track now buttons"
msgstr ""

View File

@@ -1,3 +1,8 @@
$("#chores_due_soon_days").val(Grocy.UserSettings.chores_due_soon_days); $("#chores_due_soon_days").val(Grocy.UserSettings.chores_due_soon_days);
if (BoolVal(Grocy.UserSettings.chores_overview_swap_tracking_buttons))
{
$("#chores_overview_swap_tracking_buttons").prop("checked", true);
}
RefreshLocaleNumberInput(); RefreshLocaleNumberInput();

View File

@@ -136,11 +136,15 @@
<tr id="chore-{{ $curentChoreEntry->chore_id }}-row" <tr id="chore-{{ $curentChoreEntry->chore_id }}-row"
class="@if($curentChoreEntry->due_type == 'overdue') table-danger @elseif($curentChoreEntry->due_type == 'duetoday') table-info @elseif($curentChoreEntry->due_type == 'duesoon') table-warning @endif"> class="@if($curentChoreEntry->due_type == 'overdue') table-danger @elseif($curentChoreEntry->due_type == 'duetoday') table-info @elseif($curentChoreEntry->due_type == 'duesoon') table-warning @endif">
<td class="fit-content border-right"> <td class="fit-content border-right">
<a class="btn btn-success btn-sm track-chore-button permission-CHORE_TRACK_EXECUTION" <a class="btn btn-success btn-sm track-chore-button permission-CHORE_TRACK_EXECUTION @if(boolval($userSettings['chores_overview_swap_tracking_buttons'])) now @endif"
href="#" href="#"
data-toggle="tooltip" data-toggle="tooltip"
data-placement="left" data-placement="left"
@if(boolval($userSettings['chores_overview_swap_tracking_buttons']))
title="{{ $__t('Track chore execution now') }}"
@else
title="{{ $__t('Track next chore schedule') }}" title="{{ $__t('Track next chore schedule') }}"
@endif
data-chore-id="{{ $curentChoreEntry->chore_id }}" data-chore-id="{{ $curentChoreEntry->chore_id }}"
data-chore-name="{{ FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->name }}"> data-chore-name="{{ FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->name }}">
<i class="fa-solid fa-play"></i> <i class="fa-solid fa-play"></i>
@@ -161,11 +165,15 @@
<i class="fa-solid fa-ellipsis-v"></i> <i class="fa-solid fa-ellipsis-v"></i>
</button> </button>
<div class="table-inline-menu dropdown-menu dropdown-menu-right"> <div class="table-inline-menu dropdown-menu dropdown-menu-right">
<a class="dropdown-item track-chore-button now permission-CHORE_TRACK_EXECUTION" <a class="dropdown-item track-chore-button permission-CHORE_TRACK_EXECUTION @if(!boolval($userSettings['chores_overview_swap_tracking_buttons'])) now @endif"
data-chore-id="{{ $curentChoreEntry->chore_id }}" data-chore-id="{{ $curentChoreEntry->chore_id }}"
type="button" type="button"
href="#"> href="#">
@if(boolval($userSettings['chores_overview_swap_tracking_buttons']))
<span>{{ $__t('Track next chore schedule') }}</span>
@else
<span>{{ $__t('Track chore execution now') }}</span> <span>{{ $__t('Track chore execution now') }}</span>
@endif
</a> </a>
<a class="dropdown-item reschedule-chore-button permission-CHORE_TRACK_EXECUTION" <a class="dropdown-item reschedule-chore-button permission-CHORE_TRACK_EXECUTION"
data-chore-id="{{ $curentChoreEntry->chore_id }}" data-chore-id="{{ $curentChoreEntry->chore_id }}"

View File

@@ -13,17 +13,31 @@
<div class="row"> <div class="row">
<div class="col-lg-6 col-12"> <div class="col-lg-6 col-12">
<h4 ">{{ $__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' => 0,
'min' => 0, 'additionalCssClasses' => 'user-setting-control',
'additionalCssClasses' => 'user-setting-control', 'hint' => $__t('Set to 0 to hide due soon filters/highlighting')
'hint' => $__t('Set to 0 to hide due soon filters/highlighting') ))
))
<a href="{{ $U('/choresoverview') }}" <div class="form-group">
class="btn btn-success">{{ $__t('OK') }}</a> <div class="custom-control custom-checkbox">
<input type="checkbox"
class="form-check-input custom-control-input user-setting-control"
id="chores_overview_swap_tracking_buttons"
data-setting-key="chores_overview_swap_tracking_buttons">
<label class="form-check-label custom-control-label"
for="chores_overview_swap_tracking_buttons">
{{ $__t('Swap track next schedule / track now buttons') }}
</label>
</div>
</div>
<a href="{{ $U('/choresoverview') }}"
class="btn btn-success">{{ $__t('OK') }}</a>
</div> </div>
</div> </div>
@stop @stop