bookings list
This commit is contained in:
@@ -96,7 +96,8 @@ def dashboard():
|
||||
listings = Listing.query.filter_by(host_id=current_user.id).all()
|
||||
users = User.query.all()
|
||||
documents = {doc.user_id: doc for doc in Document.query.all()}
|
||||
return render_template('dashboard.html', listings=listings, users=users, documents=documents)
|
||||
bookings = Booking.query.join(Listing).filter(Listing.host_id == current_user.id).all()
|
||||
return render_template('dashboard.html', listings=listings, users=users, documents=documents, bookings=bookings)
|
||||
return redirect(url_for('home'))
|
||||
|
||||
@app.route('/create-listing', methods=['GET', 'POST'])
|
||||
|
||||
@@ -34,6 +34,35 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<h2>Bookings</h2>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Booked By (User ID)</th>
|
||||
<th>Listing</th>
|
||||
<th>Location</th>
|
||||
<th>Property Type</th>
|
||||
<th>Check-in</th>
|
||||
<th>Check-out</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for booking in bookings %}
|
||||
<tr>
|
||||
<td>{{ booking.user_id }}</td>
|
||||
<td>{{ booking.listing.title if booking.listing else 'Unknown' }}</td>
|
||||
<td>{{ booking.listing.location if booking.listing else 'Unknown' }}</td>
|
||||
<td>{{ booking.listing.property_type if booking.listing else 'Unknown' }}</td>
|
||||
<td>{{ booking.check_in.strftime('%Y-%m-%d') }}</td>
|
||||
<td>{{ booking.check_out.strftime('%Y-%m-%d') }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<h2>Registered Users</h2>
|
||||
<div class="table-responsive">
|
||||
|
||||
Reference in New Issue
Block a user