Optimized tracking button handling on /choresoverview (closes #2186)

This commit is contained in:
Bernd Bestel 2023-03-31 20:12:06 +02:00
parent 3d01854fa1
commit 98469248eb
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
5 changed files with 21 additions and 8 deletions

View File

@ -53,7 +53,10 @@
### Chores
- xxx
- Changed the handling of the tracking buttons on the chores overview page:
- The green button now tracks an execution of the corresponding chore on the next scheduled time, rather than for now/today
- New context-/more menu option "Track chore execution now" to track an execution for now/today (so the same what the green button did before)
- Removed the limitation on the chore tracking page that the tracked time couldn't be in the future
### Calendar

View File

@ -1754,7 +1754,7 @@ msgstr ""
msgid "Chore journal"
msgstr ""
msgid "Track chore execution"
msgid "Track next chore schedule"
msgstr ""
msgid "Mark task as completed"
@ -2371,3 +2371,6 @@ msgstr ""
msgid "Quick open amount"
msgstr ""
msgid "Track chore execution now"
msgstr ""

View File

@ -93,19 +93,20 @@ $(document).on('click', '.track-chore-button', function(e)
var choreId = $(e.currentTarget).attr('data-chore-id');
var choreName = $(e.currentTarget).attr('data-chore-name');
var skipped = $(e.currentTarget).hasClass("skip");
var now = $(e.currentTarget).hasClass("now");
Grocy.Api.Get('chores/' + choreId,
function(choreDetails)
{
var trackedTime = moment().format('YYYY-MM-DD HH:mm:ss');
if (skipped)
if ((skipped || !now) && choreDetails.next_estimated_execution_time != null)
{
trackedTime = moment(choreDetails.next_estimated_execution_time).format('YYYY-MM-DD HH:mm:ss');
}
if (choreDetails.chore.track_date_only == 1)
{
if (skipped)
if ((skipped || !now) && choreDetails.next_estimated_execution_time != null)
{
trackedTime = moment(choreDetails.next_estimated_execution_time).format('YYYY-MM-DD');
}

View File

@ -145,7 +145,7 @@
href="#"
data-toggle="tooltip"
data-placement="left"
title="{{ $__t('Track chore execution') }}"
title="{{ $__t('Track next chore schedule') }}"
data-chore-id="{{ $curentChoreEntry->chore_id }}"
data-chore-name="{{ FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->name }}">
<i class="fa-solid fa-play"></i>
@ -166,7 +166,13 @@
<i class="fa-solid fa-ellipsis-v"></i>
</button>
<div class="table-inline-menu dropdown-menu dropdown-menu-right">
<a class="dropdown-item reschedule-chore-button"
<a class="dropdown-item track-chore-button now permission-CHORE_TRACK_EXECUTION"
data-chore-id="{{ $curentChoreEntry->chore_id }}"
type="button"
href="#">
<span>{{ $__t('Track chore execution now') }}</span>
</a>
<a class="dropdown-item reschedule-chore-button permission-CHORE_TRACK_EXECUTION"
data-chore-id="{{ $curentChoreEntry->chore_id }}"
type="button"
href="#">

View File

@ -39,9 +39,9 @@
'label' => 'Tracked time',
'format' => 'YYYY-MM-DD HH:mm:ss',
'initWithNow' => true,
'limitEndToNow' => true,
'limitEndToNow' => false,
'limitStartToNow' => false,
'invalidFeedback' => $__t('This can only be before now')
'invalidFeedback' => $__t('A date is required')
))
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)