-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.hbs
368 lines (328 loc) · 13.6 KB
/
index.hbs
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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
<script src="/app.js"></script>
<script src="https://kit.fontawesome.com/fe02953daa.js" crossorigin="anonymous"></script>
</head>
<style>
.card-img-top {
height: 200px;
object-fit: cover;
}
.card {
max-width: 400px; /* set a max-width for the card */
margin: 0 auto; /* center the card horizontally */
}
#card-properties {
display: flex;
flex-direction: row;
margin-top: 20px;
margin: auto 20px auto 20px;
}
</style>
<body>
{{!-- Navigation links --}}
<nav class="navbar navbar-expand-md bg-primary navbar-dark fixed-top" style="margin: auto !important">
<a class="navbar-brand" href="#" style="font-family: 'italic', Arial, sans-serif;">DREAM_HOME</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav ml-auto">
{{#if useremail}}
<li class="nav-item">
<a class="nav-link" href="/">Home</a>
</li>
{{ else}}
<li class="nav-item">
<a class="nav-link" href="/admin" >Admin</a>
</li>
{{/if}}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Register</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="/userregister">As user</a></li>
<li><a class="dropdown-item" href="/register">As landlord</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="/userlogin">As user</a></li>
<li><a class="dropdown-item" href="/login">As landlord</a></li>
<li><a class="dropdown-item" href="/tenantlogin">As Tenant</a></li>
</ul>
</li>
</ul>
</div>
</nav>
{{!-- Body --}}
<div class="container mt-4" style="margin-top: 100px !important;">
<div class="mt-4 p-5 bg-primary text-white rounded">
<h1>Welcome home </h1>
<p>Find the house of your dreams and one that can oviously accomodate your needs </p>
</div>
</div>
<div class="container-fluid bg-primary mt-5 wow fadeIn" data-wow-delay="0.1s" style="margin: 50px auto !important; padding: 35px !important; width: 800px !important;">
<div class="container">
<form action="/search" method="POST">
<div class="row g-2">
<div class="col-md-10">
<div class="row g-2">
<div class="col-md-4">
<input type="text" name="keyword" class="form-control border-0 py-3" placeholder="Search Keyword">
</div>
<div class="col-md-4">
<select name="type" class="form-select border-0 py-1">
<option selected>Property Type</option>
<option value="rental">Villa</option>
<option value="apartment">Apartment</option>
<option value="condominium">House</option>
</select>
</div>
<div class="col-md-4">
<input type="number" id="cost" name="price" placeholder="Price">
</div>
</div>
</div>
<div class="col-md-2">
<button type="submit" class="btn btn-dark border-0 w-100 py-1" data-user-email="{{useremail}}">Search</button>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- Search End -->
<div id="propertyCarousel" class="carousel slide mt-4" data-ride="carousel" data-interval="5000" style="margin-top: 100px !important;">
<div class="carousel-inner">
{{#each properties}}
<div class="carousel-item">
<div class="row">
<div class="col">
<div class="card">
<img src="/images/{{this.image}}" class="card-img-top" alt="{{this.name}}">
<div class="card-body">
<h5 class="card-title">{{this.name}}</h5>
</div>
</div>
</div>
</div>
</div>
{{/each}}
</div>
<a class="carousel-control-prev" href="#propertyCarousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#propertyCarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<img src="/images/myim.jpeg" >
<br><br><br><br><br><br>
<div class="container-xxl py-5">
<div class="container">
<div class="row g-0 gx-5 align-items-end">
<div class="col-lg-6">
<div class="text-start mx-auto mb-5 wow slideInLeft" data-wow-delay="0.1s">
<h1 class="mb-3">Property Listing</h1>
<p>Get started, have a view on our services.</p>
</div>
</div>
<div class="col-lg-6 text-start text-lg-end wow slideInRight" data-wow-delay="0.1s">
<ul class="nav nav-pills d-inline-flex justify-content-end mb-5">
<li class="nav-item me-2">
<a class="btn btn-outline-primary active" data-bs-toggle="pill" href="#tab-1">Featured</a>
</li>
<li class="nav-item me-2">
<a class="btn btn-outline-primary" data-bs-toggle="pill" href="#tab-2">For Sale</a>
</li>
<li class="nav-item me-0">
<a class="btn btn-outline-primary" data-bs-toggle="pill" href="#tab-3">For Rent</a>
</li>
</ul>
</div>
</div>
<div class="tab-content mt-5" >
<div id="tab-1" class="tab-pane fade show p-0 active">
<div class="row g-4" id="card-properties">
{{#if useremail}}
{{#each properties}}
<div class="col-lg-4 col-md-6 wow fadeInUp" data-wow-delay="0.1s">
<div class="property-item rounded overflow-hidden">
<div class="position-relative overflow-hidden">
<a href=""><img class="img-fluid" src="/images/{{this.image}}" alt="{{this.name}}"></a>
<div class="bg-primary rounded text-white position-absolute start-0 top-0 m-4 py-1 px-3">{{this.description}}</div>
<div class="bg-white rounded-top text-primary position-absolute start-0 bottom-0 mx-4 pt-1 px-3"> {{this.type}} </div>
</div>
<div class="p-4 pb-0">
<h5 class="text-primary mb-3">UGX {{this.cost}}</h5>
<a class="d-block h5 mb-2" href="">{{this.name}}</a>
<p><i class="fa fa-map-marker-alt text-primary me-2"></i>{{this.location}}</p>
</div>
<div class="d-flex border-top">
<small class="flex-fill text-center border-end py-2"><i class="fa fa-phone text-primary me-2"></i>{{this.ownerNumber}}</small>
<small class="flex-fill text-center border-end py-2"><i class="fa fa-bed text-primary me-2"></i> {{this.bedrooms}}</small>
<small class="flex-fill text-center py-2"><i class="fa fa-bath text-primary me-2"></i> {{this.bathrooms}}</small>
<small class="flex-fill text-center py-2"> {{this.postedDate}}</small>
</div>
<div class="card-footer">
<button type="button" class="edit-button" data-toggle="modal" data-target="#editPropertyModal" data-property-id="{{this.id}}"><i class="fa fa-edit"></i> Edit</button>
<button type="button" class="like-button" data-property-id="{{this.id}}" data-user-email="{{useremail}} "><i class="fa-solid fa-thumbs-up" style="color: #0a60f5;" ></i> <span class="likes">{{this.likeCount}}</span></button>
<button type="button" class="like-button"><i class="fa-solid fa-thumbs-down" style="color: #e80202;"></i><span class="likes">{{this.dislikeCount}}</span></button>
<button type="button" class="comment-button"><i class="fa-solid fa-comment" style="color: #0a60f5;"></i></button>
<button type="button" class="lease-button" data-property-id="{{this.id}}" data-user-email="{{useremail}} " data-property-name="{{this.name}}">Lease</button>
<div class="comment-section" style="display:none;">
<textarea type="text" class="comment-input" placeholder="Add a comment..." id="comment-input-{{this.id}}"></textarea>
<button type="button" class="comment-submit" data-property-id="{{this.id}}" data-user-email="{{useremail}}">Add</button>
<div class="comment-list">
{{#each this.comment}}
<div class="comment">
<p class="comment-text">{{comment.comment_text}}</p>
</div>
{{/each}}
</div>
</div>
</div>
</div>
</div>
{{/each}}
{{/if}}
</div>
</div>
</div>
</div>
</div>
<footer class="footer mt-5 " style="margin-top: 100px !important;">
<div class="container">
<div class="row">
<div class="col-md-6">
<h5>About Us</h5>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla quam velit, vulputate eu pharetra nec, mattis ac neque.</p>
</div>
<div class="col-md-3">
<h5>Links</h5>
<ul class="list-unstyled">
<li><a href="#">Home</a></li>
<li><a href="#">Properties</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div class="col-md-3">
<h5>Contact</h5>
<address>
<strong>Company Name</strong><br>
123 Street, City<br>
Country, Postal Code<br>
<i class="fa fa-phone"></i> Phone: +1 234 567890<br>
<i class="fa fa-envelope"></i> Email: info@example.com
</address>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-12">
<p class="text-center">© 2023 Company Name. All rights reserved.</p>
</div>
</div>
</div>
</footer>
<script>
// Register the ifCond helper
Handlebars.registerHelper('first', function(v1, v2, options) {
if (v1 === v2) {
return options.fn(this);
}
return options.inverse(this);
});
</script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
// Listen for click event on like button
$('.like-button').click(function() {
// Get the property ID from the data-property-id attribute
var propertyId = $(this).data('property-id');
var userEmail = $(this).data('user-email');
// Send AJAX request to store the like
$.ajax({
url: '/like', // Replace with the appropriate server route for storing likes
method: 'POST',
data: {
propertyId: propertyId,
userEmail: userEmail
},
success: function(response) {
// Handle success response, if needed
},
error: function(error) {
// Handle error, if needed
console.log(propertyId);
}
});
});
});
//comments
// Assuming you have a click event listener for the comment-submit button
$('.comment-submit').on('click', function() {
});
$(document).ready(function() {
// Listen for click event on like button
$('.comment-submit').click(function() {
var propertyId = $(this).data('property-id');
var commentText = $('#comment-input-' + propertyId).val();
var userEmail = $(this).data('user-email');
$.ajax({
url: '/comment',
method: 'POST',
data: { propertyId: propertyId,
commentText: commentText,
userEmail:userEmail,
},
success: function(response) {
// Handle success if needed
},
error: function(error) {
// Handle error if needed
}
})
});
});
$(document).ready(function() {
// Listen for click event on like button
$('.lease-button').click(function() {
var propertyId = $(this).data('property-id');
var propertyName = $(this).data('property-name');
var userEmail = $(this).data('user-email');
$.ajax({
url: '/leaserequest',
method: 'POST',
data: { propertyId: propertyId,
propertyName: propertyName,
userEmail:userEmail,
},
success: function(response) {
// Handle success if needed
},
error: function(error) {
// Handle error if needed
}
})
});
});
$('.comment-button').click(function() {
// Toggle the comment section
$(this).siblings('.comment-section').toggle();
});
</script>
<script src="/scripts.js"></script>
</body>
</html>