Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,41 +1,114 @@
|
|
| 1 |
-
# app.py - Main
|
| 2 |
import streamlit as st
|
| 3 |
-
import os
|
| 4 |
-
from pathlib import Path
|
| 5 |
-
|
| 6 |
-
# Import modules
|
| 7 |
from modules import auth, database, storage
|
| 8 |
-
from pages import
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.py - Main Entry Point for Empower Reports System
|
| 2 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
from modules import auth, database, storage
|
| 4 |
+
from pages import (
|
| 5 |
+
dashboard,
|
| 6 |
+
admin_management,
|
| 7 |
+
staff_management,
|
| 8 |
+
student_enrollment,
|
| 9 |
+
academic_calendar,
|
| 10 |
+
classroom_behavior,
|
| 11 |
+
student_decisions,
|
| 12 |
+
discipline_reports,
|
| 13 |
+
generate_reports,
|
| 14 |
+
report_design,
|
| 15 |
+
data_export,
|
| 16 |
+
performance_analytics,
|
| 17 |
+
visitation_day,
|
| 18 |
+
enter_results,
|
| 19 |
+
storage_management,
|
| 20 |
+
change_login
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
# Page configuration
|
| 24 |
+
st.set_page_config(page_title="Empower Reports", layout="wide")
|
| 25 |
+
|
| 26 |
+
# Initialize storage and database
|
| 27 |
+
storage_status = storage.get_storage_status()
|
| 28 |
+
st.markdown(f"<h1 style='text-align: center; color: #1e3a8a;'>Empower International Academy</h1>", unsafe_allow_html=True)
|
| 29 |
+
st.markdown(f"<p style='text-align: center; color: #666; font-size: 14px;'>{storage_status}</p>", unsafe_allow_html=True)
|
| 30 |
+
|
| 31 |
+
# Authentication
|
| 32 |
+
if not auth.is_logged_in():
|
| 33 |
+
auth.show_login_form()
|
| 34 |
+
st.stop()
|
| 35 |
+
|
| 36 |
+
# Sidebar with user info and logout
|
| 37 |
+
with st.sidebar:
|
| 38 |
+
st.success(f"Welcome, {st.session_state.username}")
|
| 39 |
+
if st.button("Logout", use_container_width=True):
|
| 40 |
+
auth.logout()
|
| 41 |
+
st.rerun()
|
| 42 |
+
|
| 43 |
+
# Storage info
|
| 44 |
+
storage.show_storage_info()
|
| 45 |
+
|
| 46 |
+
# Main menu
|
| 47 |
+
st.sidebar.title(f"Role: {st.session_state.user_role.title()}")
|
| 48 |
+
|
| 49 |
+
if st.session_state.user_role == 'admin':
|
| 50 |
+
page = st.sidebar.selectbox("Menu", [
|
| 51 |
+
"Dashboard",
|
| 52 |
+
"Performance Analytics",
|
| 53 |
+
"Admin Management",
|
| 54 |
+
"Staff Management",
|
| 55 |
+
"Student Enrollment",
|
| 56 |
+
"Academic Calendar",
|
| 57 |
+
"Classroom Behavior",
|
| 58 |
+
"Student Decisions",
|
| 59 |
+
"Discipline Reports",
|
| 60 |
+
"Generate Reports",
|
| 61 |
+
"Report Design",
|
| 62 |
+
"Data Export",
|
| 63 |
+
"Change Login Details",
|
| 64 |
+
"Visitation Day Management",
|
| 65 |
+
"Storage Management"
|
| 66 |
+
])
|
| 67 |
+
else:
|
| 68 |
+
page = st.sidebar.selectbox("Menu", [
|
| 69 |
+
"Dashboard",
|
| 70 |
+
"Enter Results",
|
| 71 |
+
"Classroom Behavior",
|
| 72 |
+
"Student Decisions",
|
| 73 |
+
"My Classes",
|
| 74 |
+
"Discipline Reports",
|
| 75 |
+
"Change Login Details"
|
| 76 |
+
])
|
| 77 |
+
|
| 78 |
+
# Route to appropriate page
|
| 79 |
+
if page == "Dashboard":
|
| 80 |
+
dashboard.show()
|
| 81 |
+
elif page == "Performance Analytics":
|
| 82 |
+
performance_analytics.show()
|
| 83 |
+
elif page == "Admin Management":
|
| 84 |
+
admin_management.show()
|
| 85 |
+
elif page == "Staff Management":
|
| 86 |
+
staff_management.show()
|
| 87 |
+
elif page == "Student Enrollment":
|
| 88 |
+
student_enrollment.show()
|
| 89 |
+
elif page == "Academic Calendar":
|
| 90 |
+
academic_calendar.show()
|
| 91 |
+
elif page == "Classroom Behavior":
|
| 92 |
+
classroom_behavior.show()
|
| 93 |
+
elif page == "Student Decisions":
|
| 94 |
+
student_decisions.show()
|
| 95 |
+
elif page == "Discipline Reports":
|
| 96 |
+
discipline_reports.show()
|
| 97 |
+
elif page == "Generate Reports":
|
| 98 |
+
generate_reports.show()
|
| 99 |
+
elif page == "Report Design":
|
| 100 |
+
report_design.show()
|
| 101 |
+
elif page == "Data Export":
|
| 102 |
+
data_export.show()
|
| 103 |
+
elif page == "Change Login Details":
|
| 104 |
+
change_login.show()
|
| 105 |
+
elif page == "Visitation Day Management":
|
| 106 |
+
visitation_day.show()
|
| 107 |
+
elif page == "Storage Management":
|
| 108 |
+
storage_management.show()
|
| 109 |
+
elif page == "Enter Results":
|
| 110 |
+
enter_results.show()
|
| 111 |
+
|
| 112 |
+
# Sidebar footer
|
| 113 |
+
st.sidebar.markdown("---")
|
| 114 |
+
st.sidebar.info("💡 **Empower Reports v4.0**\n\nComplete School Report Management System")
|