-
Notifications
You must be signed in to change notification settings - Fork 0
/
HomeOwner.php
265 lines (223 loc) · 7.76 KB
/
HomeOwner.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
253
254
255
256
257
258
259
260
261
262
263
264
265
<?php
include 'includes/Security_inc.php';
if ($_SESSION['role']!='home owner'){
header("Location: HomeSeeker.php");
}
include 'includes/db_connect.php';
session_start();
if (!isset($_SESSION['id'])){
header("Location: index.php");
exit();
} else {
$id=$_SESSION['id'];
}
$sql = "SELECT * FROM homeowner WHERE id = $id";
$result = mysqli_query($databaseCon, $sql);
$row = mysqli_fetch_assoc($result);
$sql1 = "SELECT p.name,p.location,hs.first_name,hs.last_name,a.status,hs.id AS HSid ,p.id ,r.id AS rid
FROM homeseeker hs,property p,rentalapplication r,applicationstatus a
WHERE r.property_id = p.id AND r.home_seeker_id = hs.id AND r.application_status_id = a.id AND p.homeowner_id = $id";
$result1 = mysqli_query($databaseCon, $sql1);
$sql2 = "SELECT p.name,pc.category ,p.rent_cost,p.rooms, p.location ,p.id AS pid
FROM Property p, propertycategory pc
WHERE homeowner_id= $id AND p.property_category_id= pc.id AND p.id NOT IN(SELECT p.id
FROM Property p ,rentalapplication r
WHERE p.id = r.property_id AND r.application_status_id = 333333)";
$result2 = mysqli_query($databaseCon, $sql2);
$sql3 = "SELECT p.homeowner_id AS HOid
FROM homeowner ho, Property p
WHERE ho.id = p.homeowner_id AND p.id= $id";
$result3 = mysqli_query($databaseCon, $sql3);
$sql4 = "SELECT p.name,pc.category ,p.rent_cost,p.rooms, p.location
FROM Property p, propertycategory pc
WHERE homeowner_id= $id AND p.property_category_id= pc.id";
$result4 = mysqli_query($databaseCon, $sql4);
?>
<!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">
<link rel="stylesheet" href="Styles\HOstyle.css">
<link rel="stylesheet" href="Styles\head.css">
<link rel="icon" href="image/Logo.png">
<title>Home Owner</title>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js">
</script>
</head>
<body class="HO_body">
<!-- Navbar -->
<header>
<div class="nav container">
<!-- Logo -->
<a href="index.php" class="logo"> <img src="image/Logo.png" alt=""> Your Home</a>
<!-- Menu Icon -->
<input type="checkbox" name="" id="menu">
<label for="menu" <i class='bx bx-menu' id="menu-icon" ></i>></label>
<!-- Nav List -->
<ul class="navbar">
<li><a href="index.php">Home</a></li>
<li><a href="index.php">About Us</a></li>
<li><a href="signout.php"><img class="logOut" src="image/logOut.png" alt="Log out" width="100" height="80"></a></li>
</ul>
</div>
</header>
<div>
<div class="WelcomeHO">
<!--<a href="index.php"><img class="logOut" src="image/logOut.png" alt="Log out" width="120" height="80"> </a>-->
<h1>Welcome <div class="HO_name"><?php echo $row["name"]." !"; ?></div></h1>
<table class="Info">
<tr>
<th>Name:</th>
<td><?php echo $row['name']?></td>
<th>Phone:</th>
<td><?php echo $row['phone_number']?></td>
<th>Email:</th>
<td><?php echo $row['email_address']?></td>
</tr>
</table>
</div>
<!-- ---------------------------------------first table -------------------------------------------------->
<table class="FirstHO_table">
<caption> <h2 class="Caption_table"> Rental Applications </h2></caption>
<thead>
<tr>
<th>Property Name</th>
<th>Location</th>
<th>Applicant’s Name</th>
<th>Status</th>
</tr>
</thead>
<tbody id="Ftable">
</tbody>
</table>
<div class='Add_button'><button><a href='AddNewProperty.php'>Add New Proproty</a></button></div>
<!-- ---------------------------------------second table -------------------------------------------------->
<table class="SecondHO_table">
<caption> <h2 class="Caption_table"> Listed Property </h2></caption>
<tr>
<th>Property Name</th>
<th>Category</th>
<th>Rent</th>
<th>Rooms</th>
<th>Location</th>
</tr>
<tbody id="Stable">
</tbody>
</table>
</div>
<!-- copyright -->
<br>
<div class="copyright" style="margin-block-start: 133px;">
<p>© YOUR HOME 2023.com</p>
</div>
<script>
$(document).ready(function (){
populate_Ftable();
populate_Stable();
});
function populate_Ftable(){
console.log("F");
$.ajax({
url:'Ftbale.php',
type:'POST',
success:function(data){
$("#Ftable").html(data);
}
});
}
function populate_Stable(){
console.log("S");
$.ajax({
url:'Stable.php',
type:'POST',
success:function(data){
$("#Stable").html(data);
}
});
}
// Function
function deletedata(id){
$.ajax({
// Action
url: 'Delete.php',
// Method
type: 'POST',
data: {
// Get value
id: id,
action: "delete"
},
success:function(response){
// Response is the output of action file
if(response == 1){
//$(#'delete'+id).hide('slow');
populate_Ftable();
populate_Stable();
alert("Data Deleted Successfully");
//window.location.reload();
}
else if(response == 0){
alert("Data Cannot Be Deleted");
}
}
});
}
function Acceptdata(id,propID){
$.ajax({
// Action
url: 'updateStatus.php',
// Method
type: 'POST',
data: {
// Get value
id: id,
propID: propID,
action: "accept"
},
success:function(response){
if(response == 1){
populate_Ftable();
populate_Stable();
alert("Data Accepted Successfully");
//window.location.reload();
}
else if(response == 0){
alert("Data Cannot Be Accepted");
}
}
});
}
function Declindata(id,propID){
$.ajax({
// Action
url: 'updateStatus.php',
// Method
type: 'POST',
data: {
// Get value
id: id,
propID: propID,
action: "declin"
},
success:function(response){
if(response == 1){
populate_Ftable();
populate_Stable();
alert("Data Declined Successfully");
//window.location.reload();
}
else if(response == 0){
alert("Data Cannot Be Declined");
}
}
});
}
</script>
</body>
<?php
mysqli_close($connection);
?>
</html>