File size: 1,420 Bytes
a05a841
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
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
42
43
44
45
46
# pages/student_pages.py - Student pages
import streamlit as st
from modules.database import Session, Student, Mark, AcademicTerm

def show_student_menu():
    """Show student menu and handle routing"""
    page = st.sidebar.selectbox("Menu", [
        "Dashboard", "My Reports", "Change Login Details"
    ])
    
    if page == "Dashboard":
        from pages import dashboard
        dashboard.show()
    elif page == "My Reports":
        show_my_reports()
    elif page == "Change Login Details":
        show_change_login()

def show_my_reports():
    """My reports page"""
    st.header("πŸ“„ My Reports")
    session = Session()
    
    # Get student reports
    student_id = st.session_state.user_id
    reports = session.query(Mark).filter_by(student_id=student_id).all()
    
    if reports:
        for report in reports:
            st.write(f"β€’ {report.subject}: {report.total} ({report.grade})")
    else:
        st.info("No reports available")
    
    session.close()

def show_change_login():
    """Change login details page"""
    st.header("πŸ” Change Login Details")
    
    with st.form("change_login"):
        new_email = st.text_input("New Email")
        current_pass = st.text_input("Current Password", type="password")
        new_pass = st.text_input("New Password", type="password")
        
        if st.form_submit_button("Update"):
            st.success("Login details updated")