/
restaurant.php
181 lines (145 loc) · 5.18 KB
/
restaurant.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
<!DOCTYPE html>
<?php
header("access-control-allow-origin: *");
include_once 'api/api.php';
global $conn, $api;
session_start();
?>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://storage.googleapis.com/code.getmdl.io/1.0.5/material.indigo-pink.min.css">
<script src="https://storage.googleapis.com/code.getmdl.io/1.0.5/material.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<title>Restaurant Control Panel</title>
<style type="text/css">
.demo-card-wide.mdl-card {
width: 512px;
}
.demo-card-wide > .mdl-card__title {
color: #fff;
height: 176px;
background: url('http://www.getmdl.io/assets/demos/welcome_card.jpg') center / cover;
}
.demo-card-wide > .mdl-card__menu {
color: #fff;
}
</style>
</head>
<body>
<?php
try{
?>
<?php
}
catch(Exception $e){
echo $e->getMessage();
}
//Get current customer
if(isset($_POST['next_customer'])){
try{
$result = deQueueUser($conn, $_SESSION['id']);
}
catch(Exception $e){
echo $e->getMessage();
}
}
if(isset($_GET['id'])){
$_SESSION['id'] = $_GET['id'];
//Get list of all people in the queue
$queue_users = getUsers($conn, $_SESSION['id']);
// foreach($queue_users as $queue_user){
?>
<div class="demo-content mdl-color--white mdl-shadow--4dp content mdl-color-text--grey-800 mdl-cell mdl-cell--8-col" style="margin-top:20px;">
<table class="mdl-data-table mdl-js-data-table mdl-data-table--selectable mdl-shadow--2dp" width="100%" style="left: 30%;">
<thead>
<tr>
<th class="mdl-data-table__cell--non-numeric">ID</th>
<th>Queue ID</th> <?php ?>
<th>Position</th> <?php?>
</tr>
</thead>
<tbody>
<?php foreach($queue_users as $queue_user){ ?>
<tr>
<td class="mdl-data-table__cell--non-numeric"><?php echo $queue_user->id;?></td>
<td><?php echo $queue_user->queue_id ;?></td>
<td><?php echo $queue_user->position ;?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php
// }
try{
$current_position = getfirstInLine($conn, $_SESSION['id']);
echo 'Now serving: ' .$current_position;
echo '<form method="POST" action="">';
echo '<button name="next_customer" value="submit">Next customer</button>';
echo '</form>';
}
catch(Exception $e){
echo $e->getMessage();
}
}
?>
<div class="mdl-layout__container has-scrolling-header"><div class="demo-layout mdl-layout mdl-layout--fixed-header mdl-js-layout mdl-color--grey-100 is-upgraded" data-upgraded=",MaterialLayout">
<header class="demo-header mdl-layout__header mdl-layout__header--scroll mdl-color--grey-100 mdl-color-text--grey-800">
<div class="mdl-layout__header-row">
<span class="mdl-layout-title">Material Design Lite</span>
<div class="mdl-layout-spacer"></div>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--expandable is-upgraded" data-upgraded=",MaterialTextfield">
<label class="mdl-button mdl-js-button mdl-button--icon" for="search" data-upgraded=",MaterialButton">
<i class="material-icons">search</i>
</label>
<div class="mdl-textfield__expandable-holder">
<input class="mdl-textfield__input" type="text" id="search">
<label class="mdl-textfield__label" for="search">Enter your query...</label>
</div>
</div>
</div>
</header>
<div class="demo-ribbon"></div>
<main class="demo-main mdl-layout__content">
<div class="demo-container mdl-grid">
<div class="mdl-cell mdl-cell--2-col mdl-cell--hide-tablet mdl-cell--hide-phone"></div>
<div class="demo-content mdl-color--white mdl-shadow--4dp content mdl-color-text--grey-800 mdl-cell mdl-cell--8-col">
<?php
$queues = getqueues($conn);
foreach($queues as $queue){
?>
<div class="demo-card-wide mdl-card mdl-shadow--2dp" style="margin-top:20px; left:27%;">
<div class="mdl-card__title">
<h2 class="mdl-card__title-text"><?php echo $queue->location; ?></h2>
</div>
<div class="mdl-card__actions mdl-card--border">
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
<?php
echo '<a href="/restaurant.php/?id='.$queue->id.'">'.$queue->name.'</a><br>';
?>
</a>
</div>
<div class="mdl-card__menu">
<button class="mdl-button mdl-button--icon mdl-js-button mdl-js-ripple-effect">
<i class="material-icons">share</i>
</button>
</div>
</div><?php
}
?>
</div>
</div>
<footer class="demo-footer mdl-mini-footer">
<div class="mdl-mini-footer--left-section">
<ul class="mdl-mini-footer--link-list">
<li><a href="#">Help</a></li>
<li><a href="#">Privacy and Terms</a></li>
<li><a href="#">User Agreement</a></li>
</ul>
</div>
</footer>
</main>
</div></div>
</body>
</html>