From 205094cd4c6533250d63d6cc31153eba4100eabb Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 24 Jan 2018 13:53:35 +0200 Subject: [PATCH] Project Kanban: Added task is hidden #1848 --- app/Http/Controllers/TaskKanbanController.php | 2 +- resources/views/tasks/kanban.blade.php | 26 +++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/TaskKanbanController.php b/app/Http/Controllers/TaskKanbanController.php index 0de8d0e98b..ed24ba7073 100644 --- a/app/Http/Controllers/TaskKanbanController.php +++ b/app/Http/Controllers/TaskKanbanController.php @@ -26,7 +26,7 @@ class TaskKanbanController extends BaseController ->orderBy('id') ->get(); - $projects = Project::scope()->get(); + $projects = Project::scope()->with('client')->get(); $clients = Client::scope()->with(['contacts'])->get(); // check initial statuses exist diff --git a/resources/views/tasks/kanban.blade.php b/resources/views/tasks/kanban.blade.php index 51633f2bdc..359402933c 100644 --- a/resources/views/tasks/kanban.blade.php +++ b/resources/views/tasks/kanban.blade.php @@ -402,6 +402,16 @@ description: description, task_status_sort_order: self.tasks().length, }) + + if (model.filter_client_id()) { + task.client(clientMap[model.filter_client_id()]); + } else if (model.filter_project_id()) { + var project = projectMap[model.filter_project_id()]; + task.project(project); + var client = clientMap[project.client.public_id()] + task.client(client); + } + task.task_status_id(self.public_id()) var url = '{{ url('/tasks') }}'; @@ -457,9 +467,19 @@ } self.toData = function() { - return 'description=' + encodeURIComponent(self.description()) + + var data = 'description=' + encodeURIComponent(self.description()) + '&task_status_id=' + self.task_status_id() + '&task_status_sort_order=' + self.task_status_sort_order(); + + if (! self.public_id() && self.client()) { + data += '&client_id=' + self.client().public_id(); + } + + if (! self.public_id() && self.project()) { + data += '&project_id=' + self.project().public_id(); + } + + return data; } self.matchesFilter = function(filter, clientId, projectId) { @@ -537,6 +557,8 @@ self.reset = function() { self.is_editing_task(false); self.is_blank(true); + self.client(false); + self.project(false); self.description(''); } @@ -681,7 +703,7 @@