partnerRequests

This commit is contained in:
Николай Полтщук 2023-04-18 13:58:36 +03:00
parent 418b268425
commit 5067746178
7 changed files with 396 additions and 177 deletions

View File

@ -1,9 +1,11 @@
import React, { useState } from 'react';
import React, {useEffect, useState } from 'react';
import {ProfileHeader} from "../../components/ProfileHeader/ProfileHeader";
import {ProfileBreadcrumbs} from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs"
import {Footer} from "../../components/Footer/Footer";
import {Navigate} from "react-router-dom";
import {Link, Navigate, useNavigate} from "react-router-dom";
import {apiRequest} from "../../api/request";
import arrowDown from "../../images/selectArrow.png"
import processImg from "../../images/partnerAddRequestFirstImg.png"
@ -19,11 +21,62 @@ export const PartnerAddRequest = () => {
return <Navigate to="/profile" replace/>
}
const [skills, setSkills] = useState(['REST API', 'Async/await'])
const [selectedSkills, setSelectedSkills] = useState([])
const [filteredSkills, setFilteredSkills] = useState(skills)
const navigate= useNavigate();
const [skills, setSkills] = useState([])
const [filteredSkills, setFilteredSkills] = useState([])
const [specializationList, setSpecializationList] = useState([])
const [levelList, setLevelList] = useState([])
const [countList] = useState([1, 2, 3, 4, 5])
const [openSkillsSelect, setOpenSkillsSelect] = useState(false)
const [openSpecializationList, setOpenSpecializationListOpen] = useState(false)
const [openLevelList, setOpenLevelList] = useState(false)
const [openCountList, setOpenCountList] = useState(false)
const [selectedSkills, setSelectedSkills] = useState([])
const [selectedSpecialization, setSelectedSpecialization] = useState('Выберите специализацию')
const [selectedLevel, setSelectedLevel] = useState('Выберите уровень')
const [selectedCount, setSelectedCount] = useState('Выберите кол-во сотрудников')
const [inputs, setInputs] = useState({title: '', description: ''})
useEffect(() => {
apiRequest(`/profile/positions-list`).then((el) => setSpecializationList(el))
apiRequest(`/profile/level-list`).then((el) => setLevelList(el))
apiRequest(`/skills/get-skills-list`).then((el) => {
setSkills(el)
setFilteredSkills(el)
})
}, [])
const disableBtn = () => {
if (!inputs.title ||
typeof selectedSpecialization === "string" ||
typeof selectedLevel === "string" ||
typeof selectedCount === "string" ||
!inputs.description ||
!selectedSkills.length) {
return false
}
return true
}
const handler = () => {
apiRequest('/request/create-request', {
method: 'POST',
data: {
user_id: localStorage.getItem('id'),
title: inputs.title,
position_id: selectedSpecialization.id,
knowledge_level_id: selectedLevel.id,
specialist_count: selectedCount,
status: 1,
descr: inputs.description,
skill_ids: selectedSkills.map((skill) => {return skill.id})
}
}).then((res) => {
navigate('/profile/requests');
})
}
return (
<div className='partnerAddRequest'>
@ -43,31 +96,42 @@ export const PartnerAddRequest = () => {
<div className='form__block__section'>
<h3>Название вакансии</h3>
<div className='form__block__section__input'>
<input type='text' placeholder='Вакансия'/>
<input onChange={e => setInputs((prevValue) => ({...prevValue, title: e.target.value}) )} type='text' placeholder='Вакансия'/>
</div>
</div>
<div className='form__block__section'>
<h3>Выберите специализацию</h3>
<div className='form__block__section__selects'>
<div className='form__block__section__selects' onClick={() => {setOpenSpecializationListOpen(!openSpecializationList)}}>
<div className='form__block__section__select'>
<span>Разработка</span>
<img src={arrowDown} />
</div>
<div className='form__block__section__select'>
<span>Backend Developer</span>
<img src={arrowDown} />
<span>{typeof selectedSpecialization === "string" ? selectedSpecialization : selectedSpecialization.name}</span>
<img className={openSpecializationList ? 'rotate' : ''} src={arrowDown} />
</div>
</div>
{openSpecializationList && Boolean(specializationList.length) &&
<div className='form__block__dropDown'>
{specializationList.map((specialization, index) => {
return <p
key={specialization.id}
onClick={() => {
setOpenSpecializationListOpen(false)
setSelectedSpecialization(specialization)
}}
>
{specialization.name}</p>
})}
</div>
}
</div>
<div className='form__block__section'>
<h3>Навыки</h3>
<div className='form__block__skills' onClick={() => {setOpenSkillsSelect(true)}}>
{Boolean(selectedSkills.length) &&
selectedSkills.map((skill, index) => {
return<div className='skill' key={index}>
<span >{skill}</span>
return<div className='skill' key={`selected-${skill.id}`}>
<span >{skill.name}</span>
<img src={deleteIcon} alt='delete'
onClick={() => {
setSkills(prevArray => [...prevArray, skill])
setFilteredSkills(prevArray => [...prevArray, skill])
setSelectedSkills(selectedSkills.filter((skill, indexSkill) => {
return indexSkill !== index
@ -76,29 +140,30 @@ export const PartnerAddRequest = () => {
</div>
})
}
{!selectedSkills.length &&
<input type='text' placeholder='Выберите навыки'
onChange={(e) => {
setFilteredSkills(skills.filter((skill) => {
return skill.toLowerCase().includes(e.target.value.toLowerCase())
return skill.name.toLowerCase().includes(e.target.value.toLowerCase())
}))
}} />
}
</div>
{openSkillsSelect && Boolean(filteredSkills.length) &&
<div className='form__block__dropDown'>
{filteredSkills.map((skill, index) => {
return <span
key={skill}
key={skill.id}
onClick={() => {
setSelectedSkills(prevArray => [...prevArray, skill])
setFilteredSkills(filteredSkills.filter((skill, skillIndex) => {
return skillIndex !== index
}))
setSkills(skills.filter((initSkill) => {
return initSkill.id !==skill.id
}))
setOpenSkillsSelect(false)
}}
>
{skill}</span>
{skill.name}</span>
})}
</div>
}
@ -108,25 +173,53 @@ export const PartnerAddRequest = () => {
<h3 className='form__block__title'>Квалификация</h3>
<div className='form__block__section'>
<h3>Выберите уровень знаний </h3>
<div className='form__block__section__select'>
<span>Разработка</span>
<img src={arrowDown} />
<div className='form__block__section__select' onClick={() => setOpenLevelList(!openLevelList)}>
<span>{typeof selectedLevel === "string" ? selectedLevel : selectedLevel.name}</span>
<img className={openLevelList ? 'rotate' : ''} src={arrowDown} />
</div>
{openLevelList && Boolean(Object.values(levelList).length) &&
<div className='form__block__dropDown'>
{Object.values(levelList).map((level, index) => {
return <p
key={level}
onClick={() => {
setOpenLevelList(false)
setSelectedLevel({name: level, id: index + 1})
}}
>
{level}</p>
})}
</div>
}
</div>
<div className='form__block__section'>
<h3>Введите необходимое описание</h3>
<textarea/>
<textarea onChange={e => setInputs((prevValue) => ({...prevValue, description: e.target.value}) )}/>
</div>
<div className='form__block__section'>
<h3>Необходимое количество человек на позицию</h3>
<div className='form__block__section__select'>
<span>2</span>
<img src={arrowDown} />
<div className='form__block__section__select' onClick={() => setOpenCountList(true)}>
<span>{selectedCount}</span>
<img className={openCountList ? 'rotate' : ''} src={arrowDown} />
</div>
{openCountList &&
<div className='form__block__dropDown'>
{countList.map((count) => {
return <p
key={count}
onClick={() => {
setOpenCountList(false)
setSelectedCount(count)
}}
>
{count}</p>
})}
</div>
}
</div>
<div className='form__block__buttons'>
<button className='form__block__cancel'>Отмена</button>
<button className='form__block__save'>Сохранить</button>
<Link to='/profile/requests' className='form__block__cancel'>Отмена</Link>
<button onClick={() => handler()} className={disableBtn() ? 'form__block__save' : 'form__block__save disable'}>Сохранить</button>
</div>
</div>
</div>

View File

@ -101,7 +101,6 @@
&__selects {
display: flex;
column-gap: 32px;
justify-content: space-between;
@media (max-width: 1020px) {
@ -122,7 +121,6 @@
display: flex;
align-items: center;
justify-content: space-between;
max-width: 202px;
width: 100%;
span {
@ -131,6 +129,14 @@
font-size: 15px;
line-height: 18px;
}
img {
transition: all 0.3s ease;
}
.rotate {
transform: rotate(180deg);
}
}
textarea {
@ -165,6 +171,12 @@
}
&__cancel {
max-width: 150px;
width: 100%;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
border: 0.5px solid #8DC63F;
border-radius: 44px;
color: #6F6F6F;
@ -173,6 +185,10 @@
line-height: 32px;
background: none;
margin-right: 23px;
&:hover {
text-decoration: none;
}
}
&__save {
@ -185,6 +201,11 @@
border: none;
}
.disable {
pointer-events: none;
opacity: 0.5;
}
&__skills {
display: flex;
gap: 5px;
@ -203,8 +224,6 @@
line-height: 14px;
color: #263238;
padding: 6px 6px 5px;
max-width: 100px;
width: 100%;
display: flex;
justify-content: space-evenly;
align-items: center;
@ -217,7 +236,6 @@
input {
border: none;
outline: none;
width: 100%;
background: none;
font-weight: 400;
font-size: 15px;
@ -228,14 +246,57 @@
}
&__dropDown {
width: 100%;
position: absolute;
display: flex;
flex-direction: column;
background: #EFF2F7;
background: #e6e6e7;
border-radius: 8px;
padding: 5px 20px;
row-gap: 10px;
padding: 5px 0;
z-index: 100;
flex-wrap: wrap;
justify-content: center;
gap: 8px;
margin-top: 3px;
align-items: center;
max-height: 250px;
overflow-y: auto;
p {
font-weight: 400;
font-size: 18px;
line-height: 14px;
cursor: pointer;
width: 100%;
text-align: center;
padding: 5px 0;
border-radius: 50px;
&:hover {
background: #e8e8fc;
}
}
&::-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: #cbd9f9;
border-radius: 20px;
}
&::-webkit-scrollbar-track {
background: #c5c0c6;
border-radius: 20px;
}
span {
cursor: pointer;

View File

@ -1,9 +1,15 @@
import React, {useState} from 'react';
import React, {useEffect, useState} from 'react';
import {Link, Navigate} 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 {Loader} from "../../components/Loader/Loader"
import {apiRequest} from "../../api/request";
import {getCorrectDate} from "../../components/Calendar/calendarHelper";
import arrowSwitchDate from "../../images/arrowViewReport.png";
import backEndImg from "../../images/QualificationInfo.png";
@ -17,20 +23,39 @@ 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);
if (!requestId) {
return <Navigate to="/profile/requests" replace/>
}
useEffect(() => {
setLoader(true)
apiRequest(`/request/get-request?request_id=${requestId}`).then((el) => {
setRequestInfo(el)
setLoader(false)
})
}, [requestId]);
const [requestInfo, setRequestInfo] = useState({})
const [loader, setLoader] = useState(false)
const [mokPersons] = useState([
{
name: 'Дмитрий, PHP Back end - разработчик, Middle',
link: '',
link: '/candidate/110',
img: personImg
},
{
name: 'Дмитрий, PHP Back end - разработчик, Middle',
link: '',
link: '/candidate/111',
img: personImg
},
{
name: 'Дмитрий, PHP Back end - разработчик, Middle',
link: '',
link: '/candidate/112',
img: personImg
}
])
@ -45,22 +70,36 @@ export const PartnerBid = () => {
]}
/>
<h2 className='partnerBid__title'>Страница заявки </h2>
{loader && <Loader />}
{!loader &&
<>
<div className='partnerBid__qualification'>
<h3>PHP разработчик</h3>
<h3>{requestInfo.title}</h3>
<div className='partnerBid__qualification__buttons'>
<button>Редактировать</button>
<img src={deleteBtn} alt='delete' />
<img src={deleteBtn} alt='delete'/>
</div>
</div>
<div className='partnerBid__switcher'>
<div className='partnerBid__switcher__prev switchDate'>
<div className={partnerRequests[partnerRequests.findIndex(el => el.id === requestId) - 1]?.id ? 'partnerBid__switcher__prev switchDate' : 'partnerBid__switcher__prev switchDate disable'}
onClick={() => {
dispatch(setPartnerRequestId(partnerRequests[partnerRequests.findIndex(el => el.id === requestId) - 1].id))
}}
>
<img src={arrowSwitchDate} alt='arrow'/>
</div>
<p>Дата заявки : 19 декабря 2022 года </p>
<div className='partnerBid__switcher__next switchDate'>
<p>Дата заявки : {getCorrectDate(requestInfo.created_at)} </p>
<div className={partnerRequests[partnerRequests.findIndex(el => el.id === requestId) + 1]?.id ? 'partnerBid__switcher__next switchDate' : 'partnerBid__switcher__next switchDate disable'}
onClick={() => {
dispatch(setPartnerRequestId(partnerRequests[partnerRequests.findIndex(el => el.id === requestId) + 1].id))
}}
>
<img src={arrowSwitchDate} alt='arrow'/>
</div>
</div>
</>
}
{Boolean(Object.keys(requestInfo).length) && !loader &&
<div className='table__wrapper'>
<table>
<thead>
@ -73,9 +112,13 @@ export const PartnerBid = () => {
<tr>
<td>
<p>
PHP приветствуется аккуратность в коде. MySQL - умение писать запросы к MySQL,
понимание как происходит запрос. Средний уровень: AJAX, JSON, общее понимание;
CSS/CSS3, HTML, Bootstrap;
{requestInfo.position.name}. &nbsp;
{requestInfo.skills.map((skill, index) => {
return <span key={skill.id}>{skill.name}
{requestInfo.skills.length > index + 1 ? ',' : '.'}
&nbsp;
</span>
})}
</p>
</td>
<td>
@ -83,16 +126,14 @@ export const PartnerBid = () => {
<div className='img__wrapper'>
<img src={backEndImg} alt='backEndImg' />
</div>
<p>Backend разработчик</p>
<p>{requestInfo.position.name}</p>
</div>
</td>
</tr>
<tr>
<td>
<p>
Знание современных фреймворков Laravel, Yii 2, FuelPHP, Симфони;
Знания по разработке REST API;
Знание PHP,HTML,CSS,MySQL,Pyhton,JavaScript.
{requestInfo.descr}
</p>
</td>
<td>
@ -100,29 +141,30 @@ export const PartnerBid = () => {
<div className='img__wrapper'>
<img src={middle} alt='middleImg' />
</div>
<p className='middle'>Средний<br/>(Middle)</p>
<p className='middle'>{requestInfo.level}</p>
</div>
</td>
</tr>
</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 <Link to='/candidate/110' key={index} className='partnerBid__suitable__person'>
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='/candidate/110'>
<Link className='partnerBid__suitable__person__more' to={person.link}>
Подробнее
</Link>
<div className='partnerBid__suitable__person__info'>
</div>
</Link>
</div>
})
}
</div>

View File

@ -84,6 +84,11 @@
cursor: pointer;
}
.disable {
pointer-events: none;
opacity: 0.5;
}
&__prev {
transform: rotate(180deg);
}

View File

@ -1,11 +1,16 @@
import React, {useState} from 'react';
import React, {useEffect, useState} from 'react';
import {Link, Navigate} from "react-router-dom";
import {useDispatch} from 'react-redux'
import {setPartnerRequestId, setPartnerRequests} from '../../redux/outstaffingSlice'
import {ProfileHeader} from "../../components/ProfileHeader/ProfileHeader";
import {ProfileBreadcrumbs} from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs"
import {SliderWorkers} from "../../components/SliderWorkers/SliderWorkers"
import {Loader} from "../../components/Loader/Loader"
import {Footer} from "../../components/Footer/Footer";
import {apiRequest} from "../../api/request";
import cursorImg from "../../images/cursorImg.png"
import './partnerRequests.scss'
@ -14,24 +19,17 @@ export const PartnerRequests = () => {
if(localStorage.getItem('role_status') !== '18') {
return <Navigate to="/profile" replace/>
}
const [items] = useState([
{
name: 'PHP разработчик ',
count: 4
},
{
name: 'PHP разработчик ',
count: 4
},
{
name: 'PHP разработчик ',
count: 4
},
{
name: 'PHP разработчик ',
count: 4
}
])
const dispatch = useDispatch();
const [requests, setRequests] = useState([])
const [loader, setLoader] = useState(true)
useEffect(() => {
apiRequest(`/request/get-request-list?user_id=${localStorage.getItem('id')}&search_depth=3`).then((el) => {
setRequests(el)
setLoader(false)
})
}, [])
return (
<div className='partnerRequests'>
<ProfileHeader />
@ -42,17 +40,25 @@ export const PartnerRequests = () => {
]}
/>
<h2 className='partnerRequests__title'>Запросы</h2>
{Boolean(items.length) ?
{loader &&
<Loader />
}
{Boolean(requests.length) && !loader &&
<div className='partnerRequests__section'>
<div className='partnerRequests__section__items'>
{
items.map((item, index) => {
return <Link key={index} to={'/profile/bid'} className='partnerRequests__section__item'>
requests.map((item, index) => {
return <Link key={index} to={'/profile/bid'} className='partnerRequests__section__item'
onClick={() => {
dispatch(setPartnerRequestId(item.id))
dispatch(setPartnerRequests(requests))
}}>
<p className='partnerRequests__section__item__name'>
{item.name}
{item.position.name}
</p>
<p className='partnerRequests__section__item__count'>
Подходящие кандидаты<span>{item.count}</span>
Подходящие кандидаты
<span>{item.result_count}</span>
</p>
</Link>
})
@ -70,7 +76,8 @@ export const PartnerRequests = () => {
</Link>
</div>
</div>
:
}
{!Boolean(requests.length) && !loader &&
<div className="partnerRequests__noItems">
<div className="partnerRequests__noItems__create">
<div className="partnerRequests__noItems__create__link">

View File

@ -9,11 +9,12 @@ import {ProfileHeader} from "../../components/ProfileHeader/ProfileHeader";
import {ProfileBreadcrumbs} from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs"
import {Footer} from "../../components/Footer/Footer";
import arrow from "../../images/right-arrow.png";
import arrowSwitchDate from "../../images/arrowViewReport.png";
import {apiRequest} from "../../api/request";
import {getCorrectDate, getCreatedDate, hourOfNum} from '../../components/Calendar/calendarHelper'
import arrow from "../../images/right-arrow.png";
import arrowSwitchDate from "../../images/arrowViewReport.png";
import './viewReport.scss'
export const ViewReport = () => {

View File

@ -10,7 +10,9 @@ const initialState = {
positionId: null,
profileInfo: {},
reportsDates: '',
partnerEmployees: []
partnerEmployees: [],
partnerRequestId: null,
partnerRequests: []
};
export const outstaffingSlice = createSlice({
@ -49,11 +51,17 @@ export const outstaffingSlice = createSlice({
},
setPartnerEmployees: (state, action) => {
state.partnerEmployees = action.payload
},
setPartnerRequestId: (state, action) => {
state.partnerRequestId = action.payload
},
setPartnerRequests: (state, action) => {
state.partnerRequests = action.payload
}
},
});
export const { tags, profiles, selectedItems, auth, currentCandidate, filteredCandidates, setPositionId, setUserInfo, setProfileInfo, setReportsDates, setPartnerEmployees } = outstaffingSlice.actions;
export const { tags, profiles, selectedItems, auth, currentCandidate, filteredCandidates, setPositionId, setUserInfo, setProfileInfo, setReportsDates, setPartnerEmployees, setPartnerRequestId, setPartnerRequests } = outstaffingSlice.actions;
export const selectProfiles = (state) => state.outstaffing.profiles;
export const selectTags = (state) => state.outstaffing.tags;
@ -66,5 +74,7 @@ export const getProfileInfo = (state) => state.outstaffing.profileInfo;
export const selectUserInfo = (state) => state.outstaffing.userInfo;
export const getReportsDates = (state) => state.outstaffing.reportsDates;
export const getPartnerEmployees = (state) => state.outstaffing.partnerEmployees;
export const getPartnerRequestId = (state) => state.outstaffing.partnerRequestId;
export const getPartnerRequests = (state) => state.outstaffing.partnerRequests;
export default outstaffingSlice.reducer;