75 lines
2.4 KiB
JavaScript
Raw Normal View History

2023-01-09 20:53:23 +03:00
import React, {useEffect, useState} from 'react'
import {useSelector} from 'react-redux'
import {Link, useNavigate} from 'react-router-dom'
2023-01-09 20:53:23 +03:00
2021-11-30 16:00:58 +02:00
import CalendarComponent from './CalendarComponent'
2023-01-09 20:53:23 +03:00
import {currentMonth} from './calendarHelper'
import {Footer} from '../Footer/Footer'
import {LogoutButton} from "../LogoutButton/LogoutButton";
import {selectCurrentCandidate} from '../../redux/outstaffingSlice'
2021-11-30 16:00:58 +02:00
2023-01-09 20:53:23 +03:00
import rectangle from '../../images/rectangle_secondPage.png'
2021-11-30 16:00:58 +02:00
import './calendar.scss'
const Calendar = () => {
2021-11-30 16:00:58 +02:00
2023-01-09 20:53:23 +03:00
const candidateForCalendar = useSelector(selectCurrentCandidate);
2021-07-02 16:02:47 +03:00
2023-01-09 20:53:23 +03:00
const [month, setMonth] = useState('');
2021-06-22 18:00:52 +03:00
const navigate = useNavigate();
2021-06-22 18:00:52 +03:00
useEffect(() => {
2021-11-30 16:00:58 +02:00
setMonth(currentMonth)
2023-01-09 20:53:23 +03:00
}, [month]);
2021-06-22 18:00:52 +03:00
2023-01-09 20:53:23 +03:00
const {name, skillsName, photo} = candidateForCalendar;
2021-06-30 17:21:55 +03:00
2023-01-09 20:53:23 +03:00
const abbreviatedName = name && name.substring(0, name.lastIndexOf(' '));
2021-06-30 17:21:55 +03:00
2021-06-16 17:51:25 +03:00
return (
<div className='container'>
<section className='calendar'>
<div className='row'>
<div className='calendar__header'>
<h2 className='calendar__profile'>
Добрый день, <span>Александр !</span>
</h2>
<LogoutButton />
2023-01-09 20:53:23 +03:00
</div>
<div className='col-12 col-xl-12 d-flex justify-content-between align-items-center flex-column flex-sm-row'>
<div className='calendar__info'>
<img className='calendar__info-img' src={photo} alt='img'/>
<h3 className='calendar__info-name'>{abbreviatedName}</h3>
</div>
<div className='calendar__title'>
<h3 className='calendar__title-text'>{skillsName} разработчик</h3>
<img className='calendar__title-img' src={rectangle} alt='img'/>
</div>
<div>
<Link to='/report'>
<button className='calendar__btn'>Заполнить отчет за день</button>
</Link>
</div>
2023-01-09 20:53:23 +03:00
</div>
2021-06-17 18:21:48 +03:00
</div>
<div className='row'>
<div className='col-12 col-xl-12'>
<CalendarComponent onSelect={() => { navigate('/report/0') }}/>
<p className='calendar__hours'>
{month} : <span> 60 часов </span>
</p>
</div>
2023-01-09 20:53:23 +03:00
</div>
<Footer/>
</section>
</div>
2021-11-30 16:00:58 +02:00
)
2023-01-09 20:53:23 +03:00
};
2021-06-16 17:51:25 +03:00
2021-11-30 16:00:58 +02:00
export default Calendar