-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathroom_details.php
252 lines (206 loc) · 8.35 KB
/
room_details.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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php require('inc/links.php'); ?>
<title><?php echo $settings_r['site_title'] ?> - ROOM DETAILS</title>
</head>
<body class="bg-dark">
<?php require('inc/header.php'); ?>
<?php
if(!isset($_GET['id'])){
redirect('rooms.php');
}
$data = filteration($_GET);
$room_res = select("SELECT * FROM `rooms` WHERE `id`=? AND `status`=? AND `removed`=?",[$data['id'],1,0],'iii');
if(mysqli_num_rows($room_res)==0){
redirect('rooms.php');
}
$room_data = mysqli_fetch_assoc($room_res);
?>
<div class="container">
<div class="row">
<div class="col-12 my-5 mb-4 px-4">
<h2 class="fw-bold text-light"><?php echo $room_data['name'] ?></h2>
<div style="font-size: 14px;">
<a href="index.php" class="text-secondary text-decoration-none">HOME</a>
<span class="text-secondary"> > </span>
<a href="rooms.php" class="text-secondary text-decoration-none">ROOMS</a>
</div>
</div>
<div class="col-lg-7 col-md-12 px-4">
<div id="roomCarousel" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner">
<?php
$room_img = ROOMS_IMG_PATH."thumbnail.jpg";
$img_q = mysqli_query($con,"SELECT * FROM `room_images`
WHERE `room_id`='$room_data[id]'");
if(mysqli_num_rows($img_q)>0)
{
$active_class = 'active';
while($img_res = mysqli_fetch_assoc($img_q))
{
echo"
<div class='carousel-item $active_class'>
<img src='".ROOMS_IMG_PATH.$img_res['image']."' class='d-block w-100 rounded'>
</div>
";
$active_class='';
}
}
else{
echo"<div class='carousel-item active'>
<img src='$room_img' class='d-block w-100'>
</div>";
}
?>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#roomCarousel" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#roomCarousel" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
</div>
<div class="col-lg-5 col-md-12 px-4">
<div class="card mb-4 border-0 shadow-sm rounded-3">
<div class="card-body">
<?php
echo<<<price
<h4>₹$room_data[price] per night</h4>
price;
$rating_q = "SELECT AVG(rating) AS `avg_rating` FROM `rating_review`
WHERE `room_id`='$room_data[id]' ORDER BY `sr_no` DESC LIMIT 20";
$rating_res = mysqli_query($con,$rating_q);
$rating_fetch = mysqli_fetch_assoc($rating_res);
$rating_data = "";
if($rating_fetch['avg_rating']!=NULL)
{
for($i=0; $i < $rating_fetch['avg_rating']; $i++){
$rating_data .="<i class='bi bi-star-fill text-warning'></i> ";
}
}
echo<<<rating
<div class="mb-3">
$rating_data
</div>
rating;
$fea_q = mysqli_query($con,"SELECT f.name FROM `features` f
INNER JOIN `room_features` rfea ON f.id = rfea.features_id
WHERE rfea.room_id = '$room_data[id]'");
$features_data = "";
while($fea_row = mysqli_fetch_assoc($fea_q)){
$features_data .="<span class='badge rounded-pill bg-light text-dark text-wrap me-1 mb-1'>
$fea_row[name]
</span>";
}
echo<<<features
<div class="mb-3">
<h6 class="mb-1">Features</h6>
$features_data
</div>
features;
$fac_q = mysqli_query($con,"SELECT f.name FROM `facilities` f
INNER JOIN `room_facilities` rfac ON f.id = rfac.facilities_id
WHERE rfac.room_id = '$room_data[id]'");
$facilities_data = "";
while($fac_row = mysqli_fetch_assoc($fac_q)){
$facilities_data .="<span class='badge rounded-pill bg-light text-dark text-wrap me-1 mb-1'>
$fac_row[name]
</span>";
}
echo<<<facilities
<div class="mb-3">
<h6 class="mb-1">Facilities</h6>
$facilities_data
</div>
facilities;
echo<<<guests
<div class="mb-3">
<h6 class="mb-1">Guests</h6>
<span class="badge rounded-pill bg-light text-dark text-wrap">
$room_data[adult] Adults
</span>
<span class="badge rounded-pill bg-light text-dark text-wrap">
$room_data[children] Children
</span>
</div>
guests;
echo<<<area
<div class="mb-3">
<h6 class="mb-1">Area</h6>
<span class='badge rounded-pill bg-light text-dark text-wrap me-1 mb-1'>
$room_data[area] sq. ft.
</span>
</div>
area;
if(!$settings_r['shutdown']){
$login=0;
if(isset($_SESSION['login']) && $_SESSION['login']==true){
$login=1;
}
echo<<<book
<button onclick='checkLoginToBook($login,$room_data[id])' class="btn w-100 text-white custom-bg shadow-none mb-1">Book Now</button>
book;
}
?>
</div>
</div>
</div>
<div class="col-12 mt-4 px-4 ">
<div class="mb-5 text-light">
<h5>Description</h5>
<p>
<?php echo $room_data['description'] ?>
</p>
</div>
<div>
<h5 class="mb-3">Reviews & Ratings</h5>
<?php
$review_q = "SELECT rr.*,uc.name AS uname, uc.profile, r.name AS rname FROM `rating_review` rr
INNER JOIN `user_cred` uc ON rr.user_id = uc.id
INNER JOIN `rooms` r ON rr.room_id = r.id
WHERE rr.room_id = '$room_data[id]'
ORDER BY `sr_no` DESC LIMIT 15";
$review_res = mysqli_query($con,$review_q);
$img_path = USERS_IMG_PATH;
if(mysqli_num_rows($review_res)==0){
echo 'No reviews yet!';
}
else
{
while($row = mysqli_fetch_assoc($review_res))
{
$stars = "<i class='bi bi-star-fill text-warning'></i> ";
for($i=1; $i<$row['rating']; $i++){
$stars .= " <i class='bi bi-star-fill text-warning'></i>";
}
echo<<<reviews
<div class="mb-4">
<div class="d-flex align-items-center mb-2">
<img src="$img_path$row[profile]" class="rounded-circle" loading="lazy" width="30px">
<h6 class="m-0 ms-2">$row[uname]</h6>
</div>
<p class="mb-1">
$row[review]
</p>
<div>
$stars
</div>
</div>
reviews;
}
}
?>
</div>
</div>
</div>
</div>
<?php require('inc/footer.php'); ?>
</body>
</html>