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
c1d5bc88
Commit
c1d5bc88
authored
Dec 18, 2022
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#110
select project is fixed
parent
c79bfce2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
23 deletions
+31
-23
users.ts
planner-api/src/routers/users.ts
+0
-1
MultipleSelect.js
...-front/src/components/UI/MultipleSelect/MultipleSelect.js
+4
-4
UsersTaskToolBar.js
...t/src/components/UsersTasksCompoments/UsersTaskToolBar.js
+2
-2
UsersTasks.js
planner-front/src/containers/UsersTasks/UsersTasks.js
+22
-13
tasksActions.js
planner-front/src/store/actions/tasksActions.js
+3
-3
No files found.
planner-api/src/routers/users.ts
View file @
c1d5bc88
...
...
@@ -62,7 +62,6 @@ router.get('/all-fields/', async (req : Request, res : Response):Promise<object>
},
}
})
console
.
log
(
'all fields users '
,
users
)
return
res
.
send
({
users
})
})
...
...
planner-front/src/components/UI/MultipleSelect/MultipleSelect.js
View file @
c1d5bc88
...
...
@@ -61,11 +61,11 @@ export default function MultipleSelect({projects,projectName,onClose,setProjectN
>
{
projects
?.
map
((
project
)
=>
(
<
MenuItem
key
=
{
project
}
value
=
{
project
}
style
=
{
getStyles
(
project
,
project
Nam
e
,
theme
)}
key
=
{
project
.
id
}
value
=
{
project
.
id
}
style
=
{
getStyles
(
project
,
project
.
titl
e
,
theme
)}
>
{
project
}
{
project
.
title
}
<
/MenuItem
>
))}
<
/Select
>
...
...
planner-front/src/components/UsersTasksCompoments/UsersTaskToolBar.js
View file @
c1d5bc88
...
...
@@ -8,12 +8,12 @@ import MultipleSelect from '../UI/MultipleSelect/MultipleSelect';
import
Add
from
"@mui/icons-material/Add"
;
import
Close
from
"@mui/icons-material/Close"
;
export
default
function
My
TaskToolBar
({
projects
,
onClose
,
projectName
,
setProjectName
,
formStatus
,
onClick
})
{
export
default
function
Users
TaskToolBar
({
projects
,
onClose
,
projectName
,
setProjectName
,
formStatus
,
onClick
})
{
let
projectsFilter
=
<><
/
>
if
(
projects
)
{
if
(
Array
.
isArray
(
projects
)
)
{
projectsFilter
=
<
MultipleSelect
projects
=
{
projects
}
...
...
planner-front/src/containers/UsersTasks/UsersTasks.js
View file @
c1d5bc88
...
...
@@ -11,7 +11,7 @@ import { useState, useEffect } from "react";
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
TaskModal
from
"../../components/UsersTasksCompoments/TaskModal/TaskModal"
;
import
moment
from
"moment"
;
import
My
TaskToolBar
from
"../../components/UsersTasksCompoments/UsersTaskToolBar"
;
import
Users
TaskToolBar
from
"../../components/UsersTasksCompoments/UsersTaskToolBar"
;
import
{
fetchAllTasks
,
deleteTask
,
editTask
,
deleteDateTimeTask
,
fetchAllTasksByMembership
}
from
"../../store/actions/tasksActions"
;
import
NewTaskForm
from
"../../components/UsersTasksCompoments/NewTaskForm"
;
import
TableRowTask
from
"../../components/UsersTasksCompoments/TableRowTask/TableRowTask"
;
...
...
@@ -45,11 +45,13 @@ export default function UsersTasks() {
if
(
tasks
&&
tasks
?.
length
>
0
)
{
setRecievedTasks
(
tasks
);
}
},
[
dispatch
,
tasks
?.
length
]);
},
[
dispatch
,
tasks
?.
length
,
addTaskForm
,
setAddTaskForm
]);
useEffect
(()
=>
{
dispatch
(
fetchAllTasksByMembership
());
},
[
addTaskForm
,
setAddTaskForm
]);
//
useEffect(() => {
//
dispatch(fetchAllTasksByMembership());
//
}, [addTaskForm, setAddTaskForm]);
...
...
@@ -112,14 +114,21 @@ useEffect(() => {
const
onProjectChange
=
(
e
,
task
)
=>
{
const
projectId
=
e
.
target
.
value
;
const
project
=
projects
.
find
((
uniqueProject
)
=>
uniqueProject
.
id
===
projectId
);
setCurrentProject
(
project
)
const
project
=
projects
.
length
>
0
?
projects
.
find
((
uniqueProject
)
=>
uniqueProject
.
id
===
projectId
):
null
;
setCurrentProject
(
project
)
if
(
project
?.
members
){
for
(
let
member
of
project
.
members
){
setExecutors
([...
executors
,
member
.
user
])
}
console
.
log
(
'executors '
,
executors
)
}
const
{
id
}
=
task
;
const
newTasks
=
recievedTasks
.
map
((
task
)
=>
{
if
(
task
.
id
===
id
)
{
const
updated
=
{
...
task
};
updated
.
project
=
project
;
updated
.
projectName
=
project
.
title
;
updated
.
projectName
=
project
.
title
?
project
.
title
:
null
;
return
updated
;
}
return
task
;
...
...
@@ -209,10 +218,12 @@ useEffect(() => {
const
onClose
=
(
projectName
)
=>
{
console
.
log
(
'projectName '
,
projectName
)
let
tasksFilteredByProject
=
tasks
if
(
projectName
.
length
>
0
)
{
tasksFilteredByProject
=
tasks
.
filter
(
task
=>
projectName
.
includes
(
task
.
project
?.
title
))
tasksFilteredByProject
=
tasks
.
filter
(
task
=>
projectName
.
includes
(
task
.
project
?.
id
))
}
console
.
log
(
'tasksFilteredByProject '
,
tasksFilteredByProject
)
setRecievedTasks
(
tasksFilteredByProject
)
setFilterProjectTumbler
(
true
)
}
...
...
@@ -244,7 +255,6 @@ useEffect(() => {
return
results
;
},
[]);
console
.
log
(
'tasks'
,
tasks
)
if
(
tasks
&&
...
...
@@ -255,7 +265,7 @@ console.log('tasks', tasks)
return
(
<
Box
sx
=
{{
width
:
"fullwidth"
}}
>
<
Paper
sx
=
{{
width
:
"100%"
,
mb
:
2
}}
>
<
My
TaskToolBar
<
Users
TaskToolBar
onClick
=
{()
=>
setAddTaskForm
(
!
addTaskForm
)}
formStatus
=
{
addTaskForm
}
projects
=
{
projects
}
...
...
@@ -275,7 +285,7 @@ console.log('tasks', tasks)
<
TableContainer
>
<
Table
sx
=
{{
minWidth
:
600
}}
aria
-
labelledby
=
"tableTitle"
>
<
Table
sx
=
{{
minWidth
:
600
}}
aria
-
labelledby
=
"tableTitle"
size
=
'small'
>
<
UsersTasksHeader
order
=
{
order
}
orderBy
=
{
orderBy
}
...
...
@@ -294,7 +304,6 @@ console.log('tasks', tasks)
task
=
{
task
}
deleteHandle
=
{
deleteHandle
}
handleEditTask
=
{
handleEditTask
}
handleEditDateTimeTask
=
{
handleEditDateTimeTask
}
deleteDateTimeTask
=
{
deleteDateTimeTaskHandle
}
onChange
=
{
onChange
}
onModalOpen
=
{
onModalOpen
}
...
...
planner-front/src/store/actions/tasksActions.js
View file @
c1d5bc88
...
...
@@ -64,8 +64,8 @@ export const fetchAllTasks = () => {
};
//**fetch tasks for table UsersTasks, start*/
const
fetchAllTasksByMembershipSuccess
=
(
tasks
)
=>
{
return
{
type
:
FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS
,
tasks
}
const
fetchAllTasksByMembershipSuccess
=
(
tasks
,
projects
)
=>
{
return
{
type
:
FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS
,
tasks
,
projects
}
};
...
...
@@ -75,7 +75,7 @@ export const fetchAllTasksByMembership = () => {
dispatch
(
fetchCalendarTasksRequest
());
try
{
const
response
=
await
axios
.
get
(
"/tasks/users-tasks"
);
dispatch
(
fetchAllTasksByMembershipSuccess
(
response
.
data
.
tasks
))
dispatch
(
fetchAllTasksByMembershipSuccess
(
response
.
data
.
tasks
,
response
.
data
.
projects
))
}
catch
(
error
)
{
dispatch
(
fetchCalendarTasksFailure
(
error
.
response
.
data
));
}
...
...
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