diff --git a/routes.py b/routes.py index cc5fdb9..b43b597 100644 --- a/routes.py +++ b/routes.py @@ -84,12 +84,14 @@ def verify_document(document_id): return redirect(url_for('dashboard')) return redirect(url_for('home')) -@app.route('/dashboard') +@app.route('/dashboard', methods=['GET', 'POST']) @login_required def dashboard(): if current_user.is_host: listings = Listing.query.filter_by(host_id=current_user.id).all() - return render_template('dashboard.html', listings=listings) + 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) return redirect(url_for('home')) @app.route('/create-listing', methods=['GET', 'POST']) diff --git a/templates/dashboard.html b/templates/dashboard.html index ae34c26..afd7899 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -1,20 +1,77 @@ {% extends 'base.html' %} {% block title %}Dashboard{% endblock %} + {% block content %} -
| ID | +Phone | +Document | +Actions | +|
|---|---|---|---|---|
| {{ user.id }} | +{{ user.email }} | +{{ user.phone }} | ++ {% if user.id in documents %} + View Document + {% else %} + Not Verified + {% endif %} + | ++ {% if user.id in documents and not documents[user.id].verified %} + + {% endif %} + | +