From fc51fbdb096ccaca7c8f7b5d51ada4256c9130bd Mon Sep 17 00:00:00 2001 From: MaxOvs19 Date: Fri, 24 Mar 2023 19:26:27 +0300 Subject: [PATCH] Added func create new tiket --- src/pages/Tracker/Tracker.js | 78 ++++++++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 4 deletions(-) diff --git a/src/pages/Tracker/Tracker.js b/src/pages/Tracker/Tracker.js index 7410e264..51c63cce 100644 --- a/src/pages/Tracker/Tracker.js +++ b/src/pages/Tracker/Tracker.js @@ -232,9 +232,19 @@ export const Tracker = () => { const [filterCompleteTasks, setFilterCompleteTasks] = useState(completeTasks); + // Modal State const [modalActiveTicket, setModalActiveTicket] = useState(false); const [modalCreateProject, setModalCreateProject] = useState(false); const [modalCreateColl, setModalCreateColl] = useState(false); + const [modalCreateTiket, setModalCreateTiket] = useState(false); + const [valueTiket, setValueTiket] = useState(""); + // + + const [selectedTab, setSelectedTab] = useState({ + name: "", + indexTab: 0, + task: [], + }); const [startWrapperIndex, setStartWrapperIndex] = useState(null); const [wrapperHover, setWrapperHover] = useState([ @@ -343,8 +353,29 @@ export const Tracker = () => { ); } - function createProject() { - setModalCreateProject(true); + function selectedTabTask(e, wrapperIndex, name, tasks) { + let tab = { name: name, indexTab: wrapperIndex, task: tasks }; + setSelectedTab(tab); + setModalCreateTiket(true); + } + + function createTiket() { + tabTaskMok.filter((item) => { + if (item.name == selectedTab.name) { + let newTiket = { + task: valueTiket, + description: "Сверстать часть таблицы. Сверстать часть таблицы", + comments: 0, + files: 0, + avatarCreated: avatarTest, + avatarDo: avatarTest, + id: item.tasks.length + 1, + }; + + item.tasks.push(newTiket); + } + }); + setModalCreateTiket(false); } return ( @@ -402,7 +433,7 @@ export const Tracker = () => { setActive={setModalCreateProject} title={"Укажите название проекта:"} /> - @@ -442,11 +473,38 @@ export const Tracker = () => { arrow + +
setModalCreateTiket(false)} + > +
e.stopPropagation()} + > +
+

Введите название карточки

+
+ setValueTiket(e.target.value)} + > +
+
+ +
+
+
{tabTaskMok.map((section, wrapperIndex) => { return ( @@ -468,7 +526,19 @@ export const Tracker = () => { {section.name}
- + + + selectedTabTask( + e, + wrapperIndex, + section.name, + section.tasks + ) + } + > + + + ...