2023-05-03 16:47:20 +03:00
|
|
|
|
import React, { useEffect, useRef, useState } from "react";
|
2023-10-24 22:58:45 +03:00
|
|
|
|
import { HexColorPicker } from "react-colorful";
|
2023-06-22 14:53:35 +03:00
|
|
|
|
import { useDispatch, useSelector } from "react-redux";
|
2023-05-04 18:38:56 +03:00
|
|
|
|
import { Link, useParams } from "react-router-dom";
|
2023-05-03 16:47:20 +03:00
|
|
|
|
|
|
|
|
|
import {
|
2023-06-22 14:53:35 +03:00
|
|
|
|
activeLoader,
|
2023-10-24 22:49:12 +03:00
|
|
|
|
addNewTagToProject,
|
2023-10-24 22:58:45 +03:00
|
|
|
|
deletePersonOnProject,
|
2023-10-25 16:33:26 +03:00
|
|
|
|
deleteTagProject,
|
2023-06-22 14:53:35 +03:00
|
|
|
|
filterCreatedByMe,
|
2023-07-03 22:07:44 +03:00
|
|
|
|
filteredExecutorTasks,
|
2023-06-22 14:53:35 +03:00
|
|
|
|
filteredParticipateTasks,
|
2023-05-05 00:50:48 +03:00
|
|
|
|
getBoarderLoader,
|
2023-06-22 14:53:35 +03:00
|
|
|
|
getProjectBoard,
|
2023-05-03 16:47:20 +03:00
|
|
|
|
modalToggle,
|
2023-06-22 14:53:35 +03:00
|
|
|
|
movePositionProjectTask,
|
2023-05-03 16:47:20 +03:00
|
|
|
|
moveProjectTask,
|
2023-05-16 00:24:52 +03:00
|
|
|
|
setColumnId,
|
2023-06-22 14:53:35 +03:00
|
|
|
|
setColumnName,
|
2023-06-09 03:19:09 +03:00
|
|
|
|
setColumnPriority,
|
2023-06-22 14:53:35 +03:00
|
|
|
|
setProjectBoardFetch,
|
|
|
|
|
setToggleTab,
|
|
|
|
|
} from "@redux/projectsTrackerSlice";
|
|
|
|
|
|
|
|
|
|
import { urlForLocal } from "@utils/helper";
|
2023-06-29 19:19:13 +03:00
|
|
|
|
import { caseOfNum } from "@utils/helper";
|
2023-06-22 14:53:35 +03:00
|
|
|
|
|
|
|
|
|
import { apiRequest } from "@api/request";
|
|
|
|
|
|
2023-07-14 03:03:49 +03:00
|
|
|
|
import { useNotification } from "@hooks/useNotification";
|
|
|
|
|
|
2023-06-22 19:18:41 +03:00
|
|
|
|
import BaseButton from "@components/Common/BaseButton/BaseButton";
|
2023-06-22 14:53:35 +03:00
|
|
|
|
import { Footer } from "@components/Common/Footer/Footer";
|
|
|
|
|
import { Loader } from "@components/Common/Loader/Loader";
|
2023-11-03 16:23:49 +03:00
|
|
|
|
import AcceptModal from "@components/Modal/AcceptModal/AcceptModal";
|
2023-06-22 14:53:35 +03:00
|
|
|
|
import ModalTicket from "@components/Modal/Tracker/ModalTicket/ModalTicket";
|
2023-06-22 19:18:41 +03:00
|
|
|
|
import TrackerModal from "@components/Modal/Tracker/TrackerModal/TrackerModal";
|
2023-06-22 14:53:35 +03:00
|
|
|
|
import { Navigation } from "@components/Navigation/Navigation";
|
|
|
|
|
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
|
|
|
|
|
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
|
2023-08-04 23:24:04 +03:00
|
|
|
|
import TrackerSelectColumn from "@components/TrackerSelectColumn/TrackerSelectColumn";
|
2023-06-22 14:53:35 +03:00
|
|
|
|
|
|
|
|
|
import arrow from "assets/icons/arrows/arrowCalendar.png";
|
2023-07-03 22:07:58 +03:00
|
|
|
|
import arrowDown from "assets/icons/arrows/selectArrow.png";
|
2023-06-22 14:53:35 +03:00
|
|
|
|
import close from "assets/icons/close.png";
|
|
|
|
|
import commentsBoard from "assets/icons/commentsBoard.svg";
|
|
|
|
|
import del from "assets/icons/delete.svg";
|
|
|
|
|
import edit from "assets/icons/edit.svg";
|
|
|
|
|
import filesBoard from "assets/icons/filesBoard.svg";
|
2023-07-04 16:19:58 +03:00
|
|
|
|
import trackerNoTasks from "assets/icons/trackerNoTasks.svg";
|
2023-06-22 14:53:35 +03:00
|
|
|
|
import project from "assets/icons/trackerProject.svg";
|
|
|
|
|
import tasks from "assets/icons/trackerTasks.svg";
|
|
|
|
|
import accept from "assets/images/accept.png";
|
2023-07-07 00:46:58 +03:00
|
|
|
|
import archive from "assets/images/archiveIcon.png";
|
2023-06-27 17:12:58 +03:00
|
|
|
|
import avatarMok from "assets/images/avatarMok.png";
|
2023-05-03 16:47:20 +03:00
|
|
|
|
|
2023-07-07 17:38:31 +03:00
|
|
|
|
import { getCorrectDate } from "../../components/Calendar/calendarHelper";
|
|
|
|
|
|
2023-05-03 16:47:20 +03:00
|
|
|
|
export const ProjectTracker = () => {
|
|
|
|
|
const dispatch = useDispatch();
|
2023-05-04 18:38:56 +03:00
|
|
|
|
const projectId = useParams();
|
2023-05-03 16:47:20 +03:00
|
|
|
|
|
2023-05-04 18:38:56 +03:00
|
|
|
|
const [openColumnSelect, setOpenColumnSelect] = useState({});
|
|
|
|
|
const [selectedTab, setSelectedTab] = useState(0);
|
2023-05-17 02:51:31 +03:00
|
|
|
|
const [priorityTask, setPriorityTask] = useState(0);
|
2023-05-04 18:38:56 +03:00
|
|
|
|
const [wrapperHover, setWrapperHover] = useState({});
|
2023-06-22 14:53:35 +03:00
|
|
|
|
const [taskHover, setTaskHover] = useState({});
|
2023-05-03 16:47:20 +03:00
|
|
|
|
const [modalAdd, setModalAdd] = useState(false);
|
|
|
|
|
const [modalActiveTicket, setModalActiveTicket] = useState(false);
|
|
|
|
|
const [selectedTicket, setSelectedTicket] = useState({});
|
2023-06-22 14:53:35 +03:00
|
|
|
|
const [personListOpen, setPersonListOpen] = useState(false);
|
2023-10-24 22:49:12 +03:00
|
|
|
|
const [tags, setTags] = useState({
|
|
|
|
|
open: false,
|
2023-10-24 22:58:45 +03:00
|
|
|
|
add: false,
|
2023-10-25 16:33:26 +03:00
|
|
|
|
edit: false,
|
2023-10-24 22:58:45 +03:00
|
|
|
|
});
|
2023-11-03 16:23:21 +03:00
|
|
|
|
const [acceptModalOpen, setAcceptModalOpen] = useState(false);
|
2023-11-03 16:23:49 +03:00
|
|
|
|
const [currentColumnDelete, setCurrentColumnDelete] = useState(null);
|
2023-10-24 22:49:12 +03:00
|
|
|
|
const [color, setColor] = useState("#aabbcc");
|
2023-10-24 22:58:45 +03:00
|
|
|
|
const [tagInfo, setTagInfo] = useState({ description: "", name: "" });
|
2023-06-22 14:53:35 +03:00
|
|
|
|
const [checkBoxParticipateTasks, setCheckBoxParticipateTasks] =
|
|
|
|
|
useState(false);
|
2023-07-04 16:19:58 +03:00
|
|
|
|
const [filteredNoTasks, setFilteredNoTasks] = useState(false);
|
2023-06-22 14:53:35 +03:00
|
|
|
|
const [checkBoxMyTasks, setCheckBoxMyTasks] = useState(false);
|
2023-07-03 22:07:44 +03:00
|
|
|
|
const [selectedExecutor, setSelectedExecutor] = useState(null);
|
2023-07-03 22:07:58 +03:00
|
|
|
|
const [selectExecutorOpen, setSelectedExecutorOpen] = useState(false);
|
2023-05-03 16:47:20 +03:00
|
|
|
|
const startWrapperIndexTest = useRef({});
|
|
|
|
|
const projectBoard = useSelector(getProjectBoard);
|
2023-05-05 16:10:25 +03:00
|
|
|
|
const loader = useSelector(getBoarderLoader);
|
2023-07-14 03:03:49 +03:00
|
|
|
|
const { showNotification } = useNotification();
|
2023-05-03 16:47:20 +03:00
|
|
|
|
|
2023-11-21 16:41:18 +03:00
|
|
|
|
const priority = {
|
|
|
|
|
2: "Высокий",
|
|
|
|
|
1: "Средний",
|
|
|
|
|
0: "Низкий",
|
|
|
|
|
};
|
2023-11-21 16:40:58 +03:00
|
|
|
|
|
2023-11-21 16:41:18 +03:00
|
|
|
|
const priorityClass = {
|
|
|
|
|
2: "high",
|
|
|
|
|
1: "middle",
|
|
|
|
|
0: "low",
|
|
|
|
|
};
|
2023-11-21 16:40:58 +03:00
|
|
|
|
|
2023-05-04 18:38:56 +03:00
|
|
|
|
useEffect(() => {
|
2023-05-05 16:10:25 +03:00
|
|
|
|
dispatch(activeLoader());
|
2023-05-04 18:38:56 +03:00
|
|
|
|
dispatch(setProjectBoardFetch(projectId.id));
|
2023-10-28 17:57:58 +03:00
|
|
|
|
initListeners();
|
2023-05-04 18:38:56 +03:00
|
|
|
|
}, []);
|
2023-05-02 18:51:19 +03:00
|
|
|
|
|
2023-05-04 18:38:56 +03:00
|
|
|
|
useEffect(() => {
|
2023-06-22 14:53:35 +03:00
|
|
|
|
const tasksHover = {};
|
|
|
|
|
const columnHover = {};
|
2023-07-04 16:19:58 +03:00
|
|
|
|
let columnsTasksEmpty = true;
|
2023-05-04 18:38:56 +03:00
|
|
|
|
if (Object.keys(projectBoard).length) {
|
|
|
|
|
projectBoard.columns.forEach((column) => {
|
2023-07-04 16:19:58 +03:00
|
|
|
|
if (column.tasks.length) columnsTasksEmpty = false;
|
2023-05-04 18:38:56 +03:00
|
|
|
|
setOpenColumnSelect((prevState) => ({
|
|
|
|
|
...prevState,
|
|
|
|
|
[column.id]: false,
|
|
|
|
|
}));
|
2023-06-22 14:53:35 +03:00
|
|
|
|
columnHover[column.id] = false;
|
|
|
|
|
column.tasks.forEach((task) => (tasksHover[task.id] = false));
|
2023-05-04 18:38:56 +03:00
|
|
|
|
});
|
2023-05-02 18:51:19 +03:00
|
|
|
|
}
|
2023-07-04 16:19:58 +03:00
|
|
|
|
if (
|
|
|
|
|
columnsTasksEmpty &&
|
|
|
|
|
(checkBoxMyTasks || selectedExecutor || checkBoxParticipateTasks)
|
|
|
|
|
) {
|
|
|
|
|
setFilteredNoTasks(true);
|
2023-07-04 16:19:46 +03:00
|
|
|
|
} else {
|
2023-07-04 16:19:58 +03:00
|
|
|
|
setFilteredNoTasks(false);
|
2023-07-04 16:19:46 +03:00
|
|
|
|
}
|
2023-06-22 14:53:35 +03:00
|
|
|
|
setWrapperHover(columnHover);
|
|
|
|
|
setTaskHover(tasksHover);
|
2023-05-04 18:38:56 +03:00
|
|
|
|
}, [projectBoard]);
|
2023-05-02 18:51:19 +03:00
|
|
|
|
|
2023-05-03 16:47:20 +03:00
|
|
|
|
function dragStartHandler(e, task, columnId) {
|
|
|
|
|
startWrapperIndexTest.current = { task: task, index: columnId };
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-15 21:46:52 +03:00
|
|
|
|
function dragOverTaskHandler(e, task) {
|
2023-06-22 14:53:35 +03:00
|
|
|
|
e.preventDefault();
|
2023-06-15 21:46:52 +03:00
|
|
|
|
if (startWrapperIndexTest.current.task.id === task.id) {
|
2023-06-22 14:53:35 +03:00
|
|
|
|
return;
|
2023-06-15 21:46:52 +03:00
|
|
|
|
}
|
2023-06-22 14:53:35 +03:00
|
|
|
|
setTaskHover((prevState) => ({ [prevState]: false, [task.id]: true }));
|
2023-06-15 21:46:52 +03:00
|
|
|
|
}
|
|
|
|
|
|
2023-06-22 14:53:35 +03:00
|
|
|
|
function dragLeaveTaskHandler() {
|
|
|
|
|
setTaskHover((prevState) => ({ [prevState]: false }));
|
2023-06-15 21:46:52 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function dragEndTaskHandler() {
|
2023-06-22 14:53:35 +03:00
|
|
|
|
setTaskHover((prevState) => ({ [prevState]: false }));
|
2023-05-04 18:38:56 +03:00
|
|
|
|
setWrapperHover((prevState) => ({
|
|
|
|
|
[prevState]: false,
|
|
|
|
|
}));
|
2023-06-15 21:46:52 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function dragDropTaskHandler(e, task, column) {
|
2023-06-22 14:53:35 +03:00
|
|
|
|
e.preventDefault();
|
2023-06-15 21:46:52 +03:00
|
|
|
|
if (task.id === startWrapperIndexTest.current.task.id) {
|
2023-06-22 14:53:35 +03:00
|
|
|
|
return;
|
2023-06-15 21:46:52 +03:00
|
|
|
|
}
|
2023-06-22 14:53:35 +03:00
|
|
|
|
const finishTask = column.tasks.indexOf(task);
|
|
|
|
|
dispatch(
|
|
|
|
|
movePositionProjectTask({
|
|
|
|
|
startTask: startWrapperIndexTest.current.task,
|
|
|
|
|
finishTask: task,
|
|
|
|
|
finishIndex: finishTask,
|
2023-12-05 14:15:04 +03:00
|
|
|
|
})
|
2023-06-22 14:53:35 +03:00
|
|
|
|
);
|
2023-05-03 16:47:20 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function dragOverHandler(e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function dragEnterHandler(columnId) {
|
|
|
|
|
if (columnId === startWrapperIndexTest.current.index) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-05-02 18:51:19 +03:00
|
|
|
|
|
2023-05-04 18:38:56 +03:00
|
|
|
|
setWrapperHover((prevState) => ({
|
|
|
|
|
[prevState]: false,
|
|
|
|
|
[columnId]: true,
|
|
|
|
|
}));
|
2023-05-03 16:47:20 +03:00
|
|
|
|
}
|
2023-06-15 21:46:52 +03:00
|
|
|
|
|
2023-05-03 16:47:20 +03:00
|
|
|
|
function dragDropHandler(e, columnId) {
|
|
|
|
|
e.preventDefault();
|
2023-05-02 18:51:19 +03:00
|
|
|
|
|
2023-05-04 18:38:56 +03:00
|
|
|
|
setWrapperHover((prevState) => ({
|
|
|
|
|
[prevState]: false,
|
|
|
|
|
}));
|
2023-05-03 16:47:20 +03:00
|
|
|
|
|
2023-06-22 14:53:35 +03:00
|
|
|
|
if (
|
|
|
|
|
startWrapperIndexTest.current.index === columnId ||
|
|
|
|
|
e.target.className.includes("__item")
|
|
|
|
|
) {
|
2023-06-15 21:46:52 +03:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-03 16:47:20 +03:00
|
|
|
|
if (columnId !== startWrapperIndexTest.current.index) {
|
|
|
|
|
dispatch(
|
|
|
|
|
moveProjectTask({
|
|
|
|
|
startWrapperIndex: startWrapperIndexTest.current,
|
|
|
|
|
columnId,
|
2023-12-05 14:15:04 +03:00
|
|
|
|
})
|
2023-05-03 16:47:20 +03:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-17 02:51:31 +03:00
|
|
|
|
function selectedTabTask(columnId, length) {
|
2023-05-03 16:47:20 +03:00
|
|
|
|
setSelectedTab(columnId);
|
|
|
|
|
dispatch(modalToggle("createTiketProject"));
|
|
|
|
|
setModalAdd(true);
|
2023-06-22 14:53:35 +03:00
|
|
|
|
setPriorityTask(length);
|
2023-05-03 16:47:20 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function openTicket(e, task) {
|
2023-08-07 15:52:58 +03:00
|
|
|
|
if (window.innerWidth < 985) {
|
2023-08-04 23:24:18 +03:00
|
|
|
|
return;
|
2023-08-04 23:24:04 +03:00
|
|
|
|
}
|
2023-05-03 16:47:20 +03:00
|
|
|
|
setSelectedTicket(task);
|
|
|
|
|
setModalActiveTicket(true);
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-09 03:19:09 +03:00
|
|
|
|
function deleteColumn(column) {
|
2023-06-22 14:53:35 +03:00
|
|
|
|
const priorityColumns = [];
|
2023-05-04 18:38:56 +03:00
|
|
|
|
apiRequest("/project-column/update-column", {
|
|
|
|
|
method: "PUT",
|
|
|
|
|
data: {
|
2023-06-09 03:19:09 +03:00
|
|
|
|
column_id: column.id,
|
2023-05-04 18:38:56 +03:00
|
|
|
|
project_id: projectBoard.id,
|
|
|
|
|
status: 0,
|
|
|
|
|
},
|
2023-06-12 22:14:45 +03:00
|
|
|
|
}).then(() => {
|
2023-06-09 03:19:09 +03:00
|
|
|
|
if (column.priority < projectBoard.columns.length) {
|
|
|
|
|
for (let i = column.priority; i < projectBoard.columns.length; i++) {
|
|
|
|
|
const currentColumn = {
|
|
|
|
|
column_id: projectBoard.columns[i].id,
|
2023-06-22 14:53:35 +03:00
|
|
|
|
priority: i,
|
|
|
|
|
};
|
|
|
|
|
priorityColumns.push(currentColumn);
|
2023-06-09 03:19:09 +03:00
|
|
|
|
}
|
|
|
|
|
apiRequest("/project-column/set-priority", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
data: {
|
|
|
|
|
project_id: projectBoard.id,
|
2023-06-22 14:53:35 +03:00
|
|
|
|
data: JSON.stringify(priorityColumns),
|
|
|
|
|
},
|
2023-06-09 03:19:09 +03:00
|
|
|
|
}).then(() => {
|
|
|
|
|
dispatch(setProjectBoardFetch(projectBoard.id));
|
2023-06-22 14:53:35 +03:00
|
|
|
|
});
|
2023-06-09 03:19:09 +03:00
|
|
|
|
} else {
|
|
|
|
|
dispatch(setProjectBoardFetch(projectBoard.id));
|
|
|
|
|
}
|
2023-07-14 03:03:49 +03:00
|
|
|
|
showNotification({ show: true, text: "Колонка удалена", type: "error" });
|
2023-05-04 18:38:56 +03:00
|
|
|
|
});
|
|
|
|
|
}
|
2023-05-02 18:51:19 +03:00
|
|
|
|
|
2023-05-23 23:02:39 +03:00
|
|
|
|
function deletePerson(userId) {
|
|
|
|
|
apiRequest("/project/del-user", {
|
|
|
|
|
method: "DELETE",
|
|
|
|
|
data: {
|
|
|
|
|
project_id: projectBoard.id,
|
2023-06-22 14:53:35 +03:00
|
|
|
|
user_id: userId,
|
2023-05-23 23:02:39 +03:00
|
|
|
|
},
|
2023-06-12 22:14:45 +03:00
|
|
|
|
}).then(() => {
|
2023-06-22 14:53:35 +03:00
|
|
|
|
dispatch(deletePersonOnProject(userId));
|
2023-05-23 23:02:39 +03:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-09 03:19:09 +03:00
|
|
|
|
function filterParticipateTasks() {
|
|
|
|
|
if (!checkBoxParticipateTasks) {
|
2023-06-22 14:53:35 +03:00
|
|
|
|
dispatch(filteredParticipateTasks(Number(localStorage.getItem("id"))));
|
2023-06-09 03:19:09 +03:00
|
|
|
|
} else {
|
2023-06-22 14:53:35 +03:00
|
|
|
|
dispatch(setProjectBoardFetch(projectId.id));
|
|
|
|
|
setCheckBoxParticipateTasks(false);
|
|
|
|
|
setCheckBoxMyTasks(false);
|
2023-07-03 22:10:04 +03:00
|
|
|
|
setSelectedExecutor(null);
|
2023-06-09 03:19:09 +03:00
|
|
|
|
}
|
2023-06-22 14:53:35 +03:00
|
|
|
|
setCheckBoxParticipateTasks(!checkBoxParticipateTasks);
|
2023-06-09 03:19:09 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function filterMyTask() {
|
|
|
|
|
if (!checkBoxMyTasks) {
|
2023-06-22 14:53:35 +03:00
|
|
|
|
dispatch(filterCreatedByMe(Number(localStorage.getItem("id"))));
|
2023-06-09 03:19:09 +03:00
|
|
|
|
} else {
|
2023-06-22 14:53:35 +03:00
|
|
|
|
dispatch(setProjectBoardFetch(projectId.id));
|
|
|
|
|
setCheckBoxParticipateTasks(false);
|
|
|
|
|
setCheckBoxMyTasks(false);
|
2023-07-03 22:10:04 +03:00
|
|
|
|
setSelectedExecutor(null);
|
2023-06-09 03:19:09 +03:00
|
|
|
|
}
|
2023-06-22 14:53:35 +03:00
|
|
|
|
setCheckBoxMyTasks(!checkBoxMyTasks);
|
2023-06-09 03:19:09 +03:00
|
|
|
|
}
|
|
|
|
|
|
2023-07-03 22:07:44 +03:00
|
|
|
|
function executorFilter(user) {
|
2023-07-03 22:07:58 +03:00
|
|
|
|
dispatch(filteredExecutorTasks(user.user_id));
|
|
|
|
|
setSelectedExecutor(user);
|
2023-07-03 22:07:44 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function deleteSelectedExecutorFilter() {
|
2023-07-03 22:07:58 +03:00
|
|
|
|
setSelectedExecutor(null);
|
2023-07-03 22:10:04 +03:00
|
|
|
|
setCheckBoxParticipateTasks(false);
|
|
|
|
|
setCheckBoxMyTasks(false);
|
2023-07-03 22:07:44 +03:00
|
|
|
|
dispatch(setProjectBoardFetch(projectId.id));
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-24 22:58:45 +03:00
|
|
|
|
function addNewTag() {
|
2023-10-24 22:49:12 +03:00
|
|
|
|
apiRequest("/mark/create", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
data: {
|
|
|
|
|
title: tagInfo.description,
|
|
|
|
|
slug: tagInfo.name,
|
|
|
|
|
color: color,
|
2023-10-24 22:58:45 +03:00
|
|
|
|
status: 1,
|
2023-10-24 22:49:12 +03:00
|
|
|
|
},
|
|
|
|
|
}).then((data) => {
|
|
|
|
|
apiRequest("/mark/attach", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
data: {
|
|
|
|
|
mark_id: data.id,
|
|
|
|
|
entity_type: 1,
|
2023-10-24 22:58:45 +03:00
|
|
|
|
entity_id: projectId.id,
|
|
|
|
|
},
|
2023-10-24 22:49:12 +03:00
|
|
|
|
}).then((data) => {
|
2023-10-24 22:58:45 +03:00
|
|
|
|
dispatch(addNewTagToProject(data.mark));
|
2023-10-24 22:49:12 +03:00
|
|
|
|
setTags((prevState) => ({
|
|
|
|
|
...prevState,
|
2023-10-24 22:58:45 +03:00
|
|
|
|
add: false,
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
});
|
2023-10-24 22:49:12 +03:00
|
|
|
|
}
|
|
|
|
|
|
2023-10-25 16:33:08 +03:00
|
|
|
|
function editTag() {
|
|
|
|
|
apiRequest("/mark/update", {
|
|
|
|
|
method: "PUT",
|
|
|
|
|
data: {
|
|
|
|
|
mark_id: tagInfo.editMarkId,
|
|
|
|
|
title: tagInfo.description,
|
|
|
|
|
slug: tagInfo.name,
|
2023-10-25 16:33:26 +03:00
|
|
|
|
color: color,
|
|
|
|
|
},
|
2023-10-25 16:33:08 +03:00
|
|
|
|
}).then(() => {
|
2023-10-25 16:33:26 +03:00
|
|
|
|
dispatch(setProjectBoardFetch(projectId.id));
|
2023-10-25 16:33:08 +03:00
|
|
|
|
setTags((prevState) => ({
|
|
|
|
|
...prevState,
|
|
|
|
|
edit: false,
|
|
|
|
|
}));
|
2023-10-26 14:45:14 +03:00
|
|
|
|
setTagInfo({ description: "", name: "" });
|
|
|
|
|
setColor("#aabbcc");
|
2023-10-25 16:33:26 +03:00
|
|
|
|
});
|
2023-10-25 16:33:08 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function deleteTag(tagId) {
|
|
|
|
|
apiRequest("/mark/detach", {
|
|
|
|
|
method: "DELETE",
|
|
|
|
|
data: {
|
|
|
|
|
mark_id: tagId,
|
|
|
|
|
entity_type: 1,
|
|
|
|
|
entity_id: projectId.id,
|
2023-10-25 16:33:26 +03:00
|
|
|
|
},
|
2023-10-25 16:33:08 +03:00
|
|
|
|
}).then(() => {
|
2023-10-25 16:33:26 +03:00
|
|
|
|
dispatch(deleteTagProject(tagId));
|
|
|
|
|
});
|
2023-10-25 16:33:08 +03:00
|
|
|
|
}
|
|
|
|
|
|
2023-10-28 17:57:32 +03:00
|
|
|
|
const initListeners = () => {
|
|
|
|
|
document.addEventListener("click", closeByClickingOut);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const closeByClickingOut = (event) => {
|
|
|
|
|
const path = event.path || (event.composedPath && event.composedPath());
|
|
|
|
|
|
|
|
|
|
if (
|
2023-10-28 17:57:58 +03:00
|
|
|
|
event &&
|
|
|
|
|
!path.find(
|
|
|
|
|
(div) =>
|
|
|
|
|
div.classList &&
|
|
|
|
|
(div.classList.contains("addPerson") ||
|
2023-12-05 14:15:04 +03:00
|
|
|
|
div.classList.contains("persons__list"))
|
2023-10-28 17:57:58 +03:00
|
|
|
|
)
|
2023-10-28 17:57:32 +03:00
|
|
|
|
) {
|
|
|
|
|
setPersonListOpen(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (
|
2023-10-28 17:57:58 +03:00
|
|
|
|
event &&
|
|
|
|
|
!path.find(
|
|
|
|
|
(div) =>
|
|
|
|
|
div.classList &&
|
|
|
|
|
(div.classList.contains("tasks__head__executor") ||
|
2023-12-05 14:15:04 +03:00
|
|
|
|
div.classList.contains("tasks__head__executorDropdown"))
|
2023-10-28 17:57:58 +03:00
|
|
|
|
)
|
2023-10-28 17:57:32 +03:00
|
|
|
|
) {
|
|
|
|
|
setSelectedExecutorOpen(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (
|
2023-10-28 17:57:58 +03:00
|
|
|
|
event &&
|
|
|
|
|
!path.find(
|
|
|
|
|
(div) =>
|
|
|
|
|
div.classList &&
|
|
|
|
|
(div.classList.contains("tasks__head__tags") ||
|
2023-12-05 14:15:04 +03:00
|
|
|
|
div.classList.contains("tags__list"))
|
2023-10-28 17:57:58 +03:00
|
|
|
|
)
|
2023-10-28 17:57:32 +03:00
|
|
|
|
) {
|
|
|
|
|
setTags({
|
|
|
|
|
open: false,
|
|
|
|
|
add: false,
|
|
|
|
|
edit: false,
|
|
|
|
|
});
|
2023-11-24 17:24:43 +03:00
|
|
|
|
setTagInfo({
|
|
|
|
|
description: "",
|
|
|
|
|
name: "",
|
|
|
|
|
});
|
|
|
|
|
setColor("#aabbcc");
|
2023-10-28 17:57:32 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (
|
2023-10-28 17:57:58 +03:00
|
|
|
|
event &&
|
|
|
|
|
!path.find(
|
|
|
|
|
(div) =>
|
|
|
|
|
div.classList &&
|
|
|
|
|
(div.classList.contains("board__head__more") ||
|
2023-12-05 14:15:04 +03:00
|
|
|
|
div.classList.contains("column__select"))
|
2023-10-28 17:57:58 +03:00
|
|
|
|
)
|
2023-10-28 17:57:32 +03:00
|
|
|
|
) {
|
|
|
|
|
setOpenColumnSelect((prevState) => {
|
2023-10-28 17:57:58 +03:00
|
|
|
|
const newState = {};
|
2023-10-28 17:57:32 +03:00
|
|
|
|
for (const key in prevState) {
|
|
|
|
|
newState[key] = false;
|
|
|
|
|
}
|
|
|
|
|
return newState;
|
2023-10-28 17:57:58 +03:00
|
|
|
|
});
|
2023-10-28 17:57:32 +03:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2023-11-03 16:23:21 +03:00
|
|
|
|
function closeAcceptModal() {
|
|
|
|
|
setAcceptModalOpen(false);
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-03 16:47:20 +03:00
|
|
|
|
return (
|
|
|
|
|
<div className="tracker">
|
|
|
|
|
<ProfileHeader />
|
|
|
|
|
<Navigation />
|
|
|
|
|
<div className="container">
|
|
|
|
|
<div className="tracker__content">
|
|
|
|
|
<ProfileBreadcrumbs
|
|
|
|
|
links={[
|
|
|
|
|
{ name: "Главная", link: "/profile" },
|
|
|
|
|
{ name: "Трекер", link: "/profile/tracker" },
|
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
<h2 className="tracker__title">Управление проектами с трекером</h2>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="tracker__tabs">
|
|
|
|
|
<div className="tracker__tabs__head">
|
|
|
|
|
<Link
|
|
|
|
|
to="/profile/tracker"
|
2023-08-04 23:24:04 +03:00
|
|
|
|
className="tab active-tab tab projectsTab"
|
2023-05-03 16:47:20 +03:00
|
|
|
|
onClick={() => dispatch(setToggleTab(1))}
|
|
|
|
|
>
|
|
|
|
|
<img src={project} alt="img" />
|
|
|
|
|
<p>Проекты </p>
|
|
|
|
|
</Link>
|
|
|
|
|
<Link
|
|
|
|
|
to="/profile/tracker"
|
2023-08-04 23:24:04 +03:00
|
|
|
|
className="tab tasksTab"
|
2023-05-03 16:47:20 +03:00
|
|
|
|
onClick={() => dispatch(setToggleTab(2))}
|
|
|
|
|
>
|
|
|
|
|
<img src={tasks} alt="img" />
|
|
|
|
|
<p>Все мои задачи</p>
|
|
|
|
|
</Link>
|
|
|
|
|
<Link
|
|
|
|
|
to="/profile/tracker"
|
2023-08-04 23:24:04 +03:00
|
|
|
|
className="tab archiveTab"
|
2023-05-03 16:47:20 +03:00
|
|
|
|
onClick={() => dispatch(setToggleTab(3))}
|
|
|
|
|
>
|
|
|
|
|
<img src={archive} alt="img" />
|
|
|
|
|
<p>Архив</p>
|
|
|
|
|
</Link>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="tracker__tabs__content">
|
2023-05-10 12:23:35 +03:00
|
|
|
|
<TrackerModal
|
|
|
|
|
active={modalAdd}
|
|
|
|
|
setActive={setModalAdd}
|
|
|
|
|
selectedTab={selectedTab}
|
2023-05-17 02:51:31 +03:00
|
|
|
|
priorityTask={priorityTask}
|
2023-06-27 18:35:44 +03:00
|
|
|
|
projectUsers={projectBoard.projectUsers}
|
2023-10-30 01:35:06 +03:00
|
|
|
|
projectMarks={projectBoard.mark}
|
2023-05-10 12:23:35 +03:00
|
|
|
|
/>
|
|
|
|
|
|
2023-05-05 16:10:25 +03:00
|
|
|
|
{loader && <Loader style="green" />}
|
|
|
|
|
{!loader && (
|
|
|
|
|
<div className="tracker__tabs__content__tasks tasks active__content">
|
|
|
|
|
<div className="tasks__head">
|
|
|
|
|
<div className="tasks__head__wrapper">
|
2023-06-26 12:10:49 +03:00
|
|
|
|
<h5>Проект : {projectBoard.name}</h5>
|
2023-05-03 16:47:20 +03:00
|
|
|
|
|
2023-05-05 16:10:25 +03:00
|
|
|
|
<div className="tasks__head__add">
|
2023-06-22 19:18:41 +03:00
|
|
|
|
<BaseButton
|
2023-05-05 00:50:48 +03:00
|
|
|
|
onClick={() => {
|
|
|
|
|
dispatch(modalToggle("createColumn"));
|
|
|
|
|
setModalAdd(true);
|
|
|
|
|
}}
|
2023-06-22 19:18:41 +03:00
|
|
|
|
styles={"button-add-column"}
|
2023-05-05 16:10:25 +03:00
|
|
|
|
>
|
|
|
|
|
+
|
2023-06-22 19:18:41 +03:00
|
|
|
|
</BaseButton>
|
|
|
|
|
{/* <span
|
|
|
|
|
onClick={() => {
|
|
|
|
|
dispatch(modalToggle("createColumn"));
|
|
|
|
|
setModalAdd(true);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
+
|
|
|
|
|
</span> */}
|
2023-05-05 16:10:25 +03:00
|
|
|
|
<p>добавить колонку</p>
|
|
|
|
|
</div>
|
2023-08-10 18:57:06 +03:00
|
|
|
|
<div
|
|
|
|
|
className={
|
|
|
|
|
projectBoard.projectUsers?.length
|
|
|
|
|
? "tasks__head__persons"
|
|
|
|
|
: "tasks__head__persons noProjectUsers"
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
{Boolean(projectBoard.projectUsers?.length) && (
|
2023-11-27 17:32:38 +03:00
|
|
|
|
<div
|
|
|
|
|
className={
|
|
|
|
|
projectBoard.projectUsers?.length == 1
|
|
|
|
|
? "onePerson"
|
|
|
|
|
: "projectPersons"
|
|
|
|
|
}
|
|
|
|
|
>
|
2023-08-10 18:57:06 +03:00
|
|
|
|
{projectBoard.projectUsers.slice(0, 3).map((person) => {
|
|
|
|
|
return (
|
|
|
|
|
<img
|
|
|
|
|
key={person.user_id}
|
|
|
|
|
src={
|
|
|
|
|
person.user?.avatar
|
|
|
|
|
? urlForLocal(person.user.avatar)
|
|
|
|
|
: avatarMok
|
|
|
|
|
}
|
|
|
|
|
alt="avatar"
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
})}
|
2023-08-10 18:56:50 +03:00
|
|
|
|
</div>
|
2023-08-10 18:57:06 +03:00
|
|
|
|
)}
|
2023-10-10 14:22:43 +03:00
|
|
|
|
{projectBoard.projectUsers?.length > 3 && (
|
2023-10-10 16:31:40 +03:00
|
|
|
|
<span className="countPersons">+1</span>
|
2023-10-10 14:22:43 +03:00
|
|
|
|
)}
|
2023-05-05 16:10:25 +03:00
|
|
|
|
<span
|
2023-05-05 00:50:48 +03:00
|
|
|
|
className="addPerson"
|
|
|
|
|
onClick={() => {
|
2023-06-22 14:53:35 +03:00
|
|
|
|
setPersonListOpen(true);
|
2023-05-05 00:50:48 +03:00
|
|
|
|
}}
|
2023-05-05 16:10:25 +03:00
|
|
|
|
>
|
|
|
|
|
+
|
|
|
|
|
</span>
|
|
|
|
|
<p>добавить участника</p>
|
2023-06-22 14:53:35 +03:00
|
|
|
|
{personListOpen && (
|
|
|
|
|
<div className="persons__list">
|
|
|
|
|
<img
|
|
|
|
|
className="persons__list__close"
|
|
|
|
|
src={close}
|
|
|
|
|
alt="close"
|
|
|
|
|
onClick={() => setPersonListOpen(false)}
|
|
|
|
|
/>
|
|
|
|
|
<div className="persons__list__count">
|
|
|
|
|
<span>{projectBoard.projectUsers?.length}</span>
|
2023-07-07 00:46:58 +03:00
|
|
|
|
{caseOfNum(
|
|
|
|
|
projectBoard.projectUsers?.length,
|
2023-12-05 14:15:04 +03:00
|
|
|
|
"persons"
|
2023-07-07 00:46:58 +03:00
|
|
|
|
)}
|
2023-06-22 14:53:35 +03:00
|
|
|
|
</div>
|
|
|
|
|
<div className="persons__list__info">
|
2023-07-04 16:19:58 +03:00
|
|
|
|
<span>В проекте - </span>
|
|
|
|
|
<p>“{projectBoard.name}”</p>
|
2023-06-22 14:53:35 +03:00
|
|
|
|
</div>
|
|
|
|
|
<div className="persons__list__items">
|
|
|
|
|
{projectBoard.projectUsers?.map((person) => {
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
className="persons__list__item"
|
|
|
|
|
key={person.user_id}
|
|
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
className="avatar"
|
2023-06-29 02:26:49 +03:00
|
|
|
|
src={
|
|
|
|
|
person.user?.avatar
|
|
|
|
|
? urlForLocal(person.user.avatar)
|
|
|
|
|
: avatarMok
|
|
|
|
|
}
|
2023-06-22 14:53:35 +03:00
|
|
|
|
alt="avatar"
|
|
|
|
|
/>
|
|
|
|
|
<span>{person.user.fio}</span>
|
|
|
|
|
<img
|
|
|
|
|
className="delete"
|
|
|
|
|
src={close}
|
|
|
|
|
alt="delete"
|
|
|
|
|
onClick={() => deletePerson(person.user_id)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
className="persons__list__add"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
dispatch(modalToggle("addWorker"));
|
|
|
|
|
setModalAdd(true);
|
|
|
|
|
setPersonListOpen(false);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<span className="addPerson">+</span>
|
|
|
|
|
<p>Добавить участников</p>
|
|
|
|
|
</div>
|
2023-05-23 23:02:39 +03:00
|
|
|
|
</div>
|
2023-06-22 14:53:35 +03:00
|
|
|
|
)}
|
2023-05-05 16:10:25 +03:00
|
|
|
|
</div>
|
2023-06-22 14:53:35 +03:00
|
|
|
|
<div
|
|
|
|
|
className="tasks__head__checkBox"
|
|
|
|
|
onClick={filterParticipateTasks}
|
|
|
|
|
>
|
2023-05-05 16:10:25 +03:00
|
|
|
|
<span>Участвую</span>
|
2023-06-09 03:19:09 +03:00
|
|
|
|
<div className="tasks__head__checkBox__box">
|
2023-06-22 14:53:35 +03:00
|
|
|
|
{checkBoxParticipateTasks && (
|
|
|
|
|
<img src={accept} alt="accept" />
|
|
|
|
|
)}
|
2023-06-09 03:19:09 +03:00
|
|
|
|
</div>
|
2023-05-05 16:10:25 +03:00
|
|
|
|
</div>
|
2023-06-09 03:19:09 +03:00
|
|
|
|
<div className="tasks__head__checkBox" onClick={filterMyTask}>
|
2023-05-05 16:10:25 +03:00
|
|
|
|
<span>Мои</span>
|
2023-06-09 03:19:09 +03:00
|
|
|
|
<div className="tasks__head__checkBox__box">
|
2023-06-22 14:53:35 +03:00
|
|
|
|
{checkBoxMyTasks && <img src={accept} alt="accept" />}
|
2023-06-09 03:19:09 +03:00
|
|
|
|
</div>
|
2023-05-05 16:10:25 +03:00
|
|
|
|
</div>
|
2023-07-03 22:07:58 +03:00
|
|
|
|
{selectedExecutor ? (
|
|
|
|
|
<div className="tasks__head__executorSelected">
|
2023-07-03 22:07:44 +03:00
|
|
|
|
<p>{selectedExecutor.user.fio}</p>
|
|
|
|
|
<img
|
2023-07-03 22:07:58 +03:00
|
|
|
|
className="avatar"
|
2023-07-03 22:07:44 +03:00
|
|
|
|
src={
|
|
|
|
|
selectedExecutor.user?.avatar
|
|
|
|
|
? urlForLocal(selectedExecutor.user.avatar)
|
|
|
|
|
: avatarMok
|
|
|
|
|
}
|
2023-07-03 22:07:58 +03:00
|
|
|
|
alt="avatar"
|
|
|
|
|
/>
|
2023-07-03 22:07:44 +03:00
|
|
|
|
<img
|
|
|
|
|
className="delete"
|
|
|
|
|
src={close}
|
|
|
|
|
alt="delete"
|
|
|
|
|
onClick={deleteSelectedExecutorFilter}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2023-07-03 22:07:58 +03:00
|
|
|
|
) : (
|
|
|
|
|
<div
|
|
|
|
|
className="tasks__head__executor"
|
|
|
|
|
onClick={() =>
|
|
|
|
|
setSelectedExecutorOpen(!selectExecutorOpen)
|
|
|
|
|
}
|
|
|
|
|
>
|
2023-07-07 00:46:40 +03:00
|
|
|
|
<p>Выберите исполнителя</p>
|
2023-07-03 22:07:58 +03:00
|
|
|
|
<img
|
|
|
|
|
className={selectExecutorOpen ? "open" : ""}
|
|
|
|
|
src={arrowDown}
|
|
|
|
|
alt="arrow"
|
|
|
|
|
/>
|
|
|
|
|
{selectExecutorOpen && (
|
|
|
|
|
<div className="tasks__head__executorDropdown">
|
2023-07-03 22:07:44 +03:00
|
|
|
|
{projectBoard.projectUsers.map((user) => {
|
2023-07-03 22:07:58 +03:00
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
className="executorDropdown__person"
|
|
|
|
|
key={user.user_id}
|
|
|
|
|
onClick={() => executorFilter(user)}
|
|
|
|
|
>
|
|
|
|
|
<p>{user.user?.fio}</p>
|
|
|
|
|
<img
|
|
|
|
|
src={
|
|
|
|
|
user.user?.avatar
|
|
|
|
|
? urlForLocal(user.user.avatar)
|
|
|
|
|
: avatarMok
|
|
|
|
|
}
|
|
|
|
|
alt="avatar"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
})}
|
2023-07-03 22:07:44 +03:00
|
|
|
|
</div>
|
2023-07-03 22:07:58 +03:00
|
|
|
|
)}
|
2023-07-03 22:07:44 +03:00
|
|
|
|
</div>
|
2023-07-03 22:07:58 +03:00
|
|
|
|
)}
|
2023-10-24 22:49:12 +03:00
|
|
|
|
<div className="tasks__head__tags">
|
2023-10-24 22:58:45 +03:00
|
|
|
|
<div
|
|
|
|
|
className="tags__add"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
setTags((prevState) => ({
|
|
|
|
|
...prevState,
|
|
|
|
|
open: !tags.open,
|
|
|
|
|
}));
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-10-24 22:49:12 +03:00
|
|
|
|
<p>Список тегов</p>
|
|
|
|
|
<span>+</span>
|
|
|
|
|
</div>
|
2023-10-24 22:58:45 +03:00
|
|
|
|
{tags.open && (
|
|
|
|
|
<div className="tags__list">
|
2023-11-24 17:24:43 +03:00
|
|
|
|
<div
|
|
|
|
|
className="addNewTag"
|
|
|
|
|
onClick={() =>
|
|
|
|
|
setTags((prevState) => ({
|
|
|
|
|
...prevState,
|
|
|
|
|
add: true,
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
<p>Добавить новый тег</p>
|
|
|
|
|
<span>+</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
2023-10-25 16:33:08 +03:00
|
|
|
|
{!tags.add && !tags.edit && (
|
2023-10-24 22:58:45 +03:00
|
|
|
|
<div className="tags__list__created">
|
|
|
|
|
{projectBoard.mark.map((tag) => {
|
|
|
|
|
return (
|
|
|
|
|
<div className="tagItem" key={tag.id}>
|
|
|
|
|
<p className="tagItem__description">
|
|
|
|
|
{tag.title}
|
|
|
|
|
</p>
|
|
|
|
|
<div className="tagItem__info">
|
|
|
|
|
<span className="tagItem__info__name">
|
|
|
|
|
{tag.slug}
|
|
|
|
|
</span>
|
|
|
|
|
<span
|
|
|
|
|
className="tagItem__info__color"
|
|
|
|
|
style={{ background: tag.color }}
|
|
|
|
|
/>
|
2023-11-24 17:24:43 +03:00
|
|
|
|
|
|
|
|
|
<div className="tagItem__info__images">
|
|
|
|
|
<img
|
|
|
|
|
src={edit}
|
|
|
|
|
alt="edit"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
setTags((prevState) => ({
|
|
|
|
|
...prevState,
|
|
|
|
|
edit: true,
|
|
|
|
|
}));
|
|
|
|
|
setTagInfo({
|
|
|
|
|
description: tag.title,
|
|
|
|
|
name: tag.slug,
|
|
|
|
|
editMarkId: tag.id,
|
|
|
|
|
});
|
|
|
|
|
setColor(tag.color);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<img
|
|
|
|
|
onClick={() => deleteTag(tag.id)}
|
|
|
|
|
className="delete"
|
|
|
|
|
src={close}
|
|
|
|
|
alt="delete"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2023-10-25 16:33:08 +03:00
|
|
|
|
</div>
|
2023-10-24 22:58:45 +03:00
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2023-10-25 16:33:08 +03:00
|
|
|
|
{(tags.add || tags.edit) && (
|
2023-10-24 22:58:45 +03:00
|
|
|
|
<div className="formTag">
|
|
|
|
|
<img
|
|
|
|
|
src={arrow}
|
|
|
|
|
className="arrow"
|
|
|
|
|
alt="arrow"
|
|
|
|
|
onClick={() => {
|
2023-10-24 22:49:12 +03:00
|
|
|
|
setTags((prevState) => ({
|
|
|
|
|
...prevState,
|
2023-10-24 22:58:45 +03:00
|
|
|
|
add: false,
|
2023-10-25 16:33:26 +03:00
|
|
|
|
edit: false,
|
2023-10-24 22:58:45 +03:00
|
|
|
|
}));
|
2023-10-25 16:33:08 +03:00
|
|
|
|
setTagInfo({
|
2023-10-25 16:33:26 +03:00
|
|
|
|
description: "",
|
|
|
|
|
name: "",
|
|
|
|
|
});
|
|
|
|
|
setColor("#aabbcc");
|
2023-10-24 22:58:45 +03:00
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<input
|
|
|
|
|
className="formTag__input"
|
|
|
|
|
placeholder="Описание метки"
|
|
|
|
|
maxLength="25"
|
|
|
|
|
value={tagInfo.description}
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
setTagInfo((prevState) => ({
|
|
|
|
|
...prevState,
|
|
|
|
|
description: e.target.value,
|
2023-10-24 22:49:12 +03:00
|
|
|
|
}))
|
2023-10-24 22:58:45 +03:00
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<input
|
|
|
|
|
className="formTag__input"
|
|
|
|
|
placeholder="Тег"
|
|
|
|
|
value={tagInfo.name}
|
|
|
|
|
maxLength="10"
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
setTagInfo((prevState) => ({
|
|
|
|
|
...prevState,
|
|
|
|
|
name: e.target.value,
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<HexColorPicker color={color} onChange={setColor} />
|
|
|
|
|
<button
|
2023-10-25 16:33:08 +03:00
|
|
|
|
onClick={() => {
|
2023-10-25 16:33:26 +03:00
|
|
|
|
tags.add ? addNewTag() : editTag();
|
|
|
|
|
}}
|
2023-10-24 22:58:45 +03:00
|
|
|
|
className={
|
|
|
|
|
tagInfo.name && tagInfo.description
|
|
|
|
|
? "formTag__btn"
|
|
|
|
|
: "formTag__btn disable"
|
|
|
|
|
}
|
|
|
|
|
>
|
2023-10-25 16:33:26 +03:00
|
|
|
|
{tags.add ? "Добавить" : "Изменить"}
|
2023-10-24 22:58:45 +03:00
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2023-10-24 22:49:12 +03:00
|
|
|
|
</div>
|
2023-10-24 22:58:45 +03:00
|
|
|
|
)}
|
2023-10-24 22:49:12 +03:00
|
|
|
|
</div>
|
2023-05-05 16:10:25 +03:00
|
|
|
|
<Link to="/profile/tracker" className="tasks__head__back">
|
|
|
|
|
<p>Вернуться на проекты</p>
|
|
|
|
|
<img src={arrow} alt="arrow" />
|
|
|
|
|
</Link>
|
2023-05-03 16:47:20 +03:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2023-06-22 14:53:35 +03:00
|
|
|
|
{Boolean(modalActiveTicket) && (
|
|
|
|
|
<ModalTicket
|
2023-05-16 00:24:52 +03:00
|
|
|
|
active={modalActiveTicket}
|
|
|
|
|
setActive={setModalActiveTicket}
|
|
|
|
|
task={selectedTicket}
|
|
|
|
|
projectId={projectBoard.id}
|
|
|
|
|
projectName={projectBoard.name}
|
2023-05-24 01:20:53 +03:00
|
|
|
|
projectUsers={projectBoard.projectUsers}
|
2023-08-31 01:58:35 +03:00
|
|
|
|
projectOwnerId={projectBoard.owner_id}
|
2023-10-25 16:33:08 +03:00
|
|
|
|
projectMarks={projectBoard.mark}
|
2023-06-22 14:53:35 +03:00
|
|
|
|
/>
|
|
|
|
|
)}
|
2023-05-03 16:47:20 +03:00
|
|
|
|
|
2023-05-05 16:10:25 +03:00
|
|
|
|
<div className="tasks__container">
|
2023-07-04 16:19:58 +03:00
|
|
|
|
{Boolean(projectBoard?.columns) &&
|
|
|
|
|
!filteredNoTasks &&
|
2023-05-05 16:10:25 +03:00
|
|
|
|
Boolean(projectBoard.columns.length) &&
|
|
|
|
|
projectBoard.columns.map((column) => {
|
|
|
|
|
return (
|
|
|
|
|
<div
|
2023-05-05 00:50:48 +03:00
|
|
|
|
key={column.id}
|
|
|
|
|
onDragOver={(e) => dragOverHandler(e)}
|
2023-06-22 14:53:35 +03:00
|
|
|
|
onDragEnter={() => dragEnterHandler(column.id)}
|
2023-05-05 00:50:48 +03:00
|
|
|
|
onDrop={(e) => dragDropHandler(e, column.id)}
|
|
|
|
|
className={`tasks__board ${
|
2023-05-05 16:10:25 +03:00
|
|
|
|
wrapperHover[column.id] ? "tasks__board__hover" : ""
|
2023-05-05 00:50:48 +03:00
|
|
|
|
}`}
|
2023-05-05 16:10:25 +03:00
|
|
|
|
>
|
|
|
|
|
<div className="board__head">
|
|
|
|
|
<span>{column.title}</span>
|
2023-07-07 17:38:31 +03:00
|
|
|
|
<div className="board__head__more">
|
2023-05-05 16:10:25 +03:00
|
|
|
|
<span
|
2023-05-05 00:50:48 +03:00
|
|
|
|
className="add"
|
2023-08-11 22:44:54 +03:00
|
|
|
|
onClick={() => {
|
|
|
|
|
selectedTabTask(
|
|
|
|
|
column.id,
|
|
|
|
|
projectBoard?.columns && column.tasks.length
|
2023-09-11 18:28:56 +03:00
|
|
|
|
? column.tasks[0].priority - 1
|
2023-12-05 14:15:04 +03:00
|
|
|
|
: 1
|
2023-08-11 22:44:54 +03:00
|
|
|
|
);
|
|
|
|
|
}}
|
2023-05-05 16:10:25 +03:00
|
|
|
|
>
|
|
|
|
|
+
|
|
|
|
|
</span>
|
|
|
|
|
<span
|
2023-05-05 00:50:48 +03:00
|
|
|
|
onClick={() => {
|
|
|
|
|
setOpenColumnSelect((prevState) => ({
|
|
|
|
|
...prevState,
|
|
|
|
|
[column.id]: true,
|
|
|
|
|
}));
|
|
|
|
|
}}
|
|
|
|
|
className="more"
|
2023-05-05 16:10:25 +03:00
|
|
|
|
>
|
|
|
|
|
...
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
2023-05-03 16:47:20 +03:00
|
|
|
|
</div>
|
2023-05-05 16:10:25 +03:00
|
|
|
|
{openColumnSelect[column.id] && (
|
2023-05-05 00:50:48 +03:00
|
|
|
|
<div className="column__select">
|
|
|
|
|
<div
|
2023-05-05 16:10:25 +03:00
|
|
|
|
className="column__select__item"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
setOpenColumnSelect((prevState) => ({
|
|
|
|
|
...prevState,
|
|
|
|
|
[column.id]: false,
|
|
|
|
|
}));
|
|
|
|
|
dispatch(modalToggle("editColumn"));
|
2023-06-22 14:53:35 +03:00
|
|
|
|
dispatch(setColumnName(column.title));
|
|
|
|
|
dispatch(setColumnId(column.id));
|
|
|
|
|
dispatch(setColumnPriority(column.priority));
|
2023-05-05 16:10:25 +03:00
|
|
|
|
setModalAdd(true);
|
|
|
|
|
}}
|
2023-05-05 00:50:48 +03:00
|
|
|
|
>
|
|
|
|
|
<img src={edit} alt="edit" />
|
|
|
|
|
<span>Изменить</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
2023-05-05 16:10:25 +03:00
|
|
|
|
className="column__select__item"
|
2023-11-03 16:23:21 +03:00
|
|
|
|
onClick={() => {
|
2023-11-03 16:23:49 +03:00
|
|
|
|
if (column.tasks.length) {
|
|
|
|
|
setAcceptModalOpen(true);
|
|
|
|
|
setCurrentColumnDelete(column);
|
|
|
|
|
} else {
|
|
|
|
|
deleteColumn(column);
|
2023-11-03 16:23:21 +03:00
|
|
|
|
}
|
2023-11-03 16:23:49 +03:00
|
|
|
|
}}
|
2023-05-05 00:50:48 +03:00
|
|
|
|
>
|
|
|
|
|
<img src={del} alt="delete" />
|
|
|
|
|
<span>Удалить</span>
|
|
|
|
|
</div>
|
2023-05-04 18:38:56 +03:00
|
|
|
|
</div>
|
2023-05-05 16:10:25 +03:00
|
|
|
|
)}
|
2023-08-30 17:02:50 +03:00
|
|
|
|
<div className="tasksContainer">
|
2023-08-30 17:02:32 +03:00
|
|
|
|
{column.tasks.map((task) => {
|
|
|
|
|
return (
|
2023-08-07 15:53:18 +03:00
|
|
|
|
<div
|
2023-08-30 17:02:32 +03:00
|
|
|
|
key={task.id}
|
|
|
|
|
className={`tasks__board__item ${
|
|
|
|
|
taskHover[task.id] ? "task__hover" : ""
|
|
|
|
|
}`}
|
|
|
|
|
draggable={true}
|
|
|
|
|
onDragStart={(e) =>
|
|
|
|
|
dragStartHandler(e, task, column.id)
|
|
|
|
|
}
|
|
|
|
|
onDragOver={(e) => dragOverTaskHandler(e, task)}
|
|
|
|
|
onDragLeave={(e) => dragLeaveTaskHandler(e)}
|
|
|
|
|
onDragEnd={() => dragEndTaskHandler()}
|
|
|
|
|
onDrop={(e) =>
|
|
|
|
|
dragDropTaskHandler(e, task, column)
|
|
|
|
|
}
|
|
|
|
|
onClick={(e) => openTicket(e, task)}
|
2023-08-07 15:53:18 +03:00
|
|
|
|
>
|
2023-08-30 17:02:32 +03:00
|
|
|
|
<div
|
|
|
|
|
className="tasks__board__item__title"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
if (window.innerWidth < 985) {
|
|
|
|
|
window.location.replace(
|
2023-12-05 14:15:04 +03:00
|
|
|
|
`/tracker/task/${task.id}`
|
2023-08-30 17:02:32 +03:00
|
|
|
|
);
|
2023-06-27 17:14:22 +03:00
|
|
|
|
}
|
2023-08-30 17:02:32 +03:00
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<p className="task__board__item__title">
|
|
|
|
|
{task.title}
|
|
|
|
|
</p>
|
2023-05-05 00:50:48 +03:00
|
|
|
|
</div>
|
2023-08-30 17:02:32 +03:00
|
|
|
|
<p
|
|
|
|
|
dangerouslySetInnerHTML={{
|
|
|
|
|
__html: task.description,
|
|
|
|
|
}}
|
|
|
|
|
className="tasks__board__item__description"
|
|
|
|
|
></p>
|
|
|
|
|
<div className="tasks__board__item__executor">
|
2023-06-29 19:19:13 +03:00
|
|
|
|
<span>
|
2023-08-30 17:02:32 +03:00
|
|
|
|
{task.executor?.fio
|
|
|
|
|
? task.executor?.fio
|
|
|
|
|
: "Исполнитель не назначен"}
|
2023-06-29 19:19:13 +03:00
|
|
|
|
</span>
|
2023-08-30 17:02:32 +03:00
|
|
|
|
{task.executor?.avatar && (
|
|
|
|
|
<img
|
|
|
|
|
src={
|
|
|
|
|
task.executor?.avatar
|
|
|
|
|
? urlForLocal(task.executor?.avatar)
|
|
|
|
|
: avatarMok
|
|
|
|
|
}
|
|
|
|
|
alt="avatar"
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
2023-10-25 16:33:26 +03:00
|
|
|
|
{Boolean(task.mark.length) && (
|
|
|
|
|
<div className="tasks__board__item__tags">
|
2023-10-25 16:33:08 +03:00
|
|
|
|
{task.mark.map((tag) => {
|
2023-10-25 16:33:26 +03:00
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
className="tagItem"
|
|
|
|
|
key={tag.id}
|
|
|
|
|
style={{ background: tag.color }}
|
|
|
|
|
>
|
|
|
|
|
<p>{tag.slug}</p>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
})}
|
2023-10-25 16:33:08 +03:00
|
|
|
|
</div>
|
2023-10-25 16:33:26 +03:00
|
|
|
|
)}
|
2023-11-21 16:41:18 +03:00
|
|
|
|
{typeof task.execution_priority ===
|
|
|
|
|
"number" && (
|
|
|
|
|
<div className="tasks__board__item__priority">
|
|
|
|
|
<p>Приоритет:</p>
|
|
|
|
|
<span
|
|
|
|
|
className={
|
|
|
|
|
priorityClass[task.execution_priority]
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
{priority[task.execution_priority]}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2023-08-30 17:02:50 +03:00
|
|
|
|
{task.dead_line && (
|
|
|
|
|
<div className="tasks__board__item__deadLine">
|
|
|
|
|
<p>Срок исполнения:</p>
|
|
|
|
|
<span>
|
|
|
|
|
{getCorrectDate(task.dead_line)}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2023-08-30 17:02:32 +03:00
|
|
|
|
<div className="tasks__board__item__info">
|
|
|
|
|
<div className="tasks__board__item__info__more">
|
2023-08-30 17:02:50 +03:00
|
|
|
|
<img
|
|
|
|
|
src={commentsBoard}
|
|
|
|
|
alt="commentsImg"
|
|
|
|
|
/>
|
2023-08-30 17:02:32 +03:00
|
|
|
|
<span>
|
|
|
|
|
{task.comment_count}{" "}
|
2023-08-30 17:02:50 +03:00
|
|
|
|
{caseOfNum(
|
|
|
|
|
task.comment_count,
|
2023-12-05 14:15:04 +03:00
|
|
|
|
"comments"
|
2023-08-30 17:02:50 +03:00
|
|
|
|
)}
|
2023-08-30 17:02:32 +03:00
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="tasks__board__item__info__more">
|
|
|
|
|
<img src={filesBoard} alt="filesImg" />
|
|
|
|
|
<span>
|
|
|
|
|
{task.files ? task.files : 0}{" "}
|
|
|
|
|
{caseOfNum(0, "files")}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
2023-05-05 00:50:48 +03:00
|
|
|
|
</div>
|
2023-08-30 17:02:32 +03:00
|
|
|
|
<TrackerSelectColumn
|
|
|
|
|
columns={projectBoard.columns.filter(
|
2023-12-05 14:15:04 +03:00
|
|
|
|
(item) => item.id !== column.id
|
2023-08-30 17:02:32 +03:00
|
|
|
|
)}
|
|
|
|
|
currentColumn={column}
|
|
|
|
|
task={task}
|
|
|
|
|
/>
|
2023-05-03 16:47:20 +03:00
|
|
|
|
</div>
|
2023-08-30 17:02:32 +03:00
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</div>
|
2023-05-05 16:10:25 +03:00
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
{Boolean(projectBoard?.columns) &&
|
|
|
|
|
!Boolean(projectBoard.columns.length) && (
|
|
|
|
|
<div className="tasks__board__noItems">
|
|
|
|
|
В проекте нет задач.
|
2023-05-03 16:47:20 +03:00
|
|
|
|
</div>
|
2023-05-05 16:10:25 +03:00
|
|
|
|
)}
|
2023-07-04 16:19:58 +03:00
|
|
|
|
{filteredNoTasks && (
|
|
|
|
|
<div className="tasks__board__noTasks">
|
|
|
|
|
<div className="tasks__board__noTasksInfo">
|
|
|
|
|
<img src={trackerNoTasks} alt="noTasks" />
|
2023-07-04 16:19:46 +03:00
|
|
|
|
<p>Пока нет подходящих задач</p>
|
|
|
|
|
</div>
|
2023-07-04 16:19:58 +03:00
|
|
|
|
<p className="tasks__board__noTasksMore">
|
|
|
|
|
Ставьте задачи, следите за прогрессом, ведите учёт
|
|
|
|
|
рабочего времени
|
|
|
|
|
</p>
|
2023-07-04 16:19:46 +03:00
|
|
|
|
</div>
|
2023-07-04 16:19:58 +03:00
|
|
|
|
)}
|
2023-05-05 00:50:48 +03:00
|
|
|
|
</div>
|
2023-05-03 16:47:20 +03:00
|
|
|
|
</div>
|
2023-05-05 16:10:25 +03:00
|
|
|
|
)}
|
2023-05-03 16:47:20 +03:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-11-03 16:23:21 +03:00
|
|
|
|
{acceptModalOpen && (
|
2023-11-03 16:23:49 +03:00
|
|
|
|
<AcceptModal
|
2023-12-04 18:00:12 +03:00
|
|
|
|
title={"В колонке ещё есть задачи, Вы точно хотите удалить её ?"}
|
2023-11-03 16:23:49 +03:00
|
|
|
|
closeModal={closeAcceptModal}
|
|
|
|
|
agreeHandler={() => deleteColumn(currentColumnDelete)}
|
|
|
|
|
/>
|
2023-11-03 16:23:21 +03:00
|
|
|
|
)}
|
2023-05-03 16:47:20 +03:00
|
|
|
|
<Footer />
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|