commit
6af92a2f70
@ -75,6 +75,7 @@ const App = () => {
|
||||
<Route exact path='settings' element={<PartnerSettings/>}/>
|
||||
<Route exact path='requests' element={<PartnerRequests/>}/>
|
||||
<Route exact path='add-request' element={<PartnerAddRequest/>}/>
|
||||
<Route exact path='edit-request' element={<PartnerAddRequest/>}/>
|
||||
<Route exact path='bid' element={<PartnerBid/>}/>
|
||||
<Route exact path='categories' element={<PartnerCategories/>}/>
|
||||
<Route exact path='treaties' element={<PartnerTreaties/>}/>
|
||||
|
@ -4,8 +4,11 @@ import {ProfileHeader} from "../../components/ProfileHeader/ProfileHeader";
|
||||
import {ProfileBreadcrumbs} from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs"
|
||||
import {Footer} from "../../components/Footer/Footer";
|
||||
import {Link, Navigate, useNavigate} from "react-router-dom";
|
||||
|
||||
import { Navigation } from '../../components/Navigation/Navigation';
|
||||
import {apiRequest} from "../../api/request";
|
||||
import {useSelector} from "react-redux";
|
||||
|
||||
import { getPartnerRequestInfo } from '../../redux/outstaffingSlice'
|
||||
|
||||
import arrowDown from "../../images/selectArrow.png"
|
||||
import processImg from "../../images/partnerAddRequestFirstImg.png"
|
||||
@ -15,15 +18,15 @@ import deleteIcon from "../../images/close.png"
|
||||
|
||||
|
||||
import './partnerAddRequest.scss'
|
||||
import { Navigation } from '../../components/Navigation/Navigation';
|
||||
|
||||
export const PartnerAddRequest = () => {
|
||||
if(localStorage.getItem('role_status') !== '18') {
|
||||
return <Navigate to="/profile" replace/>
|
||||
}
|
||||
|
||||
const partnerRequestInfo = useSelector(getPartnerRequestInfo);
|
||||
const currentUrl = useState(window.location.pathname)
|
||||
const navigate= useNavigate();
|
||||
|
||||
const [skills, setSkills] = useState([])
|
||||
const [filteredSkills, setFilteredSkills] = useState([])
|
||||
const [specializationList, setSpecializationList] = useState([])
|
||||
@ -33,12 +36,17 @@ export const PartnerAddRequest = () => {
|
||||
const [openSpecializationList, setOpenSpecializationListOpen] = useState(false)
|
||||
const [openLevelList, setOpenLevelList] = useState(false)
|
||||
const [openCountList, setOpenCountList] = useState(false)
|
||||
const [editRequest, setEditRequest] = useState(false)
|
||||
const [selectedSkills, setSelectedSkills] = useState([])
|
||||
const [selectedSpecialization, setSelectedSpecialization] = useState('Выберите специализацию')
|
||||
const [selectedLevel, setSelectedLevel] = useState('Выберите уровень')
|
||||
const [selectedCount, setSelectedCount] = useState('Выберите кол-во сотрудников')
|
||||
const [inputs, setInputs] = useState({title: '', description: ''})
|
||||
|
||||
if (currentUrl[0] === "/profile/edit-request" && !Object.keys(partnerRequestInfo).length) {
|
||||
return <Navigate to="/profile/requests" replace/>
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
apiRequest(`/profile/positions-list`).then((el) => setSpecializationList(el))
|
||||
apiRequest(`/profile/level-list`).then((el) => setLevelList(el))
|
||||
@ -48,6 +56,17 @@ export const PartnerAddRequest = () => {
|
||||
})
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (currentUrl[0] === "/profile/edit-request" && Object.keys(partnerRequestInfo).length) {
|
||||
setInputs({title: partnerRequestInfo.title, description: partnerRequestInfo.descr})
|
||||
setSelectedSpecialization(partnerRequestInfo.position)
|
||||
setSelectedLevel({name: partnerRequestInfo.level, id: partnerRequestInfo.knowledge_level_id})
|
||||
setSelectedCount(partnerRequestInfo.specialist_count)
|
||||
setSelectedSkills(partnerRequestInfo.skills)
|
||||
setEditRequest(true)
|
||||
}
|
||||
}, [])
|
||||
|
||||
const disableBtn = () => {
|
||||
if (!inputs.title ||
|
||||
typeof selectedSpecialization === "string" ||
|
||||
@ -61,6 +80,24 @@ export const PartnerAddRequest = () => {
|
||||
}
|
||||
|
||||
const handler = () => {
|
||||
if (currentUrl[0] === "/profile/edit-request") {
|
||||
apiRequest('/request/update-request', {
|
||||
method: 'PUT',
|
||||
data: {
|
||||
user_id: localStorage.getItem('id'),
|
||||
request_id: partnerRequestInfo.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');
|
||||
})
|
||||
} else {
|
||||
apiRequest('/request/create-request', {
|
||||
method: 'POST',
|
||||
data: {
|
||||
@ -77,6 +114,7 @@ export const PartnerAddRequest = () => {
|
||||
navigate('/profile/requests');
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
@ -87,10 +125,10 @@ export const PartnerAddRequest = () => {
|
||||
<ProfileBreadcrumbs links={[
|
||||
{name: 'Главная', link: '/profile'},
|
||||
{name: 'Запросы и открытые позиции', link: '/profile/requests'},
|
||||
{name: 'Создание новой заявки', link: '/profile/add-request'}
|
||||
{name: `${editRequest ? 'Редактирование заявки' : 'Создание новой заявки'}`, link: '/profile/add-request'}
|
||||
]}
|
||||
/>
|
||||
<h2 className='partnerAddRequest__title'>Страница добавления заявки</h2>
|
||||
<h2 className='partnerAddRequest__title'>{editRequest ? 'Страница редактирования заявки' : 'Страница добавления заявки'}</h2>
|
||||
<div className='partnerAddRequest__section'>
|
||||
<div className='partnerAddRequest__form'>
|
||||
<div className='partnerAddRequest__form__block form__block'>
|
||||
@ -98,7 +136,7 @@ export const PartnerAddRequest = () => {
|
||||
<div className='form__block__section'>
|
||||
<h3>Название вакансии</h3>
|
||||
<div className='form__block__section__input'>
|
||||
<input onChange={e => setInputs((prevValue) => ({...prevValue, title: e.target.value}) )} type='text' placeholder='Вакансия'/>
|
||||
<input value={inputs.title} onChange={e => setInputs((prevValue) => ({...prevValue, title: e.target.value}) )} type='text' placeholder='Вакансия'/>
|
||||
</div>
|
||||
</div>
|
||||
<div className='form__block__section'>
|
||||
@ -196,7 +234,7 @@ export const PartnerAddRequest = () => {
|
||||
</div>
|
||||
<div className='form__block__section'>
|
||||
<h3>Введите необходимое описание</h3>
|
||||
<textarea onChange={e => setInputs((prevValue) => ({...prevValue, description: e.target.value}) )}/>
|
||||
<textarea value={inputs.description} onChange={e => setInputs((prevValue) => ({...prevValue, description: e.target.value}) )}/>
|
||||
</div>
|
||||
<div className='form__block__section'>
|
||||
<h3>Необходимое количество человек на позицию</h3>
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React, {useEffect, useState} from 'react';
|
||||
import {Link, Navigate, useNavigate} from "react-router-dom";
|
||||
import {useSelector, useDispatch} from 'react-redux'
|
||||
import {getPartnerRequestId, getPartnerRequests, setPartnerRequestId} from '../../redux/outstaffingSlice'
|
||||
import {getPartnerRequestId, getPartnerRequests, setPartnerRequestId, setPartnerRequestInfo} from '../../redux/outstaffingSlice'
|
||||
|
||||
import {ProfileHeader} from "../../components/ProfileHeader/ProfileHeader";
|
||||
import {ProfileBreadcrumbs} from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs"
|
||||
@ -39,6 +39,7 @@ export const PartnerBid = () => {
|
||||
setLoader(true)
|
||||
apiRequest(`/request/get-request?request_id=${requestId}`).then((el) => {
|
||||
setRequestInfo(el)
|
||||
dispatch(setPartnerRequestInfo(el))
|
||||
setLoader(false)
|
||||
})
|
||||
}, [requestId]);
|
||||
@ -50,12 +51,6 @@ export const PartnerBid = () => {
|
||||
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');
|
||||
@ -88,7 +83,7 @@ export const PartnerBid = () => {
|
||||
<div className='partnerBid__qualification'>
|
||||
<h3>{requestInfo.title}</h3>
|
||||
<div className='partnerBid__qualification__buttons'>
|
||||
<button>Редактировать</button>
|
||||
<Link to='/profile/edit-request'>Редактировать</Link>
|
||||
<img src={deleteBtn} alt='delete' onClick={() => deleteRequest()}/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -41,7 +41,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
button {
|
||||
a {
|
||||
max-width: 168px;
|
||||
width: 100%;
|
||||
height: 48px;
|
||||
@ -53,6 +53,10 @@
|
||||
color: #000000;
|
||||
padding: 8px 24px 10px 32px;
|
||||
border: none;
|
||||
|
||||
&:hover {
|
||||
color: #000000;
|
||||
}
|
||||
}
|
||||
|
||||
img {
|
||||
|
@ -12,7 +12,8 @@ const initialState = {
|
||||
reportsDates: '',
|
||||
partnerEmployees: [],
|
||||
partnerRequestId: null,
|
||||
partnerRequests: []
|
||||
partnerRequests: [],
|
||||
partnerRequestInfo: {}
|
||||
};
|
||||
|
||||
export const outstaffingSlice = createSlice({
|
||||
@ -57,11 +58,14 @@ export const outstaffingSlice = createSlice({
|
||||
},
|
||||
setPartnerRequests: (state, action) => {
|
||||
state.partnerRequests = action.payload
|
||||
},
|
||||
setPartnerRequestInfo: (state, action) => {
|
||||
state.partnerRequestInfo = action.payload
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
export const { tags, profiles, selectedItems, auth, currentCandidate, filteredCandidates, setPositionId, setUserInfo, setProfileInfo, setReportsDates, setPartnerEmployees, setPartnerRequestId, setPartnerRequests } = outstaffingSlice.actions;
|
||||
export const { tags, profiles, selectedItems, auth, currentCandidate, filteredCandidates, setPositionId, setUserInfo, setProfileInfo, setReportsDates, setPartnerEmployees, setPartnerRequestId, setPartnerRequests, setPartnerRequestInfo } = outstaffingSlice.actions;
|
||||
|
||||
export const selectProfiles = (state) => state.outstaffing.profiles;
|
||||
export const selectTags = (state) => state.outstaffing.tags;
|
||||
@ -71,6 +75,7 @@ export const selectCurrentCandidate = (state) => state.outstaffing.currentCandid
|
||||
export const selectAuth = (state) => state.outstaffing.auth;
|
||||
export const getPositionId = (state) => state.outstaffing.positionId;
|
||||
export const getProfileInfo = (state) => state.outstaffing.profileInfo;
|
||||
export const getPartnerRequestInfo = (state) => state.outstaffing.partnerRequestInfo;
|
||||
export const selectUserInfo = (state) => state.outstaffing.userInfo;
|
||||
export const getReportsDates = (state) => state.outstaffing.reportsDates;
|
||||
export const getPartnerEmployees = (state) => state.outstaffing.partnerEmployees;
|
||||
|
Loading…
Reference in New Issue
Block a user