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 { axios } from '../../../../../../utils'
7
import ConfirmationBox from '../../../../../../shared/confirmation-box/ConfirmationBox'
8
 
9
const ExperienceCard = ({ experience, months, isEdit = false, onEdit = () => { }, setExperiences = () => { } }) => {
10
  const [isShowModal, setIsShowModal] = useState(false)
11
 
12
  const deleteExperience = async () => {
13
    await axios.post(experience.link_delete)
14
      .then(({ data: response }) => {
15
        if (response.success) return setExperiences(response.data)
16
      });
17
  };
18
 
19
  return (
20
    <div className='card__items'>
21
      <div className="card__options-container">
22
        <h4>{experience.title}</h4>
23
        {isEdit &&
24
          <div className='card__options-icons position-relative'>
25
            <button className='button-icon' onClick={() => onEdit('Experiencia', experience.link_edit, experience.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={deleteExperience}
35
            />
36
          </div>
37
        }
38
      </div>
39
      <p>{experience.company}</p>
40
      <span>{`${typeof experience.industry === 'object' ? experience.industry.name : experience.industry} / ${experience.size}`}</span>
41
      <span>
42
        {`${months[experience.from_month - 1]} ${experience.from_year}`} -{' '}
43
        {experience.to_year ? `${months[experience.to_month - 1]} ${experience.to_year}` : 'Actual'}
44
      </span>
45
      <p>{experience.formatted_adress}</p>
46
      {experience.description && parse(experience.description)}
47
    </div>
48
  )
49
}
50
 
51
export default ExperienceCard