mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
Fixed all (or most of) the broken stuff after the dependency upgrade party
This commit is contained in:
@@ -7,18 +7,18 @@
|
||||
Grocy.Api.Get('habits/get-habit-details/' + jsonForm.habit_id,
|
||||
function (habitDetails)
|
||||
{
|
||||
Grocy.Api.Get('habits/track-habit-execution/' + jsonForm.habit_id + '?tracked_time=' + $('#tracked_time').val(),
|
||||
Grocy.Api.Get('habits/track-habit-execution/' + jsonForm.habit_id + '?tracked_time=' + $('#tracked_time').find('input').val(),
|
||||
function(result)
|
||||
{
|
||||
toastr.success(L('Tracked execution of habit #1 on #2', habitDetails.habit.name, $('#tracked_time').val()));
|
||||
toastr.success(L('Tracked execution of habit #1 on #2', habitDetails.habit.name, $('#tracked_time').find('input').val()));
|
||||
|
||||
$('#habit_id').val('');
|
||||
$('#habit_id_text_input').focus();
|
||||
$('#habit_id_text_input').val('');
|
||||
$('#tracked_time').val(moment().format('YYYY-MM-DD HH:mm:ss'));
|
||||
$('#tracked_time').trigger('change');
|
||||
$('#tracked_time').find('input').val(moment().format('YYYY-MM-DD HH:mm:ss'));
|
||||
$('#tracked_time').find('input').trigger('change');
|
||||
$('#habit_id_text_input').trigger('change');
|
||||
$('#habittracking-form').validator('validate');
|
||||
Grocy.FrontendHelpers.ValidateForm('habittracking-form');
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
@@ -40,18 +40,7 @@ $('#habit_id').on('change', function(e)
|
||||
if (habitId)
|
||||
{
|
||||
Grocy.Components.HabitCard.Refresh(habitId);
|
||||
$('#tracked_time').focus();
|
||||
}
|
||||
});
|
||||
|
||||
$('#tracked_time').val(moment().format('YYYY-MM-DD HH:mm:ss'));
|
||||
$('#tracked_time').trigger('change');
|
||||
|
||||
$('#tracked_time').on('focus', function(e)
|
||||
{
|
||||
if ($('#habit_id_text_input').val().length === 0)
|
||||
{
|
||||
$('#habit_id_text_input').focus();
|
||||
$('#tracked_time').find('input').focus();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -63,23 +52,30 @@ $('#habit_id').val('');
|
||||
$('#habit_id_text_input').focus();
|
||||
$('#habit_id_text_input').val('');
|
||||
$('#habit_id_text_input').trigger('change');
|
||||
Grocy.FrontendHelpers.ValidateForm('habittracking-form');
|
||||
|
||||
$('#habittracking-form').validator();
|
||||
$('#habittracking-form').validator('validate');
|
||||
$('#habittracking-form input').keyup(function (event)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('habittracking-form');
|
||||
});
|
||||
|
||||
$('#habittracking-form input').keydown(function(event)
|
||||
{
|
||||
if (event.keyCode === 13) //Enter
|
||||
{
|
||||
if ($('#habittracking-form').validator('validate').has('.has-error').length !== 0) //There is at least one validation error
|
||||
if (document.getElementById('habittracking-form').checkValidity() === false) //There is at least one validation error
|
||||
{
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#save-habittracking-button').click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#tracked_time').on('keypress', function(e)
|
||||
$('#tracked_time').find('input').on('keypress', function(e)
|
||||
{
|
||||
$('#habittracking-form').validator('validate');
|
||||
Grocy.FrontendHelpers.ValidateForm('habittracking-form');
|
||||
});
|
||||
|
Reference in New Issue
Block a user