-
Notifications
You must be signed in to change notification settings - Fork 0
/
task-info.php
231 lines (189 loc) · 8.14 KB
/
task-info.php
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<?php
require 'authentication.php'; // admin authentication check
// auth check
$user_id = $_SESSION['admin_id'];
$user_name = $_SESSION['name'];
$security_key = $_SESSION['security_key'];
if ($user_id == NULL || $security_key == NULL) {
header('Location: index.php');
}
// check admin
$user_role = $_SESSION['user_role'];
if(isset($_GET['delete_task'])){
$action_id = $_GET['task_id'];
$sql = "DELETE FROM task_info WHERE task_id = :id";
$sent_po = "task-info.php";
$obj_admin->delete_data_by_this_method($sql,$action_id,$sent_po);
}
if(isset($_POST['add_task_post'])){
$obj_admin->add_new_task($_POST);
}
$page_name="Task_Info";
include("include/sidebar.php");
// include('ems_header.php');
?>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog add-category-modal">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h2 class="modal-title text-center">Assign New Task</h2>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<form role="form" action="" method="post" autocomplete="off">
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-5">Task Title</label>
<div class="col-sm-7">
<input type="text" placeholder="Task Title" id="task_title" name="task_title" list="expense" class="form-control" id="default" required>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-5">Task Description</label>
<div class="col-sm-7">
<textarea name="task_description" id="task_description" placeholder="Text Deskcription" class="form-control" rows="5" cols="5"></textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-5">Start Time</label>
<div class="col-sm-7">
<input type="text" name="t_start_time" id="t_start_time" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-5">End Time</label>
<div class="col-sm-7">
<input type="text" name="t_end_time" id="t_end_time" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-5">Assign To</label>
<div class="col-sm-7">
<?php
$sql = "SELECT user_id, fullname FROM tbl_admin WHERE user_role = 2";
$info = $obj_admin->manage_all_info($sql);
?>
<select class="form-control" name="assign_to" id="aassign_to" required>
<option value="">Select Employee...</option>
<?php while($row = $info->fetch(PDO::FETCH_ASSOC)){ ?>
<option value="<?php echo $row['user_id']; ?>"><?php echo $row['fullname']; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group">
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-3">
<button type="submit" name="add_task_post" class="btn btn-success-custom">Assign Task</button>
</div>
<div class="col-sm-3">
<button type="submit" class="btn btn-danger-custom" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="well well-custom">
<div class="gap"></div>
<div class="row">
<div class="col-md-8">
<div class="btn-group">
<?php if($user_role == 1){ ?>
<div class="btn-group">
<button class="btn btn-warning btn-menu" data-toggle="modal" data-target="#myModal">Assign New Task</button>
</div>
<?php } ?>
</div>
</div>
</div>
<center ><h3>Task Management Section</h3></center>
<div class="gap"></div>
<div class="gap"></div>
<div class="table-responsive">
<table class="table table-codensed table-custom">
<thead>
<tr>
<th>#</th>
<th>Task Title</th>
<th>Assigned To</th>
<th>Start Time</th>
<th>End Time</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
if($user_role == 1){
$sql = "SELECT a.*, b.fullname
FROM task_info a
INNER JOIN tbl_admin b ON(a.t_user_id = b.user_id)
ORDER BY a.task_id DESC";
}else{
$sql = "SELECT a.*, b.fullname
FROM task_info a
INNER JOIN tbl_admin b ON(a.t_user_id = b.user_id)
WHERE a.t_user_id = $user_id
ORDER BY a.task_id DESC";
}
$info = $obj_admin->manage_all_info($sql);
$serial = 1;
$num_row = $info->rowCount();
if($num_row==0){
echo '<tr><td colspan="7">No Data found</td></tr>';
}
while( $row = $info->fetch(PDO::FETCH_ASSOC) ){
?>
<tr>
<td><?php echo $serial; $serial++; ?></td>
<td><?php echo $row['t_title']; ?></td>
<td><?php echo $row['fullname']; ?></td>
<td><?php echo $row['t_start_time']; ?></td>
<td><?php echo $row['t_end_time']; ?></td>
<td>
<?php if($row['status'] == 1){
echo "In Progress <span style='color:#d4ab3a;' class=' glyphicon glyphicon-refresh' >";
}elseif($row['status'] == 2){
echo "Completed <span style='color:#00af16;' class=' glyphicon glyphicon-ok' >";
}else{
echo "Incomplete <span style='color:#d00909;' class=' glyphicon glyphicon-remove' >";
} ?>
</td>
<td><a title="Update Task" href="edit-task.php?task_id=<?php echo $row['task_id'];?>"><span class="glyphicon glyphicon-edit"></span></a>
<a title="View" href="task-details.php?task_id=<?php echo $row['task_id']; ?>"><span class="glyphicon glyphicon-folder-open"></span></a>
<?php if($user_role == 1){ ?>
<a title="Delete" href="?delete_task=delete_task&task_id=<?php echo $row['task_id']; ?>" onclick=" return check_delete();"><span class="glyphicon glyphicon-trash"></span></a></td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php
include("include/footer.php");
?>
<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
<script type="text/javascript">
flatpickr('#t_start_time', {
enableTime: true
});
flatpickr('#t_end_time', {
enableTime: true
});
</script>