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
471057cc
Commit
471057cc
authored
Jan 13, 2023
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#138
fix on filtration of projects by id and active status
parent
3deb8fcb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
20 deletions
+28
-20
MyTaskToolBar.js
...r-front/src/components/MyTasksCompoments/MyTaskToolBar.js
+4
-4
MultipleSelect.js
...-front/src/components/UI/MultipleSelect/MultipleSelect.js
+6
-6
MyTasks.js
planner-front/src/containers/MyTasks/MyTasks.js
+18
-10
No files found.
planner-front/src/components/MyTasksCompoments/MyTaskToolBar.js
View file @
471057cc
...
...
@@ -18,9 +18,9 @@ export default function MyTaskToolBar({projects,onClickActiveTasks,activeTasksOn
projectsFilter
=
<
MultipleSelect
projects
=
{
projects
}
onClose
=
{
onCloseFilterByProjects
}
project
Name
=
{
projectIdListForTaskSelect
}
setProject
Name
=
{
setProjectIdListForTaskSelect
}
onClose
FilterByProjects
=
{
onCloseFilterByProjects
}
project
IdListForTaskSelect
=
{
projectIdListForTaskSelect
}
setProject
IdListForTaskSelect
=
{
setProjectIdListForTaskSelect
}
/
>
}
...
...
@@ -40,7 +40,7 @@ export default function MyTaskToolBar({projects,onClickActiveTasks,activeTasksOn
style
=
{{
backgroundColor
:
activeTasksOn
===
true
?
"red"
:
"inherit"
,
}}
onClick
=
{
onClickActiveTasks
}
onClick
=
{
()
=>
onClickActiveTasks
()
}
>
Активные
задачи
<
/Button
>
...
...
planner-front/src/components/UI/MultipleSelect/MultipleSelect.js
View file @
471057cc
...
...
@@ -28,15 +28,15 @@ function getStyles(name, personName, theme) {
};
}
export
default
function
MultipleSelect
({
projects
,
projectName
,
onClose
,
setProjectName
})
{
export
default
function
MultipleSelect
({
projects
,
onCloseFilterByProjects
})
{
const
theme
=
useTheme
();
const
[
listProjectIds
,
setListProjectIds
]
=
React
.
useState
([])
const
handleChange
=
(
event
)
=>
{
const
{
target
:
{
value
},
}
=
event
;
set
ProjectName
(
set
ListProjectIds
(
// On autofill we get a stringified value.
typeof
value
===
'string'
?
value
.
split
(
','
)
:
value
,
);
...
...
@@ -55,18 +55,18 @@ export default function MultipleSelect({projects,projectName,onClose,setProjectN
name
=
'Choose Project'
id
=
"demo-multiple-name"
multiple
value
=
{
projectName
}
value
=
{
listProjectIds
}
onChange
=
{
handleChange
}
input
=
{
<
OutlinedInput
label
=
"Name"
/>
}
MenuProps
=
{
MenuProps
}
sx
=
{{
color
:
'white'
}}
onClose
=
{(
e
)
=>
{
onClose
(
projectName
)}}
onClose
=
{(
e
)
=>
{
onClose
FilterByProjects
(
listProjectIds
)}}
>
{
projects
?.
map
((
project
,
index
)
=>
(
<
MenuItem
key
=
{
index
}
value
=
{
project
.
id
}
style
=
{
getStyles
(
project
.
title
,
projectName
,
theme
)}
style
=
{
getStyles
(
project
.
title
,
listProjectIds
,
theme
)}
>
{
project
.
title
}
<
/MenuItem
>
...
...
planner-front/src/containers/MyTasks/MyTasks.js
View file @
471057cc
...
...
@@ -50,11 +50,24 @@ export default function EnhancedTable() {
addTaskForm
,
setAddTaskForm
,
// onClickActiveTasks,
// activeTasksOn,
dispatch
]);
dispatch
]);
// console.log('tasks ', tasks, 'projects ', projects,"recievedTasks ", recievedTasks )
useEffect
(()
=>
{
let
filteredTasks
=
tasks
;
if
(
activeTasksOn
)
{
filteredTasks
=
filteredTasks
.
filter
(
task
=>
task
.
accomplish
===
'opened'
||
task
.
accomplish
===
'progress'
)
}
if
(
projectIdListForTaskSelect
.
length
>
0
)
{
filteredTasks
=
filteredTasks
.
filter
(
task
=>
projectIdListForTaskSelect
.
includes
(
task
.
project
?.
id
))
}
setRecievedTasks
(
filteredTasks
)
},
[
activeTasksOn
,
projectIdListForTaskSelect
]);
const
handleRequestSort
=
(
property
)
=>
{
const
isAsc
=
orderBy
===
property
&&
order
===
"asc"
;
...
...
@@ -186,21 +199,16 @@ export default function EnhancedTable() {
const
onCloseFilterByProjects
=
(
projectIdListForTaskSelect
)
=>
{
let
tasksFilteredByProject
=
tasks
if
(
projectIdListForTaskSelect
.
length
>
0
)
{
tasksFilteredByProject
=
tasks
.
filter
(
task
=>
projectIdListForTaskSelect
.
includes
(
task
.
project
?.
id
))
}
console
.
log
(
'tasksFilteredByProject '
,
tasksFilteredByProject
)
setRecievedTasks
(
tasksFilteredByProject
)
// setFilterProjectTumbler(true)
const
onCloseFilterByProjects
=
(
listProjectIds
)
=>
{
setProjectIdListForTaskSelect
(
listProjectIds
)
}
const
onClickActiveTasks
=
()
=>
{
console
.
log
(
'active tasts before switched to '
,
activeTasksOn
)
setActiveTasksOn
((
prevState
)
=>
{
return
!
prevState
})
// setActiveTasksOn((prevState)=>{return !prevState})
setActiveTasksOn
(
!
activeTasksOn
)
console
.
log
(
'active tasts after switch '
,
activeTasksOn
)
if
(
activeTasksOn
)
{
...
...
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