+
+
Задача
+ {editOpen ? (
+
{
+ setInputsValue((prevValue) => ({
+ ...prevValue,
+ title: e.target.value,
+ }));
+ }}
+ />
+ ) : (
+
{inputsValue.title}
+ )}
+
+ {editOpen ? (
+
{
+ setInputsValue((prevValue) => ({
+ ...prevValue,
+ description: e.target.value,
+ }));
+ }}
+ />
+ ) : (
+
{inputsValue.description}
+ )}
+
+
+
+ {
+ dispatch(modalToggle("addSubtask"));
+ setModalAddWorker(true);
+ }}
+ styles={"button-green-add"}
+ >
+
+ Добавить под задачу
+
+
+
+
+ {0}
+ Файлов
+
+
+
+
{
+ setInputsValue((prevValue) => ({
+ ...prevValue,
+ comment: e.target.value,
+ }));
+ }}
+ />
+
+
+
+ {comments.map((comment) => {
+ return (
+
+ );
+ })}
-
-
-
-
Задача
- {editOpen ?
{
- setInputsValue((prevValue) => ({...prevValue, title: e.target.value}))
- }} /> :
{inputsValue.title}
}
-
- {editOpen ?
{
- setInputsValue((prevValue) => ({...prevValue, description: e.target.value}))
- }}/> :
{inputsValue.description}
}
- {/*
*/}
-
-
-
-
-
-
-
- {0}
- Файлов
-
-
-
-
{
- setInputsValue((prevValue) => ({...prevValue, comment: e.target.value}))
- }} />
-
-
-
- {comments.map((comment) => {
- return
- })
-
- }
-
-
+
+
+
+
+ Создатель : {taskInfo.user?.fio}
+
+
+ {Boolean(taskInfo.taskUsers?.length) &&
+ taskInfo.taskUsers.map((worker, index) => {
+ return (
+
+
+
{worker.name}
+
+ );
+ })}
-
-
-
- Создатель : {taskInfo.user?.fio}
-
-
- {Boolean(taskInfo.taskUsers?.length) &&
- taskInfo.taskUsers.map((worker, index) => {
- return (
-
-
-
{worker.name}
-
- );
- })}
-
-
-
- Добавить исполнителя
-
-
-
- Добавить участников
-
-
+
+
+ Добавить исполнителя
+
+
+
+ Добавить участников
+
+
-
-
-
-
Длительность :
-
{"0:00:00"}
-
+
+
+
+
Длительность :
+
{"0:00:00"}
+
- {timerStart ?
-
- :
-
+ {timerStart ? (
+
+ ) : (
+
+ )}
+
-
-
{
- if(editOpen) {
- setEditOpen(!editOpen)
- editTask()
- } else {
- setEditOpen(!editOpen)
- }
- }}>
-
-
{editOpen ? 'сохранить' : 'редактировать'}
-
-
-
-
ссылка на проект
-
-
-
-
в архив
-
-
-
-
удалить
-
-
+
+
{
+ if (editOpen) {
+ setEditOpen(!editOpen);
+ editTask();
+ } else {
+ setEditOpen(!editOpen);
+ }
+ }}
+ >
+
+
{editOpen ? "сохранить" : "редактировать"}
+
+
+
+
ссылка на проект
+
+
+
+
в архив
+
+
+
+
удалить
- >
- }
-
-
-
+
+
+ >
+ )}
+
+
+
);
};
diff --git a/src/components/UI/ModalTicket/ModalTicket.jsx b/src/components/UI/ModalTicket/ModalTicket.jsx
deleted file mode 100644
index ba3b2025..00000000
--- a/src/components/UI/ModalTicket/ModalTicket.jsx
+++ /dev/null
@@ -1,484 +0,0 @@
-import React, {useEffect, useState} from "react";
-import { Link } from "react-router-dom";
-import TrackerModal from "../../../components/Modal/TrackerModal/TrackerModal";
-import TrackerTaskComment from "../../../components/TrackerTaskComment/TrackerTaskComment";
-import { apiRequest } from "../../../api/request";
-import { useDispatch } from "react-redux";
-import "./modalTicket.scss"
-import {
- modalToggle,
- setProjectBoardFetch,
-} from "../../../redux/projectsTrackerSlice";
-
-import category from "../../../assets/icons/category.svg";
-import watch from "../../../assets/icons/watch.svg";
-import file from "../../../assets/icons/fileModal.svg";
-import arrow from "../../../assets/icons/arrows/arrowStart.png";
-import link from "../../../assets/icons/link.svg";
-import archive from "../../../assets/icons/archive.svg";
-import del from "../../../assets/icons/delete.svg";
-import edit from "../../../assets/icons/edit.svg";
-import send from "../../../assets/icons/send.svg";
-import plus from "../../../assets/icons/plus.svg";
-import fullScreen from "../../../assets/icons/arrows/inFullScreen.svg";
-import close from "../../../assets/icons/closeProjectPersons.svg";
-
-import {urlForLocal, getCorrectRequestDate} from "../../../utils/helper";
-
-export const ModalTiсket = ({
- active,
- setActive,
- task,
- projectId,
- projectName,
- projectUsers
-}) => {
- const dispatch = useDispatch();
- const [addSubtask, setAddSubtask] = useState(false);
- const [editOpen, setEditOpen] = useState(false);
- const [inputsValue, setInputsValue] = useState({title: task.title, description: task.description, comment: ''});
- const [comments, setComments] = useState([]);
- const [dropListOpen, setDropListOpen] = useState(false)
- const [dropListMembersOpen, setDropListMembersOpen] = useState(false)
- const [executor, setExecutor] = useState(task.executor)
- const [members, setMembers] = useState(task.taskUsers)
- const [users, setUsers] = useState([])
- const [timerStart, setTimerStart] = useState(false)
- const [timerInfo, setTimerInfo] = useState({})
- const [currentTimerCount, setCurrentTimerCount] = useState({
- hours: 0,
- minute: 0,
- seconds: 0
- })
- const [timerId, setTimerId] = useState(null)
-
- function deleteTask() {
- apiRequest("/task/update-task", {
- method: "PUT",
- data: {
- task_id: task.id,
- status: 0,
- },
- }).then((res) => {
- setActive(false);
- dispatch(setProjectBoardFetch(projectId));
- });
- }
-
- function editTask() {
- apiRequest("/task/update-task", {
- method: "PUT",
- data: {
- task_id: task.id,
- title: inputsValue.title,
- description: inputsValue.description
- },
- }).then((res) => {
- dispatch(setProjectBoardFetch(projectId));
- });
- }
-
- function createComment() {
- apiRequest("/comment/create", {
- method: "POST",
- data: {
- text: inputsValue.comment,
- entity_type: 2,
- entity_id: task.id
- }
- }).then((res) => {
- let newComment = res
- newComment.created_at = new Date()
- newComment.subComments = []
- setInputsValue((prevValue) => ({...prevValue, comment: ''}))
- setComments((prevValue) => ([...prevValue, newComment]))
- })
- }
-
- function commentDelete(comment) {
- setComments((prevValue) => prevValue.filter((item) => item.id !== comment.id))
- if (comment.subComments.length) {
- // promiseAll
- comment.subComments.forEach((subComment) => {
- apiRequest("/comment/update", {
- method: "PUT",
- data: {
- comment_id: subComment.id,
- status: 0
- }
- }).then(() => {
- })
- })
- }
- }
-
- function addSubComment(commentId, subComment) {
- const addSubComment = comments
- addSubComment.forEach((comment) => {
- if (comment.id === commentId) {
- comment.subComments.push(subComment)
- }
- })
- setComments(addSubComment)
- }
-
- function subCommentDelete(subComment) {
- const deleteSubComment = comments
- deleteSubComment.forEach((comment, index) => {
- if (comment.id === subComment.parent_id) {
- deleteSubComment[index].subComments = comment.subComments.filter((item) => item.id !== subComment.id)
- }
- })
- setComments([...deleteSubComment])
- }
-
- function startTaskTimer() {
- apiRequest("/timer/create", {
- method: "POST",
- data: {
- entity_type: 2,
- entity_id: task.id,
- created_at: getCorrectRequestDate(new Date())
- }
- }).then((res) => {
- setTimerStart(true)
- setTimerInfo(res)
- startTimer()
- })
- }
-
- function stopTaskTimer() {
- apiRequest("/timer/update", {
- method: "PUT",
- data: {
- timer_id: timerInfo.id,
- stopped_at: getCorrectRequestDate(new Date())
- }
- }).then(() => {
- setTimerStart(false)
- clearInterval(timerId)
- })
- }
-
- function taskExecutor(person) {
- apiRequest("/task/update-task", {
- method: "PUT",
- data: {
- task_id: task.id,
- executor_id: person.user_id
- },
- }).then((res) => {
- setDropListOpen(false)
- setExecutor(res.executor)
- });
- }
-
- function deleteTaskExecutor() {
- apiRequest("/task/update-task", {
- method: "PUT",
- data: {
- task_id: task.id,
- executor_id: 0
- },
- }).then(() => {
- setExecutor(null)
- });
- }
-
- function addMember(person) {
- apiRequest("/task/add-user-to-task", {
- method: "POST",
- data: {
- task_id: task.id,
- user_id: person.user_id
- },
- }).then((res) => {
- setDropListMembersOpen(false)
- setMembers((prevValue) => ([...prevValue, res]))
- });
- }
-
- function deleteMember(person) {
- apiRequest("/task/del-user", {
- method: "DELETE",
- data: {
- task_id: task.id,
- user_id: person.user_id
- },
- }).then(() => {
- setMembers(members.filter((item) => item.user_id !== person.user_id))
- });
- }
-
- useEffect(() => {
- apiRequest(`/comment/get-by-entity?entity_type=2&entity_id=${task.id}`).then((res) => {
- const comments = res.reduce((acc, cur) => {
- if (!cur.parent_id) {
- acc.push({...cur, subComments: []})
- } else {
- acc.forEach((item) => {
- if (item.id === cur.parent_id) item.subComments.push(cur)
- })
- }
- return acc
- }, [])
- setComments(comments)
- })
- apiRequest(`/timer/get-by-entity?entity_type=2&entity_id=${task.id}`).then((res) => {
- let timerSeconds = 0
- res.length && res.forEach((time) => {
- timerSeconds += time.deltaSeconds
- setCurrentTimerCount({
- hours: Math.floor(timerSeconds / 60 / 60),
- minute: Math.floor(timerSeconds / 60 % 60),
- seconds: timerSeconds % 60}
- )
- updateTimerHours = Math.floor(timerSeconds / 60 / 60)
- updateTimerMinute = Math.floor(timerSeconds / 60 % 60)
- updateTimerSec = timerSeconds % 60
- if (!time.stopped_at) {
- setTimerStart(true)
- startTimer()
- setTimerInfo(time)
- }
- })
- })
- }, [])
-
- function startTimer () {
- setTimerId(setInterval(() => {
- run()
- }, 1000))
- }
-
- let updateTimerSec = currentTimerCount.seconds, updateTimerMinute = currentTimerCount.minute, updateTimerHours = currentTimerCount.hours
-
- function run () {
- updateTimerSec++
- if (updateTimerSec > 60) {
- updateTimerMinute++
- updateTimerSec = 0
- }
- if (updateTimerMinute === 60) {
- updateTimerMinute = 0
- updateTimerHours++
- }
-
- return setCurrentTimerCount({
- hours: updateTimerHours,
- minute: updateTimerMinute,
- seconds: updateTimerSec
- })
- }
-
- function correctTimerTime (time) {
- if (time < 10) return `0${time}`
- if (time > 10) return time
- }
-
-
- useEffect(() => {
- let ids = members.map((user) => user.user_id)
- setUsers(projectUsers.reduce((acc, cur) => {
- if (!ids.includes(cur.user_id)) acc.push(cur)
- return acc
- }, []))
- }, [members])
-
-
- return (
-
setActive(false)}
- >
-
e.stopPropagation()}
- >
-
-
-
- Проект: {projectName}
-
-
-
-
-
-
-
Задача
- {editOpen ?
{
- setInputsValue((prevValue) => ({...prevValue, title: e.target.value}))
- }} /> :
{inputsValue.title}
}
-
- {editOpen ?
{
- setInputsValue((prevValue) => ({...prevValue, description: e.target.value}))
- }}/> :
{inputsValue.description}
}
- {/*
*/}
-
-
-
-
-
-
-
- {0}
- Файлов
-
-
-
-
{
- setInputsValue((prevValue) => ({...prevValue, comment: e.target.value}))
- }} />
-
-
-
- {comments.map((comment) => {
- return
- })
- }
-
-
-
-
-
-
setActive(false)}>
-
{task.title}
-
Создатель : {task.user?.fio}
-
- {executor ?
-
-
Исполнитель: {executor.fio}
-
-
deleteTaskExecutor()} />
-
:
-
-
-
Добавить исполнителя
- {dropListOpen &&
-
-
setDropListOpen(false)} />
- {projectUsers.map((person) => {
- return
taskExecutor(person)}>
-
{person.user.fio}
-
-
- })
- }
-
- }
-
- }
-
- {Boolean(members.length) &&
-
-
Участники:
-
- {members.map((member) => {
- return
-
{member.fio}
-
-
deleteMember(member)} />
-
- })
- }
-
-
- }
-
-
-
-
Добавить участников
- {dropListMembersOpen &&
-
-
setDropListMembersOpen(false)} />
- {users.length ? users.map((person) => {
- return
addMember(person)}>
-
{person.user.fio}
-
-
- }) :
Нет пользователей
- }
-
- }
-
-
-
-
-
-
-
Длительность :
-
- {correctTimerTime(currentTimerCount.hours)}:{correctTimerTime(currentTimerCount.minute)}:{correctTimerTime(currentTimerCount.seconds)}
-
-
-
- {timerStart ?
-
- :
-
- }
-
-
-
-
{
- if(editOpen) {
- setEditOpen(!editOpen)
- editTask()
- } else {
- setEditOpen(!editOpen)
- }
- }}>
-
-
{editOpen ? 'сохранить' : 'редактировать'}
-
-
-
-
ссылка на проект
-
-
-
-
в архив
-
-
-
-
удалить
-
-
-
-
-
-
-
- );
-};
-
-export default ModalTiсket;
diff --git a/src/components/UI/TicketFullScreen/TicketFullScreen.jsx b/src/components/UI/TicketFullScreen/TicketFullScreen.jsx
deleted file mode 100644
index fe9beaa7..00000000
--- a/src/components/UI/TicketFullScreen/TicketFullScreen.jsx
+++ /dev/null
@@ -1,456 +0,0 @@
-import React, { useEffect, useState } from "react";
-
-import { ProfileHeader } from "../../ProfileHeader/ProfileHeader";
-import { ProfileBreadcrumbs } from "../../ProfileBreadcrumbs/ProfileBreadcrumbs";
-import { Footer } from "@components/Common/Footer/Footer";
-import { Link, useParams, useNavigate } from "react-router-dom";
-import TrackerModal from "../../Modal/TrackerModal/TrackerModal";
-import TrackerTaskComment from "../../../components/TrackerTaskComment/TrackerTaskComment";
-import { Navigation } from "../../Navigation/Navigation";
-import {Loader} from "@components/Common/Loader/Loader";
-
-import {useDispatch, useSelector} from "react-redux";
-import {
- deletePersonOnProject,
- modalToggle,
- setProjectBoardFetch,
- setToggleTab,
- getProjectBoard,
- getBoarderLoader,
-} from "../../../redux/projectsTrackerSlice";
-import { apiRequest } from "../../../api/request";
-
-import project from "../../../images/trackerProject.svg";
-import watch from "../../../images/watch.png";
-import file from "../../../images/fileModal.svg";
-import send from "../../../images/send.svg";
-import arrow2 from "../../../images/arrowStart.png";
-import plus from "../../../images/plus.svg";
-import tasks from "../../../images/trackerTasks.svg";
-import archive from "../../../images/archiveTracker.svg";
-import arrow from "../../../images/arrowCalendar.png";
-import link from "../../../images/link.svg";
-import archive2 from "../../../images/archive.svg";
-import del from "../../../images/delete.svg";
-import edit from "../../../images/edit.svg";
-import close from "../../../images/closeProjectPersons.svg";
-
-import "./ticketFullScreen.scss";
-import {getCorrectRequestDate, urlForLocal} from "../../../helper";
-
-export const TicketFullScreen = ({}) => {
- const [modalAddWorker, setModalAddWorker] = useState(false);
- const ticketId = useParams();
- const dispatch = useDispatch();
- const navigate = useNavigate();
- const projectBoard = useSelector(getProjectBoard);
- const boardLoader = useSelector(getBoarderLoader);
- const [taskInfo, setTaskInfo] = useState({});
- const [editOpen, setEditOpen] = useState(false);
- const [inputsValue, setInputsValue] = useState({});
- const [loader, setLoader] = useState(true);
- const [comments, setComments] = useState([]);
- const [personListOpen, setPersonListOpen] = useState(false)
- const [timerStart, setTimerStart] = useState(false)
- const [timerInfo, setTimerInfo] = useState({})
-
- useEffect(() => {
- apiRequest(`/task/get-task?task_id=${ticketId.id}`).then((taskInfo) => {
- setTaskInfo(taskInfo);
- setInputsValue({title: taskInfo.title, description: taskInfo.description, comment: ''})
- apiRequest(`/comment/get-by-entity?entity_type=2&entity_id=${taskInfo.id}`).then((res) => {
- const comments = res.reduce((acc, cur) => {
- if (!cur.parent_id) {
- acc.push({...cur, subComments: []})
- } else {
- acc.forEach((item) => {
- if (item.id === cur.parent_id) item.subComments.push(cur)
- })
- }
- return acc
- }, [])
- setComments(comments)
- })
- taskInfo.timers.forEach((time) => {
- if (!time.stopped_at) {
- setTimerStart(true)
- setTimerInfo(time)
- }
- })
- dispatch(setProjectBoardFetch(taskInfo.project_id));
- setLoader(boardLoader)
- });
- }, []);
-
- function deleteTask() {
- apiRequest("/task/update-task", {
- method: "PUT",
- data: {
- task_id: ticketId.id,
- status: 0,
- },
- }).then((res) => {
- navigate(`/tracker/project/${taskInfo.project_id}`);
- });
- }
-
- function editTask() {
- apiRequest("/task/update-task", {
- method: "PUT",
- data: {
- task_id: taskInfo.id,
- title: inputsValue.title,
- description: inputsValue.description
- },
- }).then(() => {
- });
- }
-
- function createComment() {
- apiRequest("/comment/create", {
- method: "POST",
- data: {
- text: inputsValue.comment,
- entity_type: 2,
- entity_id: taskInfo.id
- }
- }).then((res) => {
- let newComment = res
- newComment.created_at = new Date()
- newComment.subComments = []
- setInputsValue((prevValue) => ({...prevValue, comment: ''}))
- setComments((prevValue) => ([...prevValue, newComment]))
- })
- }
-
- function startTaskTimer() {
- apiRequest("/timer/create", {
- method: "POST",
- data: {
- entity_type: 2,
- entity_id: taskInfo.id,
- created_at: getCorrectRequestDate(new Date())
- }
- }).then((res) => {
- setTimerStart(true)
- setTimerInfo(res)
- })
- }
-
- function stopTaskTimer() {
- apiRequest("/timer/update", {
- method: "PUT",
- data: {
- timer_id: timerInfo.id,
- stopped_at: getCorrectRequestDate(new Date())
- }
- }).then(() => setTimerStart(false))
- }
-
- function deletePerson(userId) {
- apiRequest("/project/del-user", {
- method: "DELETE",
- data: {
- project_id: projectBoard.id,
- user_id: userId
- },
- }).then((res) => {
- dispatch(deletePersonOnProject(userId))
- });
- }
-
- function commentDelete(comment) {
- setComments((prevValue) => prevValue.filter((item) => item.id !== comment.id))
- if (comment.subComments.length) {
- comment.subComments.forEach((subComment) => {
- apiRequest("/comment/update", {
- method: "PUT",
- data: {
- comment_id: subComment.id,
- status: 0
- }
- }).then(() => {
- })
- })
- }
- }
-
- function addSubComment(commentId, subComment) {
- const addSubComment = comments
- addSubComment.forEach((comment) => {
- if (comment.id === commentId) {
- comment.subComments.push(subComment)
- }
- })
- setComments(addSubComment)
- }
-
- function subCommentDelete(subComment) {
- const deleteSubComment = comments
- deleteSubComment.forEach((comment, index) => {
- if (comment.id === subComment.parent_id) {
- deleteSubComment[index].subComments = comment.subComments.filter((item) => item.id !== subComment.id)
- }
- })
- setComments([...deleteSubComment])
- }
-
- const toggleTabs = (index) => {
- dispatch(setToggleTab(index));
- };
-
- return (
-
-
-
-
-
-
-
Управление проектами с трекером
-
-
-
-
-
toggleTabs(1)}
- >
-
-
Проекты
-
-
toggleTabs(2)}
- >
-
-
Все мои задачи
-
-
toggleTabs(3)}
- >
-
-
Архив
-
-
- {loader ?
:
- <>
-
-
-
-
Проект : {projectBoard.name}
-
-
-
-
- {/*
*/}
- {/*
*/}
-
{projectBoard.projectUsers?.length}
-
{
- setPersonListOpen(true)
- }}
- >
- +
-
-
добавить участника
- {personListOpen &&
-
-
setPersonListOpen(false)} />
-
{projectBoard.projectUsers?.length}участник
-
В проекте - “{projectBoard.name}”
-
- {projectBoard.projectUsers?.map((person) => {
- return
-
-
{person.user.fio}
-
deletePerson(person.user_id)}/>
-
- })
- }
-
-
{
- dispatch(modalToggle("addWorker"));
- setModalAddWorker(true);
- setPersonListOpen(false)
- }}
- >
-
+
-
Добавить участников
-
-
- }
-
-
-
-
Вернуться на проекты
-
-
-
-
-
-
-
-
-
-
Задача
- {editOpen ?
{
- setInputsValue((prevValue) => ({...prevValue, title: e.target.value}))
- }} /> :
{inputsValue.title}
}
-
- {editOpen ?
{
- setInputsValue((prevValue) => ({...prevValue, description: e.target.value}))
- }}/> :
{inputsValue.description}
}
- {/*
*/}
-
-
-
-
-
-
-
- {0}
- Файлов
-
-
-
-
{
- setInputsValue((prevValue) => ({...prevValue, comment: e.target.value}))
- }} />
-
-
-
- {comments.map((comment) => {
- return
- })
-
- }
-
-
-
-
-
-
- Создатель : {taskInfo.user?.fio}
-
-
- {Boolean(taskInfo.taskUsers?.length) &&
- taskInfo.taskUsers.map((worker, index) => {
- return (
-
-
-
{worker.name}
-
- );
- })}
-
-
-
-
- Добавить исполнителя
-
-
-
- Добавить участников
-
-
-
-
-
-
-
Длительность :
-
{"0:00:00"}
-
-
- {timerStart ?
-
- :
-
- }
-
-
-
-
{
- if(editOpen) {
- setEditOpen(!editOpen)
- editTask()
- } else {
- setEditOpen(!editOpen)
- }
- }}>
-
-
{editOpen ? 'сохранить' : 'редактировать'}
-
-
-
-
ссылка на проект
-
-
-
-
в архив
-
-
-
-
удалить
-
-
-
-
- >
- }
-
-
-
- );
-};
-
-export default TicketFullScreen;
diff --git a/src/pages/ProjectTracker/ProjectTracker.js b/src/pages/ProjectTracker/ProjectTracker.js
index 6655b266..658e7cf2 100644
--- a/src/pages/ProjectTracker/ProjectTracker.js
+++ b/src/pages/ProjectTracker/ProjectTracker.js
@@ -1,44 +1,46 @@
import React, { useEffect, useRef, useState } from "react";
-import { Link, useParams } from "react-router-dom";
-import { ProfileHeader } from "../../components/ProfileHeader/ProfileHeader";
-import { ProfileBreadcrumbs } from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs";
-import { Footer } from "@components/Common/Footer/Footer";
-import { Navigation } from "../../components/Navigation/Navigation";
-import { Loader } from "@components/Common/Loader/Loader";
-import { urlForLocal } from '../../utils/helper'
-
import { useDispatch, useSelector } from "react-redux";
-import { apiRequest } from "../../api/request";
+import { Link, useParams } from "react-router-dom";
+
import {
- getProjectBoard,
- getBoarderLoader,
- modalToggle,
- moveProjectTask,
- setProjectBoardFetch,
- setToggleTab,
activeLoader,
- setColumnName,
- setColumnId,
- setColumnPriority,
deletePersonOnProject,
filterCreatedByMe,
filteredParticipateTasks,
- movePositionProjectTask
-} from "../../redux/projectsTrackerSlice";
+ getBoarderLoader,
+ getProjectBoard,
+ modalToggle,
+ movePositionProjectTask,
+ moveProjectTask,
+ setColumnId,
+ setColumnName,
+ setColumnPriority,
+ setProjectBoardFetch,
+ setToggleTab,
+} from "@redux/projectsTrackerSlice";
-import ModalTicket from "../../components/UI/ModalTicket/ModalTicket";
-import TrackerModal from "../../components/Modal/TrackerModal/TrackerModal";
+import { urlForLocal } from "@utils/helper";
-import project from "../../assets/icons/trackerProject.svg";
-import tasks from "../../assets/icons/trackerTasks.svg";
-import archive from "../../assets/icons/archiveTracker.svg";
-import commentsBoard from "../../assets/icons/commentsBoard.svg";
-import filesBoard from "../../assets/icons/filesBoard.svg";
-import arrow from "../../assets/icons/arrows/arrowCalendar.png";
-import del from "../../assets/icons/delete.svg";
-import edit from "../../assets/icons/edit.svg";
-import close from "../../assets/icons/close.png"
-import accept from "../../assets/images/accept.png";
+import { apiRequest } from "@api/request";
+
+import { Footer } from "@components/Common/Footer/Footer";
+import { Loader } from "@components/Common/Loader/Loader";
+import ModalTicket from "@components/Modal/Tracker/ModalTicket/ModalTicket";
+import TrackerModal from "@components/Modal/TrackerModal/TrackerModal";
+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";
+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";
export const ProjectTracker = () => {
const dispatch = useDispatch();
@@ -48,13 +50,14 @@ export const ProjectTracker = () => {
const [selectedTab, setSelectedTab] = useState(0);
const [priorityTask, setPriorityTask] = useState(0);
const [wrapperHover, setWrapperHover] = useState({});
- const [taskHover, setTaskHover] = useState({})
+ const [taskHover, setTaskHover] = useState({});
const [modalAdd, setModalAdd] = useState(false);
const [modalActiveTicket, setModalActiveTicket] = useState(false);
const [selectedTicket, setSelectedTicket] = useState({});
- const [personListOpen, setPersonListOpen] = useState(false)
- const [checkBoxParticipateTasks, setCheckBoxParticipateTasks] = useState(false)
- const [checkBoxMyTasks, setCheckBoxMyTasks] = useState(false)
+ const [personListOpen, setPersonListOpen] = useState(false);
+ const [checkBoxParticipateTasks, setCheckBoxParticipateTasks] =
+ useState(false);
+ const [checkBoxMyTasks, setCheckBoxMyTasks] = useState(false);
const startWrapperIndexTest = useRef({});
const projectBoard = useSelector(getProjectBoard);
const loader = useSelector(getBoarderLoader);
@@ -65,20 +68,20 @@ export const ProjectTracker = () => {
}, []);
useEffect(() => {
- const tasksHover = {}
- const columnHover = {}
+ const tasksHover = {};
+ const columnHover = {};
if (Object.keys(projectBoard).length) {
projectBoard.columns.forEach((column) => {
setOpenColumnSelect((prevState) => ({
...prevState,
[column.id]: false,
}));
- columnHover[column.id] = false
- column.tasks.forEach(task => tasksHover[task.id] = false)
+ columnHover[column.id] = false;
+ column.tasks.forEach((task) => (tasksHover[task.id] = false));
});
}
- setWrapperHover(columnHover)
- setTaskHover(tasksHover)
+ setWrapperHover(columnHover);
+ setTaskHover(tasksHover);
}, [projectBoard]);
function dragStartHandler(e, task, columnId) {
@@ -86,35 +89,37 @@ export const ProjectTracker = () => {
}
function dragOverTaskHandler(e, task) {
- e.preventDefault()
+ e.preventDefault();
if (startWrapperIndexTest.current.task.id === task.id) {
- return
+ return;
}
- setTaskHover((prevState) => ({[prevState]: false, [task.id]: true}))
+ setTaskHover((prevState) => ({ [prevState]: false, [task.id]: true }));
}
- function dragLeaveTaskHandler(e) {
- setTaskHover((prevState) => ({[prevState]: false}))
+ function dragLeaveTaskHandler() {
+ setTaskHover((prevState) => ({ [prevState]: false }));
}
function dragEndTaskHandler() {
- setTaskHover((prevState) => ({[prevState]: false}))
+ setTaskHover((prevState) => ({ [prevState]: false }));
setWrapperHover((prevState) => ({
[prevState]: false,
}));
}
function dragDropTaskHandler(e, task, column) {
- e.preventDefault()
+ e.preventDefault();
if (task.id === startWrapperIndexTest.current.task.id) {
- return
+ return;
}
- const finishTask = column.tasks.indexOf(task)
- dispatch(movePositionProjectTask({
- startTask: startWrapperIndexTest.current.task,
- finishTask: task,
- finishIndex: finishTask
- }))
+ const finishTask = column.tasks.indexOf(task);
+ dispatch(
+ movePositionProjectTask({
+ startTask: startWrapperIndexTest.current.task,
+ finishTask: task,
+ finishIndex: finishTask,
+ })
+ );
}
function dragOverHandler(e) {
@@ -139,9 +144,10 @@ export const ProjectTracker = () => {
[prevState]: false,
}));
- if (startWrapperIndexTest.current.index === columnId
- ||
- e.target.className.includes('__item')) {
+ if (
+ startWrapperIndexTest.current.index === columnId ||
+ e.target.className.includes("__item")
+ ) {
return;
}
@@ -159,7 +165,7 @@ export const ProjectTracker = () => {
setSelectedTab(columnId);
dispatch(modalToggle("createTiketProject"));
setModalAdd(true);
- setPriorityTask(length)
+ setPriorityTask(length);
}
function openTicket(e, task) {
@@ -168,7 +174,7 @@ export const ProjectTracker = () => {
}
function deleteColumn(column) {
- const priorityColumns = []
+ const priorityColumns = [];
apiRequest("/project-column/update-column", {
method: "PUT",
data: {
@@ -181,19 +187,19 @@ export const ProjectTracker = () => {
for (let i = column.priority; i < projectBoard.columns.length; i++) {
const currentColumn = {
column_id: projectBoard.columns[i].id,
- priority: i
- }
- priorityColumns.push(currentColumn)
+ priority: i,
+ };
+ priorityColumns.push(currentColumn);
}
apiRequest("/project-column/set-priority", {
method: "POST",
data: {
project_id: projectBoard.id,
- data: JSON.stringify(priorityColumns)
- }
+ data: JSON.stringify(priorityColumns),
+ },
}).then(() => {
dispatch(setProjectBoardFetch(projectBoard.id));
- })
+ });
} else {
dispatch(setProjectBoardFetch(projectBoard.id));
}
@@ -205,33 +211,33 @@ export const ProjectTracker = () => {
method: "DELETE",
data: {
project_id: projectBoard.id,
- user_id: userId
+ user_id: userId,
},
}).then(() => {
- dispatch(deletePersonOnProject(userId))
+ dispatch(deletePersonOnProject(userId));
});
}
function filterParticipateTasks() {
if (!checkBoxParticipateTasks) {
- dispatch(filteredParticipateTasks(Number(localStorage.getItem('id'))))
+ dispatch(filteredParticipateTasks(Number(localStorage.getItem("id"))));
} else {
- dispatch(setProjectBoardFetch(projectId.id))
- setCheckBoxParticipateTasks(false)
- setCheckBoxMyTasks(false)
+ dispatch(setProjectBoardFetch(projectId.id));
+ setCheckBoxParticipateTasks(false);
+ setCheckBoxMyTasks(false);
}
- setCheckBoxParticipateTasks(!checkBoxParticipateTasks)
+ setCheckBoxParticipateTasks(!checkBoxParticipateTasks);
}
function filterMyTask() {
if (!checkBoxMyTasks) {
- dispatch(filterCreatedByMe(Number(localStorage.getItem('id'))))
+ dispatch(filterCreatedByMe(Number(localStorage.getItem("id"))));
} else {
- dispatch(setProjectBoardFetch(projectId.id))
- setCheckBoxParticipateTasks(false)
- setCheckBoxMyTasks(false)
+ dispatch(setProjectBoardFetch(projectId.id));
+ setCheckBoxParticipateTasks(false);
+ setCheckBoxMyTasks(false);
}
- setCheckBoxMyTasks(!checkBoxMyTasks)
+ setCheckBoxMyTasks(!checkBoxMyTasks);
}
return (
@@ -303,58 +309,85 @@ export const ProjectTracker = () => {
добавить колонку