Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
planner-team-one
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
21
Issues
21
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Евгений Положенцев
planner-team-one
Commits
3deb8fcb
Commit
3deb8fcb
authored
Jan 13, 2023
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#138
added filtration active project button
parent
eb22fe70
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
8 deletions
+48
-8
MyTaskToolBar.js
...r-front/src/components/MyTasksCompoments/MyTaskToolBar.js
+16
-2
MyTasks.js
planner-front/src/containers/MyTasks/MyTasks.js
+32
-6
No files found.
planner-front/src/components/MyTasksCompoments/MyTaskToolBar.js
View file @
3deb8fcb
...
@@ -7,8 +7,9 @@ import Button from '@mui/material/Button';
...
@@ -7,8 +7,9 @@ import Button from '@mui/material/Button';
import
MultipleSelect
from
'../../components/UI/MultipleSelect/MultipleSelect'
;
import
MultipleSelect
from
'../../components/UI/MultipleSelect/MultipleSelect'
;
import
Add
from
"@mui/icons-material/Add"
;
import
Add
from
"@mui/icons-material/Add"
;
import
Close
from
"@mui/icons-material/Close"
;
import
Close
from
"@mui/icons-material/Close"
;
// import { TaskSharp } from '@mui/icons-material';
export
default
function
MyTaskToolBar
({
projects
,
onCl
ose
,
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
,
formStatus
,
onClick
})
{
export
default
function
MyTaskToolBar
({
projects
,
onCl
ickActiveTasks
,
activeTasksOn
,
onCloseFilterByProjects
,
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
,
formStatus
,
onClick
})
{
let
projectsFilter
=
let
projectsFilter
=
<><
/
>
<><
/
>
...
@@ -17,12 +18,13 @@ export default function MyTaskToolBar({projects,onClose,projectIdListForTaskSele
...
@@ -17,12 +18,13 @@ export default function MyTaskToolBar({projects,onClose,projectIdListForTaskSele
projectsFilter
=
projectsFilter
=
<
MultipleSelect
<
MultipleSelect
projects
=
{
projects
}
projects
=
{
projects
}
onClose
=
{
onClose
}
onClose
=
{
onClose
FilterByProjects
}
projectName
=
{
projectIdListForTaskSelect
}
projectName
=
{
projectIdListForTaskSelect
}
setProjectName
=
{
setProjectIdListForTaskSelect
}
setProjectName
=
{
setProjectIdListForTaskSelect
}
/
>
/
>
}
}
return
(
return
(
<
Box
sx
=
{{
flexGrow
:
1
}}
>
<
Box
sx
=
{{
flexGrow
:
1
}}
>
...
@@ -31,6 +33,18 @@ export default function MyTaskToolBar({projects,onClose,projectIdListForTaskSele
...
@@ -31,6 +33,18 @@ export default function MyTaskToolBar({projects,onClose,projectIdListForTaskSele
<
Typography
variant
=
"h6"
component
=
"div"
sx
=
{{
flexGrow
:
1
}}
>
<
Typography
variant
=
"h6"
component
=
"div"
sx
=
{{
flexGrow
:
1
}}
>
Мои
задачи
Мои
задачи
<
/Typography
>
<
/Typography
>
<
Button
color
=
{
"inherit"
}
style
=
{{
backgroundColor
:
activeTasksOn
===
true
?
"red"
:
"inherit"
,
}}
onClick
=
{
onClickActiveTasks
}
>
Активные
задачи
<
/Button
>
{
projectsFilter
}
{
projectsFilter
}
<
Button
<
Button
...
...
planner-front/src/containers/MyTasks/MyTasks.js
View file @
3deb8fcb
...
@@ -34,6 +34,10 @@ export default function EnhancedTable() {
...
@@ -34,6 +34,10 @@ export default function EnhancedTable() {
open
:
false
,
open
:
false
,
task
:
null
,
task
:
null
,
});
});
const
[
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
]
=
React
.
useState
([]);
// const [filterProjectTumbler, setFilterProjectTumbler] = React.useState(false);
// const[filteredActiveTasks, setActiveTasks] = React.useState([]);
const
[
activeTasksOn
,
setActiveTasksOn
]
=
React
.
useState
(
false
)
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -43,7 +47,10 @@ export default function EnhancedTable() {
...
@@ -43,7 +47,10 @@ export default function EnhancedTable() {
}
}
},
[
},
[
tasks
?.
length
,
tasks
?.
length
,
addTaskForm
,
setAddTaskForm
,
dispatch
]);
addTaskForm
,
setAddTaskForm
,
// onClickActiveTasks,
// activeTasksOn,
dispatch
]);
// console.log('tasks ', tasks, 'projects ', projects,"recievedTasks ", recievedTasks )
// console.log('tasks ', tasks, 'projects ', projects,"recievedTasks ", recievedTasks )
...
@@ -177,18 +184,35 @@ export default function EnhancedTable() {
...
@@ -177,18 +184,35 @@ export default function EnhancedTable() {
};
};
// ++++++++фильтрация по проектам+++++++++++++++
// ++++++++фильтрация по проектам+++++++++++++++
const
[
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
]
=
React
.
useState
([]);
const
[
filterProjectTumbler
,
setFilterProjectTumbler
]
=
React
.
useState
(
false
);
const
onClose
=
(
projectIdListForTaskSelect
)
=>
{
const
onCloseFilterByProjects
=
(
projectIdListForTaskSelect
)
=>
{
let
tasksFilteredByProject
=
tasks
let
tasksFilteredByProject
=
tasks
if
(
projectIdListForTaskSelect
.
length
>
0
)
{
if
(
projectIdListForTaskSelect
.
length
>
0
)
{
tasksFilteredByProject
=
tasks
.
filter
(
task
=>
projectIdListForTaskSelect
.
includes
(
task
.
project
?.
id
))
tasksFilteredByProject
=
tasks
.
filter
(
task
=>
projectIdListForTaskSelect
.
includes
(
task
.
project
?.
id
))
}
}
console
.
log
(
'tasksFilteredByProject '
,
tasksFilteredByProject
)
console
.
log
(
'tasksFilteredByProject '
,
tasksFilteredByProject
)
setRecievedTasks
(
tasksFilteredByProject
)
setRecievedTasks
(
tasksFilteredByProject
)
setFilterProjectTumbler
(
true
)
//
setFilterProjectTumbler(true)
}
}
const
onClickActiveTasks
=
()
=>
{
console
.
log
(
'active tasts before switched to '
,
activeTasksOn
)
setActiveTasksOn
((
prevState
)
=>
{
return
!
prevState
})
console
.
log
(
'active tasts after switch '
,
activeTasksOn
)
if
(
activeTasksOn
)
{
const
activeTasks
=
recievedTasks
.
filter
(
recievedTask
=>
recievedTask
.
accomplish
===
'opened'
||
recievedTask
.
accomplish
===
'progress'
)
console
.
log
(
'received tasks in switch'
,
recievedTasks
)
setRecievedTasks
(
activeTasks
)
}
else
{
setRecievedTasks
(
tasks
)
}
}
// if (
// if (
// tasks &&
// tasks &&
// tasks?.length > 0
// tasks?.length > 0
...
@@ -203,9 +227,11 @@ export default function EnhancedTable() {
...
@@ -203,9 +227,11 @@ export default function EnhancedTable() {
onClick
=
{()
=>
setAddTaskForm
(
!
addTaskForm
)}
onClick
=
{()
=>
setAddTaskForm
(
!
addTaskForm
)}
formStatus
=
{
addTaskForm
}
formStatus
=
{
addTaskForm
}
projects
=
{
projects
}
projects
=
{
projects
}
onClose
=
{
onClose
}
onClose
FilterByProjects
=
{
onCloseFilterByProjects
}
projectIdListForTaskSelect
=
{
projectIdListForTaskSelect
}
projectIdListForTaskSelect
=
{
projectIdListForTaskSelect
}
setProjectIdListForTaskSelect
=
{
setProjectIdListForTaskSelect
}
setProjectIdListForTaskSelect
=
{
setProjectIdListForTaskSelect
}
onClickActiveTasks
=
{
onClickActiveTasks
}
activeTasksOn
=
{
activeTasksOn
}
/
>
/
>
{
addTaskForm
?
(
{
addTaskForm
?
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment