From 7af87fa42495b1d39f3680c4886a3acf1af6b514 Mon Sep 17 00:00:00 2001 From: IO420 <320154041@pcpuma.acatlan.unam.mx> Date: Fri, 23 Jan 2026 12:35:35 -0600 Subject: [PATCH] fixed addTime and added new BarNavigation --- app/(private)/AgregarTiempo/Addtime.tsx | 30 +++-- app/(private)/AgregarTiempo/addTime.css | 21 ++++ app/(private)/AgregarTiempo/page.tsx | 66 +++++----- app/(private)/BitacoraSanciones/page.tsx | 20 ++- app/(private)/Impresiones/page.tsx | 4 + app/(private)/QuitarSancion/page.tsx | 5 +- app/Components/Impressions/impressions.tsx | 9 +- app/Components/Receipt/Inscripcion.tsx | 25 ++++ .../layout/BarNavigation/BarNavigation.tsx | 20 +-- .../BarNavigation/BarNavigationServicio.tsx | 119 ++++++++++++++++++ app/Components/layout/Header/Header.tsx | 6 +- tsconfig.json | 2 +- 12 files changed, 254 insertions(+), 73 deletions(-) create mode 100644 app/Components/layout/BarNavigation/BarNavigationServicio.tsx diff --git a/app/(private)/AgregarTiempo/Addtime.tsx b/app/(private)/AgregarTiempo/Addtime.tsx index e4b6aa0..1e26f05 100644 --- a/app/(private)/AgregarTiempo/Addtime.tsx +++ b/app/(private)/AgregarTiempo/Addtime.tsx @@ -10,6 +10,7 @@ import "./addTime.css"; import SelectionCo from "@/app/Components/Selection/SelectionCo"; import axios from "axios"; import { envConfig } from "@/app/lib/config"; +import Cookies from "js-cookie"; const PLATAFORMA_MAP: Record = { WINDOWS: 1, @@ -36,8 +37,9 @@ export default function AddTime({ // 🔹 datos del recibo const [folio, setFolio] = useState(""); const [amount, setAmount] = useState(""); - const [date, setDate] = useState(""); - + const todayISO = new Date().toISOString().split("T")[0]; + const [date, setDate] = useState(todayISO); + // 🔹 restricción de fechas const day = new Date(); const year = day.getFullYear(); @@ -77,23 +79,27 @@ export default function AddTime({ const id_plataforma = PLATAFORMA_MAP[plataformaSeleccionada]; try { - await PostReceipt({ - id_cuenta: numAcount, - folio_recibo: folio, - monto: Number(amount), - fecha_recibo: date, - }); + const token = Cookies.get("token"); + const headers = { Authorization: `Bearer ${token}` }; - await axios.post(`${envConfig.apiUrl}/alumno-inscrito/tiempo`, { - idCuenta: numAcount, - idPlataforma: id_plataforma, - }); + await axios.post( + `${envConfig.apiUrl}/operations/time`, + { + monto: Number(amount), + id_cuenta: numAcount, + idPlataforma: id_plataforma, + folio_recibo: folio, + fecha_recibo: date, + }, + { headers }, + ); toast.success("Tiempo Guardado"); setFolio(""); setAmount(""); setDate(""); + router.refresh(); } catch (err: any) { toast.error(err.message || "Error al guardar"); } diff --git a/app/(private)/AgregarTiempo/addTime.css b/app/(private)/AgregarTiempo/addTime.css index 1fe80b1..1a94679 100644 --- a/app/(private)/AgregarTiempo/addTime.css +++ b/app/(private)/AgregarTiempo/addTime.css @@ -9,3 +9,24 @@ flex-direction: column; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } + +.firstPartInformationTime { + display: flex; + flex-direction: column; + width: 100%; + max-width: 450px; +} + +.containeInformationTime { + display: flex; + gap: 10px; + width: 100%; +} + +@media (max-width: 800px) { + .containeInformationTime { + flex-direction: column; + justify-content: center; + align-items: center; + } +} \ No newline at end of file diff --git a/app/(private)/AgregarTiempo/page.tsx b/app/(private)/AgregarTiempo/page.tsx index f8cc99c..c8204d3 100644 --- a/app/(private)/AgregarTiempo/page.tsx +++ b/app/(private)/AgregarTiempo/page.tsx @@ -3,25 +3,12 @@ import Information from "@/app/Components/Global/Information/information"; import ShowError from "@/app/Components/Global/ShowError"; import { GetRegisterStudent } from "@/app/lib/getRegisterStudent"; -import { envConfig } from "@/app/lib/config"; import "./addTime.css"; import AddTime from "./Addtime"; +import Table from "@/app/Components/Global/table"; -async function getInscripcion(idCuenta: number) { - try { - const res = await fetch(`${envConfig.apiUrl}/alumno-inscrito/${idCuenta}`, { - headers: { "Content-Type": "application/json" }, - cache: "no-store", - }); - - if (!res.ok) throw new Error("No se pudo cargar inscripción"); - - return await res.json(); - } catch { - return []; - } -} +const headers = ["Inscrito", "Tiempo", "Confirmó"]; export default async function Page(props: { searchParams?: Promise<{ numAcount: string }>; @@ -41,13 +28,21 @@ export default async function Page(props: { errorMessage = result.error; } else { student = result[0]?.alumno; - inscripcion = await getInscripcion(idCuenta); + inscripcion = result; } } - const plataformasInscritas = inscripcion.map( - (ins) => ins.plataforma?.nombre - ); + const tableData = Array.isArray(inscripcion) + ? inscripcion.map((ins) => ({ + Inscrito: ins.plataforma?.nombre || "—", + Tiempo: ins.tiempo_disponible + ? `${ins.tiempo_disponible} minutos` + : "—", + Confirmó: ins.platica.data?.[0] === 1 ? "sí" : "no", + })) + : []; + + const plataformasInscritas = inscripcion.map((ins) => ins.plataforma?.nombre); return (
@@ -55,22 +50,27 @@ export default async function Page(props: {

AGREGAR TIEMPO

- +
+
+ + {student && ( + <> + - {student && ( - <> - + + + )} +
- - - )} + {student && } + ); } -//IO \ No newline at end of file +//IO diff --git a/app/(private)/BitacoraSanciones/page.tsx b/app/(private)/BitacoraSanciones/page.tsx index 78cb26d..56f4cc9 100644 --- a/app/(private)/BitacoraSanciones/page.tsx +++ b/app/(private)/BitacoraSanciones/page.tsx @@ -2,9 +2,11 @@ import BitacoraAlumno from "@/app/Components/BitacoraSanciones/BitacoraAlumno"; import BitacoraEquipo from "@/app/Components/BitacoraSanciones/BitacoraEquipo"; import BitacoraMesas from "@/app/Components/BitacoraSanciones/BitacoraMesas"; import Sanciones from "@/app/Components/BitacoraSanciones/Sanciones"; +import SearchUser from "@/app/Components/Global/SearchUser/searchUser"; import SearchUserWithDate from "@/app/Components/Global/SearchUser/SearchUserWithDate"; import ShowError from "@/app/Components/Global/ShowError"; import Toggle from "@/app/Components/Global/Toggle/Toggle"; +import QuitarSancion from "@/app/Components/QuitarSancion/QuitarSancion"; import { GetStudent } from "@/app/lib/getStudent"; import { GetSancionByStudent } from "@/app/lib/getStudent copy"; @@ -42,7 +44,7 @@ export default async function Page(props: { options={[ { key: "Equipo", - label: "Bitacora equipo", + label: "Bitácora equipo", content: ( <> @@ -51,7 +53,7 @@ export default async function Page(props: { }, { key: "Alumno", - label: "Bitacora alumno", + label: "Bitácora alumno", content: ( <> @@ -61,7 +63,7 @@ export default async function Page(props: { }, { key: "Mesas", - label: "Bitacora mesas", + label: "Bitácora mesas", content: ( <> @@ -77,6 +79,18 @@ export default async function Page(props: { ), }, + { + key: "EliminarSanciones", + label: "Eliminar Sanciones", + content: ( + <> +
+ + {/* */} +
+ + ), + }, ]} /> diff --git a/app/(private)/Impresiones/page.tsx b/app/(private)/Impresiones/page.tsx index 48e43df..3be6b65 100644 --- a/app/(private)/Impresiones/page.tsx +++ b/app/(private)/Impresiones/page.tsx @@ -64,6 +64,7 @@ export default async function Page(props: { key={1} costs={[{ value: 1 }, { value: 2 }]} numAcount={student.id_cuenta} + id_servicio={1} /> ), }, @@ -84,6 +85,7 @@ export default async function Page(props: { { value: 14 }, ]} numAcount={student.id_cuenta} + id_servicio={2} /> ), }, @@ -113,6 +115,7 @@ export default async function Page(props: { { value: 200 }, ]} numAcount={student.id_cuenta} + id_servicio={3} /> ), }, @@ -124,6 +127,7 @@ export default async function Page(props: { key={4} costs={[{ value: 1 }, { value: 2 }, { value: 5 }]} numAcount={student.id_cuenta} + id_servicio={6} /> ), }, diff --git a/app/(private)/QuitarSancion/page.tsx b/app/(private)/QuitarSancion/page.tsx index 83c7dcf..42dc6ae 100644 --- a/app/(private)/QuitarSancion/page.tsx +++ b/app/(private)/QuitarSancion/page.tsx @@ -27,10 +27,7 @@ export default async function Page(props: { {errorMessage && }

Quitar Sanciones

-
- - -
+ ); } diff --git a/app/Components/Impressions/impressions.tsx b/app/Components/Impressions/impressions.tsx index b0e9029..e05e8a5 100644 --- a/app/Components/Impressions/impressions.tsx +++ b/app/Components/Impressions/impressions.tsx @@ -13,9 +13,10 @@ interface CostOption { interface ImpressionsProps { costs: CostOption[]; numAcount: number | null; + id_servicio: number; } -function Impressions({ costs, numAcount }: ImpressionsProps) { +function Impressions({ costs, numAcount, id_servicio }: ImpressionsProps) { const [pages, setPages] = useState(""); const [cost, setCost] = useState(""); @@ -47,6 +48,7 @@ function Impressions({ costs, numAcount }: ImpressionsProps) { id_cuenta: numAcount, numero_hojas: parseInt(pages), monto: parseInt(cost) * parseInt(pages), + id_servicio, }); if (result.error) { @@ -101,7 +103,10 @@ function Impressions({ costs, numAcount }: ImpressionsProps) { /> -
+