Added func create new tiket
This commit is contained in:
parent
a21063663c
commit
fc51fbdb09
@ -232,9 +232,19 @@ export const Tracker = () => {
|
|||||||
|
|
||||||
const [filterCompleteTasks, setFilterCompleteTasks] = useState(completeTasks);
|
const [filterCompleteTasks, setFilterCompleteTasks] = useState(completeTasks);
|
||||||
|
|
||||||
|
// Modal State
|
||||||
const [modalActiveTicket, setModalActiveTicket] = useState(false);
|
const [modalActiveTicket, setModalActiveTicket] = useState(false);
|
||||||
const [modalCreateProject, setModalCreateProject] = useState(false);
|
const [modalCreateProject, setModalCreateProject] = useState(false);
|
||||||
const [modalCreateColl, setModalCreateColl] = 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 [startWrapperIndex, setStartWrapperIndex] = useState(null);
|
||||||
const [wrapperHover, setWrapperHover] = useState([
|
const [wrapperHover, setWrapperHover] = useState([
|
||||||
@ -343,8 +353,29 @@ export const Tracker = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createProject() {
|
function selectedTabTask(e, wrapperIndex, name, tasks) {
|
||||||
setModalCreateProject(true);
|
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 (
|
return (
|
||||||
@ -402,7 +433,7 @@ export const Tracker = () => {
|
|||||||
setActive={setModalCreateProject}
|
setActive={setModalCreateProject}
|
||||||
title={"Укажите название проекта:"}
|
title={"Укажите название проекта:"}
|
||||||
/>
|
/>
|
||||||
<button onClick={createProject}>
|
<button onClick={() => setModalCreateProject(true)}>
|
||||||
<span>+</span>Создать проект
|
<span>+</span>Создать проект
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -442,11 +473,38 @@ export const Tracker = () => {
|
|||||||
<img src={selectArrow} alt="arrow" />
|
<img src={selectArrow} alt="arrow" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ModalTiket
|
<ModalTiket
|
||||||
active={modalActiveTicket}
|
active={modalActiveTicket}
|
||||||
setActive={setModalActiveTicket}
|
setActive={setModalActiveTicket}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className={
|
||||||
|
modalCreateTiket ? "modal-project active" : "modal-project"
|
||||||
|
}
|
||||||
|
onClick={() => setModalCreateTiket(false)}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="modal-project__content"
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<div className="title-project">
|
||||||
|
<h4>Введите название карточки</h4>
|
||||||
|
<div className="input-container">
|
||||||
|
<input
|
||||||
|
className="name-project"
|
||||||
|
value={valueTiket}
|
||||||
|
onChange={(e) => setValueTiket(e.target.value)}
|
||||||
|
></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button className="create-project" onClick={createTiket}>
|
||||||
|
Создать
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="tasks__container">
|
<div className="tasks__container">
|
||||||
{tabTaskMok.map((section, wrapperIndex) => {
|
{tabTaskMok.map((section, wrapperIndex) => {
|
||||||
return (
|
return (
|
||||||
@ -468,7 +526,19 @@ export const Tracker = () => {
|
|||||||
{section.name}
|
{section.name}
|
||||||
</span>
|
</span>
|
||||||
<div>
|
<div>
|
||||||
<span className="add">+</span>
|
<span
|
||||||
|
className="add"
|
||||||
|
onClick={(e) =>
|
||||||
|
selectedTabTask(
|
||||||
|
e,
|
||||||
|
wrapperIndex,
|
||||||
|
section.name,
|
||||||
|
section.tasks
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
+
|
||||||
|
</span>
|
||||||
<span className="more">...</span>
|
<span className="more">...</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user