2021-11-30 17:00:58 +03:00
|
|
|
|
import React, { useEffect } from 'react'
|
|
|
|
|
import { useHistory, useParams, Link } from 'react-router-dom'
|
|
|
|
|
import { useSelector, useDispatch } from 'react-redux'
|
|
|
|
|
import {
|
|
|
|
|
currentCandidate,
|
|
|
|
|
selectCurrentCandidate,
|
|
|
|
|
auth
|
|
|
|
|
} from '../../redux/outstaffingSlice'
|
|
|
|
|
import arrow from '../../images/right-arrow.png'
|
|
|
|
|
import rectangle from '../../images/rectangle_secondPage.png'
|
|
|
|
|
import Sidebar from '../CandidateSidebar/CandidateSidebar'
|
|
|
|
|
import SkillSection from '../SkillSection/SkillSection'
|
|
|
|
|
import front from '../../images/front_end.png'
|
|
|
|
|
import back from '../../images/back_end.png'
|
|
|
|
|
import design from '../../images/design.png'
|
|
|
|
|
import { fetchGet } from '../../server/server'
|
|
|
|
|
import { Footer } from '../Footer/Footer'
|
|
|
|
|
|
|
|
|
|
import './candidate.scss'
|
|
|
|
|
import { getRole } from '../../redux/roleSlice'
|
2021-08-18 15:56:24 +03:00
|
|
|
|
|
2021-07-02 16:02:47 +03:00
|
|
|
|
const Candidate = () => {
|
2021-11-30 17:00:58 +03:00
|
|
|
|
const history = useHistory()
|
|
|
|
|
const { id: candidateId } = useParams()
|
|
|
|
|
const dispatch = useDispatch()
|
|
|
|
|
const role = useSelector(getRole)
|
2021-07-02 16:02:47 +03:00
|
|
|
|
|
2021-08-18 15:56:24 +03:00
|
|
|
|
useEffect(() => {
|
|
|
|
|
window.scrollTo(0, 0)
|
|
|
|
|
}, [])
|
|
|
|
|
|
2021-07-09 14:01:11 +03:00
|
|
|
|
useEffect(() => {
|
2021-11-30 17:00:58 +03:00
|
|
|
|
fetchGet({
|
|
|
|
|
link: `${process.env.REACT_APP_API_URL}/api/profile/`,
|
|
|
|
|
params: Number(candidateId),
|
|
|
|
|
history,
|
|
|
|
|
role,
|
|
|
|
|
logout: () => dispatch(auth(false))
|
|
|
|
|
}).then((el) => dispatch(currentCandidate(el)))
|
|
|
|
|
}, [dispatch, candidateId])
|
2021-07-05 12:33:24 +03:00
|
|
|
|
|
2021-11-30 17:00:58 +03:00
|
|
|
|
const currentCandidateObj = useSelector(selectCurrentCandidate)
|
2021-05-28 16:21:28 +03:00
|
|
|
|
|
2021-11-30 17:00:58 +03:00
|
|
|
|
const { position_id, skillValues, vc_text: text } = currentCandidateObj
|
2021-06-09 13:12:01 +03:00
|
|
|
|
|
2021-07-09 14:01:11 +03:00
|
|
|
|
const setStyles = () => {
|
|
|
|
|
const styles = {
|
|
|
|
|
classes: '',
|
|
|
|
|
header: '',
|
2021-11-30 17:00:58 +03:00
|
|
|
|
img: ''
|
|
|
|
|
}
|
2021-06-09 13:12:01 +03:00
|
|
|
|
|
2021-07-09 14:01:11 +03:00
|
|
|
|
switch (Number(position_id)) {
|
|
|
|
|
case 1: {
|
2021-11-30 17:00:58 +03:00
|
|
|
|
styles.classes = 'back'
|
|
|
|
|
styles.header = 'Backend'
|
|
|
|
|
styles.img = back
|
2021-07-09 14:01:11 +03:00
|
|
|
|
|
2021-11-30 17:00:58 +03:00
|
|
|
|
break
|
2021-07-09 14:01:11 +03:00
|
|
|
|
}
|
|
|
|
|
case 2: {
|
2021-11-30 17:00:58 +03:00
|
|
|
|
styles.classes = 'des'
|
|
|
|
|
styles.header = 'Frontend'
|
|
|
|
|
styles.img = front
|
|
|
|
|
break
|
2021-07-09 14:01:11 +03:00
|
|
|
|
}
|
|
|
|
|
case 3: {
|
2021-11-30 17:00:58 +03:00
|
|
|
|
styles.classes = 'front'
|
|
|
|
|
styles.header = 'Design'
|
|
|
|
|
styles.img = design
|
|
|
|
|
break
|
2021-07-09 14:01:11 +03:00
|
|
|
|
}
|
|
|
|
|
default:
|
2021-11-30 17:00:58 +03:00
|
|
|
|
break
|
2021-07-09 14:01:11 +03:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-30 17:00:58 +03:00
|
|
|
|
return styles
|
|
|
|
|
}
|
2021-05-26 13:35:57 +03:00
|
|
|
|
|
2021-07-03 17:37:30 +03:00
|
|
|
|
function createMarkup(text) {
|
2021-11-30 17:00:58 +03:00
|
|
|
|
return { __html: text.split('</p>').join('</p>') }
|
2021-07-03 17:37:30 +03:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-30 17:00:58 +03:00
|
|
|
|
const { header, img, classes } = setStyles()
|
2021-07-09 14:01:11 +03:00
|
|
|
|
|
2021-05-26 13:35:57 +03:00
|
|
|
|
return (
|
2021-08-18 15:56:24 +03:00
|
|
|
|
<div className='candidate'>
|
2021-11-30 17:00:58 +03:00
|
|
|
|
<div className='row'>
|
|
|
|
|
<div className='col-12'>
|
|
|
|
|
<div className='candidate__title'>
|
|
|
|
|
<h2>
|
|
|
|
|
<span>Аутстаффинг</span> it-персонала
|
|
|
|
|
</h2>
|
2021-05-26 17:41:11 +03:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-11-30 17:00:58 +03:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className='row'>
|
|
|
|
|
<div className='col-12'>
|
|
|
|
|
<div className='candidate__header'>
|
|
|
|
|
<div className='candidate__arrow' onClick={() => history.push('/')}>
|
|
|
|
|
<div className='candidate__arrow-img'>
|
|
|
|
|
<img src={arrow} alt='' />
|
2021-05-26 17:41:11 +03:00
|
|
|
|
</div>
|
2021-11-30 17:00:58 +03:00
|
|
|
|
<div className='candidate__arrow-sp'>
|
|
|
|
|
<span>Вернуться к списку</span>
|
2021-05-26 17:41:11 +03:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-11-30 17:00:58 +03:00
|
|
|
|
|
|
|
|
|
<div className='candidate__icon'>
|
|
|
|
|
<h3>{header}</h3>
|
|
|
|
|
<img className={classes} src={img} alt='' />
|
|
|
|
|
</div>
|
2021-05-26 17:41:11 +03:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-11-30 17:00:58 +03:00
|
|
|
|
</div>
|
|
|
|
|
<div className='candidate__main'>
|
|
|
|
|
<div className='row'>
|
|
|
|
|
<div className='col-12 col-xl-4'>
|
|
|
|
|
<Sidebar candidate={currentCandidateObj} position />
|
|
|
|
|
</div>
|
|
|
|
|
<div className='col-12 col-xl-8'>
|
|
|
|
|
<div className='candidate__main-description'>
|
|
|
|
|
<img src={rectangle} alt='' />
|
|
|
|
|
<p className='candidate__hashtag'># Описание опыта</p>
|
|
|
|
|
{text ? (
|
|
|
|
|
<div
|
|
|
|
|
className='candidate__text'
|
|
|
|
|
dangerouslySetInnerHTML={createMarkup(text)}
|
|
|
|
|
></div>
|
|
|
|
|
) : (
|
|
|
|
|
<p className='candidate__text-secondary'>
|
|
|
|
|
{currentCandidateObj.vc_text
|
|
|
|
|
? currentCandidateObj.vc_text
|
|
|
|
|
: 'Описание отсутствует...'}
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
{/* <Link to={`/candidate/${currentCandidateObj.id}/form`}>
|
2021-08-18 15:56:24 +03:00
|
|
|
|
<button type="submit" className='candidate__btn'>
|
2021-07-12 17:30:36 +03:00
|
|
|
|
Выбрать к собеседованию
|
|
|
|
|
</button>
|
2021-08-19 16:17:06 +03:00
|
|
|
|
</Link> */}
|
2021-11-30 17:00:58 +03:00
|
|
|
|
<SkillSection skillsArr={skillValues} />
|
2021-05-26 17:41:11 +03:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-11-30 17:00:58 +03:00
|
|
|
|
</div>
|
|
|
|
|
<Footer />
|
2021-08-18 15:56:24 +03:00
|
|
|
|
</div>
|
2021-11-30 17:00:58 +03:00
|
|
|
|
)
|
|
|
|
|
}
|
2021-05-26 13:35:57 +03:00
|
|
|
|
|
2021-11-30 17:00:58 +03:00
|
|
|
|
export default Candidate
|