import React, { useEffect, useState } from "react"; import { ProfileHeader } from "../../components/ProfileHeader/ProfileHeader"; import { ProfileBreadcrumbs } from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs"; import { Footer } from "../../components/Footer/Footer"; import { apiRequest } from "../../api/request"; import { Navigation } from "../../components/Navigation/Navigation"; import { useDispatch, useSelector } from "react-redux"; import { setAllProjects, getProjects, setToggleTab, getToggleTab, modalToggle, } from "../../redux/projectsTrackerSlice"; import TrackerModal from "../../components/UI/TrackerModal/TrackerModal"; import ProjectTiket from "../../components/ProjectTiket/ProjectTiket"; import { urlForLocal } from "../../helper"; import { getCorrectDate } from "../../components/Calendar/calendarHelper"; import { Loader } from "../../components/Loader/Loader"; import project from "../../images/trackerProject.svg"; import tasks from "../../images/trackerTasks.svg"; import archive from "../../images/archiveTracker.svg"; import avatarTest from "../../images/AvatarTest .png"; import search from "../../images/serchIcon.png"; import noProjects from "../../images/noProjects.png"; import "./tracker.scss"; export const Tracker = () => { const dispatch = useDispatch(); const projects = useSelector(getProjects); const tab = useSelector(getToggleTab); const [allTasks, setAllTasks] = useState([]); const [filteredAllTasks, setFilteredAllTasks] = useState([]); const [loader, setLoader] = useState(false); const [filterCompleteTasks, setFilterCompleteTasks] = useState([]); // const [allCompletedTasks, setAllCompletedTasks] = useState([]) const [modalCreateProject, setModalCreateProject] = useState(false); useEffect(() => { setLoader(true); apiRequest( `/project/project-list?user_id=${localStorage.getItem( "id" )}&expand=columns` ).then((el) => { dispatch(setAllProjects(el.projects)); setLoader(false); // setAllCompletedTasks(el.projects.filter((project) => { // if (project.status === 10 && project.columns.length) { // return project // } // }).map((project) => { return project.columns})) }); apiRequest( `/task/get-user-tasks?user_id=${localStorage.getItem("id")}` ).then((el) => { setAllTasks(el); setFilteredAllTasks(el); }); }, []); const toggleTabs = (index) => { dispatch(setToggleTab(index)); }; function filterAllTask(e) { setFilteredAllTasks( allTasks.filter((item) => { if (!e.target.value) { return item; } if ( item.title.toLowerCase().startsWith(e.target.value.toLowerCase()) || item.description .toLowerCase() .startsWith(e.target.value.toLowerCase()) ) { return item; } }) ); } function filterArchiveTasks(e) { // setFilterCompleteTasks( // completeTasks.filter((item) => { // if (!e.target.value) { // return item; // } // if ( // item.name.toLowerCase().startsWith(e.target.value.toLowerCase()) || // item.description // .toLowerCase() // .startsWith(e.target.value.toLowerCase()) // ) { // return item; // } // }) // ); } return (
Проекты
Все мои задачи
Архив
Создайте свой первый проект
Ставьте задачи, следите за прогрессом, ведите учёт рабочего времени
Ставьте задачи, следите за прогрессом, ведите учёт рабочего времени
{task.description}
{task.user.fio}
{getCorrectDate(task.created_at)}{filterCompleteTasks.length} задач(а)
{task.description}
{task.dateComplete}
{task.project}
В архиве задач нет
{projects.filter((project) => project.status === 10).length} проект(ов)
{project.name}
{project.date}
В архиве проектов нет