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
8faed77a
Commit
8faed77a
authored
Jan 15, 2023
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#153
добавил селект для сортировки по проектам
parent
2cfef1f4
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
251 additions
and
206 deletions
+251
-206
tasks.ts
planner-api/src/routers/tasks.ts
+6
-0
MultipleSelect.js
...-front/src/components/UI/MultipleSelect/MultipleSelect.js
+2
-3
DateTimePicker.js
...UsersTasksTableContainer/DateTimePicker/DateTimePicker.js
+0
-3
UsersTasksRow.js
...tainer/UsersTasksTableBody/UsersTasksRow/UsersTasksRow.js
+3
-3
UsersTasksTableToolbar.js
...mpoments/UsersTasksTableToolbar/UsersTasksTableToolbar.js
+35
-20
UsersTasks.js
planner-front/src/containers/UsersTasks/UsersTasks.js
+24
-9
tasksTypes.js
planner-front/src/store/actionTypes/tasksTypes.js
+3
-1
tasksActions.js
planner-front/src/store/actions/tasksActions.js
+172
-166
tasksReducer.js
planner-front/src/store/reducers/tasksReducer.js
+6
-1
No files found.
planner-api/src/routers/tasks.ts
View file @
8faed77a
...
@@ -380,10 +380,16 @@ router.post('/project',async (req: Request, res: Response):Promise<Response>=>{
...
@@ -380,10 +380,16 @@ router.post('/project',async (req: Request, res: Response):Promise<Response>=>{
const
tasks
=
await
const
tasks
=
await
dataSource
dataSource
.
getRepository
(
Task
)
.
getRepository
(
Task
)
.
createQueryBuilder
(
'task'
)
.
createQueryBuilder
(
'task'
)
.
innerJoinAndSelect
(
'task.project'
,
'project'
)
.
innerJoinAndSelect
(
'task.project'
,
'project'
)
.
innerJoinAndSelect
(
'task.author'
,
'users'
)
.
innerJoinAndSelect
(
'task.executor'
,
'userss'
)
.
innerJoinAndSelect
(
'task.dateTimeTasks'
,
'DateTimeTask'
)
.
where
(
'task.project IN(:...projects)'
,
{
projects
:
projectArray
})
.
where
(
'task.project IN(:...projects)'
,
{
projects
:
projectArray
})
.
getMany
()
.
getMany
()
return
res
.
send
({
tasks
})
return
res
.
send
({
tasks
})
})
})
...
...
planner-front/src/components/UI/MultipleSelect/MultipleSelect.js
View file @
8faed77a
...
@@ -29,7 +29,6 @@ function getStyles(name, personName, theme) {
...
@@ -29,7 +29,6 @@ function getStyles(name, personName, theme) {
}
}
export
default
function
MultipleSelect
({
projects
,
onCloseFilterByProjects
})
{
export
default
function
MultipleSelect
({
projects
,
onCloseFilterByProjects
})
{
const
theme
=
useTheme
();
const
theme
=
useTheme
();
const
[
listProjectIds
,
setListProjectIds
]
=
React
.
useState
([])
const
[
listProjectIds
,
setListProjectIds
]
=
React
.
useState
([])
const
handleChange
=
(
event
)
=>
{
const
handleChange
=
(
event
)
=>
{
...
@@ -48,10 +47,10 @@ export default function MultipleSelect({projects,onCloseFilterByProjects}) {
...
@@ -48,10 +47,10 @@ export default function MultipleSelect({projects,onCloseFilterByProjects}) {
<
InputLabel
placeholder
=
'Choose Project'
<
InputLabel
placeholder
=
'Choose Project'
label
=
'I am a really really long green TextField label'
label
=
'I am a really really long green TextField label'
id
=
"demo-multiple-name-label"
sx
=
{{
color
:
'white'
,
padding
:
'1'
}}
id
=
"demo-multiple-name-label"
sx
=
{{
color
:
'white'
,
padding
:
'1'
}}
>
Project
<
/InputLabel
>
>
Проекты
<
/InputLabel
>
<
Select
<
Select
labelId
=
"demo-multiple-name-label"
labelId
=
"demo-multiple-name-label"
label
=
'
Choose Project
'
label
=
'
Выберите проект
'
name
=
'Choose Project'
name
=
'Choose Project'
id
=
"demo-multiple-name"
id
=
"demo-multiple-name"
multiple
multiple
...
...
planner-front/src/components/UsersTasksCompoments/UsersTasksTableContainer/DateTimePicker/DateTimePicker.js
View file @
8faed77a
...
@@ -11,9 +11,6 @@ import moment from "moment";
...
@@ -11,9 +11,6 @@ import moment from "moment";
export
default
function
MaterialUIPickers
({
task
,
name
,
onChange
,
currentTask
})
{
export
default
function
MaterialUIPickers
({
task
,
name
,
onChange
,
currentTask
})
{
const
[
state
,
setState
]
=
useState
(
null
)
const
[
state
,
setState
]
=
useState
(
null
)
let
fullYear
=
new
Date
().
getFullYear
()
let
month
=
new
Date
().
getMonth
()
let
day
=
new
Date
().
getDate
();
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
task
.
dateTimeDeadLine
)
setState
(
null
)
if
(
!
task
.
dateTimeDeadLine
)
setState
(
null
)
if
(
currentTask
)
setState
(
moment
(
task
.
dateTimeDeadLine
).
utc
())
if
(
currentTask
)
setState
(
moment
(
task
.
dateTimeDeadLine
).
utc
())
...
...
planner-front/src/components/UsersTasksCompoments/UsersTasksTableContainer/UsersTasksTableBody/UsersTasksRow/UsersTasksRow.js
View file @
8faed77a
...
@@ -28,7 +28,7 @@ function UsersTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHan
...
@@ -28,7 +28,7 @@ function UsersTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHan
const
[
editMode
,
setEditMode
]
=
useState
(
false
);
const
[
editMode
,
setEditMode
]
=
useState
(
false
);
const
dateTimeTasks
=
useMemo
(()
=>
{
const
dateTimeTasks
=
useMemo
(()
=>
{
if
(
row
.
dateTimeTasks
.
length
===
1
)
{
if
(
row
?.
dateTimeTasks
?
.
length
===
1
)
{
const
date
=
moment
(
row
.
dateTimeTasks
[
0
].
dateTimeStart
).
utc
().
format
(
'DD.MM'
)
const
date
=
moment
(
row
.
dateTimeTasks
[
0
].
dateTimeStart
).
utc
().
format
(
'DD.MM'
)
const
start
=
moment
(
row
.
dateTimeTasks
[
0
].
dateTimeStart
).
utc
().
format
(
'HH:mm'
)
const
start
=
moment
(
row
.
dateTimeTasks
[
0
].
dateTimeStart
).
utc
().
format
(
'HH:mm'
)
let
end
let
end
...
@@ -60,7 +60,7 @@ function UsersTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHan
...
@@ -60,7 +60,7 @@ function UsersTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHan
}
}
<
/Box
>
<
/Box
>
}
else
if
(
row
.
dateTimeTasks
.
length
>
1
)
{
}
else
if
(
row
?.
dateTimeTasks
?
.
length
>
1
)
{
return
(
<>
return
(
<>
<
IconButton
<
IconButton
aria
-
label
=
"expand row"
aria
-
label
=
"expand row"
...
@@ -82,7 +82,7 @@ function UsersTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHan
...
@@ -82,7 +82,7 @@ function UsersTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHan
:
null
:
null
}
}
<
/>
)
<
/>
)
}
else
if
(
row
.
dateTimeTasks
.
length
===
0
)
{
}
else
if
(
row
?.
dateTimeTasks
?
.
length
===
0
)
{
return
(
<>
return
(
<>
Копий
нет
Копий
нет
{
{
...
...
planner-front/src/components/UsersTasksCompoments/UsersTasksTableToolbar/UsersTasksTableToolbar.js
View file @
8faed77a
import
{
AppBar
,
Box
,
Typography
}
from
"@mui/material"
;
import
{
AppBar
,
Box
,
Typography
}
from
"@mui/material"
;
import
{
memo
}
from
"react"
;
import
{
memo
,
useMemo
}
from
"react"
;
import
MultipleSelect
from
"../../UI/MultipleSelect/MultipleSelect"
;
import
CreateTaskFromButton
from
"./CreateTaskFromButton/CreateTaskFromButton"
;
import
CreateTaskFromButton
from
"./CreateTaskFromButton/CreateTaskFromButton"
;
function
UsersTasksTableToolbar
({
addFormStatus
,
createTaskFromButtonHandler
})
{
function
UsersTasksTableToolbar
({
addFormStatus
,
createTaskFromButtonHandler
,
projects
,
onCloseFilterByProjects
,
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
})
{
return
(
const
projectsFilter
=
useMemo
(()
=>
{
<
AppBar
position
=
"static"
sx
=
{{
padding
:
3
}}
>
if
(
Array
.
isArray
(
projects
))
{
<
Box
sx
=
{{
display
:
'flex'
,
alignItems
:
'center'
}}
>
return
<
MultipleSelect
<
Typography
projects
=
{
projects
}
sx
=
{{
flex
:
'1 1 100%'
}}
onCloseFilterByProjects
=
{
onCloseFilterByProjects
}
variant
=
"h6"
projectIdListForTaskSelect
=
{
projectIdListForTaskSelect
}
id
=
"tableTitle"
setProjectIdListForTaskSelect
=
{
setProjectIdListForTaskSelect
}
component
=
"div"
/
>
>
}
else
{
Задачи
сотрудников
return
null
<
/Typography
>
}
<
CreateTaskFromButton
},
[
projects
,
onCloseFilterByProjects
,
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
])
addFormStatus
=
{
addFormStatus
}
onClick
=
{()
=>
{
createTaskFromButtonHandler
()
}}
return
(
/
>
<
AppBar
position
=
"static"
sx
=
{{
padding
:
3
}}
>
<
/Box
>
<
Box
sx
=
{{
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
/AppBar
>
<
Typography
);
sx
=
{{
flex
:
'1 1 100%'
}}
variant
=
"h6"
id
=
"tableTitle"
component
=
"div"
>
Задачи
сотрудников
<
/Typography
>
{
projectsFilter
}
<
CreateTaskFromButton
addFormStatus
=
{
addFormStatus
}
onClick
=
{()
=>
{
createTaskFromButtonHandler
()
}}
/
>
<
/Box
>
<
/AppBar
>
);
}
}
export
default
memo
(
UsersTasksTableToolbar
)
export
default
memo
(
UsersTasksTableToolbar
)
\ No newline at end of file
planner-front/src/containers/UsersTasks/UsersTasks.js
View file @
8faed77a
...
@@ -2,10 +2,10 @@ import Paper from '@mui/material/Paper';
...
@@ -2,10 +2,10 @@ 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
{
activateCreateCopyTasksMode
,
addTaskToUserTasksTable
,
deleteDateTimeTaskUsers
,
deleteTaskUsers
,
editTaskUsers
,
fetchAllTasksByMembership
}
from
'../../store/actions/tasksActions'
;
import
{
activateCreateCopyTasksMode
,
addTaskToUserTasksTable
,
deleteDateTimeTaskUsers
,
deleteTaskUsers
,
editTaskUsers
,
fetchAllTasksByMembership
,
sortTaskByProjects
}
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
}
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'
;
...
@@ -13,8 +13,8 @@ export default function EnhancedTable() {
...
@@ -13,8 +13,8 @@ export default function EnhancedTable() {
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
navigate
=
useNavigate
()
const
navigate
=
useNavigate
()
const
{
tasks
}
=
useSelector
((
state
)
=>
state
.
tasks
);
const
{
tasks
,
sortedTasks
}
=
useSelector
((
state
)
=>
state
.
tasks
,
shallowEqual
);
const
{
allUserProjectsForModalTask
}
=
useSelector
(
state
=>
state
.
projects
,
shallowEqual
)
const
{
allUserProjectsForModalTask
,
projects
}
=
useSelector
(
state
=>
state
.
projects
,
shallowEqual
)
const
[
newTask
,
setNewTask
]
=
useState
({
const
[
newTask
,
setNewTask
]
=
useState
({
priority
:
''
,
priority
:
''
,
...
@@ -39,11 +39,18 @@ export default function EnhancedTable() {
...
@@ -39,11 +39,18 @@ export default function EnhancedTable() {
const
[
page
,
setPage
]
=
useState
(
0
);
const
[
page
,
setPage
]
=
useState
(
0
);
const
[
rowsPerPage
,
setRowsPerPage
]
=
useState
(
10
);
const
[
rowsPerPage
,
setRowsPerPage
]
=
useState
(
10
);
const
[
addFormStatus
,
setAddFormStatus
]
=
useState
(
false
);
const
[
addFormStatus
,
setAddFormStatus
]
=
useState
(
false
);
const
[
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
]
=
useState
([]);
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
fetchAllTasksByMembership
());
dispatch
(
fetchAllTasksByMembership
());
dispatch
(
fetchAllUserProjects
())
dispatch
(
fetchAllUserProjects
())
dispatch
(
fetchProjects
())
},
[
dispatch
]);
},
[
dispatch
]);
useEffect
(()
=>
{
dispatch
(
sortTaskByProjects
(
projectIdListForTaskSelect
))
},
[
dispatch
,
projectIdListForTaskSelect
]);
const
onChangeNewTaskHandler
=
useCallback
((
e
)
=>
{
const
onChangeNewTaskHandler
=
useCallback
((
e
)
=>
{
const
{
value
,
name
}
=
e
.
target
;
const
{
value
,
name
}
=
e
.
target
;
...
@@ -147,10 +154,10 @@ export default function EnhancedTable() {
...
@@ -147,10 +154,10 @@ export default function EnhancedTable() {
dispatch
(
deleteDateTimeTaskUsers
(
id
))
dispatch
(
deleteDateTimeTaskUsers
(
id
))
},
[
dispatch
])
},
[
dispatch
])
const
calendarOpen
=
(
task
)
=>
{
const
calendarOpen
=
useCallback
(
(
task
)
=>
{
dispatch
(
activateCreateCopyTasksMode
(
task
,
navigate
))
dispatch
(
activateCreateCopyTasksMode
(
task
,
navigate
))
}
}
,
[
dispatch
,
navigate
])
console
.
log
(
currentTask
)
const
editCurrentTaskHandler
=
useCallback
(()
=>
{
const
editCurrentTaskHandler
=
useCallback
(()
=>
{
if
(
currentTask
.
priority
===
''
||
currentTask
.
project
===
''
||
currentTask
.
executor
===
''
||
!
Object
.
keys
(
currentTask
.
executor
).
length
)
{
if
(
currentTask
.
priority
===
''
||
currentTask
.
project
===
''
||
currentTask
.
executor
===
''
||
!
Object
.
keys
(
currentTask
.
executor
).
length
)
{
const
task
=
{
const
task
=
{
...
@@ -174,17 +181,25 @@ export default function EnhancedTable() {
...
@@ -174,17 +181,25 @@ export default function EnhancedTable() {
})
})
},
[
dispatch
,
currentTask
])
},
[
dispatch
,
currentTask
])
const
onCloseFilterByProjects
=
useCallback
((
listProjectIds
)
=>
{
setProjectIdListForTaskSelect
(
listProjectIds
)
},
[])
return
(
return
(
<
Paper
sx
=
{{
width
:
'100%'
,
mb
:
2
}}
>
<
Paper
sx
=
{{
width
:
'100%'
,
mb
:
2
}}
>
<
UsersTasksTableToolbar
<
UsersTasksTableToolbar
addFormStatus
=
{
addFormStatus
}
addFormStatus
=
{
addFormStatus
}
createTaskFromButtonHandler
=
{
createTaskFromButtonHandler
}
createTaskFromButtonHandler
=
{
createTaskFromButtonHandler
}
onCloseFilterByProjects
=
{
onCloseFilterByProjects
}
projectIdListForTaskSelect
=
{
projectIdListForTaskSelect
}
setProjectIdListForTaskSelect
=
{
setProjectIdListForTaskSelect
}
projects
=
{
projects
.
projects
}
/
>
/
>
<
UsersTasksTableContainer
<
UsersTasksTableContainer
order
=
{
order
}
order
=
{
order
}
orderBy
=
{
orderBy
}
orderBy
=
{
orderBy
}
handleRequestSort
=
{
handleRequestSort
}
handleRequestSort
=
{
handleRequestSort
}
rows
=
{
tasks
}
rows
=
{
projectIdListForTaskSelect
.
length
?
sortedTasks
:
tasks
}
page
=
{
page
}
page
=
{
page
}
rowsPerPage
=
{
rowsPerPage
}
rowsPerPage
=
{
rowsPerPage
}
addFormStatus
=
{
addFormStatus
}
addFormStatus
=
{
addFormStatus
}
...
@@ -203,7 +218,7 @@ export default function EnhancedTable() {
...
@@ -203,7 +218,7 @@ export default function EnhancedTable() {
editCurrentTaskHandler
=
{
editCurrentTaskHandler
}
editCurrentTaskHandler
=
{
editCurrentTaskHandler
}
/
>
/
>
<
UsersTasksTablePagination
<
UsersTasksTablePagination
count
=
{
tasks
.
length
}
count
=
{
projectIdListForTaskSelect
.
length
?
sortedTasks
.
length
:
tasks
.
length
}
rowsPerPage
=
{
rowsPerPage
}
rowsPerPage
=
{
rowsPerPage
}
page
=
{
page
}
page
=
{
page
}
handleChangePage
=
{
handleChangePage
}
handleChangePage
=
{
handleChangePage
}
...
...
planner-front/src/store/actionTypes/tasksTypes.js
View file @
8faed77a
...
@@ -31,4 +31,6 @@ export const FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS = "FETCH_ALL_TASKS_BY_MEMBERS
...
@@ -31,4 +31,6 @@ export const FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS = "FETCH_ALL_TASKS_BY_MEMBERS
export
const
FETCH_ALL_TASKS_BY_MEMBERSHIP_FAILURE
=
"FETCH_ALL_TASKS_BY_MEMBERSHIP_FAILURE"
;
export
const
FETCH_ALL_TASKS_BY_MEMBERSHIP_FAILURE
=
"FETCH_ALL_TASKS_BY_MEMBERSHIP_FAILURE"
;
export
const
ACTIVATE_CREATE_COPY_TASKS_MODE
=
"ACTIVATE_CREATE_COPY_TASKS_MODE"
export
const
ACTIVATE_CREATE_COPY_TASKS_MODE
=
"ACTIVATE_CREATE_COPY_TASKS_MODE"
export
const
DEACTIVATE_CREATE_COPY_TASKS_MODE
=
"DEACTIVATE_CREATE_COPY_TASKS_MODE"
export
const
DEACTIVATE_CREATE_COPY_TASKS_MODE
=
"DEACTIVATE_CREATE_COPY_TASKS_MODE"
\ No newline at end of file
export
const
SORT_TASKS
=
"SORT_TASKS"
\ No newline at end of file
planner-front/src/store/actions/tasksActions.js
View file @
8faed77a
import
{
import
{
ADD_NEW_TASK_FAILURE
,
ADD_NEW_TASK_FAILURE
,
ADD_NEW_TASK_REQUEST
,
ADD_NEW_TASK_REQUEST
,
ADD_NEW_TASK_SUCCESS
,
ADD_NEW_TASK_SUCCESS
,
DELETE_TASK_FAILURE
,
DELETE_TASK_FAILURE
,
DELETE_TASK_REQUEST
,
DELETE_TASK_REQUEST
,
DELETE_TASK_SUCCESS
,
DELETE_TASK_SUCCESS
,
EDIT_TASK_FAILURE
,
EDIT_TASK_FAILURE
,
EDIT_TASK_REQUEST
,
EDIT_TASK_REQUEST
,
EDIT_TASK_SUCCESS
,
EDIT_TASK_SUCCESS
,
FETCH_CALENDAR_TASKS_FAILURE
,
FETCH_CALENDAR_TASKS_FAILURE
,
FETCH_CALENDAR_TASKS_REQUEST
,
FETCH_CALENDAR_TASKS_REQUEST
,
FETCH_CALENDAR_TASKS_SUCCESS
,
FETCH_CALENDAR_TASKS_SUCCESS
,
FETCH_ALL_TASKS_SUCCESS
,
FETCH_ALL_TASKS_SUCCESS
,
FETCH_TASKS_BY_PROJECT_SUCCESS
,
FETCH_TASKS_BY_PROJECT_SUCCESS
,
...
@@ -20,289 +20,295 @@ import {
...
@@ -20,289 +20,295 @@ import {
DELETE_DATETIMETASK_REQUEST
,
DELETE_DATETIMETASK_REQUEST
,
FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS
,
FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS
,
DEACTIVATE_CREATE_COPY_TASKS_MODE
,
DEACTIVATE_CREATE_COPY_TASKS_MODE
,
ACTIVATE_CREATE_COPY_TASKS_MODE
ACTIVATE_CREATE_COPY_TASKS_MODE
,
}
from
"../actionTypes/tasksTypes"
;
SORT_TASKS
}
from
"../actionTypes/tasksTypes"
;
import
axios
from
'../../axiosPlanner'
import
axios
from
'../../axiosPlanner'
const
fetchCalendarTasksRequest
=
()
=>
{
const
fetchCalendarTasksRequest
=
()
=>
{
return
{
type
:
FETCH_CALENDAR_TASKS_REQUEST
}
return
{
type
:
FETCH_CALENDAR_TASKS_REQUEST
}
};
};
const
fetchCalendarTasksSuccess
=
(
tasks
)
=>
{
const
fetchCalendarTasksSuccess
=
(
tasks
)
=>
{
return
{
type
:
FETCH_CALENDAR_TASKS_SUCCESS
,
tasks
}
return
{
type
:
FETCH_CALENDAR_TASKS_SUCCESS
,
tasks
}
};
};
const
fetchAllTasksSuccess
=
(
tasks
,
projects
)
=>
{
const
fetchAllTasksSuccess
=
(
tasks
,
projects
)
=>
{
return
{
type
:
FETCH_ALL_TASKS_SUCCESS
,
tasks
,
projects
}
return
{
type
:
FETCH_ALL_TASKS_SUCCESS
,
tasks
,
projects
}
};
};
const
fetchCalendarTasksFailure
=
(
error
)
=>
{
const
fetchCalendarTasksFailure
=
(
error
)
=>
{
return
{
type
:
FETCH_CALENDAR_TASKS_FAILURE
,
error
}
return
{
type
:
FETCH_CALENDAR_TASKS_FAILURE
,
error
}
};
};
export
const
fetchCalendarTasks
=
(
userId
)
=>
{
export
const
fetchCalendarTasks
=
(
userId
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
fetchCalendarTasksRequest
());
dispatch
(
fetchCalendarTasksRequest
());
try
{
try
{
const
response
=
await
axios
.
get
(
`/tasks/user/
${
userId
}
`
);
const
response
=
await
axios
.
get
(
`/tasks/user/
${
userId
}
`
);
dispatch
(
fetchCalendarTasksSuccess
(
response
.
data
.
tasks
))
dispatch
(
fetchCalendarTasksSuccess
(
response
.
data
.
tasks
))
}
catch
(
error
)
{
}
catch
(
error
)
{
dispatch
(
fetchCalendarTasksFailure
(
error
.
response
.
data
));
dispatch
(
fetchCalendarTasksFailure
(
error
.
response
.
data
));
}
}
}
}
};
};
export
const
fetchAllTasks
=
()
=>
{
export
const
fetchAllTasks
=
()
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
fetchCalendarTasksRequest
());
dispatch
(
fetchCalendarTasksRequest
());
try
{
try
{
const
response
=
await
axios
.
get
(
"/tasks/my"
);
const
response
=
await
axios
.
get
(
"/tasks/my"
);
dispatch
(
fetchAllTasksSuccess
(
response
.
data
.
tasks
,
response
.
data
.
projects
))
dispatch
(
fetchAllTasksSuccess
(
response
.
data
.
tasks
,
response
.
data
.
projects
))
}
catch
(
error
)
{
}
catch
(
error
)
{
dispatch
(
fetchCalendarTasksFailure
(
error
.
response
.
data
));
dispatch
(
fetchCalendarTasksFailure
(
error
.
response
.
data
));
}
}
}
}
};
};
//**fetch tasks for table UsersTasks, start*/
//**fetch tasks for table UsersTasks, start*/
const
fetchAllTasksByMembershipSuccess
=
(
tasks
,
projects
)
=>
{
const
fetchAllTasksByMembershipSuccess
=
(
tasks
,
projects
)
=>
{
return
{
type
:
FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS
,
tasks
,
projects
}
return
{
type
:
FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS
,
tasks
,
projects
}
};
};
export
const
fetchAllTasksByMembership
=
()
=>
{
export
const
fetchAllTasksByMembership
=
()
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
fetchCalendarTasksRequest
());
dispatch
(
fetchCalendarTasksRequest
());
try
{
try
{
const
response
=
await
axios
.
get
(
"/tasks/users-tasks"
);
const
response
=
await
axios
.
get
(
"/tasks/users-tasks"
);
dispatch
(
fetchAllTasksByMembershipSuccess
(
response
.
data
.
tasks
,
response
.
data
.
projects
))
dispatch
(
fetchAllTasksByMembershipSuccess
(
response
.
data
.
tasks
,
response
.
data
.
projects
))
}
catch
(
error
)
{
}
catch
(
error
)
{
dispatch
(
fetchCalendarTasksFailure
(
error
.
response
.
data
));
dispatch
(
fetchCalendarTasksFailure
(
error
.
response
.
data
));
}
}
}
}
};
};
//**end*/
//**end*/
export
const
sortTaskByProjects
=
(
projectIdListForTaskSelect
)
=>
{
return
{
type
:
SORT_TASKS
,
projectIdListForTaskSelect
}
}
const
addTaskRequest
=
()
=>
{
const
addTaskRequest
=
()
=>
{
return
{
type
:
ADD_NEW_TASK_REQUEST
}
return
{
type
:
ADD_NEW_TASK_REQUEST
}
};
};
const
addTaskSuccess
=
()
=>
{
const
addTaskSuccess
=
()
=>
{
return
{
type
:
ADD_NEW_TASK_SUCCESS
}
return
{
type
:
ADD_NEW_TASK_SUCCESS
}
};
};
const
addTaskFailure
=
(
error
)
=>
{
const
addTaskFailure
=
(
error
)
=>
{
return
{
type
:
ADD_NEW_TASK_FAILURE
,
error
}
return
{
type
:
ADD_NEW_TASK_FAILURE
,
error
}
};
};
export
const
addCalendarTask
=
(
task
,
userId
)
=>
{
export
const
addCalendarTask
=
(
task
,
userId
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
addTaskRequest
());
dispatch
(
addTaskRequest
());
try
{
try
{
await
axios
.
post
(
"/tasks"
,
task
);
await
axios
.
post
(
"/tasks"
,
task
);
dispatch
(
addTaskSuccess
())
dispatch
(
addTaskSuccess
())
dispatch
(
fetchCalendarTasks
(
userId
))
dispatch
(
fetchCalendarTasks
(
userId
))
}
catch
(
error
)
{
}
catch
(
error
)
{
dispatch
(
addTaskFailure
(
error
.
response
.
data
));
dispatch
(
addTaskFailure
(
error
.
response
.
data
));
}
}
}
}
}
}
export
const
addCopyCalendarTask
=
(
task
,
userId
)
=>
{
export
const
addCopyCalendarTask
=
(
task
,
userId
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
addTaskRequest
());
dispatch
(
addTaskRequest
());
try
{
try
{
await
axios
.
post
(
"/copy-tasks/make-copy"
,
task
);
await
axios
.
post
(
"/copy-tasks/make-copy"
,
task
);
dispatch
(
addTaskSuccess
())
dispatch
(
addTaskSuccess
())
dispatch
(
fetchCalendarTasks
(
userId
))
dispatch
(
fetchCalendarTasks
(
userId
))
}
catch
(
error
)
{
}
catch
(
error
)
{
dispatch
(
addTaskFailure
(
error
.
response
.
data
));
dispatch
(
addTaskFailure
(
error
.
response
.
data
));
}
}
}
}
}
}
export
const
addTask
=
(
task
)
=>
{
export
const
addTask
=
(
task
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
addTaskRequest
());
dispatch
(
addTaskRequest
());
try
{
try
{
await
axios
.
post
(
"/tasks"
,
task
);
await
axios
.
post
(
"/tasks"
,
task
);
dispatch
(
addTaskSuccess
())
dispatch
(
addTaskSuccess
())
dispatch
(
fetchAllTasks
())
dispatch
(
fetchAllTasks
())
}
catch
(
error
)
{
}
catch
(
error
)
{
dispatch
(
addTaskFailure
(
error
.
response
.
data
));
dispatch
(
addTaskFailure
(
error
.
response
.
data
));
}
}
}
}
}
}
const
editTaskRequest
=
()
=>
{
const
editTaskRequest
=
()
=>
{
return
{
type
:
EDIT_TASK_REQUEST
}
return
{
type
:
EDIT_TASK_REQUEST
}
};
};
const
editTaskSuccess
=
()
=>
{
const
editTaskSuccess
=
()
=>
{
return
{
type
:
EDIT_TASK_SUCCESS
}
return
{
type
:
EDIT_TASK_SUCCESS
}
};
};
const
editTaskFailure
=
(
error
)
=>
{
const
editTaskFailure
=
(
error
)
=>
{
return
{
type
:
EDIT_TASK_FAILURE
,
error
}
return
{
type
:
EDIT_TASK_FAILURE
,
error
}
};
};
export
const
editTask
=
(
task
)
=>
{
export
const
editTask
=
(
task
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
editTaskRequest
());
dispatch
(
editTaskRequest
());
try
{
try
{
await
axios
.
put
(
`/tasks/
${
task
.
id
}
`
,
task
);
await
axios
.
put
(
`/tasks/
${
task
.
id
}
`
,
task
);
dispatch
(
editTaskSuccess
())
dispatch
(
editTaskSuccess
())
dispatch
(
fetchAllTasks
())
dispatch
(
fetchAllTasks
())
}
catch
(
error
)
{
}
catch
(
error
)
{
dispatch
(
editTaskFailure
(
error
.
response
.
data
));
dispatch
(
editTaskFailure
(
error
.
response
.
data
));
}
}
}
}
}
}
export
const
editTaskUsers
=
(
task
)
=>
{
export
const
editTaskUsers
=
(
task
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
editTaskRequest
());
dispatch
(
editTaskRequest
());
try
{
try
{
await
axios
.
put
(
`/tasks/
${
task
.
id
}
`
,
task
);
await
axios
.
put
(
`/tasks/
${
task
.
id
}
`
,
task
);
dispatch
(
editTaskSuccess
())
dispatch
(
editTaskSuccess
())
await
dispatch
(
fetchAllTasksByMembership
())
dispatch
(
fetchAllTasksByMembership
())
}
catch
(
error
)
{
}
catch
(
error
)
{
dispatch
(
editTaskFailure
(
error
.
response
.
data
));
dispatch
(
editTaskFailure
(
error
.
response
.
data
));
}
}
}
}
}
}
export
const
editCalendarTask
=
(
task
,
taskId
,
userId
)
=>
{
export
const
editCalendarTask
=
(
task
,
taskId
,
userId
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
editTaskRequest
());
dispatch
(
editTaskRequest
());
try
{
try
{
await
axios
.
put
(
`/copy-tasks/change-copy/
${
taskId
}
`
,
task
);
await
axios
.
put
(
`/copy-tasks/change-copy/
${
taskId
}
`
,
task
);
dispatch
(
editTaskSuccess
())
dispatch
(
editTaskSuccess
())
dispatch
(
fetchCalendarTasks
(
userId
))
dispatch
(
fetchCalendarTasks
(
userId
))
}
catch
(
error
)
{
}
catch
(
error
)
{
dispatch
(
editTaskFailure
(
error
.
response
.
data
));
dispatch
(
editTaskFailure
(
error
.
response
.
data
));
}
}
}
}
}
}
const
deleteTaskRequest
=
()
=>
{
const
deleteTaskRequest
=
()
=>
{
return
{
type
:
DELETE_TASK_REQUEST
}
return
{
type
:
DELETE_TASK_REQUEST
}
};
};
const
deleteTaskSuccess
=
()
=>
{
const
deleteTaskSuccess
=
()
=>
{
return
{
type
:
DELETE_TASK_SUCCESS
}
return
{
type
:
DELETE_TASK_SUCCESS
}
};
};
const
deleteTaskFailure
=
(
error
)
=>
{
const
deleteTaskFailure
=
(
error
)
=>
{
return
{
type
:
DELETE_TASK_FAILURE
,
error
}
return
{
type
:
DELETE_TASK_FAILURE
,
error
}
};
};
export
const
deleteTask
=
(
taskId
)
=>
{
export
const
deleteTask
=
(
taskId
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
deleteTaskRequest
());
dispatch
(
deleteTaskRequest
());
try
{
try
{
await
axios
.
delete
(
`/tasks/
${
taskId
}
`
);
await
axios
.
delete
(
`/tasks/
${
taskId
}
`
);
dispatch
(
deleteTaskSuccess
())
dispatch
(
deleteTaskSuccess
())
dispatch
(
fetchAllTasks
())
dispatch
(
fetchAllTasks
())
}
catch
(
error
)
{
}
catch
(
error
)
{
dispatch
(
deleteTaskFailure
(
error
.
response
.
data
));
dispatch
(
deleteTaskFailure
(
error
.
response
.
data
));
}
}
}
}
}
}
export
const
deleteTaskUsers
=
(
taskId
)
=>
{
export
const
deleteTaskUsers
=
(
taskId
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
deleteTaskRequest
());
dispatch
(
deleteTaskRequest
());
try
{
try
{
await
axios
.
delete
(
`/tasks/
${
taskId
}
`
);
await
axios
.
delete
(
`/tasks/
${
taskId
}
`
);
dispatch
(
deleteTaskSuccess
())
dispatch
(
deleteTaskSuccess
())
await
dispatch
(
fetchAllTasksByMembership
())
dispatch
(
fetchAllTasksByMembership
())
}
catch
(
error
)
{
}
catch
(
error
)
{
dispatch
(
deleteTaskFailure
(
error
.
response
.
data
));
dispatch
(
deleteTaskFailure
(
error
.
response
.
data
));
}
}
}
}
}
}
export
const
deleteCalendarTask
=
(
taskId
,
userId
)
=>
{
export
const
deleteCalendarTask
=
(
taskId
,
userId
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
deleteTaskRequest
());
dispatch
(
deleteTaskRequest
());
try
{
try
{
await
axios
.
delete
(
`/copy-tasks/
${
taskId
}
`
);
await
axios
.
delete
(
`/copy-tasks/
${
taskId
}
`
);
dispatch
(
deleteTaskSuccess
())
dispatch
(
deleteTaskSuccess
())
dispatch
(
fetchCalendarTasks
(
userId
))
dispatch
(
fetchCalendarTasks
(
userId
))
}
catch
(
error
)
{
}
catch
(
error
)
{
dispatch
(
deleteTaskFailure
(
error
.
response
.
data
));
dispatch
(
deleteTaskFailure
(
error
.
response
.
data
));
}
}
}
}
}
}
const
fetchTasksByProjectRequest
=
()
=>
{
const
fetchTasksByProjectRequest
=
()
=>
{
return
{
type
:
FETCH_TASKS_BY_PROJECT_REQUEST
}
return
{
type
:
FETCH_TASKS_BY_PROJECT_REQUEST
}
};
};
const
fetchTasksByProjectSuccess
=
()
=>
{
const
fetchTasksByProjectSuccess
=
()
=>
{
return
{
type
:
FETCH_TASKS_BY_PROJECT_SUCCESS
}
return
{
type
:
FETCH_TASKS_BY_PROJECT_SUCCESS
}
};
};
const
fetchTasksByProjectFailure
=
(
error
)
=>
{
const
fetchTasksByProjectFailure
=
(
error
)
=>
{
return
{
type
:
FETCH_TASKS_BY_PROJECT_FAILURE
,
error
}
return
{
type
:
FETCH_TASKS_BY_PROJECT_FAILURE
,
error
}
};
};
export
const
fetchTasksByProject
=
(
projects
)
=>
{
export
const
fetchTasksByProject
=
(
projects
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
fetchTasksByProjectRequest
());
dispatch
(
fetchTasksByProjectRequest
());
try
{
try
{
const
response
=
await
axios
.
post
(
"/tasks/project"
,
projects
);
const
response
=
await
axios
.
post
(
"/tasks/project"
,
projects
);
dispatch
(
fetchTasksByProjectSuccess
(
response
.
data
.
tasks
))
dispatch
(
fetchTasksByProjectSuccess
(
response
.
data
.
tasks
))
}
catch
(
error
)
{
}
catch
(
error
)
{
dispatch
(
fetchTasksByProjectFailure
(
error
.
response
.
data
));
dispatch
(
fetchTasksByProjectFailure
(
error
.
response
.
data
));
}
}
}
}
}
}
const
deleteDateTimeTaskRequest
=
()
=>
{
const
deleteDateTimeTaskRequest
=
()
=>
{
return
{
type
:
DELETE_DATETIMETASK_REQUEST
}
return
{
type
:
DELETE_DATETIMETASK_REQUEST
}
};
};
const
deleteDateTimeTaskSuccess
=
()
=>
{
const
deleteDateTimeTaskSuccess
=
()
=>
{
return
{
type
:
DELETE_DATETIMETASK_SUCCESS
}
return
{
type
:
DELETE_DATETIMETASK_SUCCESS
}
};
};
const
deleteDateTimeTaskFailure
=
(
error
)
=>
{
const
deleteDateTimeTaskFailure
=
(
error
)
=>
{
return
{
type
:
DELETE_DATETIMETASK_FAILURE
,
error
}
return
{
type
:
DELETE_DATETIMETASK_FAILURE
,
error
}
};
};
export
const
deleteDateTimeTask
=
(
dateTimeTaskId
)
=>
{
export
const
deleteDateTimeTask
=
(
dateTimeTaskId
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
deleteDateTimeTaskRequest
());
dispatch
(
deleteDateTimeTaskRequest
());
try
{
try
{
await
axios
.
delete
(
`/copy-tasks/
${
dateTimeTaskId
}
`
);
await
axios
.
delete
(
`/copy-tasks/
${
dateTimeTaskId
}
`
);
dispatch
(
deleteDateTimeTaskSuccess
())
dispatch
(
deleteDateTimeTaskSuccess
())
dispatch
(
fetchAllTasks
())
dispatch
(
fetchAllTasks
())
}
catch
(
error
)
{
}
catch
(
error
)
{
dispatch
(
deleteDateTimeTaskFailure
(
error
.
response
.
data
));
dispatch
(
deleteDateTimeTaskFailure
(
error
.
response
.
data
));
}
}
}
}
}
}
export
const
deleteDateTimeTaskUsers
=
(
dateTimeTaskId
)
=>
{
export
const
deleteDateTimeTaskUsers
=
(
dateTimeTaskId
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
deleteDateTimeTaskRequest
());
dispatch
(
deleteDateTimeTaskRequest
());
try
{
try
{
await
axios
.
delete
(
`/copy-tasks/
${
dateTimeTaskId
}
`
);
await
axios
.
delete
(
`/copy-tasks/
${
dateTimeTaskId
}
`
);
dispatch
(
deleteDateTimeTaskSuccess
())
dispatch
(
deleteDateTimeTaskSuccess
())
dispatch
(
fetchAllTasksByMembership
())
dispatch
(
fetchAllTasksByMembership
())
}
catch
(
error
)
{
}
catch
(
error
)
{
dispatch
(
deleteDateTimeTaskFailure
(
error
.
response
.
data
));
dispatch
(
deleteDateTimeTaskFailure
(
error
.
response
.
data
));
}
}
}
}
}
}
...
@@ -310,27 +316,27 @@ export const deleteDateTimeTaskUsers = (dateTimeTaskId) => {
...
@@ -310,27 +316,27 @@ export const deleteDateTimeTaskUsers = (dateTimeTaskId) => {
/** add new task in UserTasks Table */
/** add new task in UserTasks Table */
const
addTaskToUserTasksTableRequest
=
()
=>
{
const
addTaskToUserTasksTableRequest
=
()
=>
{
return
{
type
:
ADD_NEW_TASK_REQUEST
}
return
{
type
:
ADD_NEW_TASK_REQUEST
}
};
};
const
addTaskToUserTasksTableSuccess
=
()
=>
{
const
addTaskToUserTasksTableSuccess
=
()
=>
{
return
{
type
:
ADD_NEW_TASK_SUCCESS
}
return
{
type
:
ADD_NEW_TASK_SUCCESS
}
};
};
const
addTaskToUserTasksTableFailure
=
(
error
)
=>
{
const
addTaskToUserTasksTableFailure
=
(
error
)
=>
{
return
{
type
:
ADD_NEW_TASK_FAILURE
,
error
}
return
{
type
:
ADD_NEW_TASK_FAILURE
,
error
}
};
};
export
const
addTaskToUserTasksTable
=
(
task
)
=>
{
export
const
addTaskToUserTasksTable
=
(
task
)
=>
{
return
async
(
dispatch
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
addTaskToUserTasksTableRequest
());
dispatch
(
addTaskToUserTasksTableRequest
());
try
{
try
{
await
axios
.
post
(
"/tasks/users"
,
task
);
await
axios
.
post
(
"/tasks/users"
,
task
);
dispatch
(
addTaskToUserTasksTableSuccess
())
dispatch
(
addTaskToUserTasksTableSuccess
())
dispatch
(
fetchAllTasksByMembership
())
dispatch
(
fetchAllTasksByMembership
())
}
catch
(
error
)
{
}
catch
(
error
)
{
dispatch
(
addTaskToUserTasksTableFailure
(
error
.
response
.
data
));
dispatch
(
addTaskToUserTasksTableFailure
(
error
.
response
.
data
));
}
}
}
}
}
}
...
@@ -338,9 +344,9 @@ export const addTaskToUserTasksTable = (task) => {
...
@@ -338,9 +344,9 @@ export const addTaskToUserTasksTable = (task) => {
export
const
activateCreateCopyTasksMode
=
(
task
,
navigate
)
=>
{
export
const
activateCreateCopyTasksMode
=
(
task
,
navigate
)
=>
{
navigate
(
'/'
)
navigate
(
'/'
)
return
{
type
:
ACTIVATE_CREATE_COPY_TASKS_MODE
,
task
}
return
{
type
:
ACTIVATE_CREATE_COPY_TASKS_MODE
,
task
}
}
}
export
const
deactivateCreateCopyTasksMode
=
()
=>
{
export
const
deactivateCreateCopyTasksMode
=
()
=>
{
return
{
type
:
DEACTIVATE_CREATE_COPY_TASKS_MODE
}
return
{
type
:
DEACTIVATE_CREATE_COPY_TASKS_MODE
}
}
}
\ No newline at end of file
planner-front/src/store/reducers/tasksReducer.js
View file @
8faed77a
...
@@ -21,7 +21,8 @@ import {
...
@@ -21,7 +21,8 @@ import {
DELETE_DATETIMETASK_REQUEST
,
DELETE_DATETIMETASK_REQUEST
,
FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS
,
FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS
,
ACTIVATE_CREATE_COPY_TASKS_MODE
,
ACTIVATE_CREATE_COPY_TASKS_MODE
,
DEACTIVATE_CREATE_COPY_TASKS_MODE
DEACTIVATE_CREATE_COPY_TASKS_MODE
,
SORT_TASKS
}
from
"../actionTypes/tasksTypes"
;
}
from
"../actionTypes/tasksTypes"
;
const
initialState
=
{
const
initialState
=
{
...
@@ -31,6 +32,7 @@ const initialState = {
...
@@ -31,6 +32,7 @@ const initialState = {
},
},
tasks
:
[],
tasks
:
[],
calendarTasks
:
[],
calendarTasks
:
[],
sortedTasks
:
[],
loading
:
false
,
loading
:
false
,
error
:
null
,
error
:
null
,
};
};
...
@@ -141,6 +143,9 @@ const tasksReduсer = (state = initialState, action) => {
...
@@ -141,6 +143,9 @@ const tasksReduсer = (state = initialState, action) => {
return
{
...
state
,
copyMode
:
{
working
:
true
,
task
:
action
.
task
}
}
return
{
...
state
,
copyMode
:
{
working
:
true
,
task
:
action
.
task
}
}
case
DEACTIVATE_CREATE_COPY_TASKS_MODE
:
case
DEACTIVATE_CREATE_COPY_TASKS_MODE
:
return
{
...
state
,
copyMode
:
{
working
:
false
,
task
:
null
}
}
return
{
...
state
,
copyMode
:
{
working
:
false
,
task
:
null
}
}
case
SORT_TASKS
:
const
filteredTasks
=
state
.
tasks
.
filter
(
task
=>
action
.
projectIdListForTaskSelect
.
includes
(
task
.
project
?.
id
))
return
{
...
state
,
loading
:
false
,
sortedTasks
:
filteredTasks
};
default
:
default
:
return
state
;
return
state
;
}
}
...
...
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