Задача
-
{taskInfo.title}
+ {editOpen ?
{
+ setInputsValue((prevValue) => ({...prevValue, title: e.target.value}))
+ }} /> :
{inputsValue.title}
}
-
{taskInfo.description}
+ {editOpen ?
{
+ setInputsValue((prevValue) => ({...prevValue, description: e.target.value}))
+ }}/> :
{inputsValue.description}
}
-
{taskInfo.description}
@@ -229,9 +252,16 @@ export const TicketFullScreen = ({}) => {
-
+
{
+ if(editOpen) {
+ setEditOpen(!editOpen)
+ editTask()
+ } else {
+ setEditOpen(!editOpen)
+ }
+ }}>
-
редактировать
+
{editOpen ? 'сохранить' : 'редактировать'}
@@ -248,6 +278,8 @@ export const TicketFullScreen = ({}) => {
+ >
+ }
diff --git a/src/components/UI/TrackerModal/TrackerModal.jsx b/src/components/UI/TrackerModal/TrackerModal.jsx
index 9951b10b..d8361f34 100644
--- a/src/components/UI/TrackerModal/TrackerModal.jsx
+++ b/src/components/UI/TrackerModal/TrackerModal.jsx
@@ -1,16 +1,22 @@
-import React, { useState } from "react";
+import React, {useEffect, useState} from "react";
import { useDispatch, useSelector } from "react-redux";
import { apiRequest } from "../../../api/request";
+import { urlForLocal } from '../../../helper'
import {
+ setColumnName,
getProjectBoard,
getValueModalType,
setProject,
setProjectBoardFetch,
editProjectName,
- getColumnTitle,
+ editColumnName,
+ getColumnName,
+ getColumnId
} from "../../../redux/projectsTrackerSlice";
+import arrowDown from "../../../images/selectArrow.png"
+
import "./trackerModal.scss";
export const TrackerModal = ({
@@ -20,22 +26,22 @@ export const TrackerModal = ({
defautlInput,
titleProject,
projectId,
- titleColumn
+ priorityTask
}) => {
const dispatch = useDispatch();
const projectBoard = useSelector(getProjectBoard);
+ const columnName = useSelector(getColumnName);
+ const columnId = useSelector(getColumnId)
const modalType = useSelector(getValueModalType);
-
- const [emailWorker, setEmailWorker] = useState("");
const [projectName, setProjectName] = useState(defautlInput);
- const [editTitleColumn, setEditTitleColumn] = useState(titleColumn);
-
const [valueColumn, setValueColumn] = useState("");
const [nameProject, setNameProject] = useState("");
-
const [valueTiket, setValueTiket] = useState("");
const [descriptionTicket, setDescriptionTicket] = useState("");
+ const [workers, setWorkers] = useState([])
+ const [selectWorkersOpen, setSelectWorkersOpen] = useState(false)
+ const [selectedWorker, setSelectedWorker] = useState(null)
function createTab() {
if (!valueColumn) {
@@ -69,6 +75,7 @@ export const TrackerModal = ({
status: 1,
user_id: localStorage.getItem("id"),
column_id: selectedTab,
+ priority: priorityTask
},
}).then((res) => {
dispatch(setProjectBoardFetch(projectBoard.id));
@@ -92,6 +99,19 @@ export const TrackerModal = ({
});
}
+ function changeColumnName() {
+ apiRequest("/project-column/update-column", {
+ method: "PUT",
+ data: {
+ column_id: columnId,
+ title: columnName
+ }
+ }).then((res) => {
+ setActive(false);
+ dispatch(editColumnName({id: columnId, title: columnName}))
+ })
+ }
+
function createProject() {
if (nameProject === "") {
return;
@@ -112,6 +132,23 @@ export const TrackerModal = ({
}
}
+ function addUserToProject() {
+ apiRequest("/project/add-user", {
+ method: "POST",
+ data: {
+ user_id: selectedWorker.id,
+ project_id: projectBoard.id
+ }
+ }).then((el) => {
+ setActive(false);
+ selectedWorker(null)
+ })
+ }
+
+ useEffect(() => {
+ modalType === "addWorker" ? apiRequest('/project/my-employee').then((el) => setWorkers(el.managerEmployees)) : ''
+ }, [modalType])
+
return (
Добавьте участника
-
Введите имя или e-mail
-
-
setEmailWorker(e.target.value)}
- />
+ {/*
*/}
+ {/* setEmailWorker(e.target.value)}*/}
+ {/* />*/}
+ {/*
*/}
+
setSelectWorkersOpen(!selectWorkersOpen)}>
+
{selectedWorker ? selectedWorker.employee.fio : 'Выберите пользователя'}
+
+ {Boolean(selectWorkersOpen) &&
+
+ {workers.map((worker) => {
+ if (worker === selectedWorker) {
+ return
+ }
+ return
setSelectedWorker(worker)}>
+
{worker.employee.fio}
+
+
+ })
+ }
+
+ }
@@ -243,12 +294,12 @@ export const TrackerModal = ({
setEditTitleColumn(e.target.value)}
+ value={columnName}
+ onChange={(e) => dispatch(setColumnName(e.target.value))}
/>
-
diff --git a/src/components/UI/TrackerModal/trackerModal.scss b/src/components/UI/TrackerModal/trackerModal.scss
index ca46330b..ab934e11 100644
--- a/src/components/UI/TrackerModal/trackerModal.scss
+++ b/src/components/UI/TrackerModal/trackerModal.scss
@@ -61,6 +61,56 @@
font-size: 15px;
line-height: 18px;
}
+
+ .select__worker {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 5px;
+ background: white;
+ border-radius: 5px;
+ cursor: pointer;
+ width: 100%;
+ position: relative;
+
+ p {
+ max-width: 150px;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ font-size: 14px;
+ }
+
+ img {
+ transition: all 0.3s ease;
+ width: 16px;
+ height: 16px;
+ }
+
+ &__dropDown {
+ display: flex;
+ flex-direction: column;
+ position: absolute;
+ width: 100%;
+ padding: 5px;
+ top: 35px;
+ left: 0;
+ background: white;
+ border-radius: 5px;
+ row-gap: 5px;
+
+ .worker {
+ display: flex;
+ justify-content: space-between;
+ }
+ }
+ }
+
+ .open {
+ .arrow {
+ transform: rotate(180deg);
+ }
+ }
}
.name-project {
diff --git a/src/pages/ProjectTracker/ProjectTracker.js b/src/pages/ProjectTracker/ProjectTracker.js
index 842f85a0..854e5ced 100644
--- a/src/pages/ProjectTracker/ProjectTracker.js
+++ b/src/pages/ProjectTracker/ProjectTracker.js
@@ -16,7 +16,8 @@ import {
setProjectBoardFetch,
setToggleTab,
activeLoader,
- setColumnTitle,
+ setColumnName,
+ setColumnId,
} from "../../redux/projectsTrackerSlice";
import ModalTicket from "../../components/UI/ModalTicket/ModalTicket";
@@ -25,7 +26,6 @@ import TrackerModal from "../../components/UI/TrackerModal/TrackerModal";
import project from "../../images/trackerProject.svg";
import tasks from "../../images/trackerTasks.svg";
import archive from "../../images/archiveTracker.svg";
-import avatarTest from "../../images/AvatarTest .png";
import selectArrow from "../../images/select.svg";
import commentsBoard from "../../images/commentsBoard.svg";
import filesBoard from "../../images/filesBoard.svg";
@@ -39,6 +39,7 @@ export const ProjectTracker = () => {
const [openColumnSelect, setOpenColumnSelect] = useState({});
const [selectedTab, setSelectedTab] = useState(0);
+ const [priorityTask, setPriorityTask] = useState(0);
const [wrapperHover, setWrapperHover] = useState({});
const [modalAdd, setModalAdd] = useState(false);
const [modalActiveTicket, setModalActiveTicket] = useState(false);
@@ -125,10 +126,11 @@ export const ProjectTracker = () => {
}
}
- function selectedTabTask(columnId) {
+ function selectedTabTask(columnId, length) {
setSelectedTab(columnId);
dispatch(modalToggle("createTiketProject"));
setModalAdd(true);
+ setPriorityTask(length + 1)
}
function openTicket(e, task) {
@@ -196,6 +198,7 @@ export const ProjectTracker = () => {
active={modalAdd}
setActive={setModalAdd}
selectedTab={selectedTab}
+ priorityTask={priorityTask}
/>
{loader &&
}
@@ -217,9 +220,9 @@ export const ProjectTracker = () => {
добавить колонку