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 }) {
...
@@ -8,7 +8,7 @@ function CreateTaskFromButton({ addFormStatus, onClick }) {
color
=
{
addFormStatus
===
true
?
"info"
:
"inherit"
}
color
=
{
addFormStatus
===
true
?
"info"
:
"inherit"
}
style
=
{{
style
=
{{
backgroundColor
:
addFormStatus
===
true
?
"white"
:
"inherit"
,
backgroundColor
:
addFormStatus
===
true
?
"white"
:
"inherit"
,
width
:
'2
5
0px'
width
:
'2
8
0px'
}}
}}
onClick
=
{
onClick
}
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
{
memo
,
useMemo
}
from
"react"
;
import
MultipleSelect
from
"../../UI/MultipleSelect/MultipleSelect"
;
import
MultipleSelect
from
"../../UI/MultipleSelect/MultipleSelect"
;
import
CreateTaskFromButton
from
"./CreateTaskFromButton/CreateTaskFromButton"
;
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
(()
=>
{
const
projectsFilter
=
useMemo
(()
=>
{
if
(
Array
.
isArray
(
projects
))
{
if
(
Array
.
isArray
(
projects
))
{
...
@@ -17,9 +17,9 @@ function MyTasksTableToolbar({ addFormStatus, createTaskFromButtonHandler, proje
...
@@ -17,9 +17,9 @@ function MyTasksTableToolbar({ addFormStatus, createTaskFromButtonHandler, proje
}
else
{
}
else
{
return
null
return
null
}
}
},
[
projects
,
onCloseFilterByProjects
,
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
])
},
[
projects
,
onCloseFilterByProjects
,
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
])
return
(
return
(
<
AppBar
position
=
"static"
sx
=
{{
padding
:
3
}}
>
<
AppBar
position
=
"static"
sx
=
{{
padding
:
3
}}
>
<
Box
sx
=
{{
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Box
sx
=
{{
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
<
Typography
...
@@ -30,6 +30,11 @@ return (
...
@@ -30,6 +30,11 @@ return (
>
>
Мои
задачи
Мои
задачи
<
/Typography
>
<
/Typography
>
<
FormControlLabel
control
=
{
<
Switch
color
=
'error'
checked
=
{
activeTasksOn
}
onChange
=
{()
=>
{
setActiveTasksOn
(
prevState
=>!
prevState
)
}}
/>
}
label
=
"Активные задачи"
labelPlacement
=
"end"
/>
{
projectsFilter
}
{
projectsFilter
}
<
CreateTaskFromButton
<
CreateTaskFromButton
addFormStatus
=
{
addFormStatus
}
addFormStatus
=
{
addFormStatus
}
...
@@ -37,7 +42,7 @@ return (
...
@@ -37,7 +42,7 @@ return (
/
>
/
>
<
/Box
>
<
/Box
>
<
/AppBar
>
<
/AppBar
>
);
);
}
}
export
default
memo
(
MyTasksTableToolbar
)
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 }) {
...
@@ -8,7 +8,7 @@ function CreateTaskFromButton({ addFormStatus, onClick }) {
color
=
{
addFormStatus
===
true
?
"info"
:
"inherit"
}
color
=
{
addFormStatus
===
true
?
"info"
:
"inherit"
}
style
=
{{
style
=
{{
backgroundColor
:
addFormStatus
===
true
?
"white"
:
"inherit"
,
backgroundColor
:
addFormStatus
===
true
?
"white"
:
"inherit"
,
width
:
'2
5
0px'
width
:
'2
8
0px'
}}
}}
onClick
=
{
onClick
}
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
{
memo
,
useMemo
}
from
"react"
;
import
MultipleSelect
from
"../../UI/MultipleSelect/MultipleSelect"
;
import
MultipleSelect
from
"../../UI/MultipleSelect/MultipleSelect"
;
import
CreateTaskFromButton
from
"./CreateTaskFromButton/CreateTaskFromButton"
;
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
(()
=>
{
const
projectsFilter
=
useMemo
(()
=>
{
if
(
Array
.
isArray
(
projects
))
{
if
(
Array
.
isArray
(
projects
))
{
...
@@ -30,6 +30,11 @@ return (
...
@@ -30,6 +30,11 @@ return (
>
>
Задачи
сотрудников
Задачи
сотрудников
<
/Typography
>
<
/Typography
>
<
FormControlLabel
control
=
{
<
Switch
color
=
'error'
checked
=
{
activeTasksOn
}
onChange
=
{()
=>
{
setActiveTasksOn
(
prevState
=>!
prevState
)
}}
/>
}
label
=
"Активные задачи"
labelPlacement
=
"end"
/>
{
projectsFilter
}
{
projectsFilter
}
<
CreateTaskFromButton
<
CreateTaskFromButton
addFormStatus
=
{
addFormStatus
}
addFormStatus
=
{
addFormStatus
}
...
...
planner-front/src/containers/MyTasks/MyTasks.js
View file @
d8b93d48
...
@@ -39,6 +39,7 @@ export default function MyTasks() {
...
@@ -39,6 +39,7 @@ export default function MyTasks() {
const
[
rowsPerPage
,
setRowsPerPage
]
=
useState
(
10
);
const
[
rowsPerPage
,
setRowsPerPage
]
=
useState
(
10
);
const
[
addFormStatus
,
setAddFormStatus
]
=
useState
(
false
);
const
[
addFormStatus
,
setAddFormStatus
]
=
useState
(
false
);
const
[
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
]
=
useState
([]);
const
[
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
]
=
useState
([]);
const
[
activeTasksOn
,
setActiveTasksOn
]
=
useState
(
false
)
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
fetchAllTasks
());
dispatch
(
fetchAllTasks
());
...
@@ -47,8 +48,8 @@ export default function MyTasks() {
...
@@ -47,8 +48,8 @@ export default function MyTasks() {
},
[
dispatch
]);
},
[
dispatch
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
sortTaskByProjects
(
projectIdListForTaskSelect
))
dispatch
(
sortTaskByProjects
(
projectIdListForTaskSelect
,
activeTasksOn
))
},
[
dispatch
,
projectIdListForTaskSelect
]);
},
[
dispatch
,
projectIdListForTaskSelect
,
activeTasksOn
,
tasks
]);
const
onChangeNewTaskHandler
=
useCallback
((
e
)
=>
{
const
onChangeNewTaskHandler
=
useCallback
((
e
)
=>
{
...
@@ -173,6 +174,7 @@ export default function MyTasks() {
...
@@ -173,6 +174,7 @@ export default function MyTasks() {
setProjectIdListForTaskSelect
(
listProjectIds
)
setProjectIdListForTaskSelect
(
listProjectIds
)
},
[])
},
[])
return
(
return
(
<
Paper
sx
=
{{
width
:
'100%'
,
mb
:
2
}}
>
<
Paper
sx
=
{{
width
:
'100%'
,
mb
:
2
}}
>
<
MyTasksTableToolbar
<
MyTasksTableToolbar
...
@@ -182,12 +184,14 @@ export default function MyTasks() {
...
@@ -182,12 +184,14 @@ export default function MyTasks() {
projectIdListForTaskSelect
=
{
projectIdListForTaskSelect
}
projectIdListForTaskSelect
=
{
projectIdListForTaskSelect
}
setProjectIdListForTaskSelect
=
{
setProjectIdListForTaskSelect
}
setProjectIdListForTaskSelect
=
{
setProjectIdListForTaskSelect
}
projects
=
{
projects
.
projects
}
projects
=
{
projects
.
projects
}
activeTasksOn
=
{
activeTasksOn
}
setActiveTasksOn
=
{
setActiveTasksOn
}
/
>
/
>
<
MyTasksTableContainer
<
MyTasksTableContainer
order
=
{
order
}
order
=
{
order
}
orderBy
=
{
orderBy
}
orderBy
=
{
orderBy
}
handleRequestSort
=
{
handleRequestSort
}
handleRequestSort
=
{
handleRequestSort
}
rows
=
{
projectIdListForTaskSelect
.
length
?
sortedTasks
:
tasks
}
rows
=
{
sortedTasks
.
length
?
sortedTasks
:
tasks
}
page
=
{
page
}
page
=
{
page
}
rowsPerPage
=
{
rowsPerPage
}
rowsPerPage
=
{
rowsPerPage
}
addFormStatus
=
{
addFormStatus
}
addFormStatus
=
{
addFormStatus
}
...
@@ -206,7 +210,7 @@ export default function MyTasks() {
...
@@ -206,7 +210,7 @@ export default function MyTasks() {
editCurrentTaskHandler
=
{
editCurrentTaskHandler
}
editCurrentTaskHandler
=
{
editCurrentTaskHandler
}
/
>
/
>
<
MyTasksTablePagination
<
MyTasksTablePagination
count
=
{
projectIdListForTaskSelect
.
length
?
sortedTasks
.
length
:
tasks
.
length
}
count
=
{
sortedTasks
.
length
?
sortedTasks
.
length
:
tasks
.
length
}
rowsPerPage
=
{
rowsPerPage
}
rowsPerPage
=
{
rowsPerPage
}
page
=
{
page
}
page
=
{
page
}
handleChangePage
=
{
handleChangePage
}
handleChangePage
=
{
handleChangePage
}
...
...
planner-front/src/containers/UsersTasks/UsersTasks.js
View file @
d8b93d48
...
@@ -40,6 +40,7 @@ export default function UsersTasks() {
...
@@ -40,6 +40,7 @@ export default function UsersTasks() {
const
[
rowsPerPage
,
setRowsPerPage
]
=
useState
(
10
);
const
[
rowsPerPage
,
setRowsPerPage
]
=
useState
(
10
);
const
[
addFormStatus
,
setAddFormStatus
]
=
useState
(
false
);
const
[
addFormStatus
,
setAddFormStatus
]
=
useState
(
false
);
const
[
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
]
=
useState
([]);
const
[
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
]
=
useState
([]);
const
[
activeTasksOn
,
setActiveTasksOn
]
=
useState
(
false
)
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
fetchAllTasksByMembership
());
dispatch
(
fetchAllTasksByMembership
());
...
@@ -48,8 +49,8 @@ export default function UsersTasks() {
...
@@ -48,8 +49,8 @@ export default function UsersTasks() {
},
[
dispatch
]);
},
[
dispatch
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
sortTaskByProjects
(
projectIdListForTaskSelect
))
dispatch
(
sortTaskByProjects
(
projectIdListForTaskSelect
,
activeTasksOn
))
},
[
dispatch
,
projectIdListForTaskSelect
]);
},
[
dispatch
,
projectIdListForTaskSelect
,
activeTasksOn
,
tasks
]);
const
onChangeNewTaskHandler
=
useCallback
((
e
)
=>
{
const
onChangeNewTaskHandler
=
useCallback
((
e
)
=>
{
...
@@ -194,12 +195,14 @@ export default function UsersTasks() {
...
@@ -194,12 +195,14 @@ export default function UsersTasks() {
projectIdListForTaskSelect
=
{
projectIdListForTaskSelect
}
projectIdListForTaskSelect
=
{
projectIdListForTaskSelect
}
setProjectIdListForTaskSelect
=
{
setProjectIdListForTaskSelect
}
setProjectIdListForTaskSelect
=
{
setProjectIdListForTaskSelect
}
projects
=
{
projects
.
projects
}
projects
=
{
projects
.
projects
}
activeTasksOn
=
{
activeTasksOn
}
setActiveTasksOn
=
{
setActiveTasksOn
}
/
>
/
>
<
UsersTasksTableContainer
<
UsersTasksTableContainer
order
=
{
order
}
order
=
{
order
}
orderBy
=
{
orderBy
}
orderBy
=
{
orderBy
}
handleRequestSort
=
{
handleRequestSort
}
handleRequestSort
=
{
handleRequestSort
}
rows
=
{
projectIdListForTaskSelect
.
length
?
sortedTasks
:
tasks
}
rows
=
{
sortedTasks
.
length
?
sortedTasks
:
tasks
}
page
=
{
page
}
page
=
{
page
}
rowsPerPage
=
{
rowsPerPage
}
rowsPerPage
=
{
rowsPerPage
}
addFormStatus
=
{
addFormStatus
}
addFormStatus
=
{
addFormStatus
}
...
@@ -218,7 +221,7 @@ export default function UsersTasks() {
...
@@ -218,7 +221,7 @@ export default function UsersTasks() {
editCurrentTaskHandler
=
{
editCurrentTaskHandler
}
editCurrentTaskHandler
=
{
editCurrentTaskHandler
}
/
>
/
>
<
UsersTasksTablePagination
<
UsersTasksTablePagination
count
=
{
projectIdListForTaskSelect
.
length
?
sortedTasks
.
length
:
tasks
.
length
}
count
=
{
sortedTasks
.
length
?
sortedTasks
.
length
:
tasks
.
length
}
rowsPerPage
=
{
rowsPerPage
}
rowsPerPage
=
{
rowsPerPage
}
page
=
{
page
}
page
=
{
page
}
handleChangePage
=
{
handleChangePage
}
handleChangePage
=
{
handleChangePage
}
...
...
planner-front/src/store/actions/tasksActions.js
View file @
d8b93d48
...
@@ -87,8 +87,8 @@ export const fetchAllTasksByMembership = () => {
...
@@ -87,8 +87,8 @@ export const fetchAllTasksByMembership = () => {
//**end*/
//**end*/
export
const
sortTaskByProjects
=
(
projectIdListForTaskSelect
)
=>
{
export
const
sortTaskByProjects
=
(
projectIdListForTaskSelect
,
activeTasksOn
)
=>
{
return
{
type
:
SORT_TASKS
,
projectIdListForTaskSelect
}
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) => {
...
@@ -156,7 +156,17 @@ const tasksReduсer = (state = initialState, action) => {
case
DEACTIVATE_CREATE_COPY_TASKS_MODE
:
case
DEACTIVATE_CREATE_COPY_TASKS_MODE
:
return
{
...
state
,
copyMode
:
{
working
:
false
,
task
:
null
}
}
return
{
...
state
,
copyMode
:
{
working
:
false
,
task
:
null
}
}
case
SORT_TASKS
:
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
};
return
{
...
state
,
loading
:
false
,
sortedTasks
:
filteredTasks
};
default
:
default
:
return
state
;
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