personal area partner with fixes report

This commit is contained in:
2023-02-21 19:05:04 +03:00
parent 740659e1f1
commit e26b8cc22e
22 changed files with 873 additions and 122 deletions

View File

@ -96,6 +96,12 @@
transform: scale(1.02);
}
@media (max-width: 950px) {
width: 200px;
font-size: 15px;
height: 50px;
}
@media (max-width: 800px) {
width: auto;
height: auto;

View File

@ -29,11 +29,18 @@
&-box {
display: flex;
align-items: center;
margin-left: 40px;
margin-left: 20px;
cursor: pointer;
img {
width: 6px;
height: 6px;
margin: 0px 10px;
width: 12px;
height: 12px;
&:first-child {
transform: rotate(180deg);
margin: 0;
}
}
span {

View File

@ -53,7 +53,8 @@ export function currentMonthAndDay(day) {
}
export function getCorrectDate(day) {
return `${new Date(day).getDate()}-${new Date(day).getMonth() + 1}-${new Date(day).getFullYear()}`
const months = ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря']
return `${new Date(day).getDate()} ${months[new Date(day).getMonth()]} ${new Date(day).getFullYear()} года`
};
export function currentMonthAndDayReportPage() {

View File

@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react'
import ellipse from '../../images/ellipse.png'
import arrow from '../../images/arrowCalendar.png'
import rectangle from '../../images/rectangle__calendar.png'
import calendarIcon from '../../images/calendar_icon.png'
import moment from 'moment'
@ -68,27 +68,27 @@ export const ProfileCalendarComponent = React.memo(({value, setValueHandler, rep
<div className='calendar-component'>
<div className='calendar-component__header'>
<h3>Мои отчеты</h3>
<div className='calendar-component__header-box'>
<img src={ellipse} alt='' />
<span onClick={() => {
setValueHandler(prevMonth())
dispatch(setRequestDate(getReports(prevMonth())))
}}>
<div className='calendar-component__header-box' onClick={() => {
setValueHandler(prevMonth())
dispatch(setRequestDate(getReports(prevMonth())))
}}>
<img src={arrow} alt='' />
<span>
{prevMonth().format('MMMM')}
</span>
</div>
<div className='calendar-component__header-box'>
<span>{value.format('YYYY')}</span>
</div>
<div className='calendar-component__header-box'>
<img src={ellipse} alt='' />
<span onClick={() => {
setValueHandler(nextMonth())
dispatch(setRequestDate(getReports(nextMonth())))
<div className='calendar-component__header-box' onClick={() => {
setValueHandler(nextMonth())
dispatch(setRequestDate(getReports(nextMonth())))
}}>
}}>
<span>
{nextMonth().format('MMMM')}
</span>
<img src={arrow} alt='' />
</div>
</div>

View File

@ -53,4 +53,22 @@
transform: scale(1.02);
}
}
.summary__info {
@media (max-width: 800px) {
.summary__name {
margin: 0;
max-width: 220px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
@media (max-width: 500px) {
.summary__name {
max-width: 150px;
}
}
}
}

View File

@ -21,6 +21,45 @@ export const ProfileHeader = () => {
const userRole = useSelector(getRole);
const profileInfo = useSelector(getProfileInfo);
const [user] = useState('developer')
const [navInfo] = useState({
developer: [
{
path: '/summary',
name: 'Резюме'
},
{
path: '/calendar',
name: 'Отчетность'
},
{
path: '/tracker',
name: 'Трекер'
},
{
path: '/payouts',
name: 'Выплаты'
},
{
path: '/settings',
name: 'Настройки'
},
],
partner: [
{
path: '/employees',
name: 'Сотрудники'
},
{
path: '',
name: 'Отчетность'
},
{
path: '/requests',
name: 'Запросы'
},
]
})
const [isLoggingOut, setIsLoggingOut] = useState(false);
@ -44,7 +83,14 @@ export const ProfileHeader = () => {
<header className='profileHeader'>
<div className='profileHeader__head'>
<div className='profileHeader__container'>
<h2 className='profileHeader__title'>itguild.<span>для разработчиков</span></h2>
<h2 className='profileHeader__title'>itguild.
<span>
{user === 'developer' ?
'для разработчиков' :
'для партнеров'
}
</span>
</h2>
<button onClick={handler} className='profileHeader__logout'>
{isLoggingOut ? <Loader/> : 'Выйти'}
</button>
@ -53,15 +99,20 @@ export const ProfileHeader = () => {
<div className='profileHeader__info'>
<div className='profileHeader__container'>
<nav className='profileHeader__nav'>
<NavLink end to={'/profile/summary'}>Резюме</NavLink>
<NavLink end to={'/profile'}>Отчетность</NavLink>
<NavLink end to={'/profile/tracker'}>Трекер</NavLink>
<NavLink end to={'/profile/payouts'}>Выплаты</NavLink>
<NavLink end to={'/profile/settings'}>Настройки</NavLink>
{
navInfo[user].map((link, index) => {
return <NavLink key={index} end to={`/profile${link.path}`}>{link.name}</NavLink>
})
}
</nav>
<div className='profileHeader__personalInfo'>
<h3 className='profileHeader__personalInfoName'>{profileInfo?.fio}</h3>
<h3 className='profileHeader__personalInfoName'>
{user === 'developer' ?
profileInfo?.fio :
''
}
</h3>
<NavLink end to={'/profile'}>
<img src={profileInfo.photo ? urlForLocal(profileInfo.photo) : ""} className='profileHeader__personalInfoAvatar' alt='avatar'/>
</NavLink>

View File

@ -60,13 +60,11 @@ const ReportForm = () => {
const totalHours = inputs.reduce((a, b) => a + b.hours_spent, 0);
const deleteInput = (indexRemove) => {
if (indexRemove !== 0) {
setInputs((prev) => prev.filter((el, index) => index !== indexRemove))
}
setInputs((prev) => prev.filter((el, index) => index !== indexRemove))
};
const handler = () => {
if(!inputs[0].task) {
if(!inputs[0].task || !inputs[0].hours_spent) {
setReportSuccess('Заполните задачи');
setTimeout(() => setReportSuccess(''), 1000)
return