This repository has been archived by the owner on Mar 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart_reserve.php
85 lines (73 loc) · 4.41 KB
/
cart_reserve.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
<html>
<head>
<title>ตะกร้าจอง | Food Order System</title>
<?php
session_start();
?>
<link rel="shortcut icon" href="favicon.ico" />
</head>
<body>
<?php
include("conf/header.php");
if (!isset($_SESSION['user'])) {
echo "<script>alert('กรุณาล็อคอินเข้าสู่ระบบเพื่อใช้งาน'); window.location.assign('index.php');</script>";
exit(0);
}
?>
<div class="container" style="padding-top: 90px;">
<h1 class="page-header text-center">ตะกร้าจอง</h1>
<div class="table-responsive">
<table class="table table-striped table-bordered" align="center" style="width:700px">
<thead>
<th style="text-align:right;" width="250px">หมายเลขโต๊ะ</th>
<th style="text-align:right;">จำนวนที่นั่ง (คน)</th>
<th style="width: 150px; text-align:center;">ยกเลิก</th>
</thead>
<?php
require_once("conf/connection.php");
if (!isset($_SESSION['food']['reserve'])) {
echo '<tr>
<td colspan="7" class="text-center">ไม่มีรายการจองในตะกร้า</td>
</tr>';
} else {
$count_product = count($_SESSION['food']['reserve']['tables_no']);
for ($i = 0; $i < $count_product; $i++) {
$sql_sum = "SELECT * FROM tables WHERE tables_no = '" . $_SESSION['food']['reserve']['tables_no'][$i] . "' ";
$data_sum = mysqli_query($link, $sql_sum);
$value = mysqli_fetch_assoc($data_sum);
// $sum_price[] = $_SESSION['food']['list']['food_price'][$i] * $_SESSION['food']['list']['amount'][$i];
// $product_id[] = $value['foodid'];
?>
<tr>
<td align="right"><?php echo $value['tables_no']; ?></td>
<td align="right"><?php echo $value['tables_seats']; ?></td>
<td align="center" style="padding:5px; width:10px"><a href="del_list_tables.php?tables_no=<?php echo $value['tables_no']; ?>"> <span class="glyphicon glyphicon-trash fa-2x" style="font-size:25px; color:red;" aria-hidden="true"></span></td>
</tr>
<?php } ?>
<tr>
<td align="right" colspan="1"><b>รวมทั้งหมด</b></td>
<td align="right"><b><?= number_format(array_sum($_SESSION['food']['reserve']['seats']), 0) ?></b></td>
<td align=""><b>ที่นั่ง</b></td>
</tr>
<?php } ?>
</table>
</div>
<div class="col-md-offset-3 col-md-6" style="text-align: center;">
<a class="btn btn-primary" href="show_tables.php" role="button">เพิ่มรายการ</a>
<a class="btn btn-success <?php
if (!isset($_SESSION['food']['reserve']['tables_no'])) {
echo "disabled";
} ?>" href="checkout_reserve.php" role="button">จองโต๊ะ</a>
<!--<button type="submit" class="btn btn-info" name="save" <?php
if (!isset($_SESSION['food']['reserve']['tables_no'])) {
echo "disabled";
} ?>>บันทึกข้อมูล</button> -->
<a class="btn btn-danger <?php
if (!isset($_SESSION['food']['reserve']['tables_no'])) {
echo "disabled";
} ?>" href="del_list_tables_all.php" onclick="if(confirm('ต้องการล้างตะกร้าใช่หรือไม่?')) return true; else return false;">ล้างตะกร้า</a>
</div>
</div>
</body>
<?php include("conf/footer.php"); ?>
</html>