Merge branch 'master' into pr/raupie/2135

This commit is contained in:
Bernd Bestel 2023-04-01 17:01:13 +02:00
commit 5ad1fdc814
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
6 changed files with 27 additions and 23 deletions

View File

@ -53,7 +53,10 @@
### Chores ### 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 ### Calendar

View File

@ -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';

View File

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

View File

@ -1,6 +1,5 @@
var shoppingListTable = $('#shoppinglist-table').DataTable({ var shoppingListTable = $('#shoppinglist-table').DataTable({
'order': [[1, 'asc']], 'order': [[1, 'asc']],
"orderFixed": [[3, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 }, { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }, { 'searchable': false, "targets": 0 },
@ -355,17 +354,24 @@ $(document).on('click', '.order-listitem-button', function(e)
Grocy.Api.Put('objects/shopping_list/' + listItemId, { 'done': done }, Grocy.Api.Put('objects/shopping_list/' + listItemId, { 'done': done },
function() function()
{ {
var statusInfoCell = $("#shoppinglistitem-" + listItemId + "-status-info");
if (done == 1) if (done == 1)
{ {
$('#shoppinglistitem-' + listItemId + '-row').addClass("text-muted"); $('#shoppinglistitem-' + listItemId + '-row').addClass("text-muted");
$('#shoppinglistitem-' + listItemId + '-row').addClass("text-strike-through"); $('#shoppinglistitem-' + listItemId + '-row').addClass("text-strike-through");
statusInfoCell.text(statusInfoCell.text().replace("xxUNDONExx", "xxDONExx"));
} }
else else
{ {
$('#shoppinglistitem-' + listItemId + '-row').removeClass("text-muted"); $('#shoppinglistitem-' + listItemId + '-row').removeClass("text-muted");
$('#shoppinglistitem-' + listItemId + '-row').removeClass("text-strike-through"); $('#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(); Grocy.FrontendHelpers.EndUiBusy();
}, },
function(xhr) function(xhr)
@ -374,20 +380,6 @@ $(document).on('click', '.order-listitem-button', function(e)
console.error(xhr); 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() function OnListItemRemoved()

View File

@ -145,7 +145,7 @@
href="#" href="#"
data-toggle="tooltip" data-toggle="tooltip"
data-placement="left" data-placement="left"
title="{{ $__t('Track chore execution') }}" title="{{ $__t('Track next chore schedule') }}"
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>
@ -166,7 +166,13 @@
<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 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 }}" data-chore-id="{{ $curentChoreEntry->chore_id }}"
type="button" type="button"
href="#"> href="#">

View File

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