diff --git a/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx b/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx index cab390d0..c1d86bfe 100644 --- a/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx +++ b/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx @@ -334,8 +334,10 @@ export const ModalTiсket = ({ ); }, [members]); - function copyProjectLink () { - navigator.clipboard.writeText(`https://itguild.info/tracker/project/${projectId}`) + function copyProjectLink() { + navigator.clipboard.writeText( + `https://itguild.info/tracker/project/${projectId}` + ); } return ( diff --git a/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx b/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx index 6db4239c..676a0ed0 100644 --- a/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx +++ b/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx @@ -210,8 +210,10 @@ export const TicketFullScreen = () => { dispatch(setToggleTab(index)); }; - function copyTicketLink () { - navigator.clipboard.writeText(`https://itguild.info/tracker/task/${taskInfo.id}`) + function copyTicketLink() { + navigator.clipboard.writeText( + `https://itguild.info/tracker/task/${taskInfo.id}` + ); } return ( diff --git a/src/components/Modal/Tracker/TrackerModal/TrackerModal.jsx b/src/components/Modal/Tracker/TrackerModal/TrackerModal.jsx index 4d03f1ea..99475330 100644 --- a/src/components/Modal/Tracker/TrackerModal/TrackerModal.jsx +++ b/src/components/Modal/Tracker/TrackerModal/TrackerModal.jsx @@ -1,6 +1,7 @@ import React, { useEffect, useState } from "react"; import { useDispatch, useSelector } from "react-redux"; +import { getProfileInfo } from "@redux/outstaffingSlice"; import { addPersonToProject, editColumnName, @@ -35,12 +36,14 @@ export const TrackerModal = ({ titleProject, projectId, priorityTask, + projectUsers, }) => { const dispatch = useDispatch(); const projectBoard = useSelector(getProjectBoard); const columnName = useSelector(getColumnName); const columnId = useSelector(getColumnId); const columnPriority = useSelector(getColumnPriority); + const profileInfo = useSelector(getProfileInfo); const modalType = useSelector(getValueModalType); const [projectName, setProjectName] = useState(defautlInput); @@ -51,8 +54,16 @@ export const TrackerModal = ({ const [workers, setWorkers] = useState([]); const [selectWorkersOpen, setSelectWorkersOpen] = useState(false); const [selectedWorker, setSelectedWorker] = useState(null); - const [selectColumnPriority, setSelectColumnPriority] = useState('Выберите приоритет колонки') - const [selectColumnPriorityOpen, setSelectColumnPriorityOpen] = useState(false) + const [selectColumnPriority, setSelectColumnPriority] = useState( + "Выберите приоритет колонки" + ); + const [selectedExecutorTask, setSelectedExecutorTask] = useState( + "Выберите исполнителя задачи" + ); + const [selectExecutorTaskOpen, setSelectExecutorTaskOpen] = useState(false); + const [correctProjectUsers, setCorrectProjectUsers] = useState([]); + const [selectColumnPriorityOpen, setSelectColumnPriorityOpen] = + useState(false); function createTab() { if (!valueColumn) { @@ -91,13 +102,28 @@ export const TrackerModal = ({ column_id: selectedTab, priority: priorityTask, }, - }).then(() => { - dispatch(setProjectBoardFetch(projectBoard.id)); + }).then((res) => { + if (selectedExecutorTask.user_id) { + apiRequest("/task/update-task", { + method: "PUT", + data: { + task_id: res.id, + executor_id: selectedExecutorTask.user_id, + }, + }).then(() => { + dispatch(setProjectBoardFetch(projectBoard.id)); + setActive(false); + setValueTiket(""); + setDescriptionTicket(""); + setSelectedExecutorTask("Выберите исполнителя задачи"); + }); + } else { + setActive(false); + setValueTiket(""); + setDescriptionTicket(""); + dispatch(setProjectBoardFetch(projectBoard.id)); + } }); - - setActive(false); - setValueTiket(""); - setDescriptionTicket(""); } function editProject() { @@ -211,6 +237,26 @@ export const TrackerModal = ({ ); }) : ""; + if ( + localStorage.getItem("role_status") !== "18" && + projectUsers && + Boolean( + !projectUsers.find((item) => item.user_id === profileInfo.id_user) + ) + ) { + setCorrectProjectUsers([ + ...projectUsers, + { + user: { + avatar: profileInfo.photo, + fio: profileInfo.fio, + }, + user_id: profileInfo.id_user, + }, + ]); + } else { + setCorrectProjectUsers(projectUsers); + } }, [active]); return ( @@ -280,7 +326,7 @@ export const TrackerModal = ({ )} {modalType === "createTiketProject" && ( -