diff --git a/app/(private)/ActivosMantenimiento/page.tsx b/app/(private)/ActivosMantenimiento/page.tsx index 658d7c9..2f0136d 100644 --- a/app/(private)/ActivosMantenimiento/page.tsx +++ b/app/(private)/ActivosMantenimiento/page.tsx @@ -1,21 +1,40 @@ -"use client"; -import SearchUser from "@/app/Components/SearchUser/searchUser"; -import Equipos from "@/app/Components/ActivosMantenimiento/Equipos"; -import Toggle from "@/app/Components/Toggle/Toggle"; import Areas from "@/app/Components/ActivosMantenimiento/Areas"; import Mesas from "@/app/Components/ActivosMantenimiento/Mesas"; +import Equipos from "@/app/Components/Equipos/equipos"; +import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; +import ClearParams from "@/app/Components/Global/ClearParams/ClearParams"; +import SearchUser from "@/app/Components/Global/SearchUser/searchUser"; +import Toggle from "@/app/Components/Global/Toggle/Toggle"; -export default function Page(props: { +export default async function Page(props: { searchParams?: Promise<{ - numAcount: string; + numAcount?: string; + machine?: string; success?: string; error?: string; }>; }) { - const params = props.searchParams; + const params = await props.searchParams; + const numAcount = params?.numAcount ? params.numAcount : null; + const showSuccess = params?.success ? params.success : null; + const showError = params?.error ? params.error : null; return (
+ {showError && ( + <> + + + + )} + + {showSuccess && ( + <> + + + + )} +

EQUIPOS ACTIVOS Y EN MANTENIMIENTO

- + ), @@ -54,3 +73,4 @@ export default function Page(props: {
); } +//IO diff --git a/app/(private)/AgregarTiempo/page.tsx b/app/(private)/AgregarTiempo/page.tsx index d3658bb..723498d 100644 --- a/app/(private)/AgregarTiempo/page.tsx +++ b/app/(private)/AgregarTiempo/page.tsx @@ -1,11 +1,12 @@ -import SearchUser from "@/app/Components/SearchUser/searchUser"; -import Information from "@/app/Components/Information/information"; +import SearchUser from "@/app/Components/Global/SearchUser/searchUser"; +import Information from "@/app/Components/Global/Information/information"; import Receipt from "@/app/Components/Receipt/Receipt"; -import AlertBox from "@/app/Components/AlertBox/AlertBox"; +import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; import { GetStudent } from "@/app/lib/getStudent"; import "./addTime.css"; +import ClearParams from "@/app/Components/Global/ClearParams/ClearParams"; export default async function Page(props: { searchParams?: Promise<{ @@ -16,34 +17,46 @@ export default async function Page(props: { }) { const params = await props.searchParams; const numAcount = params?.numAcount ? params.numAcount : null; - const showSuccess = params?.success ? parseInt(params.success) : null; - const showError = params?.error ? params.error : null; + const showSuccess = params?.success ? params.success : null; + let showError = params?.error ? params.error : null; let student: any = null; if (numAcount) { - student = await GetStudent(parseInt(numAcount)); + const result = await GetStudent(parseInt(numAcount)); + + if (result.error) { + showError = "Alumno no encontrado"; + } else { + student = result; + } } return (
{showError && ( - + <> + + + )} {showSuccess && ( - + <> + + + )}

AGREGAR TIEMPO

- + {student ? ( <>
- +
) : ( diff --git a/app/(private)/Alta/page.tsx b/app/(private)/Alta/page.tsx index acf3ec2..2e51c0a 100644 --- a/app/(private)/Alta/page.tsx +++ b/app/(private)/Alta/page.tsx @@ -1,91 +1,39 @@ -'use client' -import { useState } from "react"; -import StepNavigator from "@/app/Components/StepNavigator/StepNavigator"; +import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; +import RegisterAlta from "@/app/Components/Alta/registerAlta"; -export default function Page() { - const [step, setStep] = useState(1); - const [major, setMajor] = useState(""); +import "./style.css"; +import ClearParams from "@/app/Components/Global/ClearParams/ClearParams"; - const handleNext = (e: any) => { - e.preventDefault(); - if (step < 3) setStep(step + 1); - }; - - const handlePrev = (e: any) => { - e.preventDefault(); - if (step > 1) setStep(step - 1); - }; +export default async function Page(props: { + searchParams?: Promise<{ + success?: string; + error?: string; + }>; +}) { + const params = await props.searchParams; + const showSuccess = params?.success ? params.success : null; + const showError = params?.error ? params.error : null; return (
+ {showError && ( + <> + + + + )} + + {showSuccess && ( + <> + + + + )} +

ALTA

- console.log()}> -
- - setUser(e.target.value)} - placeholder='Coloca un número de cuenta...' - /> - - - setUser(e.target.value)} - placeholder='Coloca el nombre' - /> - - - setUser(e.target.value)} - placeholder='Coloca el apellido paterno' - /> - - - setUser(e.target.value)} - placeholder='Coloca el apellido materno' - /> -
-
- - setUser(e.target.value)} - placeholder='Coloca ' - /> - - - setUser(e.target.value)} - placeholder='Coloca ' - /> - - - - - - -
-
- -
+ +
); } -//IO \ No newline at end of file +//IO diff --git a/app/(private)/Alta/style.css b/app/(private)/Alta/style.css new file mode 100644 index 0000000..bf559d8 --- /dev/null +++ b/app/(private)/Alta/style.css @@ -0,0 +1,23 @@ +.gridAlta { + display: grid; + grid-template-columns: 1fr 1fr; +} +.containerAlta { + background-color: #f9f9f9; + width: 100%; + max-width: 900px; + padding: 1rem; + border-radius: 4px; +} + +@media (max-width: 800px) { + .gridAlta { + grid-template-columns: 1fr; + justify-items: center; + min-width: max-content; + } + + .containerAlta { + width: 80%; + } +} diff --git a/app/(private)/AsignacionEquipo/asignacionEquipos..css b/app/(private)/AsignacionEquipo/asignacionEquipos..css deleted file mode 100644 index e73c9f3..0000000 --- a/app/(private)/AsignacionEquipo/asignacionEquipos..css +++ /dev/null @@ -1,29 +0,0 @@ - -.availableTablesContainer { - /* You can add specific styles for the table list here */ - width: 45%; /* Adjust width to fit the layout */ - background-color: #f9f9f9; - border-radius: 8px; - padding: 10px; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); -} - -.tableList { - list-style: none; - padding: 0; - display: flex; - flex-direction: column; /* Or use flex-wrap to make it a grid */ - height: 200px; /* Or a fixed height with overflow */ - overflow-y: auto; -} - -.tableList li { - padding: 8px; - border-bottom: 1px solid #ddd; - cursor: pointer; - transition: background-color 0.2s; -} - -.tableList li:hover { - background-color: #f0f0f0; -} diff --git a/app/(private)/AsignacionEquipo/page.tsx b/app/(private)/AsignacionEquipo/page.tsx index f4160e9..7e4976d 100644 --- a/app/(private)/AsignacionEquipo/page.tsx +++ b/app/(private)/AsignacionEquipo/page.tsx @@ -1,10 +1,52 @@ -"use client"; -import SearchUser from "@/app/Components/SearchUser/searchUser"; -import Toggle from "@/app/Components/Toggle/Toggle"; +import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; +import ClearParams from "@/app/Components/Global/ClearParams/ClearParams"; +import SearchUser from "@/app/Components/Global/SearchUser/searchUser"; +import Toggle from "@/app/Components/Global/Toggle/Toggle"; +import { GetStudent } from "@/app/lib/getStudent"; + +import '@/app/globals.css' + +export default async function Page(props: { + searchParams?: Promise<{ + numAcount?: string; + machine?: string; + success?: string; + error?: string; + }>; +}) { + const params = await props.searchParams; + const numAcount = params?.numAcount ? params.numAcount : null; + const machine = params?.machine ? params.machine : null; + const showSuccess = params?.success ? params.success : null; + const showError = params?.error ? params.error : null; + + let student: any = null; + + if (numAcount) { + const result = await GetStudent(parseInt(numAcount)); + + if (result.error) { + } else { + student = result; + } + } -export default function Page() { return (
+ {showError && ( + <> + + + + )} + + {showSuccess && ( + <> + + + + )} +

