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
7ee93529
Commit
7ee93529
authored
Dec 13, 2022
by
Ibadullina Inabat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Реализовано удаление участника проекта
parent
4c9591fc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
26 deletions
+12
-26
MemberForm.js
planner-front/src/components/MemberForm/MemberForm.js
+11
-25
ProjectMembersList.js
...rojectComponents/ProjectMembersList/ProjectMembersList.js
+1
-1
No files found.
planner-front/src/components/MemberForm/MemberForm.js
View file @
7ee93529
import
{
Box
,
Button
,
Grid
,
Modal
}
from
"@mui/material"
;
import
{
Box
,
Button
,
Grid
,
Modal
}
from
"@mui/material"
;
import
{
useState
}
from
"react"
;
import
{
useState
}
from
"react"
;
import
{
useSelector
,
useDispatch
}
from
"react-redux"
;
import
{
useSelector
,
useDispatch
}
from
"react-redux"
;
import
FormElement
from
"../UI/Form/FormElement/FormElement"
;
import
{
Typography
}
from
"@mui/material"
;
import
{
Typography
}
from
"@mui/material"
;
import
TextField
from
'@mui/material/TextField'
;
import
TextField
from
'@mui/material/TextField'
;
import
Stack
from
'@mui/material/Stack'
;
import
Autocomplete
from
'@mui/material/Autocomplete'
;
import
Autocomplete
from
'@mui/material/Autocomplete'
;
import
{
useParams
}
from
"react-router-dom"
;
import
{
useParams
}
from
"react-router-dom"
;
import
PersonAddIcon
from
'@mui/icons-material/PersonAdd'
;
import
PersonAddIcon
from
'@mui/icons-material/PersonAdd'
;
import
{
fetchUsers
}
from
"../../store/actions/usersActions"
;
import
{
useEffect
}
from
"react"
;
import
{
useEffect
}
from
"react"
;
import
{
fetchProject
}
from
"../../store/actions/projectsActions"
;
import
{
fetchProject
}
from
"../../store/actions/projectsActions"
;
...
@@ -34,7 +31,6 @@ const MemberForm = ({ onSubmit, members }) => {
...
@@ -34,7 +31,6 @@ const MemberForm = ({ onSubmit, members }) => {
const
handleOpen
=
()
=>
setOpen
(
true
);
const
handleOpen
=
()
=>
setOpen
(
true
);
const
handleClose
=
()
=>
setOpen
(
false
);
const
handleClose
=
()
=>
setOpen
(
false
);
const
[
state
,
setState
]
=
useState
({
const
[
state
,
setState
]
=
useState
({
// displayName: "",
roleProject
:
""
,
roleProject
:
""
,
user
:
""
,
user
:
""
,
projectId
:
""
projectId
:
""
...
@@ -43,7 +39,7 @@ const MemberForm = ({ onSubmit, members }) => {
...
@@ -43,7 +39,7 @@ const MemberForm = ({ onSubmit, members }) => {
const
submitFormHandler
=
(
e
)
=>
{
const
submitFormHandler
=
(
e
)
=>
{
e
.
preventDefault
();
e
.
preventDefault
();
let
members
=
{
roleProject
:
state
.
roleProject
,
projectId
:
params
.
id
,
userId
:
state
.
user
.
id
}
let
members
=
{
roleProject
:
state
.
roleProject
,
projectId
:
params
.
id
,
userId
:
state
.
user
.
id
}
console
.
log
(
members
);
console
.
log
(
members
);
onSubmit
(
members
);
onSubmit
(
members
);
setOpen
(
false
);
setOpen
(
false
);
...
@@ -52,20 +48,11 @@ const MemberForm = ({ onSubmit, members }) => {
...
@@ -52,20 +48,11 @@ const MemberForm = ({ onSubmit, members }) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
fetchProject
(
params
.
id
))
dispatch
(
fetchProject
(
params
.
id
))
},
[]);
},
[
params
]);
// console.log(user)
// const onChange = (e) => {
// const value = e.target.value;
// const name = e.target.name;
// const newState= { ...state, [name]: value };
// console.log("newState " + newState)
// console.log("e.target " + e.target)
// console.log("e " + e)
// setState(newState);
// };
const
memberChangeHandler
=
(
e
,
value
)
=>
{
const
memberChangeHandler
=
(
e
,
value
)
=>
{
setState
(()
=>
{
return
{
...
state
,
user
:
value
,
projectId
:
params
.
id
}
});
setState
(()
=>
{
return
{
...
state
,
user
:
value
,
projectId
:
params
.
id
}
});
console
.
log
(
"memberChangeHandler"
+
value
)
console
.
log
(
"memberChangeHandler"
+
value
)
}
}
const
roleChangeHandler
=
(
e
,
value
)
=>
{
const
roleChangeHandler
=
(
e
,
value
)
=>
{
...
@@ -74,7 +61,7 @@ const MemberForm = ({ onSubmit, members }) => {
...
@@ -74,7 +61,7 @@ const MemberForm = ({ onSubmit, members }) => {
}
}
return
(
return
(
<
div
>
<
div
>
<
PersonAddIcon
onClick
=
{
handleOpen
}
style
=
{{
marginLeft
:
"30px"
,
marginTop
:
"-3px"
,
cursor
:
'pointer'
}}
>
Добавить
участника
<
/PersonAddIcon
>
<
PersonAddIcon
onClick
=
{
handleOpen
}
style
=
{{
marginLeft
:
"30px"
,
marginTop
:
"-3px"
,
cursor
:
'pointer'
}}
>
Добавить
участника
<
/PersonAddIcon
>
<
Modal
<
Modal
open
=
{
open
}
open
=
{
open
}
onClose
=
{
handleClose
}
onClose
=
{
handleClose
}
...
@@ -85,7 +72,7 @@ const MemberForm = ({ onSubmit, members }) => {
...
@@ -85,7 +72,7 @@ const MemberForm = ({ onSubmit, members }) => {
<
Box
sx
=
{
style
}
>
<
Box
sx
=
{
style
}
>
<
form
onSubmit
=
{
submitFormHandler
}
>
<
form
onSubmit
=
{
submitFormHandler
}
>
<
Grid
container
direction
=
"column"
spacing
=
{
2
}
>
<
Grid
container
direction
=
"column"
spacing
=
{
2
}
>
<
Typography
variant
=
"h5"
style
=
{{
margin
:
"5px"
,
textAlign
:
"center"
}}
>
Новый
участник
<
/Typography
>
<
Typography
variant
=
"h5"
style
=
{{
margin
:
"5px"
,
textAlign
:
"center"
}}
>
Новый
участник
<
/Typography
>
<
Autocomplete
<
Autocomplete
id
=
"free-solo-demo"
id
=
"free-solo-demo"
freeSolo
freeSolo
...
@@ -95,7 +82,7 @@ const MemberForm = ({ onSubmit, members }) => {
...
@@ -95,7 +82,7 @@ const MemberForm = ({ onSubmit, members }) => {
name
=
{
"userId"
}
name
=
{
"userId"
}
value
=
{
state
.
user
}
value
=
{
state
.
user
}
renderInput
=
{(
params
)
=>
<
TextField
renderInput
=
{(
params
)
=>
<
TextField
style
=
{{
margin
:
"5px"
}}
style
=
{{
margin
:
"5px"
}}
label
=
{
"Участник"
}
label
=
{
"Участник"
}
state
=
{
state
}
state
=
{
state
}
{...
params
}
/>
}
{...
params
}
/>
}
...
@@ -107,7 +94,7 @@ const MemberForm = ({ onSubmit, members }) => {
...
@@ -107,7 +94,7 @@ const MemberForm = ({ onSubmit, members }) => {
value
=
{
state
.
roleProject
}
value
=
{
state
.
roleProject
}
onChange
=
{
roleChangeHandler
}
onChange
=
{
roleChangeHandler
}
renderInput
=
{(
params
)
=>
<
TextField
renderInput
=
{(
params
)
=>
<
TextField
style
=
{{
margin
:
"5px"
}}
style
=
{{
margin
:
"5px"
}}
name
=
{
"roleProject"
}
name
=
{
"roleProject"
}
label
=
{
"Роль в проекте"
}
label
=
{
"Роль в проекте"
}
state
=
{
state
}
state
=
{
state
}
...
@@ -118,7 +105,6 @@ const MemberForm = ({ onSubmit, members }) => {
...
@@ -118,7 +105,6 @@ const MemberForm = ({ onSubmit, members }) => {
type
=
"submit"
type
=
"submit"
color
=
"primary"
color
=
"primary"
variant
=
"contained"
variant
=
"contained"
>
>
Create
Create
<
/Button
>
<
/Button
>
...
...
planner-front/src/components/ProjectComponents/ProjectMembersList/ProjectMembersList.js
View file @
7ee93529
...
@@ -12,7 +12,7 @@ const ProjectMembersList = ({members, roleProjectOfAuthor}) => {
...
@@ -12,7 +12,7 @@ const ProjectMembersList = ({members, roleProjectOfAuthor}) => {
id
=
{
member
.
id
}
id
=
{
member
.
id
}
key
=
{
member
.
id
}
key
=
{
member
.
id
}
roleProjectOfAuthor
=
{
roleProjectOfAuthor
}
roleProjectOfAuthor
=
{
roleProjectOfAuthor
}
userId
=
{
member
.
user
.
id
}
userId
=
{
member
?.
user
?
.
id
}
/
>
/
>
})}
})}
<
/Grid
>
<
/Grid
>
...
...
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