From 1090f070c9759d3b42f066dcae28eece9046f5fe Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Thu, 16 Mar 2023 18:47:01 +0100 Subject: [PATCH 1/4] Optimized shopping list done items filter handling (fixes #2169) --- public/viewjs/shoppinglist.js | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/public/viewjs/shoppinglist.js b/public/viewjs/shoppinglist.js index c7f5dff5..7cfb08ee 100644 --- a/public/viewjs/shoppinglist.js +++ b/public/viewjs/shoppinglist.js @@ -355,17 +355,24 @@ $(document).on('click', '.order-listitem-button', function(e) Grocy.Api.Put('objects/shopping_list/' + listItemId, { 'done': done }, function() { + var statusInfoCell = $("#shoppinglistitem-" + listItemId + "-status-info"); + if (done == 1) { $('#shoppinglistitem-' + listItemId + '-row').addClass("text-muted"); $('#shoppinglistitem-' + listItemId + '-row').addClass("text-strike-through"); + statusInfoCell.text(statusInfoCell.text().replace("xxUNDONExx", "xxDONExx")); } else { $('#shoppinglistitem-' + listItemId + '-row').removeClass("text-muted"); $('#shoppinglistitem-' + listItemId + '-row').removeClass("text-strike-through"); + statusInfoCell.text(statusInfoCell.text().replace("xxDONExx", "xxUNDONExx")); } + shoppingListTable.rows().invalidate().draw(false); + $("#status-filter").trigger("change"); + Grocy.FrontendHelpers.EndUiBusy(); }, function(xhr) @@ -374,20 +381,6 @@ $(document).on('click', '.order-listitem-button', function(e) console.error(xhr); } ); - - - var statusInfoCell = $("#shoppinglistitem-" + listItemId + "-status-info"); - if (done == 1) - { - statusInfoCell.text(statusInfoCell.text().replace("xxUNDONExx", "xxDONExx")); - } - else - { - statusInfoCell.text(statusInfoCell.text().replace("xxDONExx", "xxUNDONExx")); - } - shoppingListTable.rows().invalidate().draw(false); - - $("#status-filter").trigger("change"); }); function OnListItemRemoved() From 756133a9eb4672df26b38d62b4b359fe25f9fe04 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Thu, 16 Mar 2023 18:52:41 +0100 Subject: [PATCH 2/4] Removed shopping list table fixed order (fixes #2167) --- public/viewjs/shoppinglist.js | 1 - 1 file changed, 1 deletion(-) diff --git a/public/viewjs/shoppinglist.js b/public/viewjs/shoppinglist.js index 7cfb08ee..25294200 100644 --- a/public/viewjs/shoppinglist.js +++ b/public/viewjs/shoppinglist.js @@ -1,6 +1,5 @@ var shoppingListTable = $('#shoppinglist-table').DataTable({ 'order': [[1, 'asc']], - "orderFixed": [[3, 'asc']], 'columnDefs': [ { 'orderable': false, 'targets': 0 }, { 'searchable': false, "targets": 0 }, From 3d01854fa118383aa15e19de1cb764ed0a3878f1 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Thu, 16 Mar 2023 21:16:27 +0100 Subject: [PATCH 3/4] Don't use double quotes for SQL string literals (references #2170) --- migrations/0115.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/migrations/0115.sql b/migrations/0115.sql index 15636c61..20935e58 100644 --- a/migrations/0115.sql +++ b/migrations/0115.sql @@ -1 +1,3 @@ -update user_settings set key = "stock_due_soon_days" where key = "stock_expring_soon_days"; +UPDATE user_settings +SET key = 'stock_due_soon_days' +WHERE key = 'stock_expring_soon_days'; From 98469248eb4c74941e67b8ee9ff26b3292cca7ce Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Fri, 31 Mar 2023 20:12:06 +0200 Subject: [PATCH 4/4] 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 @@