From 9663171cb153f57d5f62fc8c1ccb89674e39af15 Mon Sep 17 00:00:00 2001 From: IO420 <320154041@pcpuma.acatlan.unam.mx> Date: Thu, 22 Jan 2026 10:26:15 -0600 Subject: [PATCH] fixed selection --- app/(private)/Inscripcion/page.tsx | 15 ++++++++++----- app/Components/Receipt/Inscripcion.tsx | 5 +++-- app/Components/Selection/Selection.tsx | 24 ++++++++++++++++++++---- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/app/(private)/Inscripcion/page.tsx b/app/(private)/Inscripcion/page.tsx index 0e2c3b9..21571d8 100644 --- a/app/(private)/Inscripcion/page.tsx +++ b/app/(private)/Inscripcion/page.tsx @@ -75,6 +75,10 @@ export default async function Page(props: { })) : []; + const plataformasInscritas = Array.isArray(inscripcion) + ? inscripcion.map((ins) => ins.plataforma?.nombre) + : []; + return ( {errorMessage && } @@ -118,11 +122,12 @@ export default async function Page(props: { {student && ( - <> - - - - > + + + )} ); diff --git a/app/Components/Receipt/Inscripcion.tsx b/app/Components/Receipt/Inscripcion.tsx index 11817af..b585412 100644 --- a/app/Components/Receipt/Inscripcion.tsx +++ b/app/Components/Receipt/Inscripcion.tsx @@ -10,9 +10,10 @@ import Selection from "../Selection/Selection"; interface ReceiptsProps { numAcount: number | null; + plataformasInscritas: string[]; } -export default function Inscripcion({ numAcount }: ReceiptsProps) { +export default function Inscripcion({ numAcount, plataformasInscritas }: ReceiptsProps) { const router = useRouter(); const [folio, setFolio] = useState(""); @@ -71,7 +72,7 @@ export default function Inscripcion({ numAcount }: ReceiptsProps) { return ( - + (null); const options = [ @@ -25,16 +29,22 @@ function Selection() { setSelected(selected === optionName ? null : optionName); }; + const opcionesDisponibles = options.filter( + (option) => !plataformasInscritas.includes(option.name), + ); + return ( - {options.map((option, index) => ( + {opcionesDisponibles.map((option, index) => ( handleSelect(option.name)} > {option.name} ))} + + {opcionesDisponibles.length === 0 && ( + + El alumno ya está inscrito en todas las plataformas + + )} ); }
+ El alumno ya está inscrito en todas las plataformas +