2021-09-15 17:07:28 +03:00
|
|
|
import React from 'react'
|
2022-02-11 16:34:31 +03:00
|
|
|
import { useSelector } from 'react-redux'
|
2021-09-15 17:07:28 +03:00
|
|
|
import { Link } from 'react-router-dom'
|
|
|
|
import { Achievement } from '../Achievement/Achievement'
|
|
|
|
|
2021-11-30 17:00:58 +03:00
|
|
|
import { LEVELS, SKILLS } from '../constants/constants'
|
|
|
|
|
2021-09-15 17:07:28 +03:00
|
|
|
import maleBig from '../../images/medium_male_big.png'
|
2021-11-30 17:00:58 +03:00
|
|
|
import './candidateSidebar.scss'
|
2022-05-27 14:39:05 +03:00
|
|
|
import { Highlighter } from '../../App'
|
|
|
|
import { useState } from 'react'
|
|
|
|
import { useEffect } from 'react'
|
2021-05-27 17:44:11 +03:00
|
|
|
|
2022-02-11 16:34:31 +03:00
|
|
|
import { selectUserInfo } from '../../redux/outstaffingSlice'
|
|
|
|
import { isRejected } from '@reduxjs/toolkit'
|
|
|
|
|
2021-08-11 17:42:56 +03:00
|
|
|
const getYearsString = (years) => {
|
2021-09-15 17:07:28 +03:00
|
|
|
let yearsString
|
|
|
|
if (years % 10 === 1) {
|
|
|
|
yearsString = 'год'
|
2021-08-11 17:42:56 +03:00
|
|
|
} else if (years === 11 || years === 12 || years === 13 || years === 14) {
|
2021-09-15 17:07:28 +03:00
|
|
|
yearsString = 'лет'
|
|
|
|
} else if (years % 10 === 2 || years % 10 === 3 || years % 10 === 4) {
|
|
|
|
yearsString = 'года'
|
2021-08-17 17:15:04 +03:00
|
|
|
} else {
|
2021-09-15 17:07:28 +03:00
|
|
|
yearsString = 'лет'
|
2021-08-11 17:42:56 +03:00
|
|
|
}
|
2021-09-15 17:07:28 +03:00
|
|
|
return `${years} ${yearsString}`
|
2021-08-11 17:42:56 +03:00
|
|
|
}
|
|
|
|
|
2022-05-27 14:39:05 +03:00
|
|
|
const CandidateSidebar = ({ candidate, position, setActiveSnippet, activeSnippet }) => {
|
2022-05-27 20:08:40 +03:00
|
|
|
const userId = localStorage.getItem('id')
|
2022-05-27 14:39:05 +03:00
|
|
|
const showSnippet = () => {
|
|
|
|
setActiveSnippet((prev)=>!prev)
|
|
|
|
}
|
|
|
|
|
2021-05-27 17:44:11 +03:00
|
|
|
return (
|
2021-11-30 17:00:58 +03:00
|
|
|
<div className='candidate-sidebar'>
|
|
|
|
<div className='candidate-sidebar__info'>
|
|
|
|
<div className='candidate-sidebar__position'>
|
|
|
|
<h2>
|
|
|
|
{candidate.specification} {SKILLS[candidate.position_id]},{' '}
|
|
|
|
{LEVELS[candidate.level]}{' '}
|
|
|
|
</h2>
|
|
|
|
</div>
|
2021-09-15 17:07:28 +03:00
|
|
|
<img src={candidate.photo} alt='' />
|
|
|
|
{candidate && candidate.years_of_exp && (
|
|
|
|
<>
|
2021-11-30 17:00:58 +03:00
|
|
|
<p className='candidate-sidebar__experience-title'>Опыт работы</p>
|
|
|
|
<p className='candidate-sidebar__experience'>
|
2021-09-15 17:07:28 +03:00
|
|
|
{getYearsString(candidate.years_of_exp)}
|
|
|
|
</p>
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
<Link to={`/candidate/${candidate.id}/form`}>
|
2021-11-30 17:00:58 +03:00
|
|
|
<button className='candidate-sidebar__select'>
|
2021-09-15 17:07:28 +03:00
|
|
|
Выбрать к собеседованию
|
|
|
|
</button>
|
2021-06-18 17:16:08 +03:00
|
|
|
</Link>
|
2022-05-27 20:08:40 +03:00
|
|
|
{userId && (
|
|
|
|
<>
|
|
|
|
<Link to={`/${candidate.id}/calendar`}>
|
2021-12-07 10:58:19 +03:00
|
|
|
<button className='candidate-sidebar__select'>
|
|
|
|
Отчёты
|
|
|
|
</button>
|
|
|
|
</Link>
|
2022-05-27 14:39:05 +03:00
|
|
|
{/* <Link to={`/candidate/${candidate.id}/code`}> */}
|
|
|
|
<button
|
|
|
|
className='candidate-sidebar__select'
|
|
|
|
onClick={showSnippet}
|
|
|
|
>
|
|
|
|
{activeSnippet ? "Показать": "Скрыть"}
|
|
|
|
</button>
|
|
|
|
{/* </Link> */}
|
2021-11-30 17:00:58 +03:00
|
|
|
<div className='candidate-sidebar__achievements'>
|
2021-09-15 17:07:28 +03:00
|
|
|
{candidate &&
|
|
|
|
candidate.achievements &&
|
|
|
|
candidate.achievements.map((item) => {
|
2022-05-27 14:39:05 +03:00
|
|
|
return <Achievement key={item.id} achievement={item.achievement} />
|
2021-09-15 17:07:28 +03:00
|
|
|
})}
|
|
|
|
</div>
|
2022-05-27 20:08:40 +03:00
|
|
|
</>)}
|
2021-05-27 17:44:11 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-09-15 17:07:28 +03:00
|
|
|
)
|
|
|
|
}
|
2021-05-27 17:44:11 +03:00
|
|
|
|
2021-11-30 17:00:58 +03:00
|
|
|
export default CandidateSidebar
|