From 210aa2f3db015a1927b78ebcfbb77f6223d3dba7 Mon Sep 17 00:00:00 2001 From: IO420 <320154041@pcpuma.acatlan.unam.mx> Date: Wed, 29 Oct 2025 13:41:03 -0600 Subject: [PATCH] build --- src/app/(Operador)/AgregarEquipo/page.tsx | 31 +- src/app/(Operador)/Editar/page.tsx | 268 +----------------- src/app/(Operador)/Escaner/page.tsx | 17 +- src/app/dashboard/page.tsx | 91 ------ src/app/login/Login.tsx | 6 +- src/app/reporte/page.tsx | 27 +- src/components/BarNavigation.tsx | 6 - src/components/BarcodeScanner.tsx | 10 - src/components/Editar.tsx | 260 +++++++++++++++++ .../Editar => components}/editar.css | 0 10 files changed, 305 insertions(+), 411 deletions(-) delete mode 100644 src/app/dashboard/page.tsx create mode 100644 src/components/Editar.tsx rename src/{app/(Operador)/Editar => components}/editar.css (100%) diff --git a/src/app/(Operador)/AgregarEquipo/page.tsx b/src/app/(Operador)/AgregarEquipo/page.tsx index 653df6a..43ee27f 100644 --- a/src/app/(Operador)/AgregarEquipo/page.tsx +++ b/src/app/(Operador)/AgregarEquipo/page.tsx @@ -3,10 +3,10 @@ import { useState, useEffect } from "react"; import axios from "axios"; import Cookies from "js-cookie"; // Para leer cookies en el cliente -import "../../styles/layout/agregarEquipo.scss"; import toast from "react-hot-toast"; +import "../../styles/layout/agregarEquipo.scss"; -export default function page() { +export default function Page() { const [formData, setFormData] = useState({ serie: "", marca: "", @@ -76,7 +76,7 @@ export default function page() { setTiposEquipo(tiposEquipoRes.data); setSistemasOperativos(sistemasOperativosRes.data); setProcesadores(procesadoresRes.data); - } catch (err: any) { + } catch (err) { if (axios.isAxiosError(err)) { if (err.response) { toast.error( @@ -127,17 +127,17 @@ export default function page() { alert("Acción cancelada"); }; - const handleChange = (e: any) => { - const { name, value } = e.target; - setFormData((prev) => { - let updated = { ...prev, [name]: value }; - if (value === "Impresora") { - updated.sistemaOperativo = ""; - updated.procesador = ""; - } - return updated; - }); - }; + // const handleChange = (e: any) => { + // const { name, value } = e.target; + // setFormData((prev) => { + // let updated = { ...prev, [name]: value }; + // if (value === "Impresora") { + // updated.sistemaOperativo = ""; + // updated.procesador = ""; + // } + // return updated; + // }); + // }; return (
@@ -303,6 +303,9 @@ export default function page() {
+ import("@/components/Editar"), { + ssr: false, +}); - useEffect(() => { - const fetchEquipo = async () => { - try { - const response = await axios.get( - `${process.env.NEXT_PUBLIC_API_URL}/equipos/${equipoId}` - ); - - setFormData(response.data); - } catch (error) { - console.error("Error al obtener el equipo:", error); - alert("No se pudo cargar la información del equipo."); - } - }; - - if (equipoId) { - fetchEquipo(); - } - }, [equipoId]); - - const mostrarCamposComputadora = formData.tipoEquipo !== "Impresora"; - - const handleGuardar = async () => { - try { - await axios.patch( - `${process.env.NEXT_PUBLIC_API_URL}/equipos/update/${equipoId}`, - formData - ); - alert("Equipo actualizado correctamente"); - } catch (error) { - console.error("Error al guardar:", error); - alert("Hubo un error al guardar el equipo."); - } - }; - - const handleCancelar = () => { - alert("Acción cancelada"); - }; - - return ( -
-
-

- {equipoId ? `Editar Equipo (${equipoId})` : "Agregar Equipo"} - Inventario: - Fecha de censo: -

- -
- {/* Columna 1 */} -
-
- - - setFormData({ ...formData, serie: e.target.value }) - } - /> -
-
- - -
-
- - -
-
- - -
- -
- - -
-
- - {/* Columna 2 */} -
- {mostrarCamposComputadora && ( - <> -
- - -
- -
- - -
- - )} - -
- - -
- -
- - -
-
- - {/* Columna 3 */} -
-
- -