mirror of
https://github.com/grocy/grocy.git
synced 2025-08-17 03:04:36 +00:00
Add a checkbox to set the "never expires date" (closes #40)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user