From 9315bdcb2200191c5c745ef7a1b13d44d5711e91 Mon Sep 17 00:00:00 2001
From: frcarlos <307100636@pcpuma.acatlan.unam.mx>
Date: Wed, 25 Feb 2026 12:53:04 -0500
Subject: [PATCH 1/5] merge
---
package-lock.json | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/package-lock.json b/package-lock.json
index 259868d..8ade54c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -693,6 +693,7 @@
"version": "2.5.6",
"resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.6.tgz",
"integrity": "sha512-tmmZ3lQxAe/k/+rNnXQRawJ4NjxO2hqiOLTHvWchtGZULp4RyFeh6aU4XdOYBFe2KE1oShQTv4AblOs2iOrNnQ==",
+ "dev": true,
"hasInstallScript": true,
"license": "MIT",
"optional": true,
@@ -732,6 +733,7 @@
"cpu": [
"arm64"
],
+ "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -752,6 +754,7 @@
"cpu": [
"arm64"
],
+ "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -772,6 +775,7 @@
"cpu": [
"x64"
],
+ "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -792,6 +796,7 @@
"cpu": [
"x64"
],
+ "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -812,6 +817,7 @@
"cpu": [
"arm"
],
+ "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -832,6 +838,7 @@
"cpu": [
"arm"
],
+ "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -852,6 +859,7 @@
"cpu": [
"arm64"
],
+ "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -872,6 +880,7 @@
"cpu": [
"arm64"
],
+ "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -892,6 +901,7 @@
"cpu": [
"x64"
],
+ "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -912,6 +922,7 @@
"cpu": [
"x64"
],
+ "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -932,6 +943,7 @@
"cpu": [
"arm64"
],
+ "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -952,6 +964,7 @@
"cpu": [
"ia32"
],
+ "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -972,6 +985,7 @@
"cpu": [
"x64"
],
+ "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1841,6 +1855,7 @@
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
+ "dev": true,
"license": "MIT",
"optional": true,
"engines": {
@@ -1851,6 +1866,7 @@
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+ "dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
@@ -2200,6 +2216,7 @@
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz",
"integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==",
+ "dev": true,
"license": "MIT",
"optional": true
},
@@ -2246,6 +2263,7 @@
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
+ "dev": true,
"license": "MIT",
"optional": true,
"engines": {
From 6b687a8be2eb56ebbb1dcbdc6890236f274d40e3 Mon Sep 17 00:00:00 2001
From: frcarlos <307100636@pcpuma.acatlan.unam.mx>
Date: Wed, 25 Feb 2026 20:22:19 -0500
Subject: [PATCH 2/5] new view is create Periodo
---
app/(private)/Periodo/page.tsx | 39 ++++++++++++++++++++++++++++++++++
proxy.ts | 2 ++
2 files changed, 41 insertions(+)
create mode 100644 app/(private)/Periodo/page.tsx
diff --git a/app/(private)/Periodo/page.tsx b/app/(private)/Periodo/page.tsx
new file mode 100644
index 0000000..887a3a1
--- /dev/null
+++ b/app/(private)/Periodo/page.tsx
@@ -0,0 +1,39 @@
+"use client";
+
+import { useState } from "react";
+
+export default function PeriodoPage() {
+ const [periodos] = useState([
+ { id: 1, nombre: "2024-2", activo: true },
+ { id: 2, nombre: "2025-1", activo: false },
+ { id: 3, nombre: "2025-2", activo: false },
+ { id: 4, nombre: "2026-1", activo: true },
+ { id: 5, nombre: "2026-2", activo: false },
+ { id: 6, nombre: "2027-1", activo: false },
+ ]);
+
+ return (
+
+
PERIODO ESCOLAR
+
+
+
+
+ | ID |
+ Periodo |
+ Activo |
+
+
+
+ {periodos.map((p) => (
+
+ | {p.id} |
+ {p.nombre} |
+ {p.activo ? "Sí" : "No"} |
+
+ ))}
+
+
+
+ );
+}
\ No newline at end of file
diff --git a/proxy.ts b/proxy.ts
index 36cf5db..66a5657 100644
--- a/proxy.ts
+++ b/proxy.ts
@@ -41,6 +41,7 @@ export async function proxy(request: NextRequest) {
"/AsignacionEquipo",
"/Monitor",
"/ActivosMantenimiento",
+ "/Periodo",
];
if (role === 5 && !onlyImpresiones.includes(pathname)) {
@@ -66,6 +67,7 @@ export const config = {
matcher: [
"/",
"/Reportes",
+ "/Periodo",
"/Monitor",
"/QuitarSancion",
"/Programas",
From 649ebe6ab9c055ac8f1a7ba0da33b81272c3d503 Mon Sep 17 00:00:00 2001
From: frcarlos <307100636@pcpuma.acatlan.unam.mx>
Date: Thu, 26 Feb 2026 12:24:51 -0500
Subject: [PATCH 3/5] Periodo conexion
---
app/(private)/Periodo/page.tsx | 138 +++++++++++++++++++++++++++++----
app/globals.css | 3 +
2 files changed, 126 insertions(+), 15 deletions(-)
diff --git a/app/(private)/Periodo/page.tsx b/app/(private)/Periodo/page.tsx
index 887a3a1..901266f 100644
--- a/app/(private)/Periodo/page.tsx
+++ b/app/(private)/Periodo/page.tsx
@@ -1,35 +1,143 @@
"use client";
-import { useState } from "react";
+import { useState, useEffect } from "react";
+import axios from "axios";
+
+interface Periodo {
+ id_periodo: number;
+ semestre: string;
+ fecha_inicio_servicio: string;
+ fecha_fin_servicio: string;
+ activo: boolean;
+}
export default function PeriodoPage() {
- const [periodos] = useState([
- { id: 1, nombre: "2024-2", activo: true },
- { id: 2, nombre: "2025-1", activo: false },
- { id: 3, nombre: "2025-2", activo: false },
- { id: 4, nombre: "2026-1", activo: true },
- { id: 5, nombre: "2026-2", activo: false },
- { id: 6, nombre: "2027-1", activo: false },
- ]);
+
+ const [periodos, setPeriodos] = useState([]);
+ const [semestre, setSemestre] = useState("");
+ const [fechaInicio, setFechaInicio] = useState("");
+ const [fechaFin, setFechaFin] = useState("");
+
+ const API = "http://localhost:3000/periodo"; // NO CAMBIO RUTA
+
+
+ const config = {
+ headers: {
+ Authorization: `Bearer ${localStorage.getItem("token")}`,
+ },
+ };
+
+
+ const obtenerPeriodos = async () => {
+ try {
+ const res = await axios.get(API, config);
+ setPeriodos(res.data);
+ } catch (error) {
+ console.error("Error al obtener periodos", error);
+ }
+ };
+
+ useEffect(() => {
+ obtenerPeriodos();
+ }, []);
+
+ // CREAR PERIODO
+
+ const crearPeriodo = async () => {
+ try {
+ await axios.post(
+ API,
+ {
+ semestre,
+ fecha_inicio_servicio: fechaInicio,
+ fecha_fin_servicio: fechaFin,
+ activo: true,
+ },
+ config
+ );
+
+ setSemestre("");
+ setFechaInicio("");
+ setFechaFin("");
+
+ obtenerPeriodos();
+ } catch (error) {
+ console.error("Error al crear periodo", error);
+ }
+ };
+
+ // ELIMINAR PERIODO
+
+ const eliminarPeriodo = async (id_periodo: number) => {
+ try {
+ await axios.delete(`${API}/${id_periodo}`, config);
+ obtenerPeriodos();
+ } catch (error) {
+ console.error("Error al eliminar periodo", error);
+ }
+ };
return (
-
PERIODO ESCOLAR
+
PERIODO ESCOLAR
-
+ {/* ================= CREAR ================= */}
+
+ setSemestre(e.target.value)}
+ />
+
+ setFechaInicio(e.target.value)}
+ />
+
+ setFechaFin(e.target.value)}
+ />
+
+
+
+
+ {/* ================= LISTADO ================= */}
+
| ID |
- Periodo |
+ Semestre |
+ Inicio |
+ Fin |
Activo |
+ Acción |
{periodos.map((p) => (
-
- | {p.id} |
- {p.nombre} |
+
+ | {p.id_periodo} |
+ {p.semestre} |
+ {p.fecha_inicio_servicio} |
+ {p.fecha_fin_servicio} |
{p.activo ? "Sí" : "No"} |
+
+
+ |
))}
diff --git a/app/globals.css b/app/globals.css
index 3efcefd..4569bcb 100644
--- a/app/globals.css
+++ b/app/globals.css
@@ -255,10 +255,13 @@ button:disabled {
background-color: #2563eb;
}
+
+
.buttonSearch:hover {
background-color: #1d4ed8;
}
+
.buttonCharge {
background-color: #16a34a;
}
From 3c44aa833e1f0c6ecb58d8ee2de448c29be7d062 Mon Sep 17 00:00:00 2001
From: frcarlos <307100636@pcpuma.acatlan.unam.mx>
Date: Fri, 27 Feb 2026 10:06:03 -0500
Subject: [PATCH 4/5] merge
---
app/globals.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/globals.css b/app/globals.css
index 4569bcb..aa0985d 100644
--- a/app/globals.css
+++ b/app/globals.css
@@ -481,7 +481,7 @@ thead tr {
background-color: #2563eb;
position: relative;
z-index: 1;
-}
+}
tbody tr {
transition: transform 0.3s ease, opacity 0.3s ease;
From 552353f4d708f8d10f441465af0a6790b41a0f4d Mon Sep 17 00:00:00 2001
From: frcarlos <307100636@pcpuma.acatlan.unam.mx>
Date: Fri, 27 Feb 2026 16:30:52 -0500
Subject: [PATCH 5/5] PeriodoPage
---
app/(private)/Periodo/page.tsx | 208 +++++++++++++++++++++++----------
1 file changed, 145 insertions(+), 63 deletions(-)
diff --git a/app/(private)/Periodo/page.tsx b/app/(private)/Periodo/page.tsx
index 901266f..1605a02 100644
--- a/app/(private)/Periodo/page.tsx
+++ b/app/(private)/Periodo/page.tsx
@@ -2,6 +2,7 @@
import { useState, useEffect } from "react";
import axios from "axios";
+import Cookies from "js-cookie";
interface Periodo {
id_periodo: number;
@@ -17,20 +18,17 @@ export default function PeriodoPage() {
const [semestre, setSemestre] = useState("");
const [fechaInicio, setFechaInicio] = useState("");
const [fechaFin, setFechaFin] = useState("");
+ const [modoEdicion, setModoEdicion] = useState(false);
+ const [idEditar, setIdEditar] = useState(null);
- const API = "http://localhost:3000/periodo"; // NO CAMBIO RUTA
+ const API = "http://localhost:5000/periodo";
-
- const config = {
- headers: {
- Authorization: `Bearer ${localStorage.getItem("token")}`,
- },
- };
+ const token = Cookies.get("token");
+ const headers = { Authorization: `Bearer ${token}` };
-
const obtenerPeriodos = async () => {
try {
- const res = await axios.get(API, config);
+ const res = await axios.get(API, { headers });
setPeriodos(res.data);
} catch (error) {
console.error("Error al obtener periodos", error);
@@ -41,9 +39,22 @@ export default function PeriodoPage() {
obtenerPeriodos();
}, []);
- // CREAR PERIODO
-
+ // VALIDAR SEMESTRE
+ const handleSemestreChange = (e: React.ChangeEvent) => {
+ const valor = e.target.value;
+
+
+ if (/^\d{0,6}$/.test(valor)) {
+ setSemestre(valor);
+ }
+ };
+
const crearPeriodo = async () => {
+ if (semestre.length !== 6) {
+ alert("El semestre debe tener exactamente 6 dígitos.");
+ return;
+ }
+
try {
await axios.post(
API,
@@ -53,95 +64,166 @@ export default function PeriodoPage() {
fecha_fin_servicio: fechaFin,
activo: true,
},
- config
+ { headers }
);
- setSemestre("");
- setFechaInicio("");
- setFechaFin("");
-
+ limpiarFormulario();
obtenerPeriodos();
} catch (error) {
console.error("Error al crear periodo", error);
}
};
- // ELIMINAR PERIODO
-
+
const eliminarPeriodo = async (id_periodo: number) => {
try {
- await axios.delete(`${API}/${id_periodo}`, config);
+ await axios.delete(`${API}/${id_periodo}`, { headers });
obtenerPeriodos();
} catch (error) {
console.error("Error al eliminar periodo", error);
}
};
- return (
-
-
PERIODO ESCOLAR
+ const cargarPeriodo = (p: Periodo) => {
+ setModoEdicion(true);
+ setIdEditar(p.id_periodo);
+ setSemestre(p.semestre);
+ setFechaInicio(p.fecha_inicio_servicio);
+ setFechaFin(p.fecha_fin_servicio);
+ };
- {/* ================= CREAR ================= */}
-
+
+ const modificarPeriodo = async () => {
+ if (semestre.length !== 6) {
+ alert("El semestre debe tener exactamente 6 dígitos.");
+ return;
+ }
+
+ try {
+ await axios.put(
+ `${API}/${idEditar}`,
+ {
+ semestre,
+ fecha_inicio_servicio: fechaInicio,
+ fecha_fin_servicio: fechaFin,
+ },
+ { headers }
+ );
+
+ limpiarFormulario();
+ obtenerPeriodos();
+ } catch (error) {
+ console.error("Error al modificar periodo", error);
+ }
+ };
+
+ const limpiarFormulario = () => {
+ setSemestre("");
+ setFechaInicio("");
+ setFechaFin("");
+ setModoEdicion(false);
+ setIdEditar(null);
+ };
+
+ return (
+
);
}
\ No newline at end of file