-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.php
More file actions
199 lines (148 loc) · 5.77 KB
/
Copy pathtask.php
File metadata and controls
199 lines (148 loc) · 5.77 KB
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<?php
include("includes/header.html");
include("includes/session.php");
include("includes/navbar.html");
include("includes/sidepanel.html");
?>
<main id="main" class="main">
<section class="section">
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<h4 class="card-title">Tasks</h4>
<!-- Table with stripped rows -->
<table id="myTable" class="table">
<thead>
<tr>
<th>Status</th>
<th>
Task name
</th>
<th>Type</th>
<th>Description</th>
<th></th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tbody>
<?php
include("connection/conn.php");
$sql = " SELECT task.taskName, task.description, task.type, assign.status, assign.ass_id FROM users JOIN assign ON users.user_id = assign.user_id JOIN task
ON task.task_id = assign.task_id
WHERE assign.user_id='$user_id'";
$query = mysqli_query($conn, $sql);
while($row = $query->fetch_assoc()){
echo"<tr>";
if($row["status"] == "Pending"){
echo "<td><span class='badge bg-danger'>".$row['status']."</span></td>";
}else{
echo "<td><span class='badge bg-success'>".$row['status']."</span></td>";
}
echo "
<td>".$row['taskName']."</td>
<td>".$row['type']."</td>
<td>".$row['description']."</td>
<td></td>
<td>
<button type='button' class='info btn btn-primary btn-sm btn-flat' data-id='".$row['ass_id']."'>Done</button>
<button type='button' class='del btn btn-danger btn-sm btn-flat' data-id='".$row['ass_id']."'>Remove</button>
</td>
</tr>
";
}
?>
</tbody>
</tbody>
</table>
<!-- End Table with stripped rows -->
</div>
</div>
</div>
</div>
</section>
</main>
<div class="modal fade" id="inquiry">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"><b>Confirmation</b></h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
</button>
</div>
<div class="modal-body">
<form class="form-horizontal" method="POST" action="ass.php">
<input type="hidden" class="id" name="id">
<div class="row">
<div class="col">
Are you sure you are done?
</div>
</div>
<div class="col-sm-9 mt-3">
<button type="submit" class="btn btn-secondary btn-flat" name="read"><i class="fa fa-check-square-o"></i>Yes</button>
</div>
</div>
<div class="modal-footer">
</form>
</div>
</div>
</div>
</div>
<div class="modal fade" id="delete">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"><b>Deleting...</b></h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
</button>
</div>
<div class="modal-body">
<form class="form-horizontal" method="POST" action="ass.php">
<input type="hidden" class="id" name="id">
<div class="text-center">
<p>Remove Assigned Task?</p>
<h2 class="bold fullname"></h2>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-flat pull-left" data-bs-dismiss="modal"><i class="fa fa-close"></i> Close</button>
<button type="submit" class="btn btn-danger btn-flat" name="delete"><i class="fa fa-trash"></i> Delete</button>
</form>
</div>
</div>
</div>
</div>
<script src="admin/js/jquery.js"></script>
<script src="admin/js/alertify.min.js"></script>
<script>
$(function(){
$(document).on('click', '.del', function(e){
e.preventDefault();
$('#delete').modal('show');
var id = $(this).data('id');
getRow(id);
});
$(document).on('click', '.info', function(e){
e.preventDefault();
$('#inquiry').modal('show');
var id = $(this).data('id');
getRow(id);
});
})
function getRow(id){
$.ajax({
type: 'POST',
url: 'ass.php',
data: {id:id},
dataType: 'json',
success: function(response){
$('.id').val(response.ass_id);
$('.status').val(response.status);
}
});
}
</script>
<?php
include("includes/footer.html");
?>