mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +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;
|
var startDate = null;
|
||||||
if (Grocy.Components.DateTimePicker.GetInputElement().data('init-with-now') === true)
|
if (Grocy.Components.DateTimePicker.GetInputElement().data('init-with-now') === true)
|
||||||
{
|
{
|
||||||
@ -40,46 +57,50 @@ if (Grocy.Components.DateTimePicker.GetInputElement().data('limit-end-to-now') =
|
|||||||
limitDate = moment();
|
limitDate = moment();
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.datetimepicker').datetimepicker(
|
Grocy.Components.DateTimePicker.Init = function()
|
||||||
{
|
{
|
||||||
format: Grocy.Components.DateTimePicker.GetInputElement().data('format'),
|
$('.datetimepicker').datetimepicker(
|
||||||
buttons: {
|
{
|
||||||
showToday: true,
|
format: Grocy.Components.DateTimePicker.GetInputElement().data('format'),
|
||||||
showClose: true
|
buttons: {
|
||||||
},
|
showToday: true,
|
||||||
calendarWeeks: true,
|
showClose: true
|
||||||
maxDate: limitDate,
|
},
|
||||||
locale: moment.locale(),
|
calendarWeeks: true,
|
||||||
defaultDate: startDate,
|
maxDate: limitDate,
|
||||||
useCurrent: false,
|
locale: moment.locale(),
|
||||||
icons: {
|
defaultDate: startDate,
|
||||||
time: 'far fa-clock',
|
useCurrent: false,
|
||||||
date: 'far fa-calendar',
|
icons: {
|
||||||
up: 'fas fa-arrow-up',
|
time: 'far fa-clock',
|
||||||
down: 'fas fa-arrow-down',
|
date: 'far fa-calendar',
|
||||||
previous: 'fas fa-chevron-left',
|
up: 'fas fa-arrow-up',
|
||||||
next: 'fas fa-chevron-right',
|
down: 'fas fa-arrow-down',
|
||||||
today: 'fas fa-calendar-check',
|
previous: 'fas fa-chevron-left',
|
||||||
clear: 'far fa-trash-alt',
|
next: 'fas fa-chevron-right',
|
||||||
close: 'far fa-times-circle'
|
today: 'fas fa-calendar-check',
|
||||||
},
|
clear: 'far fa-trash-alt',
|
||||||
sideBySide: true,
|
close: 'far fa-times-circle'
|
||||||
keyBinds: {
|
},
|
||||||
up: function(widget) { },
|
sideBySide: true,
|
||||||
down: function(widget) { },
|
keyBinds: {
|
||||||
'control up': function(widget) { },
|
up: function(widget) { },
|
||||||
'control down': function(widget) { },
|
down: function(widget) { },
|
||||||
left: function(widget) { },
|
'control up': function(widget) { },
|
||||||
right: function(widget) { },
|
'control down': function(widget) { },
|
||||||
pageUp: function(widget) { },
|
left: function(widget) { },
|
||||||
pageDown: function(widget) { },
|
right: function(widget) { },
|
||||||
enter: function(widget) { },
|
pageUp: function(widget) { },
|
||||||
escape: function(widget) { },
|
pageDown: function(widget) { },
|
||||||
'control space': function(widget) { },
|
enter: function(widget) { },
|
||||||
t: function(widget) { },
|
escape: function(widget) { },
|
||||||
'delete': function(widget) { }
|
'control space': function(widget) { },
|
||||||
}
|
t: function(widget) { },
|
||||||
});
|
'delete': function(widget) { }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Grocy.Components.DateTimePicker.Init();
|
||||||
|
|
||||||
Grocy.Components.DateTimePicker.GetInputElement().on('keyup', function(e)
|
Grocy.Components.DateTimePicker.GetInputElement().on('keyup', function(e)
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
{
|
{
|
||||||
$('#inventory-change-info').addClass('d-none');
|
$('#inventory-change-info').addClass('d-none');
|
||||||
$('#new_amount').val('');
|
$('#new_amount').val('');
|
||||||
Grocy.Components.DateTimePicker.SetValue('');
|
Grocy.Components.DateTimePicker.Clear();
|
||||||
Grocy.Components.ProductPicker.SetValue('');
|
Grocy.Components.ProductPicker.SetValue('');
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
{
|
{
|
||||||
$('#amount').val(0);
|
$('#amount').val(0);
|
||||||
$('#price').val('');
|
$('#price').val('');
|
||||||
Grocy.Components.DateTimePicker.SetValue('');
|
Grocy.Components.DateTimePicker.Clear();
|
||||||
Grocy.Components.ProductPicker.SetValue('');
|
Grocy.Components.ProductPicker.SetValue('');
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user