-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadminMenu.php
More file actions
186 lines (159 loc) · 8.82 KB
/
adminMenu.php
File metadata and controls
186 lines (159 loc) · 8.82 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
<?php
session_start();
?>
<?php
if (!isset($_SESSION['admin']))
{
echo "<script type='text/javascript'>
window.location.href='./adminLogin.php';
</script>";
}
?>
<?php
if (!isset($_SESSION['menuType']))
{
$_SESSION['menuType']="";
}
if (isset($_POST['type']))
{
$_SESSION['menuType']=$_POST['type'];
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>The Sushi Bar SG</title>
<link rel="shortcut icon" href="./assets/icon/favicon.ico" type="image/x-icon">
<link rel="icon" href="./assets/icon/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="./styles/sushi.css">
<meta charset="utf-8">
<style>
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: url('OpenSans-Regular.ttf') format('truetype');
}
</style>
</head>
<body>
<div class="container">
<section>
<div class="header">
<div class="header-box1"><img src="assets/nav/sushi_logo.png" alt="logo" class="logo" width="150px" height="50px"></div>
<div class="header-box2">
<nav class="main-nav">
<ul>
<li><a href="adminReports.php"><b>reports</b></a></li>
<li><a href="adminMenu.php"><b>menu</b></a></li>
<li><a href="adminEnquiries.php"><b>enquiries</b></a></li>
</ul>
</nav>
</div>
<div class="header-box3">
<nav class="main-nav">
<a id="cart" href="./php/adminLogout.php"><img src="assets/nav/logout-icon.jpg" width="50px" height="50px" style="margin-top: 4px; margin-left: 50px;"></a>
</nav>
</div>
</div>
</section>
<div class="cart-main">
<table id="history-table" style="width: 80%;">
<thead>
<tr>
<th colspan="4"><h2 style="text-align: left;">menu items</h2></th>
<th></th>
<th></th>
</tr>
<tr style="margin-bottom: 30px;">
<script type="text/javascript" src="scripts/adminMenu.js"></script>
<th colspan="3">
<form action="adminMenu.php" method="post">
<label style="display: inline-block; margin-right: 30px; margin-bottom: 20px;">Type : </label>
<div class="select-style2" style="display: inline-block;">
<select name="type" id="type" onchange="updateDate('go');" >
<option value=""<?php if ($_SESSION['menuType']==""){echo " selected ";}?>>All</option>
<option value="Gunkan"<?php if ($_SESSION['menuType']=="Gunkan"){echo " selected ";}?>>Gunkan</option>
<option value="Maki"<?php if ($_SESSION['menuType']=="Maki"){echo " selected ";}?>>Maki</option>
<option value="Sets"<?php if ($_SESSION['menuType']=="Sets"){echo " selected ";}?>>Sets</option>
<option value="Nigiri"<?php if ($_SESSION['menuType']=="Nigiri"){echo " selected ";}?>>Nigiri</option>
<option value="Don"<?php if ($_SESSION['menuType']=="Don"){echo " selected ";}?>>Don</option>
</select>
</div>
<input type="submit" class="go" value="GO" id="go" style="display:none">
</form>
</th>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<th></th>
<th> item name</th>
<th>price</th>
<th>details</th>
<th>availability</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
include './php/credentials.php';
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
?>
<?php
$sql_1 = "SELECT * FROM menu WHERE type LIKE '%".$_SESSION['menuType']."%'";
$result = mysqli_query($conn, $sql_1);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
echo'
<tr>
<td><img src="'.$row['imgURL'].'"></td>
<td>'.$row['name'].'</td>
<td><input class="input-number" type="number" align="left" id="price'.$row['id'].'" name="price'.$row['id'].'" style=" text-align:left; background-color: #f4f5f0; margin-left: 0px;" step=0.1 form="form'.$row['id'].'" value='.$row['price'].' onchange="checkPrice('.$row['id'].');"></td>
<td style="padding-top: 20px;"><textarea class="input-textarea" id="description'.$row['id'].'" name="description'.$row['id'].'" style=" text-align:left;" form="form'.$row['id'].'" onchange="updateDate(\'go'.$row['id'].'\');">'.$row['description'].'</textarea></td>
<td>
<div class="select-style2">
<select name="availability'.$row['id'].'" id="availability'.$row['id'].'" onchange="updateDate(\'go'.$row['id'].'\');" form="form'.$row['id'].'" required >
<option value="1"'; if ($row['availability']==1){echo " selected ";}echo'>Available</option>
<option value="0"'; if ($row['availability']==0){echo " selected ";}echo'>Unavailable</option>
</select>
</div>
</td>
<td>
<form name="form'.$row['id'].'" id="form'.$row['id'].'" action="./php/editMenu.php" method="post">
<input type="number" id="menuID" name="menuID" style="display: none" value='.$row['id'].'>
<input type="submit" class="update" value="UPDATE" id="go'.$row['id'].'" style="display:none">
</form>
</td>
</tr>'
;
}
}
?>
</tbody>
</table>
</div>
<script type="text/javascript" src="adminMenu.js"></script>
<section>
<div class="footer">
<div id="icons">
<a href="#"><img src="assets/footer/fb_icon.jpg"></a>
<a href="#"><img src="assets/footer/pinterest_icon.jpg"></a>
<a href="#"><img src="assets/footer/snapchat_icon.jpg"></a>
<a href="#"><img src="assets/footer/spotify_icon.jpg"></a>
</div>
<div id="copyright">
<i>© The Sushi Bar All Rights Reserved</i>
</div>
</div>
</section>
</div>
</body>
</html>