From 2beaa87060d309b10f441d6f96717cf0cd26285c Mon Sep 17 00:00:00 2001 From: IO Date: Wed, 26 Jun 2024 22:22:22 -0600 Subject: [PATCH 1/6] cardUsuario --- src/components/CardUsuarios/CardUsuario.js | 16 ++++++++++++---- src/components/CardUsuarios/MapeoUsuario.js | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/components/CardUsuarios/CardUsuario.js b/src/components/CardUsuarios/CardUsuario.js index 22c0a1e..abaa6a9 100644 --- a/src/components/CardUsuarios/CardUsuario.js +++ b/src/components/CardUsuarios/CardUsuario.js @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import '../App.css'; -const CardUsuario = ({ usuario}) => { +const CardUsuario = ({usuario,permissions}) => { const [showDialog, setShowDialog] = useState(false); const [confirmText, setConfirmText] = useState(''); @@ -55,9 +55,17 @@ const CardUsuario = ({ usuario}) => {

{usuario.nombre}

Tipo de Usuario:
-
- - +
+ {permissions ? ( + <> + + + + ) : null}
{showDialog && ( diff --git a/src/components/CardUsuarios/MapeoUsuario.js b/src/components/CardUsuarios/MapeoUsuario.js index 82981da..8c3300c 100644 --- a/src/components/CardUsuarios/MapeoUsuario.js +++ b/src/components/CardUsuarios/MapeoUsuario.js @@ -39,7 +39,7 @@ const MapeoUsuario = ({ filters }) => { tipoUsuario: filters.tipoUsuario || '' }).toString(); - fetch(`http://localhost:3000/auth?${query}`, { + fetch(`http://localhost:3000/auth/page?${query}`, { headers: { 'Authorization': `Bearer ${jwt}` } From 5ef84713f3f7ca964c63d793d59511444850421f Mon Sep 17 00:00:00 2001 From: IO <320154041@pcpuma.acatlan.unam.mx> Date: Thu, 27 Jun 2024 11:11:12 -0600 Subject: [PATCH 2/6] cedetec --- src/components/CardProfesores/CardProfesor.js | 2 -- src/components/{ => Filter}/FilterProfesor.css | 0 src/components/{ => Filter}/FilterProfesor.js | 2 +- src/pages/Directorio.js | 2 +- src/redux/states/user.ts | 7 ------- src/redux/store.ts | 11 ----------- 6 files changed, 2 insertions(+), 22 deletions(-) rename src/components/{ => Filter}/FilterProfesor.css (100%) rename src/components/{ => Filter}/FilterProfesor.js (99%) delete mode 100644 src/redux/states/user.ts delete mode 100644 src/redux/store.ts diff --git a/src/components/CardProfesores/CardProfesor.js b/src/components/CardProfesores/CardProfesor.js index 8719a6d..83a82eb 100644 --- a/src/components/CardProfesores/CardProfesor.js +++ b/src/components/CardProfesores/CardProfesor.js @@ -15,13 +15,11 @@ 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(); } }; const handleEditClick = () => { - // Redirige a la página de edición del profesor window.location.href = `${PrivateRoutes.EDITARPROFESOR}${profesor.id_profesor}`; }; diff --git a/src/components/FilterProfesor.css b/src/components/Filter/FilterProfesor.css similarity index 100% rename from src/components/FilterProfesor.css rename to src/components/Filter/FilterProfesor.css diff --git a/src/components/FilterProfesor.js b/src/components/Filter/FilterProfesor.js similarity index 99% rename from src/components/FilterProfesor.js rename to src/components/Filter/FilterProfesor.js index f7bec42..0121293 100644 --- a/src/components/FilterProfesor.js +++ b/src/components/Filter/FilterProfesor.js @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import './FilterProfesor.css'; -import Mapeo from './Mapeo'; +import Mapeo from '../Mapeo'; function FilterProfesor() { const [nombre, setNombre] = useState(''); diff --git a/src/pages/Directorio.js b/src/pages/Directorio.js index aea93f7..87c4daf 100644 --- a/src/pages/Directorio.js +++ b/src/pages/Directorio.js @@ -1,5 +1,5 @@ import '../App.css'; -import FilterProfesor from '../components/FilterProfesor' +import FilterProfesor from '../components/Filter/FilterProfesor' const Directorio = () => { return ( diff --git a/src/redux/states/user.ts b/src/redux/states/user.ts deleted file mode 100644 index f0741e3..0000000 --- a/src/redux/states/user.ts +++ /dev/null @@ -1,7 +0,0 @@ -import {createSlice} from '@reduxjs/toolkit' -import {UserInfo} from '../../models/user.model' - -export const userSlice = createSlice({ - name:'user', - initialState: -}) \ No newline at end of file diff --git a/src/redux/store.ts b/src/redux/store.ts deleted file mode 100644 index b7c8746..0000000 --- a/src/redux/store.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { UserInfo } from "../models/user.model" - -export interface AppStore{ - user:UserInfo; -} - -export default configureStore({ - reducer:{ - user: - } -}) \ No newline at end of file From 38693908bfcfedc57375a69a436d142e08510036 Mon Sep 17 00:00:00 2001 From: IO <320154041@pcpuma.acatlan.unam.mx> Date: Thu, 27 Jun 2024 14:24:28 -0600 Subject: [PATCH 3/6] Update profesor --- src/App.js | 4 +- src/components/CardProfesores/CardProfesor.js | 2 +- src/components/CardUsuarios/CardUsuario.js | 22 +- src/components/CardUsuarios/MapeoUsuario.js | 10 +- src/components/FormEditProfesor.css | 6 +- src/components/FormEditProfesor.js | 395 ++++++++++++------ src/models/routes.js | 3 +- src/pages/FormEditProfesorPage.js | 24 +- 8 files changed, 283 insertions(+), 183 deletions(-) diff --git a/src/App.js b/src/App.js index d6b1428..4370e7c 100644 --- a/src/App.js +++ b/src/App.js @@ -30,8 +30,8 @@ const App = () => { }> }> } /> - }> - } /> + }> + } /> } /> }> diff --git a/src/components/CardProfesores/CardProfesor.js b/src/components/CardProfesores/CardProfesor.js index 74bf961..28107ba 100644 --- a/src/components/CardProfesores/CardProfesor.js +++ b/src/components/CardProfesores/CardProfesor.js @@ -15,7 +15,7 @@ const CardProfesor = ({ profesor, edificioNombre, permissions }) => { await fetchDelete(profesor.id_profesor); setShowDialog(false); setConfirmText(''); - // window.location.reload(); + window.location.reload(); } }; diff --git a/src/components/CardUsuarios/CardUsuario.js b/src/components/CardUsuarios/CardUsuario.js index 55660a6..d612381 100644 --- a/src/components/CardUsuarios/CardUsuario.js +++ b/src/components/CardUsuarios/CardUsuario.js @@ -1,11 +1,8 @@ import React, { useState } from 'react'; import '../../App.css'; +import { PrivateRoutes } from '../../models/routes'; -<<<<<<<<< Temporary merge branch 1:src/components/CardUsuario.js -const CardUsuario = ({ usuario, permissions }) => { -========= const CardUsuario = ({ usuario}) => { ->>>>>>>>> Temporary merge branch 2:src/components/CardUsuarios/CardUsuario.js const [showDialog, setShowDialog] = useState(false); const [confirmText, setConfirmText] = useState(''); @@ -18,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) => { @@ -59,21 +56,10 @@ const CardUsuario = ({ usuario}) => {

{usuario.nombre}

-<<<<<<<<< Temporary merge branch 1:src/components/CardUsuario.js -
Tipo de Usuario: {usuario.id_tipo_usuario === 1 ? 'Administrador' : 'Responsable'}
-
- {permissions && ( - <> - - - - )} -=========
Tipo de Usuario:
->>>>>>>>> Temporary merge branch 2:src/components/CardUsuarios/CardUsuario.js
{showDialog && ( @@ -90,5 +76,5 @@ const CardUsuario = ({ usuario}) => {
)}
-) +)} export default CardUsuario; diff --git a/src/components/CardUsuarios/MapeoUsuario.js b/src/components/CardUsuarios/MapeoUsuario.js index 8e882f1..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,15 +34,11 @@ const MapeoUsuario = ({ filters }) => { limit: 10, }).toString(); -<<<<<<<<< Temporary merge branch 1:src/components/MapeoUsuario.js - fetch(`http://localhost:3000/auth/?${query}`) -========= fetch(`http://localhost:3000/auth?${query}`, { headers: { 'Authorization': `Bearer ${jwt}` } }) ->>>>>>>>> Temporary merge branch 2:src/components/CardUsuarios/MapeoUsuario.js .then(response => { if (!response.ok) { throw new Error('La respuesta de la red no fue correcta'); @@ -101,13 +98,8 @@ const MapeoUsuario = ({ filters }) => { return (
-<<<<<<<<< Temporary merge branch 1:src/components/MapeoUsuario.js - {usuarios && usuarios.map(usuario => ( - -========= {usuarios.map(usuario => ( ->>>>>>>>> Temporary merge branch 2:src/components/CardUsuarios/MapeoUsuario.js ))}