diff --git a/SE_API/TaskRoutes.py b/SE_API/TaskRoutes.py index 9b0e36a..d6b4301 100644 --- a/SE_API/TaskRoutes.py +++ b/SE_API/TaskRoutes.py @@ -403,7 +403,7 @@ def getAllFutureTasks(token):
""" - user = get_user_by_token + user = get_user_by_token(token) if user is None: return bad_request("Bad User Token") diff --git a/templates/js/controllers/homeController.js b/templates/js/controllers/homeController.js index 813f067..d269bdd 100644 --- a/templates/js/controllers/homeController.js +++ b/templates/js/controllers/homeController.js @@ -8,6 +8,7 @@ angular.module('SeHub') $scope.oldText = ""; $scope.messages = []; $scope.userMessages = []; + $scope.userTasks = []; $scope.messagesDisplay = []; $scope.courses = []; $scope.campuses = []; @@ -32,7 +33,7 @@ angular.module('SeHub') { apiService.getAllUserMessages(token).success(function(data) { - console.log(data); + // console.log(data); $scope.userMessages = data; }).error(function(err) { @@ -40,7 +41,7 @@ angular.module('SeHub') }); } - $scope.displayMessages(); // + // $scope.displayMessages(); // $scope.addMessageClicked = function() { @@ -64,10 +65,10 @@ angular.module('SeHub') }).error(function(err) { console.log("Error Below"); - console.log(err); + console.log(err.message); }); - $scope.messages.push({"text": $scope.msg.msgToAdd}); + $scope.userMessages.push({"text": $scope.msg.msgToAdd}); $location.path('/home/'); } else @@ -78,25 +79,54 @@ angular.module('SeHub') $scope.msg.msgToAdd = null; } + $scope.gotoTask = function(task) + { + console.log(task); + if(task.isPersonal) + { + $location.path('/tasks/fill/' + task.id + '/' + $scope.user.id); + } + else // it's a project task + { + apiService.getProjectsByCourse(token, task.courseId).success(function(data) + { + console.log($scope.user); + for(var i = 0; i < $scope.user.projects_id_list.length; i++) + for(var j = 0; j < data.length; j++) + { + if($scope.user.projects_id_list[i] === data[j]) + { + $location.path('/tasks/fill/' + task.id + '/' + data[j].id); + } + } + }).error(function(err) + { + console.log(err.message); + }); + } + } + $scope.displayTasks = function() { - apiService.getAllUserTasks(token).success(function(data) // Get all Tasks // TODO change to closest TASK + apiService.getAllFutureTasks(token).success(function(data) // Get all Tasks // TODO change to closest TASK { - $scope.tasks = data; + $scope.userTasks = data; console.log(data); }).error(function(err) { - + console.log(err.message); }); + } - // apiService.getAllFutureTasks(token, courseId).success(function(data) // need to check courseId - // { - // console.log("YE"); - // }).error(function(err) - // { - // console.log("Error: " + err.message); - // }); - + $scope.getProjects = function(courseId) + { + apiService.getProjectsByCourse(token, courseId).success(function(data) + { + return data; + }).error(function(err) + { + console.log(err.message); + }); } $scope.getCampuses = function() @@ -105,13 +135,13 @@ angular.module('SeHub') { $scope.campuses = data; $scope.getCourses(); // Get all the courses info - if($scope.messages) + if($scope.userMessages) { //$scope.displayMessages(); // // Display all messages in message feed and the latest one } }).error(function(err) { - console.log("Error: " + err.message); + console.log(err.message); }); } @@ -157,25 +187,6 @@ angular.module('SeHub') console.log($scope.courseObj); } - // $scope.chooseCourseClicked = function() - // { - // console.log("Click "); - // console.log($scope.choosenCourse); - // if($scope.choosenCourse) - // { - // console.log("here"); - // $scope.courseObj = null; - // for(var i = 0; i < $scope.courses.length; i++) - // { - // if($scope.courses[i].courseName === $scope.choosenCourse) - // { - // $scope.courseObj = $scope.courses[i]; - // console.log($scope.courseObj); - // } - // } - // } - // } - $scope.chooseProjectClicked = function() { console.log("choose project Clicked!!"); @@ -184,8 +195,13 @@ angular.module('SeHub') $scope.getCampuses(); // Get all the campuses info // animation + if($scope.userMessages) + { + $scope.displayMessages(); // // Display all messages in message feed and the latest one + } // $scope.displayMessages(); $scope.displayTasks(); // Display all tasks in task feed and the latest one + // $scope.getProjects(); // Get all projects info $scope.isEnterd = top.setIsEnterd; }]); \ No newline at end of file diff --git a/templates/js/controllers/mainController.js b/templates/js/controllers/mainController.js index b5e5632..04aae91 100644 --- a/templates/js/controllers/mainController.js +++ b/templates/js/controllers/mainController.js @@ -52,7 +52,6 @@ angular.module('SeHub') }]; dataService.initService($scope); //Start Data Sync Service (For User) - console.log(data); if ($scope.user.isFirstLogin) { $scope.menuObj = {}; $scope.isInRegisterMode = true; diff --git a/templates/js/controllers/tasksController.js b/templates/js/controllers/tasksController.js index cd4c459..1642c3b 100644 --- a/templates/js/controllers/tasksController.js +++ b/templates/js/controllers/tasksController.js @@ -1,14 +1,32 @@ angular.module('SeHub') .controller('tasksController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope) { - console.log("in controller"); + $scope.lecturerTasks = []; + $rootScope.seToken = $cookies['com.sehub.www']; + var token = $rootScope.seToken; $scope.createTaskClicked = function() { $location.path("/tasks/new"); // Reference to 'newTask' page } + $scope.displayTasks = function() + { + apiService.getAllFutureTasks(token).success(function(data) // Get all Tasks // TODO change to closest TASK + { + $scope.lecturerTasks = data; + console.log(data); + }).error(function(err) + { + console.log(err.message); + }); + } + $scope.gotoTask = function(taskId) + { + $location.path('/tasks/fill/' + taskId); + } + $scope.displayTasks(); // Calling tasks with task id }]); \ No newline at end of file diff --git a/templates/js/services/apiService.js b/templates/js/services/apiService.js index 706e85a..329d3ce 100644 --- a/templates/js/services/apiService.js +++ b/templates/js/services/apiService.js @@ -197,8 +197,8 @@ service.factory('apiService', ['$http', function($http) { }; return $http(req); }, - getAllFutureTasks: function(token, courseId){ - var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getAllFutureCampusTasks/" + token + "/" + courseId; + getAllFutureTasks: function(token){ + var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/getAllFutureTasks/" + token; req = { method: "GET", url: url diff --git a/templates/views/home.html b/templates/views/home.html index 316c0c4..2d924c4 100644 --- a/templates/views/home.html +++ b/templates/views/home.html @@ -25,123 +25,64 @@

Dash Board

- -
-
- Closest Task- - -
- In Course: {{tasks[0].courseName}} -
-
-
-
- Latest Message- - - {{userMessages[0].message}} - -
-
- - - -
-
+
- +
-
- -
-
-
- {{msg.user.username}} + +
+
-
- {{msg.group.courseName}} -

- {{msg.group.projectName}} + + +
+
+ {{msg.user.username}} +
+
+ {{msg.group.courseName}} + {{msg.group.projectName}} +
-
-
- {{msg.message}} -
+ + +
+ {{msg.message}} +
+
- - - - + - - + - + -

Tasks

-
- -
+ +
+ Title: + + {{task.title}} + +

+ Description: {{task.description}} +
+
- +
@@ -171,75 +112,104 @@
-
- -
-
- -

Messages

-
-
-
- -

Tasks

-
-
+
+
+ Closest Task- + +
+ + {{userTasks[0].title}} + +
+
-
-
- -
- -
-
-
- -
-
-
-
- {{user.name}} +
+ Latest Message- + + {{userMessages[0].message}} + +
+
+ + +
+ + + + + +
+
+
-
- class_name +
+
+ {{msg.user.username}} +
+
+ {{msg.group.courseName}} + {{msg.group.projectName}} +
+
+
+ {{msg.message}}
+ + + + + + + + +
+ Title: + + {{task.title}} + +

+ Description: {{task.description}}
-
-
-
- {{msg.text}} -
-
-
-
-
- + + + + +
-
- -

- For Task 3 Press: Task #3 -

- For Task 4 Press: Task #4 -

- For Task 5 Press: Task #5 -

- For Task 6 Press: Task #6 -

- For Task 7 Press: Task #7 -

- For Task 8 Press: Task #8 -

-
+ +
+
+ +
+
+
+
+ Post + Clear All +
+
+
+
+ + + + +
+
+ + {{c.courseName}} +
- - - - +
\ No newline at end of file diff --git a/templates/views/tasks.html b/templates/views/tasks.html index 2279260..a405511 100644 --- a/templates/views/tasks.html +++ b/templates/views/tasks.html @@ -24,8 +24,13 @@ -

Not Submitted

-

Not Submitted ..

+ + + {{task.title}} + + + +