diff --git a/routes.py b/routes.py index c8d2c86..ef4373b 100644 --- a/routes.py +++ b/routes.py @@ -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']) diff --git a/templates/dashboard.html b/templates/dashboard.html index afd7899..8b5d25b 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -34,6 +34,35 @@ +
| Booked By (User ID) | +Listing | +Location | +Property Type | +Check-in | +Check-out | +
|---|---|---|---|---|---|
| {{ booking.user_id }} | +{{ booking.listing.title if booking.listing else 'Unknown' }} | +{{ booking.listing.location if booking.listing else 'Unknown' }} | +{{ booking.listing.property_type if booking.listing else 'Unknown' }} | +{{ booking.check_in.strftime('%Y-%m-%d') }} | +{{ booking.check_out.strftime('%Y-%m-%d') }} | +