diff --git a/src/components/UI/TrackerModal/TrackerModal.jsx b/src/components/UI/TrackerModal/TrackerModal.jsx index b0d3c77a..d8361f34 100644 --- a/src/components/UI/TrackerModal/TrackerModal.jsx +++ b/src/components/UI/TrackerModal/TrackerModal.jsx @@ -1,7 +1,8 @@ -import React, { useState } from "react"; +import React, {useEffect, useState} from "react"; import { useDispatch, useSelector } from "react-redux"; import { apiRequest } from "../../../api/request"; +import { urlForLocal } from '../../../helper' import { setColumnName, getProjectBoard, @@ -14,6 +15,8 @@ import { getColumnId } from "../../../redux/projectsTrackerSlice"; +import arrowDown from "../../../images/selectArrow.png" + import "./trackerModal.scss"; export const TrackerModal = ({ @@ -23,6 +26,7 @@ export const TrackerModal = ({ defautlInput, titleProject, projectId, + priorityTask }) => { const dispatch = useDispatch(); const projectBoard = useSelector(getProjectBoard); @@ -30,15 +34,14 @@ export const TrackerModal = ({ const columnId = useSelector(getColumnId) const modalType = useSelector(getValueModalType); - - const [emailWorker, setEmailWorker] = useState(""); const [projectName, setProjectName] = useState(defautlInput); - const [valueColumn, setValueColumn] = useState(""); const [nameProject, setNameProject] = useState(""); - const [valueTiket, setValueTiket] = useState(""); const [descriptionTicket, setDescriptionTicket] = useState(""); + const [workers, setWorkers] = useState([]) + const [selectWorkersOpen, setSelectWorkersOpen] = useState(false) + const [selectedWorker, setSelectedWorker] = useState(null) function createTab() { if (!valueColumn) { @@ -72,6 +75,7 @@ export const TrackerModal = ({ status: 1, user_id: localStorage.getItem("id"), column_id: selectedTab, + priority: priorityTask }, }).then((res) => { dispatch(setProjectBoardFetch(projectBoard.id)); @@ -128,6 +132,23 @@ export const TrackerModal = ({ } } + function addUserToProject() { + apiRequest("/project/add-user", { + method: "POST", + data: { + user_id: selectedWorker.id, + project_id: projectBoard.id + } + }).then((el) => { + setActive(false); + selectedWorker(null) + }) + } + + useEffect(() => { + modalType === "addWorker" ? apiRequest('/project/my-employee').then((el) => setWorkers(el.managerEmployees)) : '' + }, [modalType]) + return (
Введите имя или e-mail
-{selectedWorker ? selectedWorker.employee.fio : 'Выберите пользователя'}
+ + {Boolean(selectWorkersOpen) && +{worker.employee.fio}
+ +