ASIGNACION DE EQUIPOS

- + -
+ {student &&

No hay records disponibles

} ), }, @@ -34,7 +76,8 @@ export default function Page() { Cuenta - + + ), }, @@ -43,3 +86,4 @@ export default function Page() {
); } +//IO diff --git a/app/(private)/AsignacionMesas/asignacionmesas.css b/app/(private)/AsignacionMesas/asignacionmesas.css deleted file mode 100644 index e73c9f3..0000000 --- a/app/(private)/AsignacionMesas/asignacionmesas.css +++ /dev/null @@ -1,29 +0,0 @@ - -.availableTablesContainer { - /* You can add specific styles for the table list here */ - width: 45%; /* Adjust width to fit the layout */ - background-color: #f9f9f9; - border-radius: 8px; - padding: 10px; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); -} - -.tableList { - list-style: none; - padding: 0; - display: flex; - flex-direction: column; /* Or use flex-wrap to make it a grid */ - height: 200px; /* Or a fixed height with overflow */ - overflow-y: auto; -} - -.tableList li { - padding: 8px; - border-bottom: 1px solid #ddd; - cursor: pointer; - transition: background-color 0.2s; -} - -.tableList li:hover { - background-color: #f0f0f0; -} diff --git a/app/(private)/AsignacionMesas/page.tsx b/app/(private)/AsignacionMesas/page.tsx index 7551292..4396bbb 100644 --- a/app/(private)/AsignacionMesas/page.tsx +++ b/app/(private)/AsignacionMesas/page.tsx @@ -1,6 +1,6 @@ "use client"; -import SearchUser from "@/app/Components/SearchUser/searchUser"; -import Toggle from "@/app/Components/Toggle/Toggle"; +import SearchUser from "@/app/Components/Global/SearchUser/searchUser"; +import Toggle from "@/app/Components/Global/Toggle/Toggle"; import { useState } from "react"; export default function Page() { @@ -18,7 +18,7 @@ export default function Page() { label: "Asignar mesa", content: ( <> - +
@@ -56,7 +56,7 @@ export default function Page() { Cuenta - + ), }, diff --git a/app/(private)/BitacoraSanciones/page.tsx b/app/(private)/BitacoraSanciones/page.tsx index 5d68131..cc6c2cd 100644 --- a/app/(private)/BitacoraSanciones/page.tsx +++ b/app/(private)/BitacoraSanciones/page.tsx @@ -1,21 +1,60 @@ -"use client"; - -import Toggle from "@/app/Components/Toggle/Toggle"; -import Sanciones from "@/app/Components/BitacoraSanciones/Sanciones"; -import BitacoraMesas from "@/app/Components/BitacoraSanciones/BitacoraMesas"; import BitacoraAlumno from "@/app/Components/BitacoraSanciones/BitacoraAlumno"; import BitacoraEquipo from "@/app/Components/BitacoraSanciones/BitacoraEquipo"; +import BitacoraMesas from "@/app/Components/BitacoraSanciones/BitacoraMesas"; +import Sanciones from "@/app/Components/BitacoraSanciones/Sanciones"; +import Toggle from "@/app/Components/Global/Toggle/Toggle"; +import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; +import { GetStudent } from "@/app/lib/getStudent"; +import ClearParams from "@/app/Components/Global/ClearParams/ClearParams"; + +export default async function Page(props: { + searchParams?: Promise<{ + key?: string; + numAcount?: string; + success?: string; + error?: string; + }>; +}) { + const params = await props.searchParams; + const key = params?.key && params.key ; + const numAcount = params?.numAcount ? params.numAcount : null; + const showSuccess = params?.success ? params.success : null; + const showError = params?.error ? params.error : null; + + let student: any = null; + + if (numAcount) { + const result = await GetStudent(parseInt(numAcount)); + + if (result.error) { + } else { + student = result; + } + } -export default function Page() { return (
+ {showError && ( + <> + + + + )} + + {showSuccess && ( + <> + + + + )} +

BITACORA Y SANCIONES

@@ -24,7 +63,7 @@ export default function Page() { ), }, { - key: "2", + key: "Alumno", label: "Bitacora alumno", content: ( <> @@ -33,7 +72,7 @@ export default function Page() { ), }, { - key: "3", + key: "Mesas", label: "Bitacora mesas", content: ( <> @@ -42,11 +81,11 @@ export default function Page() { ), }, { - key: "4", + key: "Sanciones", label: "Sanciones", content: ( <> - + ), }, diff --git a/app/(private)/CambiarPass/page.tsx b/app/(private)/CambiarPass/page.tsx index 00fba34..23da32e 100644 --- a/app/(private)/CambiarPass/page.tsx +++ b/app/(private)/CambiarPass/page.tsx @@ -1,13 +1,37 @@ -import ChangePassword from "../../Components/ChangePassword/changePassword"; +import ChangePassword from "@/app/Components/auth/ChangePassword/changePassword"; +import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; +import ClearParams from "@/app/Components/Global/ClearParams/ClearParams"; + +export default async function Page(props: { + searchParams?: Promise<{ + success?: string; + error?: string; + }>; +}) { + const params = await props.searchParams; + const showSuccess = params?.success ? params.success : null; + const showError = params?.error ? params.error : null; -export default function Page() { return ( -
-

Cambiar contraseña

+
+ {showError && ( + <> + + + + )} - + {showSuccess && ( + <> + + + + )} + +

Cambiar contraseña

+ +
- ); } -//IO \ No newline at end of file +//IO diff --git a/app/(private)/Impresiones/page.tsx b/app/(private)/Impresiones/page.tsx index 2a95fa9..f78b77e 100644 --- a/app/(private)/Impresiones/page.tsx +++ b/app/(private)/Impresiones/page.tsx @@ -1,31 +1,34 @@ -import SearchUser from "../../Components/SearchUser/searchUser"; +import SearchUser from "../../Components/Global/SearchUser/searchUser"; import Receipt from "../../Components/Receipt/Receipt"; -import Impressions from "../../Components/Impressions/impressions"; -import Toggle from "../../Components/Toggle/Toggle"; -import Information from "../../Components/Information/information"; -import AlertBox from "@/app/Components/AlertBox/AlertBox"; +import Toggle from "../../Components/Global/Toggle/Toggle"; +import Information from "../../Components/Global/Information/information"; +import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; +import Impressions from "@/app/Components/Impressions/impressions"; import { GetStudent } from "@/app/lib/getStudent"; import "@/app/globals.css"; +import ClearParams from "@/app/Components/Global/ClearParams/ClearParams"; export default async function Page(props: { searchParams?: Promise<{ + key: string; numAcount: string; success?: string; error?: string; }>; }) { const params = await props.searchParams; + const key = params?.key && params.key; const numAcount = params?.numAcount ? params.numAcount : null; const showSuccess = params?.success ? params.success : null; - let showError = params?.error ? params.error : null; + const showError = params?.error ? params.error : null; let student: any = null; + if (numAcount) { const result = await GetStudent(parseInt(numAcount)); if (result.error) { - showError = "Alumno no encontrado"; } else { student = result; } @@ -34,17 +37,23 @@ export default async function Page(props: { return (
{showError && ( - + <> + + + )} {showSuccess && ( - + <> + + + )}

IMPRESIONES Y PLOTEO

- + - {student ? ( + {student && ( <> - ), + content: , }, { - key: "2", + key: "B/N", label: "Impresiones B/N", content: ( ), }, { - key: "3", + key: "color", label: "Impresiones color", content: ( @@ -136,8 +144,6 @@ export default async function Page(props: { ]} /> - ) : ( - <> )}
); diff --git a/app/(private)/InformacionEquipo/informacionequipo.css b/app/(private)/InformacionEquipo/informacionequipo.css index 3edf365..151831f 100644 --- a/app/(private)/InformacionEquipo/informacionequipo.css +++ b/app/(private)/InformacionEquipo/informacionequipo.css @@ -44,7 +44,6 @@ display: grid; grid-template-columns: repeat(3, 240px); /* ancho fijo por columna */ gap: 6px 20px; - margin-bottom: 20px; flex-wrap: wrap; margin-right: 2px; } diff --git a/app/(private)/InformacionEquipo/page.tsx b/app/(private)/InformacionEquipo/page.tsx index 743d05a..e664473 100644 --- a/app/(private)/InformacionEquipo/page.tsx +++ b/app/(private)/InformacionEquipo/page.tsx @@ -1,24 +1,53 @@ -import ProgramSelector from "@/app/Components/ProgramSelector/ProgramSelector"; -import Toggle from "@/app/Components/Toggle/Toggle"; +import Toggle from "@/app/Components/Global/Toggle/Toggle"; +import Equipos from "@/app/Components/Equipos/equipos"; +import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; +import ProgramSelector from "@/app/Components/InformacionEquipos/ProgramSelector"; import "./informacionequipo.css"; -import Equipos from "@/app/Components/Equipos/equipos"; +import ClearParams from "@/app/Components/Global/ClearParams/ClearParams"; + +export default async function Page(props: { + searchParams?: Promise<{ + key?:string; + machine?: string; + success?: string; + error?: string; + }>; +}) { + const params = await props.searchParams; + const key = params?.key && params.key; + const machine = params?.machine ? params.machine : null; + const showSuccess = params?.success ? params.success : null; + const showError = params?.error ? params.error : null; -export default function Page() { return (
+ {showError && ( + <> + + + + )} + + {showSuccess && ( + <> + + + + )} +

INFORMACION DE EQUIPOS

, + content: , }, { - key: "2", + key: "Equipo", label: "Programa por equipo", content: ( ); } +//IO diff --git a/app/(private)/Inscripcion/inscripcion.css b/app/(private)/Inscripcion/inscripcion.css new file mode 100644 index 0000000..7b05ca4 --- /dev/null +++ b/app/(private)/Inscripcion/inscripcion.css @@ -0,0 +1,9 @@ +.inscripcion{ + background-color: #f9f9f9; + width: 100%; + max-width: 700px; + border-radius: 4px; + padding: 1rem; + margin-top: 1rem; + outline: 1px solid #cfcfcf; +} \ No newline at end of file diff --git a/app/(private)/Inscripcion/page.tsx b/app/(private)/Inscripcion/page.tsx new file mode 100644 index 0000000..b5fd570 --- /dev/null +++ b/app/(private)/Inscripcion/page.tsx @@ -0,0 +1,71 @@ +import SearchUser from "@/app/Components/Global/SearchUser/searchUser"; +import Information from "@/app/Components/Global/Information/information"; +import Receipt from "@/app/Components/Receipt/Receipt"; +import Selection from "@/app/Components/Selection/Selection"; +import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; +import ClearParams from "@/app/Components/Global/ClearParams/ClearParams"; +import { GetStudent } from "@/app/lib/getStudent"; + +import "./inscripcion.css"; + +export default async function Page(props: { + searchParams?: Promise<{ + numAcount: string; + success?: string; + error?: string; + }>; +}) { + const params = await props.searchParams; + const numAcount = params?.numAcount ? params.numAcount : null; + const showSuccess = params?.success ? params.success : null; + let showError = params?.error ? params.error : null; + + let student: any = null; + if (numAcount) { + const result = await GetStudent(parseInt(numAcount)); + + if (result.error) { + showError = "Alumno no encontrado"; + } else { + student = result; + } + } + + return ( +
+ {showError && ( + <> + + + + )} + + {showSuccess && ( + <> + + + + )} + +

INSCRIPCION

+ + + + {student && ( + <> + +
+ + +
+ + )} +
+ ); +} +//IO diff --git a/app/(private)/Inscripciones/inscriptions.css b/app/(private)/Inscripciones/inscriptions.css deleted file mode 100644 index e69de29..0000000 diff --git a/app/(private)/Inscripciones/page.tsx b/app/(private)/Inscripciones/page.tsx deleted file mode 100644 index c14b5a4..0000000 --- a/app/(private)/Inscripciones/page.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import SearchUser from "@/app/Components/SearchUser/searchUser"; -import Information from "@/app/Components/Information/information"; -import StepNavigator from "@/app/Components/StepNavigator/StepNavigator"; -import Receipt from "@/app/Components/Receipt/Receipt"; -import Selection from "@/app/Components/Selection/Selection"; -import { GetStudent } from "@/app/lib/getStudent"; - -import "./inscriptions.css"; - -export default async function Page(props: { - searchParams?: Promise<{ - numAcount: string; - }>; -}) { - const params = await props.searchParams; - const numAcount = params?.numAcount ? params.numAcount : null; - - let student: any = null; - let error: string | null = null; - if (numAcount) { - const result = await GetStudent(parseInt(numAcount)); - - if (result.error) { - error = result.error; - } else { - student = result; - } - } - - return ( -
-

INSCRIPCION

- - - - {student ? ( - <> - - - - - - - - ) : ( - <> - )} -
- ); -} -//IO diff --git a/app/(private)/Inscritos/page.tsx b/app/(private)/Inscritos/page.tsx index 7195f72..be351f6 100644 --- a/app/(private)/Inscritos/page.tsx +++ b/app/(private)/Inscritos/page.tsx @@ -1,14 +1,39 @@ +import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; +import ClearParams from "@/app/Components/Global/ClearParams/ClearParams"; + +export default async function Page(props: { + searchParams?: Promise<{ + period: string; + success?: string; + error?: string; + }>; +}) { + const params = await props.searchParams; + const period = params?.period ? params.period : null; + const showSuccess = params?.success ? params.success : null; + const showError = params?.error ? params.error : null; -export default function Page() { return ( -
-

INSCRITOS

+
+ {showError && ( + <> + + + + )} + + {showSuccess && ( + <> + + + + )} +

INSCRITOS

- @@ -17,17 +42,14 @@ export default function Page() { -
-
- +
@@ -37,12 +59,10 @@ export default function Page() { - - +
CarreraProfesores
- ); } -//IO \ No newline at end of file +//IO diff --git a/app/(private)/Mensajes/page.tsx b/app/(private)/Mensajes/page.tsx index ed3d6b6..eaeaf38 100644 --- a/app/(private)/Mensajes/page.tsx +++ b/app/(private)/Mensajes/page.tsx @@ -1,15 +1,40 @@ -"use client"; - import EnviarMensaje from "@/app/Components/EviarMensaje/EnviarMensaje"; -import Toggle from "@/app/Components/Toggle/Toggle"; +import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; +import ClearParams from "@/app/Components/Global/ClearParams/ClearParams"; +import Toggle from "@/app/Components/Global/Toggle/Toggle"; + +export default async function Page(props: { + searchParams?: Promise<{ + key:string; + success?: string; + error?: string; + }>; +}) { + const params = await props.searchParams; + const key = params?.key && params.key ; + const showSuccess = params?.success ? params.success : null; + const showError = params?.error ? params.error : null; -export default function Page() { return (
+ {showError && ( + <> + + + + )} + + {showSuccess && ( + <> + + + + )} +

Enviar mensaje

; +}) { + const params = await props.searchParams; + const numAcount = params?.numAcount ? params.numAcount : null; + const showSuccess = params?.success ? params.success : null; + const showError = params?.error ? params.error : null; return (
@@ -144,7 +34,7 @@ export default function Page() { - {machines.map((machine, index) => ( + {/* {machines.map((machine, index) => ( {machine.ubicacion} {machine.nombre} @@ -154,7 +44,7 @@ export default function Page() { {machine.disponible ? "si" : "no"} - ))} + ))} */} diff --git a/app/(private)/Programas/page.tsx b/app/(private)/Programas/page.tsx index 3722faf..014e048 100644 --- a/app/(private)/Programas/page.tsx +++ b/app/(private)/Programas/page.tsx @@ -3,7 +3,6 @@ import { useState } from "react"; import styleprograms from "./programas.module.css"; export default function Page() { - // modo puede ser: "ver", "editar", "nuevo" const [modo, setModo] = useState("ver"); const handleNuevo = () => { @@ -62,7 +61,7 @@ export default function Page() {
-
- + + + )} ); } diff --git a/app/Components/BitacoraSanciones/TableSancion.tsx b/app/Components/BitacoraSanciones/TableSancion.tsx new file mode 100644 index 0000000..98de26c --- /dev/null +++ b/app/Components/BitacoraSanciones/TableSancion.tsx @@ -0,0 +1,76 @@ +"use client"; + +import { useEffect, useState } from "react"; +import styles from "./Page.module.css"; +import axios from "axios"; + +interface alumno_sancion { + id_alumno_sancion: number; + fecha_inicio: string; + alumno: alumno; + sancion: sancion; +} + +interface alumno { + id_cuenta: number; + nombre: string; + credito: number; +} + +interface sancion { + id_sancion: number; + sancion: string; + duracion: number; +} + +export default function TableSancion() { + const [sanciones, setSanciones] = useState(); + const [button, setButton] = useState(false); + + useEffect(() => { + const getSanciones = async () => { + const response = await axios.get( + "" + ); + setSanciones(response); + }; + getSanciones(); + }, [button]); + + const handlebutton = () => { + setButton(!button); + }; + return ( + <> +

{sanciones}

+
+ + + + + + + + + + + +
CuentaMotivo de la sancionDuracion (Semanas) Fecha SancionPodra utilizar el servicio hasta
+
+ +
+
+ +
+
+ +

{button ?

desactivado

:

activado

}

+ + ); +} +//IO diff --git a/app/Components/Equipos/equipos.tsx b/app/Components/Equipos/equipos.tsx index 122a384..81afc2a 100644 --- a/app/Components/Equipos/equipos.tsx +++ b/app/Components/Equipos/equipos.tsx @@ -30,7 +30,7 @@ export default function Equipos() {
{ setEquipo(e.target.value); diff --git a/app/Components/AlertBox/AlertBox.css b/app/Components/Global/AlertBox/AlertBox.css similarity index 50% rename from app/Components/AlertBox/AlertBox.css rename to app/Components/Global/AlertBox/AlertBox.css index f33818d..cceac3f 100644 --- a/app/Components/AlertBox/AlertBox.css +++ b/app/Components/Global/AlertBox/AlertBox.css @@ -1,3 +1,25 @@ +@keyframes slideInLeft { + 0% { + opacity: 0; + transform: translateX(-100%); + } + 100% { + opacity: 0.9; + transform: translateX(0); + } +} + +@keyframes slideOutRight { + 0% { + opacity: 0.9; + transform: translateX(0); + } + 100% { + opacity: 0; + transform: translateX(100%); + } +} + .messageBox { display: flex; position: absolute; @@ -6,20 +28,20 @@ font-weight: bold; font-size: 2rem; text-align: center; - opacity: 1; z-index: 100; top: 0; left: 0; - width: 100%; + max-width: 500px; max-height: min-content; - opacity: 0.9; - transition: opacity 0.5s ease, transform 0.5s ease; + opacity: 0; +} + +.messageBox:not(.hidden) { + animation: slideInLeft 0.5s ease forwards; } .messageBox.hidden { - opacity: 0; - pointer-events: none; - transition: opacity 1s ease-out,transform 0.5 ease; + animation: slideOutRight 0.5s ease forwards; } .success { @@ -32,4 +54,4 @@ background-color: #ffcdd2; color: #000000; border: 1px solid #ef9a9a; -} \ No newline at end of file +} diff --git a/app/Components/AlertBox/AlertBox.tsx b/app/Components/Global/AlertBox/AlertBox.tsx similarity index 93% rename from app/Components/AlertBox/AlertBox.tsx rename to app/Components/Global/AlertBox/AlertBox.tsx index e8863ea..aa295e5 100644 --- a/app/Components/AlertBox/AlertBox.tsx +++ b/app/Components/Global/AlertBox/AlertBox.tsx @@ -2,6 +2,7 @@ import { useEffect, useState } from "react"; import "./AlertBox.css"; +import ClearParams from "../ClearParams/ClearParams"; interface AlertBoxProps { message: string | null; diff --git a/app/Components/Global/ClearParams/ClearParams.tsx b/app/Components/Global/ClearParams/ClearParams.tsx new file mode 100644 index 0000000..7bf870c --- /dev/null +++ b/app/Components/Global/ClearParams/ClearParams.tsx @@ -0,0 +1,28 @@ +"use client"; + +import { useEffect } from "react"; + +interface ClearParamsProps { + paramsToClear: string[]; +} + +export default function ClearParams({ paramsToClear }: ClearParamsProps) { + useEffect(() => { + if (typeof window === "undefined") return; + const url = new URL(window.location.href); + let changed = false; + + paramsToClear.forEach((param) => { + if (url.searchParams.has(param)) { + url.searchParams.delete(param); + changed = true; + } + }); + + if (changed) { + window.history.replaceState({}, "", url.toString()); + } + }, [paramsToClear]); + + return null; +} diff --git a/app/Components/Global/FormHandle.tsx b/app/Components/Global/FormHandle.tsx new file mode 100644 index 0000000..6f3d3c9 --- /dev/null +++ b/app/Components/Global/FormHandle.tsx @@ -0,0 +1,40 @@ +"use client"; + +import { ReactNode, useCallback } from "react"; +import { useRouter, usePathname, useSearchParams } from "next/navigation"; + +interface FormHandlerProps { + children: ReactNode; + onSubmit: () => Promise; +} + +export default function FormHandler({ children, onSubmit }: FormHandlerProps) { + const router = useRouter(); + const searchParams = useSearchParams(); + const pathname = usePathname(); + + const updateParams = useCallback( + (updates: Record) => { + const params = new URLSearchParams(searchParams.toString()); + + Object.entries(updates).forEach(([key, value]) => { + if (value === null) params.delete(key); + else params.set(key, value); + }); + + router.push(`${pathname}?${params.toString()}`); + }, + [searchParams, router, pathname] + ); + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + try { + await onSubmit(); + } catch (err: any) { + updateParams({ error: String(err) }); + } + }; + + return {children}; +} diff --git a/app/Components/Information/information.tsx b/app/Components/Global/Information/information.tsx similarity index 100% rename from app/Components/Information/information.tsx rename to app/Components/Global/Information/information.tsx diff --git a/app/Components/SearchUser/searchUser.css b/app/Components/Global/SearchUser/searchUser.css similarity index 100% rename from app/Components/SearchUser/searchUser.css rename to app/Components/Global/SearchUser/searchUser.css diff --git a/app/Components/SearchUser/searchUser.tsx b/app/Components/Global/SearchUser/searchUser.tsx similarity index 67% rename from app/Components/SearchUser/searchUser.tsx rename to app/Components/Global/SearchUser/searchUser.tsx index a04d080..8057454 100644 --- a/app/Components/SearchUser/searchUser.tsx +++ b/app/Components/Global/SearchUser/searchUser.tsx @@ -1,16 +1,17 @@ -'use client' +"use client"; -import { useRouter } from "next/navigation"; +import { usePathname, useRouter, useSearchParams } from "next/navigation"; import { useEffect, useState } from "react"; -interface urlProp{ - urlBase:string - value:string|null +interface urlProp { + value: string | null; } -function SearchUser(props:urlProp) { +function SearchUser(props: urlProp) { const [numAcount, setnumAcount] = useState(""); const router = useRouter(); + const pathname = usePathname(); + const searchParams = useSearchParams(); useEffect(() => { if (props.value) { @@ -20,16 +21,17 @@ function SearchUser(props:urlProp) { const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); - + const params = new URLSearchParams(searchParams.toString()); if (numAcount) { - router.push(`/${props.urlBase}?numAcount=${numAcount}`); + params.delete("error"); + params.set("numAcount", `${numAcount}`); + router.push(`${pathname}?${params.toString()}`); } }; return ( <> -
+
{ + setView(key); + + const params = new URLSearchParams(searchParams.toString()); + params.set("key", key); + + router.replace(`${pathname}?${params.toString()}`); + }; + return (
@@ -23,7 +37,7 @@ export default function Toggle({ options, defaultView }: ToggleProps) { @@ -36,3 +50,4 @@ export default function Toggle({ options, defaultView }: ToggleProps) {
); } +//IO \ No newline at end of file diff --git a/app/Components/visual/FallingSquares/FallingSquares.tsx b/app/Components/Global/visual/FallingSquares/FallingSquares.tsx similarity index 100% rename from app/Components/visual/FallingSquares/FallingSquares.tsx rename to app/Components/Global/visual/FallingSquares/FallingSquares.tsx diff --git a/app/Components/visual/FallingSquares/style.css b/app/Components/Global/visual/FallingSquares/style.css similarity index 100% rename from app/Components/visual/FallingSquares/style.css rename to app/Components/Global/visual/FallingSquares/style.css diff --git a/app/Components/Global/visual/GlobalAlert.tsx b/app/Components/Global/visual/GlobalAlert.tsx new file mode 100644 index 0000000..a1518bf --- /dev/null +++ b/app/Components/Global/visual/GlobalAlert.tsx @@ -0,0 +1,36 @@ +"use client"; + +import { useEffect, useState } from "react"; +import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; +import ClearParams from "@/app/Components/Global/ClearParams/ClearParams"; +import { useSearchParams } from "next/navigation"; + +export default function GlobalAlert() { + const searchParams = useSearchParams(); + const [showSuccess, setShowSuccess] = useState(null); + const [showError, setShowError] = useState(null); + + useEffect(() => { + const success = searchParams.get("success"); + const error = searchParams.get("error"); + + if (success) setShowSuccess(success); + if (error) setShowError(error); + }, []); + + return ( +
+ {showError && ( + <> + + + )} + + {showSuccess && ( + <> + + + )} +
+ ); +} diff --git a/app/Components/visual/Wave/wave.module.css b/app/Components/Global/visual/Wave/wave.module.css similarity index 100% rename from app/Components/visual/Wave/wave.module.css rename to app/Components/Global/visual/Wave/wave.module.css diff --git a/app/Components/visual/Wave/wavesBack.tsx b/app/Components/Global/visual/Wave/wavesBack.tsx similarity index 100% rename from app/Components/visual/Wave/wavesBack.tsx rename to app/Components/Global/visual/Wave/wavesBack.tsx diff --git a/app/Components/Header/Header.tsx b/app/Components/Header/Header.tsx deleted file mode 100644 index 199f951..0000000 --- a/app/Components/Header/Header.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import Image from "next/image"; -import header from"./Header.module.css"; -import Link from "next/link"; - -function Header() { - return ( -
- - Logo FES - -
-
- Image of CEDETEC -
-
- ); -} - -export default Header; -//IO \ No newline at end of file diff --git a/app/Components/Impressions/Impressions.css b/app/Components/Impressions/Impressions.css deleted file mode 100644 index e69de29..0000000 diff --git a/app/Components/Impressions/impressions.tsx b/app/Components/Impressions/impressions.tsx index b0ad63d..018a35d 100644 --- a/app/Components/Impressions/impressions.tsx +++ b/app/Components/Impressions/impressions.tsx @@ -5,8 +5,6 @@ import { useState } from "react"; import { useRouter } from "next/navigation"; import { PostImpressions } from "@/app/lib/postImpressions"; -import "./Impressions.css"; - interface CostOption { value: number; } @@ -29,25 +27,24 @@ function Impressions({ costs, numAcount }: ImpressionsProps) { }; const handlePayment = async () => { + const currentUrl = new URL(window.location.href); + const params = new URLSearchParams(); + + const setError = (msg: string) => { + params.set("error", msg); + router.push(`${currentUrl}&${params.toString()}`); + }; + if (!numAcount) { - router.push( - `/Impresiones?numAcount=${numAcount}&error=Error busca denuevo al estudiante` - ); - return; + return setError("busca de nuevo al estudiante"); } if (!pages) { - router.push( - `/Impresiones?numAcount=${numAcount}&error=Ingresa el numero de hojas a imprimir` - ); - return; + return setError("Ingresa el numero de hojas a imprimir"); } if (!cost) { - router.push( - `/Impresiones?numAcount=${numAcount}&error=Selecciona un costo` - ); - return; + return setError("Selecciona un costo"); } const result = await PostImpressions({ @@ -59,18 +56,16 @@ function Impressions({ costs, numAcount }: ImpressionsProps) { if (result.error) { if (result.error === "Token inválido") handleLogout(); else { - router.push( - `/Impresiones?numAcount=${numAcount}&error=${result.error}` - ); + return setError(`Error: ${result.error}`); } return; } setPages(""); setCost(""); - router.push( - `/Impresiones?numAcount=${numAcount}&success=Impresion cobrada correctamente` - ); + params.delete("error"); + params.set("success", "Impresion cobrada correctamente"); + router.push(`${currentUrl}&${params.toString()}`); }; return ( @@ -84,7 +79,7 @@ function Impressions({ costs, numAcount }: ImpressionsProps) {
{ setconfirmNewPass(e.target.value); @@ -61,7 +61,7 @@ export default function ChangePassword() {
); } -//IO \ No newline at end of file +//IO diff --git a/public/rock2.jpg b/public/rock2.jpg new file mode 100644 index 0000000..6c4487e Binary files /dev/null and b/public/rock2.jpg differ