fixes
This commit is contained in:
parent
56ef7061fa
commit
f9ebddd606
@ -1,7 +1,8 @@
|
|||||||
import React, { useState } from "react";
|
import React, {useEffect, useState} from "react";
|
||||||
|
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { apiRequest } from "../../../api/request";
|
import { apiRequest } from "../../../api/request";
|
||||||
|
import { urlForLocal } from '../../../helper'
|
||||||
import {
|
import {
|
||||||
setColumnName,
|
setColumnName,
|
||||||
getProjectBoard,
|
getProjectBoard,
|
||||||
@ -14,6 +15,8 @@ import {
|
|||||||
getColumnId
|
getColumnId
|
||||||
} from "../../../redux/projectsTrackerSlice";
|
} from "../../../redux/projectsTrackerSlice";
|
||||||
|
|
||||||
|
import arrowDown from "../../../images/selectArrow.png"
|
||||||
|
|
||||||
import "./trackerModal.scss";
|
import "./trackerModal.scss";
|
||||||
|
|
||||||
export const TrackerModal = ({
|
export const TrackerModal = ({
|
||||||
@ -23,6 +26,7 @@ export const TrackerModal = ({
|
|||||||
defautlInput,
|
defautlInput,
|
||||||
titleProject,
|
titleProject,
|
||||||
projectId,
|
projectId,
|
||||||
|
priorityTask
|
||||||
}) => {
|
}) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const projectBoard = useSelector(getProjectBoard);
|
const projectBoard = useSelector(getProjectBoard);
|
||||||
@ -30,15 +34,14 @@ export const TrackerModal = ({
|
|||||||
const columnId = useSelector(getColumnId)
|
const columnId = useSelector(getColumnId)
|
||||||
|
|
||||||
const modalType = useSelector(getValueModalType);
|
const modalType = useSelector(getValueModalType);
|
||||||
|
|
||||||
const [emailWorker, setEmailWorker] = useState("");
|
|
||||||
const [projectName, setProjectName] = useState(defautlInput);
|
const [projectName, setProjectName] = useState(defautlInput);
|
||||||
|
|
||||||
const [valueColumn, setValueColumn] = useState("");
|
const [valueColumn, setValueColumn] = useState("");
|
||||||
const [nameProject, setNameProject] = useState("");
|
const [nameProject, setNameProject] = useState("");
|
||||||
|
|
||||||
const [valueTiket, setValueTiket] = useState("");
|
const [valueTiket, setValueTiket] = useState("");
|
||||||
const [descriptionTicket, setDescriptionTicket] = useState("");
|
const [descriptionTicket, setDescriptionTicket] = useState("");
|
||||||
|
const [workers, setWorkers] = useState([])
|
||||||
|
const [selectWorkersOpen, setSelectWorkersOpen] = useState(false)
|
||||||
|
const [selectedWorker, setSelectedWorker] = useState(null)
|
||||||
|
|
||||||
function createTab() {
|
function createTab() {
|
||||||
if (!valueColumn) {
|
if (!valueColumn) {
|
||||||
@ -72,6 +75,7 @@ export const TrackerModal = ({
|
|||||||
status: 1,
|
status: 1,
|
||||||
user_id: localStorage.getItem("id"),
|
user_id: localStorage.getItem("id"),
|
||||||
column_id: selectedTab,
|
column_id: selectedTab,
|
||||||
|
priority: priorityTask
|
||||||
},
|
},
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
dispatch(setProjectBoardFetch(projectBoard.id));
|
dispatch(setProjectBoardFetch(projectBoard.id));
|
||||||
@ -128,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 (
|
return (
|
||||||
<div
|
<div
|
||||||
className={active ? "modal-add active" : "modal-add"}
|
className={active ? "modal-add active" : "modal-add"}
|
||||||
@ -138,21 +159,35 @@ export const TrackerModal = ({
|
|||||||
<div>
|
<div>
|
||||||
<div className="title-project">
|
<div className="title-project">
|
||||||
<h4>Добавьте участника</h4>
|
<h4>Добавьте участника</h4>
|
||||||
<p className="title-project__decs">Введите имя или e-mail </p>
|
{/*<div className="input-container">*/}
|
||||||
<div className="input-container">
|
{/* <input*/}
|
||||||
<input
|
{/* className="name-project"*/}
|
||||||
className="name-project"
|
{/* value={emailWorker}*/}
|
||||||
value={emailWorker}
|
{/* onChange={(e) => setEmailWorker(e.target.value)}*/}
|
||||||
onChange={(e) => setEmailWorker(e.target.value)}
|
{/* />*/}
|
||||||
/>
|
{/*</div>*/}
|
||||||
|
<div className={selectWorkersOpen ? 'select__worker open' : 'select__worker'} onClick={() => setSelectWorkersOpen(!selectWorkersOpen)}>
|
||||||
|
<p>{selectedWorker ? selectedWorker.employee.fio : 'Выберите пользователя'}</p>
|
||||||
|
<img className='arrow' src={arrowDown} alt='arrow' />
|
||||||
|
{Boolean(selectWorkersOpen) &&
|
||||||
|
<div className='select__worker__dropDown'>
|
||||||
|
{workers.map((worker) => {
|
||||||
|
if (worker === selectedWorker) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return <div className='worker' key={worker.id} onClick={() => setSelectedWorker(worker)}>
|
||||||
|
<p>{worker.employee.fio}</p>
|
||||||
|
<img src={urlForLocal(worker.employee.avatar)} alt='avatar'/>
|
||||||
|
</div>
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
className="button-add"
|
className="button-add"
|
||||||
onClick={(e) => {
|
onClick={addUserToProject}
|
||||||
e.preventDefault();
|
|
||||||
setActive(false);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
Добавить
|
Добавить
|
||||||
</button>
|
</button>
|
||||||
|
@ -61,6 +61,56 @@
|
|||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
line-height: 18px;
|
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 {
|
.name-project {
|
||||||
|
@ -26,7 +26,6 @@ import TrackerModal from "../../components/UI/TrackerModal/TrackerModal";
|
|||||||
import project from "../../images/trackerProject.svg";
|
import project from "../../images/trackerProject.svg";
|
||||||
import tasks from "../../images/trackerTasks.svg";
|
import tasks from "../../images/trackerTasks.svg";
|
||||||
import archive from "../../images/archiveTracker.svg";
|
import archive from "../../images/archiveTracker.svg";
|
||||||
import avatarTest from "../../images/AvatarTest .png";
|
|
||||||
import selectArrow from "../../images/select.svg";
|
import selectArrow from "../../images/select.svg";
|
||||||
import commentsBoard from "../../images/commentsBoard.svg";
|
import commentsBoard from "../../images/commentsBoard.svg";
|
||||||
import filesBoard from "../../images/filesBoard.svg";
|
import filesBoard from "../../images/filesBoard.svg";
|
||||||
@ -40,6 +39,7 @@ export const ProjectTracker = () => {
|
|||||||
|
|
||||||
const [openColumnSelect, setOpenColumnSelect] = useState({});
|
const [openColumnSelect, setOpenColumnSelect] = useState({});
|
||||||
const [selectedTab, setSelectedTab] = useState(0);
|
const [selectedTab, setSelectedTab] = useState(0);
|
||||||
|
const [priorityTask, setPriorityTask] = useState(0);
|
||||||
const [wrapperHover, setWrapperHover] = useState({});
|
const [wrapperHover, setWrapperHover] = useState({});
|
||||||
const [modalAdd, setModalAdd] = useState(false);
|
const [modalAdd, setModalAdd] = useState(false);
|
||||||
const [modalActiveTicket, setModalActiveTicket] = useState(false);
|
const [modalActiveTicket, setModalActiveTicket] = useState(false);
|
||||||
@ -126,10 +126,11 @@ export const ProjectTracker = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectedTabTask(columnId) {
|
function selectedTabTask(columnId, length) {
|
||||||
setSelectedTab(columnId);
|
setSelectedTab(columnId);
|
||||||
dispatch(modalToggle("createTiketProject"));
|
dispatch(modalToggle("createTiketProject"));
|
||||||
setModalAdd(true);
|
setModalAdd(true);
|
||||||
|
setPriorityTask(length + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
function openTicket(e, task) {
|
function openTicket(e, task) {
|
||||||
@ -197,6 +198,7 @@ export const ProjectTracker = () => {
|
|||||||
active={modalAdd}
|
active={modalAdd}
|
||||||
setActive={setModalAdd}
|
setActive={setModalAdd}
|
||||||
selectedTab={selectedTab}
|
selectedTab={selectedTab}
|
||||||
|
priorityTask={priorityTask}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{loader && <Loader style="green" />}
|
{loader && <Loader style="green" />}
|
||||||
@ -277,7 +279,7 @@ export const ProjectTracker = () => {
|
|||||||
<div>
|
<div>
|
||||||
<span
|
<span
|
||||||
className="add"
|
className="add"
|
||||||
onClick={() => selectedTabTask(column.id)}
|
onClick={() => selectedTabTask(column.id, column.tasks.length)}
|
||||||
>
|
>
|
||||||
+
|
+
|
||||||
</span>
|
</span>
|
||||||
@ -322,11 +324,11 @@ export const ProjectTracker = () => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{column.tasks.map((task, index) => {
|
{column.tasks.map((task, index) => {
|
||||||
if (index > 2) {
|
// if (index > 2) {
|
||||||
if (!column.open) {
|
// if (!column.open) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={task.id}
|
key={task.id}
|
||||||
@ -347,7 +349,7 @@ export const ProjectTracker = () => {
|
|||||||
<div className="tasks__board__item__info">
|
<div className="tasks__board__item__info">
|
||||||
<div className="tasks__board__item__info__more">
|
<div className="tasks__board__item__info__more">
|
||||||
<img src={commentsBoard} alt="commentsImg" />
|
<img src={commentsBoard} alt="commentsImg" />
|
||||||
<span>{task.comments} коментариев</span>
|
<span>{task.comment_count} коментариев</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="tasks__board__item__info__more">
|
<div className="tasks__board__item__info__more">
|
||||||
<img src={filesBoard} alt="filesImg" />
|
<img src={filesBoard} alt="filesImg" />
|
||||||
@ -361,18 +363,18 @@ export const ProjectTracker = () => {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
{column.tasks.length > 3 && (
|
{/*{column.tasks.length > 3 && (*/}
|
||||||
<span
|
{/* <span*/}
|
||||||
className={
|
{/* className={*/}
|
||||||
column.open
|
{/* column.open*/}
|
||||||
? "lessItems openItems"
|
{/* ? "lessItems openItems"*/}
|
||||||
: "moreItems openItems"
|
{/* : "moreItems openItems"*/}
|
||||||
}
|
{/* }*/}
|
||||||
// onClick={() => toggleMoreTasks(column.id)}
|
{/* // onClick={() => toggleMoreTasks(column.id)}*/}
|
||||||
>
|
{/* >*/}
|
||||||
{column.open ? "-" : "+"}
|
{/* {column.open ? "-" : "+"}*/}
|
||||||
</span>
|
{/* </span>*/}
|
||||||
)}
|
{/*)}*/}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
@ -453,6 +453,8 @@
|
|||||||
|
|
||||||
&__more {
|
&__more {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
span {
|
span {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
Loading…
Reference in New Issue
Block a user