diff --git a/app/Http/Controllers/TaskController.php b/app/Http/Controllers/TaskController.php index 9c362262f6..d07d4dd663 100644 --- a/app/Http/Controllers/TaskController.php +++ b/app/Http/Controllers/TaskController.php @@ -243,7 +243,7 @@ class TaskController extends BaseController } if (request()->wantsJson()) { - return $task->toJson(); + return $task->load(['client.contacts', 'project'])->toJson(); } else { return Redirect::to("tasks/{$task->public_id}/edit"); } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index d7f9c66e3a..375ce237cb 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -655,7 +655,7 @@ $LANG = array( 'created_by_invoice' => 'Created by :invoice', 'primary_user' => 'Primary User', 'help' => 'Help', - 'customize_help' => '
We use pdfmake to define the invoice designs declaratively. The pdfmake playground provide\'s a great way to see the library in action.
+ 'customize_help' => 'We use pdfmake to define the invoice designs declaratively. The pdfmake playground provides a great way to see the library in action.
You can access a child property using dot notation. For example to show the client name you could use $client.name
.
If you need help figuring something out post a question to our support forum with the design you\'re using.
', 'invoice_due_date' => 'Due Date', diff --git a/resources/views/time_tracker.blade.php b/resources/views/time_tracker.blade.php index b89b7c9726..6f23569fec 100644 --- a/resources/views/time_tracker.blade.php +++ b/resources/views/time_tracker.blade.php @@ -233,16 +233,13 @@ }, success: function(response) { console.log(response); - //var task = new TaskModel(response); var task = self.selectedTask(); - //self.selectTask(task); if (task.isNew()) { self.addTask(task); - } else { - //self.removeTask(task.original); - //self.addTask(task); } task.update(response); + self.formChanged(false); + //self.selectTask(task); }, }); } @@ -254,10 +251,7 @@ self.selectedTask(false); $('.search').focus(); } else { - //console.log(task.data.client) - //console.log('before: ' + task.client_id()); task.update(task.data); - //console.log('after: ' + task.client_id()); } self.formChanged(false); }); @@ -399,8 +393,6 @@ } self.removeTask = function(task) { - console.log('remove:'); - console.log(task); self.tasks.remove(task); } @@ -442,20 +434,24 @@ 'client': { update: function(data) { if (! data.data) { + self.client_id(0); return false; - }; - self.client_id(data.data.public_id); - return new ClientModel(data.data); + } else { + self.client_id(data.data.public_id); + return new ClientModel(data.data); + } } }, 'project': { update: function(data) { if (! data.data) { + self.project_id(0); return false; - }; - self.project_id(data.data.public_id); - return data.data ? new ProjectModel(data.data) : null; - } + } else { + self.project_id(data.data.public_id); + return new ProjectModel(data.data); + } + }, }, 'ignore': [ 'time_log',