Added a sub feature flag to disable chore assignments when not needed

This commit is contained in:
Bernd Bestel
2019-09-26 17:20:25 +02:00
parent cf3217ada4
commit cf2e6f1039
9 changed files with 38 additions and 3 deletions

View File

@@ -9,6 +9,9 @@
- It's now possible to display a recipe directly from the meal plan (new "eye button") (thanks @kriddles) - It's now possible to display a recipe directly from the meal plan (new "eye button") (thanks @kriddles)
- Improved the responsiveness of the meal plan and calendar page by automatically switching to a day calendar view on smaller screens (thanks for the idea @kriddles) - Improved the responsiveness of the meal plan and calendar page by automatically switching to a day calendar view on smaller screens (thanks for the idea @kriddles)
### Chores improvements
- There is now a new sub feature flag `FEATURE_FLAG_CHORES_ASSIGNMENTS` to disable chore assignments if you don't need them (defaults to `true`, so no changed behavior when not configured)
### Calendar improvements ### Calendar improvements
- The calendar now also contains all planned recipes from the meal plan on the corresponding day - The calendar now also contains all planned recipes from the meal plan on the corresponding day
- Improved that dates in the iCal calendar export now include the server timezone - Improved that dates in the iCal calendar export now include the server timezone

View File

@@ -124,6 +124,7 @@ Setting('FEATURE_FLAG_STOCK_PRICE_TRACKING', true);
Setting('FEATURE_FLAG_STOCK_LOCATION_TRACKING', true); Setting('FEATURE_FLAG_STOCK_LOCATION_TRACKING', true);
Setting('FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING', true); Setting('FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING', true);
Setting('FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING', true); Setting('FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING', true);
Setting('FEATURE_FLAG_CHORES_ASSIGNMENTS', true);
# Feature settings # Feature settings

View File

@@ -3,7 +3,11 @@
e.preventDefault(); e.preventDefault();
var jsonData = $('#chore-form').serializeJSON({ checkboxUncheckedValue: "0" }); var jsonData = $('#chore-form').serializeJSON({ checkboxUncheckedValue: "0" });
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
{
jsonData.assignment_config = $("#assignment_config").val().join(","); jsonData.assignment_config = $("#assignment_config").val().join(",");
}
Grocy.FrontendHelpers.BeginUiBusy("chore-form"); Grocy.FrontendHelpers.BeginUiBusy("chore-form");
if (Grocy.EditMode === 'create') if (Grocy.EditMode === 'create')

View File

