-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard.php
170 lines (131 loc) · 5.76 KB
/
dashboard.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
<?php
session_start();
include 'connectDB.php';
$jam = date("H:i:s");
if (isset($_POST["panggilAntrianA"])){
$query = mysqli_query($connect, "SELECT * from antrian where status = 'dilayani' AND loket = 'A' ORDER BY nomor DESC");
if (mysqli_num_rows($query) > 0){
$query = mysqli_fetch_assoc($query);
$nomorSekarang = $query["nomor"];
mysqli_query($connect, "UPDATE antrian SET status = 'selesai' where nomor = $nomorSekarang");
}
$query = mysqli_query($connect, "SELECT * from antrian where status = 'mengantri'");
$query = mysqli_fetch_assoc($query);
$nomorSekarang = $query["nomor"];
mysqli_query($connect, "UPDATE antrian SET status = 'dilayani', loket = 'A', dilayani = '$jam' where nomor = $nomorSekarang");
}
if (isset($_POST["panggilAntrianB"])){
$query = mysqli_query($connect, "SELECT * from antrian where status = 'dilayani' AND loket = 'B' ORDER BY nomor DESC");
if (mysqli_num_rows($query) > 0){
$query = mysqli_fetch_assoc($query);
$nomorSekarang = $query["nomor"];
mysqli_query($connect, "UPDATE antrian SET status = 'selesai' where nomor = $nomorSekarang");
}
$query = mysqli_query($connect, "SELECT * from antrian where status = 'mengantri'");
$query = mysqli_fetch_assoc($query);
$nomorSekarang = $query["nomor"];
mysqli_query($connect, "UPDATE antrian SET status = 'dilayani', loket = 'B', dilayani = '$jam' where nomor = $nomorSekarang");
}
if (isset($_POST["panggilAntrianC"])){
$query = mysqli_query($connect, "SELECT * from antrian where status = 'dilayani' AND loket = 'C' ORDER BY nomor DESC");
if (mysqli_num_rows($query) > 0){
$query = mysqli_fetch_assoc($query);
$nomorSekarang = $query["nomor"];
mysqli_query($connect, "UPDATE antrian SET status = 'selesai' where nomor = $nomorSekarang");
}
$query = mysqli_query($connect, "SELECT * from antrian where status = 'mengantri'");
$query = mysqli_fetch_assoc($query);
$nomorSekarang = $query["nomor"];
mysqli_query($connect, "UPDATE antrian SET status = 'dilayani', loket = 'C', dilayani = '$jam' where nomor = $nomorSekarang");
}
if (isset($_POST["selesaiA"])){
$query = mysqli_query($connect, "SELECT * from antrian where status = 'dilayani' AND loket = 'A' ORDER BY nomor DESC");
if (mysqli_num_rows($query) > 0){
$query = mysqli_fetch_assoc($query);
$nomorSekarang = $query["nomor"];
mysqli_query($connect, "UPDATE antrian SET status = 'selesai' where nomor = $nomorSekarang");
}
}
if (isset($_POST["selesaiB"])){
$query = mysqli_query($connect, "SELECT * from antrian where status = 'dilayani' AND loket = 'B' ORDER BY nomor DESC");
if (mysqli_num_rows($query) > 0){
$query = mysqli_fetch_assoc($query);
$nomorSekarang = $query["nomor"];
mysqli_query($connect, "UPDATE antrian SET status = 'selesai' where nomor = $nomorSekarang");
}
}
if (isset($_POST["selesaiC"])){
$query = mysqli_query($connect, "SELECT * from antrian where status = 'dilayani' AND loket = 'C' ORDER BY nomor DESC");
if (mysqli_num_rows($query) > 0){
$query = mysqli_fetch_assoc($query);
$nomorSekarang = $query["nomor"];
mysqli_query($connect, "UPDATE antrian SET status = 'selesai' where nomor = $nomorSekarang");
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php include '_headtags.php' ?>
<script src="js/jquery.js"></script>
<script>
var refreshId = setInterval(function(){
$('#tampilAntrian').load('tampilAntrian.php');
}, 1000);
</script>
<title>Program Antrian</title>
</head>
<body>
<!-- header -->
<?php include '_navbar.php' ?>
<!-- end header -->
<!-- body -->
<div class="row">
<div class="col s5 offset-s1 card">
<div class="card-content">
<!-- tampilan antrian -->
<div id="tampilAntrian"></div>
<!-- end tampilan antrian -->
</div>
<br><br>
</div>
<div class="col s4 offset-s1 card">
<h3 class="header center">Loket A</h3>
<div class="card-content">
<form action="" method="post">
<div class="center"><button class="btn-large blue darken-2" type="submit" name="panggilAntrianA">Panggil</button> <button class="btn-large red darken-2" type="submit" name="selesaiA">Selesai</button></div>
</form>
</div>
<h3 class="header center">Loket B</h3>
<div class="card-content">
<form action="" method="post">
<div class="center"><button class="btn-large blue darken-2" type="submit" name="panggilAntrianB">Panggil</button> <button class="btn-large red darken-2" type="submit" name="selesaiB">Selesai</button></div>
</form>
</div>
<h3 class="header center">Loket C</h3>
<div class="card-content">
<form action="" method="post">
<div class="center"><button class="btn-large blue darken-2" type="submit" name="panggilAntrianC">Panggil</button> <button class="btn-large red darken-2" type="submit" name="selesaiC">Selesai</button></div>
</form>
</div>
</div>
</div>
<!-- end body -->
<!-- footer -->
<?php include "_footer.php"; ?>
<!-- end footer -->
</body>
</html>
<?php
if ( !isset($_SESSION["admin"])){
echo "
<script>
Swal.fire('Akses Ditolak','Anda Belum Login Sebagai Karyawan','warning').then(function(){
document.location.href = 'index.php';
});
</script>
";
}
?>