diff --git a/.example.txt b/.example.txt deleted file mode 100644 index 4b73e25..0000000 --- a/.example.txt +++ /dev/null @@ -1 +0,0 @@ -NEXT_PUBLIC_API_URL= \ No newline at end of file diff --git a/app/(private)/ActivosMantenimiento/page.tsx b/app/(private)/ActivosMantenimiento/page.tsx index 61bb673..87949da 100644 --- a/app/(private)/ActivosMantenimiento/page.tsx +++ b/app/(private)/ActivosMantenimiento/page.tsx @@ -1,21 +1,33 @@ -"use client"; -import Areas from "@/app/Components/Equipo/ActivosMantenimiento/Areas"; -import Mesas from "@/app/Components/Equipo/ActivosMantenimiento/Mesas"; -import Equipos from "@/app/Components/Equipo/Equipos/equipos"; +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 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 +66,4 @@ export default function Page(props: {
); } +//IO diff --git a/app/(private)/Alta/page.tsx b/app/(private)/Alta/page.tsx index f78797d..167f43c 100644 --- a/app/(private)/Alta/page.tsx +++ b/app/(private)/Alta/page.tsx @@ -1,9 +1,28 @@ -import RegisterAlta from "@/app/Components/Inscripciones/Alta/registerAlta"; +import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; +import RegisterAlta from "@/app/Components/Alta/registerAlta"; + import "./style.css"; -export default function Page() { +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

diff --git a/app/(private)/AsignacionEquipo/page.tsx b/app/(private)/AsignacionEquipo/page.tsx index 67a73e7..7c5cf3d 100644 --- a/app/(private)/AsignacionEquipo/page.tsx +++ b/app/(private)/AsignacionEquipo/page.tsx @@ -1,10 +1,31 @@ -"use client"; +import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; import SearchUser from "@/app/Components/Global/SearchUser/searchUser"; import Toggle from "@/app/Components/Global/Toggle/Toggle"; -export default function Page() { +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; + return (
+ {showError && ( + + )} + + {showSuccess && ( + + )} +

ASIGNACION DE EQUIPOS

- +
@@ -34,7 +55,8 @@ export default function Page() { Cuenta - + + ), }, @@ -43,3 +65,4 @@ export default function Page() {
); } +//IO diff --git a/app/(private)/BitacoraSanciones/page.tsx b/app/(private)/BitacoraSanciones/page.tsx index 6445267..f4bb4ed 100644 --- a/app/(private)/BitacoraSanciones/page.tsx +++ b/app/(private)/BitacoraSanciones/page.tsx @@ -1,19 +1,53 @@ -import BitacoraAlumno from "@/app/Components/Reportes/BitacoraSanciones/BitacoraAlumno"; -import BitacoraEquipo from "@/app/Components/Reportes/BitacoraSanciones/BitacoraEquipo"; -import BitacoraMesas from "@/app/Components/Reportes/BitacoraSanciones/BitacoraMesas"; -import Sanciones from "@/app/Components/Reportes/BitacoraSanciones/Sanciones"; +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"; + +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

