This commit is contained in:
Николай Полтщук 2023-04-27 14:51:01 +03:00
parent 03bba43f67
commit 88162816c5
3 changed files with 31 additions and 8 deletions

View File

@ -1,6 +1,7 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { useDispatch } from "react-redux"; import { useDispatch } from "react-redux";
import { setProject } from "../../../redux/projectsTrackerSlice"; import { setProject } from "../../../redux/projectsTrackerSlice";
import {apiRequest} from "../../../api/request";
import "./ModalCreate.scss"; import "./ModalCreate.scss";
@ -16,9 +17,20 @@ export const ModalCreate = ({ active, setActive, title }) => {
name: inputValue, name: inputValue,
count: 0, count: 0,
}; };
dispatch(setProject(newItem)); apiRequest('/project/create', {
setActive(false); method: 'POST',
setInputValue(""); data: {
user_id: localStorage.getItem('id'),
name: inputValue,
status: 1,
// description: '',
// company_id: 3
}
}).then((res) => {
dispatch(setProject(newItem));
setActive(false);
setInputValue("");
})
} }
} }

View File

@ -23,9 +23,12 @@ import search from "../../images/serchIcon.png";
import noProjects from "../../images/noProjects.png"; import noProjects from "../../images/noProjects.png";
import arrow from "../../images/arrowCalendar.png"; import arrow from "../../images/arrowCalendar.png";
import "./tracker.scss"; import {apiRequest} from "../../api/request";
import { Navigation } from "../../components/Navigation/Navigation"; import { Navigation } from "../../components/Navigation/Navigation";
import "./tracker.scss";
export const Tracker = () => { export const Tracker = () => {
const [toggleTab, setToggleTab] = useState(1); const [toggleTab, setToggleTab] = useState(1);
const [tabTaskMok, setTabTaskMok] = useState([ const [tabTaskMok, setTabTaskMok] = useState([
@ -385,6 +388,12 @@ export const Tracker = () => {
false, false,
]); ]);
useEffect(() => {
apiRequest(`/project/project-list?user_id=${localStorage.getItem('id')}&expand=columns`).then((el) => {
})
}, [])
const projects = useSelector(getProjects); const projects = useSelector(getProjects);
const toggleTabs = (index) => { const toggleTabs = (index) => {
@ -689,7 +698,7 @@ export const Tracker = () => {
<div className="tasks__head__add"> <div className="tasks__head__add">
<span onClick={() => setModalCreateColl(true)}>+</span> <span onClick={() => setModalCreateColl(true)}>+</span>
<p>добавить задачу в проект</p> <p>добавить колонку</p>
</div> </div>
<div className="tasks__head__persons"> <div className="tasks__head__persons">
<img src={avatarTest} alt="avatar" /> <img src={avatarTest} alt="avatar" />
@ -698,10 +707,10 @@ export const Tracker = () => {
<span className="addPerson" onClick={setModalAddWorker}> <span className="addPerson" onClick={setModalAddWorker}>
+ +
</span> </span>
<p>добавить участника в проект</p> <p>добавить участника</p>
</div> </div>
<div className="tasks__head__select"> <div className="tasks__head__select">
<span>Учавствую</span> <span>Участвую</span>
<img src={selectArrow} alt="arrow" /> <img src={selectArrow} alt="arrow" />
</div> </div>
<div className="tasks__head__select"> <div className="tasks__head__select">

View File

@ -250,6 +250,8 @@
font-size: 14px; font-size: 14px;
line-height: 17px; line-height: 17px;
max-width: 120px; max-width: 120px;
display: flex;
align-items: center;
} }
} }
@ -294,7 +296,7 @@
background: #00c5a8; background: #00c5a8;
color: white; color: white;
font-size: 14px; font-size: 14px;
left: -35px; left: -30px;
z-index: 1; z-index: 1;
} }