From 9b979725e57d2d5c56c3ddbfa1f3e6f2ceca08bf Mon Sep 17 00:00:00 2001 From: IO <320154041@pcpuma.acatlan.unam.mx> Date: Wed, 19 Nov 2025 18:17:24 -0600 Subject: [PATCH 1/5] added new style to ask 1 --- .../pregunta1_1/pregunta1.1.css | 7 +- src/components/Equipo_Computo/Pregunta1.tsx | 357 ++++++------------ src/components/Equipo_Computo/Pregunta_4.tsx | 2 +- src/components/Equipo_Computo/pregunta1.1.css | 144 +++++++ 4 files changed, 270 insertions(+), 240 deletions(-) create mode 100644 src/components/Equipo_Computo/pregunta1.1.css diff --git a/src/app/(Administrador)/pregunta1_1/pregunta1.1.css b/src/app/(Administrador)/pregunta1_1/pregunta1.1.css index 62bfe3e..f7c439b 100644 --- a/src/app/(Administrador)/pregunta1_1/pregunta1.1.css +++ b/src/app/(Administrador)/pregunta1_1/pregunta1.1.css @@ -29,7 +29,7 @@ border-radius: 10px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); overflow-x: auto; - + min-width: 700px; } /* Tabla */ @@ -81,7 +81,7 @@ /* Input */ .input-contenedor input { - width: 40%; + width: 100%; padding: 6px 25px 6px 6px; border: 2px solid #002855; border-radius: 6px; @@ -144,6 +144,5 @@ } .tabla-contenedor { - flex: 1; - min-width: 300px; + flex: 1; } diff --git a/src/components/Equipo_Computo/Pregunta1.tsx b/src/components/Equipo_Computo/Pregunta1.tsx index a13e83a..610a596 100644 --- a/src/components/Equipo_Computo/Pregunta1.tsx +++ b/src/components/Equipo_Computo/Pregunta1.tsx @@ -1,242 +1,129 @@ "use client"; -import "./pregunta1.module.scss" +import React, { useState } from "react"; +import "./pregunta1.1.css"; + +export default function Pregunta1() { + const [datos, setDatos] = useState([ + { nombre: "Windows", valores: ["", "", "", "", ""] }, + { nombre: "Linux", valores: ["", "", "", "", ""] }, + { nombre: "Mac OS", valores: ["", "", "", "", ""] }, + { nombre: "Total", valores: ["", "", "", "", ""] }, + ]); + + const handleChange = (filaIndex: number, colIndex: number, value: string) => { + const nuevosDatos = [...datos]; + nuevosDatos[filaIndex].valores[colIndex] = value; + setDatos(nuevosDatos); + }; + + const calcularTotalFila = (valores: string[]) => + valores.reduce((acc, val) => acc + (Number(val) || 0), 0); + + const calcularTotalesColumnas = () => { + const numColumnas = datos[0].valores.length; + const totales = Array(numColumnas).fill(0); + datos.slice(0, -1).forEach((fila) => { + fila.valores.forEach((valor, colIndex) => { + totales[colIndex] += Number(valor) || 0; + }); + }); + return totales; + }; + + const totalesColumnas = calcularTotalesColumnas(); + + // Títulos de las tablas + const tablas = [ + "Computadoras de escritorio", + "Tabletas", + "Computadoras portátiles", + "Alto rendimiento", + ]; + + // Función para renderizar una tabla + const renderTabla = (titulo: string) => ( +
| {titulo} | +Alumnos | +Profesores | +Técnicos Académicos | +Investigadores | +Administrativos | +Total | +
|---|---|---|---|---|---|---|
| {fila.nombre} | + {totalesColumnas.map((colTotal, i) => ( +{colTotal} | + ))} +{totalGeneral} | +||||
| {fila.nombre} | + {fila.valores.map((valor, colIndex) => ( +
+
+
+ handleChange(filaIndex, colIndex, e.target.value)
+ }
+ />
+
+ |
+ ))}
+ 100 ? "total-error" : "" + }`} + > + {totalFila} + | +
- Desglosa en cada renglon el número de equipos de cómputo dedicado por - cada categoría enlistada, de acuerdo con el perfil del usuario al que - se destina su uso primordialmente. -
+| Computadoras de escritorio | -Alumnos | -Profesores | -Tecnicos Academicos | -Investigadores | -Administrativos | -Total | -
|---|---|---|---|---|---|---|
| Windows | -- | - | - | - | - | 10 | -
| Linux | -- | - | - | - | - | 10 | -
| Mac OS | -- | - | - | - | - | 10 | -
| Total | -10 | -10 | -10 | -10 | -10 | -10 | -
| Computadoras portátiles | -Alumnos | -Profesores | -Tecnicos Academicos | -Investigadores | -Administrativos | -Total | -
|---|---|---|---|---|---|---|
| Windows | -- | - | - | - | - | 10 | -
| Chromebook | -- | - | - | - | - | 10 | -
| Mac OS | -- | - | - | - | - | 10 | -
| Total | -10 | 10 | 10 | 10 | 10 | -10 | -
| Tabletas | -Alumnos | -Profesores | -Tecnicos Academicos | -Investigadores | -Administrativos | -Total | -
|---|---|---|---|---|---|---|
| Android | -- | - | - | - | - | 10 | -
| iPad iOS | -- | - | - | - | - | 10 | -
| Total | -10 | 10 | 10 | 10 | 10 | -10 | -
| Alto Rendimiento | -Alumnos | -Profesores | -Tecnicos Academicos | -Investigadores | -Administrativos | -Total | -
|---|---|---|---|---|---|---|
| Servidores | -- | - | - | - | - | 10 | -
| Total | -10 | 10 | 10 | 10 | 10 | -10 | -
3. Desglose la cantidad de población beneficiada por plataforma y tipo de procesador: *
-- Presione cada pestaña para ingresar la información. -
+Presione cada pestaña para ingresar la información.
| % Antiguedad de los equipos | +% Antigüedad de los equipos | Menor a 2 años | Entre 2 y 3 años | Entre 4 y 5 años | Mayor a 6 años | +No registrados | Total |
|---|---|---|---|---|---|---|---|
| {fila.nombre} | - {fila.valores.map((valor, colIndex) => ( -+ {fila.valores.map((valor, colIdx) => ( + |
- handleChange(filaIndex, colIndex, e.target.value)
- }
+ readOnly
/>
%
|
))}
- 100 ? "total-error" : "" - }`} - > + | 100.1 ? "total-error" : ""}`}> {total.toFixed(2)}% |
| Computadoras de Escritorio (247) | -Computadoras Portátiles (767) | -Alto Rendimiento (17) | -
|---|---|---|
|
-
-
- setGarantia({ ...garantia, escritorio: e.target.value })
- }
- />
-
- |
-
-
-
- setGarantia({ ...garantia, portatil: e.target.value })
- }
- />
-
- |
-
-
-
- setGarantia({
- ...garantia,
- altoRendimiento: e.target.value,
- })
- }
- />
-
- |
-
| Computadoras de Escritorio (247) | +Computadoras Portátiles (767) | +Alto Rendimiento (17) | +
|---|---|---|
|
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+ |
+
| {TITULOS_TABLAS[tablaIndex]} | +Alumnos | +Profesores | +Técnicos Académicos | +Investigadores | +Administrativos | +Total | +
|---|
| {titulo} | -Alumnos | -Profesores | -Técnicos Académicos | -Investigadores | -Administrativos | -Total | -
|---|---|---|---|---|---|---|
| {fila.nombre} | - {totalesColumnas.map((colTotal, i) => ( -{colTotal} | +|||||
| {so} | + {valores.map((valor, colIndex) => ( +
+
+
+
+ |
))}
- {totalGeneral} | +{totalFila} | |||
| {fila.nombre} | - {fila.valores.map((valor, colIndex) => ( -
-
-
- handleChange(filaIndex, colIndex, e.target.value)
- }
- />
-
- |
- ))}
- 100 ? "total-error" : "" - }`} - > - {totalFila} - | -