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
604159dd
Commit
604159dd
authored
Jan 15, 2023
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#154
Изменил все запросы под текущую таблицу
parent
9021b8a9
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
56 additions
and
85 deletions
+56
-85
tasks.ts
planner-api/src/routers/tasks.ts
+1
-0
MyTaskNewTaskForm.js
...asksTableContainer/MyTaskNewTaskForm/MyTaskNewTaskForm.js
+5
-25
EditRow.js
...eContainer/MyTasksTableBody/MyTasksRow/EditRow/EditRow.js
+4
-14
MyTasksRow.js
...sTableContainer/MyTasksTableBody/MyTasksRow/MyTasksRow.js
+3
-3
MyTasksTableHead.js
...yTasksTableContainer/MyTasksTableHead/MyTasksTableHead.js
+3
-3
MyTasksTableToolbar.js
...asksCompoments/MyTasksTableToolbar/MyTasksTableToolbar.js
+1
-1
MyTasks.js
planner-front/src/containers/MyTasks/MyTasks.js
+24
-36
UsersTasks.js
planner-front/src/containers/UsersTasks/UsersTasks.js
+1
-1
tasksActions.js
planner-front/src/store/actions/tasksActions.js
+1
-1
tasksReducer.js
planner-front/src/store/reducers/tasksReducer.js
+13
-1
No files found.
planner-api/src/routers/tasks.ts
View file @
604159dd
...
@@ -29,6 +29,7 @@ router.get('/', async(req:Request, res:Response):Promise<Response> => {
...
@@ -29,6 +29,7 @@ router.get('/', async(req:Request, res:Response):Promise<Response> => {
router
.
post
(
'/'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
router
.
post
(
'/'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
const
{
user
,
title
,
description
,
project
,
executor
,
dateTimeStart
,
dateTimeDue
,
dateTimeDeadLine
,
priority
,
calendar
}
=
req
.
body
;
const
{
user
,
title
,
description
,
project
,
executor
,
dateTimeStart
,
dateTimeDue
,
dateTimeDeadLine
,
priority
,
calendar
}
=
req
.
body
;
console
.
log
(
'dateTimeStart
\
n'
,
dateTimeStart
,
"dateTimeDue
\n
"
,
dateTimeDue
,
'dateTimeDeadLine
\
n '
,
dateTimeDeadLine
)
console
.
log
(
'dateTimeStart
\
n'
,
dateTimeStart
,
"dateTimeDue
\n
"
,
dateTimeDue
,
'dateTimeDeadLine
\
n '
,
dateTimeDeadLine
)
console
.
log
(
req
.
body
)
let
dateTimeDueFinal
=
dateTimeDue
let
dateTimeDueFinal
=
dateTimeDue
let
dateTimeStartFinal
=
dateTimeStart
let
dateTimeStartFinal
=
dateTimeStart
let
dateTimeDeadlineFinal
=
dateTimeDeadLine
let
dateTimeDeadlineFinal
=
dateTimeDeadLine
...
...
planner-front/src/components/MyTasksCompoments/MyTasksTableContainer/MyTaskNewTaskForm/MyTaskNewTaskForm.js
View file @
604159dd
import
{
Box
,
Divider
,
Grid
,
IconButton
,
TextField
,
Tooltip
,
Typography
,
}
from
"@mui/material"
;
import
{
Box
,
Divider
,
Grid
,
IconButton
,
TextField
,
Tooltip
,
Typography
,
}
from
"@mui/material"
;
import
{
styled
}
from
'@mui/material/styles'
;
import
{
styled
}
from
'@mui/material/styles'
;
import
{
memo
,
useMemo
}
from
"react"
;
import
{
memo
}
from
"react"
;
import
{
priorities
}
from
"../../../../constants"
;
import
{
priorities
}
from
"../../../../constants"
;
import
CustomSelect
from
"../../../UI/СustomSelect/СustomSelect"
import
CustomSelect
from
"../../../UI/СustomSelect/СustomSelect"
import
MaterialUIPickers
from
"../DateTimePicker/DateTimePicker"
;
import
MaterialUIPickers
from
"../DateTimePicker/DateTimePicker"
;
...
@@ -18,14 +18,6 @@ const StyledTooltip = styled(({ className, ...props }) => (
...
@@ -18,14 +18,6 @@ const StyledTooltip = styled(({ className, ...props }) => (
function
MyTaskNewTaskForm
({
addFormStatus
,
onChangeNewTaskHandler
,
newTask
,
allUserProjectsForModalTask
,
onDateChangeHandler
,
createNewTaskHandler
})
{
function
MyTaskNewTaskForm
({
addFormStatus
,
onChangeNewTaskHandler
,
newTask
,
allUserProjectsForModalTask
,
onDateChangeHandler
,
createNewTaskHandler
})
{
const
workers
=
useMemo
(()
=>
{
if
(
newTask
?.
project
)
{
return
newTask
?.
project
?.
members
.
map
((
member
)
=>
{
return
{
value
:
member
.
user
,
text
:
member
.
user
.
displayName
}
})
}
else
{
return
[{
value
:
''
,
text
:
'Выберите проект'
}]
}
},
[
newTask
?.
project
])
return
(
return
(
<
Box
sx
=
{{
<
Box
sx
=
{{
...
@@ -44,11 +36,10 @@ function MyTaskNewTaskForm({ addFormStatus, onChangeNewTaskHandler, newTask, all
...
@@ -44,11 +36,10 @@ function MyTaskNewTaskForm({ addFormStatus, onChangeNewTaskHandler, newTask, all
}}
>
}}
>
<
Grid
container
padding
=
{
2
}
>
<
Grid
container
padding
=
{
2
}
>
<
Grid
item
xs
=
{
1
}
>
Приоритеты
<
/Grid
>
<
Grid
item
xs
=
{
1
}
>
Приоритеты
<
/Grid
>
<
Grid
item
xs
=
{
3.
5
}
>
Заголовок
<
/Grid
>
<
Grid
item
xs
=
{
5
}
>
Заголовок
<
/Grid
>
<
Grid
item
xs
=
{
2
}
>
Проект
<
/Grid
>
<
Grid
item
xs
=
{
2
}
>
Проект
<
/Grid
>
<
Grid
item
xs
=
{
2
}
>
Исполнитель
<
/Grid
>
<
Grid
item
xs
=
{
3
}
>
Дедлайн
<
/Grid
>
<
Grid
item
xs
=
{
3
}
>
Дедлайн
<
/Grid
>
<
Grid
item
xs
=
{
0.5
}
><
/Grid
>
<
Grid
item
xs
=
{
1
}
><
/Grid
>
<
/Grid
>
<
/Grid
>
<
Grid
container
padding
=
{
2
}
alignItems
=
'center'
>
<
Grid
container
padding
=
{
2
}
alignItems
=
'center'
>
<
Grid
item
xs
=
{
1
}
>
<
Grid
item
xs
=
{
1
}
>
...
@@ -63,7 +54,7 @@ function MyTaskNewTaskForm({ addFormStatus, onChangeNewTaskHandler, newTask, all
...
@@ -63,7 +54,7 @@ function MyTaskNewTaskForm({ addFormStatus, onChangeNewTaskHandler, newTask, all
sx
=
{{
width
:
'90%'
}}
sx
=
{{
width
:
'90%'
}}
/
>
/
>
<
/Grid
>
<
/Grid
>
<
Grid
item
xs
=
{
3.
5
}
>
<
Grid
item
xs
=
{
5
}
>
<
StyledTooltip
<
StyledTooltip
title
=
{
<
TextField
title
=
{
<
TextField
id
=
"task-description"
id
=
"task-description"
...
@@ -98,17 +89,6 @@ function MyTaskNewTaskForm({ addFormStatus, onChangeNewTaskHandler, newTask, all
...
@@ -98,17 +89,6 @@ function MyTaskNewTaskForm({ addFormStatus, onChangeNewTaskHandler, newTask, all
sx
=
{{
width
:
'90%'
}}
sx
=
{{
width
:
'90%'
}}
/
>
/
>
<
/Grid
>
<
/Grid
>
<
Grid
item
xs
=
{
2
}
>
<
CustomSelect
value
=
{
newTask
.
executor
}
name
=
{
'executor'
}
variant
=
{
'outlined'
}
onChange
=
{
onChangeNewTaskHandler
}
id
=
{
'executor'
}
items
=
{
workers
}
sx
=
{{
width
:
'90%'
}}
/
>
<
/Grid
>
<
Grid
item
xs
=
{
3
}
>
<
Grid
item
xs
=
{
3
}
>
<
MaterialUIPickers
<
MaterialUIPickers
task
=
{
newTask
}
task
=
{
newTask
}
...
@@ -116,7 +96,7 @@ function MyTaskNewTaskForm({ addFormStatus, onChangeNewTaskHandler, newTask, all
...
@@ -116,7 +96,7 @@ function MyTaskNewTaskForm({ addFormStatus, onChangeNewTaskHandler, newTask, all
onChange
=
{
onDateChangeHandler
}
onChange
=
{
onDateChangeHandler
}
/
>
/
>
<
/Grid
>
<
/Grid
>
<
Grid
item
xs
=
{
0.5
}
>
<
Grid
item
xs
=
{
1
}
>
<
IconButton
disabled
=
{
!
isValidate
(
newTask
.
title
,
newTask
.
description
)}
onClick
=
{
createNewTaskHandler
}
>
<
IconButton
disabled
=
{
!
isValidate
(
newTask
.
title
,
newTask
.
description
)}
onClick
=
{
createNewTaskHandler
}
>
<
Save
/>
<
Save
/>
<
/IconButton
>
<
/IconButton
>
...
...
planner-front/src/components/MyTasksCompoments/MyTasksTableContainer/MyTasksTableBody/MyTasksRow/EditRow/EditRow.js
View file @
604159dd
import
{
TableCell
,
TextField
,
Tooltip
}
from
"@mui/material"
;
import
{
TableCell
,
TextField
,
Tooltip
}
from
"@mui/material"
;
import
moment
from
"moment"
;
import
moment
from
"moment"
;
import
{
memo
,
useMemo
}
from
"react"
;
import
{
memo
}
from
"react"
;
import
{
accomplishStatuses
,
priorities
}
from
"../../../../../../constants"
;
import
{
accomplishStatuses
,
priorities
}
from
"../../../../../../constants"
;
import
CustomSelect
from
"../../../../../UI/СustomSelect/СustomSelect"
import
CustomSelect
from
"../../../../../UI/СustomSelect/СustomSelect"
import
{
styled
}
from
'@mui/material/styles'
;
import
{
styled
}
from
'@mui/material/styles'
;
...
@@ -15,16 +15,6 @@ const StyledTooltip = styled(({ className, ...props }) => (
...
@@ -15,16 +15,6 @@ const StyledTooltip = styled(({ className, ...props }) => (
`
;
`
;
function
EditRow
({
buttons
,
dateTimeTasks
,
onChangeCurrentTaskHandler
,
currentTask
,
allUserProjectsForModalTask
,
onDateChangeEditHandler
,
user
})
{
function
EditRow
({
buttons
,
dateTimeTasks
,
onChangeCurrentTaskHandler
,
currentTask
,
allUserProjectsForModalTask
,
onDateChangeEditHandler
,
user
})
{
const
workers
=
useMemo
(()
=>
{
if
(
currentTask
?.
project
)
{
currentTask
.
project
=
allUserProjectsForModalTask
.
find
((
project
)
=>
project
?.
value
?.
id
===
currentTask
?.
project
?.
id
)?.
value
const
arrUsers
=
currentTask
?.
project
?.
members
.
map
((
member
)
=>
{
return
{
value
:
member
.
user
,
text
:
member
.
user
.
displayName
}
})
arrUsers
.
push
({
value
:
''
,
text
:
'Никто'
})
return
arrUsers
}
else
{
return
[{
value
:
''
,
text
:
'Выберите проект'
}]
}
},
[
allUserProjectsForModalTask
,
currentTask
])
return
(
return
(
<>
<>
...
@@ -45,7 +35,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa
...
@@ -45,7 +35,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa
<
TableCell
sx
=
{{
width
:
'10%'
}}
>
{
moment
(
currentTask
.
createdAt
).
format
(
'DD.MM.YYYY'
)}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'10%'
}}
>
{
moment
(
currentTask
.
createdAt
).
format
(
'DD.MM.YYYY'
)}
<
/TableCell
>
<
Tooltip
title
=
{
currentTask
.
description
}
>
<
Tooltip
title
=
{
currentTask
.
description
}
>
<
TableCell
sx
=
{{
width
:
'2
5
%'
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
}}
>
<
TableCell
sx
=
{{
width
:
'2
8
%'
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
}}
>
{
user
.
id
===
currentTask
.
author
.
id
?
{
user
.
id
===
currentTask
.
author
.
id
?
<
StyledTooltip
<
StyledTooltip
title
=
{
<
TextField
title
=
{
<
TextField
...
@@ -72,7 +62,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa
...
@@ -72,7 +62,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa
:
currentTask
.
title
}
:
currentTask
.
title
}
<
/TableCell
>
<
/TableCell
>
<
/Tooltip
>
<
/Tooltip
>
<
TableCell
sx
=
{{
width
:
'1
0
%'
}}
>
<
TableCell
sx
=
{{
width
:
'1
2
%'
}}
>
{
user
.
id
===
currentTask
.
author
.
id
?
{
user
.
id
===
currentTask
.
author
.
id
?
<
CustomSelect
<
CustomSelect
value
=
{
currentTask
.
project
}
value
=
{
currentTask
.
project
}
...
@@ -85,7 +75,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa
...
@@ -85,7 +75,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa
/
>
/
>
:
currentTask
.
projectTitle
}
:
currentTask
.
projectTitle
}
<
/TableCell
>
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'
8
%'
}}
>
{
currentTask
.
authorName
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'
11
%'
}}
>
{
currentTask
.
authorName
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'13%'
}}
>
<
TableCell
sx
=
{{
width
:
'13%'
}}
>
{
dateTimeTasks
}
{
dateTimeTasks
}
...
...
planner-front/src/components/MyTasksCompoments/MyTasksTableContainer/MyTasksTableBody/MyTasksRow/MyTasksRow.js
View file @
604159dd
...
@@ -164,12 +164,12 @@ function MyTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHandle
...
@@ -164,12 +164,12 @@ function MyTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHandle
<
TableCell
sx
=
{{
width
:
'4%'
}}
>
{
row
.
priority
?
row
.
priority
:
null
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'4%'
}}
>
{
row
.
priority
?
row
.
priority
:
null
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'10%'
}}
>
{
moment
(
row
.
createdAt
).
format
(
'DD.MM.YYYY'
)}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'10%'
}}
>
{
moment
(
row
.
createdAt
).
format
(
'DD.MM.YYYY'
)}
<
/TableCell
>
<
Tooltip
title
=
{
row
.
description
}
>
<
Tooltip
title
=
{
row
.
description
}
>
<
TableCell
sx
=
{{
width
:
'2
5
%'
}}
>
<
TableCell
sx
=
{{
width
:
'2
8
%'
}}
>
{
row
.
title
}
{
row
.
title
}
<
/TableCell
>
<
/TableCell
>
<
/Tooltip
>
<
/Tooltip
>
<
TableCell
sx
=
{{
width
:
'1
0
%'
}}
>
{
row
.
projectTitle
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'1
2
%'
}}
>
{
row
.
projectTitle
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'
8
%'
}}
>
{
row
.
authorName
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'
11
%'
}}
>
{
row
.
authorName
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'13%'
}}
>
<
TableCell
sx
=
{{
width
:
'13%'
}}
>
{
dateTimeTasks
}
{
dateTimeTasks
}
...
...
planner-front/src/components/MyTasksCompoments/MyTasksTableContainer/MyTasksTableHead/MyTasksTableHead.js
View file @
604159dd
...
@@ -24,7 +24,7 @@ const headCells = [
...
@@ -24,7 +24,7 @@ const headCells = [
label
:
"Заголовок"
,
label
:
"Заголовок"
,
canSort
:
true
,
canSort
:
true
,
style
:
{
style
:
{
width
:
'2
5
%'
width
:
'2
8
%'
}
}
},
},
{
{
...
@@ -32,7 +32,7 @@ const headCells = [
...
@@ -32,7 +32,7 @@ const headCells = [
label
:
"Проект"
,
label
:
"Проект"
,
canSort
:
true
,
canSort
:
true
,
style
:
{
style
:
{
width
:
'1
0
%'
width
:
'1
2
%'
}
}
},
},
{
{
...
@@ -40,7 +40,7 @@ const headCells = [
...
@@ -40,7 +40,7 @@ const headCells = [
label
:
"Автор"
,
label
:
"Автор"
,
canSort
:
true
,
canSort
:
true
,
style
:
{
style
:
{
width
:
'
8
%'
width
:
'
11
%'
}
}
},
},
{
{
...
...
planner-front/src/components/MyTasksCompoments/MyTasksTableToolbar/MyTasksTableToolbar.js
View file @
604159dd
...
@@ -28,7 +28,7 @@ return (
...
@@ -28,7 +28,7 @@ return (
id
=
"tableTitle"
id
=
"tableTitle"
component
=
"div"
component
=
"div"
>
>
Задачи
сотрудников
Мои
задачи
<
/Typography
>
<
/Typography
>
{
projectsFilter
}
{
projectsFilter
}
<
CreateTaskFromButton
<
CreateTaskFromButton
...
...
planner-front/src/containers/MyTasks/MyTasks.js
View file @
604159dd
...
@@ -2,17 +2,18 @@ import Paper from '@mui/material/Paper';
...
@@ -2,17 +2,18 @@ import Paper from '@mui/material/Paper';
import
MyTasksTableToolbar
from
'../../components/MyTasksCompoments/MyTasksTableToolbar/MyTasksTableToolbar'
;
import
MyTasksTableToolbar
from
'../../components/MyTasksCompoments/MyTasksTableToolbar/MyTasksTableToolbar'
;
import
MyTasksTablePagination
from
'../../components/MyTasksCompoments/MyTasksTablePagination/MyTasksTablePagination'
;
import
MyTasksTablePagination
from
'../../components/MyTasksCompoments/MyTasksTablePagination/MyTasksTablePagination'
;
import
MyTasksTableContainer
from
'../../components/MyTasksCompoments/MyTasksTableContainer/MyTasksTableContainer'
;
import
MyTasksTableContainer
from
'../../components/MyTasksCompoments/MyTasksTableContainer/MyTasksTableContainer'
;
import
{
activateCreateCopyTasksMode
,
addTaskToUserTasksTable
,
deleteDateTimeTaskUsers
,
deleteTaskUsers
,
editTaskUsers
,
fetchAllTasksByMembership
,
sortTaskByProjects
}
from
'../../store/actions/tasksActions'
;
import
{
activateCreateCopyTasksMode
,
fetchAllTasks
,
sortTaskByProjects
,
addTask
,
deleteTask
,
deleteDateTimeTask
,
editTask
}
from
'../../store/actions/tasksActions'
;
import
{
shallowEqual
,
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
shallowEqual
,
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
useCallback
,
useEffect
,
useState
}
from
'react'
;
import
{
useCallback
,
useEffect
,
useState
}
from
'react'
;
import
{
fetchAllUserProjects
,
fetchProjects
}
from
'../../store/actions/projectsActions'
;
import
{
fetchAllUserProjects
,
fetchProjects
}
from
'../../store/actions/projectsActions'
;
import
moment
from
'moment'
;
import
moment
from
'moment'
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
{
useNavigate
}
from
'react-router-dom'
;
export
default
function
EnhancedTable
()
{
export
default
function
MyTasks
()
{
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
navigate
=
useNavigate
()
const
navigate
=
useNavigate
()
const
{
user
}
=
useSelector
((
state
)
=>
state
.
users
);
const
{
tasks
,
sortedTasks
}
=
useSelector
((
state
)
=>
state
.
tasks
,
shallowEqual
);
const
{
tasks
,
sortedTasks
}
=
useSelector
((
state
)
=>
state
.
tasks
,
shallowEqual
);
const
{
allUserProjectsForModalTask
,
projects
}
=
useSelector
(
state
=>
state
.
projects
,
shallowEqual
)
const
{
allUserProjectsForModalTask
,
projects
}
=
useSelector
(
state
=>
state
.
projects
,
shallowEqual
)
...
@@ -21,7 +22,6 @@ export default function EnhancedTable() {
...
@@ -21,7 +22,6 @@ export default function EnhancedTable() {
title
:
''
,
title
:
''
,
project
:
''
,
project
:
''
,
description
:
''
,
description
:
''
,
executor
:
''
,
dateTimeDeadLine
:
null
,
dateTimeDeadLine
:
null
,
})
})
...
@@ -30,7 +30,6 @@ export default function EnhancedTable() {
...
@@ -30,7 +30,6 @@ export default function EnhancedTable() {
title
:
''
,
title
:
''
,
project
:
''
,
project
:
''
,
description
:
''
,
description
:
''
,
executor
:
''
,
dateTimeDeadLine
:
null
,
dateTimeDeadLine
:
null
,
})
})
...
@@ -42,7 +41,7 @@ export default function EnhancedTable() {
...
@@ -42,7 +41,7 @@ export default function EnhancedTable() {
const
[
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
]
=
useState
([]);
const
[
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
]
=
useState
([]);
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
fetchAllTasks
ByMembership
());
dispatch
(
fetchAllTasks
());
dispatch
(
fetchAllUserProjects
())
dispatch
(
fetchAllUserProjects
())
dispatch
(
fetchProjects
())
dispatch
(
fetchProjects
())
},
[
dispatch
]);
},
[
dispatch
]);
...
@@ -114,7 +113,6 @@ export default function EnhancedTable() {
...
@@ -114,7 +113,6 @@ export default function EnhancedTable() {
title
:
''
,
title
:
''
,
project
:
''
,
project
:
''
,
description
:
''
,
description
:
''
,
executor
:
''
,
dateTimeDeadLine
:
null
dateTimeDeadLine
:
null
})
})
}
}
...
@@ -122,36 +120,31 @@ export default function EnhancedTable() {
...
@@ -122,36 +120,31 @@ export default function EnhancedTable() {
},
[
addFormStatus
])
},
[
addFormStatus
])
const
createNewTaskHandler
=
useCallback
(()
=>
{
const
createNewTaskHandler
=
useCallback
(()
=>
{
if
(
newTask
.
priority
===
''
||
newTask
.
project
===
''
||
newTask
.
executor
===
''
)
{
const
task
=
{
const
task
=
{
...
newTask
,
...
newTask
,
priority
:
newTask
.
priority
?
newTask
.
priority
:
null
,
priority
:
newTask
.
priority
?
newTask
.
priority
:
null
,
project
:
newTask
.
project
?
newTask
.
project
:
null
,
project
:
newTask
.
project
?
newTask
.
project
:
null
,
executor
:
newTask
.
executor
?
newTask
.
executor
:
null
,
executor
:
user
,
dateTimeDeadLine
:
new
Date
(
newTask
.
dateTimeDeadLine
)
instanceof
Date
&&
!
isNaN
(
new
Date
(
newTask
.
dateTimeDeadLine
))
?
newTask
.
dateTimeDeadLine
:
null
dateTimeDeadLine
:
new
Date
(
newTask
.
dateTimeDeadLine
)
instanceof
Date
&&
!
isNaN
(
new
Date
(
newTask
.
dateTimeDeadLine
))
?
newTask
.
dateTimeDeadLine
:
null
}
}
dispatch
(
addTaskToUserTasksTable
(
task
))
dispatch
(
addTask
(
task
))
}
else
{
dispatch
(
addTaskToUserTasksTable
(
newTask
))
}
setNewTask
({
setNewTask
({
priority
:
''
,
priority
:
''
,
title
:
''
,
title
:
''
,
project
:
''
,
project
:
''
,
description
:
''
,
description
:
''
,
executor
:
''
,
dateTimeDeadLine
:
null
dateTimeDeadLine
:
null
})
})
setAddFormStatus
((
prevState
)
=>
{
return
!
prevState
})
setAddFormStatus
((
prevState
)
=>
{
return
!
prevState
})
},
[
dispatch
,
newTask
])
},
[
dispatch
,
newTask
,
user
])
console
.
log
(
currentTask
)
const
deleteTaskHandler
=
useCallback
((
id
)
=>
{
const
deleteTaskHandler
=
useCallback
((
id
)
=>
{
dispatch
(
deleteTask
Users
(
id
))
dispatch
(
deleteTask
(
id
))
},
[
dispatch
])
},
[
dispatch
])
const
deleteCopyTaskHandler
=
useCallback
((
id
)
=>
{
const
deleteCopyTaskHandler
=
useCallback
((
id
)
=>
{
dispatch
(
deleteDateTimeTask
Users
(
id
))
dispatch
(
deleteDateTimeTask
(
id
))
},
[
dispatch
])
},
[
dispatch
])
const
calendarOpen
=
useCallback
((
task
)
=>
{
const
calendarOpen
=
useCallback
((
task
)
=>
{
...
@@ -159,27 +152,22 @@ export default function EnhancedTable() {
...
@@ -159,27 +152,22 @@ export default function EnhancedTable() {
},
[
dispatch
,
navigate
])
},
[
dispatch
,
navigate
])
const
editCurrentTaskHandler
=
useCallback
(()
=>
{
const
editCurrentTaskHandler
=
useCallback
(()
=>
{
if
(
currentTask
.
priority
===
''
||
currentTask
.
project
===
''
||
currentTask
.
executor
===
''
||
!
Object
.
keys
(
currentTask
.
executor
).
length
)
{
const
task
=
{
const
task
=
{
...
currentTask
,
...
currentTask
,
priority
:
currentTask
.
priority
?
currentTask
.
priority
:
null
,
priority
:
currentTask
.
priority
?
currentTask
.
priority
:
null
,
project
:
currentTask
.
project
?
currentTask
.
project
:
null
,
project
:
currentTask
.
project
?
currentTask
.
project
:
null
,
executor
:
currentTask
.
executor
&&
currentTask
.
executor
?.
id
?
currentTask
.
executor
:
null
,
executor
:
user
,
dateTimeDeadLine
:
new
Date
(
currentTask
.
dateTimeDeadLine
)
instanceof
Date
&&
!
isNaN
(
new
Date
(
currentTask
.
dateTimeDeadLine
))
?
currentTask
.
dateTimeDeadLine
:
null
dateTimeDeadLine
:
new
Date
(
currentTask
.
dateTimeDeadLine
)
instanceof
Date
&&
!
isNaN
(
new
Date
(
currentTask
.
dateTimeDeadLine
))
?
currentTask
.
dateTimeDeadLine
:
null
}
}
dispatch
(
editTaskUsers
(
task
))
dispatch
(
editTask
(
task
))
}
else
{
dispatch
(
editTaskUsers
(
currentTask
))
}
setCurrentTask
({
setCurrentTask
({
priority
:
''
,
priority
:
''
,
title
:
''
,
title
:
''
,
project
:
''
,
project
:
''
,
description
:
''
,
description
:
''
,
executor
:
''
,
dateTimeDeadLine
:
null
dateTimeDeadLine
:
null
})
})
},
[
dispatch
,
currentTask
])
},
[
dispatch
,
currentTask
,
user
])
const
onCloseFilterByProjects
=
useCallback
((
listProjectIds
)
=>
{
const
onCloseFilterByProjects
=
useCallback
((
listProjectIds
)
=>
{
setProjectIdListForTaskSelect
(
listProjectIds
)
setProjectIdListForTaskSelect
(
listProjectIds
)
...
...
planner-front/src/containers/UsersTasks/UsersTasks.js
View file @
604159dd
...
@@ -9,7 +9,7 @@ import { fetchAllUserProjects, fetchProjects } from '../../store/actions/project
...
@@ -9,7 +9,7 @@ import { fetchAllUserProjects, fetchProjects } from '../../store/actions/project
import
moment
from
'moment'
;
import
moment
from
'moment'
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
{
useNavigate
}
from
'react-router-dom'
;
export
default
function
EnhancedTable
()
{
export
default
function
UsersTasks
()
{
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
navigate
=
useNavigate
()
const
navigate
=
useNavigate
()
...
...
planner-front/src/store/actions/tasksActions.js
View file @
604159dd
...
@@ -135,7 +135,7 @@ export const addTask = (task) => {
...
@@ -135,7 +135,7 @@ export const addTask = (task) => {
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
addTaskRequest
());
dispatch
(
addTaskRequest
());
try
{
try
{
await
axios
.
post
(
"/tasks"
,
task
);
const
response
=
await
axios
.
post
(
"/tasks"
,
task
);
dispatch
(
addTaskSuccess
())
dispatch
(
addTaskSuccess
())
dispatch
(
fetchAllTasks
())
dispatch
(
fetchAllTasks
())
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
planner-front/src/store/reducers/tasksReducer.js
View file @
604159dd
...
@@ -91,7 +91,19 @@ const tasksReduсer = (state = initialState, action) => {
...
@@ -91,7 +91,19 @@ const tasksReduсer = (state = initialState, action) => {
})
})
return
{
...
state
,
loading
:
false
,
calendarTasks
:
newTasksWithInfoForCell
};
return
{
...
state
,
loading
:
false
,
calendarTasks
:
newTasksWithInfoForCell
};
case
FETCH_ALL_TASKS_SUCCESS
:
case
FETCH_ALL_TASKS_SUCCESS
:
return
{
...
state
,
loading
:
false
,
tasks
:
action
.
tasks
,
projects
:
action
.
projects
};
const
newArrTasks
=
action
.
tasks
.
map
((
task
)
=>
{
return
{
...
task
,
authorName
:
task
.
author
.
displayName
,
projectTitle
:
task
.
project
.
title
,
accomplishTranslate
:
accomplishStatuses
.
find
((
status
)
=>
{
if
(
status
.
value
===
task
.
accomplish
)
{
return
status
}
return
null
}).
text
}})
return
{
...
state
,
loading
:
false
,
tasks
:
newArrTasks
,
projects
:
action
.
projects
};
case
FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS
:
case
FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS
:
const
newArr
=
action
.
tasks
.
map
((
task
)
=>
{
const
newArr
=
action
.
tasks
.
map
((
task
)
=>
{
return
{
return
{
...
...
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