-
Notifications
You must be signed in to change notification settings - Fork 1
/
statuscomplain.php
751 lines (558 loc) · 23 KB
/
statuscomplain.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
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
<?php
include("config/config.php");
//dashboard of admin
if(!isset($_SESSION['name'])){
header("Location: index.php");
exit();
}
else{
$sql = "SELECT usertype FROM user WHERE email='".$_SESSION["email"]."'";
$res=mysqli_query($con,$sql);
$row=$res->fetch_assoc();
if($row['usertype']=='admin'){
$sidebar='
<li class="nav-item ">
<a class="nav-link" href="./adddepartment.php">
<i class="material-icons">group_add</i>
<p>Add department</p>
</a>
</li>
<li class="nav-item ">
<a class="nav-link" href="./removedepartment.php">
<i class="material-icons">clear</i>
<p>Remove department</p>
</a>
</li>
'
;
}else{
$sidebar='';
}
if( $row['usertype']!='admin' )
{
if($row['usertype']=='User'){
header("Location: dashboard.php");
exit();
}
else if($row['usertype']=='Department'){
header("Location: depthome.php");
exit();
}
}
}
$sql = "SELECT name FROM user WHERE email='".$_SESSION["email"]."'";
$res=$res_u=mysqli_query($con,$sql);
$row=$res->fetch_assoc();
$uname=$row["name"];//set name to department name instead of gmail account name
$_SESSION["name"] =$uname;
$totcomp=mysqli_num_rows(mysqli_query($con,"SELECT * FROM complain "));
$totpendingcomp=mysqli_num_rows(mysqli_query($con,"SELECT * FROM complain WHERE status='Pending' OR status='Pending#'"));
$totsolvedcomp=mysqli_num_rows(mysqli_query($con,"SELECT * FROM complain WHERE status='Resolved' OR status='Resolved#'"));
$totinprogresscomp=mysqli_num_rows(mysqli_query($con,"SELECT * FROM complain WHERE status='In-Progress' OR status='In-Progress#'" ));
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="apple-touch-icon" sizes="76x76" href="assets/img/apple-icon.png">
<link rel="icon" type="image/png" href="assets/img/favicon.png">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Complains | Complain Box </title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no' name='viewport' />
<!-- Fonts and icons -->
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Roboto+Slab:400,700|Material+Icons" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css">
<!-- CSS Files -->
<link href="assets/css/material-dashboard.css?v=2.1.1" rel="stylesheet" />
</head>
<body class="">
<div class="wrapper ">
<div class="sidebar" data-color="purple" data-background-color="white" data-image="assets/img/sidebar.jpg">
<!--
Tip 1: You can change the color of the sidebar using: data-color="purple | azure | green | orange | danger"
Tip 2: you can also add an image using data-image tag
-->
<div class="logo">
<a href="#" class="simple-text logo-normal">
Complain Box
</a>
</div>
<div class="sidebar-wrapper">
<ul class="nav">
<li class="nav-item">
<br/>
<div class="card-profile">
<div class="card-avatar">
<img class="img" src="<?php echo $_SESSION['imgurl']; ?>" />
</div>
<div class="card-body">
<h5 class="card-title"> <?php echo $_SESSION['name']; ?></h5>
</div>
</div>
</li>
<li class="nav-item active">
<a class="nav-link" href="./admindashboard.php">
<i class="material-icons">dashboard</i>
<p>Dashboard</p>
</a>
</li>
<li class="nav-item ">
<a class="nav-link" href="./adminprofile.php">
<i class="material-icons">person</i>
<p>My Profile</p>
</a>
</li>
<li class="nav-item ">
<a class="nav-link" href="./test_report.php">
<i class="material-icons">content_paste</i>
<p>Reports</p>
</a>
</li>
<li class="nav-item ">
<a class="nav-link" href="./editdepartment.php">
<i class="material-icons">create</i>
<p>Edit department</p>
</a>
</li>
<?php echo $sidebar;?>
<li class="nav-item ">
<a class="nav-link" href="./logout.php">
<i class="material-icons">arrow_back</i>
<p>Logout</p>
</a>
</li>
</ul>
</div>
</div>
<div class="main-panel">
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-transparent navbar-absolute fixed-top ">
<div class="container-fluid">
<div class="navbar-wrapper">
<a class="navbar-brand" href="#"><b>Complains</b></a>
</div>
<button class="navbar-toggler" type="button" data-toggle="collapse" aria-controls="navigation-index" aria-expanded="false" aria-label="Toggle navigation">
<span class="sr-only">Toggle navigation</span>
<span class="navbar-toggler-icon icon-bar"></span>
<span class="navbar-toggler-icon icon-bar"></span>
<span class="navbar-toggler-icon icon-bar"></span>
</button>
</div>
</nav>
<!-- End Navbar -->
<?php
if(!isset($_GET['department']))
$dptn='';
else
$dptn=$_GET['department'].' : ';
echo '
<div class="content" id="complainDetail">
<div class="container-fluid">
<div class="row">
<div class="col-lg-3 col-md-6 col-sm-6">
<div class="card card-stats">
<div class="card-header card-header-primary card-header-icon">
<div class="card-icon">
<i class="material-icons">format_list_bulleted</i>
</div>
<p class="card-category">Complains</p>
<h3 class="card-title">'.$totcomp.'
</h3>
</div>
<div class="card-footer">
<div class="stats">
<i class="material-icons">content_paste</i><a href="./statuscomplain.php?status=">View Details</a>
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-6">
<div class="card card-stats">
<div class="card-header card-header-warning card-header-icon">
<div class="card-icon">
<i class="fa fa-clock-o"></i>
</div>
<p class="card-category">Pending</p>
<h3 class="card-title">'.$totpendingcomp.'</h3>
</div>
<div class="card-footer">
<div class="stats">
<i class="material-icons">error_outline</i><a href="./statuscomplain.php?status=Pending">View Details</a>
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-6">
<div class="card card-stats">
<div class="card-header card-header-info card-header-icon">
<div class="card-icon">
<i class="fa fa-refresh"></i>
</div>
<p class="card-category">In Progress</p>
<h3 class="card-title">'.$totinprogresscomp.'</h3>
</div>
<div class="card-footer">
<div class="stats">
<i class="material-icons">refresh</i><a href="./statuscomplain.php?status=In-Progress">View Details</a>
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-6">
<div class="card card-stats">
<div class="card-header card-header-success card-header-icon">
<div class="card-icon">
<i class="fa fa-check-square-o"></i>
</div>
<p class="card-category">Solved</p>
<h3 class="card-title">'.$totsolvedcomp.'</h3>
</div>
<div class="card-footer">
<div class="stats">
<i class="material-icons">check</i><a href="./statuscomplain.php?status=Solved">View Details</a>
</div>
</div>
</div>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header card-header-primary">
<h4 class="card-title ">'.$dptn.$_GET["status"].' Complains</h4>
<p class="card-category"> </p>
</div>';
echo ' <div class="card-body table-responsive">
<table class="table table-hover">
<thead class="text-primary">
<th>ID</th>
<th>Department</th>
<th>Detail</th>
<th>Date Time</th>
<th>Status</th>
<!-- <th>Complainant</th>
<th>Mail</th>-->
<th>View</th>
</thead> <tbody>';
$sql = "SELECT * FROM complain WHERE status like '%".$_GET['status']."%' AND Departmentname like '%".$dptn."%' ORDER BY id DESC";
$result=mysqli_query($con,$sql);
while($row = mysqli_fetch_array($result)){
//Creates a loop to dipslay all complain
echo "<tr><td>".$row['id']."</td>";
echo "<td>".$row['Departmentname']."</td>";
if(strlen($row['description'])>50)
{
echo "<td >".substr($row['description'],0,50) ." ...</td>";
}
else{
$tmpd= $row['description'];
$tmplen=54-strlen($row['description']);
echo "<td >".$tmpd.str_repeat(' ',$tmplen);"</td>";
}
echo "<td>".$row['complaindate']."</td>";
echo "<td class='";
if($row['status']=='Pending' || $row['status']=='Pending#'){
echo 'text-danger';
}else if($row['status']=='In-Progress'|| $row['status']=='In-Progress#'){
echo 'text-warning';
}
else if($row['status']=='Resolved'|| $row['status']=='Resolved#'){
echo 'text-success';
}
echo "' style=' font-weight: 500;'>".$row['status']."</td>";
//echo "<td>".$row['complainant']."</td>";
//echo "<td>".$row['complainantmail']."</td>";
echo '<td><button type="button" class="btn btn-primary" name="'.$row['id'].'" onclick="viewDetails()">View Details</button></td>';
}
echo '</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>';
include("footer.php");
echo' </div>';
?>
<!---- action form ---->
<!----end of complain-->
</div>
<!-- Core JS Files
margin-top: 34px;
left: -119px;
color: #fff;
background: #9c27b0;
-->
<script src="assets/js/core/jquery.min.js"></script>
<script src="assets/js/core/popper.min.js"></script>
<script src="assets/js/core/bootstrap-material-design.min.js"></script>
<script src="assets/js/plugins/perfect-scrollbar.jquery.min.js"></script>
<!-- Plugin for the momentJs -->
<script src="assets/js/plugins/moment.min.js"></script>
<!-- Plugin for Sweet Alert -->
<script src="assets/js/plugins/sweetalert2.js"></script>
<!-- Forms Validations Plugin -->
<script src="assets/js/plugins/jquery.validate.min.js"></script>
<!-- Plugin for the Wizard, full documentation here: https://github.com/VinceG/twitter-bootstrap-wizard -->
<script src="assets/js/plugins/jquery.bootstrap-wizard.js"></script>
<!-- Plugin for Select, full documentation here: http://silviomoreto.github.io/bootstrap-select -->
<script src="assets/js/plugins/bootstrap-selectpicker.js"></script>
<!-- Plugin for the DateTimePicker, full documentation here: https://eonasdan.github.io/bootstrap-datetimepicker/ -->
<script src="assets/js/plugins/bootstrap-datetimepicker.min.js"></script>
<!-- DataTables.net Plugin, full documentation here: https://datatables.net/ -->
<script src="assets/js/plugins/jquery.dataTables.min.js"></script>
<!-- Plugin for Tags, full documentation here: https://github.com/bootstrap-tagsinput/bootstrap-tagsinputs -->
<script src="assets/js/plugins/bootstrap-tagsinput.js"></script>
<!-- Plugin for Fileupload, full documentation here: http://www.jasny.net/bootstrap/javascript/#fileinput -->
<script src="assets/js/plugins/jasny-bootstrap.min.js"></script>
<!-- Full Calendar Plugin, full documentation here: https://github.com/fullcalendar/fullcalendar -->
<script src="assets/js/plugins/fullcalendar.min.js"></script>
<!-- Vector Map plugin, full documentation here: http://jvectormap.com/documentation/ -->
<script src="assets/js/plugins/jquery-jvectormap.js"></script>
<!-- Plugin for the Sliders, full documentation here: http://refreshless.com/nouislider/ -->
<script src="assets/js/plugins/nouislider.min.js"></script>
<!-- Include a polyfill for ES6 Promises (optional) for IE11, UC Browser and Android browser support SweetAlert -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/core.js"></script>
<!-- Library for adding dinamically elements -->
<script src="assets/js/plugins/arrive.min.js"></script>
<!-- Google Maps Plugin -->
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY_HERE"></script>
<!-- Chartist JS -->
<script src="assets/js/plugins/chartist.min.js"></script>
<!-- Notifications Plugin -->
<script src="assets/js/plugins/bootstrap-notify.js"></script>
<!-- Control Center for Material Dashboard: parallax effects, scripts for the example pages etc -->
<script src="assets/js/material-dashboard.js?v=2.1.1" type="text/javascript"></script>
<!-- Material Dashboard DEMO methods, don't include it in your project! -->
<script src="assets/demo/demo.js"></script>
<script>
/* $("li").click(function(){
alert("j");
var val=$(this).text();
$("#dropdownMenuLink").text("STATUS: "+$(this).text());
$.ajax(function(){
type:"POST",
url:"status_update.php",
data:"status="+val+"&id=<?php //echo $_GET['id']?>"
}).done(function(){
window.open("depthome.php?id="+<?php //echo $_GET['id']?>,"_self");
});
});
*/
</script>
<script>
function doSomething(a) {
var x = document.getElementById("testing");
var y = document.getElementById("test");
//if (x.style.display === "none") {
y.innerHTML = a;
//x.style.display = "block";
console.log(a);
// alert('Form submitted!'+a);
return false;
}
$(document).ready(function() {
$().ready(function() {
$sidebar = $('.sidebar');
$sidebar_img_container = $sidebar.find('.sidebar-background');
$full_page = $('.full-page');
$sidebar_responsive = $('body > .navbar-collapse');
window_width = $(window).width();
fixed_plugin_open = $('.sidebar .sidebar-wrapper .nav li.active a p').html();
if (window_width > 767 && fixed_plugin_open == 'Dashboard') {
if ($('.fixed-plugin .dropdown').hasClass('show-dropdown')) {
$('.fixed-plugin .dropdown').addClass('open');
}
}
$('.fixed-plugin a').click(function(event) {
// Alex if we click on switch, stop propagation of the event, so the dropdown will not be hide, otherwise we set the section active
if ($(this).hasClass('switch-trigger')) {
if (event.stopPropagation) {
event.stopPropagation();
} else if (window.event) {
window.event.cancelBubble = true;
}
}
});
$('.fixed-plugin .active-color span').click(function() {
$full_page_background = $('.full-page-background');
$(this).siblings().removeClass('active');
$(this).addClass('active');
var new_color = $(this).data('color');
if ($sidebar.length != 0) {
$sidebar.attr('data-color', new_color);
}
if ($full_page.length != 0) {
$full_page.attr('filter-color', new_color);
}
if ($sidebar_responsive.length != 0) {
$sidebar_responsive.attr('data-color', new_color);
}
});
$('.fixed-plugin .background-color .badge').click(function() {
$(this).siblings().removeClass('active');
$(this).addClass('active');
var new_color = $(this).data('background-color');
if ($sidebar.length != 0) {
$sidebar.attr('data-background-color', new_color);
}
});
$('.fixed-plugin .img-holder').click(function() {
$full_page_background = $('.full-page-background');
$(this).parent('li').siblings().removeClass('active');
$(this).parent('li').addClass('active');
var new_image = $(this).find("img").attr('src');
if ($sidebar_img_container.length != 0 && $('.switch-sidebar-image input:checked').length != 0) {
$sidebar_img_container.fadeOut('fast', function() {
$sidebar_img_container.css('background-image', 'url("' + new_image + '")');
$sidebar_img_container.fadeIn('fast');
});
}
if ($full_page_background.length != 0 && $('.switch-sidebar-image input:checked').length != 0) {
var new_image_full_page = $('.fixed-plugin li.active .img-holder').find('img').data('src');
$full_page_background.fadeOut('fast', function() {
$full_page_background.css('background-image', 'url("' + new_image_full_page + '")');
$full_page_background.fadeIn('fast');
});
}
if ($('.switch-sidebar-image input:checked').length == 0) {
var new_image = $('.fixed-plugin li.active .img-holder').find("img").attr('src');
var new_image_full_page = $('.fixed-plugin li.active .img-holder').find('img').data('src');
$sidebar_img_container.css('background-image', 'url("' + new_image + '")');
$full_page_background.css('background-image', 'url("' + new_image_full_page + '")');
}
if ($sidebar_responsive.length != 0) {
$sidebar_responsive.css('background-image', 'url("' + new_image + '")');
}
});
$('.switch-sidebar-image input').change(function() {
$full_page_background = $('.full-page-background');
$input = $(this);
if ($input.is(':checked')) {
if ($sidebar_img_container.length != 0) {
$sidebar_img_container.fadeIn('fast');
$sidebar.attr('data-image', '#');
}
if ($full_page_background.length != 0) {
$full_page_background.fadeIn('fast');
$full_page.attr('data-image', '#');
}
background_image = true;
} else {
if ($sidebar_img_container.length != 0) {
$sidebar.removeAttr('data-image');
$sidebar_img_container.fadeOut('fast');
}
if ($full_page_background.length != 0) {
$full_page.removeAttr('data-image', '#');
$full_page_background.fadeOut('fast');
}
background_image = false;
}
});
$('.switch-sidebar-mini input').change(function() {
$body = $('body');
$input = $(this);
if (md.misc.sidebar_mini_active == true) {
$('body').removeClass('sidebar-mini');
md.misc.sidebar_mini_active = false;
$('.sidebar .sidebar-wrapper, .main-panel').perfectScrollbar();
} else {
$('.sidebar .sidebar-wrapper, .main-panel').perfectScrollbar('destroy');
setTimeout(function() {
$('body').addClass('sidebar-mini');
md.misc.sidebar_mini_active = true;
}, 300);
}
// we simulate the window Resize so the charts will get updated in realtime.
var simulateWindowResize = setInterval(function() {
window.dispatchEvent(new Event('resize'));
}, 180);
// we stop the simulation of Window Resize after the animations are completed
setTimeout(function() {
clearInterval(simulateWindowResize);
}, 1000);
});
});
});
</script>
<?php
?>
<script>
function takeAction(event){
// var building = document.getElementById('building');
// var location = document.getElementById('location');
// var msg = document.getElementById('complain_message');
var id= event.target.name;
window.open("depthome.php?id="+id,"_self");
}
$(document).ready(function() {
// Javascript method's body can be found in assets/js/demos.js
md.initDashboardPageCharts();
});
</script>
<?php
if (isset($_POST['forward_admin'])) {
if(isset($_COOKIE['status'])){
$status=$_COOKIE['status'];
}else{
$status="Pending";
}
$query= mysqli_query($con,"UPDATE complain SET status='$status#' WHERE id='$id'");
$remark = $_POST['remark'];
$sql7="INSERT INTO admincomplain (`ogid`, `remark`) values ($id,'".$remark."')";
//echo $sql7;
$query= mysqli_query($con,$sql7);
$query = mysqli_query($con,"SELECT email from user WHERE usertype='admin'");
$row = mysqli_fetch_array($query);
$mail_to = $row['email'];
echo '<script>
$.ajax({
url:"complain_submit_ajax.php",
type:"POST",
data:"id='.$id.'&mail_to='.$mail_to.'",
cache:false,
}).done(function(data){
console.log(data);
window.location.href = "depthome.php";
}).fail(function() {
alert( "Login with Somaiya mail" );
});
</script>';
header("Location: depthome.php");
}
?>
<script>
$("li").click(function(){
var val=$(this).text();
$("#dropdownMenuLink").text($(this).text());
document.cookie = "status=" + $(this).text();
if($(this).text()=='In-Progress'){
$('#expense').hide();
$("#start").show();
}else if($(this).text()=='Resolved'){
$("#start").hide();
$('#expense').show();
}else{
$('#expense').hide();
$("#start").show();
}
/* $.ajax({
type: "POST",
url: "status_update.php",
data:"status="+val+"&id=<?php //echo $_GET['id']?>"
}).done(function(){
window.open("depthome.php","_self");
});
*/
});
function viewDetails(){
var id= event.target.name;
window.open("admin_view.php?id="+id,"_self");
// window.location.href = "./admin_action.php";
}
</script>
</body>
</html>