Submit task

This commit is contained in:
Sagi Dayan 2015-08-02 16:57:46 +03:00
parent cf0114c5ac
commit 8c1f919b99
5 changed files with 41 additions and 8 deletions

View file

@ -127,6 +127,10 @@ body.noscroll
margin-bottom: auto; margin-bottom: auto;
} }
.center_all{
margin:auto;
}
.mail_suffix .mail_suffix
{ {
margin-top: auto; margin-top: auto;

View file

@ -133,7 +133,7 @@ angular.module('SeHub').controller('newTasksController', ['$scope', 'apiService'
$scope.compDetails = [{ $scope.compDetails = [{
detail: "Label" detail: "Label"
}, { }, {
detail: "URL Path" detail: "URL Path (You Need To Include 'http://'"
}]; }];
if (type === 'radiobuttons') if (type === 'radiobuttons')

View file

@ -8,12 +8,14 @@ angular.module('SeHub')
var submitterId = $routeParams.submitterId; var submitterId = $routeParams.submitterId;
var token = $cookies['com.sehub.www']; var token = $cookies['com.sehub.www'];
var groupId = $routeParams.gId; var groupId = $routeParams.gId;
$scope.loading = true;
apiService.getTaskById(token, taskId, groupId).success(function(data) { apiService.getTaskById(token, taskId, groupId).success(function(data) {
$scope.task = data; $scope.task = data;
$scope.dateInit($scope.task.dueDate); $scope.dateInit($scope.task.dueDate);
$scope.loading = false;
}).error(function(err) { }).error(function(err) {
console.error('Error: ', err); $location.path('/tasks');
}) })
if (submitterId) { //In This Case we Only Want to show The Content of the Submitter if (submitterId) { //In This Case we Only Want to show The Content of the Submitter
@ -71,8 +73,23 @@ angular.module('SeHub')
$scope.submitTask = function(event) { //Dialog will pop-up if not all mandatory fields are filled $scope.submitTask = function(event) { //Dialog will pop-up if not all mandatory fields are filled
if (validateComponents()) { if (validateComponents()) {
alert('All Shit Are Filled'); apiService.submitTask(token, taskId, groupId, $scope.task.components).success(function(data) {
return; $mdDialog.show(
$mdDialog.alert()
.title('Submitted!')
.content('Your Task Was Successfully Submitted!')
.ariaLabel('ddd')
.ok('GoTo My Submitted Task')
.then(function(dd){
if($scope.task.isPersonal)
$location.path('/tasks/overview/'+taskId+'/'+groupId+'/'+groupId);
else
$location.path('/tasks/overview/'+taskId+'/'+groupId+'/'+groupId);
})
.targetEvent(event)
);
})
} }
$mdDialog.show( $mdDialog.show(
$mdDialog.alert() $mdDialog.alert()

View file

@ -254,6 +254,15 @@ service.factory('apiService', ['$http', function($http) {
}; };
return $http(req); return $http(req);
},
submitTask: function(token, taskId, ownerId, payload){
var url = (DEBUG ? "http://localhost:8080" : "http://se-hub.appspot.com") + "/api/tasks/submitTask/" + token + '/' + taskId + '/' + ownerId;
req = {
method: 'POST',
data: payload,
url: url
};
return $http(req);
} }
}; };
}]); }]);

View file

@ -1,4 +1,7 @@
<div layout='row'> <div ng-if='loading' class='center_all'>
<md-progress-circular md-mode="indeterminate"></md-progress-circular>
</div>
<div layout='row' ng-if='!loading'>
<div flex='20'></div> <div flex='20'></div>
<div layout="coulumn" flex="60"> <div layout="coulumn" flex="60">
<md-card layout-padding style="width:100%"> <md-card layout-padding style="width:100%">