diff --git a/resources/views/tasks/time_tracker.blade.php b/resources/views/tasks/time_tracker.blade.php index ae173996fc..b12a02cade 100644 --- a/resources/views/tasks/time_tracker.blade.php +++ b/resources/views/tasks/time_tracker.blade.php @@ -119,15 +119,13 @@
-
@@ -313,7 +311,6 @@ } var $clientSelect = $('select#client_id'); - //$clientSelect.combobox(); $clientSelect.on('change', function(e) { var clientId = $('input[name=client_id]').val(); var projectId = $('input[name=project_id]').val(); @@ -357,6 +354,18 @@ } }); + $projectSelect.on('change', function(e) { + var projectId = $('input[name=project_id]').val(); + if (window.model && model.selectedTask() && projectId == -1) { + var project = new ProjectModel(); + project.name($('#project_name').val()); + model.selectedTask().project_id(-1); + model.selectedTask().project(project); + } + refreshProjectList(); + }); + + Mousetrap.bind('/', function(e) { event.preventDefault(); $('#search').focus(); diff --git a/resources/views/tasks/time_tracker_knockout.blade.php b/resources/views/tasks/time_tracker_knockout.blade.php index c17d46995b..1c498a0974 100644 --- a/resources/views/tasks/time_tracker_knockout.blade.php +++ b/resources/views/tasks/time_tracker_knockout.blade.php @@ -698,7 +698,7 @@ function ProjectModel(data) { var self = this; self.name = ko.observable(''); - self.public_id = ko.observable(0); + self.public_id = ko.observable(-1); if (data) { ko.mapping.fromJS(data, {}, this); @@ -707,8 +707,8 @@ function ClientModel(data) { var self = this; - self.public_id = ko.observable(-1); self.name = ko.observable(''); + self.public_id = ko.observable(-1); self.contacts = ko.observableArray(); self.mapping = {