diff --git a/diplomas/src/pages/alumnosVista.jsx b/diplomas/src/pages/alumnosVista.jsx index 9093e69..a9f7b11 100644 --- a/diplomas/src/pages/alumnosVista.jsx +++ b/diplomas/src/pages/alumnosVista.jsx @@ -44,15 +44,7 @@ export default function AlumnosVista() { useEffect(() => { cargarAlumnos(); - cargarCursos(); - supabaseClient - .from("pildoras") - .select("id, nombre") - .then(({ data }) => setPildoras(data || [])); - supabaseClient - .from("inyeccion") - .select("id, nombre") - .then(({ data }) => setInyecciones(data || [])); + // ...cargar cursos, inyecciones, pildoras... }, []); const cargarCursos = async () => { @@ -74,11 +66,11 @@ export default function AlumnosVista() { telefono, tipo_formacion, curso_id, - curso(id, nombre), + curso(nombre), inyeccion_id, - inyeccion(id, nombre), + inyeccion(nombre), pildoras_id, - pildoras(id, nombre) + pildoras(nombre) `) .order("id", { ascending: true }); setAlumnos(data || []); @@ -185,7 +177,7 @@ export default function AlumnosVista() {
ID | Nombre | Correo | @@ -196,39 +188,125 @@ export default function AlumnosVista() {||||
---|---|---|---|---|---|---|
{alumno.id} | -{alumno.nombre} | -{alumno.correo} | -{alumno.telefono} | -- {alumno.tipo_formacion === "curso" - ? "Curso" - : alumno.tipo_formacion === "inyeccion" - ? "Inyección" - : alumno.tipo_formacion === "pildora" - ? "Píldora" - : ""} - | -- {alumno.tipo_formacion === "curso" && alumno.curso?.nombre} - {alumno.tipo_formacion === "inyeccion" && alumno.inyeccion?.nombre} - {alumno.tipo_formacion === "pildora" && alumno.pildoras?.nombre} - | -- - | -
+ {alumno.id} + | ++ setNuevoNombre(e.target.value)} className="border rounded px-2 py-1 text-black" /> + | ++ setNuevoCorreo(e.target.value)} className="border rounded px-2 py-1 text-black" /> + | ++ setNuevoNumero(e.target.value)} className="border rounded px-2 py-1 text-black" /> + | ++ + | ++ {nuevoTipo === "curso" && ( + + )} + {nuevoTipo === "inyeccion" && ( + + )} + {nuevoTipo === "pildora" && ( + + )} + | ++ + + | +
{alumno.id} | +{alumno.nombre} | +{alumno.correo} | +{alumno.telefono} | ++ {alumno.tipo_formacion === "curso" + ? "Curso" + : alumno.tipo_formacion === "inyeccion" + ? "Inyección" + : alumno.tipo_formacion === "pildora" + ? "Píldora" + : ""} + | ++ {alumno.tipo_formacion === "curso" && alumno.curso?.nombre} + {alumno.tipo_formacion === "inyeccion" && alumno.inyeccion?.nombre} + {alumno.tipo_formacion === "pildora" && alumno.pildoras?.nombre} + | ++ + + | +