|
import streamlit as st
|
|
from ..database.sql_db import (
|
|
get_user,
|
|
get_student_user,
|
|
get_admin_user,
|
|
get_teacher_user,
|
|
create_student_user,
|
|
update_student_user,
|
|
delete_student_user
|
|
)
|
|
|
|
from ..database.morphosintax_mongo_db import get_student_morphosyntax_analysis
|
|
|
|
def admin_page():
|
|
st.title("Panel de Administraci贸n")
|
|
st.write(f"Bienvenido, {st.session_state.username}")
|
|
|
|
|
|
st.header("Crear Nuevo Usuario Estudiante")
|
|
new_username = st.text_input("Correo electr贸nico del nuevo usuario", key="admin_new_username")
|
|
new_password = st.text_input("Contrase帽a", type="password", key="admin_new_password")
|
|
if st.button("Crear Usuario", key="admin_create_user"):
|
|
if create_student_user(new_username, new_password):
|
|
st.success(f"Usuario estudiante {new_username} creado exitosamente")
|
|
else:
|
|
st.error("Error al crear el usuario estudiante")
|
|
|
|
|
|
st.header("Ver Datos de Estudiantes")
|
|
student_username = st.text_input("Nombre de usuario del estudiante", key="admin_view_student")
|
|
if st.button("Ver Datos", key="admin_view_student_data"):
|
|
student = get_student_user(student_username)
|
|
if student:
|
|
st.write(f"Informaci贸n del estudiante {student_username}:")
|
|
st.json(student)
|
|
|
|
student_data = get_student_morphosyntax_analysis(student_username)
|
|
if student_data:
|
|
st.write("Datos de an谩lisis del estudiante:")
|
|
st.json(student_data)
|
|
else:
|
|
st.info("No hay datos de an谩lisis para este estudiante.")
|
|
else:
|
|
st.error("Estudiante no encontrado")
|
|
|
|
|
|
if st.button("Cerrar Sesi贸n", key="admin_logout"):
|
|
st.session_state.clear()
|
|
st.experimental_rerun() |