-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.php
More file actions
118 lines (109 loc) · 5.63 KB
/
index.php
File metadata and controls
118 lines (109 loc) · 5.63 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
<!DOCTYPE html>
<html lang="en">
<head>
<?php session_start(); include("conn_db.php"); include('head.php');?>
<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 href="css/main.css" rel="stylesheet">
<style>
html {
height: 100%;
}
</style>
<title>Welcome | EATERIO</title>
</head>
<body class="d-flex flex-column h-100">
<?php include('nav_header.php')?>
<div class="position-relative d-flex text-center text-white promo-banner-bg py-3">
<div class="p-lg-2 mx-auto my-5">
<h1 class="display-5 fw-normal">Welcome to EATERIO</h1>
<p class="lead fw-normal">Food ordering system of SIIT Bangkradi Campus Canteen</p>
<span class="xsmall-font text-muted">Food photo created by jcomp - www.freepik.com</span>
</div>
</div>
<div class="container p-5" id="recommended-shop">
<h2 class="border-bottom pb-2"><i class="bi bi-shop align-top"></i> Recommended For You</h2>
<!-- GRID SHOP SELECTION -->
<div class="row row-cols-1 row-cols-lg-3 align-items-stretch g-4 py-3">
<?php
$query = "SELECT s_id,s_name,s_openhour,s_closehour,s_status,s_preorderstatus,s_pic FROM shop
WHERE (s_preorderstatus = 1) OR (s_preorderstatus = 0 AND (CURTIME() BETWEEN s_openhour AND s_closehour));";
$result = $mysqli -> query($query);
if($result -> num_rows > 0){
while($row = $result -> fetch_array()){
?>
<!-- GRID EACH SHOP -->
<div class="col">
<a href="<?php echo "shop_menu.php?s_id=".$row["s_id"]?>" class="text-decoration-none text-dark">
<div class="card rounded-25">
<img <?php
if(is_null($row["s_pic"])){echo "src='img/default.png'";}
else{echo "src=\"img/{$row['s_pic']}\"";}
?> style="width:100%; height:175px; object-fit:cover;"
class="card-img-top rounded-25 img-fluid" alt="<?php echo $row["s_name"]?>">
<div class="card-body">
<h4 name="shop-name" class="card-title"><?php echo $row["s_name"]?></h4>
<p class="card-subtitle">
<?php
$now = date('H:i:s');
if((($now < $row["s_openhour"])||($now > $row["s_closehour"]))||($row["s_status"]==0)){
?>
<span class="badge rounded-pill bg-danger">Closed</span>
<?php }else{ ?>
<span class="badge rounded-pill bg-success">Open</span>
<?php }
if($row["s_preorderstatus"]==1){
?>
<span class="badge rounded-pill bg-success">Pre-order avaliable</span>
<?php }else{ ?>
<span class="badge rounded-pill bg-danger">Pre-order Unavaliable</span>
<?php } ?>
</p>
<?php
$open = explode(":",$row["s_openhour"]);
$close = explode(":",$row["s_closehour"]);
?>
<p class="card-text my-2">Open hours:
<?php echo $open[0].":".$open[1]." - ".$close[0].":".$close[1];?></p>
<div class="text-end">
<a href="<?php echo "shop_menu.php?s_id=".$row["s_id"]?>"
class="btn btn-sm btn-outline-dark">Go to shop</a>
</div>
</div>
</div>
</a>
</div>
<!-- END GRID EACH SHOP -->
<?php }
}else{
?>
<div class="row row-cols-1 w-100">
<div class="col mt-4 pt-3 px-3 bg-danger text-white rounded text-center">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor"
class="bi bi-x-circle" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
<path
d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" />
</svg>
<p class="ms-2 mt-2">No shop currently avaliable to order.</p>
</div>
</div>
<?php
}
$result -> free_result();
?>
</div>
<!-- END GRID SHOP SELECTION -->
</div>
<footer
class="footer d-flex flex-wrap justify-content-between align-items-center px-5 py-3 mt-auto bg-secondary text-light">
<span class="smaller-font">© 2021 SeriousEater Group<br /><span class="xsmall-font">Paphana Y. Sirada C.
Thanakit L.</span></span>
<ul class="nav justify-content-end list-unstyled d-flex">
<li class="ms-3"><a class="text-light" target="_blank" href="https://github.com/waterthatfrozen/EATERIO"><i
class="bi bi-github"></i></a></li>
</ul>
</footer>
</body>
</html>