Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
/* eslint-disable react/prop-types */
import React, { useState } from 'react'
import parse from 'html-react-parser'
import EditIcon from '@mui/icons-material/EditOutlined'
import DeleteIcon from '@mui/icons-material/DeleteOutline'
import ConfirmationBox from '../../../../../../shared/confirmation-box/ConfirmationBox'
import { axios } from '../../../../../../utils'
const EducationCard = ({ education, isEdit = false, onEdit = () => { }, setEducations = () => { } }) => {
const [isShowModal, setIsShowModal] = useState(false)
const deleteEducations = async () => {
await axios.post(education.link_delete)
.then(({ data: response }) => {
if (response.success) return setEducations(response.data)
});
};
return (
<div className='card__items'>
<div className="card__options-container">
<h4>{education.university}</h4>
{isEdit &&
<div className='card__options-icons position-relative'>
<button className='button-icon' onClick={() => onEdit('Educación', education.link_edit, education.description || ' ')}>
<EditIcon />
</button>
<button className='button-icon' onClick={() => setIsShowModal(true)}>
<DeleteIcon />
</button>
<ConfirmationBox
show={isShowModal}
onClose={() => setIsShowModal(false)}
onAccept={deleteEducations}
/>
</div>
}
</div>
<p>{`${education.field_of_study} - ${education.degree}`}</p>
<span>{`${education.from_year} - ${education.to_year || 'Actual'}`}</span>
<span>{education.formatted_address}</span>
<p>{education.formatted_adress}</p>
{education.description && parse(education.description)}
</div>
)
}
export default EducationCard