diff --git a/app/(private)/BitacoraSanciones/page.tsx b/app/(private)/BitacoraSanciones/page.tsx
index 0731acc..6445267 100644
--- a/app/(private)/BitacoraSanciones/page.tsx
+++ b/app/(private)/BitacoraSanciones/page.tsx
@@ -1,5 +1,3 @@
-"use client";
-
import BitacoraAlumno from "@/app/Components/Reportes/BitacoraSanciones/BitacoraAlumno";
import BitacoraEquipo from "@/app/Components/Reportes/BitacoraSanciones/BitacoraEquipo";
import BitacoraMesas from "@/app/Components/Reportes/BitacoraSanciones/BitacoraMesas";
diff --git a/app/(private)/Impresiones/page.tsx b/app/(private)/Impresiones/page.tsx
index 8ebe9eb..4c4b924 100644
--- a/app/(private)/Impresiones/page.tsx
+++ b/app/(private)/Impresiones/page.tsx
@@ -3,10 +3,10 @@ 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 { GetStudent } from "@/app/lib/getStudent";
import "@/app/globals.css";
-import Impressions from "@/app/Components/Servicios/Impressions/impressions";
export default async function Page(props: {
searchParams?: Promise<{
@@ -46,7 +46,7 @@ export default async function Page(props: {
IMPRESIONES Y PLOTEO
- {student ? (
+ {student && (
<>
>
- ) : (
- <>>
)}
);
diff --git a/app/Components/Reportes/BitacoraSanciones/Sanciones.tsx b/app/Components/Reportes/BitacoraSanciones/Sanciones.tsx
index 118a3ae..28d6cf2 100644
--- a/app/Components/Reportes/BitacoraSanciones/Sanciones.tsx
+++ b/app/Components/Reportes/BitacoraSanciones/Sanciones.tsx
@@ -1,97 +1,49 @@
-"use client";
-import { useEffect, useState } from "react";
-import styles from "./Page.module.css";
import SearchUser from "../../Global/SearchUser/searchUser";
import Information from "../../Global/Information/information";
+import AlertBox from "../../Global/AlertBox/AlertBox";
import { GetStudent } from "@/app/lib/getStudent";
-import { envConfig } from "@/app/lib/config";
-interface sancion {
- no_cuenta: number;
- nombre: string;
- motivo: string;
- duracion: number;
- fecha_sancion: string;
- utilizar_hasta: number;
-}
+export default async function Sanciones(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;
-export default function Sanciones() {
- const [sanciones, setSanciones] = useState([]);
- const [ubicacion_equipo, setUbicacionEquipo] = useState("");
- const [no_cuenta, setNo_cuenta] = useState("");
+ let student: any = null;
- useEffect(() => {
- fetch(`${envConfig.apiUrl}/student/${no_cuenta}`).then(
- (
- response // Revisar
- ) => response.json().then((data) => setNo_cuenta(data[0].sancion))
- );
- }, [no_cuenta]);
+ if (numAcount) {
+ const result = await GetStudent(parseInt(numAcount));
+
+ if (result.error) {
+ showError = "alumno no encontrado";
+ } else {
+ student = result;
+ }
+ }
return (
<>
-
+ {showError && (
+ <>
+
+ >
+ )}
- {/* */}
+ {showSuccess && (
+
+ )}
-
-
-
-
-
-
- | Cuenta |
- Motivo de la sancion |
- Duracion (Semanas) |
- Fecha Sancion |
- Podra utilizar el servicio hasta |
-
-
-
- {sanciones.map((sancion, index) => (
-
- | {sancion.no_cuenta} |
- {sancion.motivo} |
- {sancion.fecha_sancion} |
- {sancion.duracion} |
- {sancion.utilizar_hasta} |
-
- ))}
-
-
-
-
+ {student && (
+
+ )}
>
);
}
diff --git a/app/Components/Reportes/BitacoraSanciones/UbicacionEquipo.tsx b/app/Components/Reportes/BitacoraSanciones/UbicacionEquipo.tsx
new file mode 100644
index 0000000..b4b0c7c
--- /dev/null
+++ b/app/Components/Reportes/BitacoraSanciones/UbicacionEquipo.tsx
@@ -0,0 +1,92 @@
+import { useState } from "react";
+import styles from "./Page.module.css";
+
+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 UbicacionEquipo() {
+ const [ubicacionEquipo, setUbicacionEquipo] = useState("");
+ const [sanciones, setSanciones] = useState<>([]);
+
+ return (
+ <>
+
+
+
+
+
+
+ | Cuenta |
+ Motivo de la sancion |
+ Duracion (Semanas) |
+ Fecha Sancion |
+ Podra utilizar el servicio hasta |
+
+
+
+ {sanciones &&
+ sanciones.map((sancion, index) => (
+
+ | {sancion.id_sancion} |
+ {sancion.sancion} |
+ {sancion.fecha_sancion} |
+ {sancion.duracion} |
+ {sancion.utilizar_hasta} |
+
+ ))}
+
+
+
+
+
+ >
+ );
+}
+//IO