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 +