fixed checkbox
This commit is contained in:
@@ -20,7 +20,6 @@ export default async function Page(props: {
|
||||
const numAcount = params?.numAcount ?? null;
|
||||
const table = params?.table ?? null;
|
||||
|
||||
|
||||
let student: any = null;
|
||||
let platica: any = null;
|
||||
let inscripcion: any[] = [];
|
||||
|
||||
@@ -7,11 +7,11 @@ import ShowError from "@/app/Components/Global/ShowError";
|
||||
|
||||
import { cookies } from "next/headers";
|
||||
import { GetStudentWhitoutSancion } from "@/app/lib/getStudentWhitoutSancion";
|
||||
import { envConfig } from "@/app/lib/config";
|
||||
|
||||
import axios from "axios";
|
||||
|
||||
import "@/app/globals.css";
|
||||
import { envConfig } from "@/app/lib/config";
|
||||
|
||||
export default async function Page(props: {
|
||||
searchParams?: Promise<{
|
||||
|
||||
@@ -37,6 +37,7 @@ export default function CheckBoxEquipo({ numAcount, machine }: Props) {
|
||||
const [tiempoRestante, setTiempoRestante] = useState<string>("");
|
||||
const [minutos, setMinutos] = useState<number>();
|
||||
const [error, setError] = useState()
|
||||
const [loading, setLoading] = useState<boolean>(false)
|
||||
|
||||
const fetchByCuenta = async (idCuenta: number) => {
|
||||
const result = await getEquipoByCount(idCuenta);
|
||||
@@ -102,6 +103,7 @@ export default function CheckBoxEquipo({ numAcount, machine }: Props) {
|
||||
|
||||
const handleButton = async (e: React.MouseEvent<HTMLButtonElement>) => {
|
||||
e.preventDefault();
|
||||
setLoading(false)
|
||||
|
||||
await axios.patch(
|
||||
`${envConfig.apiUrl}/bitacora/cancelar/${bitacora.id_bitacora}`,
|
||||
@@ -122,6 +124,7 @@ export default function CheckBoxEquipo({ numAcount, machine }: Props) {
|
||||
if (modo === "Equipo" && machine) {
|
||||
fetchByEquipo(parseInt(machine));
|
||||
}
|
||||
setLoading(true)
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -155,7 +158,7 @@ export default function CheckBoxEquipo({ numAcount, machine }: Props) {
|
||||
|
||||
<h2 style={{ marginTop: "10px" }}>{error}</h2>
|
||||
|
||||
{bitacora && (
|
||||
{bitacora && tiempoRestante !== "agotado" && (
|
||||
<>
|
||||
<Information
|
||||
NoCuenta={bitacora.alumno_inscrito.alumno.id_cuenta}
|
||||
@@ -163,11 +166,12 @@ export default function CheckBoxEquipo({ numAcount, machine }: Props) {
|
||||
Tiempo={tiempoRestante}
|
||||
Equipo={bitacora.equipo.ubicacion}
|
||||
/>
|
||||
|
||||
<button
|
||||
className="button buttonSearch"
|
||||
style={{ marginTop: "1rem" }}
|
||||
onClick={handleButton}
|
||||
disabled={minutos ? false : true}
|
||||
disabled={loading || !minutos}
|
||||
>
|
||||
Cancelar tiempo
|
||||
</button>
|
||||
|
||||
@@ -141,7 +141,7 @@ export default function CheckBoxMesa({ numAcount, table }: props) {
|
||||
|
||||
<h2 style={{ marginTop: "10px" }}>{error}</h2>
|
||||
|
||||
{bitacora && (
|
||||
{bitacora && tiempoRestante !== "agotado" && (
|
||||
<>
|
||||
<Information
|
||||
NoCuenta={bitacora.alumno_inscrito.alumno.id_cuenta}
|
||||
@@ -149,11 +149,12 @@ export default function CheckBoxMesa({ numAcount, table }: props) {
|
||||
Tiempo={tiempoRestante}
|
||||
Mesa={bitacora.mesa.id_mesa}
|
||||
/>
|
||||
|
||||
<button
|
||||
className="button buttonSearch"
|
||||
style={{ marginTop: "1rem" }}
|
||||
onClick={handleButton}
|
||||
disabled={loading || minutos ? false : true}
|
||||
disabled={loading || !minutos}
|
||||
>
|
||||
Cancelar tiempo
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user