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
15fd3d71
Commit
15fd3d71
authored
Dec 12, 2022
by
Ibadullina Inabat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
реализовано добавление участника сразу на странице проекта
parent
dde54eb9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
MemberForm.js
planner-front/src/components/MemberForm/MemberForm.js
+11
-12
No files found.
planner-front/src/components/MemberForm/MemberForm.js
View file @
15fd3d71
import
{
Box
,
Button
,
Grid
,
Modal
}
from
"@mui/material"
;
import
{
useState
}
from
"react"
;
import
{
useSelector
}
from
"react-redux"
;
import
{
useSelector
,
useDispatch
}
from
"react-redux"
;
import
FormElement
from
"../UI/Form/FormElement/FormElement"
;
import
{
Typography
}
from
"@mui/material"
;
import
TextField
from
'@mui/material/TextField'
;
...
...
@@ -8,6 +8,9 @@ import Stack from '@mui/material/Stack';
import
Autocomplete
from
'@mui/material/Autocomplete'
;
import
{
useParams
}
from
"react-router-dom"
;
import
PersonAddIcon
from
'@mui/icons-material/PersonAdd'
;
import
{
fetchUsers
}
from
"../../store/actions/usersActions"
;
import
{
useEffect
}
from
"react"
;
import
{
fetchProject
}
from
"../../store/actions/projectsActions"
;
const
style
=
{
position
:
'relative'
,
...
...
@@ -21,10 +24,11 @@ const style = {
p
:
4
,
};
const
MemberForm
=
({
onSubmit
})
=>
{
const
MemberForm
=
({
onSubmit
,
members
})
=>
{
const
users
=
useSelector
(
state
=>
state
.
users
.
users
)
const
[
role
,
setRole
]
=
useState
([{
role
:
"user"
},
{
role
:
"admin"
},
{
role
:
"watcher"
}])
const
params
=
useParams
()
const
dispatch
=
useDispatch
();
const
[
open
,
setOpen
]
=
useState
(
false
);
const
handleOpen
=
()
=>
setOpen
(
true
);
...
...
@@ -39,21 +43,16 @@ const MemberForm = ({ onSubmit }) => {
const
submitFormHandler
=
(
e
)
=>
{
e
.
preventDefault
();
// let idOfUser = users?.map((user) => (user.displayName === state.displayName) ? user.id : null)
// let idOfUser = users?.map((user) => {
// console.log(user)
// return (user.id === state.displayName.id) ? user.id : null
// })
// console.log(idOfUser)
// console.log(idOfUser)
console
.
log
(
"state of submit "
+
state
);
let
members
=
{
roleProject
:
state
.
roleProject
,
projectId
:
params
.
id
,
userId
:
state
.
user
.
id
}
console
.
log
(
members
);
onSubmit
(
members
);
setOpen
(
false
);
};
console
.
log
(
state
);
useEffect
(()
=>
{
dispatch
(
fetchProject
(
params
.
id
))
},
[
members
,
dispatch
,
params
]);
// console.log(user)
// const onChange = (e) => {
// const value = e.target.value;
...
...
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