-
-
-
Проект : {projectBoard.name}
+ {loader &&
}
+ {!loader && (
+
+
+
+
Проект : {projectBoard.name}
-
+ >
-
-
+ {
dispatch(modalToggle("createColumn"));
setModalAdd(true);
}}
- >
- +
-
- добавить колонку
-
-
-
-
-
+9
-
+ +
+
+
добавить колонку
+
+
+
+
+
+9
+
{
dispatch(modalToggle("addWorker"));
setModalAdd(true);
}}
- >
- +
-
-
добавить участника
+ >
+ +
+
+
добавить участника
+
+
+
Участвую
+
+
+
+
Мои
+
+
+
+
Вернуться на проекты
+
+
-
-
Участвую
-
-
-
-
Мои
-
-
-
-
Вернуться на проекты
-
-
-
-
+ />
-
- {Boolean(projectBoard?.columns) &&
- Boolean(projectBoard.columns.length) &&
- projectBoard.columns.map((column) => {
- return (
-
+ {Boolean(projectBoard?.columns) &&
+ Boolean(projectBoard.columns.length) &&
+ projectBoard.columns.map((column) => {
+ return (
+
dragOverHandler(e)}
onDragEnter={(e) => dragEnterHandler(column.id)}
onDrop={(e) => dragDropHandler(e, column.id)}
className={`tasks__board ${
- column.tasks.length >= 3 ? "tasks__board__more" : ""
+ column.tasks.length >= 3 ? "tasks__board__more" : ""
} ${
- wrapperHover[column.id] ? "tasks__board__hover" : ""
+ wrapperHover[column.id] ? "tasks__board__hover" : ""
}`}
- >
-
- {/*
*/}
- {column.title}
-
-
+
+ {/*
*/}
+ {column.title}
+
+ selectedTabTask(column.id)}
- >
- +
-
-
+ +
+
+ {
setOpenColumnSelect((prevState) => ({
...prevState,
@@ -289,52 +287,52 @@ export const ProjectTracker = () => {
}));
}}
className="more"
- >
- ...
-
+ >
+ ...
+
+
-
- {openColumnSelect[column.id] && (
+ {openColumnSelect[column.id] && (
{
- setOpenColumnSelect((prevState) => ({
- ...prevState,
- [column.id]: false,
- }));
- dispatch(modalToggle("editColumn"));
- setModalAdd(true);
- }}
+ className="column__select__item"
+ onClick={() => {
+ setOpenColumnSelect((prevState) => ({
+ ...prevState,
+ [column.id]: false,
+ }));
+ dispatch(modalToggle("editColumn"));
+ setModalAdd(true);
+ }}
>
Изменить
deleteColumn(column.id)}
+ className="column__select__item"
+ onClick={() => deleteColumn(column.id)}
>
Удалить
- )}
- {column.tasks.map((task, index) => {
- if (index > 2) {
- if (!column.open) {
- return;
+ )}
+ {column.tasks.map((task, index) => {
+ if (index > 2) {
+ if (!column.open) {
+ return;
+ }
}
- }
- return (
+ return (
- dragStartHandler(e, task, column.id)
- }
- onDragEnd={(e) => dragEndHandler(e)}
- onClick={(e) => openTicket(e, task)}
+ key={task.id}
+ className="tasks__board__item"
+ draggable={true}
+ onDragStart={(e) =>
+ dragStartHandler(e, task, column.id)
+ }
+ onDragEnd={(e) => dragEndHandler(e)}
+ onClick={(e) => openTicket(e, task)}
>
{task.title}
@@ -357,32 +355,32 @@ export const ProjectTracker = () => {
{/*
*/}
- );
- })}
- {column.tasks.length > 3 && (
+ );
+ })}
+ {column.tasks.length > 3 && (
toggleMoreTasks(column.id)}
+ className={
+ column.open
+ ? "lessItems openItems"
+ : "moreItems openItems"
+ }
+ // onClick={() => toggleMoreTasks(column.id)}
>
- {column.open ? "-" : "+"}
-
- )}
+ {column.open ? "-" : "+"}
+
+ )}
+
+ );
+ })}
+ {Boolean(projectBoard?.columns) &&
+ !Boolean(projectBoard.columns.length) && (
+
+ В проекте нет задач.
- );
- })}
- {Boolean(projectBoard?.columns) &&
- !Boolean(projectBoard.columns.length) &&
-
- В проекте нет задач.
+ )}
- }
-
- }
+ )}
diff --git a/src/pages/Tracker/Tracker.js b/src/pages/Tracker/Tracker.js
index 0654e51c..532f0980 100644
--- a/src/pages/Tracker/Tracker.js
+++ b/src/pages/Tracker/Tracker.js
@@ -1,18 +1,24 @@
-import React, {useEffect, useState} from "react";
+import React, { useEffect, useState } from "react";
import { ProfileHeader } from "../../components/ProfileHeader/ProfileHeader";
import { ProfileBreadcrumbs } from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs";
import { Footer } from "../../components/Footer/Footer";
-import {apiRequest} from "../../api/request";
+import { apiRequest } from "../../api/request";
import { Navigation } from "../../components/Navigation/Navigation";
import { useDispatch, useSelector } from "react-redux";
-import { setAllProjects, getProjects, setToggleTab, getToggleTab } from "../../redux/projectsTrackerSlice";
+import {
+ setAllProjects,
+ getProjects,
+ setToggleTab,
+ getToggleTab,
+ modalToggle,
+} from "../../redux/projectsTrackerSlice";
-import ModalCreate from "../../components/UI/ModalCreate/ModalCreate";
+import TrackerModal from "../../components/UI/TrackerModal/TrackerModal";
import ProjectTiket from "../../components/ProjectTiket/ProjectTiket";
-import { urlForLocal } from '../../helper'
-import { getCorrectDate} from "../../components/Calendar/calendarHelper";
+import { urlForLocal } from "../../helper";
+import { getCorrectDate } from "../../components/Calendar/calendarHelper";
import { Loader } from "../../components/Loader/Loader";
import project from "../../images/trackerProject.svg";
@@ -27,10 +33,11 @@ import "./tracker.scss";
export const Tracker = () => {
const dispatch = useDispatch();
const projects = useSelector(getProjects);
- const tab = useSelector(getToggleTab)
- const [allTasks, setAllTasks] = useState([])
+ const tab = useSelector(getToggleTab);
+
+ const [allTasks, setAllTasks] = useState([]);
const [filteredAllTasks, setFilteredAllTasks] = useState([]);
- const [loader, setLoader] = useState(false)
+ const [loader, setLoader] = useState(false);
const [archiveProjects] = useState([
{
@@ -40,7 +47,7 @@ export const Tracker = () => {
{
name: "Будущее России",
date: "7 марта 2023 г",
- }
+ },
]);
const [completeTasks] = useState([
@@ -64,7 +71,7 @@ export const Tracker = () => {
dateComplete: "7 марта 2023 г",
avatarDo: avatarTest,
project: "Будущее России",
- }
+ },
]);
const [filterCompleteTasks, setFilterCompleteTasks] = useState(completeTasks);
@@ -73,36 +80,42 @@ export const Tracker = () => {
const [modalCreateProject, setModalCreateProject] = useState(false);
useEffect(() => {
- setLoader(true)
- apiRequest(`/project/project-list?user_id=${localStorage.getItem('id')}&expand=columns`).then((el) => {
- dispatch(setAllProjects(el.projects))
- setLoader(false)
- })
- apiRequest(`/task/get-user-tasks?user_id=${localStorage.getItem('id')}`).then((el) => {
- setAllTasks(el)
- setFilteredAllTasks(el)
- })
- }, [])
+ setLoader(true);
+ apiRequest(
+ `/project/project-list?user_id=${localStorage.getItem(
+ "id"
+ )}&expand=columns`
+ ).then((el) => {
+ dispatch(setAllProjects(el.projects));
+ setLoader(false);
+ });
+ apiRequest(
+ `/task/get-user-tasks?user_id=${localStorage.getItem("id")}`
+ ).then((el) => {
+ setAllTasks(el);
+ setFilteredAllTasks(el);
+ });
+ }, []);
const toggleTabs = (index) => {
- dispatch(setToggleTab(index))
+ dispatch(setToggleTab(index));
};
function filterAllTask(e) {
setFilteredAllTasks(
- allTasks.filter((item) => {
- if (!e.target.value) {
- return item;
- }
- if (
- item.title.toLowerCase().startsWith(e.target.value.toLowerCase()) ||
- item.description
- .toLowerCase()
- .startsWith(e.target.value.toLowerCase())
- ) {
- return item;
- }
- })
+ allTasks.filter((item) => {
+ if (!e.target.value) {
+ return item;
+ }
+ if (
+ item.title.toLowerCase().startsWith(e.target.value.toLowerCase()) ||
+ item.description
+ .toLowerCase()
+ .startsWith(e.target.value.toLowerCase())
+ ) {
+ return item;
+ }
+ })
);
}
@@ -171,52 +184,58 @@ export const Tracker = () => {
: "tracker__tabs__content__projects tracker__tabs__content__wrapper"
}
>
-
+ titleProject={"Укажите название проекта:"}
+ >
- {loader &&
-
- }
+ {loader &&
}
- {Boolean(projects.length) && !loader &&
+ {Boolean(projects.length) &&
+ !loader &&
projects.map((project, index) => {
- return (
- project.status !== 10 ?
-
- : ''
+ return project.status !== 10 ? (
+
+ ) : (
+ ""
);
})}
- {(!Boolean(projects.length) || !Boolean(projects.filter((project) => project.status !== 10).length)) && !loader && (
-
-
-
-
-
Создайте свой первый проект
+ {(!Boolean(projects.length) ||
+ !Boolean(
+ projects.filter((project) => project.status !== 10).length
+ )) &&
+ !loader && (
+
+
+
+
+
Создайте свой первый проект
+
+
-
+
+ Ставьте задачи, следите за прогрессом, ведите учёт рабочего
+ времени
+
-
- Ставьте задачи, следите за прогрессом, ведите учёт рабочего
- времени
-
-
- )}
+ )}
{Boolean(projects.length) && !loader && (
@@ -245,30 +264,32 @@ export const Tracker = () => {
/>
- {loader &&
-
- }
- {!loader &&
+ {loader &&
}
+ {!loader && (
- {Boolean(filteredAllTasks.length) && filteredAllTasks.map((task) => {
- return (
-
-
-
{task.title}
-
{task.description}
-
-
-
-
-
{task.user.fio}
-
{getCorrectDate(task.created_at)}
+ {Boolean(filteredAllTasks.length) &&
+ filteredAllTasks.map((task) => {
+ return (
+
+
+
{task.title}
+
{task.description}
+
+
+
+
+
{task.user.fio}
+
{getCorrectDate(task.created_at)}
+
-
- );
- })}
+ );
+ })}
- }
+ )}