mirror of
https://github.com/grocy/grocy.git
synced 2025-04-30 10:05:45 +00:00
Make it possible to track a chore execution without the time part, only the day
This commit is contained in:
parent
98fcd767b3
commit
9ef55f1f01
@ -14,6 +14,7 @@
|
|||||||
- It's now possible to customize the default amount for purchase/consume (see stock settings under the settings icon on the top right)
|
- It's now possible to customize the default amount for purchase/consume (see stock settings under the settings icon on the top right)
|
||||||
- Chores improvements
|
- Chores improvements
|
||||||
- New recurrence patterns - chores can now also be "scheduled" to repat daily/weekly/monthly
|
- New recurrence patterns - chores can now also be "scheduled" to repat daily/weekly/monthly
|
||||||
|
- It's now possible to track the day of a chore execution only (without the time, option per chore)
|
||||||
- Recipe improvements
|
- Recipe improvements
|
||||||
- It's now possible to enter a "variable amount" (e. g. if a recipe needs "1 - 2 cups"), the original amount is still used for stock fulfillment checking (if enabled for that recipe ingredient)
|
- It's now possible to enter a "variable amount" (e. g. if a recipe needs "1 - 2 cups"), the original amount is still used for stock fulfillment checking (if enabled for that recipe ingredient)
|
||||||
- New translations: (thanks all the translators)
|
- New translations: (thanks all the translators)
|
||||||
|
@ -2780,6 +2780,9 @@
|
|||||||
"period_days": {
|
"period_days": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
"track_date_only": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"row_created_timestamp": {
|
"row_created_timestamp": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time"
|
"format": "date-time"
|
||||||
|
@ -1227,3 +1227,9 @@ msgstr ""
|
|||||||
|
|
||||||
msgid "When this is not empty, it will be shown instead of the amount entered above while the amount there will still be used for stock fulfillment checking"
|
msgid "When this is not empty, it will be shown instead of the amount entered above while the amount there will still be used for stock fulfillment checking"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Track date only"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "When enabled only the day of an execution is tracked, not the time"
|
||||||
|
msgstr ""
|
||||||
|
2
migrations/0069.sql
Normal file
2
migrations/0069.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE chores
|
||||||
|
ADD track_date_only TINYINT DEFAULT 0;
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var jsonData = $('#chore-form').serializeJSON();
|
var jsonData = $('#chore-form').serializeJSON({ checkboxUncheckedValue: "0" });
|
||||||
Grocy.FrontendHelpers.BeginUiBusy("chore-form");
|
Grocy.FrontendHelpers.BeginUiBusy("chore-form");
|
||||||
|
|
||||||
if (Grocy.EditMode === 'create')
|
if (Grocy.EditMode === 'create')
|
||||||
|
@ -65,7 +65,15 @@ $(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');
|
||||||
|
|
||||||
|
Grocy.Api.Get('objects/chores/' + choreId,
|
||||||
|
function(chore)
|
||||||
|
{
|
||||||
var trackedTime = moment().format('YYYY-MM-DD HH:mm:ss');
|
var trackedTime = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||||
|
if (chore.track_date_only == 1)
|
||||||
|
{
|
||||||
|
trackedTime = moment().format('YYYY-MM-DD');
|
||||||
|
}
|
||||||
|
|
||||||
Grocy.Api.Post('chores/' + choreId + '/execute', { 'tracked_time': trackedTime },
|
Grocy.Api.Post('chores/' + choreId + '/execute', { 'tracked_time': trackedTime },
|
||||||
function()
|
function()
|
||||||
@ -124,6 +132,13 @@ $(document).on('click', '.track-chore-button', function(e)
|
|||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
},
|
||||||
|
function(xhr)
|
||||||
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("choretracking-form");
|
||||||
|
console.error(xhr);
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("click", ".chore-name-cell", function(e)
|
$(document).on("click", ".chore-name-cell", function(e)
|
||||||
|
@ -45,6 +45,26 @@ $('#chore_id').on('change', function(e)
|
|||||||
var choreId = $(e.target).val();
|
var choreId = $(e.target).val();
|
||||||
if (choreId)
|
if (choreId)
|
||||||
{
|
{
|
||||||
|
Grocy.Api.Get('objects/chores/' + choreId,
|
||||||
|
function(chore)
|
||||||
|
{
|
||||||
|
if (chore.track_date_only == 1)
|
||||||
|
{
|
||||||
|
Grocy.Components.DateTimePicker.ChangeFormat("YYYY-MM-DD");
|
||||||
|
Grocy.Components.DateTimePicker.SetValue(moment().format("YYYY-MM-DD"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Grocy.Components.DateTimePicker.ChangeFormat("YYYY-MM-DD HH:mm:ss");
|
||||||
|
Grocy.Components.DateTimePicker.SetValue(moment().format("YYYY-MM-DD HH:mm:ss"));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(xhr)
|
||||||
|
{
|
||||||
|
console.error(xhr);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
Grocy.Components.ChoreCard.Refresh(choreId);
|
Grocy.Components.ChoreCard.Refresh(choreId);
|
||||||
Grocy.Components.DateTimePicker.GetInputElement().focus();
|
Grocy.Components.DateTimePicker.GetInputElement().focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
||||||
|
@ -43,6 +43,13 @@ Grocy.Components.DateTimePicker.Clear = function()
|
|||||||
$('#datetimepicker-timeago').text('');
|
$('#datetimepicker-timeago').text('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Grocy.Components.DateTimePicker.ChangeFormat = function(format)
|
||||||
|
{
|
||||||
|
$(".datetimepicker").datetimepicker("destroy");
|
||||||
|
Grocy.Components.DateTimePicker.GetInputElement().data("format", format);
|
||||||
|
Grocy.Components.DateTimePicker.Init();
|
||||||
|
}
|
||||||
|
|
||||||
var startDate = null;
|
var startDate = null;
|
||||||
if (Grocy.Components.DateTimePicker.GetInputElement().data('init-with-now') === true)
|
if (Grocy.Components.DateTimePicker.GetInputElement().data('init-with-now') === true)
|
||||||
{
|
{
|
||||||
|
@ -59,6 +59,12 @@ class ChoresService extends BaseService
|
|||||||
throw new \Exception('User does not exist');
|
throw new \Exception('User does not exist');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$chore = $this->Database->chores($choreId);
|
||||||
|
if ($chore->track_date_only == 1)
|
||||||
|
{
|
||||||
|
$trackedTime = substr($trackedTime, 0, 10) . ' 00:00:00';
|
||||||
|
}
|
||||||
|
|
||||||
$logRow = $this->Database->chores_log()->createRow(array(
|
$logRow = $this->Database->chores_log()->createRow(array(
|
||||||
'chore_id' => $choreId,
|
'chore_id' => $choreId,
|
||||||
'tracked_time' => $trackedTime,
|
'tracked_time' => $trackedTime,
|
||||||
|
@ -87,6 +87,16 @@
|
|||||||
|
|
||||||
<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">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="hidden" name="track_date_only" value="0">
|
||||||
|
<input @if($mode == 'edit' && $chore->track_date_only == 1) checked @endif class="form-check-input" type="checkbox" id="track_date_only" name="track_date_only" value="1">
|
||||||
|
<label class="form-check-label" for="track_date_only">{{ $__t('Track date only') }}
|
||||||
|
<span class="text-muted small">{{ $__t('When enabled only the day of an execution is tracked, not the time') }}</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@include('components.userfieldsform', array(
|
@include('components.userfieldsform', array(
|
||||||
'userfields' => $userfields,
|
'userfields' => $userfields,
|
||||||
'entity' => 'chores'
|
'entity' => 'chores'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user