@@ -22,7 +56,7 @@ export default function Page() { ), }, { - key: "2", + key: "Alumno", label: "Bitacora alumno", content: ( <> @@ -31,7 +65,7 @@ export default function Page() { ), }, { - key: "3", + key: "Mesas", label: "Bitacora mesas", content: ( <> @@ -40,11 +74,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 66b6423..2c88235 100644 --- a/app/(private)/CambiarPass/page.tsx +++ b/app/(private)/CambiarPass/page.tsx @@ -1,8 +1,26 @@ import ChangePassword from "@/app/Components/auth/ChangePassword/changePassword"; +import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; + +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 (
+ {showError && ( + + )} + + {showSuccess && ( + + )} +

Cambiar contraseña

diff --git a/app/(private)/Impresiones/page.tsx b/app/(private)/Impresiones/page.tsx index 4c4b924..106b06e 100644 --- a/app/(private)/Impresiones/page.tsx +++ b/app/(private)/Impresiones/page.tsx @@ -3,19 +3,21 @@ import Receipt from "../../Components/Receipt/Receipt"; 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/Servicios/Impressions/impressions"; +import Impressions from "@/app/Components/Impressions/impressions"; import { GetStudent } from "@/app/lib/getStudent"; import "@/app/globals.css"; 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; @@ -34,9 +36,7 @@ export default async function Page(props: { return (
{showError && ( - <> - - + )} {showSuccess && ( @@ -56,10 +56,10 @@ export default async function Page(props: { /> ), }, { - key: "3", + key: "color", label: "Impresiones color", content: ( diff --git a/app/(private)/InformacionEquipo/page.tsx b/app/(private)/InformacionEquipo/page.tsx index 0721229..b61b282 100644 --- a/app/(private)/InformacionEquipo/page.tsx +++ b/app/(private)/InformacionEquipo/page.tsx @@ -1,12 +1,32 @@ import Toggle from "@/app/Components/Global/Toggle/Toggle"; -import ProgramSelector from "@/app/Components/Equipo/ProgramSelector/ProgramSelector"; -import Equipos from "@/app/Components/Equipo/Equipos/equipos"; +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"; -export default function Page() { +export default async function Page(props: { + searchParams?: Promise<{ + machine: string; + success?: string; + error?: string; + }>; +}) { + const params = await props.searchParams; + const machine = params?.machine ? params.machine : null; + const showSuccess = params?.success ? params.success : null; + const showError = params?.error ? params.error : null; + return (
+ {showError && ( + + )} + + {showSuccess && ( + + )} +

INFORMACION DE EQUIPOS

, + content: , }, { key: "2", @@ -44,3 +64,4 @@ export default function Page() {
); } +//IO diff --git a/app/(private)/Inscripcion/page.tsx b/app/(private)/Inscripcion/page.tsx index 168a4af..72c7c8e 100644 --- a/app/(private)/Inscripcion/page.tsx +++ b/app/(private)/Inscripcion/page.tsx @@ -3,10 +3,10 @@ import Information from "@/app/Components/Global/Information/information"; import StepNavigator from "@/app/Components/Global/StepNavigator/StepNavigator"; import Receipt from "@/app/Components/Receipt/Receipt"; import Selection from "@/app/Components/Selection/Selection"; +import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; import { GetStudent } from "@/app/lib/getStudent"; import "./inscriptions.css"; -import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; export default async function Page(props: { searchParams?: Promise<{ @@ -34,9 +34,7 @@ export default async function Page(props: { return (
{showError && ( - <> - - + )} {showSuccess && ( diff --git a/app/(private)/Inscritos/page.tsx b/app/(private)/Inscritos/page.tsx index 7195f72..6f2bd45 100644 --- a/app/(private)/Inscritos/page.tsx +++ b/app/(private)/Inscritos/page.tsx @@ -1,5 +1,16 @@ -export default function Page() { +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; + return (

INSCRITOS

diff --git a/app/(private)/Mensajes/page.tsx b/app/(private)/Mensajes/page.tsx index 4fd79b2..ac09c40 100644 --- a/app/(private)/Mensajes/page.tsx +++ b/app/(private)/Mensajes/page.tsx @@ -1,15 +1,33 @@ -"use client"; - -import EnviarMensaje from "@/app/Components/Equipo/EviarMensaje/EnviarMensaje"; +import EnviarMensaje from "@/app/Components/EviarMensaje/EnviarMensaje"; +import AlertBox from "@/app/Components/Global/AlertBox/AlertBox"; import Toggle from "@/app/Components/Global/Toggle/Toggle"; -export default function Page() { +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; + 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)/QuitarSancion/page.tsx b/app/(private)/QuitarSancion/page.tsx index 957ceb1..d33b5de 100644 --- a/app/(private)/QuitarSancion/page.tsx +++ b/app/(private)/QuitarSancion/page.tsx @@ -1,15 +1,26 @@ -"use client"; - import SearchUser from "@/app/Components/Global/SearchUser/searchUser"; import QuitarSancion from "@/app/Components/QuitarSancion/QuitarSancion"; -export default function Page() { +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; + const showError = params?.error ? params.error : null; + return ( + <> +

Quitar Sanciones

-

Quitar Sanciones

- +
+ ); } //IO diff --git a/app/(private)/Reportes/page.tsx b/app/(private)/Reportes/page.tsx index fae8ae7..7915e91 100644 --- a/app/(private)/Reportes/page.tsx +++ b/app/(private)/Reportes/page.tsx @@ -1,9 +1,10 @@ "use client"; -import { useState } from "react"; -import styles from "./Page.module.css"; // importamos el css +import styles from "./Page.module.css"; import Toggle from "@/app/Components/Global/Toggle/Toggle"; -import SearchDateBetween from "@/app/Components/Reportes/SearchDateBetween/SearchDateBetween"; +import SearchDateBetween from "@/app/Components/SearchDateBetween/SearchDateBetween"; + +import { useState } from "react"; export default function Page() { const [reportes] = useState([ diff --git a/app/Components/Equipo/ActivosMantenimiento/Areas.tsx b/app/Components/ActivosMantenimiento/Areas.tsx similarity index 100% rename from app/Components/Equipo/ActivosMantenimiento/Areas.tsx rename to app/Components/ActivosMantenimiento/Areas.tsx diff --git a/app/Components/Equipo/ActivosMantenimiento/Equipos.tsx b/app/Components/ActivosMantenimiento/Equipos.tsx similarity index 100% rename from app/Components/Equipo/ActivosMantenimiento/Equipos.tsx rename to app/Components/ActivosMantenimiento/Equipos.tsx diff --git a/app/Components/Equipo/ActivosMantenimiento/Mesas.tsx b/app/Components/ActivosMantenimiento/Mesas.tsx similarity index 100% rename from app/Components/Equipo/ActivosMantenimiento/Mesas.tsx rename to app/Components/ActivosMantenimiento/Mesas.tsx diff --git a/app/Components/Inscripciones/Alta/registerAlta.tsx b/app/Components/Alta/registerAlta.tsx similarity index 100% rename from app/Components/Inscripciones/Alta/registerAlta.tsx rename to app/Components/Alta/registerAlta.tsx diff --git a/app/Components/Reportes/BitacoraSanciones/BitacoraAlumno.tsx b/app/Components/BitacoraSanciones/BitacoraAlumno.tsx similarity index 99% rename from app/Components/Reportes/BitacoraSanciones/BitacoraAlumno.tsx rename to app/Components/BitacoraSanciones/BitacoraAlumno.tsx index f5e8ff5..4d0ffe1 100644 --- a/app/Components/Reportes/BitacoraSanciones/BitacoraAlumno.tsx +++ b/app/Components/BitacoraSanciones/BitacoraAlumno.tsx @@ -1,7 +1,8 @@ "use client"; -import { useState } from "react"; -import styles from "./Page.module.css"; import SearchDate from "../SearchDate/SearchDate"; +import { useState } from "react"; + +import styles from "./Page.module.css"; interface alumnos { tiempo_entrada: string; diff --git a/app/Components/Reportes/BitacoraSanciones/BitacoraEquipo.tsx b/app/Components/BitacoraSanciones/BitacoraEquipo.tsx similarity index 99% rename from app/Components/Reportes/BitacoraSanciones/BitacoraEquipo.tsx rename to app/Components/BitacoraSanciones/BitacoraEquipo.tsx index 29bdac9..e243683 100644 --- a/app/Components/Reportes/BitacoraSanciones/BitacoraEquipo.tsx +++ b/app/Components/BitacoraSanciones/BitacoraEquipo.tsx @@ -1,7 +1,8 @@ "use client"; -import { useState } from "react"; -import styles from "./Page.module.css"; import SearchDate from "../SearchDate/SearchDate"; +import { useState } from "react"; + +import styles from "./Page.module.css"; interface equipos { hora_entrada: string; diff --git a/app/Components/Reportes/BitacoraSanciones/BitacoraMesas.tsx b/app/Components/BitacoraSanciones/BitacoraMesas.tsx similarity index 94% rename from app/Components/Reportes/BitacoraSanciones/BitacoraMesas.tsx rename to app/Components/BitacoraSanciones/BitacoraMesas.tsx index 9d5a712..59ef913 100644 --- a/app/Components/Reportes/BitacoraSanciones/BitacoraMesas.tsx +++ b/app/Components/BitacoraSanciones/BitacoraMesas.tsx @@ -1,8 +1,8 @@ "use client"; -import { useState } from "react"; -import styles from "./Page.module.css"; - import SearchDate from "../SearchDate/SearchDate"; +import { useState } from "react"; + +import styles from "./Page.module.css"; interface tables { no_mesa: number; @@ -14,7 +14,7 @@ interface tables { function BitacoraMesas() { const [tables, setTables] = useState([]); - const [ubicacion_equipo, setUbicacionEquipo] = useState(""); + return ( <> diff --git a/app/Components/Reportes/BitacoraSanciones/Page.module.css b/app/Components/BitacoraSanciones/Page.module.css similarity index 100% rename from app/Components/Reportes/BitacoraSanciones/Page.module.css rename to app/Components/BitacoraSanciones/Page.module.css diff --git a/app/Components/BitacoraSanciones/Sanciones.tsx b/app/Components/BitacoraSanciones/Sanciones.tsx new file mode 100644 index 0000000..c0199cf --- /dev/null +++ b/app/Components/BitacoraSanciones/Sanciones.tsx @@ -0,0 +1,20 @@ +import Information from "../Global/Information/information"; +import SearchUser from "../Global/SearchUser/searchUser"; + +interface Student { + id_cuenta: string ; + nombre: string ; +} + +export default async function Sanciones(props: { student?: Student }) { + const idCuenta = props?.student?.id_cuenta ?? null; + + return ( + <> + + {props.student && ( + + )} + + ); +} diff --git a/app/Components/Reportes/BitacoraSanciones/UbicacionEquipo.tsx b/app/Components/BitacoraSanciones/UbicacionEquipo.tsx similarity index 84% rename from app/Components/Reportes/BitacoraSanciones/UbicacionEquipo.tsx rename to app/Components/BitacoraSanciones/UbicacionEquipo.tsx index b4b0c7c..1482c17 100644 --- a/app/Components/Reportes/BitacoraSanciones/UbicacionEquipo.tsx +++ b/app/Components/BitacoraSanciones/UbicacionEquipo.tsx @@ -1,4 +1,5 @@ import { useState } from "react"; + import styles from "./Page.module.css"; interface alumno_sancion { @@ -20,9 +21,8 @@ interface sancion { duracion: number; } -export default function UbicacionEquipo() { +export default function UbicacionEquipo(sanciones:alumno_sancion[]) { const [ubicacionEquipo, setUbicacionEquipo] = useState(""); - const [sanciones, setSanciones] = useState<>([]); return ( <> @@ -59,13 +59,12 @@ export default function UbicacionEquipo() { {sanciones && - sanciones.map((sancion, index) => ( + sanciones.map((s, index) => ( - {sancion.id_sancion} - {sancion.sancion} - {sancion.fecha_sancion} - {sancion.duracion} - {sancion.utilizar_hasta} + {s.sancion.id_sancion} + {s.sancion.sancion} + {s.fecha_inicio} + {s.sancion.duracion} ))} diff --git a/app/Components/Equipo/Equipos/equipos.tsx b/app/Components/Equipos/equipos.tsx similarity index 97% rename from app/Components/Equipo/Equipos/equipos.tsx rename to app/Components/Equipos/equipos.tsx index 122a384..81afc2a 100644 --- a/app/Components/Equipo/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/Equipo/EviarMensaje/EnviarMensaje.tsx b/app/Components/EviarMensaje/EnviarMensaje.tsx similarity index 100% rename from app/Components/Equipo/EviarMensaje/EnviarMensaje.tsx rename to app/Components/EviarMensaje/EnviarMensaje.tsx diff --git a/app/Components/Global/Toggle/Toggle.tsx b/app/Components/Global/Toggle/Toggle.tsx index 4a9dcff..6fc4c0c 100644 --- a/app/Components/Global/Toggle/Toggle.tsx +++ b/app/Components/Global/Toggle/Toggle.tsx @@ -1,5 +1,7 @@ "use client"; +import { useSearchParams } from "next/navigation"; +import { useRouter } from "next/navigation"; import { useState, ReactNode } from "react"; interface ToggleOption { @@ -14,8 +16,19 @@ interface ToggleProps { } export default function Toggle({ options, defaultView }: ToggleProps) { + const router = useRouter(); + const searchParams = useSearchParams(); const [view, setView] = useState(defaultView || options[0].key); + const handleClick = (key: string) => { + setView(key); + + const params = new URLSearchParams(searchParams.toString()); + params.set("key", key); + + router.replace(`${window.location.pathname}?${params.toString()}`); + }; + return (
@@ -23,7 +36,7 @@ export default function Toggle({ options, defaultView }: ToggleProps) { @@ -36,3 +49,4 @@ export default function Toggle({ options, defaultView }: ToggleProps) {
); } +//IO \ No newline at end of file diff --git a/app/Components/Servicios/Impressions/impressions.tsx b/app/Components/Impressions/impressions.tsx similarity index 93% rename from app/Components/Servicios/Impressions/impressions.tsx rename to app/Components/Impressions/impressions.tsx index 4c55d7f..1197b47 100644 --- a/app/Components/Servicios/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; } @@ -110,10 +108,11 @@ function Impressions({ costs, numAcount }: ImpressionsProps) { />
-
+
+
diff --git a/app/Components/Equipo/ProgramSelector/ProgramSelector.tsx b/app/Components/InformacionEquipos/ProgramSelector.tsx similarity index 98% rename from app/Components/Equipo/ProgramSelector/ProgramSelector.tsx rename to app/Components/InformacionEquipos/ProgramSelector.tsx index d08e070..3ea9b2c 100644 --- a/app/Components/Equipo/ProgramSelector/ProgramSelector.tsx +++ b/app/Components/InformacionEquipos/ProgramSelector.tsx @@ -12,7 +12,6 @@ function ProgramSelector({ titulo, opcion }: DatosEquipo) { return (
- {/* Label dinámico con el título que recibimos */} {/* Renderizamos UN solo