mirror of
https://github.com/grocy/grocy.git
synced 2025-08-19 20:11:16 +00:00
Implemented daily/weekly/monthly recurrence patterns for chores (closes #151)
This commit is contained in:
@@ -57,6 +57,15 @@ $('#chore-form input').keydown(function(event)
|
||||
}
|
||||
});
|
||||
|
||||
var checkboxValues = $("#period_config").val().split(",");
|
||||
for (var i = 0; i < checkboxValues.length; i++)
|
||||
{
|
||||
if (!checkboxValues[i].isEmpty())
|
||||
{
|
||||
$("#" + checkboxValues[i]).prop('checked', true);
|
||||
}
|
||||
}
|
||||
|
||||
$('#name').focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('chore-form');
|
||||
|
||||
@@ -70,13 +79,36 @@ $('.input-group-chore-period-type').on('change', function(e)
|
||||
var periodType = $('#period_type').val();
|
||||
var periodDays = $('#period_days').val();
|
||||
|
||||
if (periodType === 'dynamic-regular')
|
||||
$(".period-type-input").addClass("d-none");
|
||||
$(".period-type-" + periodType).removeClass("d-none");
|
||||
$('#chore-period-type-info').text("");
|
||||
$("#period_config").val("");
|
||||
|
||||
if (periodType === 'manually')
|
||||
{
|
||||
$('#chore-period-type-info').text(L('This means it is estimated that a new execution of this chore is tracked #1 days after the last was tracked', periodDays.toString()));
|
||||
$('#chore-period-type-info').removeClass('d-none');
|
||||
//
|
||||
}
|
||||
else
|
||||
else if (periodType === 'dynamic-regular')
|
||||
{
|
||||
$('#chore-period-type-info').addClass('d-none');
|
||||
$("label[for='period_days']").text(L("Period days"));
|
||||
$("#period_days").attr("min", "0");
|
||||
$("#period_days").attr("max", "9999");
|
||||
$("#period_days").parent().find(".invalid-feedback").text(L('This cannot be negative'));
|
||||
$('#chore-period-type-info').text(L('This means it is estimated that a new execution of this chore is tracked #1 days after the last was tracked', periodDays.toString()));
|
||||
}
|
||||
else if (periodType === 'daily')
|
||||
{
|
||||
//
|
||||
}
|
||||
else if (periodType === 'weekly')
|
||||
{
|
||||
$("#period_config").val($(".period-type-weekly input:checkbox:checked").map(function () { return this.value; }).get().join(","));
|
||||
}
|
||||
else if (periodType === 'monthly')
|
||||
{
|
||||
$("label[for='period_days']").text(L("Day of month"));
|
||||
$("#period_days").attr("min", "1");
|
||||
$("#period_days").attr("max", "31");
|
||||
$("#period_days").parent().find(".invalid-feedback").text(L('The amount must be between #1 and #2', "0", "31"));
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user