diff --git a/app/(private)/Monitor/MachineTable.tsx b/app/(private)/Monitor/MachineTable.tsx index 155e73a..5045256 100644 --- a/app/(private)/Monitor/MachineTable.tsx +++ b/app/(private)/Monitor/MachineTable.tsx @@ -25,7 +25,7 @@ export default function MachineTable() { const fetchMachines = async () => { try { const res = await fetch( - `${process.env.NEXT_PUBLIC_API_URL}/equipo`, + `${process.env.NEXT_PUBLIC_API_URL}/equipo/disable`, { cache: "no-store" } ); const data = await res.json(); diff --git a/app/(private)/Monitor/MachineTableActive.tsx b/app/(private)/Monitor/MachineTableActive.tsx new file mode 100644 index 0000000..29169ed --- /dev/null +++ b/app/(private)/Monitor/MachineTableActive.tsx @@ -0,0 +1,81 @@ +"use client"; + +import { useEffect, useState } from "react"; +import styles from "./Page.module.css"; + +type Equipo = { + id_equipo: number; + nombre_equipo: string; + ubicacion: string; + activo: { + data: number[]; + }; + plataforma: { + nombre: string; + }; + areaUbicacion: { + area: string; + }; +}; + +export default function MachineTableActive() { + const [machines, setMachines] = useState([]); + const [loading, setLoading] = useState(true); + + const fetchMachines = async () => { + try { + const res = await fetch( + `${process.env.NEXT_PUBLIC_API_URL}/equipo/active`, + { cache: "no-store" }, + ); + const data = await res.json(); + setMachines(data); + } catch (error) { + console.error("Error al cargar equipos", error); + } finally { + setLoading(false); + } + }; + + useEffect(() => { + fetchMachines(); + }, []); + + if (loading) { + return

Cargando equipos...

; + } + + return ( +
+ + + + + + + + + + + + + {machines.map((machine) => { + const disponible = machine.activo.data[0] === 1; + + return ( + + + + + + + + ); + })} + +
UbicaciónNombre EquipoPlataformaÁreaDisponible
{machine.ubicacion}{machine.nombre_equipo} + {machine.plataforma.nombre} + {machine.areaUbicacion.area}{disponible ? "Sí" : "No"}
+
+ ); +} diff --git a/app/(private)/Monitor/Page.module.css b/app/(private)/Monitor/Page.module.css index 7ea84a2..d2d66f1 100644 --- a/app/(private)/Monitor/Page.module.css +++ b/app/(private)/Monitor/Page.module.css @@ -39,3 +39,39 @@ .resetButton:hover { background-color: #cc0000; } + +.WINDOWS::before { + content: ""; + display: inline-block; + width: 20px; + height: 20px; + background-image: url("/windows.png"); + background-size: contain; + background-repeat: no-repeat; + margin-right: 6px; + vertical-align: middle; +} + +.MACINTOSH::before { + content: ""; + display: inline-block; + width: 20px; + height: 20px; + background-image: url("/apple.png"); + background-size: contain; + background-repeat: no-repeat; + margin-right: 6px; + vertical-align: middle; +} + +.PROFESORES::before { + content: ""; + display: inline-block; + width: 20px; + height: 20px; + background-image: url("/teacher.png"); + background-size: contain; + background-repeat: no-repeat; + margin-right: 6px; + vertical-align: middle; +} \ No newline at end of file diff --git a/app/(private)/Monitor/page.tsx b/app/(private)/Monitor/page.tsx index f81c840..d78236b 100644 --- a/app/(private)/Monitor/page.tsx +++ b/app/(private)/Monitor/page.tsx @@ -1,23 +1,46 @@ +import Toggle from "@/app/Components/Global/Toggle/Toggle"; import MachineTable from "./MachineTable"; import styles from "./Page.module.css"; +import ToggleTable from "@/app/Components/Global/Toggle/ToggleTable"; +import MachineTableActive from "./MachineTableActive"; export default async function Page(props: { - searchParams?: Promise<{ numAcount: string }>; + searchParams?: Promise<{ numAcount: string; key: string }>; }) { const params = await props.searchParams; const numAcount = params?.numAcount ?? null; + const key = params?.key ?? "active"; return (
-

MONITOR DE MÁQUINAS DISPONIBLES

+

MONITOR DE MÁQUINAS

- +
- - + + + + ), + }, + { + key: "disable", + label: "No Disponibles", + content: ( + <> + + + ), + }, + ]} + />
); } diff --git a/app/Components/Alta/registerAlta.css b/app/Components/Alta/registerAlta.css index f81c1d8..a14c892 100644 --- a/app/Components/Alta/registerAlta.css +++ b/app/Components/Alta/registerAlta.css @@ -8,6 +8,11 @@ color: #ffffff; } +.buttonInscription{ + background-color: #007a5b; + color: white; +} + .buttonSave:not(:disabled):hover { background-color: #001f5c; } diff --git a/app/Components/Alta/registerAlta.tsx b/app/Components/Alta/registerAlta.tsx index b15cd5d..54578b9 100644 --- a/app/Components/Alta/registerAlta.tsx +++ b/app/Components/Alta/registerAlta.tsx @@ -62,9 +62,19 @@ export default function RegisterAlta(props: urlProp) { e.preventDefault(); try { - await apiClient.post("/alumno", form); + const payload = { + id_cuenta: Number(form.cuenta), + nombre: `${form.apellidoP} ${form.apellidoM} ${form.nombre}`.trim(), + fecha_nacimiento: form.fecha.replaceAll("-", ""), + correo: form.email || undefined, + id_carrera: Number(form.carrera), + genero: form.genero || undefined, + }; + + await apiClient.post("/student", payload); + setSaved(true); - toast.error("Alumno registrado correctamente"); + toast.success("Alumno registrado correctamente"); } catch (error) { console.error("Error al guardar alumno:", error); toast.error("Error al guardar alumno"); @@ -73,7 +83,7 @@ export default function RegisterAlta(props: urlProp) { const handleInscripcion = (e: React.MouseEvent) => { e.preventDefault(); - router.push("/Inscripcion"); + router.push(`/Inscripcion?numAcount=${form.cuenta}`); }; return ( @@ -150,7 +160,12 @@ export default function RegisterAlta(props: urlProp) {
- @@ -160,7 +175,12 @@ export default function RegisterAlta(props: urlProp) {
- {listMajor.map((c) => (
+ +
+ {options.find((opt) => opt.key === view)?.content} +
+ + ); +} +//IO diff --git a/app/Components/Selection/Selection.tsx b/app/Components/Selection/Selection.tsx index 27630bc..26370d8 100644 --- a/app/Components/Selection/Selection.tsx +++ b/app/Components/Selection/Selection.tsx @@ -20,15 +20,15 @@ function Selection({ const options = [ { name: "WINDOWS", - img: "https://images.icon-icons.com/2235/PNG/512/windows_os_logo_icon_134678.png", + img: "/windows.png", }, { name: "MACINTOSH", - img: "https://upload.wikimedia.org/wikipedia/commons/f/fa/Apple_logo_black.svg", + img: "apple.png", }, { name: "PROFESORES", - img: "https://cdn-icons-png.flaticon.com/512/3135/3135715.png", + img: "teacher.png", }, ]; diff --git a/app/Components/Selection/SelectionCo.tsx b/app/Components/Selection/SelectionCo.tsx index ba51d12..7393ec8 100644 --- a/app/Components/Selection/SelectionCo.tsx +++ b/app/Components/Selection/SelectionCo.tsx @@ -15,19 +15,18 @@ function SelectionCo({ const options = [ { name: "WINDOWS", - img: "https://images.icon-icons.com/2235/PNG/512/windows_os_logo_icon_134678.png", + img: "/windows.png", }, { name: "MACINTOSH", - img: "https://upload.wikimedia.org/wikipedia/commons/f/fa/Apple_logo_black.svg", + img: "apple.png", }, { name: "PROFESORES", - img: "https://cdn-icons-png.flaticon.com/512/3135/3135715.png", + img: "teacher.png", }, ]; - // ✅ SOLO las inscritas const opcionesInscritas = options.filter((option) => plataformasInscritas.includes(option.name), ); diff --git a/public/apple.png b/public/apple.png new file mode 100644 index 0000000..af00ef5 Binary files /dev/null and b/public/apple.png differ diff --git a/public/teacher.png b/public/teacher.png new file mode 100644 index 0000000..418e26a Binary files /dev/null and b/public/teacher.png differ diff --git a/public/windows.png b/public/windows.png new file mode 100644 index 0000000..50d3d77 Binary files /dev/null and b/public/windows.png differ