guild_front/src/pages/ProjectTracker/ProjectTracker.js

695 lines
26 KiB
JavaScript
Raw Normal View History

2023-05-03 16:47:20 +03:00
import React, { useEffect, useRef, useState } from "react";
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,
deletePersonOnProject,
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-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";
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";
import archive from "assets/icons/archiveTracker.svg";
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";
import project from "assets/icons/trackerProject.svg";
import tasks from "assets/icons/trackerTasks.svg";
import accept from "assets/images/accept.png";
import avatarMok from "assets/images/avatarMok.png";
2023-07-04 16:19:46 +03:00
import trackerNoTasks from "assets/icons/trackerNoTasks.svg"
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);
const [checkBoxParticipateTasks, setCheckBoxParticipateTasks] =
useState(false);
2023-07-04 16:19:46 +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-05-03 16:47:20 +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-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:46 +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:46 +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:46 +03:00
if (columnsTasksEmpty && (checkBoxMyTasks || selectedExecutor || checkBoxParticipateTasks)) {
setFilteredNoTasks(true)
} else {
setFilteredNoTasks(false)
}
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-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-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) {
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-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-07-04 16:19:46 +03:00
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"
className="tab active-tab tab"
onClick={() => dispatch(setToggleTab(1))}
>
<img src={project} alt="img" />
<p>Проекты </p>
</Link>
<Link
to="/profile/tracker"
className="tab"
onClick={() => dispatch(setToggleTab(2))}
>
<img src={tasks} alt="img" />
<p>Все мои задачи</p>
</Link>
<Link
to="/profile/tracker"
className="tab"
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-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>
<div className="tasks__head__persons">
2023-06-29 02:27:08 +03:00
{projectBoard.projectUsers?.length > 3 && (
<span className="countPersons">+1...</span>
)}
<div className="projectPersons">
{projectBoard.projectUsers?.length &&
2023-06-29 03:41:59 +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"
/>
);
})}
</div>
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>
участник
</div>
<div className="persons__list__info">
2023-07-04 16:19:46 +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-03 22:07:44 +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-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-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:46 +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>
<div>
<span
2023-05-05 00:50:48 +03:00
className="add"
2023-06-22 14:53:35 +03:00
onClick={() =>
2023-06-29 02:27:08 +03:00
selectedTabTask(
column.id,
projectBoard?.columns
? projectBoard?.columns[0].tasks.at(-1)
.priority + 1
: 1
)
2023-06-22 14:53:35 +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-06-09 03:19:09 +03:00
onClick={() => deleteColumn(column)}
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-06-15 21:46:52 +03:00
{column.tasks.map((task) => {
2023-05-05 16:10:25 +03:00
return (
2023-05-05 00:50:48 +03:00
<div
2023-05-05 16:10:25 +03:00
key={task.id}
2023-06-15 21:46:52 +03:00
className={`tasks__board__item ${
2023-06-22 14:53:35 +03:00
taskHover[task.id] ? "task__hover" : ""
2023-06-15 21:46:52 +03:00
}`}
2023-05-05 16:10:25 +03:00
draggable={true}
2023-06-22 14:53:35 +03:00
onDragStart={(e) =>
dragStartHandler(e, task, column.id)
}
2023-06-15 21:46:52 +03:00
onDragOver={(e) => dragOverTaskHandler(e, task)}
onDragLeave={(e) => dragLeaveTaskHandler(e)}
2023-06-22 14:53:35 +03:00
onDragEnd={() => dragEndTaskHandler()}
onDrop={(e) =>
dragDropTaskHandler(e, task, column)
}
2023-05-05 16:10:25 +03:00
onClick={(e) => openTicket(e, task)}
2023-05-05 00:50:48 +03:00
>
<div className="tasks__board__item__title">
2023-06-22 14:53:35 +03:00
<p className="task__board__item__title">
{task.title}
</p>
2023-05-03 16:47:20 +03:00
</div>
2023-06-26 13:24:20 +03:00
<p
dangerouslySetInnerHTML={{
__html: task.description,
}}
className="tasks__board__item__description"
></p>
<div className="tasks__board__item__executor">
<span>
{task.executor?.fio
? task.executor?.fio
: "Исполнитель не назначен"}
</span>
{task.executor?.avatar && (
<img
src={
task.executor?.avatar
? urlForLocal(task.executor?.avatar)
: avatarMok
}
alt="avatar"
/>
)}
</div>
2023-05-05 00:50:48 +03:00
<div className="tasks__board__item__info">
<div className="tasks__board__item__info__more">
<img src={commentsBoard} alt="commentsImg" />
2023-06-29 19:19:13 +03:00
<span>
{task.comment_count}{" "}
{caseOfNum(task.comment_count, "comments")}
</span>
2023-05-05 00:50:48 +03:00
</div>
<div className="tasks__board__item__info__more">
<img src={filesBoard} alt="filesImg" />
2023-06-29 19:19:13 +03:00
<span>
{task.files ? task.files : 0}{" "}
{caseOfNum(0, "files")}
</span>
2023-05-05 00:50:48 +03:00
</div>
2023-05-03 16:47:20 +03:00
</div>
</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:46 +03:00
{filteredNoTasks &&
<div className='tasks__board__noTasks'>
<div className='tasks__board__noTasksInfo'>
<img src={trackerNoTasks} alt='noTasks' />
<p>Пока нет подходящих задач</p>
</div>
<p className='tasks__board__noTasksMore'>Ставьте задачи, следите за прогрессом, ведите учёт рабочего времени</p>
</div>
}
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>
<Footer />
</div>
);
};