forked from cedrickjames/helpdesk-production
-
Notifications
You must be signed in to change notification settings - Fork 1
/
allrequest.php
596 lines (342 loc) · 18.3 KB
/
allrequest.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
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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
<?php
//Set the session timeout for 1 hour
$timeout = 500;
//Set the maxlifetime of the session
ini_set("session.gc_maxlifetime", $timeout);
//Set the cookie lifetime of the session
ini_set("session.cookie_lifetime", $timeout);
// session_start();
$s_name = session_name();
$url1 = $_SERVER['REQUEST_URI'];
header("Refresh: 500; URL=$url1");
//Check the session exists or not
if (isset($_COOKIE[$s_name])) {
setcookie($s_name, $_COOKIE[$s_name], time() + $timeout, '/');
} else
echo "Session is expired.<br/>";
// end of session timeout>";
session_start();
if (!isset($_SESSION['connected'])) {
header("location: index.php");
}
// connection php and transfer of session
include("includes/connect.php");
$user_dept = $_SESSION['department'];
$user_level = $_SESSION['level'];
if (isset($_POST['approveRequest'])) {
$requestID = $_POST['requestID'];
$remarks = $_POST['remarks'];
$date = date("ym-dH-is");
$username = $_SESSION['name'];
$sql = "UPDATE `request` SET `status2`='For Admin Approval',`approving_head`='$username',`head_approved_date`='$date',`head_remarks`='$remarks' WHERE `id` = '$requestID';";
$results = mysqli_query($con, $sql);
}
if (isset($_POST['dissapproveRequest'])) {
$requestID = $_POST['requestID'];
$remarks = $_POST['remarks'];
$date = date("ym-dH-is");
$username = $_SESSION['name'];
$sql = "UPDATE `request` SET `status2`='Disapproved by head',`approving_head`='$username',`head_approved_date`='$date',`head_remarks`='$remarks' WHERE `id` = '$requestID';";
$results = mysqli_query($con, $sql);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Helpdesk</title>
<!-- font awesome -->
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" /> -->
<link rel="stylesheet" href="./fontawesome-free-6.2.0-web/css/all.min.css">
<!-- tailwind play cdn -->
<!-- <script src="https://cdn.tailwindcss.com"></script> -->
<script src="./cdn_tailwindcss.js"></script>
<!-- from flowbite cdn -->
<!-- <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/flowbite.min.css" /> -->
<link rel="stylesheet" href="node_modules/flowbite/dist/flowbite.min.css" />
<!-- modal and other tailwind elements -->
<link rel="stylesheet" href="./node_modules/tw-elements/dist/css/index.min.css" />
<link rel="shortcut icon" href="resources/img/helpdesk.png">
<!-- <link rel="stylesheet" href="css/style.css" /> -->
<!-- tailwind element -->
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tw-elements/dist/css/index.min.css" /> -->
<!-- <script src="https://cdn.tailwindcss.com"></script> -->
<!-- darkmode -->
<script>
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
if (localStorage.getItem('color-theme') === 'dark' || (!('color-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.classList.add('dark');
} else {
document.documentElement.classList.remove('dark')
}
</script>
</head>
<body onload=navFuntion() class="static bg-white dark:bg-gray-900">
<!-- nav -->
<?php require_once 'nav.php'; ?>
<div class=" flex mt-24 left-10 right-5 flex-col px-14 sm:px-14 pt-6 pb-14 z-50 ">
<!-- <div class=" fixed top-20 left-10 right-5 flex flex-col pt-6 px-2 sm:px-4 py-2.5 "> -->
<div class="overflow-x-auto sm:-mx-6 lg:-mx-8 ">
<div class="py-4 inline-block min-w-full sm:px-6 lg:px-8">
<div class="overflow-hidden">
<h1 class="mb-4 text-4xl font-extrabold tracking-tight leading-none text-gray-900 md:text-5xl lg:text-3xl dark:text-white">Job Order: <span class="text-blue-600 dark:text-blue-500">All Request</span></h1>
<table class="min-w-full text-center">
<thead class="border-b bg-gray-800">
<tr>
<th scope="col" class="text-sm font-small text-white px-2 py-4">
No.
</th>
<th scope="col" class="text-sm font-small text-white px-2 py-4">
View JO
</th>
<!-- <th scope="col" class="text-sm font-small text-white px-2 py-4">
Action
</th> -->
<th scope="col" class="text-sm font-medium text-white px-2 py-4">
Status
</th>
<th scope="col" class="text-sm font-medium text-white px-2 py-4">
JO No.
</th>
<th scope="col" class="text-sm font-medium text-white px-2 py-4">
Assign Section
</th>
<th scope="col" class="text-sm font-medium text-white px-2 py-4">
Date of Request
</th>
<th scope="col" class="text-sm font-medium text-white px-2 py-4">
Requestor
</th>
<th scope="col" class="text-sm font-medium text-white px-2 py-4">
Department
</th>
<th scope="col" class="text-sm font-medium text-white px-2 py-4">
In-Charge
</th>
<th scope="col" class="text-sm font-medium text-white px-2 py-4">
Target Date Start
</th>
<th scope="col" class="text-sm font-medium text-white px-2 py-4">
Target Date Finish
</th>
<th scope="col" class="text-sm font-medium text-white px-2 py-4">
Attachment
</th>
<th scope="col" class="text-sm font-medium text-white px-2 py-4">
Category
</th>
<!-- <th scope="col" class="text-sm font-medium text-white px-2 py-4">
Action
</th> -->
</tr>
</thead class="border-b">
<tbody>
<!-- start calling record on db -->
<?php
$a = 1;
// include ("includes/connect.php");
$sql = "select * from request order by ticket_no ASC ";
$result = mysqli_query($con, $sql);
// if(isset($_POST['searchh'] )){
// $search=mysqli_real_escape_string($mysqli,$_POST['search']);
// if($search!=""){
// $sql="select * from request where suppliername like '%$search%' or contact_person like '%$search%'";
// }
// }
while ($row = mysqli_fetch_assoc($result)) {
?>
<tr class="bg-white border-b">
<td class="px-6 py-4 whitespace-nowrap text-sm font-small text-gray-900"><?php echo $a++ ?></td>
<td class="px-6 py-4 text-right">
<!-- <a href="#" class="font-medium text-blue-600 dark:text-blue-500 hover:underline">Select</a> -->
<button type="button" class="inline-block px-6 py-2.5 bg-blue-600 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out" data-bs-toggle="modal" data-bs-target="#exampleModalCenter" data-bs-jonumber="<?php echo $row['ticket_no']; ?>" data-bs-id="<?php echo $row['id']; ?>" data-bs-jorequest="<?php echo $row['request_details']; ?>"> View JO
</button>
</td>
<div class="modal fade fixed top-0 left-0 hidden w-full h-full outline-none overflow-x-hidden overflow-y-auto" id="exampleModalCenter" tabindex="-1" aria-labelledby="exampleModalCenterTitle" aria-modal="true" role="dialog">
<div class="modal-dialog modal-dialog-centered relative w-auto pointer-events-none">
<div class="modal-content border-none shadow-lg relative flex flex-col w-full pointer-events-auto bg-white bg-clip-padding rounded-md outline-none text-current">
<div class="modal-header flex flex-shrink-0 items-center justify-between p-4 border-b border-gray-200 rounded-t-md">
<h5 class="text-xl font-medium leading-normal text-gray-800" id="ticketnumbertitle">
JO Number////////:
</h5>
<button type="button" class="btn-close box-content w-4 h-4 p-1 text-black border-none rounded-none opacity-50 focus:shadow-none focus:outline-none focus:opacity-100 hover:text-black hover:opacity-75 hover:no-underline" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-header flex flex-shrink-0 items-center justify-between p-4 border-b border-gray-200 rounded-t-md">
<h5 class="text-lg font-medium leading-normal text-blue-800">Details of Request : </h5>
</div>
<div class="modal-header flex flex-shrink-0 items-center justify-between p-4 rounded-t-md">
<p class="text-sm font-medium leading-normal text-gray-800" id="ticketdetails">
details////////:
</p>
</div>
<form method="POST" action="allrequest.php">
<div class="modal-body relative p-4">
<div class="mb-6">
<!-- <label for="default-input" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Remarks</label> -->
<input type="text" name="requestID" id="idInput" class="hidden bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
</div>
</div>
<div class="modal-footer flex flex-shrink-0 flex-wrap items-center justify-end p-4 border-t border-gray-200 rounded-b-md">
<button class="inline-block px-6 py-2.5 bg-red-600 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-red-700 hover:shadow-lg focus:bg-purple-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-purple-800 active:shadow-lg transition duration-150 ease-in-out" data-bs-dismiss="modal">
Close
</button>
</div>
</form>
</div>
</div>
</div>
<td class="text-sm text-red-700 font-light px-6 py-4 whitespace-nowrap">
<?php echo $row['status']; ?>
</td>
<td class="text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap">
<?php echo $row['ticket_no']; ?>
</td>
<td class="text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap">
<?php echo $row['request_to']; ?>
</td>
<td class="text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap">
<?php echo $row['date_filled']; ?>
</td>
<td class="text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap">
<?php echo $row['requestor']; ?>
</td>
<td class="text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap">
<?php echo $row['department']; ?>
</td>
<td class="text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap">
<?php echo $row['perform_by']; ?>
</td>
<td class="text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap">
<?php echo $row['reqstart_date']; ?>
</td>
<td class="text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap">
<?php echo $row['reqfinish_date']; ?>
</td>
<!-- to view pdf -->
<td class="text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap">
<?php if ($row['attachment'] != null) {
?>
<a class="text-sm text-blue-700 font-light px-6 py-4 whitespace-nowrap" href="<?php echo $row['attachment']; ?>" target="_blank">View</a>
<?php
} else {
?>
<a class="text-sm text-red-700 font-light px-6 py-4 whitespace-nowrap">Empty...</a>
<?php
}
?>
</td>
<td class="text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap">
<?php echo $row['request_category']; ?>
</td>
</tr>
<?php
}
?>
<!-- <td class="text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap">
MIS-001
</td>
<td class="text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap">
10/23/2022
</td>
<td class="text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap">
Mark
</td>
<td class="text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap">
Production
</td>
<td class="text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap">
Request to check computer due to always hang up and also alway no network
</td>
<td class="text-sm text-gray-700 font-light px-6 py-4 whitespace-nowrap">
Un-Assigned
</td>
<td class="text-sm text-gray-900 font-light px-6 py-4 whitespace-nowrap">
10/28/2022
</td> -->
<!-- <td class="py-4 px-6">
<a href="#" class="font-medium text-blue-600 dark:text-blue-500 hover:underline">Update</a>
</td> -->
<!--
-->
<!-- <td class="py-4 px-6">
<a href="#" class="font-medium text-blue-600 dark:text-blue-500 hover:underline">Update</a>
</td>
</tr> -->
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- flowbite javascript -->
<!-- <script src="https://unpkg.com/[email protected]/dist/flowbite.js"></script> -->
<script src="./node_modules/flowbite/dist/flowbite.js"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/tw-elements/dist/js/index.min.js"></script> -->
<script src="./node_modules/tw-elements/dist/js/index.min.js"></script>
<!-- darkmode script -->
<script>
const exampleModal = document.getElementById('exampleModalCenter')
exampleModal.addEventListener('show.bs.modal', event => {
// Button that triggered the modal
const button = event.relatedTarget
// Extract info from data-bs-* attributes
const requestId = button.getAttribute('data-bs-id');
const joNumber = button.getAttribute('data-bs-jonumber')
const joRequest = button.getAttribute('data-bs-jorequest')
// If necessary, you could initiate an AJAX request here
// and then do the updating in a callback.
//
// Update the modal's content.
const modalId = exampleModal.querySelector('#idInput')
const ticketNo = exampleModal.querySelector('#ticketnumbertitle')
const joDetails = exampleModal.querySelector('#ticketdetails')
modalId.value = `${requestId}`
ticketNo.textContent = `JO No. : ${joNumber}`
joDetails.textContent = ` ${joRequest}`
})
var themeToggleDarkIcon = document.getElementById('theme-toggle-dark-icon');
var themeToggleLightIcon = document.getElementById('theme-toggle-light-icon');
// Change the icons inside the button based on previous settings
if (localStorage.getItem('color-theme') === 'dark' || (!('color-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
themeToggleLightIcon.classList.remove('hidden');
} else {
themeToggleDarkIcon.classList.remove('hidden');
}
var themeToggleBtn = document.getElementById('theme-toggle');
themeToggleBtn.addEventListener('click', function() {
// toggle icons inside button
themeToggleDarkIcon.classList.toggle('hidden');
themeToggleLightIcon.classList.toggle('hidden');
// if set via local storage previously
if (localStorage.getItem('color-theme')) {
if (localStorage.getItem('color-theme') === 'light') {
document.documentElement.classList.add('dark');
localStorage.setItem('color-theme', 'dark');
} else {
document.documentElement.classList.remove('dark');
localStorage.setItem('color-theme', 'light');
}
// if NOT set via local storage previously
} else {
if (document.documentElement.classList.contains('dark')) {
document.documentElement.classList.remove('dark');
localStorage.setItem('color-theme', 'light');
} else {
document.documentElement.classList.add('dark');
localStorage.setItem('color-theme', 'dark');
}
}
});
// active page highlight
var activepage = document.getElementById("allrequest");
activepage.classList.remove("text-gray-700");
activepage.classList.add("text-blue-700");
activepage.classList.remove("dark:text-gray-400");
activepage.classList.add("dark:text-white");
</script>
</body>
</html>