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" && ( -
+ <>

Введите название и описание задачи

@@ -299,11 +345,59 @@ export const TrackerModal = ({ placeholder="Описание задачи" />
+
setSelectExecutorTaskOpen(!selectExecutorTaskOpen)} + className={ + selectExecutorTaskOpen + ? "select__executor select__executor--open" + : "select__executor" + } + > +
+ {selectedExecutorTask.user_id ? ( + <> + {selectedExecutorTask.user.fio} + avatar + + ) : ( + {selectedExecutorTask} + )} +
+ arrow + {selectExecutorTaskOpen && ( +
+ {correctProjectUsers.length ? ( + correctProjectUsers.map((person) => { + return ( +
setSelectedExecutorTask(person)} + className="executor" + key={person.user_id} + > + {person.user.fio} + avatar +
+ ); + }) + ) : ( + Нет пользователей + )} +
+ )} +
Создать -
+ )} {modalType === "editProject" && (
@@ -386,19 +480,35 @@ export const TrackerModal = ({ />

Приоритет колонки

-
setSelectColumnPriorityOpen(!selectColumnPriorityOpen)}> - {selectColumnPriority} - arrow - {selectColumnPriorityOpen && -
- {projectBoard.columns.map((column, index) => { - return { - setSelectColumnPriority(index + 1) - dispatch(setColumnPriority(index + 1)) - }}>{index + 1} - })} -
+
+ setSelectColumnPriorityOpen(!selectColumnPriorityOpen) + } + > + {selectColumnPriority} + arrow + {selectColumnPriorityOpen && ( +
+ {projectBoard.columns.map((column, index) => { + return ( + { + setSelectColumnPriority(index + 1); + dispatch(setColumnPriority(index + 1)); + }} + > + {index + 1} + + ); + })} +
+ )}
{/*
*/} {/* { }); } - function copyProjectLink () { - navigator.clipboard.writeText(`https://itguild.info/tracker/project/${project.id}`) + function copyProjectLink() { + navigator.clipboard.writeText( + `https://itguild.info/tracker/project/${project.id}` + ); } return ( diff --git a/src/pages/ProjectTracker/ProjectTracker.js b/src/pages/ProjectTracker/ProjectTracker.js index 393dc043..8982f294 100644 --- a/src/pages/ProjectTracker/ProjectTracker.js +++ b/src/pages/ProjectTracker/ProjectTracker.js @@ -291,6 +291,7 @@ export const ProjectTracker = () => { setActive={setModalAdd} selectedTab={selectedTab} priorityTask={priorityTask} + projectUsers={projectBoard.projectUsers} /> {loader && } @@ -324,12 +325,26 @@ export const ProjectTracker = () => { {projectBoard.projectUsers?.length} -
+
{projectBoard.projectUsers?.length && - projectBoard.projectUsers.slice(0, projectBoard.length > 3 ? 3 : projectBoard.length).map((person) => { - return avatar - }) - } + projectBoard.projectUsers + .slice( + 0, + projectBoard.length > 3 ? 3 : projectBoard.length + ) + .map((person) => { + return ( + avatar + ); + })}
{ className="tasks__board__item__description" >

- {task.executor?.fio ? task.executor?.fio : 'Исполнитель не назначен'} - {task.executor?.avatar && - avatar - } + + {task.executor?.fio + ? task.executor?.fio + : "Исполнитель не назначен"} + + {task.executor?.avatar && ( + avatar + )}