forked from ugurarici/restaurant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
table.php
126 lines (124 loc) · 3.48 KB
/
table.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
<?php
function __autoload($className){
require_once "classes/".$className.".php";
}
$tblObj = new Table();
$table = $tblObj->getOne($_GET['id']);
if(! $table) die("Boyle bir masa yok.");
$menu = array(
"Yemekler" => array(
"1" => array(
"id" => "1",
"name" => "Kuru",
"price" => 5.5,
),
"2" => array(
"id" => "2",
"name" => "Pilav",
"price" => 3,
),
),
"İçecekler" => array(
"3" => array(
"id" => "3",
"name" => "Su",
"price" => 0.75,
),
"4" => array(
"id" => "4",
"name" => "Kola",
"price" => 2.3,
),
),
"Tatlılar" => array(
"5" => array(
"id" => "5",
"name" => "Künefe",
"price" => 12.5,
),
),
);
$orderedItems = array(
"35" => array(
"id" => "1",
"name" => "Kuru",
"price" => 5.5,
),
"36" => array(
"id" => "2",
"name" => "Pilav",
"price" => 3,
),
"37" => array(
"id" => "4",
"name" => "Kola",
"price" => 2.3,
),
);
?>
<!doctype html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<title>Restaurant</title>
<link rel="stylesheet" href="assets/bootstrap.min.css">
</head>
<body>
<br>
<div class="container">
<div class="row"><a href="index.php" class="btn btn-warning">< Geri</a></div>
<div class="col-sm-6">
<h1>Menü</h1>
<table class="table">
<?php
foreach($menu as $kat => $urunler):
?>
<tr>
<th><?=$kat?><span class="pull-right"><?=count($urunler)?> Ürün</span></th>
</tr>
<?php
foreach($urunler as $id => $urun):
?>
<tr>
<td>
<?=$urun['name']?>
<span class="pull-right"><?=$urun['price']?> TL
<button class="btn btn-primary">+</button>
</span>
</td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
</table>
</div>
<div class="col-sm-6">
<h1>Masa <?=$table['name']?></h1>
<table class="table">
<th>Sipariş Edilenler<span class="pull-right"><?=count($orderedItems)?> Ürün</span></th>
<?php
$totalPrice = 0.0;
foreach($orderedItems as $id => $urun):
$totalPrice += $urun['price'];
?>
<tr>
<td>
<?=$urun['name']?>
<span class="pull-right"><?=$urun['price']?> TL
<button class="btn btn-danger">-</button>
</span>
</td>
</tr>
<?php endforeach; ?>
<tr>
<th>Toplam Tutar <span class="pull-right"><?=$totalPrice?> TL</span></th>
</tr>
</table>
<button class="btn btn-danger col-xs-6">İptal Et</button>
<button class="btn btn-info col-xs-6">Taşı</button>
<br>
<br>
<button class="btn btn-success btn-block">Hesabı Kapat</button>
</div>
</div>
</body>
</html>