mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Workaround for datepicker problem (fixes #100)
This commit is contained in:
parent
364f6b2051
commit
89553b7fa0
@ -24,6 +24,23 @@ Grocy.Components.DateTimePicker.SetValue = function(value)
|
||||
}
|
||||
}
|
||||
|
||||
Grocy.Components.DateTimePicker.Clear = function()
|
||||
{
|
||||
$(".datetimepicker").datetimepicker("destroy");
|
||||
Grocy.Components.DateTimePicker.Init();
|
||||
|
||||
Grocy.Components.DateTimePicker.GetInputElement().val("");
|
||||
|
||||
// "Click" the shortcut checkbox when the desired value is
|
||||
// not the shortcut value and it is currently set
|
||||
value = "";
|
||||
var shortcutValue = $("#datetimepicker-shortcut").data("datetimepicker-shortcut-value");
|
||||
if (value != shortcutValue && $("#datetimepicker-shortcut").is(":checked"))
|
||||
{
|
||||
$("#datetimepicker-shortcut").click();
|
||||
}
|
||||
}
|
||||
|
||||
var startDate = null;
|
||||
if (Grocy.Components.DateTimePicker.GetInputElement().data('init-with-now') === true)
|
||||
{
|
||||
@ -40,6 +57,8 @@ if (Grocy.Components.DateTimePicker.GetInputElement().data('limit-end-to-now') =
|
||||
limitDate = moment();
|
||||
}
|
||||
|
||||
Grocy.Components.DateTimePicker.Init = function()
|
||||
{
|
||||
$('.datetimepicker').datetimepicker(
|
||||
{
|
||||
format: Grocy.Components.DateTimePicker.GetInputElement().data('format'),
|
||||
@ -80,6 +99,8 @@ $('.datetimepicker').datetimepicker(
|
||||
'delete': function(widget) { }
|
||||
}
|
||||
});
|
||||
}
|
||||
Grocy.Components.DateTimePicker.Init();
|
||||
|
||||
Grocy.Components.DateTimePicker.GetInputElement().on('keyup', function(e)
|
||||
{
|
||||
|
@ -42,7 +42,7 @@
|
||||
{
|
||||
$('#inventory-change-info').addClass('d-none');
|
||||
$('#new_amount').val('');
|
||||
Grocy.Components.DateTimePicker.SetValue('');
|
||||
Grocy.Components.DateTimePicker.Clear();
|
||||
Grocy.Components.ProductPicker.SetValue('');
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
||||
|
@ -50,7 +50,7 @@
|
||||
{
|
||||
$('#amount').val(0);
|
||||
$('#price').val('');
|
||||
Grocy.Components.DateTimePicker.SetValue('');
|
||||
Grocy.Components.DateTimePicker.Clear();
|
||||
Grocy.Components.ProductPicker.SetValue('');
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||
|
Loading…
x
Reference in New Issue
Block a user