From f11aafaf97e5fecf12085c866f86452170f26b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Castellanos?= <77862762+angelcast2002@users.noreply.github.com> Date: Fri, 13 Oct 2023 11:56:18 -0600 Subject: [PATCH 1/5] Loader y cambios en el apartado de subir foto --- .../ImageDirectUploader.module.css | 5 +++ uniEmpleos/src/components/Loader/Loader.jsx | 37 +++++++++++++++++++ .../src/components/Loader/Loader.module.css | 34 +++++++++++++++++ .../PrincipalStudent/PrincipalStudent.jsx | 10 ++++- .../PrincipalStudent.module.css | 8 ++++ 5 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 uniEmpleos/src/components/Loader/Loader.jsx create mode 100644 uniEmpleos/src/components/Loader/Loader.module.css diff --git a/uniEmpleos/src/components/ImageDirectUploader/ImageDirectUploader.module.css b/uniEmpleos/src/components/ImageDirectUploader/ImageDirectUploader.module.css index 9efb7010..9ae44a6f 100644 --- a/uniEmpleos/src/components/ImageDirectUploader/ImageDirectUploader.module.css +++ b/uniEmpleos/src/components/ImageDirectUploader/ImageDirectUploader.module.css @@ -23,6 +23,11 @@ cursor: pointer; border-radius: 5px; border: 2px solid #ccc; + overflow: hidden; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + line-height: 2; } .UploaderInput { diff --git a/uniEmpleos/src/components/Loader/Loader.jsx b/uniEmpleos/src/components/Loader/Loader.jsx new file mode 100644 index 00000000..d8cd61d3 --- /dev/null +++ b/uniEmpleos/src/components/Loader/Loader.jsx @@ -0,0 +1,37 @@ +import React from "react" +import style from "./Loader.module.css" + +const Loader = ({ size }) => { + const customStyle = [ + { + "--d": "200ms", + }, + { + "--d": "400ms", + }, + { + "--d": "600ms", + }, + { + "--d": "800ms", + }, + { + "--d": "1000ms", + }, + ] + + return ( +
+ + + + + +
+ ) +} + +export default Loader diff --git a/uniEmpleos/src/components/Loader/Loader.module.css b/uniEmpleos/src/components/Loader/Loader.module.css new file mode 100644 index 00000000..a795cb21 --- /dev/null +++ b/uniEmpleos/src/components/Loader/Loader.module.css @@ -0,0 +1,34 @@ +.loader { + display: inline-flex; + align-items: center; + column-gap: 5px; +} + +.loader__bar { + display: inline-block; + width: 15%; + height: 30%; + background-color: #000; + opacity: .5; + border-radius: 10px; + animation: scale-up 1000ms + var(--d) linear infinite; +} + +.loader__bar:nth-child(even) { + height: 70%; +} + +.loader__bar:nth-child(3) { + height: 100%; +} + +@keyframes scale-up { + 25% { + opacity: 1; + scale: 1 1.5; + } + 50% { + scale: 1; + } +} \ No newline at end of file diff --git a/uniEmpleos/src/pages/PrincipalStudent/PrincipalStudent.jsx b/uniEmpleos/src/pages/PrincipalStudent/PrincipalStudent.jsx index 46c3749a..f6b892eb 100644 --- a/uniEmpleos/src/pages/PrincipalStudent/PrincipalStudent.jsx +++ b/uniEmpleos/src/pages/PrincipalStudent/PrincipalStudent.jsx @@ -7,6 +7,7 @@ import { Header } from "../../components/Header/Header" import useConfig from "../../Hooks/Useconfig" import API_URL from "../../api" import useApi from "../../Hooks/useApi" +import Loader from "../../components/Loader/Loader" const schema = Joi.object({ token: Joi.string().required(), @@ -21,6 +22,7 @@ const PrincipalStudent = () => { const [carrera, setCarrera] = useState("") const [postulaciones, setPostulaciones] = useState([]) const [ofertasAMostrar, setOfertasAMostrar] = useState([]) + const [loading, setLoading] = useState(false) const form = useConfig(schema, { token: "a", @@ -31,6 +33,7 @@ const PrincipalStudent = () => { const [dataa, setData] = useState([]) const configureData = async () => { + setLoading(true) const response = await fetch(`${API_URL}/api/postulations/previews`, { method: "GET", headers: { @@ -92,18 +95,21 @@ const PrincipalStudent = () => { } }) setOfertasAMostrar(ofertas) + setLoading(false) } useEffect(() => { if (dataa.status === 200) { handleOfertasAMostrar() } - }, [dataa.data, carrera]) + }, [dataa.data, carrera, postulaciones]) return (
- {dataa.status === 200 && ofertasAMostrar.length > 0 ? ( + {loading ? ( +
+ ) : dataa.status === 200 && ofertasAMostrar.length > 0 ? (
{ofertasAMostrar.map((postulation) => ( Date: Fri, 13 Oct 2023 16:40:28 -0600 Subject: [PATCH 2/5] updates --- uniEmpleos/src/components/Header/Header.jsx | 5 ++--- uniEmpleos/src/components/Loader/Loader.module.css | 1 + .../src/pages/PricipalAdmin/PrincipalAdmin.jsx | 12 ++++++++++-- .../pages/PricipalAdmin/PrincipalAdmin.module.css | 7 +++++++ .../PrincipalStudent/PrincipalStudent.module.css | 1 - 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/uniEmpleos/src/components/Header/Header.jsx b/uniEmpleos/src/components/Header/Header.jsx index 997768c7..5163a7b3 100644 --- a/uniEmpleos/src/components/Header/Header.jsx +++ b/uniEmpleos/src/components/Header/Header.jsx @@ -69,9 +69,8 @@ export const Header = () => { return (
diff --git a/uniEmpleos/src/components/Loader/Loader.module.css b/uniEmpleos/src/components/Loader/Loader.module.css index a795cb21..3b7c6697 100644 --- a/uniEmpleos/src/components/Loader/Loader.module.css +++ b/uniEmpleos/src/components/Loader/Loader.module.css @@ -2,6 +2,7 @@ display: inline-flex; align-items: center; column-gap: 5px; + margin: 50px; } .loader__bar { diff --git a/uniEmpleos/src/pages/PricipalAdmin/PrincipalAdmin.jsx b/uniEmpleos/src/pages/PricipalAdmin/PrincipalAdmin.jsx index 81043912..78c159cc 100644 --- a/uniEmpleos/src/pages/PricipalAdmin/PrincipalAdmin.jsx +++ b/uniEmpleos/src/pages/PricipalAdmin/PrincipalAdmin.jsx @@ -9,6 +9,7 @@ import { Header } from "../../components/Header/Header" import { navigate } from "../../store" import useApi from "../../Hooks/useApi" import Popup from "../../components/Popup/Popup" +import Loader from "../../components/Loader/Loader" const schema = Joi.object({ token: Joi.string().required(), @@ -29,8 +30,10 @@ const PrincipalAdmin = () => { const [warning, setWarning] = useState(false) const [error, setError] = useState("") const [typeError, setTypeError] = useState(1) + const [loading, setLoading] = useState(false) const obtenerPreviews = async () => { + setLoading(true) const datos = await api.handleRequest("GET", "/postulations/previews", { id_empresa: user.id_user, }) @@ -47,6 +50,7 @@ const PrincipalAdmin = () => { setError("Ups, algo salio mal al obtener las ofertas") setWarning(true) } + setLoading(false) } useEffect(() => { @@ -54,7 +58,7 @@ const PrincipalAdmin = () => { }, []) return ( -
+
{ style={typeError} close={() => setWarning(false)} /> - {api.data ? ( + {loading ? ( +
+ +
+ ) : api.data ? (
{dataa.map((postulation) => ( Date: Sat, 14 Oct 2023 10:28:25 -0600 Subject: [PATCH 3/5] eliminarOferta Se agrego la opcion para poder ver los detalles de una oferta y que se pueda eliminar como administrador --- uniEmpleos/src/components/InfoTab/InfoTab.jsx | 2 +- .../AdminShowPostulationDetails.jsx | 148 ++++++++++++++++++ .../AdminShowPostulationDetails.module.css | 111 +++++++++++++ .../pages/PricipalAdmin/PrincipalAdmin.jsx | 29 ++++ uniEmpleos/src/pages/index.jsx | 4 + uniEmpleos/src/store/router.js | 4 + 6 files changed, 297 insertions(+), 1 deletion(-) create mode 100644 uniEmpleos/src/pages/AdminShowPostulationDetails/AdminShowPostulationDetails.jsx create mode 100644 uniEmpleos/src/pages/AdminShowPostulationDetails/AdminShowPostulationDetails.module.css diff --git a/uniEmpleos/src/components/InfoTab/InfoTab.jsx b/uniEmpleos/src/components/InfoTab/InfoTab.jsx index 22a39744..badf18fc 100644 --- a/uniEmpleos/src/components/InfoTab/InfoTab.jsx +++ b/uniEmpleos/src/components/InfoTab/InfoTab.jsx @@ -33,7 +33,7 @@ const InfoTab = ({
diff --git a/uniEmpleos/src/pages/AdminShowPostulationDetails/AdminShowPostulationDetails.jsx b/uniEmpleos/src/pages/AdminShowPostulationDetails/AdminShowPostulationDetails.jsx new file mode 100644 index 00000000..27e60849 --- /dev/null +++ b/uniEmpleos/src/pages/AdminShowPostulationDetails/AdminShowPostulationDetails.jsx @@ -0,0 +1,148 @@ +import react, { useEffect, useState } from "react" +import useApi from "../../Hooks/useApi" +import Popup from "../../components/Popup/Popup" +import style from "./AdminShowPostulationDetails.module.css" +import Loader from "../../components/Loader/Loader" +import OfertaInfo from "../../components/ofertaInfo/OfertaInfo" +import { useQuill } from "react-quilljs" +import Button from "../../components/Button/Button" +import { navigate } from "../../store" + +const AdminShowPostulationDetails = ({ id }) => { + const postulationDetails = useApi() + const api = useApi() + const [data, setData] = useState(null) + const [warning, setWarning] = useState(false) + const [error, setError] = useState("") + const [typeError, setTypeError] = useState(1) + const [loading, setLoading] = useState(false) + const { quill, quillRef } = useQuill({ + readOnly: true, // Establecer el editor Quill en modo de solo lectura + modules: { + toolbar: false, // Ocultar la barra de herramientas + }, + }) + const [detalles, setDetalles] = useState("") + + const getPostulationsDetails = async () => { + setLoading(true) + const datos = await postulationDetails.handleRequest( + "POST", + "/offers/all", + { + id_oferta: id, + } + ) + + if (datos.status === 200) { + setData(datos.data) + } else { + setTypeError(1) + setError("Ups, algo salio mal al obtener la oferta") + setWarning(true) + } + setLoading(false) + } + + useEffect(() => { + getPostulationsDetails() + }, []) + + useEffect(() => { + if (data) { + const { offer } = data + setDetalles(offer.descripcion) + } + }, [data]) + + useEffect(() => { + if (quill && detalles) { + try { + quill.setContents(JSON.parse(detalles)) + } catch (error) { + quill.setText(detalles) + } + } + }, [quill, detalles]) + + const onclickAccept = async () => { + const variableApi = `/admins/delete/offers?id_oferta=${id}` + const apiResponse = await api.handleRequest("DELETE", variableApi) + if (apiResponse.status === 200) { + setTypeError(3) + setError("Oferta eliminada con éxito") + setWarning(true) + setTimeout(() => { + navigate("/profileadmin") + }, 5000) + } else { + setTypeError(1) + setError("Upss algo salió mal, intentalo de nuevo") + setWarning(true) + } + } + + const handleReturn = () => { + navigate("/profileadmin") + } + + return ( +
+ setWarning(false)} + /> + {data && !loading ? ( +
+
+
+

{data.offer.puesto}

+ +
+
+
+ + + + + +
+
+ Detalles +
+
+
+
+
+ ) : ( +
+ +
+ )} +
+ ) +} + +export default AdminShowPostulationDetails diff --git a/uniEmpleos/src/pages/AdminShowPostulationDetails/AdminShowPostulationDetails.module.css b/uniEmpleos/src/pages/AdminShowPostulationDetails/AdminShowPostulationDetails.module.css new file mode 100644 index 00000000..b0c0ce37 --- /dev/null +++ b/uniEmpleos/src/pages/AdminShowPostulationDetails/AdminShowPostulationDetails.module.css @@ -0,0 +1,111 @@ +.container { + background-color: #fff; + width: 100%; + height: 100%; + display: flex; + flex-direction: column; +} + +.postulacionContainer { + display: flex; + flex-direction: column; + justify-content: space-evenly; + align-items: center; + gap: 25px; + height: calc(100% - 25px); + background-color: #f5f5f5; + color: #000; + padding: 25px; +} + +.titleContainer{ + width: 80%; + background-color: transparent; + border-radius: 10px; + box-shadow: rgba(0, 0, 0, 0.3) 0px 19px 38px, rgba(0, 0, 0, 0.22) 0px 15px 12px; + padding: 15px; + justify-content: center; + display: flex; + align-items: center; +} + +.buttonContainer { + display: flex; + flex-direction: row; + justify-content: space-between; + width: 75%; + gap: 25px; + padding: 25px 0; +} + +.headertittlecontainer{ + display: flex; + flex-direction: row; + justify-content: center; + width: 100%; +} + +.headertittlecontainer button { + background-color: transparent; + margin-left: auto; +} + +.headertittlecontainer button:hover, .headertittlecontainer button:focus, .headertittlecontainer button:active { + background-color: transparent; + border: none; +} + +.headertittlecontainer h4 { + display: flex; + justify-content: center; + align-items: center; + position: relative; + left: calc(50% - 30px); +} + + +.headertittlecontainer img { + width: 30px; + height: 30px; +} + +button.icontrash{ + width: 10px; + height: 10px; +} + +.dataContainer { + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: flex-start; + gap: 20px; + width: 75%; +} + +.label { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 20px; + width: 75%; +} + +.Editor { + width: 100%; + border: 0 solid #ccc !important; +} + +.imgLabel { + width: 30px; + height: 30px; +} + +.loaderContainer { + display: flex; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; +} \ No newline at end of file diff --git a/uniEmpleos/src/pages/PricipalAdmin/PrincipalAdmin.jsx b/uniEmpleos/src/pages/PricipalAdmin/PrincipalAdmin.jsx index 78c159cc..d05d8f3e 100644 --- a/uniEmpleos/src/pages/PricipalAdmin/PrincipalAdmin.jsx +++ b/uniEmpleos/src/pages/PricipalAdmin/PrincipalAdmin.jsx @@ -26,6 +26,7 @@ const PrincipalAdmin = () => { const { user } = useStoreon("user") const api = useApi() + const obtainPostulantes = useApi() const [dataa, setData] = useState([]) const [warning, setWarning] = useState(false) const [error, setError] = useState("") @@ -53,6 +54,28 @@ const PrincipalAdmin = () => { setLoading(false) } + const handleVerPostulantes = async (id) => { + const datos = await obtainPostulantes.handleRequest( + "POST", + "/offers/applicants", + { + id_oferta: parseInt(id, 10), + } + ) + console.log(datos) + if (datos.data) { + navigate(`/postulantes/${id}`) + } else { + setTypeError(2) + setError("La oferta no tiene postulantes") + setWarning(true) + } + } + + const hadleVerMas = (id) => { + navigate(`/adminSPD/${id}`) + } + useEffect(() => { obtenerPreviews() }, []) @@ -79,6 +102,12 @@ const PrincipalAdmin = () => { salary={`Q.${postulation.salario}.00`} company={postulation.nombre_empresa} labelbutton="Ver más" + onClick={() => { + hadleVerMas(postulation.id_oferta) + }} + verPostulantes={() => { + handleVerPostulantes(postulation.id_oferta) + }} /> ))}
diff --git a/uniEmpleos/src/pages/index.jsx b/uniEmpleos/src/pages/index.jsx index fc5c5d75..1b843249 100644 --- a/uniEmpleos/src/pages/index.jsx +++ b/uniEmpleos/src/pages/index.jsx @@ -19,6 +19,7 @@ import OfferDetails from "./OfferDetails/OfferDetails" import PostulantesPage from "./PostulantesPage/PostulantesPage" import PublicProfile from "./PublicProfile/PublicProfile" import PrincipalAdmin from "./PricipalAdmin/PrincipalAdmin" +import AdminShowPostulationDetails from "./AdminShowPostulationDetails/AdminShowPostulationDetails" const Page = () => { const { [routerKey]: route } = useStoreon(routerKey) @@ -79,6 +80,9 @@ const Page = () => { case "publicprofile": Component = break + case "adminShowPostulationDetails": + Component = + break default: Component =

404 Error

} diff --git a/uniEmpleos/src/store/router.js b/uniEmpleos/src/store/router.js index 17b25c98..82ec9488 100644 --- a/uniEmpleos/src/store/router.js +++ b/uniEmpleos/src/store/router.js @@ -26,4 +26,8 @@ export default createRouter([ "/publicprofile/*", (correo) => ({ page: "publicprofile", props: { correo } }), ], + [ + "/adminSPD/*", + (id) => ({ page: "adminShowPostulationDetails", props: { id } }), + ], ]) From 48f340f6eeeef9c2f06b636e57c8e39be9e23767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Castellanos?= <77862762+angelcast2002@users.noreply.github.com> Date: Mon, 16 Oct 2023 16:59:15 -0600 Subject: [PATCH 4/5] Ver estudiantes como admin Se agrego la pagina para poder ver a los estudiantes cuando se es administrador, asi mismo se hicieron cambios en el InfoStudent, y otras paginas para corregir la estetica --- uniEmpleos/src/components/Header/Header.jsx | 2 +- .../components/InfoStudent/InfoStudent.jsx | 27 ++++++- .../InfoStudent/InfoStudent.module.css | 28 ++++++- uniEmpleos/src/components/InfoTab/InfoTab.jsx | 4 +- .../src/pages/AdminStudent/AdminStudent.jsx | 80 +++++++++++++++++++ .../AdminStudent/AdminStudent.module.css | 10 +++ .../pages/PostulantesPage/PostulantesPage.jsx | 49 +++++++----- .../PostulationsEmpresa.jsx | 13 ++- uniEmpleos/src/pages/index.jsx | 4 + uniEmpleos/src/store/router.js | 1 + 10 files changed, 187 insertions(+), 31 deletions(-) create mode 100644 uniEmpleos/src/pages/AdminStudent/AdminStudent.jsx create mode 100644 uniEmpleos/src/pages/AdminStudent/AdminStudent.module.css diff --git a/uniEmpleos/src/components/Header/Header.jsx b/uniEmpleos/src/components/Header/Header.jsx index 5163a7b3..1c2f380e 100644 --- a/uniEmpleos/src/components/Header/Header.jsx +++ b/uniEmpleos/src/components/Header/Header.jsx @@ -70,7 +70,7 @@ export const Header = () => {
diff --git a/uniEmpleos/src/components/InfoStudent/InfoStudent.jsx b/uniEmpleos/src/components/InfoStudent/InfoStudent.jsx index e7aa5c01..a141469a 100644 --- a/uniEmpleos/src/components/InfoStudent/InfoStudent.jsx +++ b/uniEmpleos/src/components/InfoStudent/InfoStudent.jsx @@ -2,7 +2,15 @@ import React from "react" import PropTypes from "prop-types" import style from "./InfoStudent.module.css" -const InfoStudent = ({ nombre, apellido, universidad, pfp, onClick }) => { +const InfoStudent = ({ + nombre, + apellido, + universidad, + pfp, + onClick, + showState, + state, +}) => { return (
{`${nombre} ${apellido}`} - {universidad} + {universidad && ( + {universidad} + )} + {showState && ( +
+ Estado: + + {`${state}`} + +
+ )}
@@ -21,9 +41,10 @@ const InfoStudent = ({ nombre, apellido, universidad, pfp, onClick }) => { InfoStudent.propTypes = { nombre: PropTypes.string.isRequired, apellido: PropTypes.string.isRequired, - universidad: PropTypes.string.isRequired, + universidad: PropTypes.string, pfp: PropTypes.string.isRequired, onClick: PropTypes.func.isRequired, + estado: PropTypes.string, } export default InfoStudent diff --git a/uniEmpleos/src/components/InfoStudent/InfoStudent.module.css b/uniEmpleos/src/components/InfoStudent/InfoStudent.module.css index 1f6e6512..544638f1 100644 --- a/uniEmpleos/src/components/InfoStudent/InfoStudent.module.css +++ b/uniEmpleos/src/components/InfoStudent/InfoStudent.module.css @@ -5,6 +5,7 @@ height: 100px; padding: 10px; animation: aparecer 0.5s ease; + justify-content: space-evenly; } @keyframes aparecer { @@ -20,7 +21,7 @@ .button { display: flex; - width: 100%; + width: calc(100% - 20px); height: 100%; justify-content: start; align-items: center; @@ -29,7 +30,7 @@ background-color: #8c6fd454; gap: 20px; border-radius: 10px; - padding: 0; + padding: 0 10px; } .button:hover { @@ -62,7 +63,7 @@ .infoContainer { width: calc(75% - 20px); - height: 80%; + height: 100%; display: flex; flex-direction: column; overflow: auto; @@ -84,3 +85,24 @@ color: #333333; text-align: left; } + +.stateContainer { + display: flex; + flex-direction: row; + gap: 5px; +} + +@media (max-width: 767px) { + .mainContainer { + width: calc(100% - 20px); + height: 150px; + } + + .pfpContainer { + width: calc(30% - 20px); + } + + .infoContainer { + width: calc(70% - 20px); + } +} diff --git a/uniEmpleos/src/components/InfoTab/InfoTab.jsx b/uniEmpleos/src/components/InfoTab/InfoTab.jsx index badf18fc..d3ee472a 100644 --- a/uniEmpleos/src/components/InfoTab/InfoTab.jsx +++ b/uniEmpleos/src/components/InfoTab/InfoTab.jsx @@ -42,9 +42,9 @@ const InfoTab = ({ InfoTab.propTypes = { title: PropTypes.string.isRequired, - area: PropTypes.string.isRequired, + area: PropTypes.string, salary: PropTypes.string.isRequired, - company: PropTypes.string.isRequired, + company: PropTypes.string, labelbutton: PropTypes.string.isRequired, onClick: PropTypes.func.isRequired, verPostulantes: PropTypes.func.isRequired, diff --git a/uniEmpleos/src/pages/AdminStudent/AdminStudent.jsx b/uniEmpleos/src/pages/AdminStudent/AdminStudent.jsx new file mode 100644 index 00000000..a68434d5 --- /dev/null +++ b/uniEmpleos/src/pages/AdminStudent/AdminStudent.jsx @@ -0,0 +1,80 @@ +import React, { useEffect, useState } from "react" +import Header from "../../components/Header/Header" +import style from "./AdminStudent.module.css" +import InfoStudent from "../../components/InfoStudent/InfoStudent" +import useApi from "../../Hooks/useApi" +import Popup from "../../components/Popup/Popup" +import Loader from "../../components/Loader/Loader" +import fotoPFP from "/images/pfp.svg" +import API_URL from "../../api" + +const ProfileAdminStudent = () => { + const students = useApi() + const [studentsData, setStudentsData] = useState([]) + const [warning, setWarning] = useState(false) + const [error, setError] = useState("") + const [typeError, setTypeError] = useState(1) + const [loading, setLoading] = useState(false) + + const obtainStudents = async () => { + setLoading(true) + const data = await students.handleRequest("GET", "/admins/students") + if (data.status === 200) { + setStudentsData(data.data) + } else { + setTypeError(1) + setError("Ups, algo salio mal al obtener los estudiantes") + setWarning(true) + } + setLoading(false) + } + const handleStudentClick = (e) => { + console.log(e) + } + + useEffect(() => { + obtainStudents() + }, []) + + console.log(studentsData.studets) + return ( +
+
+ setWarning(false)} + /> + {loading ? ( + + ) : ( +
+ {studentsData.studets ? ( + studentsData.studets.map((student) => ( + { + handleStudentClick(student.id_estudiante) + }} + showState + state={student.suspendido} + /> + )) + ) : ( +

No hay estudiantes

+ )} +
+ )} +
+ ) +} + +export default ProfileAdminStudent diff --git a/uniEmpleos/src/pages/AdminStudent/AdminStudent.module.css b/uniEmpleos/src/pages/AdminStudent/AdminStudent.module.css new file mode 100644 index 00000000..9d9651ab --- /dev/null +++ b/uniEmpleos/src/pages/AdminStudent/AdminStudent.module.css @@ -0,0 +1,10 @@ + + + +.studentsContainer { + width: 100%; + display: flex; + flex-wrap: wrap; +} + + diff --git a/uniEmpleos/src/pages/PostulantesPage/PostulantesPage.jsx b/uniEmpleos/src/pages/PostulantesPage/PostulantesPage.jsx index 7383b7f7..ba963268 100644 --- a/uniEmpleos/src/pages/PostulantesPage/PostulantesPage.jsx +++ b/uniEmpleos/src/pages/PostulantesPage/PostulantesPage.jsx @@ -8,6 +8,7 @@ import { Header } from "../../components/Header/Header" import { navigate } from "../../store" import API_URL from "../../api" import fotoPFP from "/images/pfp.svg" +import Loader from "../../components/Loader/Loader" const PostulantesPage = ({ id }) => { const api = useApi() @@ -15,8 +16,12 @@ const PostulantesPage = ({ id }) => { const [warning, setWarning] = useState(false) const [error, setError] = useState("") const [typeError, setTypeError] = useState(1) + const [loading, setLoading] = useState(false) + + console.log(id) const obtainPostulantes = async () => { + setLoading(true) const datos = await api.handleRequest("POST", "/offers/applicants", { id_oferta: parseInt(id, 10), }) @@ -27,6 +32,7 @@ const PostulantesPage = ({ id }) => { setError("Error al obtener los postulantes") setWarning(true) } + setLoading(false) } useEffect(() => { @@ -47,25 +53,30 @@ const PostulantesPage = ({ id }) => { close={() => setWarning(false)} />

Postulantes

-
- {response.data ? ( - response.data.map((postulante) => ( - handleClickUsuario(postulante.id_estudiante)} - /> - )) - ) : ( - No hay postulantes - )} -
+ {loading ? ( + + ) : ( +
+ {response.data ? ( + response.data.map((postulante) => ( + handleClickUsuario(postulante.id_estudiante)} + /> + )) + ) : ( + No hay postulantes + )} +
+ )}
) } diff --git a/uniEmpleos/src/pages/PostulationsEmpresa/PostulationsEmpresa.jsx b/uniEmpleos/src/pages/PostulationsEmpresa/PostulationsEmpresa.jsx index 1528184f..d6768061 100644 --- a/uniEmpleos/src/pages/PostulationsEmpresa/PostulationsEmpresa.jsx +++ b/uniEmpleos/src/pages/PostulationsEmpresa/PostulationsEmpresa.jsx @@ -8,6 +8,7 @@ import { Header } from "../../components/Header/Header" import { navigate } from "../../store" import useApi from "../../Hooks/useApi" import Popup from "../../components/Popup/Popup" +import Loader from "../../components/Loader/Loader" const schema = Joi.object({ token: Joi.string().required(), @@ -30,15 +31,18 @@ const PostulationsEmpresa = () => { const [warning, setWarning] = useState(false) const [error, setError] = useState("") const [typeError, setTypeError] = useState(1) + const [loading, setLoading] = useState(false) useEffect(() => { if (api.data) { const { offers } = api.data setData(offers) } + setLoading(false) }, [api.data]) useEffect(() => { + setLoading(true) api.handleRequest("POST", "/offers/company", { id_empresa: user.id_user, }) @@ -72,17 +76,20 @@ const PostulationsEmpresa = () => { return (
-
+
setWarning(false)} /> - {api.data ? ( + {loading ? ( + + ) : dataa.length > 0 ? (
{dataa.map((postulation) => ( {
) : (
-

No tiene niguna oferta activa

+

No tiene niguna oferta activa

)}
diff --git a/uniEmpleos/src/pages/index.jsx b/uniEmpleos/src/pages/index.jsx index 1b843249..df13005b 100644 --- a/uniEmpleos/src/pages/index.jsx +++ b/uniEmpleos/src/pages/index.jsx @@ -20,6 +20,7 @@ import PostulantesPage from "./PostulantesPage/PostulantesPage" import PublicProfile from "./PublicProfile/PublicProfile" import PrincipalAdmin from "./PricipalAdmin/PrincipalAdmin" import AdminShowPostulationDetails from "./AdminShowPostulationDetails/AdminShowPostulationDetails" +import ProfileAdminStudent from "./AdminStudent/AdminStudent" const Page = () => { const { [routerKey]: route } = useStoreon(routerKey) @@ -83,6 +84,9 @@ const Page = () => { case "adminShowPostulationDetails": Component = break + case "adminStudent": + Component = + break default: Component =

404 Error

} diff --git a/uniEmpleos/src/store/router.js b/uniEmpleos/src/store/router.js index 82ec9488..04659bba 100644 --- a/uniEmpleos/src/store/router.js +++ b/uniEmpleos/src/store/router.js @@ -30,4 +30,5 @@ export default createRouter([ "/adminSPD/*", (id) => ({ page: "adminShowPostulationDetails", props: { id } }), ], + ["/profileadminstudent", () => ({ page: "adminStudent" })], ]) From a329d75733314b5e293a2da2519fb5f575c6f3bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Castellanos?= <77862762+angelcast2002@users.noreply.github.com> Date: Tue, 17 Oct 2023 18:48:47 -0600 Subject: [PATCH 5/5] Update AdminStudent.jsx --- .../src/pages/AdminStudent/AdminStudent.jsx | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/uniEmpleos/src/pages/AdminStudent/AdminStudent.jsx b/uniEmpleos/src/pages/AdminStudent/AdminStudent.jsx index a68434d5..94d512c3 100644 --- a/uniEmpleos/src/pages/AdminStudent/AdminStudent.jsx +++ b/uniEmpleos/src/pages/AdminStudent/AdminStudent.jsx @@ -51,23 +51,25 @@ const ProfileAdminStudent = () => { ) : (
{studentsData.studets ? ( - studentsData.studets.map((student) => ( - { - handleStudentClick(student.id_estudiante) - }} - showState - state={student.suspendido} - /> - )) + studentsData.studets.map((student) => { + const pfpUrlEmisor = + student.foto === "" + ? "/images/pfp.svg" + : `${API_URL}/api/uploads/${student.foto}` + return ( + { + handleStudentClick(student.id_estudiante) + }} + showState + state={student.suspendido} + /> + ) + }) ) : (

No hay estudiantes

)}