-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtaskview.html
125 lines (113 loc) · 4.15 KB
/
taskview.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html ng-app="myApp">
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="js/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="js/angular.min.js" type="text/javascript"></script>
<link href="css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript">
// $(document).ready(function() {
// console.log( "ready!" );
// var paramValue = document.location.search.split('=')[1];
// if(paramValue){
// alert(paramValue)
// }
// else{
// window.location.href='projects.html'
// }
// });
var app =angular.module('myApp',[]);
app.controller('TaskController',function($scope,$http){
$scope.init =function(){
$scope.selftask=true;
// $locationProvider.html5Mode(true);
// var paramValue = $location.search().projectid;
$scope.paramValue = document.location.search.split('=')[1];
if($scope.paramValue){
if($scope.paramValue=='self'){
$scope.getCompleteTaskDetails();
// $scope.syncProjectTasks($scope.paramValue);
}
else{
$scope.selftask=false;
$scope.getProjctTasks($scope.paramValue);
$scope.syncProjectTasks($scope.paramValue);
}
}
else{
window.location.href='projects.html'
}
}
$scope.getCompleteTaskDetails= function(){
$http({method: 'GET', url:'asana/admin/adminactions.php?action=getworkspacetasks'})
.success(function(data,status){
$scope.taskdata=data;
console.log(data);
}).error(function(data,status){console.log(data)});
}
$scope.getProjctTasks= function(projectid){
$http({method:'GET',url:'asana/admin/adminactions.php?action=getprojecttasks&projectid='+projectid})
.success(function(data,status){
$scope.projecttasks=data;
console.log($scope.projecttasks);
}).error(function(data,status){
});
}
$scope.syncProjectTasks= function(projectid){
$http({method:'GET', url:'asana/admin/adminactions.php?action=syncprojecttasks&projectid='+projectid})
.success(function(data,status){
$scope.getProjctTasks(projectid)
})
}
});
</script>
</head>
<body ng-controller="TaskController" ng-init="init()">
<div ng-if="!selftask">
<h1>{{projecttasks.name}} Tasks</h1>
<h3>Client: {{projecttasks.client.name}}</h3>
<h3>Workspace: {{projecttasks.workspace.name}}</h3>
<table class="table table-bordered table-responsive">
<thead>
<tr>
<th>name</th>
<th>Assigned to</th>
<th>due_date</th>
<th>status</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="task in projecttasks.tasks">
<td>{{task.name}}</td>
<td>{{task.assignee.name}}</td>
<td>{{task.due_date}}</td>
<td ng-if="task.status==1">Completed</td>
<td ng-if="task.status==0">Ongoing</td>
</tr>
</tbody>
</table>
</div>
<div ng-if="selftask">
<table class="table table-bordered table-responsive">
<thead>
<tr>
<th>name</th>
<th>Assigned to</th>
<th>due_date</th>
<th>status</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="task in taskdata">
<td>{{task.name}}</td>
<td>{{task.assignee.name}}</td>
<td>{{task.due_date}}</td>
<td ng-if="task.status==1">Completed</td>
<td ng-if="task.status==0">Ongoing</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>