diff --git a/src/pages/AuthForCandidate/AuthForCandidate.js b/src/pages/AuthForCandidate/AuthForCandidate.jsx
similarity index 100%
rename from src/pages/AuthForCandidate/AuthForCandidate.js
rename to src/pages/AuthForCandidate/AuthForCandidate.jsx
diff --git a/src/pages/AuthForDevelopers/AuthForDevelopers.js b/src/pages/AuthForDevelopers/AuthForDevelopers.jsx
similarity index 100%
rename from src/pages/AuthForDevelopers/AuthForDevelopers.js
rename to src/pages/AuthForDevelopers/AuthForDevelopers.jsx
diff --git a/src/pages/PartnerBid/PartnerBid.js b/src/pages/PartnerBid/PartnerBid.jsx
similarity index 100%
rename from src/pages/PartnerBid/PartnerBid.js
rename to src/pages/PartnerBid/PartnerBid.jsx
diff --git a/src/pages/PartnerSettings/PartnerSettings.js b/src/pages/PartnerSettings/PartnerSettings.jsx
similarity index 100%
rename from src/pages/PartnerSettings/PartnerSettings.js
rename to src/pages/PartnerSettings/PartnerSettings.jsx
diff --git a/src/pages/ProjectTracker/ProjectTracker.js b/src/pages/ProjectTracker/ProjectTracker.js
index 586d1cbc..de272f97 100644
--- a/src/pages/ProjectTracker/ProjectTracker.js
+++ b/src/pages/ProjectTracker/ProjectTracker.js
@@ -1,11 +1,19 @@
-import React, {useEffect, useRef, useState} from "react";
-import {Link, useParams} from "react-router-dom";
+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/Footer/Footer";
+import { Navigation } from "../../components/Navigation/Navigation";
import { useDispatch, useSelector } from "react-redux";
-import {getProjectBoard, moveProjectTask, setProjectBoardFetch, setToggleTab} from "../../redux/projectsTrackerSlice";
+import { apiRequest } from "../../api/request";
+import {
+ getProjectBoard,
+ modalToggle,
+ moveProjectTask,
+ setProjectBoardFetch,
+ setToggleTab,
+} from "../../redux/projectsTrackerSlice";
import ModalTicket from "../../components/UI/ModalTicket/ModalTicket";
import ModalAdd from "../../components/UI/ModalAdd/ModalAdd";
@@ -21,422 +29,347 @@ import arrow from "../../images/arrowCalendar.png";
import del from "../../images/delete.svg";
import edit from "../../images/edit.svg";
-import {apiRequest} from "../../api/request";
-import { Navigation } from "../../components/Navigation/Navigation";
-
export const ProjectTracker = () => {
- const dispatch = useDispatch();
- const projectId = useParams()
- const [openColumnSelect, setOpenColumnSelect] = useState({})
- const [selectedTab, setSelectedTab] = useState(0);
- const startWrapperIndexTest = useRef({})
- const [wrapperHover, setWrapperHover] = useState({});
- const projectBoard = useSelector(getProjectBoard);
- useEffect(() => {
- dispatch(setProjectBoardFetch(projectId.id))
- }, [])
+ const dispatch = useDispatch();
+ const projectId = useParams();
- useEffect(() => {
- if (Object.keys(projectBoard).length) {
- projectBoard.columns.forEach(column => {
- setOpenColumnSelect(prevState => ({...prevState, [column.id]: false}))
- setWrapperHover(prevState => ({...prevState, [column.id]: false}))
- })
- }
- }, [projectBoard])
+ const [openColumnSelect, setOpenColumnSelect] = useState({});
+ const [selectedTab, setSelectedTab] = useState(0);
+ const [wrapperHover, setWrapperHover] = useState({});
+ const [modalAdd, setModalAdd] = useState(false);
+ const [modalActiveTicket, setModalActiveTicket] = useState(false);
+ const [selectedTicket, setSelectedTicket] = useState({});
- // Modal State
- const [modalActiveTicket, setModalActiveTicket] = useState(false);
- const [selectedTicket, setSelectedTicket] = useState({});
- const [modalAddWorker, setModalAddWorker] = useState(false);
- const [modalCreateColl, setModalCreateColl] = useState(false);
- const [modalCreateTiket, setModalCreateTiket] = useState(false);
- const [valueTiket, setValueTiket] = useState("");
- const [descriptionTicket, setDescriptionTicket] = useState("")
- const [valueColl, setValueColl] = useState("");
- //
+ const startWrapperIndexTest = useRef({});
+ const projectBoard = useSelector(getProjectBoard);
- // function toggleMoreTasks(columnId) {
- // setTabTaskMok((prevArray) =>
- // prevArray.map((elem, index) => {
- // if (columnId === index) {
- // return { ...elem, open: !elem.open };
- // } else {
- // return elem;
- // }
- // })
- // );
- // }
+ useEffect(() => {
+ dispatch(setProjectBoardFetch(projectId.id));
+ }, []);
- function dragStartHandler(e, task, columnId) {
- startWrapperIndexTest.current = { task: task, index: columnId };
- setTimeout(() => {
- e.target.classList.add("tasks__board__item__hide");
- }, 0);
+ useEffect(() => {
+ if (Object.keys(projectBoard).length) {
+ projectBoard.columns.forEach((column) => {
+ setOpenColumnSelect((prevState) => ({
+ ...prevState,
+ [column.id]: false,
+ }));
+ setWrapperHover((prevState) => ({ ...prevState, [column.id]: false }));
+ });
+ }
+ }, [projectBoard]);
+
+ // function toggleMoreTasks(columnId) {
+ // setTabTaskMok((prevArray) =>
+ // prevArray.map((elem, index) => {
+ // if (columnId === index) {
+ // return { ...elem, open: !elem.open };
+ // } else {
+ // return elem;
+ // }
+ // })
+ // );
+ // }
+
+ function dragStartHandler(e, task, columnId) {
+ startWrapperIndexTest.current = { task: task, index: columnId };
+ setTimeout(() => {
+ e.target.classList.add("tasks__board__item__hide");
+ }, 0);
+ }
+
+ function dragEndHandler(e) {
+ setWrapperHover((prevState) => ({
+ [prevState]: false,
+ }));
+ e.target.classList.remove("tasks__board__item__hide");
+ }
+
+ function dragOverHandler(e) {
+ e.preventDefault();
+ }
+
+ function dragEnterHandler(columnId) {
+ if (columnId === startWrapperIndexTest.current.index) {
+ return;
}
- function dragEndHandler(e) {
- setWrapperHover(prevState => ({
- [prevState]: false
- })
- );
- e.target.classList.remove("tasks__board__item__hide");
+ setWrapperHover((prevState) => ({
+ [prevState]: false,
+ [columnId]: true,
+ }));
+ }
+ function dragDropHandler(e, columnId) {
+ e.preventDefault();
+ if (startWrapperIndexTest.current.index === columnId) {
+ return;
}
- function dragOverHandler(e) {
- e.preventDefault();
- }
+ setWrapperHover((prevState) => ({
+ [prevState]: false,
+ }));
- function dragEnterHandler(columnId) {
- if (columnId === startWrapperIndexTest.current.index) {
- return;
- }
-
- setWrapperHover(prevState => ({
- [prevState]: false, [columnId]: true
- }))
- }
- function dragDropHandler(e, columnId) {
- e.preventDefault();
- if (startWrapperIndexTest.current.index === columnId) {
- return;
- }
-
- setWrapperHover(prevState => ({
- [prevState]: false
- })
- );
-
- if (columnId !== startWrapperIndexTest.current.index) {
- dispatch(moveProjectTask({startWrapperIndex: startWrapperIndexTest.current, columnId}))
- }
- }
-
- function selectedTabTask(columnId) {
- setSelectedTab(columnId);
- setModalCreateTiket(true);
- }
-
- function openTicket(e, task) {
- setSelectedTicket(task);
- setModalActiveTicket(true);
- }
-
- function createTiket() {
- if (!valueTiket || !descriptionTicket) {
- return
- }
-
- apiRequest('/task/create-task', {
- method: 'POST',
- data: {
- project_id: projectBoard.id,
- title: valueTiket,
- description: descriptionTicket,
- status: 1,
- user_id: localStorage.getItem('id'),
- column_id: selectedTab
- }
- }).then((res) => {
- dispatch(setProjectBoardFetch(projectBoard.id))
+ if (columnId !== startWrapperIndexTest.current.index) {
+ dispatch(
+ moveProjectTask({
+ startWrapperIndex: startWrapperIndexTest.current,
+ columnId,
})
-
- setModalCreateTiket(false);
- setValueTiket("");
- setDescriptionTicket("")
+ );
}
+ }
- function createTab() {
- if (!valueColl) {
- return
- }
+ function selectedTabTask(columnId) {
+ setSelectedTab(columnId);
+ dispatch(modalToggle("createTiketProject"));
+ setModalAdd(true);
+ }
- apiRequest('/project-column/create-column', {
- method: 'POST',
- data: {
- project_id: projectBoard.id,
- title: valueColl
- }
- }).then((res) => {
- dispatch(setProjectBoardFetch(projectBoard.id))
- })
- setValueColl("");
- setModalCreateColl(false);
- }
+ function openTicket(e, task) {
+ setSelectedTicket(task);
+ setModalActiveTicket(true);
+ }
- function deleteColumn(id) {
- apiRequest('/project-column/update-column', {
- method: 'PUT',
- data: {
- column_id: id,
- project_id: projectBoard.id,
- status: 0
- }
- }).then((res) => {
- dispatch(setProjectBoardFetch(projectBoard.id))
- })
- }
+ function deleteColumn(id) {
+ apiRequest("/project-column/update-column", {
+ method: "PUT",
+ data: {
+ column_id: id,
+ project_id: projectBoard.id,
+ status: 0,
+ },
+ }).then((res) => {
+ dispatch(setProjectBoardFetch(projectBoard.id));
+ });
+ }
- return (
-
-
-
-
-
-
-
Управление проектами с трекером
-
-
-
-
-
dispatch(setToggleTab(1))}
- >
-
-
Проекты
-
-
dispatch(setToggleTab(2))}
- >
-
-
Все мои задачи
-
-
dispatch(setToggleTab(3))}
- >
-
-
Архив
-
-
-
-
-
-
-
Проект : {projectBoard.name}
+ return (
+
+
+
+
+
+
+
Управление проектами с трекером
+
+
+
+
+
dispatch(setToggleTab(1))}
+ >
+
+
Проекты
+
+
dispatch(setToggleTab(2))}
+ >
+
+
Все мои задачи
+
+
dispatch(setToggleTab(3))}
+ >
+
+
Архив
+
+
+
+
+
+
+
Проект : {projectBoard.name}
-
-
-
Введите название колонки
-
- setValueColl(e.target.value)}
- >
-
-
-
-
+
-
-
-
Добавьте участника
-
- Введите имя или e-mail{" "}
-
-
- setValueTiket(e.target.value)}
- >
-
-
-
-
-
-
-
setModalCreateColl(true)}>+
-
добавить колонку
-
-
-
-
-
+9
-
+
+
{
+ dispatch(modalToggle("createColumn"));
+ setModalAdd(true);
+ }}
+ >
+
-
добавить участника
-
-
-
Участвую
-
-
-
-
Мои
-
-
-
- Вернуться на проекты
-
-
-
-
-
-
-
-
-
-
Введите название и описание задачи
-
- setValueTiket(e.target.value)}
- placeholder='Название задачи'
- >
-
-
- setDescriptionTicket(e.target.value)}
- placeholder='Описание задачи'
- >
-
-
-
-
-
-
- {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" : ""
- } ${
- wrapperHover[column.id] ? "tasks__board__hover" : ""
- }`}
- >
-
- {/*
*/}
-
- {column.title}
-
-
- selectedTabTask(column.id)}
- >
- +
-
- {
- setOpenColumnSelect(prevState => ({...prevState, [column.id]: true}))
- }} className="more">...
-
-
- {openColumnSelect[column.id] &&
-
-
{
- setOpenColumnSelect(prevState => ({...prevState, [column.id]: false}))
- }}>
-
-
Изменить
-
-
deleteColumn(column.id)}>
-
-
Удалить
-
-
- }
- {column.tasks.map((task, index) => {
- if (index > 2) {
- if (!column.open) {
- return;
- }
- }
- return (
-
- dragStartHandler(e, task, column.id)
- }
- onDragEnd={(e) => dragEndHandler(e)}
- onClick={(e) => openTicket(e, task)}
- >
-
-
- {task.description}
-
-
-
-
-
{task.comments} коментариев
-
-
-
-
{task.files} файлов
-
- {/*
*/}
- {/*
*/}
- {/*
*/}
- {/*
*/}
-
-
- );
- })}
- {column.tasks.length > 3 && (
-
toggleMoreTasks(column.id)}
- >
- {column.open ? "-" : "+"}
-
- )}
-
- );
- })}
-
-
+
добавить колонку
+
+
+
+
+9
+
{
+ dispatch(modalToggle("addWorker"));
+ setModalAdd(true);
+ }}
+ >
+ +
+
+
добавить участника
+
+
+
Участвую
+
+
+
+
Мои
+
+
+
+
Вернуться на проекты
+
+
+
-
+
+
+
+
+ {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" : ""
+ } ${
+ wrapperHover[column.id] ? "tasks__board__hover" : ""
+ }`}
+ >
+
+ {/*
*/}
+ {column.title}
+
+ selectedTabTask(column.id)}
+ >
+ +
+
+ {
+ setOpenColumnSelect((prevState) => ({
+ ...prevState,
+ [column.id]: true,
+ }));
+ }}
+ className="more"
+ >
+ ...
+
+
+
+ {openColumnSelect[column.id] && (
+
+
{
+ setOpenColumnSelect((prevState) => ({
+ ...prevState,
+ [column.id]: false,
+ }));
+ dispatch(modalToggle("editColumn"));
+ setModalAdd(true);
+ }}
+ >
+
+
Изменить
+
+
deleteColumn(column.id)}
+ >
+
+
Удалить
+
+
+ )}
+ {column.tasks.map((task, index) => {
+ if (index > 2) {
+ if (!column.open) {
+ return;
+ }
+ }
+ return (
+
+ dragStartHandler(e, task, column.id)
+ }
+ onDragEnd={(e) => dragEndHandler(e)}
+ onClick={(e) => openTicket(e, task)}
+ >
+
+
+ {task.description}
+
+
+
+
+
{task.comments} коментариев
+
+
+
+
{task.files} файлов
+
+ {/*
*/}
+ {/*
*/}
+ {/*
*/}
+ {/*
*/}
+
+
+ );
+ })}
+ {column.tasks.length > 3 && (
+
toggleMoreTasks(column.id)}
+ >
+ {column.open ? "-" : "+"}
+
+ )}
+
+ );
+ })}
+
+
- );
+
+
+
+ );
};
diff --git a/src/redux/projectsTrackerSlice.js b/src/redux/projectsTrackerSlice.js
index 0bba58a3..71145e03 100644
--- a/src/redux/projectsTrackerSlice.js
+++ b/src/redux/projectsTrackerSlice.js
@@ -1,16 +1,15 @@
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
-import {apiRequest} from "../api/request";
+import { apiRequest } from "../api/request";
const initialState = {
projects: [],
projectBoard: {},
- toggleTab: 1
+ toggleTab: 1,
+ modalType: "",
};
-export const setProjectBoardFetch = createAsyncThunk(
- 'userInfo',
- (id) =>
- apiRequest(`/project/get-project?project_id=${id}&expand=columns`)
+export const setProjectBoardFetch = createAsyncThunk("userInfo", (id) =>
+ apiRequest(`/project/get-project?project_id=${id}&expand=columns`)
);
export const projectsTrackerSlice = createSlice({
@@ -18,47 +17,61 @@ export const projectsTrackerSlice = createSlice({
initialState,
reducers: {
setAllProjects: (state, action) => {
- state.projects = action.payload
+ state.projects = action.payload;
},
setProject: (state, action) => {
state.projects.push(action.payload);
},
setToggleTab: (state, action) => {
- state.toggleTab = action.payload
+ state.toggleTab = action.payload;
},
deleteProject: (state, action) => {
- state.projects = state.projects.filter((project) => project.id !== action.payload.id)
+ state.projects = state.projects.filter(
+ (project) => project.id !== action.payload.id
+ );
},
moveProjectTask: (state, action) => {
state.projectBoard.columns.forEach((column, index) => {
if (column.id === action.payload.columnId) {
- column.tasks.push(action.payload.startWrapperIndex.task)
+ column.tasks.push(action.payload.startWrapperIndex.task);
apiRequest(`/task/update-task`, {
- method: 'PUT',
+ method: "PUT",
data: {
task_id: action.payload.startWrapperIndex.task.id,
- column_id: column.id
- }
- }).then((res) => {
- })
+ column_id: column.id,
+ },
+ }).then((res) => {});
}
if (column.id === action.payload.startWrapperIndex.index) {
- state.projectBoard.columns[index].tasks = column.tasks.filter((task)=> task.id !== action.payload.startWrapperIndex.task.id);
+ state.projectBoard.columns[index].tasks = column.tasks.filter(
+ (task) => task.id !== action.payload.startWrapperIndex.task.id
+ );
}
- })
- }
+ });
+ },
+ modalToggle: (state, action) => {
+ state.modalType = action.payload;
+ },
},
extraReducers: {
[setProjectBoardFetch.fulfilled]: (state, action) => {
- state.projectBoard = action.payload
- }
- }
+ state.projectBoard = action.payload;
+ },
+ },
});
-export const { setProject, deleteProject, setAllProjects, moveProjectTask, setToggleTab } = projectsTrackerSlice.actions;
+export const {
+ setProject,
+ deleteProject,
+ setAllProjects,
+ moveProjectTask,
+ setToggleTab,
+ modalToggle,
+} = projectsTrackerSlice.actions;
export const getProjects = (state) => state.tracker.projects;
export const getProjectBoard = (state) => state.tracker.projectBoard;
-export const getToggleTab = (state) => state.tracker.toggleTab
+export const getToggleTab = (state) => state.tracker.toggleTab;
+export const getValueModalType = (state) => state.tracker.modalType;
export default projectsTrackerSlice.reducer;