2021-07-03 17:37:30 +03:00
|
|
|
import React from 'react';
|
2021-08-18 15:56:24 +03:00
|
|
|
import { useDispatch, useSelector } from 'react-redux';
|
2021-08-20 17:33:29 +03:00
|
|
|
import { useHistory, useParams, Link } from 'react-router-dom';
|
2021-08-18 15:56:24 +03:00
|
|
|
import { currentCandidate, selectCurrentCandidate } from '../redux/outstaffingSlice';
|
|
|
|
import SVG from 'react-inlinesvg';
|
2021-08-09 15:10:12 +03:00
|
|
|
import { WithLogout } from '../hoc/withLogout';
|
2021-07-03 17:37:30 +03:00
|
|
|
import Form from '../components/Form/Form';
|
2021-08-18 15:56:24 +03:00
|
|
|
import { LEVELS, SKILLS } from '../components/constants/constants';
|
|
|
|
import { fetchItemsForId } from '../server/server';
|
2021-08-18 18:16:57 +03:00
|
|
|
import { Footer } from '../components/Footer/Footer';
|
2021-07-03 17:37:30 +03:00
|
|
|
|
2021-08-18 15:56:24 +03:00
|
|
|
import arrow from '../images/right-arrow.png';
|
|
|
|
import rectangle from '../images/rectangle_secondPage.png';
|
|
|
|
import telegramIcon from '../images/telegram-icon.svg';
|
|
|
|
|
|
|
|
import './formPage.scss';
|
2021-08-20 17:33:29 +03:00
|
|
|
import { getRole } from '../redux/roleSlice';
|
2021-08-18 15:56:24 +03:00
|
|
|
|
|
|
|
const goBack = (history) => {
|
|
|
|
history.goBack();
|
|
|
|
};
|
|
|
|
|
|
|
|
const FormPage = () => {
|
|
|
|
const params = useParams();
|
|
|
|
const history = useHistory();
|
|
|
|
const dispatch = useDispatch();
|
2021-08-20 17:33:29 +03:00
|
|
|
const candidate = useSelector(selectCurrentCandidate);
|
|
|
|
const role = useSelector(getRole);
|
2021-08-18 15:56:24 +03:00
|
|
|
|
|
|
|
if(!candidate.id) {
|
2021-08-20 17:33:29 +03:00
|
|
|
fetchItemsForId({ link: `${process.env.REACT_APP_API_URL}/api/profile/`, index: Number(params.id), history, role, }).then((el) =>
|
2021-08-18 15:56:24 +03:00
|
|
|
dispatch(currentCandidate(el))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<WithLogout>
|
|
|
|
<div className='form-page'>
|
|
|
|
<div className='form-page__back'>
|
|
|
|
<div className='form-page__arrow' onClick={() => goBack(history)}>
|
|
|
|
<div className='form-page__arrow-img'>
|
|
|
|
<img src={arrow} alt="" />
|
|
|
|
</div>
|
|
|
|
<div className='form-page__back-to-candidate'>
|
|
|
|
<span>Вернуться к кандидату</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className='form-page__candidate'>
|
|
|
|
<div className='form-page__avatar'>
|
|
|
|
<img src={candidate.photo} />
|
|
|
|
</div>
|
|
|
|
<div className='form-page__candidate-info'>
|
|
|
|
<div className='form-page__position'>
|
|
|
|
<span>{candidate.specification} {SKILLS[candidate.position_id]}, {LEVELS[candidate.level]}</span>
|
|
|
|
</div>
|
|
|
|
<div className='form-page__selected'>
|
|
|
|
<img src={rectangle} />
|
|
|
|
<span>Выбранный кандидат</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className='form-page__interview'>
|
|
|
|
<div className='form-page__form'><Form /></div>
|
|
|
|
<div className='form-page__separator'>
|
|
|
|
<div className='form-page__line'></div>
|
|
|
|
<div className='form-page__option'>или</div>
|
|
|
|
</div>
|
|
|
|
<div className='form-page__telegram'>
|
|
|
|
<div className='form-page__telegram-text'>Заявка на собеседование через телеграм</div>
|
|
|
|
<div className='form-page__telegram-icon'>
|
2021-08-20 17:33:29 +03:00
|
|
|
<a href='https://t.me/st0kir' target='_blank'><SVG src={telegramIcon} /></a>
|
2021-08-18 15:56:24 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-08-18 18:16:57 +03:00
|
|
|
<Footer />
|
2021-08-18 15:56:24 +03:00
|
|
|
</div>
|
|
|
|
</WithLogout>
|
|
|
|
)
|
|
|
|
}
|
2021-07-03 17:37:30 +03:00
|
|
|
|
|
|
|
export default FormPage;
|