Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Ir a la última revisión | | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
5473 stevensc 1
/* eslint-disable react/prop-types */
2
import React, { useState } from 'react'
3
import parse from 'html-react-parser'
4
import EditIcon from '@mui/icons-material/EditOutlined'
5
import DeleteIcon from '@mui/icons-material/DeleteOutline'
6
import ConfirmationBox from '../../../../../../shared/confirmation-box/ConfirmationBox'
7
import { axios } from '../../../../../../utils'
8
 
9
const EducationCard = ({ education, isEdit = false, onEdit = () => { }, setEducations = () => { } }) => {
10
    const [isShowModal, setIsShowModal] = useState(false)
11
 
12
    const deleteEducations = async () => {
13
        await axios.post(education.link_delete)
14
            .then(({ data: response }) => {
15
                if (response.success) return setEducations(response.data)
16
            });
17
    };
18
 
19
    return (
20
        <div className='card__items'>
21
            <div className="card__options-container">
22
                <h4>{education.university}</h4>
23
                {isEdit &&
24
                    <div className='card__options-icons position-relative'>
25
                        <button className='button-icon' onClick={() => onEdit('Educación', education.link_edit, education.description || ' ')}>
26
                            <EditIcon />
27
                        </button>
28
                        <button className='button-icon' onClick={() => setIsShowModal(true)}>
29
                            <DeleteIcon />
30
                        </button>
31
                        <ConfirmationBox
32
                            show={isShowModal}
33
                            onClose={() => setIsShowModal(false)}
34
                            onAccept={deleteEducations}
35
                        />
36
                    </div>
37
                }
38
            </div>
39
            <p>{`${education.field_of_study} - ${education.degree}`}</p>
40
            <span>{`${education.from_year} -  ${education.to_year || 'Actual'}`}</span>
41
            <span>{education.formatted_address}</span>
42
            <p>{education.formatted_adress}</p>
43
            {education.description && parse(education.description)}
44
        </div>
45
    )
46
}
47
 
48
export default EducationCard