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 {Link, Navigate, useNavigate} from "react-router-dom"; import {apiRequest} from "../../api/request"; import arrowDown from "../../images/selectArrow.png" import processImg from "../../images/partnerAddRequestFirstImg.png" import reportImg from "../../images/partnerAddRequestSecondImg.png" import documentsImg from "../../images/partnerAddRequestThirdInfo.png" 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 } 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 (

Страница добавления заявки

Данные открытой позиции

Название вакансии

setInputs((prevValue) => ({...prevValue, title: e.target.value}) )} type='text' placeholder='Вакансия'/>

Выберите специализацию

{setOpenSpecializationListOpen(!openSpecializationList)}}>
{typeof selectedSpecialization === "string" ? selectedSpecialization : selectedSpecialization.name}
{openSpecializationList && Boolean(specializationList.length) &&
{specializationList.map((specialization, index) => { return

{ setOpenSpecializationListOpen(false) setSelectedSpecialization(specialization) }} > {specialization.name}

})}
}

Навыки

{setOpenSkillsSelect(true)}}> {Boolean(selectedSkills.length) && selectedSkills.map((skill, index) => { return
{skill.name} delete { setSkills(prevArray => [...prevArray, skill]) setFilteredSkills(prevArray => [...prevArray, skill]) setSelectedSkills(selectedSkills.filter((skill, indexSkill) => { return indexSkill !== index })) }} />
}) } { setFilteredSkills(skills.filter((skill) => { return skill.name.toLowerCase().includes(e.target.value.toLowerCase()) })) }} />
{openSkillsSelect && Boolean(filteredSkills.length) &&
{filteredSkills.map((skill, index) => { return { setSelectedSkills(prevArray => [...prevArray, skill]) setFilteredSkills(filteredSkills.filter((skill, skillIndex) => { return skillIndex !== index })) setSkills(skills.filter((initSkill) => { return initSkill.id !==skill.id })) setOpenSkillsSelect(false) }} > {skill.name} })}
}

Квалификация

Выберите уровень знаний

setOpenLevelList(!openLevelList)}> {typeof selectedLevel === "string" ? selectedLevel : selectedLevel.name}
{openLevelList && Boolean(Object.values(levelList).length) &&
{Object.values(levelList).map((level, index) => { return

{ setOpenLevelList(false) setSelectedLevel({name: level, id: index + 1}) }} > {level}

})}
}

Введите необходимое описание