-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboard.php
177 lines (164 loc) · 6.64 KB
/
dashboard.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
<?php
session_start();
require "includes/database_connect.php";
if (!isset($_SESSION["user_id"])) {
header("location: index.php");
die();
}
$user_id = $_SESSION['user_id'];
$sql_1 = "SELECT * FROM users WHERE id = $user_id";
$result_1 = mysqli_query($conn, $sql_1);
if (!$result_1) {
echo "Something went wrong!";
return;
}
$user = mysqli_fetch_assoc($result_1);
if (!$user) {
echo "Something went wrong!";
return;
}
$sql_2 = "SELECT *
FROM interested_users_properties iup
INNER JOIN properties p ON iup.property_id = p.id
WHERE iup.user_id = $user_id";
$result_2 = mysqli_query($conn, $sql_2);
if (!$result_2) {
echo "Something went wrong!";
return;
}
$interested_properties = mysqli_fetch_all($result_2, MYSQLI_ASSOC);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Dashboard | PG Life</title>
<?php
include "includes/head_links.php";
?>
<link href="css/dashboard.css" rel="stylesheet" />
</head>
<body>
<?php
include "includes/header.php";
?>
<nav aria-label="breadcrumb">
<ol class="breadcrumb py-2">
<li class="breadcrumb-item">
<a href="index.php">Home</a>
</li>
<li class="breadcrumb-item active" aria-current="page">
Dashboard
</li>
</ol>
</nav>
<div class="my-profile page-container">
<h1>My Profile</h1>
<div class="row">
<div class="col-md-3 profile-img-container">
<i class="fas fa-user profile-img"></i>
</div>
<div class="col-md-9">
<div class="row no-gutters justify-content-between align-items-end">
<div class="profile">
<div class="name"><?= $user['full_name'] ?></div>
<div class="email"><?= $user['email'] ?></div>
<div class="phone"><?= $user['phone'] ?></div>
<div class="college"><?= $user['college_name'] ?></div>
</div>
<div class="edit">
<div class="edit-profile">Edit Profile</div>
</div>
</div>
</div>
</div>
</div>
<?php
if (count($interested_properties) > 0) {
?>
<div class="my-interested-properties">
<div class="page-container">
<h1>My Interested Properties</h1>
<?php
foreach ($interested_properties as $property) {
$property_images = glob("img/properties/" . $property['id'] . "/*");
?>
<div class="property-card property-id-<?= $property['id'] ?> row">
<div class="image-container col-md-4">
<img src="<?= $property_images[0] ?>" />
</div>
<div class="content-container col-md-8">
<div class="row no-gutters justify-content-between">
<?php
$total_rating = ($property['rating_clean'] + $property['rating_food'] + $property['rating_safety']) / 3;
$total_rating = round($total_rating, 1);
?>
<div class="star-container" title="<?= $total_rating ?>">
<?php
$rating = $total_rating;
for ($i = 0; $i < 5; $i++) {
if ($rating >= $i + 0.8) {
?>
<i class="fas fa-star"></i>
<?php
} elseif ($rating >= $i + 0.3) {
?>
<i class="fas fa-star-half-alt"></i>
<?php
} else {
?>
<i class="far fa-star"></i>
<?php
}
}
?>
</div>
<div class="interested-container">
<i class="is-interested-image fas fa-heart" property_id="<?= $property['id'] ?>"></i>
</div>
</div>
<div class="detail-container">
<div class="property-name"><?= $property['name'] ?></div>
<div class="property-address"><?= $property['address'] ?></div>
<div class="property-gender">
<?php
if ($property['gender'] == "male") {
?>
<img src="img/male.png">
<?php
} elseif ($property['gender'] == "female") {
?>
<img src="img/female.png">
<?php
} else {
?>
<img src="img/unisex.png">
<?php
}
?>
</div>
</div>
<div class="row no-gutters">
<div class="rent-container col-6">
<div class="rent">₹ <?= number_format($property['rent']) ?>/-</div>
<div class="rent-unit">per month</div>
</div>
<div class="button-container col-6">
<a href="property_detail.php?property_id=<?= $property['id'] ?>" class="btn btn-primary">View</a>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
<?php
}
?>
<?php
include "includes/footer.php";
?>
</body>
</html>