-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #216 from markalbrand56/angel
Angel
- Loading branch information
Showing
19 changed files
with
596 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<div | ||
className={style.loader} | ||
style={{ width: `${size}px`, height: `${size}px` }} | ||
> | ||
<span className={style.loader__bar} style={customStyle[0]}></span> | ||
<span className={style.loader__bar} style={customStyle[1]}></span> | ||
<span className={style.loader__bar} style={customStyle[2]}></span> | ||
<span className={style.loader__bar} style={customStyle[3]}></span> | ||
<span className={style.loader__bar} style={customStyle[4]}></span> | ||
</div> | ||
) | ||
} | ||
|
||
export default Loader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.loader { | ||
display: inline-flex; | ||
align-items: center; | ||
column-gap: 5px; | ||
margin: 50px; | ||
} | ||
|
||
.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; | ||
} | ||
} |
148 changes: 148 additions & 0 deletions
148
uniEmpleos/src/pages/AdminShowPostulationDetails/AdminShowPostulationDetails.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<div className={style.container}> | ||
<Popup | ||
message={error} | ||
status={warning} | ||
style={typeError} | ||
close={() => setWarning(false)} | ||
/> | ||
{data && !loading ? ( | ||
<div className={style.postulacionContainer}> | ||
<div className={style.headertittlecontainer}> | ||
<div className={style.titleContainer}> | ||
<h4>{data.offer.puesto}</h4> | ||
<button | ||
onClick={onclickAccept} | ||
type="button" | ||
className={style.deleteButton} | ||
> | ||
<img src="/images/delete.svg" alt="trash" /> | ||
</button> | ||
</div> | ||
</div> | ||
<div className={style.dataContainer}> | ||
<OfertaInfo img="/images/empresa.svg" label={data.company.nombre} /> | ||
<OfertaInfo img="/images/email.svg" label={data.company.correo} /> | ||
<OfertaInfo | ||
img="/images/telefono.svg" | ||
label={data.company.telefono} | ||
/> | ||
<OfertaInfo | ||
img="/images/requisitos.svg" | ||
label={data.offer.requisitos} | ||
/> | ||
<OfertaInfo | ||
img="/images/salario.svg" | ||
label={data.offer.salario.toString()} | ||
/> | ||
</div> | ||
<div className={style.label}> | ||
Detalles | ||
<div ref={quillRef} className={style.Editor} /> | ||
</div> | ||
<div className={style.buttonContainer}> | ||
<Button | ||
label="Regresar" | ||
backgroundColor="transparet" | ||
onClick={handleReturn} | ||
/> | ||
</div> | ||
</div> | ||
) : ( | ||
<div className={style.loaderContainer}> | ||
<Loader size={100} /> | ||
</div> | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
export default AdminShowPostulationDetails |
Oops, something went wrong.