-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.php
More file actions
351 lines (308 loc) · 21.6 KB
/
view.php
File metadata and controls
351 lines (308 loc) · 21.6 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
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
<?php
$sqlconnect = mysqli_connect('localhost', 'root', '');
if (!$sqlconnect){
die("Failed to connect to the database: ");
}
$selectDB = mysqli_select_db($sqlconnect, 'APSMS');
if (!$selectDB){
die("Failed to connect to the database: ");
}
?>
<html>
<head>
<meta charset = "UTF-8">
<meta http-equiv = "X-UA-Compatible" content = "IE=edge">
<meta name = "viewport" content = "width = device - width, initialize-scale = 1.0">
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.7/dist/umd/popper.min.js" integrity="sha384-zYPOMqeu1DAVkHiLqWBUTcbYfZ8osu1Nd6Z89ify25QV9guujx43ITvfi12/QExE" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.min.js" integrity="sha384-Y4oOpwW3duJdCWv5ly8SCFYWqFDsfob/3GkgExXKV4idmbt98QcxXYs9UoXAB7BZ" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<style>
.wrapper{
display: inline-block;
width: 150px;
color : #183C1B;
margin : 2px;
border-radius: 5px;
}
.textColor{
display: inline-block;
width: 150px;
color : #183C1B;
margin : 2px;
}
.float-parent-element {
width: 100%;
}
.float-child-element {
float: left;
width: 50%;
}
.box {
display: inline-block;
width: 300px;
border: solid grey;
padding: 5px;
margin: 20px;
}
.error {color: #FF0000;}
</style>
</head>
<body>
<?php include("_navbar.php")?>
<div class="container" >
<h1 style="text-align: center; padding-bottom: 16px;">Document Tracking Status </h1>
</div>
<body>
<div class = "container">
<div class = "float-parent-element">
<table class = "table">
<tbody>
<div class = "float-child-element">
<?php
if (!empty($_GET['id'])) {
$subID = $_GET['id'];
$_SESSION['submID'] = $subID;
} else {
$subID = $_SESSION['submID'];
}
$result_out = mysqli_query($sqlconnect, "SELECT Timestamp, Term, Organization, ARN, ActivityTitle, TypeOfSubmission, ActivityDuration, ForEvaluation, StartingDate, EndingDate, Time, Venue,
NatureOfActivity, TypeOfActivity, SubmissionBy, Position, ContactNumber, Email, File, ProcessingStage, ApprovalStatus from actdetail JOIN actstatus on actdetail.submissionid = actstatus.subid
WHERE SubmissionID = '$subID'");
if (!$result_out){
die("Failed to connect: ");
} else {
$dataVal = mysqli_fetch_array($result_out);
$timeS = $dataVal['Timestamp'];
$term = $dataVal['Term'];
$org = $dataVal['Organization'];
$arn = $dataVal['ARN'];
$actTitle= $dataVal['ActivityTitle'];
$typeSub = $dataVal['TypeOfSubmission'];
$actDur = $dataVal['ActivityDuration'];
$eval = $dataVal['ForEvaluation'];
$startDate = $dataVal['StartingDate'];
$endDate = $dataVal['EndingDate'];
$time = $dataVal['Time'];
$venue = $dataVal['Venue'];
$natureAct = $dataVal['NatureOfActivity'];
$typeAct = $dataVal['TypeOfActivity'];
$subBy = $dataVal['SubmissionBy'];
$pos = $dataVal['Position'];
$num = $dataVal['ContactNumber'];
$email = $dataVal['Email'];
$file = $dataVal['File'];
$processStage = $dataVal['ProcessingStage'];
$approveStatus = $dataVal['ApprovalStatus'];
echo "<div class = 'textColor'>Timestamp: </div>" . " " . $timeS . " " . "<br>";
echo "<div class = 'textColor'>Term: </div>" . " " . $term . " " . "<br>";
echo "<div class = 'textColor'>Organization: </div>" . " " . $org . " " . "<br>";
echo "<div class = 'textColor'>Activity Reference Number: </div>" . " " . $arn . " " . "<br>";
echo "<div class = 'textColor'>Activity Title: </div>" . " " . $actTitle . " " . "<br>";
echo "<div class = 'textColor'>Type of Submission: </div>" . " " . $typeSub . " " . "<br>";
echo "<div class = 'textColor'>Activity Duration: </div>" . " " . $actDur . " " . "<br>";
echo "<div class = 'textColor'>For Evaluation: </div>" . " " . $eval . " " . "<br>";
echo "<div class = 'textColor'>Starting Date: </div>" . " " . $startDate . " " . "<br>";
echo "<div class = 'textColor'>Ending Date: </div>" . " " . $endDate . " " . "<br>";
echo "<div class = 'textColor'>Time: </div>" . " " . $time . " " . "<br>";
echo "<div class = 'textColor'>Venue: </div>" . " " . $venue . " " . "<br>";
echo "<div class = 'textColor'>Nature of Activity: </div>" . " " . $natureAct . " " . "<br>";
echo "<div class = 'textColor'>Type of Activity: </div>" . " " . $typeAct . " " . "<br>";
echo "<div class = 'textColor'>Submission By: </div>" . " " . $subBy . " " . "<br>";
echo "<div class = 'textColor'>Position: </div>" . " " . $pos . " " . "<br>";
echo "<div class = 'textColor'>Contact Number: </div>" . " " . $num . " " . "<br>";
echo "<div class = 'textColor'>Email: </div>" . " " . $email . " " . "<br>";
echo "<div class = 'textColor'>File: </div>" . " " . "<a href = $file target = '_blank'> $file </a> " . "<br>";
if (strtolower($processStage) == strtolower('For First Checking')){
echo "<div class = 'textColor'>Processing Stage: </div>" . " " . "<div class = 'wrapper' style='background-color:#FF0000'>$processStage</div>" . "<br>";
} else if (strtolower($processStage) == strtolower('For Second Checking')) {
echo "<div class = 'textColor'>Processing Stage: </div>" . " " . "<div class = 'wrapper' style='background-color:#FEC20C'>$processStage</div>" . "<br>";
}else if (strtolower($processStage) == strtolower('Checked')) {
echo "<div class = 'textColor'>Processing Stage: </div>" . " " . "<div class = 'wrapper' style='background-color:#03AC13'>$processStage</div>" . "<br>";
}
if (strtolower($approveStatus) == strtolower('Full Incentive')){
echo "<div class = 'textColor'>Approval Status: </div>" . " " . "<div class = 'wrapper' style='background-color:#6f90f4'>$approveStatus</div>" . " " . "<br>";}
elseif (strtolower($approveStatus) == strtolower('Half Incentive')) {
echo "<div class = 'textColor'>Approval Status: </div>" . "<div class = 'wrapper' style='background-color:#6f90f4'>$approveStatus</div>" . " " . "<br>";}
elseif (strtolower($approveStatus) == strtolower('Early Approved')) {
echo "<div class = 'textColor'>Approval Status: </div>" . "<div class = 'wrapper' style='background-color:#d9ead3'>$approveStatus</div>" . " " . "<br>";}
elseif (strtolower($approveStatus) == strtolower('Late Approved')) {
echo "<div class = 'textColor'>Approval Status: </div>" . "<div class = 'wrapper' style='background-color:#fff2cc'>$approveStatus</div>" . " " . "<br>";}
elseif (strtolower($approveStatus) == strtolower('Pending')) {
echo "<div class = 'textColor'>Approval Status: </div>" . "<div class = 'wrapper' style='background-color:#CBC3E3'>$approveStatus</div>" . " " . "<br>";}
elseif (strtolower($approveStatus) == strtolower('Uncounted Pend')) {
echo "<div class = 'textColor'>Approval Status: </div>" . "<div class = 'wrapper' style='background-color:#ff80ff'>$approveStatus</div>" . " " . "<br>";}
elseif (strtolower($approveStatus) == strtolower('No Status')) {
echo "<div class = 'textColor'>Approval Status: </div>" . "<div class = 'wrapper' style='background-color:#D3D3D3'>$approveStatus</div>" . " " . "<br>";}
elseif (strtolower($approveStatus) == strtolower('Denied')) {
echo "<div class = 'textColor'>Approval Status: </div>" . "<div class = 'wrapper' style='background-color:#E3BAC6'>$approveStatus</div>" . " " . "<br>";}
}
echo "<br><a class = 'btn btn-primary' href = 'dts.php'> Return DTS </a> <span style = 'padding-right: 8px'></span>";
$result_out = mysqli_query($sqlconnect, "SELECT PROCESSINGSTAGE, APPROVALSTATUS, ASSOCIATECHECKER, FINALCHECKER, ASSOCIATEREMARKS, FINALREMARKS, POSTACTREQUIREMENTS, POSTACTDEADLINE,
FOREVAL, SUBID FROM ACTSTATUS WHERE SUBID = '$subID'");
if (!$result_out){
die("Failed to connect: ");
} else {
$dataVal = mysqli_fetch_array($result_out);
$processStage = $dataVal['PROCESSINGSTAGE'];
$approveStatus = $dataVal['APPROVALSTATUS'];
$assocCheck = $dataVal['ASSOCIATECHECKER'];
$finalCheck = $dataVal['FINALCHECKER'];
$assocRemark = $dataVal['ASSOCIATEREMARKS'];
$finalRemark = $dataVal['FINALREMARKS'];
$postReq = $dataVal['POSTACTREQUIREMENTS'];
$postD = $dataVal['POSTACTDEADLINE'];
$eval = $dataVal['FOREVAL'];
}
if ($_SESSION['organization'] == 'CSO')
echo "<button
class = 'btn btn-success'
type='button'
data-bs-toggle='modal'
data-bs-target='#checkSubmission'
data-bs-processStage = '$processStage'
data-bs-approveStatus = '$approveStatus'
data-bs-assocCheck = '$assocCheck'
data-bs-finalCheck = '$finalCheck'
data-bs-assocRemark = '$assocRemark'
data-bs-finalRemark = '$finalRemark'
data-bs-postReq = '$postReq'
data-bs-postD = '$postD'
data-bs-eval = '$eval'
> Check Submission</button> ";
if(isset($_POST['save'])) {
$subID = $_SESSION['submID'];
$updaterecords = "UPDATE ACTSTATUS SET PROCESSINGSTAGE = '$_POST[process]', APPROVALSTATUS = '$_POST[approval]', ASSOCIATECHECKER = '$_POST[assocCheck]', FINALCHECKER = '$_POST[finalCheck]',
ASSOCIATEREMARKS = '$_POST[assocRemark]', FINALREMARKS = '$_POST[finalRemark]', POSTACTREQUIREMENTS = '$_POST[postDet]', POSTACTDEADLINE = '$_POST[deadlinePR]', FOREVAL = '$_POST[evalStatus]'
WHERE SUBID = '$subID'";
mysqli_query($sqlconnect, $updaterecords);
echo "<script type='text/javascript'>location.href = 'view.php?id=$subID';</script>";
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
</div>
<div class = "float-child-element">
<?php
echo "<div style='text-align:justify'>";
echo "<div class = 'textColor'>Processing Stage: </div>" . " " . $processStage . " " . "<br>";
echo "<div class = 'textColor'>Approve Status: </div>" . " " . $approveStatus . " " . "<br>";
echo "<div class = 'textColor'>Associate Checker: </div>" . " " . $assocCheck . " " . "<br>";
echo "<div class = 'textColor'>Final Checker: </div>" . " " . $finalCheck . " " . "<br>";
echo "<div class = 'textColor'>Associate Remark: </div>" . " " . "<div class='form-control'>$assocRemark </div>". " " . "<br>";
echo "<div class = 'textColor'>Final Remark: </div>" . " " . "<div class='form-control'>$finalRemark </div>" . " " . "<br>";
echo "<div class = 'textColor'>Post-Activity Requirements: </div>" . " " . "<div class='form-control'>$postReq </div>" . " " . "<br>";
echo "<div class = 'textColor'>Post-Activity Deadline: </div>" . " " . $postD . " " . "<br>";
echo "<div class = 'textColor'>For Evaluation: </div>" . " " . $eval . " " . "<br>";
?>
</div>
</tbody>
</table>
</div>
</div>
<div class="modal fade" id="checkSubmission" tabindex="-1" aria-labelledby="checkSubLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable">
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="createAccountLabel">Check Submission</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<label for = "dropdownProcess" style = "color: #183C1B; width : 150px; border-radius: 10px"> Processing Stage: </label>
<select class="form-select" name="process" id="dropdownProcess" <?php if($_SESSION['classification'] == "ASSOCIATE") echo " disabled " ?>>
<option value=""> </option>
<option value="For First Checking">For First Checking</option>
<option value="For Second Checking">For Second Checking</option>
<option value="Checked">Checked</option>
</select>
<br>
<label for = "dropdownApproval" style = "width : 150px; border-radius: 10px"> Approval Status: </label>
<select class="form-select" name="approval" id="dropdownApproval" <?php if($_SESSION['classification'] == "ASSOCIATE") echo " disabled " ?>>
<option value=""> </option>
<option value="Full Incentive">Full Incentive</option>
<option value="Half Incentive">Half Incentive</option>
<option value="Early Approved">Early Approved</option>
<option value="Late Approved">Late Approved</option>
<option value="Pending">Pending</option>
<option value="Uncounted Pend">Uncounted Pend</option>
<option value="No Status">No Status</option>
<option value="Denied">Denied</option>
</select>
<br>
<label for = "assocCheck" style = "width : 150px; border-radius: 10px"> Associate Checker: </label>
<input class="form-control" type="text" name="assocCheck" <?php if($_SESSION['classification'] == "ASSOCIATE") echo " readonly value = '". $_SESSION['accountName'] ."' "; else echo " id='assocCheck' " ?>>
<br>
<label for = "finalCheck" style = "width : 150px; border-radius: 10px"> Final Checker: </label>
<input class="form-control" type="text" name="finalCheck" <?php if($_SESSION['classification'] == "ASSOCIATE") echo " readonly id='finalCheck' "; else echo " readonly value = '". $_SESSION['accountName'] ."' ";?>>
<br>
<label for = "assocRemark" style = "width : 150px; border-radius: 10px"> Associate Remark: </label>
<textarea class="form-control" rows = '5' cols = '30' name = 'assocRemark' id = 'assocRemark' placeholder = 'Enter Associate Remark Here'></textarea>
<br>
<label for = "finalRemark" style = "width : 150px; border-radius: 10px"> Final Remark: </label>
<textarea class="form-control" rows = '5' cols = '30' name = 'finalRemark' id = 'finalRemark' placeholder = 'Enter Final Remark Here' <?php if($_SESSION['classification'] == "ASSOCIATE") echo " readonly " ?>></textarea>
<br>
<label for = "postDet" style = "border-radius: 10px">Post-Activity Requirements: </label>
<textarea class="form-control" rows = '5' cols = '30' name = 'postDet' id = 'postDet' placeholder = 'Enter Post Activity Details' <?php if($_SESSION['classification'] == "ASSOCIATE") echo " readonly " ?>></textarea>
<br>
<label for = "deadlinePR" style = "color: #183C1B; border-radius: 10px"> Post-Activity Deadline: </label>
<input class="form-control" type="date" name="deadlinePR" id="deadlinePR" <?php if($_SESSION['classification'] == "ASSOCIATE") echo " readonly " ?>>
<br>
<label for = "evalStatus" style = "width : 150px; border-radius: 10px"> For Evaluation: </label>
<select class="form-select" name="evalStatus" id="evalStatus" <?php if($_SESSION['classification'] == "ASSOCIATE") echo " disabled " ?>>
<option value=""></option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
<br>
<br>
</form>
</table>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<input type="submit" class="btn btn-success" value="Save Changes" name="save" />
</div>
</div>
</form>
</div>
</div>
<script>
var editModal = document.getElementById('checkSubmission')
editModal.addEventListener('show.bs.modal', function (event) {
var button = event.relatedTarget
// Extract info from data-bs-* attributes
var processStage = button.getAttribute('data-bs-processStage')
var approveStatus = button.getAttribute('data-bs-approveStatus')
var assocCheck = button.getAttribute('data-bs-assocCheck')
var finalCheck = button.getAttribute('data-bs-finalCheck')
var assocRemark = button.getAttribute('data-bs-assocRemark')
var finalRemark = button.getAttribute('data-bs-finalRemark')
var postReq = button.getAttribute('data-bs-postReq')
var postD = button.getAttribute('data-bs-postD')
var eval = button.getAttribute('data-bs-eval')
// Set values of Text Entries
document.getElementById('dropdownProcess').value = processStage
document.getElementById('dropdownApproval').value = approveStatus
try {
document.getElementById('assocCheck').value = assocCheck
} catch {
}
try {
document.getElementById('finalCheck').value = finalCheck
} catch {
}
document.getElementById('assocRemark').value = assocRemark
document.getElementById('finalRemark').value = finalRemark
document.getElementById('postDet').value = postReq
document.getElementById('deadlinePR').value = postD
document.getElementById('evalStatus').value = eval
})
</script>
</body>
</html>
<?php
mysqli_close($sqlconnect);
?>