-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
171 lines (80 loc) · 3.34 KB
/
index.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
<?php
session_start();
require_once "function.php";
if (!isset($_SESSION["akun-admin"]) && !isset($_SESSION["akun-user"])) {
header("Location: login.php");
exit;
}
if (isset($_GET["transaksi"])) {
$menu = ambil_data("SELECT * FROM transaksi");
} else if (isset($_GET["pesanan"])) {
$menu = ambil_data("SELECT p.kode_pesanan, tk.nama_pelanggan, p.kode_menu, p.qty
FROM pesanan AS p
JOIN transaksi AS tk ON (tk.kode_pesanan = p.kode_pesanan)
");
} else {
if (!isset($_GET["search"])) {
$menu = ambil_data("SELECT * FROM menu ORDER BY kode_menu DESC");
} else {
$key_search = $_GET["key-search"];
$menu = ambil_data("SELECT * FROM menu WHERE nama LIKE '%$key_search%' OR
harga LIKE '%$key_search%' OR
kategori LIKE '%$key_search%' OR
`status` LIKE '%$key_search%'
ORDER BY kode_menu DESC
");
}
}
if (isset($_POST["pesan"])) {
$pesanan = tambah_data_pesanan();
echo $pesanan > 0
? "<script>
alert('Pesanan Berhasil Dikirim!');
</script>"
: "<script>
alert('Pesanan Gagal Dikirim!');
</script>";
}
?>
<!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">
<link rel="stylesheet" href="./src/css/bootstrap-5.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="./src/css/bootstrap-icons-1.8.3/bootstrap-icons.css">
<title>Beranda</title>
</head>
<body class="bg-light">
<!-- Header -->
<div class="container-fluid position-fixed top-0 bg-dark p-2 d-flex justify-content-between" style="z-index: 2;">
<div class="text-white h3 d-flex">
<span id="menu-list" role="button"><i class="bi bi-list"></i></span>
<span class="mx-3">Restoran </span>
</div>
<a class="btn btn-danger fw-bold" href="logout.php" onclick="return confirm('Ingin Logout?')">Logout</a>
</div>
<!-- List Menu -->
<div id="dropdown-menu" class="container-fluid position-fixed float-start bg-dark text-white w-auto vh-100" style="display: none; z-index: 1; top: 50px;">
<ul>
<br>
<li><a class="text-decoration-none p-2 h5 text-light" href="index.php">MENU</a></li><br>
<?php if (isset($_SESSION["akun-admin"])) { ?>
<li><a class="text-decoration-none p-2 h5 text-light" href="index.php?pesanan">PESANAN</a></li><br>
<li><a class="text-decoration-none p-2 h5 text-light" href="index.php?transaksi">TRANSAKSI</a></li>
<?php } ?>
</ul>
</div>
<!-- Content -->
<div class="container" style="z-index: -1; margin-top: 60px;">
<?php
if (isset($_GET["pesanan"])) include "halaman/pesanan.php";
else if (isset($_GET["transaksi"])) include "halaman/transaksi.php";
else include "halaman/beranda.php";
?>
</div>
<script src="./src/css/bootstrap-5.2.0/js/bootstrap.min.js"></script>
<script src="src/js/beranda.js"></script>
</body>
</html>