import React, { useEffect, useState } from "react"; import { ProfileHeader } from "../../ProfileHeader/ProfileHeader"; import { ProfileBreadcrumbs } from "../../ProfileBreadcrumbs/ProfileBreadcrumbs"; import { Footer } from "../../Footer/Footer"; import { Link, useParams, useNavigate } from "react-router-dom"; import TrackerModal from "../TrackerModal/TrackerModal"; import { Navigation } from "../../Navigation/Navigation"; import {Loader} from "../../Loader/Loader"; import { useDispatch } from "react-redux"; import {modalToggle, setToggleTab} from "../../../redux/projectsTrackerSlice"; import { apiRequest } from "../../../api/request"; import project from "../../../images/trackerProject.svg"; import watch from "../../../images/watch.png"; import file from "../../../images/fileModal.svg"; import task from "../../../images/tasksMock.png"; import send from "../../../images/send.svg"; import arrow2 from "../../../images/arrowStart.png"; import plus from "../../../images/plus.svg"; import tasks from "../../../images/trackerTasks.svg"; import archive from "../../../images/archiveTracker.svg"; import selectArrow from "../../../images/select.svg"; import avatarTest from "../../../images/AvatarTest .png"; import arrow from "../../../images/arrowCalendar.png"; import link from "../../../images/link.svg"; import archive2 from "../../../images/archive.svg"; import del from "../../../images/delete.svg"; import edit from "../../../images/edit.svg"; import "./ticketFullScreen.scss"; export const TicketFullScreen = ({}) => { const [modalAddWorker, setModalAddWorker] = useState(false); const ticketId = useParams(); const dispatch = useDispatch(); const navigate = useNavigate(); const [projectInfo, setProjectInfo] = useState({}); const [taskInfo, setTaskInfo] = useState({}); const [editOpen, setEditOpen] = useState(false); const [inputsValue, setInputsValue] = useState({}) const [loader, setLoader] = useState(true) useEffect(() => { apiRequest(`/task/get-task?task_id=${ticketId.id}`).then((taskInfo) => { setTaskInfo(taskInfo); setInputsValue({title: taskInfo.title, description: taskInfo.description}) apiRequest(`/project/get-project?project_id=${taskInfo.project_id}`).then( (project) => { setProjectInfo(project); setLoader(false) } ); }); }, []); function deleteTask() { apiRequest("/task/update-task", { method: "PUT", data: { task_id: ticketId.id, status: 0, }, }).then((res) => { navigate(`/tracker/project/${taskInfo.project_id}`); }); } function editTask() { apiRequest("/task/update-task", { method: "PUT", data: { task_id: taskInfo.id, title: inputsValue.title, description: inputsValue.description }, }).then((res) => { }); } const toggleTabs = (index) => { dispatch(setToggleTab(index)); }; return (

Управление проектами с трекером

toggleTabs(1)} > img

Проекты

toggleTabs(2)} > img

Все мои задачи

toggleTabs(3)} > img

Архив

{loader ? : <>

Проект : {projectInfo.name}

avatar avatar +9 { dispatch(modalToggle("addWorker")); setModalAddWorker(true); }} > +

добавить участника в проект

Учавствую arrow
Мои arrow

Вернуться на проекты

arrow
Задача {editOpen ? { setInputsValue((prevValue) => ({...prevValue, title: e.target.value})) }} /> :
{inputsValue.title}
}
{editOpen ? { setInputsValue((prevValue) => ({...prevValue, description: e.target.value})) }}/> :

{inputsValue.description}

}

{0} Файлов

Создатель : {taskInfo.user?.fio}

{Boolean(taskInfo.taskUsers?.length) && taskInfo.taskUsers.map((worker, index) => { return (

{worker.name}

); })}
Добавить участников
Длительность :

{"8:30:22"}

{ if(editOpen) { setEditOpen(!editOpen) editTask() } else { setEditOpen(!editOpen) } }}>

{editOpen ? 'сохранить' : 'редактировать'}

ссылка на проект

в архив

удалить

}
); }; export default TicketFullScreen;