merge branch and partnerRequest candidate

This commit is contained in:
Николай Полтщук 2023-04-19 22:42:46 +03:00
parent f4ada281da
commit 37d8ab385d
6 changed files with 99 additions and 137 deletions

View File

@ -1,3 +1,8 @@
footer {
border-top: 1px solid #ebebeb;
padding: 35px 0 50px;
}
.footer {
&__top {

View File

@ -3,12 +3,14 @@ import { NavLink } from 'react-router-dom'
import { urlForLocal } from '../../helper'
import { apiRequest } from '../../api/request';
import { useDispatch, useSelector } from 'react-redux';
import { getProfileInfo } from '../../redux/outstaffingSlice';
import { getProfileInfo, setProfileInfo } from '../../redux/outstaffingSlice';
import avatarMok from "../../pages/PartnerTreaties/Images/avatarMok.png"
export const Navigation = () => {
const dispatch = useDispatch();
const profileInfo = useSelector(getProfileInfo);
const [user] = useState(localStorage.getItem('role_status') === '18' ? 'partner' : 'developer')
const [navInfo] = useState({
@ -61,7 +63,7 @@ export const Navigation = () => {
},
]
})
useEffect(() => {
if (localStorage.getItem('role_status') === '18') {
return
@ -70,9 +72,9 @@ export const Navigation = () => {
.then((profileInfo) =>
dispatch(setProfileInfo(profileInfo))
);
}, [dispatch]);
return (
<div className='profileHeader__info'>
<div className='profileHeader__container'>
@ -92,7 +94,7 @@ export const Navigation = () => {
}
</h3>
<NavLink end to={'/profile'}>
<img src={profileInfo.photo ? urlForLocal(profileInfo.photo) : ""} className='profileHeader__personalInfoAvatar' alt='avatar' />
<img src={profileInfo.photo ? urlForLocal(profileInfo.photo) : avatarMok} className='profileHeader__personalInfoAvatar' alt='avatar' />
</NavLink>
</div>
</div>

View File

@ -4,13 +4,8 @@ import {useDispatch, useSelector} from "react-redux";
import {Loader} from '../Loader/Loader'
import {apiRequest} from "../../api/request";
import {auth, getProfileInfo, setProfileInfo} from "../../redux/outstaffingSlice";
import {auth, setProfileInfo} from "../../redux/outstaffingSlice";
import {getRole} from "../../redux/roleSlice";
import {urlForLocal} from "../../helper";
import avatarMok from "../../pages/PartnerTreaties/Images/avatarMok.png"
import { Navigation } from '../Navigation/Navigation';
import './profileHeader.scss'
@ -21,58 +16,7 @@ export const ProfileHeader = () => {
const userRole = useSelector(getRole);
const profileInfo = useSelector(getProfileInfo);
const [user] = useState(localStorage.getItem('role_status') === '18' ? 'partner' : 'developer')
const [navInfo] = useState({
developer: [
{
path: '/summary',
name: 'Резюме'
},
{
path: '/calendar',
name: 'Отчетность'
},
{
path: '/tracker',
name: 'Трекер'
},
{
path: '/payouts',
name: 'Выплаты'
},
{
path: '/settings',
name: 'Настройки'
},
],
partner: [
{
path: '/catalog',
name: 'Каталог'
},
{
path: '/requests',
name: 'Запросы'
},
{
path: '/categories',
name: 'Персонал'
},
{
path: '/tracker',
name: 'Трекер'
},
{
path: '/treaties',
name: 'Договора'
},
{
path: '/settings',
name: 'Настройки'
},
]
})
const [isLoggingOut, setIsLoggingOut] = useState(false);
@ -112,29 +56,6 @@ export const ProfileHeader = () => {
</button>
</div>
</div>
<div className='profileHeader__info'>
<div className='profileHeader__container'>
<nav className='profileHeader__nav'>
{
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'>
{user === 'developer' ?
profileInfo?.fio :
''
}
</h3>
<NavLink end to={'/profile'}>
<img src={profileInfo.photo ? urlForLocal(profileInfo.photo) : avatarMok} className='profileHeader__personalInfoAvatar' alt='avatar'/>
</NavLink>
</div>
</div>
</div>
</header>
)
};

View File

@ -1,32 +1,35 @@
import React, {useEffect, useState} from 'react';
import {Link, Navigate} from "react-router-dom";
import {Link, Navigate, useNavigate} from "react-router-dom";
import {useSelector, useDispatch} from 'react-redux'
import {getPartnerRequestId, getPartnerRequests, setPartnerRequestId} from '../../redux/outstaffingSlice'
import {ProfileHeader} from "../../components/ProfileHeader/ProfileHeader";
import {ProfileBreadcrumbs} from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs"
import {Footer} from "../../components/Footer/Footer";
import { Navigation } from '../../components/Navigation/Navigation';
import {Loader} from "../../components/Loader/Loader"
import {apiRequest} from "../../api/request";
import {getCorrectDate} from "../../components/Calendar/calendarHelper";
import {urlForLocal} from '../../helper'
import arrowSwitchDate from "../../images/arrowViewReport.png";
import backEndImg from "../../images/QualificationInfo.png";
import middle from "../../images/QualificationInfoMiddle.png";
import personImg from "../../images/mokPerson.png"
import deleteBtn from "../../images/deleteBtn.png"
import './partnerBid.scss'
import { Navigation } from '../../components/Navigation/Navigation';
export const PartnerBid = () => {
if(localStorage.getItem('role_status') !== '18') {
return <Navigate to="/profile" replace/>
}
const dispatch = useDispatch();
const requestId = useSelector(getPartnerRequestId);
const partnerRequests = useSelector(getPartnerRequests);
const navigate= useNavigate();
if (!requestId) {
return <Navigate to="/profile/requests" replace/>
@ -40,26 +43,33 @@ export const PartnerBid = () => {
})
}, [requestId]);
const deleteRequest = () => {
apiRequest('/request/update-request', {
method: 'PUT',
data: {
user_id: localStorage.getItem('id'),
request_id: requestId,
status: 0,
// title: 'bro',
// position_id: 1,
// knowledge_level_id: 2,
// specialist_count: 2,
// descr: 'broooooo',
// skill_ids: [1, 2, 3]
}
}).then((res) => {
navigate('/profile/requests');
})
};
const [requestInfo, setRequestInfo] = useState({})
const [loader, setLoader] = useState(false)
const [mokPersons] = useState([
{
name: 'Дмитрий, PHP Back end - разработчик, Middle',
link: '/candidate/110',
img: personImg
},
{
name: 'Дмитрий, PHP Back end - разработчик, Middle',
link: '/candidate/111',
img: personImg
},
{
name: 'Дмитрий, PHP Back end - разработчик, Middle',
link: '/candidate/112',
img: personImg
}
])
const [levels] = useState({
1: "Junior",
2: "Middle",
3: "Middle+",
4: "Senior",
})
return (
<div className='partnerBid'>
<ProfileHeader />
@ -79,7 +89,7 @@ export const PartnerBid = () => {
<h3>{requestInfo.title}</h3>
<div className='partnerBid__qualification__buttons'>
<button>Редактировать</button>
<img src={deleteBtn} alt='delete'/>
<img src={deleteBtn} alt='delete' onClick={() => deleteRequest()}/>
</div>
</div>
<div className='partnerBid__switcher'>
@ -102,6 +112,7 @@ export const PartnerBid = () => {
</>
}
{Boolean(Object.keys(requestInfo).length) && !loader &&
<>
<div className='table__wrapper'>
<table>
<thead>
@ -150,27 +161,25 @@ export const PartnerBid = () => {
</tbody>
</table>
</div>
}
<div className='partnerBid__suitable'>
<div className='partnerBid__suitable__title'>
<p>Подходящие сотрудники по запросу</p>
</div>
<div className='partnerBid__suitable__persons'>
{mokPersons.map((person, index) => {
return <div key={index} className='partnerBid__suitable__person'>
<img src={person.img} alt='avatar' />
<p>{person.name}</p>
<Link className='partnerBid__suitable__person__more' to={person.link}>
Подробнее
</Link>
<div className='partnerBid__suitable__person__info'>
<div className='partnerBid__suitable'>
<div className='partnerBid__suitable__title'>
<p>Подходящие сотрудники по запросу</p>
</div>
<div className='partnerBid__suitable__persons'>
{requestInfo.result_profiles.length && requestInfo.result_profiles.map((person, index) => {
return <div key={index} className='partnerBid__suitable__person'>
<img src={urlForLocal(person.photo)} alt='avatar' />
<p>{person.fio} - {person.position_title}, {levels[person.level]}</p>
<Link className='partnerBid__suitable__person__more' to={`/candidate/${person.id}`}>
Подробнее
</Link>
</div>
</div>
})
}
})
}
</div>
</div>
</div>
</>
}
</div>
<Footer/>
</div>

View File

@ -59,6 +59,7 @@
width: 44px;
height: 44px;
margin-left: 21px;
cursor: pointer;
}
}
}
@ -339,6 +340,30 @@
row-gap: 18px;
position: relative;
top: -15px;
max-height: 420px;
overflow: auto;
&::-webkit-scrollbar {
width: 4px;
background: 0 0;
box-shadow: 0 0 14px rgba(0, 0, 0, 0.04);
border-radius: 20px;
}
&::-webkit-scrollbar {
width: 4px;
border-radius: 20px;
}
&::-webkit-scrollbar-thumb {
background: #8db274;
border-radius: 20px;
}
&::-webkit-scrollbar-track {
background: #c5c0c6;
border-radius: 20px;
}
}
&__person {
@ -353,8 +378,9 @@
}
img {
width: 88px;
max-width: 88px;
height: 88px;
width: 100%;
}
p {
@ -364,6 +390,7 @@
line-height: 32px;
margin-left: 60px;
position: relative;
width: 100%;
&:after {
content: "";

View File

@ -5,6 +5,8 @@ import {Link} from "react-router-dom";
import {ProfileHeader} from "../../components/ProfileHeader/ProfileHeader";
import {ProfileBreadcrumbs} from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs"
import {Footer} from "../../components/Footer/Footer";
import { CardControl } from '../../components/CardControl/CardControl';
import { Navigation } from '../../components/Navigation/Navigation';
import {getProfileInfo} from "../../redux/outstaffingSlice";
@ -17,11 +19,7 @@ import paymentIcon from "../../images/paymentIcon.png"
import settingIcon from "../../images/settingIcon.png"
import avatarMok from "../PartnerTreaties/Images/avatarMok.png"
import rightArrow from "../../images/arrowRight.png"
import './profile.scss'
import { CardControl } from '../../components/CardControl/CardControl';
import { Navigation } from '../../components/Navigation/Navigation';
export const Profile = () => {
@ -48,7 +46,7 @@ export const Profile = () => {
description: 'Сколько времени занимает<br/> выполнение задач'
},
{
path: '/payouts',
path: 'profile/payouts',
img: paymentIcon,
title: 'Выплаты',
description: 'У вас <span>подтвержден</span><br/> статус самозанятого'
@ -122,13 +120,13 @@ export const Profile = () => {
<div className='profile__items'>
{
profileItemsInfo[user].map((item, index) => {
return <CardControl
description={item.description}
return <CardControl
description={item.description}
img={item.img}
path={item.path}
title={item.title}
key={index}
/>
/>
})
}
</div>