2015-06-23 16:40:30 +00:00
|
|
|
angular.module('SeHub')
|
|
|
|
.controller('tasksController', ['$scope', '$cookies', '$cookieStore', '$window', '$location', '$mdToast', '$mdDialog', 'apiService', '$rootScope', function ($scope, $cookies, $cookieStore, $window, $location, $mdToast, $mdDialog, apiService ,$rootScope)
|
|
|
|
{
|
2015-08-02 12:39:39 +00:00
|
|
|
$scope.lecturerTasks = [];
|
|
|
|
$rootScope.seToken = $cookies['com.sehub.www'];
|
|
|
|
var token = $rootScope.seToken;
|
2015-06-23 16:40:30 +00:00
|
|
|
|
2015-07-01 04:05:13 +00:00
|
|
|
$scope.createTaskClicked = function()
|
2015-06-23 16:40:30 +00:00
|
|
|
{
|
2015-06-24 10:42:32 +00:00
|
|
|
$location.path("/tasks/new"); // Reference to 'newTask' page
|
2015-06-23 16:40:30 +00:00
|
|
|
}
|
|
|
|
|
2015-08-02 12:39:39 +00:00
|
|
|
$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);
|
|
|
|
}
|
2015-06-23 16:40:30 +00:00
|
|
|
|
2015-08-02 12:39:39 +00:00
|
|
|
$scope.displayTasks(); // Calling tasks with task id
|
2015-06-23 16:40:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
}]);
|