diff --git a/src/App.js b/src/App.js index 09149ad..1be49f9 100644 --- a/src/App.js +++ b/src/App.js @@ -17,6 +17,7 @@ import { PrivateRoutes, PublicRoutes } from './models/routes'; import NavUsuario from './components/CardUsuarios/NavUsuarios'; import InterAdmin from './pages/PanelNavegacion/InterAdmin'; import InterResp from './components/InterResp' + const App = () => { return (
@@ -24,14 +25,14 @@ const App = () => {
}> - } /> + } /> }> } /> }> }> - } /> - }> - } /> + } /> + }> + } /> } /> }> diff --git a/src/components/CardProfesores/CardProfesor.css b/src/components/CardProfesores/CardProfesor.css index 2278105..1d343d1 100644 --- a/src/components/CardProfesores/CardProfesor.css +++ b/src/components/CardProfesores/CardProfesor.css @@ -1,18 +1,18 @@ .card { - max-width: 450px; - width: 100%; - height: 175px; - margin: auto; - padding: 0.5em; - border-radius: 1em !important; - background: #f9f9f9 !important; - box-shadow: 0 4px 8px 2px rgba(0, 0, 0, 0.1); - display: flex; - flex-direction: row !important; - justify-content: left; - text-align: center; - transition: box-shadow 0.3s ease, transform 0.3s ease; -} + max-width: 400px; + width: 100%; + height: 175px; + margin: auto; + padding: 0.5em; + border-radius: 1em !important; + background: #f9f9f9 !important; + box-shadow: 0 4px 8px 2px rgba(0, 0, 0, 0.1); + display: flex; + flex-direction: row !important; + justify-content: left; + text-align: center; + transition: box-shadow 0.3s ease, transform 0.3s ease; + } .card:hover { box-shadow: 0 8px 16px 4px rgba(0, 0, 0, 0.2); diff --git a/src/components/CardProfesores/CardProfesor.js b/src/components/CardProfesores/CardProfesor.js index 73b423a..88b794b 100644 --- a/src/components/CardProfesores/CardProfesor.js +++ b/src/components/CardProfesores/CardProfesor.js @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import './CardProfesor.css'; -import { PrivateRoutes } from '../../models/routes'; +import { PrivateRoutes, PublicRoutes } from '../../models/routes'; const CardProfesor = ({ profesor, edificioNombre, permissions }) => { const [showDialog, setShowDialog] = useState(false); @@ -15,16 +15,18 @@ const CardProfesor = ({ profesor, edificioNombre, permissions }) => { await fetchDelete(profesor.id_profesor); setShowDialog(false); setConfirmText(''); - // Opcional: Puedes recargar la página después de eliminar - // window.location.reload(); + window.location.reload(); } }; const handleEditClick = () => { - // Redirige a la página de edición del profesor window.location.href = `${PrivateRoutes.EDITARPROFESOR}${profesor.id_profesor}`; }; + const handleViewProfesor = () =>{ + window.location.href = `${PublicRoutes.DATAPROFESOR}${profesor.id_profesor}`; + } + const fetchDelete = async (id_profesor) => { try { const token = localStorage.getItem('Token'); @@ -55,11 +57,11 @@ const CardProfesor = ({ profesor, edificioNombre, permissions }) => { return (
- Profesor img + Profesor img
-

{profesor.nombre}

-
{edificioNombre}
+

{profesor.nombre}

+
{edificioNombre}
{permissions ? ( @@ -73,7 +75,7 @@ const CardProfesor = ({ profesor, edificioNombre, permissions }) => { ) : null}
-
+
{showDialog && (
diff --git a/src/components/CardUsuarios/CardUsuario.js b/src/components/CardUsuarios/CardUsuario.js index 779c3a6..d612381 100644 --- a/src/components/CardUsuarios/CardUsuario.js +++ b/src/components/CardUsuarios/CardUsuario.js @@ -1,5 +1,6 @@ import React, { useState } from 'react'; import '../../App.css'; +import { PrivateRoutes } from '../../models/routes'; const CardUsuario = ({ usuario}) => { const [showDialog, setShowDialog] = useState(false); @@ -14,12 +15,12 @@ const CardUsuario = ({ usuario}) => { await fetchDelete(usuario.id_usuario); setShowDialog(false); setConfirmText(''); - // Evita recargar la página directamente en React + window.location.reload(); } }; const handleEditClick = () => { - window.location.href = `/Usuario/editar/${usuario.id_usuario}`; + window.location.href = `${PrivateRoutes.EDITARPROFESOR}${usuario.id_usuario}`; }; const fetchDelete = async (id_usuario) => { @@ -75,7 +76,5 @@ const CardUsuario = ({ usuario}) => {
)}
- ); -}; - +)} export default CardUsuario; diff --git a/src/components/CardUsuarios/MapeoUsuario.js b/src/components/CardUsuarios/MapeoUsuario.js index 561229a..ed8b6a5 100644 --- a/src/components/CardUsuarios/MapeoUsuario.js +++ b/src/components/CardUsuarios/MapeoUsuario.js @@ -6,6 +6,7 @@ const MapeoUsuario = ({ filters }) => { const [usuarios, setUsuarios] = useState([]); const [currentPage, setCurrentPage] = useState(1); const [totalPages, setTotalPages] = useState(1); + const [jwt,setJwt] = useState(); useEffect(() => { jwtPermissions(); @@ -33,7 +34,11 @@ const MapeoUsuario = ({ filters }) => { limit: 10, }).toString(); - fetch(`http://localhost:3000/auth/?${query}`) + fetch(`http://localhost:3000/auth?${query}`, { + headers: { + 'Authorization': `Bearer ${jwt}` + } + }) .then(response => { if (!response.ok) { throw new Error('La respuesta de la red no fue correcta'); @@ -93,13 +98,9 @@ const MapeoUsuario = ({ filters }) => { return (
- {usuarios.length > 0 ? ( - usuarios.map(usuario => ( - - )) - ) : ( -

No se encontraron usuarios.

- )} + {usuarios.map(usuario => ( + + ))}