select executor on create task
This commit is contained in:
parent
7c622d63a1
commit
bd3e2288ed
@ -1,6 +1,7 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
|
import { getProfileInfo } from "@redux/outstaffingSlice";
|
||||||
import {
|
import {
|
||||||
addPersonToProject,
|
addPersonToProject,
|
||||||
editColumnName,
|
editColumnName,
|
||||||
@ -16,8 +17,6 @@ import {
|
|||||||
setProjectBoardFetch,
|
setProjectBoardFetch,
|
||||||
} from "@redux/projectsTrackerSlice";
|
} from "@redux/projectsTrackerSlice";
|
||||||
|
|
||||||
import {getProfileInfo} from "@redux/outstaffingSlice";
|
|
||||||
|
|
||||||
import { urlForLocal } from "@utils/helper";
|
import { urlForLocal } from "@utils/helper";
|
||||||
|
|
||||||
import { apiRequest } from "@api/request";
|
import { apiRequest } from "@api/request";
|
||||||
@ -37,7 +36,7 @@ export const TrackerModal = ({
|
|||||||
titleProject,
|
titleProject,
|
||||||
projectId,
|
projectId,
|
||||||
priorityTask,
|
priorityTask,
|
||||||
projectUsers
|
projectUsers,
|
||||||
}) => {
|
}) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const projectBoard = useSelector(getProjectBoard);
|
const projectBoard = useSelector(getProjectBoard);
|
||||||
@ -58,8 +57,10 @@ export const TrackerModal = ({
|
|||||||
const [selectColumnPriority, setSelectColumnPriority] = useState(
|
const [selectColumnPriority, setSelectColumnPriority] = useState(
|
||||||
"Выберите приоритет колонки"
|
"Выберите приоритет колонки"
|
||||||
);
|
);
|
||||||
const [selectedExecutorTask, setSelectedExecutorTask] = useState('Выберите исполнителя задачи')
|
const [selectedExecutorTask, setSelectedExecutorTask] = useState(
|
||||||
const [selectExecutorTaskOpen, setSelectExecutorTaskOpen] = useState(false)
|
"Выберите исполнителя задачи"
|
||||||
|
);
|
||||||
|
const [selectExecutorTaskOpen, setSelectExecutorTaskOpen] = useState(false);
|
||||||
const [correctProjectUsers, setCorrectProjectUsers] = useState([]);
|
const [correctProjectUsers, setCorrectProjectUsers] = useState([]);
|
||||||
const [selectColumnPriorityOpen, setSelectColumnPriorityOpen] =
|
const [selectColumnPriorityOpen, setSelectColumnPriorityOpen] =
|
||||||
useState(false);
|
useState(false);
|
||||||
@ -114,8 +115,8 @@ export const TrackerModal = ({
|
|||||||
setActive(false);
|
setActive(false);
|
||||||
setValueTiket("");
|
setValueTiket("");
|
||||||
setDescriptionTicket("");
|
setDescriptionTicket("");
|
||||||
setSelectedExecutorTask('Выберите исполнителя задачи')
|
setSelectedExecutorTask("Выберите исполнителя задачи");
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
setActive(false);
|
setActive(false);
|
||||||
setValueTiket("");
|
setValueTiket("");
|
||||||
@ -237,9 +238,13 @@ export const TrackerModal = ({
|
|||||||
})
|
})
|
||||||
: "";
|
: "";
|
||||||
if (
|
if (
|
||||||
localStorage.getItem("role_status") !== "18" && projectUsers && Boolean(!projectUsers.find((item) => item.user_id === profileInfo.id_user))
|
localStorage.getItem("role_status") !== "18" &&
|
||||||
|
projectUsers &&
|
||||||
|
Boolean(
|
||||||
|
!projectUsers.find((item) => item.user_id === profileInfo.id_user)
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
setCorrectProjectUsers( [
|
setCorrectProjectUsers([
|
||||||
...projectUsers,
|
...projectUsers,
|
||||||
{
|
{
|
||||||
user: {
|
user: {
|
||||||
@ -250,7 +255,7 @@ export const TrackerModal = ({
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
setCorrectProjectUsers(projectUsers)
|
setCorrectProjectUsers(projectUsers);
|
||||||
}
|
}
|
||||||
}, [active]);
|
}, [active]);
|
||||||
|
|
||||||
@ -342,31 +347,51 @@ export const TrackerModal = ({
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
onClick={() => setSelectExecutorTaskOpen(!selectExecutorTaskOpen)}
|
onClick={() => setSelectExecutorTaskOpen(!selectExecutorTaskOpen)}
|
||||||
className={selectExecutorTaskOpen ? 'select__executor select__executor--open' : 'select__executor'}>
|
className={
|
||||||
<div className='selected__executor'>
|
selectExecutorTaskOpen
|
||||||
{selectedExecutorTask.user_id ?
|
? "select__executor select__executor--open"
|
||||||
|
: "select__executor"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<div className="selected__executor">
|
||||||
|
{selectedExecutorTask.user_id ? (
|
||||||
<>
|
<>
|
||||||
<span>{selectedExecutorTask.user.fio}</span>
|
<span>{selectedExecutorTask.user.fio}</span>
|
||||||
<img className='avatar' src={urlForLocal(selectedExecutorTask.user.avatar)} alt='avatar' />
|
<img
|
||||||
|
className="avatar"
|
||||||
|
src={urlForLocal(selectedExecutorTask.user.avatar)}
|
||||||
|
alt="avatar"
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
: <span>{selectedExecutorTask}</span>
|
) : (
|
||||||
}
|
<span>{selectedExecutorTask}</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<img className='arrow' src={arrowDown} alt='arrow' />
|
<img className="arrow" src={arrowDown} alt="arrow" />
|
||||||
{selectExecutorTaskOpen &&
|
{selectExecutorTaskOpen && (
|
||||||
<div className='select__executor__dropDown'>
|
<div className="select__executor__dropDown">
|
||||||
{correctProjectUsers.length ?
|
{correctProjectUsers.length ? (
|
||||||
correctProjectUsers.map((person) => {
|
correctProjectUsers.map((person) => {
|
||||||
return <div onClick={() => setSelectedExecutorTask(person)} className='executor' key={person.user_id}>
|
return (
|
||||||
|
<div
|
||||||
|
onClick={() => setSelectedExecutorTask(person)}
|
||||||
|
className="executor"
|
||||||
|
key={person.user_id}
|
||||||
|
>
|
||||||
<span>{person.user.fio}</span>
|
<span>{person.user.fio}</span>
|
||||||
<img className='avatar' src={urlForLocal(person.user.avatar)} alt='avatar'/>
|
<img
|
||||||
|
className="avatar"
|
||||||
|
src={urlForLocal(person.user.avatar)}
|
||||||
|
alt="avatar"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
);
|
||||||
})
|
})
|
||||||
: <span>Нет пользователей</span>
|
) : (
|
||||||
|
<span>Нет пользователей</span>
|
||||||
}
|
)}
|
||||||
</div>
|
</div>
|
||||||
}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<BaseButton styles={"button-add"} onClick={createTiket}>
|
<BaseButton styles={"button-add"} onClick={createTiket}>
|
||||||
@ -456,7 +481,11 @@ export const TrackerModal = ({
|
|||||||
</div>
|
</div>
|
||||||
<h4>Приоритет колонки</h4>
|
<h4>Приоритет колонки</h4>
|
||||||
<div
|
<div
|
||||||
className={selectColumnPriorityOpen ? 'select-priority select-priority--open' : 'select-priority'}
|
className={
|
||||||
|
selectColumnPriorityOpen
|
||||||
|
? "select-priority select-priority--open"
|
||||||
|
: "select-priority"
|
||||||
|
}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
setSelectColumnPriorityOpen(!selectColumnPriorityOpen)
|
setSelectColumnPriorityOpen(!selectColumnPriorityOpen)
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ export const ProjectTiket = ({ project, index }) => {
|
|||||||
initListeners();
|
initListeners();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
function initListeners() {
|
function initListeners() {
|
||||||
document.addEventListener("click", closeByClickingOut);
|
document.addEventListener("click", closeByClickingOut);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user