mirror of
https://github.com/grocy/grocy.git
synced 2025-09-19 02:57:44 +00:00
Make it possible to track any information on chore execution (by using Userfields, closes #825)
This commit is contained in:
@@ -70,7 +70,10 @@
|
|||||||
- This happens automatically on consuming a recipe/product from the meal plan page
|
- This happens automatically on consuming a recipe/product from the meal plan page
|
||||||
- Fixed that stock fulfillment checking used the desired servings of the recipe (those selected on the recipes page, not them from the meal plan entry)
|
- Fixed that stock fulfillment checking used the desired servings of the recipe (those selected on the recipes page, not them from the meal plan entry)
|
||||||
|
|
||||||
### Chores fixes
|
### Chores improvements(fixes
|
||||||
|
- It's now possible to track any addtional info on a chore execution by using Userfields
|
||||||
|
- => Configure the desired Userfields for the entity `chores_log`
|
||||||
|
- => The on chore execution tracking entered information is then visible on the corresponding chore journal entry
|
||||||
- Fixed that tracking chores with "Done by" a different user was not possible
|
- Fixed that tracking chores with "Done by" a different user was not possible
|
||||||
|
|
||||||
### Userfield fixes
|
### Userfield fixes
|
||||||
|
@@ -62,7 +62,9 @@ class ChoresController extends BaseController
|
|||||||
return $this->renderPage($response, 'choresjournal', [
|
return $this->renderPage($response, 'choresjournal', [
|
||||||
'choresLog' => $this->getDatabase()->chores_log()->orderBy('tracked_time', 'DESC'),
|
'choresLog' => $this->getDatabase()->chores_log()->orderBy('tracked_time', 'DESC'),
|
||||||
'chores' => $this->getDatabase()->chores()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
'chores' => $this->getDatabase()->chores()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'users' => $this->getDatabase()->users()->orderBy('username')
|
'users' => $this->getDatabase()->users()->orderBy('username'),
|
||||||
|
'userfields' => $this->getUserfieldsService()->GetFields('chores_log'),
|
||||||
|
'userfieldValues' => $this->getUserfieldsService()->GetAllValues('chores_log')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +87,8 @@ class ChoresController extends BaseController
|
|||||||
{
|
{
|
||||||
return $this->renderPage($response, 'choretracking', [
|
return $this->renderPage($response, 'choretracking', [
|
||||||
'chores' => $this->getDatabase()->chores()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
'chores' => $this->getDatabase()->chores()->where('active = 1')->orderBy('name', 'COLLATE NOCASE'),
|
||||||
'users' => $this->getDatabase()->users()->orderBy('username')
|
'users' => $this->getDatabase()->users()->orderBy('username'),
|
||||||
|
'userfields' => $this->getUserfieldsService()->GetFields('chores_log'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5447,7 +5447,7 @@
|
|||||||
"stock_log",
|
"stock_log",
|
||||||
"stock",
|
"stock",
|
||||||
"stock_current_locations",
|
"stock_current_locations",
|
||||||
"api_keys"
|
"chores_log"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ExposedEntityNoListing": {
|
"ExposedEntityNoListing": {
|
||||||
@@ -5462,7 +5462,8 @@
|
|||||||
"stock_log",
|
"stock_log",
|
||||||
"api_keys",
|
"api_keys",
|
||||||
"stock",
|
"stock",
|
||||||
"stock_current_locations"
|
"stock_current_locations",
|
||||||
|
"chores_log"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ExposedEntityNoDelete": {
|
"ExposedEntityNoDelete": {
|
||||||
@@ -5470,7 +5471,8 @@
|
|||||||
"enum": [
|
"enum": [
|
||||||
"stock_log",
|
"stock_log",
|
||||||
"stock",
|
"stock",
|
||||||
"stock_current_locations"
|
"stock_current_locations",
|
||||||
|
"chores_log"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ExposedEntityEditRequiresAdmin": {
|
"ExposedEntityEditRequiresAdmin": {
|
||||||
|
@@ -15,6 +15,9 @@
|
|||||||
{
|
{
|
||||||
Grocy.Api.Post('chores/' + jsonForm.chore_id + '/execute', { 'tracked_time': Grocy.Components.DateTimePicker.GetValue(), 'done_by': $("#user_id").val() },
|
Grocy.Api.Post('chores/' + jsonForm.chore_id + '/execute', { 'tracked_time': Grocy.Components.DateTimePicker.GetValue(), 'done_by': $("#user_id").val() },
|
||||||
function(result)
|
function(result)
|
||||||
|
{
|
||||||
|
Grocy.EditObjectId = result.id;
|
||||||
|
Grocy.Components.UserfieldsForm.Save(function()
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.EndUiBusy("choretracking-form");
|
Grocy.FrontendHelpers.EndUiBusy("choretracking-form");
|
||||||
toastr.success(__t('Tracked execution of chore %1$s on %2$s', choreDetails.chore.name, Grocy.Components.DateTimePicker.GetValue()) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoChoreExecution(' + result.id + ')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>');
|
toastr.success(__t('Tracked execution of chore %1$s on %2$s', choreDetails.chore.name, Grocy.Components.DateTimePicker.GetValue()) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoChoreExecution(' + result.id + ')"><i class="fas fa-undo"></i> ' + __t("Undo") + '</a>');
|
||||||
@@ -26,6 +29,7 @@
|
|||||||
Grocy.Components.DateTimePicker.SetValue(moment().format('YYYY-MM-DD HH:mm:ss'));
|
Grocy.Components.DateTimePicker.SetValue(moment().format('YYYY-MM-DD HH:mm:ss'));
|
||||||
$('#chore_id_text_input').trigger('change');
|
$('#chore_id_text_input').trigger('change');
|
||||||
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
||||||
|
});
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
@@ -59,7 +59,9 @@ class UserfieldsService extends BaseService
|
|||||||
$userEntities[] = 'userentity-' . $userentity->name;
|
$userEntities[] = 'userentity-' . $userentity->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
return array_merge($exposedDefaultEntities, $userEntities, $specialEntities);
|
$entitiesSorted = array_merge($exposedDefaultEntities, $userEntities, $specialEntities);
|
||||||
|
sort($entitiesSorted);
|
||||||
|
return $entitiesSorted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetField($fieldId)
|
public function GetField($fieldId)
|
||||||
|
@@ -77,6 +77,10 @@
|
|||||||
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
|
@if(GROCY_FEATURE_FLAG_CHORES_ASSIGNMENTS)
|
||||||
<th>{{ $__t('Done by') }}</th>
|
<th>{{ $__t('Done by') }}</th>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@include('components.userfields_thead', array(
|
||||||
|
'userfields' => $userfields
|
||||||
|
))
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="d-none">
|
<tbody class="d-none">
|
||||||
@@ -116,6 +120,11 @@
|
|||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@include('components.userfields_tbody', array(
|
||||||
|
'userfields' => $userfields,
|
||||||
|
'userfieldValues' => FindAllObjectsInArrayByPropertyValue($userfieldValues, 'object_id', $choreLogEntry->id)
|
||||||
|
))
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@@ -52,6 +52,11 @@
|
|||||||
value="{{ GROCY_USER_ID }}">
|
value="{{ GROCY_USER_ID }}">
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@include('components.userfieldsform', array(
|
||||||
|
'userfields' => $userfields,
|
||||||
|
'entity' => 'chores_log'
|
||||||
|
))
|
||||||
|
|
||||||
<button id="save-choretracking-button"
|
<button id="save-choretracking-button"
|
||||||
class="btn btn-success">{{ $__t('OK') }}</button>
|
class="btn btn-success">{{ $__t('OK') }}</button>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user