tring to do mesa
This commit is contained in:
@@ -8,13 +8,13 @@ import Table from "@/app/Components/Global/table";
|
||||
|
||||
import { envConfig } from "@/app/lib/config";
|
||||
import { GetRegisterStudent } from "@/app/lib/getRegisterStudent";
|
||||
import axios from "axios";
|
||||
|
||||
async function getInscripcion(idCuenta: number) {
|
||||
try {
|
||||
const res = await fetch(
|
||||
`${envConfig.apiUrl}/alumno-inscrito/${idCuenta}`,
|
||||
{ cache: "no-store" }
|
||||
);
|
||||
const res = await fetch(`${envConfig.apiUrl}/alumno-inscrito/${idCuenta}`, {
|
||||
cache: "no-store",
|
||||
});
|
||||
|
||||
if (!res.ok) throw new Error("Error al cargar inscripción");
|
||||
return await res.json();
|
||||
@@ -42,13 +42,8 @@ export default async function Page(props: {
|
||||
if (numAcount) {
|
||||
const idCuenta = parseInt(numAcount);
|
||||
|
||||
const result = await GetRegisterStudent(idCuenta);
|
||||
|
||||
if (result.error) {
|
||||
errorMessage = result.error;
|
||||
} else {
|
||||
student = result[0]?.alumno;
|
||||
}
|
||||
const result = await axios.get(`${envConfig.apiUrl}/bitacora-mesa/cuenta/${idCuenta}`);
|
||||
student = result.data
|
||||
|
||||
const inscResult = await getInscripcion(idCuenta);
|
||||
if (!inscResult.error && Array.isArray(inscResult)) {
|
||||
@@ -104,7 +99,7 @@ export default async function Page(props: {
|
||||
{
|
||||
key: "Liberar",
|
||||
label: "Cancelar mesa",
|
||||
content: <CheckBoxMesa numAcount={numAcount} />,
|
||||
content: <CheckBoxMesa numAcount={numAcount} student={student} />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
@@ -26,7 +26,7 @@ export default function MachineTable() {
|
||||
try {
|
||||
const res = await fetch(
|
||||
`${process.env.NEXT_PUBLIC_API_URL}/equipo/disable`,
|
||||
{ cache: "no-store" }
|
||||
{ cache: "no-store" },
|
||||
);
|
||||
const data = await res.json();
|
||||
setMachines(data);
|
||||
@@ -66,12 +66,11 @@ export default function MachineTable() {
|
||||
<tr key={machine.id_equipo}>
|
||||
<td>{machine.ubicacion}</td>
|
||||
<td>{machine.nombre_equipo}</td>
|
||||
<td>{machine.plataforma.nombre}</td>
|
||||
<td>{machine.areaUbicacion.area}</td>
|
||||
<td
|
||||
>
|
||||
{disponible ? "Sí" : "No"}
|
||||
<td className={styles[machine.plataforma.nombre]}>
|
||||
{machine.plataforma.nombre}
|
||||
</td>
|
||||
<td>{machine.areaUbicacion.area}</td>
|
||||
<td>{disponible ? "Sí" : "No"}</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -18,7 +18,7 @@ export default async function Page(props: {
|
||||
<div className={styles.actions}>
|
||||
<button className={styles.resetButton}>Actualizar información</button>
|
||||
</div>
|
||||
<ToggleTable
|
||||
<Toggle
|
||||
defaultView={key}
|
||||
options={[
|
||||
{
|
||||
|
||||
@@ -3,12 +3,20 @@
|
||||
import { useState } from "react";
|
||||
import SearchUser from "./Global/SearchUser/searchUser";
|
||||
import SearchBoxEquipo from "./SearchEquipo";
|
||||
import Information from "./Global/Information/information";
|
||||
|
||||
export default function CheckBoxMesa({
|
||||
numAcount,
|
||||
}: {
|
||||
numAcount?: string | null;
|
||||
}) {
|
||||
interface props {
|
||||
numAcount: string | null;
|
||||
student: {
|
||||
id_cuenta: number;
|
||||
nombre: string;
|
||||
carrera:{
|
||||
carrera:string;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default function CheckBoxMesa({ numAcount, student }: props) {
|
||||
const [modo, setModo] = useState<"Mesa" | "Cuenta" | null>(null);
|
||||
|
||||
return (
|
||||
@@ -39,6 +47,10 @@ export default function CheckBoxMesa({
|
||||
|
||||
{modo === "Cuenta" && <SearchUser value={numAcount ?? null} />}
|
||||
{modo === "Mesa" && <SearchBoxEquipo />}
|
||||
|
||||
{student && (
|
||||
<Information NoCuenta={student.id_cuenta} nombre={student.nombre} carrera={student.carrera?.carrera}/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user