tracker
This commit is contained in:
parent
f9ebddd606
commit
a443bad839
@ -33,7 +33,8 @@ export const ModalTiсket = ({
|
|||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const [addSubtask, setAddSubtask] = useState(false);
|
const [addSubtask, setAddSubtask] = useState(false);
|
||||||
const [editOpen, setEditOpen] = useState(false);
|
const [editOpen, setEditOpen] = useState(false);
|
||||||
const [inputsValue, setInputsValue] = useState({title: task.title, description: task.description})
|
const [inputsValue, setInputsValue] = useState({title: task.title, description: task.description, comment: ''});
|
||||||
|
const [comments, setComments] = useState([]);
|
||||||
|
|
||||||
function deleteTask() {
|
function deleteTask() {
|
||||||
apiRequest("/task/update-task", {
|
apiRequest("/task/update-task", {
|
||||||
@ -61,6 +62,23 @@ export const ModalTiсket = ({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function editComment() {
|
||||||
|
apiRequest("/comment/create", {
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
text: inputsValue.comment,
|
||||||
|
entity_type: 2,
|
||||||
|
entity_id: task.id
|
||||||
|
}
|
||||||
|
}).then((res) => {
|
||||||
|
setInputsValue((prevValue) => ({...prevValue, comment: ''}))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
apiRequest(`/comment/get-by-entity?entity_type=2&entity_id=${task.id}`).then((res) => setComments(res))
|
||||||
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={active ? "modal-tiket active" : "modal-tiket"}
|
className={active ? "modal-tiket active" : "modal-tiket"}
|
||||||
@ -115,8 +133,10 @@ export const ModalTiсket = ({
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="content__input">
|
<div className="content__input">
|
||||||
<input placeholder="Оставить комментарий"></input>
|
<input placeholder="Оставить комментарий" value={inputsValue.comment} onChange={(e) => {
|
||||||
<img src={send}></img>
|
setInputsValue((prevValue) => ({...prevValue, comment: e.target.value}))
|
||||||
|
}} />
|
||||||
|
<img src={send} onClick={editComment}></img>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -39,13 +39,15 @@ export const TicketFullScreen = ({}) => {
|
|||||||
const [projectInfo, setProjectInfo] = useState({});
|
const [projectInfo, setProjectInfo] = useState({});
|
||||||
const [taskInfo, setTaskInfo] = useState({});
|
const [taskInfo, setTaskInfo] = useState({});
|
||||||
const [editOpen, setEditOpen] = useState(false);
|
const [editOpen, setEditOpen] = useState(false);
|
||||||
const [inputsValue, setInputsValue] = useState({})
|
const [inputsValue, setInputsValue] = useState({});
|
||||||
const [loader, setLoader] = useState(true)
|
const [loader, setLoader] = useState(true);
|
||||||
|
const [comments, setComments] = useState([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
apiRequest(`/task/get-task?task_id=${ticketId.id}`).then((taskInfo) => {
|
apiRequest(`/task/get-task?task_id=${ticketId.id}`).then((taskInfo) => {
|
||||||
setTaskInfo(taskInfo);
|
setTaskInfo(taskInfo);
|
||||||
setInputsValue({title: taskInfo.title, description: taskInfo.description})
|
setInputsValue({title: taskInfo.title, description: taskInfo.description, comment: ''})
|
||||||
|
apiRequest(`/comment/get-by-entity?entity_type=2&entity_id=${taskInfo.id}`).then((res) => setComments(res))
|
||||||
apiRequest(`/project/get-project?project_id=${taskInfo.project_id}`).then(
|
apiRequest(`/project/get-project?project_id=${taskInfo.project_id}`).then(
|
||||||
(project) => {
|
(project) => {
|
||||||
setProjectInfo(project);
|
setProjectInfo(project);
|
||||||
@ -79,6 +81,19 @@ export const TicketFullScreen = ({}) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function editComment() {
|
||||||
|
apiRequest("/comment/create", {
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
text: inputsValue.comment,
|
||||||
|
entity_type: 2,
|
||||||
|
entity_id: taskInfo.id
|
||||||
|
}
|
||||||
|
}).then((res) => {
|
||||||
|
setInputsValue((prevValue) => ({...prevValue, comment: ''}))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const toggleTabs = (index) => {
|
const toggleTabs = (index) => {
|
||||||
dispatch(setToggleTab(index));
|
dispatch(setToggleTab(index));
|
||||||
};
|
};
|
||||||
@ -204,8 +219,10 @@ export const TicketFullScreen = ({}) => {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="content__input">
|
<div className="content__input">
|
||||||
<input placeholder="Оставить комментарий"></input>
|
<input placeholder="Оставить комментарий" value={inputsValue.comment} onChange={(e) => {
|
||||||
<img src={send}></img>
|
setInputsValue((prevValue) => ({...prevValue, comment: e.target.value}))
|
||||||
|
}} />
|
||||||
|
<img src={send} onClick={editComment}></img>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -142,17 +142,25 @@ export const TrackerModal = ({
|
|||||||
}).then((el) => {
|
}).then((el) => {
|
||||||
setActive(false);
|
setActive(false);
|
||||||
selectedWorker(null)
|
selectedWorker(null)
|
||||||
|
setSelectWorkersOpen(false)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
modalType === "addWorker" ? apiRequest('/project/my-employee').then((el) => setWorkers(el.managerEmployees)) : ''
|
modalType === "addWorker" ? apiRequest('/project/my-employee').then((el) => {
|
||||||
|
let persons = el.managerEmployees
|
||||||
|
projectBoard.projectUsers.forEach(person => persons.splice(persons.indexOf(person), 1))
|
||||||
|
setWorkers(persons)
|
||||||
|
}) : ''
|
||||||
}, [modalType])
|
}, [modalType])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={active ? "modal-add active" : "modal-add"}
|
className={active ? "modal-add active" : "modal-add"}
|
||||||
onClick={() => setActive(false)}
|
onClick={() => {
|
||||||
|
setActive(false)
|
||||||
|
setSelectWorkersOpen(false)
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<div className="modal-add__content" onClick={(e) => e.stopPropagation()}>
|
<div className="modal-add__content" onClick={(e) => e.stopPropagation()}>
|
||||||
{modalType === "addWorker" && (
|
{modalType === "addWorker" && (
|
||||||
@ -172,6 +180,9 @@ export const TrackerModal = ({
|
|||||||
{Boolean(selectWorkersOpen) &&
|
{Boolean(selectWorkersOpen) &&
|
||||||
<div className='select__worker__dropDown'>
|
<div className='select__worker__dropDown'>
|
||||||
{workers.map((worker) => {
|
{workers.map((worker) => {
|
||||||
|
if ((workers.length === 1 || 0) && worker === selectedWorker) {
|
||||||
|
return <p>Пользователей нет</p>
|
||||||
|
}
|
||||||
if (worker === selectedWorker) {
|
if (worker === selectedWorker) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user