Update dashboard layout

This commit is contained in:
Nguyen Ngo
2025-08-13 15:52:14 -04:00
parent d40b7774a8
commit 7937cd1cf7
3 changed files with 1489 additions and 302 deletions
+12 -8
View File
@@ -1314,23 +1314,27 @@ def logout():
@app.route('/dashboard')
@login_required
def dashboard():
"""Main dashboard after login - Fixed to show all QR codes"""
"""Enhanced project-centric dashboard"""
try:
user = User.query.get(session['user_id'])
# Get ALL QR codes (both active and inactive) with proper error handling
# The frontend filtering will handle display logic
# Get ALL QR codes and projects for project-centric view
qr_codes = QRCode.query.order_by(QRCode.created_date.desc()).all()
projects = Project.query.order_by(Project.name.asc()).all()
return render_template('dashboard.html', user=user, qr_codes=qr_codes)
# Log dashboard access with project info
logger_handler.logger.info(f"User {session['username']} accessed project dashboard: {len(qr_codes)} QR codes, {len(projects)} projects")
return render_template('dashboard.html',
user=user,
qr_codes=qr_codes,
projects=projects)
except Exception as e:
logger_handler.log_database_error('dashboard_load', e)
print(f"Error fetching QR codes: {e}")
print(f"Error loading dashboard: {e}")
flash('Error loading dashboard. Please try again.', 'error')
qr_codes = []
user = None
return render_template('dashboard.html', user=user, qr_codes=qr_codes)
return redirect(url_for('login'))
# User management routes
@app.route('/profile', methods=['GET', 'POST'])