2021-07-09 14:01:11 +03:00
|
|
|
|
import React, { useEffect } from 'react';
|
2021-07-12 17:30:36 +03:00
|
|
|
|
import { useHistory, useParams, Link } from 'react-router-dom';
|
2021-07-02 16:02:47 +03:00
|
|
|
|
import { useSelector, useDispatch } from 'react-redux';
|
2021-07-09 14:01:11 +03:00
|
|
|
|
import { currentCandidate, selectCurrentCandidate } from '../../redux/outstaffingSlice';
|
2021-05-26 17:41:11 +03:00
|
|
|
|
import arrow from '../../images/right-arrow.png';
|
2021-05-27 17:44:11 +03:00
|
|
|
|
import rectangle from '../../images/rectangle_secondPage.png';
|
2021-06-01 15:25:01 +03:00
|
|
|
|
import Sidebar from '../Sidebar/Sidebar';
|
2021-07-02 16:02:47 +03:00
|
|
|
|
import SectionSkills from './SectionSkills';
|
2021-07-05 12:33:24 +03:00
|
|
|
|
import front from '../../images/front_end.png';
|
|
|
|
|
import back from '../../images/back_end.png';
|
|
|
|
|
import design from '../../images/design.png';
|
2021-07-09 14:01:11 +03:00
|
|
|
|
import { fetchItemsForId } from '../../server/server';
|
2021-07-03 17:37:30 +03:00
|
|
|
|
|
2021-08-18 15:56:24 +03:00
|
|
|
|
import './candidate.css';
|
|
|
|
|
|
2021-07-02 16:02:47 +03:00
|
|
|
|
const Candidate = () => {
|
2021-05-26 15:59:00 +03:00
|
|
|
|
const history = useHistory();
|
2021-05-28 16:21:28 +03:00
|
|
|
|
const { id: candidateId } = useParams();
|
2021-07-02 16:02:47 +03:00
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
2021-08-18 15:56:24 +03:00
|
|
|
|
useEffect(() => {
|
|
|
|
|
window.scrollTo(0, 0)
|
|
|
|
|
}, [])
|
|
|
|
|
|
2021-07-09 14:01:11 +03:00
|
|
|
|
useEffect(() => {
|
2021-08-05 16:44:49 +03:00
|
|
|
|
fetchItemsForId(`${process.env.REACT_APP_API_URL}/api/profile/`, Number(candidateId)).then((el) =>
|
2021-07-09 14:01:11 +03:00
|
|
|
|
dispatch(currentCandidate(el))
|
|
|
|
|
);
|
|
|
|
|
}, [dispatch, candidateId]);
|
2021-07-05 12:33:24 +03:00
|
|
|
|
|
2021-07-02 16:02:47 +03:00
|
|
|
|
const currentCandidateObj = useSelector(selectCurrentCandidate);
|
2021-05-28 16:21:28 +03:00
|
|
|
|
|
2021-07-08 11:03:47 +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: '',
|
|
|
|
|
img: '',
|
|
|
|
|
};
|
2021-06-09 13:12:01 +03:00
|
|
|
|
|
2021-07-09 14:01:11 +03:00
|
|
|
|
switch (Number(position_id)) {
|
|
|
|
|
case 1: {
|
2021-08-18 15:56:24 +03:00
|
|
|
|
styles.classes = 'back';
|
2021-07-09 14:01:11 +03:00
|
|
|
|
styles.header = 'Backend';
|
|
|
|
|
styles.img = back;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 2: {
|
2021-08-18 15:56:24 +03:00
|
|
|
|
styles.classes = 'des';
|
2021-07-09 14:01:11 +03:00
|
|
|
|
styles.header = 'Frontend';
|
|
|
|
|
styles.img = front;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 3: {
|
2021-08-18 15:56:24 +03:00
|
|
|
|
styles.classes = 'front';
|
|
|
|
|
styles.header = 'Design';
|
|
|
|
|
styles.img = design;
|
2021-07-09 14:01:11 +03:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return styles;
|
|
|
|
|
};
|
2021-05-26 13:35:57 +03:00
|
|
|
|
|
2021-07-03 17:37:30 +03:00
|
|
|
|
function createMarkup(text) {
|
|
|
|
|
return { __html: text.split('</p>').join('</p>') };
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-09 14:01:11 +03:00
|
|
|
|
const { header, img, classes } = setStyles();
|
|
|
|
|
|
2021-05-26 13:35:57 +03:00
|
|
|
|
return (
|
2021-08-18 15:56:24 +03:00
|
|
|
|
<div className='candidate'>
|
2021-05-26 17:41:11 +03:00
|
|
|
|
<div className="row">
|
|
|
|
|
<div className="col-12">
|
2021-08-18 15:56:24 +03:00
|
|
|
|
<div className='candidate__title'>
|
2021-05-26 17:41:11 +03:00
|
|
|
|
<h2>
|
|
|
|
|
<span>Аутстаффинг</span> it-персонала
|
|
|
|
|
</h2>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="row">
|
|
|
|
|
<div className="col-12">
|
2021-08-18 15:56:24 +03:00
|
|
|
|
<div className='candidate__header'>
|
|
|
|
|
<div className='arrow' onClick={() => history.push('/')}>
|
|
|
|
|
<div className='arrow__img'>
|
2021-06-07 17:48:07 +03:00
|
|
|
|
<img src={arrow} alt="" />
|
|
|
|
|
</div>
|
2021-08-18 15:56:24 +03:00
|
|
|
|
<div className='arrow__sp'>
|
2021-06-07 17:48:07 +03:00
|
|
|
|
<span>Вернуться к списку</span>
|
|
|
|
|
</div>
|
2021-05-26 17:41:11 +03:00
|
|
|
|
</div>
|
|
|
|
|
|
2021-08-18 15:56:24 +03:00
|
|
|
|
<div className='icon'>
|
2021-07-05 12:33:24 +03:00
|
|
|
|
<h3>{header}</h3>
|
2021-06-09 13:12:01 +03:00
|
|
|
|
<img className={classes} src={img} alt="" />
|
2021-05-26 17:41:11 +03:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-08-18 15:56:24 +03:00
|
|
|
|
<div className='candidate__main'>
|
2021-05-26 17:41:11 +03:00
|
|
|
|
<div className="row">
|
2021-06-09 13:12:01 +03:00
|
|
|
|
<div className="col-12 col-xl-4">
|
2021-08-11 17:42:56 +03:00
|
|
|
|
<Sidebar candidate={currentCandidateObj} />
|
2021-05-26 17:41:11 +03:00
|
|
|
|
</div>
|
2021-06-09 13:12:01 +03:00
|
|
|
|
<div className="col-12 col-xl-8">
|
2021-08-18 15:56:24 +03:00
|
|
|
|
<div className='candidate__main__description'>
|
2021-05-27 17:44:11 +03:00
|
|
|
|
<img src={rectangle} alt="" />
|
2021-08-18 15:56:24 +03:00
|
|
|
|
<p className='hashtag'># Описание опыта</p>
|
2021-07-03 17:37:30 +03:00
|
|
|
|
{text ? (
|
2021-08-18 15:56:24 +03:00
|
|
|
|
<div className='candidate__text' dangerouslySetInnerHTML={createMarkup(text)}></div>
|
2021-07-03 17:37:30 +03:00
|
|
|
|
) : (
|
2021-08-18 15:56:24 +03:00
|
|
|
|
<p className='candidate__textSecondary'>
|
2021-08-11 17:56:47 +03:00
|
|
|
|
{currentCandidateObj.vc_text ? currentCandidateObj.vc_text : 'Описание отсутствует...' }
|
|
|
|
|
</p>
|
2021-07-03 17:37:30 +03:00
|
|
|
|
)}
|
2021-08-16 16:19:50 +03:00
|
|
|
|
<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>
|
|
|
|
|
</Link>
|
2021-07-05 12:33:24 +03:00
|
|
|
|
<SectionSkills skillsArr={skillValues} />
|
2021-05-26 17:41:11 +03:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-08-18 15:56:24 +03:00
|
|
|
|
</div>
|
2021-05-26 13:35:57 +03:00
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default Candidate;
|