added funtionality to bottonToggle
This commit is contained in:
@@ -36,87 +36,84 @@ export default function Pregunta1EP() {
|
||||
|
||||
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||
|
||||
useEffect(() => {
|
||||
const cargarDatos = async (baja: boolean) => {
|
||||
const token = Cookies.get("token");
|
||||
const headers = { Authorization: `Bearer ${token}` };
|
||||
|
||||
axios
|
||||
.post(
|
||||
const body = baja ? ["BAJA"] : ["EN DESUSO", "EN USO"];
|
||||
|
||||
try {
|
||||
const res = await axios.post(
|
||||
`${api_url}/equipos/reporte/equipos_impesion_group/impresoras`,
|
||||
["EN DESUSO", "EN USO"],
|
||||
{
|
||||
headers,
|
||||
body,
|
||||
{ headers }
|
||||
);
|
||||
|
||||
const data = res.data;
|
||||
|
||||
const valores = {
|
||||
inyeccionTinta: "0",
|
||||
laserPequenaBN: "0",
|
||||
matrizPuntos: "0",
|
||||
laserAltoVolumenBN: "0",
|
||||
laserPequenaColor: "0",
|
||||
multifuncionales: "0",
|
||||
laserAltoVolumenColor: "0",
|
||||
impresora3D: "0",
|
||||
plotter: "0",
|
||||
credencial: "0",
|
||||
termica: "0",
|
||||
};
|
||||
|
||||
data.forEach((item: any) => {
|
||||
const uso = item.periferico.toUpperCase().trim();
|
||||
const total = item.total ?? "0";
|
||||
|
||||
switch (uso) {
|
||||
case "INYECCIÓN TINTA":
|
||||
valores.inyeccionTinta = total;
|
||||
break;
|
||||
case "LÁSER PEQUEÑA B/N":
|
||||
valores.laserPequenaBN = total;
|
||||
break;
|
||||
case "MATRIZ DE PUNTOS":
|
||||
valores.matrizPuntos = total;
|
||||
break;
|
||||
case "LÁSER DE ALTO VOLUMEN B/N":
|
||||
valores.laserAltoVolumenBN = total;
|
||||
break;
|
||||
case "LÁSER PEQUEÑA COLOR":
|
||||
valores.laserPequenaColor = total;
|
||||
break;
|
||||
case "MULTIFUNCIONALES":
|
||||
valores.multifuncionales = total;
|
||||
break;
|
||||
case "LÁSER DE ALTO VOLUMEN COLOR":
|
||||
valores.laserAltoVolumenColor = total;
|
||||
break;
|
||||
case "3D":
|
||||
valores.impresora3D = total;
|
||||
break;
|
||||
case "IMPRESORA CREDENCIALES":
|
||||
valores.credencial = total;
|
||||
break;
|
||||
case "IMPRESORA TÉRMICA":
|
||||
valores.termica = total;
|
||||
break;
|
||||
case "PLOTTER":
|
||||
valores.plotter = total;
|
||||
break;
|
||||
}
|
||||
)
|
||||
.then((res) => {
|
||||
const data = res.data;
|
||||
|
||||
const valores = {
|
||||
inyeccionTinta: "0",
|
||||
laserPequenaBN: "0",
|
||||
matrizPuntos: "0",
|
||||
laserAltoVolumenBN: "0",
|
||||
laserPequenaColor: "0",
|
||||
multifuncionales: "0",
|
||||
laserAltoVolumenColor: "0",
|
||||
impresora3D: "0",
|
||||
plotter: "0",
|
||||
credencial: "0",
|
||||
termica: "0",
|
||||
};
|
||||
|
||||
data.forEach((item: any) => {
|
||||
const uso = item.periferico.toUpperCase().trim();
|
||||
const total = item.total ?? "0";
|
||||
|
||||
switch (uso) {
|
||||
case "INYECCIÓN TINTA":
|
||||
valores.inyeccionTinta = total;
|
||||
break;
|
||||
|
||||
case "LÁSER PEQUEÑA B/N":
|
||||
valores.laserPequenaBN = total;
|
||||
break;
|
||||
|
||||
case "MATRIZ DE PUNTOS":
|
||||
valores.matrizPuntos = total;
|
||||
break;
|
||||
|
||||
case "LÁSER DE ALTO VOLUMEN B/N":
|
||||
valores.laserAltoVolumenBN = total;
|
||||
break;
|
||||
|
||||
case "LÁSER PEQUEÑA COLOR":
|
||||
valores.laserPequenaColor = total;
|
||||
break;
|
||||
|
||||
case "MULTIFUNCIONALES":
|
||||
valores.multifuncionales = total;
|
||||
break;
|
||||
|
||||
case "LÁSER DE ALTO VOLUMEN COLOR":
|
||||
valores.laserAltoVolumenColor = total;
|
||||
break;
|
||||
case "3D":
|
||||
valores.impresora3D = total;
|
||||
break;
|
||||
case "IMPRESORA CREDENCIALES":
|
||||
valores.credencial = total;
|
||||
break;
|
||||
case "IMPRESORA TÉRMICA":
|
||||
valores.termica = total;
|
||||
break;
|
||||
case "PLOTTER":
|
||||
valores.plotter = total;
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
setEquipos(valores);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error("Error:", err);
|
||||
});
|
||||
|
||||
setEquipos(valores);
|
||||
} catch (error) {
|
||||
console.error("Error:", error);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
cargarDatos(false);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@@ -127,7 +124,11 @@ export default function Pregunta1EP() {
|
||||
|
||||
<div className="pregunta-cuadro">
|
||||
Equipos de impresión.
|
||||
<ToggleButton />
|
||||
<ToggleButton
|
||||
onChange={(estado) => {
|
||||
cargarDatos(estado);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className={style.grid}>
|
||||
|
||||
@@ -26,14 +26,16 @@ export default function Pregunta2EP() {
|
||||
|
||||
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||
|
||||
useEffect(() => {
|
||||
const cargarDatos = async (baja: boolean) => {
|
||||
const token = Cookies.get("token");
|
||||
const headers = { Authorization: `Bearer ${token}` };
|
||||
|
||||
const body = baja ? ["BAJA"] : ["EN DESUSO", "EN USO"];
|
||||
|
||||
axios
|
||||
.post(
|
||||
`${api_url}/equipos/reporte/contar_periferico_tipoUso/impresoras`,
|
||||
["EN DESUSO", "EN USO"],
|
||||
body,
|
||||
{
|
||||
headers,
|
||||
}
|
||||
@@ -97,13 +99,21 @@ export default function Pregunta2EP() {
|
||||
.catch((err) => {
|
||||
console.error("Error:", err);
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
cargarDatos(false);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={styles.container_P2}>
|
||||
<div className="pregunta-cuadro">
|
||||
Equipos de impresión de acuerdo con la población universitaria.
|
||||
<ToggleButton />
|
||||
<ToggleButton
|
||||
onChange={(estado) => {
|
||||
cargarDatos(estado);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className={styles.row_P2}>
|
||||
|
||||
@@ -22,13 +22,16 @@ export default function Pregunta4EP() {
|
||||
|
||||
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||
|
||||
useEffect(() => {
|
||||
const cargarDatos = async (baja: boolean) => {
|
||||
const token = Cookies.get("token");
|
||||
const headers = { Authorization: `Bearer ${token}` };
|
||||
|
||||
const body = baja ? ["BAJA"] : ["EN DESUSO", "EN USO"];
|
||||
|
||||
axios
|
||||
.post(
|
||||
`${api_url}/equipos/reporte/equipos_impesion_group/dijitales`,
|
||||
["EN DESUSO", "EN USO"],
|
||||
body,
|
||||
{
|
||||
headers,
|
||||
}
|
||||
@@ -72,6 +75,10 @@ export default function Pregunta4EP() {
|
||||
.catch((err) => {
|
||||
console.error("Error:", err);
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
cargarDatos(false);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@@ -82,7 +89,11 @@ export default function Pregunta4EP() {
|
||||
|
||||
<div className="pregunta-cuadro">
|
||||
Número de equipos de digitalización.
|
||||
<ToggleButton />
|
||||
<ToggleButton
|
||||
onChange={(estado) => {
|
||||
cargarDatos(estado);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid">
|
||||
|
||||
@@ -27,14 +27,16 @@ export default function Pregunta5EP() {
|
||||
|
||||
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||
|
||||
useEffect(() => {
|
||||
const cargarDatos = async (baja: boolean) => {
|
||||
const token = Cookies.get("token");
|
||||
const headers = { Authorization: `Bearer ${token}` };
|
||||
|
||||
const body = baja ? ["BAJA"] : ["EN DESUSO", "EN USO"];
|
||||
|
||||
axios
|
||||
.post(
|
||||
`${api_url}/equipos/reporte/contar_periferico_tipoUso/dijtales`,
|
||||
["EN DESUSO", "EN USO"],
|
||||
body,
|
||||
{
|
||||
headers,
|
||||
}
|
||||
@@ -97,6 +99,10 @@ export default function Pregunta5EP() {
|
||||
.catch((err) => {
|
||||
console.error("Error:", err);
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
cargarDatos(false);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@@ -104,7 +110,11 @@ export default function Pregunta5EP() {
|
||||
<div className="pregunta-cuadro">
|
||||
Número de equipos de digitalización de acuerdo con la población
|
||||
universitaria.
|
||||
<ToggleButton />
|
||||
<ToggleButton
|
||||
onChange={(estado) => {
|
||||
cargarDatos(estado);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className={styles.row_P2}>
|
||||
|
||||
@@ -20,16 +20,14 @@ export default function Pregunta7EP() {
|
||||
|
||||
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||
|
||||
useEffect(() => {
|
||||
const cargarDatos = async (baja: boolean) => {
|
||||
const token = Cookies.get("token");
|
||||
const headers = { Authorization: `Bearer ${token}` };
|
||||
|
||||
const body = baja ? ["BAJA"] : ["EN DESUSO", "EN USO"];
|
||||
|
||||
axios
|
||||
.post(
|
||||
`${api_url}/equipos/reporte/contar_laboratorio`,
|
||||
["EN DESUSO", "EN USO"],
|
||||
{ headers }
|
||||
)
|
||||
.post(`${api_url}/equipos/reporte/contar_laboratorio`, body, { headers })
|
||||
.then((res) => {
|
||||
const formato: Dato[] = res.data.map((item: any) => ({
|
||||
nombre: item.laboratorio || "SIN NOMBRE",
|
||||
@@ -41,6 +39,10 @@ export default function Pregunta7EP() {
|
||||
.catch((err) => {
|
||||
console.error("Error cargando datos:", err);
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
cargarDatos(false);
|
||||
}, []);
|
||||
|
||||
const sortedData = React.useMemo(() => {
|
||||
@@ -91,7 +93,11 @@ export default function Pregunta7EP() {
|
||||
</div>
|
||||
<div className="pregunta-cuadro">
|
||||
Numero de laboratorios.
|
||||
<ToggleButton />
|
||||
<ToggleButton
|
||||
onChange={(estado) => {
|
||||
cargarDatos(estado);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="controls">
|
||||
|
||||
@@ -20,14 +20,16 @@ export default function Pregunta8() {
|
||||
|
||||
const api_url = process.env.NEXT_PUBLIC_API_URL;
|
||||
|
||||
useEffect(() => {
|
||||
const cargarDatos = async (baja: boolean) => {
|
||||
const token = Cookies.get("token");
|
||||
const headers = { Authorization: `Bearer ${token}` };
|
||||
|
||||
const body = baja ? ["BAJA"] : ["EN DESUSO", "EN USO"];
|
||||
|
||||
axios
|
||||
.post(
|
||||
`${api_url}/equipos/reporte/contar_proyecto`,
|
||||
["EN DESUSO", "EN USO"],
|
||||
body,
|
||||
{ headers }
|
||||
)
|
||||
.then((res) => {
|
||||
@@ -41,6 +43,10 @@ export default function Pregunta8() {
|
||||
.catch((err) => {
|
||||
console.error("Error cargando datos:", err);
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
cargarDatos(false);
|
||||
}, []);
|
||||
|
||||
const sortedData = React.useMemo(() => {
|
||||
@@ -91,7 +97,11 @@ export default function Pregunta8() {
|
||||
</div>
|
||||
<div className="pregunta-cuadro">
|
||||
Numero de proyectos.
|
||||
<ToggleButton />
|
||||
<ToggleButton
|
||||
onChange={(estado) => {
|
||||
cargarDatos(estado);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="controls">
|
||||
<div className="show-records">
|
||||
|
||||
Reference in New Issue
Block a user