From 4dd804003b6d4536da71484c8884bf86def39346 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Tue, 17 Sep 2019 17:17:33 +0200 Subject: [PATCH] Re-apply filter after chore execution on the chores overview page --- public/viewjs/choresoverview.js | 7 +++++++ views/choresoverview.blade.php | 9 ++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/public/viewjs/choresoverview.js b/public/viewjs/choresoverview.js index c1536119..e5cef4ca 100644 --- a/public/viewjs/choresoverview.js +++ b/public/viewjs/choresoverview.js @@ -114,13 +114,16 @@ $(document).on('click', '.track-chore-button', function(e) choreRow.removeClass("table-warning"); choreRow.removeClass("table-danger"); + $('#chore-' + choreId + '-due-filter-column').html(""); if (nextExecutionTime.isBefore(now)) { choreRow.addClass("table-danger"); + $('#chore-' + choreId + '-due-filter-column').html("overdue"); } else if (nextExecutionTime.isBefore(nextXDaysThreshold)) { choreRow.addClass("table-warning"); + $('#chore-' + choreId + '-due-filter-column').html("duesoon"); } $('#chore-' + choreId + '-last-tracked-time').parent().effect('highlight', { }, 500); @@ -157,6 +160,10 @@ $(document).on('click', '.track-chore-button', function(e) setTimeout(function() { RefreshContextualTimeago(); + + // Refresh the DataTable to re-apply filters + choresOverviewTable.rows().invalidate().draw(false); + $(".input-group-filter").trigger("change"); }, 550); }, function(xhr) diff --git a/views/choresoverview.blade.php b/views/choresoverview.blade.php index d7b8cad3..d6e6b721 100644 --- a/views/choresoverview.blade.php +++ b/views/choresoverview.blade.php @@ -25,11 +25,11 @@
- +
- @@ -37,7 +37,7 @@
- @foreach($users as $user) @@ -115,9 +115,8 @@ @endif - + @if(FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->period_type !== \Grocy\Services\ChoresService::CHORE_PERIOD_TYPE_MANUALLY && $curentChoreEntry->next_estimated_execution_time < date('Y-m-d H:i:s')) overdue @elseif(FindObjectInArrayByPropertyValue($chores, 'id', $curentChoreEntry->chore_id)->period_type !== \Grocy\Services\ChoresService::CHORE_PERIOD_TYPE_MANUALLY && $curentChoreEntry->next_estimated_execution_time < date('Y-m-d H:i:s', strtotime("+$nextXDays days"))) duesoon @endif - @if($curentChoreEntry->next_execution_assigned_to_user_id == GROCY_USER_ID) assigned-to-me @endif @if(!empty($curentChoreEntry->next_execution_assigned_to_user_id))