Add a checkbox to set the "never expires date" (closes #40)

This commit is contained in:
Bernd Bestel
2018-08-06 22:41:35 +02:00
parent 282ee0885b
commit 339d81318f
7 changed files with 47 additions and 7 deletions

View File

@@ -2,7 +2,7 @@ Grocy.Components.DateTimePicker = { };
Grocy.Components.DateTimePicker.GetInputElement = function()
{
return $('.datetimepicker').find('input');
return $('.datetimepicker').find('input').not(".form-check-input");
}
Grocy.Components.DateTimePicker.GetValue = function()
@@ -171,3 +171,20 @@ $('.datetimepicker').on('update.datetimepicker', function(e)
{
Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
});
$("#datetimepicker-shortcut").on("click", function()
{
if (this.checked)
{
var value = $("#datetimepicker-shortcut").data("datetimepicker-shortcut-value");
Grocy.Components.DateTimePicker.SetValue(value);
Grocy.Components.DateTimePicker.GetInputElement().attr("readonly", "");
$(Grocy.Components.DateTimePicker.GetInputElement().data('next-input-selector')).focus();
}
else
{
Grocy.Components.DateTimePicker.SetValue("");
Grocy.Components.DateTimePicker.GetInputElement().removeAttr("readonly");
Grocy.Components.DateTimePicker.GetInputElement().focus();
}
});