Working on time tracker

This commit is contained in:
Hillel Coren 2017-09-26 10:12:03 +03:00
parent 89063f4a9c
commit 50fdf31121
4 changed files with 27 additions and 3 deletions

View File

@ -126,6 +126,14 @@ class HomeController extends BaseController
return RESULT_SUCCESS;
}
/**
* @return mixed
*/
public function loggedIn()
{
return RESULT_SUCCESS;
}
/**
* @return mixed
*/

View File

@ -121,6 +121,7 @@ if (Utils::isTravis()) {
}
Route::group(['middleware' => ['lookup:user', 'auth:user']], function () {
Route::get('logged_in', 'HomeController@loggedIn');
Route::get('dashboard', 'DashboardController@index');
Route::get('dashboard_chart_data/{group_by}/{start_date}/{end_date}/{currency_id}/{include_expenses}', 'DashboardController@chartData');
Route::get('set_entity_filter/{entity_type}/{filter?}', 'AccountController@setEntityFilter');

View File

@ -2460,7 +2460,7 @@ $LANG = array(
'started_task' => 'Successfully started task',
'create_client' => 'Create Client',
'download_app' => 'Download the desktop app',
'download_desktop_app' => 'Download the desktop app',
);

View File

@ -318,6 +318,20 @@
projectsForClientMap[client.public_id].push(project);
}
function sendKeepAlive() {
setTimeout(function() {
$.get('{{ URL::to('/keep_alive') }}', function (response) {
if (response == '{{ RESULT_SUCCESS }}') {
sendKeepAlive()
} else {
location.reload();
}
}).fail(function() {
location.reload();
});
}, 1000 * 60 * 15);
}
$(function() {
// setup clients and project comboboxes
@ -436,14 +450,15 @@
window.open('{{ config('ninja.time_tracker') }}', '_blank');
}
};
toastr.info("{{ trans('texts.download_app') }}", false, options);
toastr.info("{{ trans('texts.download_desktop_app') }}", false, options);
}
sendKeepAlive();
$(window).on('beforeunload', function () {
if (navigator.userAgent == 'Time Tracker') {
return undefined;
}
if (model.selectedTask() && model.formChanged()) {
return "{{ trans('texts.save_or_discard') }}";
} else {