From 98469248eb4c74941e67b8ee9ff26b3292cca7ce Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Fri, 31 Mar 2023 20:12:06 +0200 Subject: [PATCH] Optimized tracking button handling on /choresoverview (closes #2186) --- changelog/70_UNRELEASED_xxxx.xx.xx.md | 5 ++++- localization/strings.pot | 5 ++++- public/viewjs/choresoverview.js | 5 +++-- views/choresoverview.blade.php | 10 ++++++++-- views/choretracking.blade.php | 4 ++-- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/changelog/70_UNRELEASED_xxxx.xx.xx.md b/changelog/70_UNRELEASED_xxxx.xx.xx.md index bacdb590..6c04d196 100644 --- a/changelog/70_UNRELEASED_xxxx.xx.xx.md +++ b/changelog/70_UNRELEASED_xxxx.xx.xx.md @@ -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 diff --git a/localization/strings.pot b/localization/strings.pot index 92d05e62..fcc0b034 100644 --- a/localization/strings.pot +++ b/localization/strings.pot @@ -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 "" diff --git a/public/viewjs/choresoverview.js b/public/viewjs/choresoverview.js index 18040928..431e32ce 100644 --- a/public/viewjs/choresoverview.js +++ b/public/viewjs/choresoverview.js @@ -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'); } diff --git a/views/choresoverview.blade.php b/views/choresoverview.blade.php index e2cd0635..f16cb5a9 100644 --- a/views/choresoverview.blade.php +++ b/views/choresoverview.blade.php @@ -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 }}"> @@ -166,7 +166,13 @@