1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Working on time tracker

This commit is contained in:
Hillel Coren 2017-09-25 16:30:11 +03:00
parent f1bdeb5cb2
commit 6640978b3c
3 changed files with 3 additions and 11 deletions

View File

@ -243,6 +243,7 @@ class TaskController extends BaseController
}
if (request()->wantsJson()) {
$task->time_log = json_decode($task->time_log);
return $task->load(['client.contacts', 'project'])->toJson();
} else {
return Redirect::to("tasks/{$task->public_id}/edit");

View File

@ -156,14 +156,6 @@ class TaskRepository extends BaseRepository
$task->is_running = $data['is_running'] ? 1 : 0;
}
/*
if ($count = count($timeLog)) {
$lastTime = $timeLog[$count - 1];
$task->is_running = count($lastTime) == 2 && intval($lastTime[1]);
\Log::info('is running: ' . $task->is_running);
}
*/
$task->time_log = json_encode($timeLog);
$task->save();

View File

@ -434,7 +434,6 @@
json: 'application/json'
},
success: function(response) {
console.log(response);
if (isSelected) {
var clientId = $('input[name=client_id]').val();
if (clientId == -1 && response.client) {
@ -463,6 +462,7 @@
toastr.success("{{ trans('texts.updated_task') }}");
}
} else {
self.update(response);
if (self.isRunning()) {
if (self.time_log().length == 1) {
toastr.success("{{ trans('texts.started_task') }}");
@ -485,8 +485,7 @@
self.update = function(data) {
self.data = data;
var times = JSON.parse(data.time_log);
data.time_log = false;
var times = data.time_log instanceof Array ? data.time_log : JSON.parse(data.time_log);
ko.mapping.fromJS(data, self.mapping, this);
self.time_log.removeAll();
for (var i=0; i<times.length; i++) {