110 lines
3.0 KiB
TypeScript
110 lines
3.0 KiB
TypeScript
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 SearchUser from "@/app/Components/Global/SearchUser/searchUser";
|
|
import SearchUserWithDate from "@/app/Components/Global/SearchUser/SearchUserWithDate";
|
|
import ShowError from "@/app/Components/Global/ShowError";
|
|
import Toggle from "@/app/Components/Global/Toggle/Toggle";
|
|
import QuitarSancion from "@/app/Components/QuitarSancion/QuitarSancion";
|
|
import { GetStudentWhitoutSancion } from "@/app/lib/getStudentWhitoutSancion";
|
|
|
|
export default async function Page(props: {
|
|
searchParams?: Promise<{
|
|
key?: string;
|
|
numAcount?: string;
|
|
date?: string;
|
|
}>;
|
|
}) {
|
|
const params = await props.searchParams;
|
|
const key = params?.key && params.key;
|
|
const numAcount = params?.numAcount ? params.numAcount : null;
|
|
const date = params?.date ? params.date : null;
|
|
|
|
|
|
let student: any = null;
|
|
let errorMessage = "";
|
|
|
|
if (numAcount) {
|
|
const result = await GetStudentWhitoutSancion(parseInt(numAcount));
|
|
|
|
if (result.error) {
|
|
errorMessage = `${result.error}`;
|
|
} else {
|
|
student = result;
|
|
}
|
|
}
|
|
|
|
return (
|
|
<section className="containerSection">
|
|
{errorMessage && <ShowError key={Date.now()} message={errorMessage} />}
|
|
|
|
<h2 className="title"> BITACORA Y SANCIONES </h2>
|
|
|
|
<Toggle
|
|
defaultView={key}
|
|
options={[
|
|
{
|
|
key: "Equipo",
|
|
label: "Bitácora equipo",
|
|
content: (
|
|
<>
|
|
<BitacoraEquipo date={date}/>
|
|
</>
|
|
),
|
|
},
|
|
{
|
|
key: "Alumno",
|
|
label: "Bitácora alumno",
|
|
content: (
|
|
<>
|
|
<SearchUserWithDate value={numAcount} />
|
|
<BitacoraAlumno
|
|
key={`${numAcount}-${date}`}
|
|
numAcount={numAcount}
|
|
date={date}
|
|
/>
|
|
|
|
</>
|
|
),
|
|
},
|
|
{
|
|
key: "Mesas",
|
|
label: "Bitácora mesas",
|
|
content: (
|
|
<>
|
|
<BitacoraMesas />
|
|
</>
|
|
),
|
|
},
|
|
{
|
|
key: "Sanciones",
|
|
label: "Sanciones",
|
|
content: (
|
|
<>
|
|
<SearchUser value={numAcount} />
|
|
<Sanciones student={student} />
|
|
</>
|
|
),
|
|
},
|
|
{
|
|
key: "EliminarSanciones",
|
|
label: "Eliminar Sanciones",
|
|
content: (
|
|
<>
|
|
<div className="containerSection">
|
|
<SearchUser value={numAcount} />
|
|
<QuitarSancion id_cuenta={Number(numAcount)} />
|
|
</div>
|
|
</>
|
|
),
|
|
},
|
|
]}
|
|
/>
|
|
</section>
|
|
);
|
|
}
|
|
//IO
|
|
|
|
// by Tyrannuss
|