-
Notifications
You must be signed in to change notification settings - Fork 0
/
property_list.txt
284 lines (248 loc) · 12.3 KB
/
property_list.txt
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<?php
session_start();
require "includes/database_connect.php";
$user_id = isset($_SESSION['user_id']) ? $_SESSION['user_id'] : NULL;
$city_name = $_GET["city"];
$sql_1 = "SELECT * FROM cities where name = '$city_name'";
$result_1 = mysqli_query($conn, $sql_1);
if (!$result_1) {
echo "Something went wrong!";
return;
}
$city = mysqli_fetch_assoc($result_1);
if (!$city) {
echo "Sorry! We do not have any PG listed in this city.";
return;
}
$city_id = $city['id'];
$sql_2 = "SELECT * FROM properties where city_id = '$city_id'";
$result_2 = mysqli_query($conn, $sql_2);
if (!$result_2) {
echo "Something went wrong!";
return;
}
$properties = mysqli_fetch_all($result_2, MYSQLI_ASSOC);
$sql_3 = "SELECT *
FROM interested_users_properties iup
INNER JOIN properties p ON iup.property_id = p.id
WHERE p.city_id = $city_id";
$result_3 = mysqli_query($conn, $sql_3);
if (!$result_3) {
echo "Something went wrong!";
return;
}
$interested_users_properties = mysqli_fetch_all($result_3, MYSQLI_ASSOC);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Best PG's in Mumbai | PG Life</title>
<?php
include "includes/head_links.php";
?>
<link rel="stylesheet" href="css/property_list.css">
</head>
<body>
<?php
include "includes/header.php";
?>
<nav aria-label="breadcrumb">
<ol class="breadcrumb py-2">
<li class="breadcrumb-item"><a href="home.php">Home</a></li>
<li class="breadcrumb-item active" aria-current="page"><?= $city['name'] ?></li>
</ol>
</nav>
<div class="page-container">
<div class="cards_box">
<div class="icons_card">
<div class="icons_card_box">
<div class="row justify-content-evenly">
<div class="col-sm-4">
<div class="rounded-circle">
<a href="" data-bs-toggle="modal" data-bs-target="#FilterModal"><img class="icon-img"
src="img/filter.png" /></a>
</div>
<a data-bs-toggle="modal" data-bs-target="#FilterModal" class="icon-text" href="">Filter</a>
</div>
<div class="col-sm-4">
<div class="rounded-circle">
<div class="sort-btn" data-sort="DESC">
<img class="icon-img" src="img/desc.png" alt="sort-desc" />
</div>
</div>
<a class="icon-text" href="">Highest rent first</a>
</div>
<div class="col-sm-4">
<div class="rounded-circle">
<div class="sort-btn" data-sort="ASC">
<img class="icon-img" src="img/asc.png" alt="sort-asc" />
</div>
</div>
<a class="icon-text" href="">Lowest rent first</a>
</div>
</div>
</div>
</div>
<?php
foreach ($properties as $property) {
$property_images = glob("img/properties/" . $property['id'] . "/*");
?>
<div id="properties_cards_box">
<div class="property_card property-id-<?= $property['id'] ?>">
<div class="row">
<div class="col-md-4">
<div class="image-container">
<img src="<?= $property_images[0] ?>" />
</div>
</div>
<div class="col-md-8">
<div class="row justify-content-between" id="stars-heart">
<?php
$total_ratings = ($property['rating_clean'] + $property['rating_food'] + $property['rating_safety']) / 3;
$total_ratings = round($total_ratings, 1);
?>
<div class="col-4 stars-container" title="<?= $total_ratings ?>">
<?php
$rating = $total_ratings;
for ($i = 0; $i < 5; $i++) {
if ($rating >= $i + 0.8) {
?>
<i class="fas fa-star"></i>
<?php
} else if ($rating >= $i + 0.3) {
?>
<i class="fas fa-star-half-alt"></i>
<?php
} else {
?>
<i class="far fa-star"></i>
<?php
}
}
?>
</div>
<div class="col-4 heart-container">
<div>
<?php
$interested_users_count = 0;
$is_interested = false;
foreach ($interested_users_properties as $interested_user_property) {
if ($interested_user_property['property_id'] == $property['id']) {
$interested_users_count++;
if ($interested_user_property['user_id'] == $user_id) {
$is_interested = true;
}
}
}
if ($is_interested) {
?>
<i class="is-interested-image fas fa-heart" property_id="<?= $property['id'] ?>"></i>
<?php
} else {
?>
<i class="is-interested-image far fa-heart" property_id="<?= $property['id'] ?>"></i>
<?php
}
?>
<div>
<span class="interested-user-count"><?= $interested_users_count ?></span> interested
</div>
</div>
</div>
</div>
<div class="row" id="address-card">
<div class="col-md-9">
<div id="PG-name">
<?= $property['name'] ?>
</div>
<div id="address">
<?= $property['address'] ?>
</div>
</div>
</div>
<div class="row">
<div id="gender">
<?php
if ($property['gender'] == "male") {
?>
<img src="img/male.png" />
<?php } else if ($property['gender'] == "female") {
?>
<img src="img/female.png" />
<?php } else {
?>
<img src="img/unisex.png" />
<?php
}
?>
</div>
</div>
<div class="row">
<div class="col-6 price">
<div id="price">₹ <?= number_format($property['rent']) ?>/-</div>
<div id="per-month">per month</div>
</div>
<div class="col-6 view">
<div class="row">
<div class="col-2">
<a target="_blank" href="<?= $property['map_location'] ?>"><img src="img/map.png" /></a>
</div>
<div class="col-10">
<button id="view-btn" class="btn btn-primary">
<a href="property_details.php?property_id= <?= $property['id'] ?>">View</a>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
}
if (count($properties) == 0) {
?>
<div class="no-property-container">
<p>No PG to list</p>
</div>
<?php
}
?>
<div class="modal fade" id="FilterModal" aria-labelledby="filter_modal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Filters</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
<div class="modal-body">
Gender
<div id="button-box">
<button class="btn btn-dark">No Filter</button>
<button class="btn btn-outline-dark"><i class="fas fa-venus-mars"></i>
Unisex</button>
<button class="btn btn-outline-dark"><i class="fas fa-mars"></i> Male</button>
<button class="btn btn-outline-dark"><i class="fas fa-venus"></i>
Female</button>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" data-bs-dismiss="modal">Okay</button>
</div>
</div>
</div>
</div>
<div id="space"></div>
<?php
include "includes/signup_modal.php";
include "includes/login_modal.php";
include "includes/footer.php";
?>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/property_list.js"></script>
</body>
</html>