correctProjectUsers
This commit is contained in:
parent
bd82169b6a
commit
fc6feca92d
@ -76,6 +76,7 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
|
||||||
p {
|
p {
|
||||||
max-width: 150px;
|
max-width: 150px;
|
||||||
|
@ -3,7 +3,7 @@ import { Link } from "react-router-dom";
|
|||||||
import TrackerModal from "../../../components/Modal/TrackerModal/TrackerModal";
|
import TrackerModal from "../../../components/Modal/TrackerModal/TrackerModal";
|
||||||
import TrackerTaskComment from "../../../components/TrackerTaskComment/TrackerTaskComment";
|
import TrackerTaskComment from "../../../components/TrackerTaskComment/TrackerTaskComment";
|
||||||
import { apiRequest } from "../../../api/request";
|
import { apiRequest } from "../../../api/request";
|
||||||
import { useDispatch } from "react-redux";
|
import {useDispatch, useSelector} from "react-redux";
|
||||||
import "./modalTicket.scss"
|
import "./modalTicket.scss"
|
||||||
import {
|
import {
|
||||||
modalToggle,
|
modalToggle,
|
||||||
@ -24,6 +24,7 @@ import fullScreen from "../../../assets/icons/arrows/inFullScreen.svg";
|
|||||||
import close from "../../../assets/icons/closeProjectPersons.svg";
|
import close from "../../../assets/icons/closeProjectPersons.svg";
|
||||||
|
|
||||||
import {urlForLocal, getCorrectRequestDate} from "../../../utils/helper";
|
import {urlForLocal, getCorrectRequestDate} from "../../../utils/helper";
|
||||||
|
import {getProfileInfo} from "@redux/outstaffingSlice";
|
||||||
|
|
||||||
export const ModalTiсket = ({
|
export const ModalTiсket = ({
|
||||||
active,
|
active,
|
||||||
@ -51,6 +52,9 @@ export const ModalTiсket = ({
|
|||||||
seconds: 0
|
seconds: 0
|
||||||
})
|
})
|
||||||
const [timerId, setTimerId] = useState(null)
|
const [timerId, setTimerId] = useState(null)
|
||||||
|
const [correctProjectUsers, setCorrectProjectUsers] = useState(projectUsers)
|
||||||
|
const [executorId, setExecutorId] = useState(task.executor_id)
|
||||||
|
const profileInfo = useSelector(getProfileInfo);
|
||||||
|
|
||||||
function deleteTask() {
|
function deleteTask() {
|
||||||
apiRequest("/task/update-task", {
|
apiRequest("/task/update-task", {
|
||||||
@ -168,8 +172,10 @@ export const ModalTiсket = ({
|
|||||||
executor_id: person.user_id
|
executor_id: person.user_id
|
||||||
},
|
},
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
|
setExecutorId(person.user_id)
|
||||||
setDropListOpen(false)
|
setDropListOpen(false)
|
||||||
setExecutor(res.executor)
|
setExecutor(res.executor)
|
||||||
|
dispatch(setProjectBoardFetch(projectId));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +187,9 @@ export const ModalTiсket = ({
|
|||||||
executor_id: 0
|
executor_id: 0
|
||||||
},
|
},
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
setExecutor(null)
|
setExecutorId(null)
|
||||||
|
setExecutor(null);
|
||||||
|
dispatch(setProjectBoardFetch(projectId));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,6 +203,7 @@ export const ModalTiсket = ({
|
|||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
setDropListMembersOpen(false)
|
setDropListMembersOpen(false)
|
||||||
setMembers((prevValue) => ([...prevValue, res]))
|
setMembers((prevValue) => ([...prevValue, res]))
|
||||||
|
dispatch(setProjectBoardFetch(projectId));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +215,8 @@ export const ModalTiсket = ({
|
|||||||
user_id: person.user_id
|
user_id: person.user_id
|
||||||
},
|
},
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
setMembers(members.filter((item) => item.user_id !== person.user_id))
|
setMembers(members.filter((item) => item.user_id !== person.user_id));
|
||||||
|
dispatch(setProjectBoardFetch(projectId));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,6 +253,16 @@ export const ModalTiсket = ({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (localStorage.getItem("role_status") !== "18" && Boolean(!correctProjectUsers.find((item) => item.user_id === profileInfo.id_user))) {
|
||||||
|
setCorrectProjectUsers((prevState) => [...prevState, {
|
||||||
|
user: {
|
||||||
|
avatar: profileInfo.photo,
|
||||||
|
fio: profileInfo.fio
|
||||||
|
},
|
||||||
|
user_id: profileInfo.id_user
|
||||||
|
}])
|
||||||
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
function startTimer () {
|
function startTimer () {
|
||||||
@ -313,23 +333,24 @@ export const ModalTiсket = ({
|
|||||||
setInputsValue((prevValue) => ({...prevValue, title: e.target.value}))
|
setInputsValue((prevValue) => ({...prevValue, title: e.target.value}))
|
||||||
}} /> :<h5>{inputsValue.title}</h5>}
|
}} /> :<h5>{inputsValue.title}</h5>}
|
||||||
<div className="content__description">
|
<div className="content__description">
|
||||||
{editOpen ? <input value={inputsValue.description} onChange={(e) => {
|
{editOpen ?
|
||||||
|
<textarea value={inputsValue.description} onChange={(e) => {
|
||||||
setInputsValue((prevValue) => ({...prevValue, description: e.target.value}))
|
setInputsValue((prevValue) => ({...prevValue, description: e.target.value}))
|
||||||
}}/> :<p>{inputsValue.description}</p>}
|
}}/> :<p>{inputsValue.description}</p>}
|
||||||
{/*<img src={taskImg} className="image-task"></img>*/}
|
{/*<img src={taskImg} className="image-task"></img>*/}
|
||||||
</div>
|
</div>
|
||||||
<div className="content__communication">
|
<div className="content__communication">
|
||||||
<p className="tasks">
|
{/*<p className="tasks">*/}
|
||||||
<button
|
{/* <button*/}
|
||||||
onClick={() => {
|
{/* onClick={() => {*/}
|
||||||
dispatch(modalToggle("addSubtask"));
|
{/* dispatch(modalToggle("addSubtask"));*/}
|
||||||
setAddSubtask(true);
|
{/* setAddSubtask(true);*/}
|
||||||
}}
|
{/* }}*/}
|
||||||
>
|
{/* >*/}
|
||||||
<img src={plus}></img>
|
{/* <img src={plus}></img>*/}
|
||||||
Добавить под задачу
|
{/* Добавить под задачу*/}
|
||||||
</button>
|
{/* </button>*/}
|
||||||
</p>
|
{/*</p>*/}
|
||||||
<p className="file">
|
<p className="file">
|
||||||
<button>
|
<button>
|
||||||
<img src={file}></img>
|
<img src={file}></img>
|
||||||
@ -378,7 +399,7 @@ export const ModalTiсket = ({
|
|||||||
{dropListOpen &&
|
{dropListOpen &&
|
||||||
<div className='dropdownList'>
|
<div className='dropdownList'>
|
||||||
<img src={close} className='dropdownList__close' onClick={() => setDropListOpen(false)} />
|
<img src={close} className='dropdownList__close' onClick={() => setDropListOpen(false)} />
|
||||||
{projectUsers.map((person) => {
|
{correctProjectUsers.map((person) => {
|
||||||
return <div className='dropdownList__person' key={person.user_id} onClick={() => taskExecutor(person)}>
|
return <div className='dropdownList__person' key={person.user_id} onClick={() => taskExecutor(person)}>
|
||||||
<span>{person.user.fio}</span>
|
<span>{person.user.fio}</span>
|
||||||
<img src={urlForLocal(person.user.avatar)} />
|
<img src={urlForLocal(person.user.avatar)} />
|
||||||
@ -434,12 +455,17 @@ export const ModalTiсket = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{timerStart ?
|
{timerStart ?
|
||||||
<button className="stop" onClick={() => stopTaskTimer()}>
|
<button
|
||||||
|
className={executorId === Number(localStorage.getItem('id')) ? 'stop' : 'stop disable'}
|
||||||
|
onClick={() => stopTaskTimer()}>
|
||||||
Остановить
|
Остановить
|
||||||
</button>
|
</button>
|
||||||
:
|
:
|
||||||
<button className={task.executor_id === Number(localStorage.getItem('id')) ? 'start' : 'start disable'} onClick={() => startTaskTimer()}>
|
<button
|
||||||
Начать делать <img src={arrow}></img>
|
className={executorId === Number(localStorage.getItem('id')) ? 'start' : 'start disable'}
|
||||||
|
onClick={() => startTaskTimer()}>
|
||||||
|
Начать делать
|
||||||
|
<img src={arrow}></img>
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
@ -248,6 +248,16 @@
|
|||||||
margin: 10px 0 20px 0;
|
margin: 10px 0 20px 0;
|
||||||
max-width: 330px;
|
max-width: 330px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
height: 100px;
|
||||||
|
outline: none;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 140%;
|
||||||
|
color: #252c32;
|
||||||
|
resize: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__communication {
|
&__communication {
|
||||||
@ -279,7 +289,7 @@
|
|||||||
|
|
||||||
.file {
|
.file {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-left: 20px;
|
margin-left: 7px;
|
||||||
|
|
||||||
button {
|
button {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -365,7 +365,7 @@
|
|||||||
&__items {
|
&__items {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
row-gap: 60px;
|
row-gap: 10px;
|
||||||
column-gap: 35px;
|
column-gap: 35px;
|
||||||
margin-bottom: 38px;
|
margin-bottom: 38px;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user