@@ -8,7 +8,7 @@
Grocy.Api.Get('chores/' + jsonForm.chore_id, Grocy.Api.Get('chores/' + jsonForm.chore_id,
function (choreDetails) function (choreDetails)
{ {
Grocy.Api.Post('chores/' + jsonForm.chore_id + '/execute', { 'tracked_time': Grocy.Components.DateTimePicker.GetValue(), 'done_by': Grocy.Components.UserPicker.GetValue() }, Grocy.Api.Post('chores/' + jsonForm.chore_id + '/execute', { 'tracked_time': Grocy.Components.DateTimePicker.GetValue(), 'done_by': $("#user_id").val() },
function(result) function(result)
{ {
Grocy.FrontendHelpers.EndUiBusy("choretracking-form"); Grocy.FrontendHelpers.EndUiBusy("choretracking-form");

View File

@@ -86,6 +86,7 @@
<input type="hidden" id="period_config" name="period_config" value="@if($mode == 'edit'){{ $chore->period_config }}@endif"> <input type="hidden" id="period_config" name="period_config" value="@if($mode == 'edit'){{ $chore->period_config }}@endif">
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
<div class="form-group"> <div class="form-group">
<label for="assignment_type">{{ $__t('Assignment type') }} <span id="chore-assignment-type-info" class="small text-muted"></span></label> <label for="assignment_type">{{ $__t('Assignment type') }} <span id="chore-assignment-type-info" class="small text-muted"></span></label>
<select required class="form-control input-group-chore-assignment-type" id="assignment_type" name="assignment_type"> <select required class="form-control input-group-chore-assignment-type" id="assignment_type" name="assignment_type">
@@ -105,6 +106,10 @@
</select> </select>
<div class="invalid-feedback">{{ $__t('This assignment type requires that at least one is assigned') }}</div> <div class="invalid-feedback">{{ $__t('This assignment type requires that at least one is assigned') }}</div>
</div> </div>
@else
<input type="hidden" id="assignment_type" name="assignment_type" value="{{ \Grocy\Services\ChoresService::CHORE_ASSIGNMENT_TYPE_NO_ASSIGNMENT }}">
<input type="hidden" id="assignment_config" name="assignment_config" value="">
@endif
<div class="form-group"> <div class="form-group">
<div class="form-check"> <div class="form-check">

View File

@@ -35,7 +35,9 @@
<th class="border-right"></th> <th class="border-right"></th>
<th>{{ $__t('Chore') }}</th> <th>{{ $__t('Chore') }}</th>
<th>{{ $__t('Tracked time') }}</th> <th>{{ $__t('Tracked time') }}</th>
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
<th>{{ $__t('Done by') }}</th> <th>{{ $__t('Done by') }}</th>
@endif
</tr> </tr>
</thead> </thead>
<tbody class="d-none"> <tbody class="d-none">
@@ -58,6 +60,7 @@
<span>{{ $choreLogEntry->tracked_time }}</span> <span>{{ $choreLogEntry->tracked_time }}</span>
<time class="timeago timeago-contextual @if(FindObjectInArrayByPropertyValue($chores, 'id', $choreLogEntry->chore_id)->track_date_only == 1) timeago-date-only @endif" datetime="{{ $choreLogEntry->tracked_time }}"></time> <time class="timeago timeago-contextual @if(FindObjectInArrayByPropertyValue($chores, 'id', $choreLogEntry->chore_id)->track_date_only == 1) timeago-date-only @endif" datetime="{{ $choreLogEntry->tracked_time }}"></time>
</td> </td>
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
<td> <td>
@if ($choreLogEntry->done_by_user_id !== null && !empty($choreLogEntry->done_by_user_id)) @if ($choreLogEntry->done_by_user_id !== null && !empty($choreLogEntry->done_by_user_id))
{{ GetUserDisplayName(FindObjectInArrayByPropertyValue($users, 'id', $choreLogEntry->done_by_user_id)) }} {{ GetUserDisplayName(FindObjectInArrayByPropertyValue($users, 'id', $choreLogEntry->done_by_user_id)) }}
@@ -65,6 +68,7 @@
{{ $__t('Unknown') }} {{ $__t('Unknown') }}
@endif @endif
</td> </td>
@endif
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>

View File

@@ -18,7 +18,9 @@
</h1> </h1>
<p id="info-due-chores" data-status-filter="duesoon" data-next-x-days="{{ $nextXDays }}" class="btn btn-lg btn-warning status-filter-button responsive-button mr-2"></p> <p id="info-due-chores" data-status-filter="duesoon" data-next-x-days="{{ $nextXDays }}" class="btn btn-lg btn-warning status-filter-button responsive-button mr-2"></p>
<p id="info-overdue-chores" data-status-filter="overdue" class="btn btn-lg btn-danger status-filter-button responsive-button mr-2"></p> <p id="info-overdue-chores" data-status-filter="overdue" class="btn btn-lg btn-danger status-filter-button responsive-button mr-2"></p>
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
<p id="info-assigned-to-me-chores" data-user-filter="xx{{ GROCY_USER_ID }}xx" class="btn btn-lg btn-secondary user-filter-button responsive-button"></p> <p id="info-assigned-to-me-chores" data-user-filter="xx{{ GROCY_USER_ID }}xx" class="btn btn-lg btn-secondary user-filter-button responsive-button"></p>
@endif
</div> </div>
</div> </div>
@@ -35,6 +37,7 @@
<option class="bg-danger" value="overdue">{{ $__t('Overdue') }}</option> <option class="bg-danger" value="overdue">{{ $__t('Overdue') }}</option>
</select> </select>
</div> </div>
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
<div class="col-xs-12 col-md-6 col-xl-3"> <div class="col-xs-12 col-md-6 col-xl-3">
<label for="user-filter">{{ $__t('Filter by assignment') }}</label> <i class="fas fa-filter"></i> <label for="user-filter">{{ $__t('Filter by assignment') }}</label> <i class="fas fa-filter"></i>
<select class="form-control input-group-filter" id="user-filter"> <select class="form-control input-group-filter" id="user-filter">
@@ -44,6 +47,7 @@
@endforeach @endforeach
</select> </select>
</div> </div>
@endif
</div> </div>
<div class="row"> <div class="row">
@@ -55,9 +59,13 @@
<th>{{ $__t('Chore') }}</th> <th>{{ $__t('Chore') }}</th>
<th>{{ $__t('Next estimated tracking') }}</th> <th>{{ $__t('Next estimated tracking') }}</th>
<th>{{ $__t('Last tracked') }}</th> <th>{{ $__t('Last tracked') }}</th>
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
<th>{{ $__t('Assigned to') }}</th> <th>{{ $__t('Assigned to') }}</th>
@endif
<th class="d-none">Hidden status</th> <th class="d-none">Hidden status</th>
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
<th class="d-none">Hidden assigned to user id</th> <th class="d-none">Hidden assigned to user id</th>
@endif
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
@@ -106,6 +114,7 @@
<span id="chore-{{ $curentChoreEntry->chore_id }}-last-tracked-time">{{ $curentChoreEntry->last_tracked_time }}</span> <span id="chore-{{ $curentChoreEntry->chore_id }}-last-tracked-time">{{ $curentChoreEntry->last_tracked_time }}</span>
<time id="chore-{{ $curentChoreEntry->chore_id }}-last-tracked-time-timeago" class="timeago timeago-contextual @if($curentChoreEntry->track_date_only == 1) timeago-date-only @endif" datetime="{{ $curentChoreEntry->last_tracked_time }}"></time> <time id="chore-{{ $curentChoreEntry->chore_id }}-last-tracked-time-timeago" class="timeago timeago-contextual @if($curentChoreEntry->track_date_only == 1) timeago-date-only @endif" datetime="{{ $curentChoreEntry->last_tracked_time }}"></time>
</td> </td>
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
<td> <td>
<span id="chore-{{ $curentChoreEntry->chore_id }}-next-execution-assigned-user"> <span id="chore-{{ $curentChoreEntry->chore_id }}-next-execution-assigned-user">
@if(!empty($curentChoreEntry->next_execution_assigned_to_user_id)) @if(!empty($curentChoreEntry->next_execution_assigned_to_user_id))
@@ -115,14 +124,17 @@
@endif @endif
</span> </span>
</td> </td>
@endif
<td id="chore-{{ $curentChoreEntry->chore_id }}-due-filter-column" class="d-none"> <td id="chore-{{ $curentChoreEntry->chore_id }}-due-filter-column" class="d-none">
@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(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
</td> </td>
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
<td class="d-none"> <td class="d-none">
@if(!empty($curentChoreEntry->next_execution_assigned_to_user_id)) @if(!empty($curentChoreEntry->next_execution_assigned_to_user_id))
xx{{ $curentChoreEntry->next_execution_assigned_to_user_id }}xx xx{{ $curentChoreEntry->next_execution_assigned_to_user_id }}xx
@endif @endif
</td> </td>
@endif
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,

View File

@@ -32,12 +32,16 @@
'invalidFeedback' => $__t('This can only be before now') 'invalidFeedback' => $__t('This can only be before now')
)) ))
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
@include('components.userpicker', array( @include('components.userpicker', array(
'label' => 'Done by', 'label' => 'Done by',
'users' => $users, 'users' => $users,
'nextInputSelector' => '#user_id', 'nextInputSelector' => '#user_id',
'prefillByUserId' => GROCY_USER_ID 'prefillByUserId' => GROCY_USER_ID
)) ))
@else
<input type="hidden" id="user_id" name="user_id" value="{{ GROCY_USER_ID }}">
@endif
<button id="save-choretracking-button" class="btn btn-success">{{ $__t('OK') }}</button> <button id="save-choretracking-button" class="btn btn-success">{{ $__t('OK') }}</button>

View File

@@ -13,6 +13,8 @@
<h3><span id="chorecard-chore-name"></span></h3> <h3><span id="chorecard-chore-name"></span></h3>
<strong>{{ $__t('Tracked count') }}:</strong> <span id="chorecard-chore-tracked-count" class="locale-number locale-number-generic"></span><br> <strong>{{ $__t('Tracked count') }}:</strong> <span id="chorecard-chore-tracked-count" class="locale-number locale-number-generic"></span><br>
<strong>{{ $__t('Last tracked') }}:</strong> <span id="chorecard-chore-last-tracked"></span> <time id="chorecard-chore-last-tracked-timeago" class="timeago timeago-contextual"></time><br> <strong>{{ $__t('Last tracked') }}:</strong> <span id="chorecard-chore-last-tracked"></span> <time id="chorecard-chore-last-tracked-timeago" class="timeago timeago-contextual"></time><br>
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
<strong>{{ $__t('Last done by') }}:</strong> <span id="chorecard-chore-last-done-by"></span> <strong>{{ $__t('Last done by') }}:</strong> <span id="chorecard-chore-last-done-by"></span>
@endif
</div> </div>
</div> </div>