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
d8b93d48
Commit
d8b93d48
authored
Jan 16, 2023
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#154
добавил сортировку по активным задачам
parent
94d3fe63
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
64 additions
and
37 deletions
+64
-37
CreateTaskFromButton.js
...TableToolbar/CreateTaskFromButton/CreateTaskFromButton.js
+1
-1
MyTasksTableToolbar.js
...asksCompoments/MyTasksTableToolbar/MyTasksTableToolbar.js
+27
-22
CreateTaskFromButton.js
...TableToolbar/CreateTaskFromButton/CreateTaskFromButton.js
+1
-1
UsersTasksTableToolbar.js
...mpoments/UsersTasksTableToolbar/UsersTasksTableToolbar.js
+7
-2
MyTasks.js
planner-front/src/containers/MyTasks/MyTasks.js
+8
-4
UsersTasks.js
planner-front/src/containers/UsersTasks/UsersTasks.js
+7
-4
tasksActions.js
planner-front/src/store/actions/tasksActions.js
+2
-2
tasksReducer.js
planner-front/src/store/reducers/tasksReducer.js
+11
-1
No files found.
planner-front/src/components/MyTasksCompoments/MyTasksTableToolbar/CreateTaskFromButton/CreateTaskFromButton.js
View file @
d8b93d48
...
...
@@ -8,7 +8,7 @@ function CreateTaskFromButton({ addFormStatus, onClick }) {
color
=
{
addFormStatus
===
true
?
"info"
:
"inherit"
}
style
=
{{
backgroundColor
:
addFormStatus
===
true
?
"white"
:
"inherit"
,
width
:
'2
5
0px'
width
:
'2
8
0px'
}}
onClick
=
{
onClick
}
>
...
...
planner-front/src/components/MyTasksCompoments/MyTasksTableToolbar/MyTasksTableToolbar.js
View file @
d8b93d48
import
{
AppBar
,
Box
,
Typography
}
from
"@mui/material"
;
import
{
AppBar
,
Box
,
FormControlLabel
,
Switch
,
Typography
}
from
"@mui/material"
;
import
{
memo
,
useMemo
}
from
"react"
;
import
MultipleSelect
from
"../../UI/MultipleSelect/MultipleSelect"
;
import
CreateTaskFromButton
from
"./CreateTaskFromButton/CreateTaskFromButton"
;
function
MyTasksTableToolbar
({
addFormStatus
,
createTaskFromButtonHandler
,
projects
,
onCloseFilterByProjects
,
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
})
{
function
MyTasksTableToolbar
({
addFormStatus
,
createTaskFromButtonHandler
,
projects
,
onCloseFilterByProjects
,
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
,
activeTasksOn
,
setActiveTasksOn
})
{
const
projectsFilter
=
useMemo
(()
=>
{
if
(
Array
.
isArray
(
projects
))
{
...
...
@@ -17,9 +17,9 @@ function MyTasksTableToolbar({ addFormStatus, createTaskFromButtonHandler, proje
}
else
{
return
null
}
},
[
projects
,
onCloseFilterByProjects
,
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
])
},
[
projects
,
onCloseFilterByProjects
,
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
])
return
(
return
(
<
AppBar
position
=
"static"
sx
=
{{
padding
:
3
}}
>
<
Box
sx
=
{{
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
...
...
@@ -30,6 +30,11 @@ return (
>
Мои
задачи
<
/Typography
>
<
FormControlLabel
control
=
{
<
Switch
color
=
'error'
checked
=
{
activeTasksOn
}
onChange
=
{()
=>
{
setActiveTasksOn
(
prevState
=>!
prevState
)
}}
/>
}
label
=
"Активные задачи"
labelPlacement
=
"end"
/>
{
projectsFilter
}
<
CreateTaskFromButton
addFormStatus
=
{
addFormStatus
}
...
...
@@ -37,7 +42,7 @@ return (
/
>
<
/Box
>
<
/AppBar
>
);
);
}
export
default
memo
(
MyTasksTableToolbar
)
\ No newline at end of file
planner-front/src/components/UsersTasksCompoments/UsersTasksTableToolbar/CreateTaskFromButton/CreateTaskFromButton.js
View file @
d8b93d48
...
...
@@ -8,7 +8,7 @@ function CreateTaskFromButton({ addFormStatus, onClick }) {
color
=
{
addFormStatus
===
true
?
"info"
:
"inherit"
}
style
=
{{
backgroundColor
:
addFormStatus
===
true
?
"white"
:
"inherit"
,
width
:
'2
5
0px'
width
:
'2
8
0px'
}}
onClick
=
{
onClick
}
>
...
...
planner-front/src/components/UsersTasksCompoments/UsersTasksTableToolbar/UsersTasksTableToolbar.js
View file @
d8b93d48
import
{
AppBar
,
Box
,
Typography
}
from
"@mui/material"
;
import
{
AppBar
,
Box
,
FormControlLabel
,
Switch
,
Typography
}
from
"@mui/material"
;
import
{
memo
,
useMemo
}
from
"react"
;
import
MultipleSelect
from
"../../UI/MultipleSelect/MultipleSelect"
;
import
CreateTaskFromButton
from
"./CreateTaskFromButton/CreateTaskFromButton"
;
function
UsersTasksTableToolbar
({
addFormStatus
,
createTaskFromButtonHandler
,
projects
,
onCloseFilterByProjects
,
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
})
{
function
UsersTasksTableToolbar
({
addFormStatus
,
createTaskFromButtonHandler
,
projects
,
onCloseFilterByProjects
,
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
,
activeTasksOn
,
setActiveTasksOn
})
{
const
projectsFilter
=
useMemo
(()
=>
{
if
(
Array
.
isArray
(
projects
))
{
...
...
@@ -30,6 +30,11 @@ return (
>
Задачи
сотрудников
<
/Typography
>
<
FormControlLabel
control
=
{
<
Switch
color
=
'error'
checked
=
{
activeTasksOn
}
onChange
=
{()
=>
{
setActiveTasksOn
(
prevState
=>!
prevState
)
}}
/>
}
label
=
"Активные задачи"
labelPlacement
=
"end"
/>
{
projectsFilter
}
<
CreateTaskFromButton
addFormStatus
=
{
addFormStatus
}
...
...
planner-front/src/containers/MyTasks/MyTasks.js
View file @
d8b93d48
...
...
@@ -39,6 +39,7 @@ export default function MyTasks() {
const
[
rowsPerPage
,
setRowsPerPage
]
=
useState
(
10
);
const
[
addFormStatus
,
setAddFormStatus
]
=
useState
(
false
);
const
[
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
]
=
useState
([]);
const
[
activeTasksOn
,
setActiveTasksOn
]
=
useState
(
false
)
useEffect
(()
=>
{
dispatch
(
fetchAllTasks
());
...
...
@@ -47,8 +48,8 @@ export default function MyTasks() {
},
[
dispatch
]);
useEffect
(()
=>
{
dispatch
(
sortTaskByProjects
(
projectIdListForTaskSelect
))
},
[
dispatch
,
projectIdListForTaskSelect
]);
dispatch
(
sortTaskByProjects
(
projectIdListForTaskSelect
,
activeTasksOn
))
},
[
dispatch
,
projectIdListForTaskSelect
,
activeTasksOn
,
tasks
]);
const
onChangeNewTaskHandler
=
useCallback
((
e
)
=>
{
...
...
@@ -173,6 +174,7 @@ export default function MyTasks() {
setProjectIdListForTaskSelect
(
listProjectIds
)
},
[])
return
(
<
Paper
sx
=
{{
width
:
'100%'
,
mb
:
2
}}
>
<
MyTasksTableToolbar
...
...
@@ -182,12 +184,14 @@ export default function MyTasks() {
projectIdListForTaskSelect
=
{
projectIdListForTaskSelect
}
setProjectIdListForTaskSelect
=
{
setProjectIdListForTaskSelect
}
projects
=
{
projects
.
projects
}
activeTasksOn
=
{
activeTasksOn
}
setActiveTasksOn
=
{
setActiveTasksOn
}
/
>
<
MyTasksTableContainer
order
=
{
order
}
orderBy
=
{
orderBy
}
handleRequestSort
=
{
handleRequestSort
}
rows
=
{
projectIdListForTaskSelect
.
length
?
sortedTasks
:
tasks
}
rows
=
{
sortedTasks
.
length
?
sortedTasks
:
tasks
}
page
=
{
page
}
rowsPerPage
=
{
rowsPerPage
}
addFormStatus
=
{
addFormStatus
}
...
...
@@ -206,7 +210,7 @@ export default function MyTasks() {
editCurrentTaskHandler
=
{
editCurrentTaskHandler
}
/
>
<
MyTasksTablePagination
count
=
{
projectIdListForTaskSelect
.
length
?
sortedTasks
.
length
:
tasks
.
length
}
count
=
{
sortedTasks
.
length
?
sortedTasks
.
length
:
tasks
.
length
}
rowsPerPage
=
{
rowsPerPage
}
page
=
{
page
}
handleChangePage
=
{
handleChangePage
}
...
...
planner-front/src/containers/UsersTasks/UsersTasks.js
View file @
d8b93d48
...
...
@@ -40,6 +40,7 @@ export default function UsersTasks() {
const
[
rowsPerPage
,
setRowsPerPage
]
=
useState
(
10
);
const
[
addFormStatus
,
setAddFormStatus
]
=
useState
(
false
);
const
[
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
]
=
useState
([]);
const
[
activeTasksOn
,
setActiveTasksOn
]
=
useState
(
false
)
useEffect
(()
=>
{
dispatch
(
fetchAllTasksByMembership
());
...
...
@@ -48,8 +49,8 @@ export default function UsersTasks() {
},
[
dispatch
]);
useEffect
(()
=>
{
dispatch
(
sortTaskByProjects
(
projectIdListForTaskSelect
))
},
[
dispatch
,
projectIdListForTaskSelect
]);
dispatch
(
sortTaskByProjects
(
projectIdListForTaskSelect
,
activeTasksOn
))
},
[
dispatch
,
projectIdListForTaskSelect
,
activeTasksOn
,
tasks
]);
const
onChangeNewTaskHandler
=
useCallback
((
e
)
=>
{
...
...
@@ -194,12 +195,14 @@ export default function UsersTasks() {
projectIdListForTaskSelect
=
{
projectIdListForTaskSelect
}
setProjectIdListForTaskSelect
=
{
setProjectIdListForTaskSelect
}
projects
=
{
projects
.
projects
}
activeTasksOn
=
{
activeTasksOn
}
setActiveTasksOn
=
{
setActiveTasksOn
}
/
>
<
UsersTasksTableContainer
order
=
{
order
}
orderBy
=
{
orderBy
}
handleRequestSort
=
{
handleRequestSort
}
rows
=
{
projectIdListForTaskSelect
.
length
?
sortedTasks
:
tasks
}
rows
=
{
sortedTasks
.
length
?
sortedTasks
:
tasks
}
page
=
{
page
}
rowsPerPage
=
{
rowsPerPage
}
addFormStatus
=
{
addFormStatus
}
...
...
@@ -218,7 +221,7 @@ export default function UsersTasks() {
editCurrentTaskHandler
=
{
editCurrentTaskHandler
}
/
>
<
UsersTasksTablePagination
count
=
{
projectIdListForTaskSelect
.
length
?
sortedTasks
.
length
:
tasks
.
length
}
count
=
{
sortedTasks
.
length
?
sortedTasks
.
length
:
tasks
.
length
}
rowsPerPage
=
{
rowsPerPage
}
page
=
{
page
}
handleChangePage
=
{
handleChangePage
}
...
...
planner-front/src/store/actions/tasksActions.js
View file @
d8b93d48
...
...
@@ -87,8 +87,8 @@ export const fetchAllTasksByMembership = () => {
//**end*/
export
const
sortTaskByProjects
=
(
projectIdListForTaskSelect
)
=>
{
return
{
type
:
SORT_TASKS
,
projectIdListForTaskSelect
}
export
const
sortTaskByProjects
=
(
projectIdListForTaskSelect
,
activeTasksOn
)
=>
{
return
{
type
:
SORT_TASKS
,
projectIdListForTaskSelect
:
projectIdListForTaskSelect
,
activeTasksOn
:
activeTasksOn
}
}
...
...
planner-front/src/store/reducers/tasksReducer.js
View file @
d8b93d48
...
...
@@ -156,7 +156,17 @@ const tasksReduсer = (state = initialState, action) => {
case
DEACTIVATE_CREATE_COPY_TASKS_MODE
:
return
{
...
state
,
copyMode
:
{
working
:
false
,
task
:
null
}
}
case
SORT_TASKS
:
const
filteredTasks
=
state
.
tasks
.
filter
(
task
=>
action
.
projectIdListForTaskSelect
.
includes
(
task
.
project
?.
id
))
let
filteredTasks
=
[]
if
(
action
.
activeTasksOn
)
{
filteredTasks
=
state
.
tasks
.
filter
(
task
=>
task
.
accomplish
===
'opened'
||
task
.
accomplish
===
'progress'
)
}
if
(
action
.
projectIdListForTaskSelect
.
length
)
{
if
(
filteredTasks
.
length
)
{
filteredTasks
=
filteredTasks
.
filter
(
task
=>
action
.
projectIdListForTaskSelect
.
includes
(
task
.
project
?.
id
))
}
else
{
filteredTasks
=
state
.
tasks
.
filter
(
task
=>
action
.
projectIdListForTaskSelect
.
includes
(
task
.
project
?.
id
))
}
}
return
{
...
state
,
loading
:
false
,
sortedTasks
:
filteredTasks
};
default
:
return
state
;
...
...
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