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
29bd3775
Commit
29bd3775
authored
Jan 12, 2023
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#149
Реализовал создание задачи
parent
e098bb78
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
11 deletions
+37
-11
NewTaskForm.js
...ments/UsersTasksTableContainer/NewTaskForm/NewTaskForm.js
+2
-2
UsersTasksTableContainer.js
...ents/UsersTasksTableContainer/UsersTasksTableContainer.js
+2
-1
UsersTasks.js
planner-front/src/containers/UsersTasks/UsersTasks.js
+33
-8
No files found.
planner-front/src/components/UsersTasksCompoments/UsersTasksTableContainer/NewTaskForm/NewTaskForm.js
View file @
29bd3775
...
@@ -5,7 +5,7 @@ import CustomSelect from "../../../UI/СustomSelect/СustomSelect"
...
@@ -5,7 +5,7 @@ import CustomSelect from "../../../UI/СustomSelect/СustomSelect"
import
MaterialUIPickers
from
"./DateTimePicker/DateTimePicker"
;
import
MaterialUIPickers
from
"./DateTimePicker/DateTimePicker"
;
import
{
Save
}
from
"@mui/icons-material"
;
import
{
Save
}
from
"@mui/icons-material"
;
function
NewTaskForm
({
addFormStatus
,
onChangeNewTaskHandler
,
newTask
,
allUserProjectsForModalTask
,
onDateChange
})
{
function
NewTaskForm
({
addFormStatus
,
onChangeNewTaskHandler
,
newTask
,
allUserProjectsForModalTask
,
onDateChange
,
createNewTaskHandler
})
{
const
workers
=
useMemo
(()
=>
{
const
workers
=
useMemo
(()
=>
{
if
(
newTask
?.
project
)
{
if
(
newTask
?.
project
)
{
return
newTask
?.
project
?.
members
.
map
((
member
)
=>
{
return
{
value
:
member
.
user
,
text
:
member
.
user
.
displayName
}})
return
newTask
?.
project
?.
members
.
map
((
member
)
=>
{
return
{
value
:
member
.
user
,
text
:
member
.
user
.
displayName
}})
...
@@ -91,7 +91,7 @@ function NewTaskForm({ addFormStatus, onChangeNewTaskHandler, newTask, allUserPr
...
@@ -91,7 +91,7 @@ function NewTaskForm({ addFormStatus, onChangeNewTaskHandler, newTask, allUserPr
/
>
/
>
<
/Grid
>
<
/Grid
>
<
Grid
item
xs
=
{
0.5
}
>
<
Grid
item
xs
=
{
0.5
}
>
<
IconButton
disabled
=
{
!
newTask
.
title
}
>
<
IconButton
disabled
=
{
!
newTask
.
title
}
onClick
=
{
createNewTaskHandler
}
>
<
Save
/>
<
Save
/>
<
/IconButton
>
<
/IconButton
>
<
/Grid
>
<
/Grid
>
...
...
planner-front/src/components/UsersTasksCompoments/UsersTasksTableContainer/UsersTasksTableContainer.js
View file @
29bd3775
...
@@ -5,7 +5,7 @@ import UsersTasksTableBody from "./UsersTasksTableBody/UsersTasksTableBody";
...
@@ -5,7 +5,7 @@ import UsersTasksTableBody from "./UsersTasksTableBody/UsersTasksTableBody";
import
UsersTasksTableHead
from
"./UsersTasksTableHead/UsersTasksTableHead"
;
import
UsersTasksTableHead
from
"./UsersTasksTableHead/UsersTasksTableHead"
;
function
UsersTasksTableContainer
({
order
,
orderBy
,
handleRequestSort
,
rows
,
page
,
rowsPerPage
,
addFormStatus
,
onChangeNewTaskHandler
,
newTask
,
allUserProjectsForModalTask
,
onDateChange
})
{
function
UsersTasksTableContainer
({
order
,
orderBy
,
handleRequestSort
,
rows
,
page
,
rowsPerPage
,
addFormStatus
,
onChangeNewTaskHandler
,
newTask
,
allUserProjectsForModalTask
,
onDateChange
,
createNewTaskHandler
})
{
return
(
return
(
<
TableContainer
>
<
TableContainer
>
<
NewTaskForm
<
NewTaskForm
...
@@ -14,6 +14,7 @@ function UsersTasksTableContainer({ order, orderBy, handleRequestSort, rows, pag
...
@@ -14,6 +14,7 @@ function UsersTasksTableContainer({ order, orderBy, handleRequestSort, rows, pag
newTask
=
{
newTask
}
newTask
=
{
newTask
}
allUserProjectsForModalTask
=
{
allUserProjectsForModalTask
}
allUserProjectsForModalTask
=
{
allUserProjectsForModalTask
}
onDateChange
=
{
onDateChange
}
onDateChange
=
{
onDateChange
}
createNewTaskHandler
=
{()
=>
{
createNewTaskHandler
()}}
/
>
/
>
<
Table
<
Table
sx
=
{{
minWidth
:
750
}}
sx
=
{{
minWidth
:
750
}}
...
...
planner-front/src/containers/UsersTasks/UsersTasks.js
View file @
29bd3775
...
@@ -2,7 +2,7 @@ import Paper from '@mui/material/Paper';
...
@@ -2,7 +2,7 @@ import Paper from '@mui/material/Paper';
import
UsersTasksTableToolbar
from
'../../components/UsersTasksCompoments/UsersTasksTableToolbar/UsersTasksTableToolbar'
;
import
UsersTasksTableToolbar
from
'../../components/UsersTasksCompoments/UsersTasksTableToolbar/UsersTasksTableToolbar'
;
import
UsersTasksTablePagination
from
'../../components/UsersTasksCompoments/UsersTasksTablePagination/UsersTasksTablePagination'
;
import
UsersTasksTablePagination
from
'../../components/UsersTasksCompoments/UsersTasksTablePagination/UsersTasksTablePagination'
;
import
UsersTasksTableContainer
from
'../../components/UsersTasksCompoments/UsersTasksTableContainer/UsersTasksTableContainer'
;
import
UsersTasksTableContainer
from
'../../components/UsersTasksCompoments/UsersTasksTableContainer/UsersTasksTableContainer'
;
import
{
fetchAllTasksByMembership
}
from
'../../store/actions/tasksActions'
;
import
{
addTaskToUserTasksTable
,
fetchAllTasksByMembership
}
from
'../../store/actions/tasksActions'
;
import
{
shallowEqual
,
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
shallowEqual
,
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
{
fetchAllUserProjects
}
from
'../../store/actions/projectsActions'
;
import
{
fetchAllUserProjects
}
from
'../../store/actions/projectsActions'
;
...
@@ -18,10 +18,10 @@ export default function EnhancedTable() {
...
@@ -18,10 +18,10 @@ export default function EnhancedTable() {
const
[
newTask
,
setNewTask
]
=
useState
({
const
[
newTask
,
setNewTask
]
=
useState
({
priority
:
''
,
priority
:
''
,
title
:
''
,
title
:
''
,
project
:
''
,
project
:
null
,
description
:
''
,
description
:
''
,
executor
:
''
,
executor
:
null
,
dateTimeDeadLine
:
''
,
dateTimeDeadLine
:
null
,
})
})
const
[
order
,
setOrder
]
=
useState
(
'asc'
);
const
[
order
,
setOrder
]
=
useState
(
'asc'
);
const
[
orderBy
,
setOrderBy
]
=
useState
(
'createdAt'
);
const
[
orderBy
,
setOrderBy
]
=
useState
(
'createdAt'
);
...
@@ -34,10 +34,6 @@ export default function EnhancedTable() {
...
@@ -34,10 +34,6 @@ export default function EnhancedTable() {
dispatch
(
fetchAllUserProjects
())
dispatch
(
fetchAllUserProjects
())
},
[
dispatch
]);
},
[
dispatch
]);
useEffect
(()
=>
{
dispatch
(
fetchAllUserProjects
())
},
[
dispatch
])
const
onChangeNewTaskHandler
=
(
e
)
=>
{
const
onChangeNewTaskHandler
=
(
e
)
=>
{
const
{
value
,
name
}
=
e
.
target
;
const
{
value
,
name
}
=
e
.
target
;
setNewTask
((
prevState
=>
{
setNewTask
((
prevState
=>
{
...
@@ -74,6 +70,34 @@ export default function EnhancedTable() {
...
@@ -74,6 +70,34 @@ export default function EnhancedTable() {
};
};
const
createTaskFromButtonHandler
=
()
=>
{
const
createTaskFromButtonHandler
=
()
=>
{
if
(
addFormStatus
)
{
setNewTask
({
priority
:
''
,
title
:
''
,
project
:
''
,
description
:
''
,
executor
:
''
,
dateTimeDeadLine
:
''
,
})
}
setAddFormStatus
((
prevState
)
=>
{
return
!
prevState
})
}
const
createNewTaskHandler
=
()
=>
{
if
(
newTask
.
priority
===
''
)
{
const
task
=
{...
newTask
,
priority
:
null
}
dispatch
(
addTaskToUserTasksTable
(
task
))
}
else
{
dispatch
(
addTaskToUserTasksTable
(
newTask
))
}
setNewTask
({
priority
:
''
,
title
:
''
,
project
:
''
,
description
:
''
,
executor
:
''
,
dateTimeDeadLine
:
''
,
})
setAddFormStatus
((
prevState
)
=>
{
return
!
prevState
})
setAddFormStatus
((
prevState
)
=>
{
return
!
prevState
})
}
}
...
@@ -95,6 +119,7 @@ export default function EnhancedTable() {
...
@@ -95,6 +119,7 @@ export default function EnhancedTable() {
newTask
=
{
newTask
}
newTask
=
{
newTask
}
allUserProjectsForModalTask
=
{
allUserProjectsForModalTask
}
allUserProjectsForModalTask
=
{
allUserProjectsForModalTask
}
onDateChange
=
{
onDateChange
}
onDateChange
=
{
onDateChange
}
createNewTaskHandler
=
{
createNewTaskHandler
}
/
>
/
>
<
UsersTasksTablePagination
<
UsersTasksTablePagination
count
=
{
tasks
.
length
}
count
=
{
tasks
.
length
}
...
...
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