Squashed commit

Updated dependencies
Added the possibility to skip chore schedules (closes #1486)
Show the meal plan section on the corresponding calendar events (closes #1582)
Make it possible to define a time for meal plan sections and use that time for the corresponding calendar events (references #1582)
Added a changelog template
Make it possible to toggle the meal plan calendar view on bigger screens (closes #1678)
This commit is contained in:
Bernd Bestel
2022-02-08 18:08:26 +01:00
parent 4279bf6445
commit 66cf7e4ffa
27 changed files with 556 additions and 301 deletions

View File

@@ -205,5 +205,10 @@ function CleanFileName(fileName)
function nl2br(s)
{
if (s == null || s === undefined)
{
return "";
}
return s.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, "$1<br>$2");
}

View File

@@ -393,6 +393,7 @@ Grocy.FrontendHelpers.ValidateForm = function(formId)
if (form.checkValidity() === true)
{
$(form).find(':submit').removeClass('disabled');
$(form).find('.keep-disabled').addClass('disabled');
}
else
{

View File

@@ -24,7 +24,6 @@
$('#battery_id_text_input').focus();
$('#battery_id_text_input').val('');
$('#tracked_time').find('input').val(moment().format('YYYY-MM-DD HH:mm:ss'));
$('#tracked_time').find('input').trigger('change');
$('#battery_id_text_input').trigger('change');
Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
},

View File

@@ -92,6 +92,7 @@ $(document).on('click', '.track-chore-button', function(e)
var choreId = $(e.currentTarget).attr('data-chore-id');
var choreName = $(e.currentTarget).attr('data-chore-name');
var skipped = $(e.currentTarget).hasClass("skip");
Grocy.Api.Get('objects/chores/' + choreId,
function(chore)
@@ -102,7 +103,7 @@ $(document).on('click', '.track-chore-button', function(e)
trackedTime = moment().format('YYYY-MM-DD');
}
Grocy.Api.Post('chores/' + choreId + '/execute', { 'tracked_time': trackedTime },
Grocy.Api.Post('chores/' + choreId + '/execute', { 'tracked_time': trackedTime, 'skipped': skipped },
function()
{
Grocy.Api.Get('chores/' + choreId,
@@ -132,7 +133,7 @@ $(document).on('click', '.track-chore-button', function(e)
$('#chore-' + choreId + '-last-tracked-time').text(trackedTime);
$('#chore-' + choreId + '-last-tracked-time-timeago').attr('datetime', trackedTime);
if (result.chore.period_type == "dynamic-regular")
if (result.chore.period_type != "manually")
{
$('#chore-' + choreId + '-next-execution-time').text(result.next_estimated_execution_time);
$('#chore-' + choreId + '-next-execution-time-timeago').attr('datetime', result.next_estimated_execution_time);

View File

@@ -1,4 +1,4 @@
$('#save-choretracking-button').on('click', function(e)
$('.save-choretracking-button').on('click', function(e)
{
e.preventDefault();
@@ -7,13 +7,15 @@
return;
}
var skipped = $(e.currentTarget).hasClass("skip");
var jsonForm = $('#choretracking-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("choretracking-form");
Grocy.Api.Get('chores/' + jsonForm.chore_id,
function(choreDetails)
{
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(), 'skipped': skipped },
function(result)
{
Grocy.EditObjectId = result.id;
@@ -58,6 +60,7 @@ $('#chore_id').on('change', function(e)
Grocy.Api.Get('objects/chores/' + choreId,
function(chore)
{
if (chore.track_date_only == 1)
{
Grocy.Components.DateTimePicker.ChangeFormat("YYYY-MM-DD");
@@ -68,6 +71,17 @@ $('#chore_id').on('change', function(e)
Grocy.Components.DateTimePicker.ChangeFormat("YYYY-MM-DD HH:mm:ss");
Grocy.Components.DateTimePicker.SetValue(moment().format("YYYY-MM-DD HH:mm:ss"));
}
if (chore.period_type == "manually")
{
$(".save-choretracking-button.skip").addClass("keep-disabled");
}
else
{
$(".save-choretracking-button.skip").removeClass("keep-disabled");
}
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
},
function(xhr)
{
@@ -114,7 +128,7 @@ $('#choretracking-form input').keydown(function(event)
}
else
{
$('#save-choretracking-button').click();
$('.save-choretracking-button').first().click();
}
}
});

View File

@@ -20,8 +20,6 @@ Grocy.Components.DateTimePicker.SetValue = function(value, inputElement = Grocy.
$("#datetimepicker-shortcut").click();
}
inputElement.val(value);
inputElement.trigger('change');
inputElement.keyup();
}

View File

@@ -20,8 +20,6 @@ Grocy.Components.DateTimePicker2.SetValue = function(value, inputElement = Grocy
$("#datetimepicker2-shortcut").click();
}
inputElement.val(value);
inputElement.trigger('change');
inputElement.keyup();
}

View File

@@ -19,11 +19,18 @@ $(".calendar").each(function()
var isPrimarySection = BoolVal(container.attr("data-primary-section"));
var isLastSection = BoolVal(container.attr("data-last-section"));
var rightButtonList = "agendaWeek,agendaDay,prev,today,next";
if ($(window).width() < 768)
{
var rightButtonList = "prev,today,next";
}
var headerConfig = {
"left": "title",
"center": "",
"right": "prev,today,next"
"right": rightButtonList
};
if (!isPrimarySection)
{
headerConfig = {
@@ -39,7 +46,7 @@ $(".calendar").each(function()
"weekNumbers": false,
"eventLimit": false,
"eventSources": fullcalendarEventSources,
"defaultView": ($(window).width() < 768) ? "agendaDay" : "agendaWeek",
"defaultView": ($(window).width() < 768 || GetUriParam("days") == "0") ? "agendaDay" : "agendaWeek",
"allDayText": sectionName,
"allDayHtml": sectionName,
"minTime": "00:00:00",
@@ -310,6 +317,15 @@ $(".calendar").each(function()
{
UpdateUriParam("start", view.start.format("YYYY-MM-DD"));
if (view.name == "agendaDay")
{
UpdateUriParam("days", "0");
}
else
{
RemoveUriParam("days");
}
if (firstRender)
{
firstRender = false