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
b6d42153
Commit
b6d42153
authored
Jan 12, 2023
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#149
немного починил сортировки и сделал более стабильное отображение таблицы
parent
4b9c6870
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
213 additions
and
151 deletions
+213
-151
CalendarWeekTask.js
...alendarColumnDayWeek/CalendarWeekTask/CalendarWeekTask.js
+2
-2
UsersTasksTableBody.js
...TableContainer/UsersTasksTableBody/UsersTasksTableBody.js
+23
-15
helpers.js
...s/UsersTasksTableContainer/UsersTasksTableBody/helpers.js
+10
-2
UsersTasksTableHead.js
...TableContainer/UsersTasksTableHead/UsersTasksTableHead.js
+74
-24
UsersTasksTableToolbar.js
...mpoments/UsersTasksTableToolbar/UsersTasksTableToolbar.js
+4
-4
MonthCalendar.js
planner-front/src/containers/MonthCalendar/MonthCalendar.js
+1
-0
UsersTasks.js
planner-front/src/containers/UsersTasks/UsersTasks.js
+18
-32
WeekCalendar.js
planner-front/src/containers/WeekCalendar/WeekCalendar.js
+1
-0
tasksReducer.js
planner-front/src/store/reducers/tasksReducer.js
+80
-72
No files found.
planner-front/src/components/Calendars/WeekCalendar/WeekCalendarBody/CalendarColumnDayWeek/CalendarWeekTask/CalendarWeekTask.js
View file @
b6d42153
...
@@ -101,7 +101,7 @@ function CalendarWeekTask({ height, width, left, top, task, zIndex, handleOpen,
...
@@ -101,7 +101,7 @@ function CalendarWeekTask({ height, width, left, top, task, zIndex, handleOpen,
const
returnTask
=
useMemo
(()
=>
{
const
returnTask
=
useMemo
(()
=>
{
if
(
copyModeTask
?.
id
===
task
?.
mainTaskId
)
{
if
(
copyModeTask
?.
id
===
task
?.
mainTaskId
)
{
return
(
<>
return
(
<>
<
span
style
=
{{
textOverflow
:
'ellipsis'
,
padding
:
'5px 0 0 5px'
}}
>
<
span
style
=
{{
maxWidth
:
'80%'
,
whiteSpace
:
'nowrap'
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
,
padding
:
'5px 0 0 5px'
}}
>
{
task
.
title
}
{
task
.
title
}
<
/span
>
<
/span
>
<
DeleteIcon
<
DeleteIcon
...
@@ -121,7 +121,7 @@ function CalendarWeekTask({ height, width, left, top, task, zIndex, handleOpen,
...
@@ -121,7 +121,7 @@ function CalendarWeekTask({ height, width, left, top, task, zIndex, handleOpen,
<
/>
)
<
/>
)
}
else
{
}
else
{
return
(
<>
return
(
<>
<
span
style
=
{{
textOverflow
:
'ellipsis'
,
padding
:
'5px 0 0 5px'
}}
>
<
span
style
=
{{
maxWidth
:
'80%'
,
whiteSpace
:
'nowrap'
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
,
padding
:
'5px 0 0 5px'
}}
>
{
task
.
title
}
{
task
.
title
}
<
/span
>
<
/span
>
<
CopyIcon
<
CopyIcon
...
...
planner-front/src/components/UsersTasksCompoments/UsersTasksTableContainer/UsersTasksTableBody/UsersTasksTableBody.js
View file @
b6d42153
import
{
TableBody
,
TableCell
,
TableRow
}
from
"@mui/material"
;
import
{
Divider
,
TableBody
,
TableCell
,
TableRow
,
Tooltip
}
from
"@mui/material"
;
import
moment
from
"moment"
;
import
{
memo
}
from
"react"
;
import
{
memo
}
from
"react"
;
import
DeleteButton
from
"../../../UI/DeleteButton/DeleteButton"
;
import
{
getComparator
,
stableSort
}
from
"./helpers"
;
import
{
getComparator
,
stableSort
}
from
"./helpers"
;
import
{
Done
,
Edit
}
from
"@mui/icons-material"
;
function
UsersTasksTableBody
({
rows
,
page
,
rowsPerPage
,
order
,
orderBy
})
{
function
UsersTasksTableBody
({
rows
,
page
,
rowsPerPage
,
order
,
orderBy
})
{
return
(
return
(
<
TableBody
>
<
TableBody
>
...
@@ -12,24 +15,29 @@ function UsersTasksTableBody({rows, page, rowsPerPage, order, orderBy}) {
...
@@ -12,24 +15,29 @@ function UsersTasksTableBody({rows, page, rowsPerPage, order, orderBy}) {
return
(
return
(
<
TableRow
<
TableRow
hover
hover
tabIndex
=
{
-
1
}
key
=
{
row
.
id
}
key
=
{
row
.
name
}
>
>
<
TableCell
<
TableCell
sx
=
{{
width
:
'4%'
}}
>
{
row
.
priority
?
row
.
priority
:
null
}
<
/TableCell
>
component
=
"th"
<
TableCell
sx
=
{{
width
:
'10%'
}}
>
{
moment
(
row
.
createdAt
).
format
(
'DD.MM.YYYY'
)}
<
/TableCell
>
scope
=
"row"
<
Tooltip
title
=
{
row
.
description
}
>
padding
=
"none"
<
TableCell
sx
=
{{
width
:
'25%'
,
overflow
:
'hidden'
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
}}
>
>
{
row
.
title
}
{
row
.
name
}
<
/TableCell
>
<
/Tooltip
>
<
TableCell
sx
=
{{
width
:
'10%'
}}
>
{
row
.
projectTitle
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'8%'
}}
>
{
row
.
executorName
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'8%'
}}
>
{
row
.
authorName
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'15%'
}}
>
{
row
.
dateTimeTasks
.
length
?
row
.
dateTimeTasks
[
0
].
dateTimeStart
:
null
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'10%'
}}
>
{
row
.
dateTimeDeadLine
?
moment
(
row
.
dateTimeDeadLine
).
utcOffset
(
'+000'
).
format
(
'DD.MM.YYYY HH:MM'
)
:
null
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'7%'
}}
>
{
row
.
accomplish
}
<
/TableCell
>
<
TableCell
size
=
'medium'
sx
=
{{
width
:
'5%'
,
position
:
'relative'
}}
>
<
Edit
sx
=
{{
position
:
'absolute'
,
left
:
-
10
}}
/
>
<
DeleteButton
/>
<
/TableCell
>
<
/TableCell
>
<
TableCell
align
=
"right"
>
{
row
.
calories
}
<
/TableCell
>
<
TableCell
align
=
"right"
>
{
row
.
fat
}
<
/TableCell
>
<
TableCell
align
=
"right"
>
{
row
.
carbs
}
<
/TableCell
>
<
TableCell
align
=
"right"
>
{
row
.
protein
}
<
/TableCell
>
<
/TableRow
>
<
/TableRow
>
);
);
})}
})}
<
/TableBody
>
<
/TableBody
>
);
);
}
}
...
...
planner-front/src/components/UsersTasksCompoments/UsersTasksTableContainer/UsersTasksTableBody/helpers.js
View file @
b6d42153
function
descendingComparator
(
a
,
b
,
orderBy
)
{
function
descendingComparator
(
a
,
b
,
orderBy
,
order
)
{
if
(
!
b
[
orderBy
])
{
if
(
order
===
'asc'
)
{
return
1
}
return
-
1
}
if
(
b
[
orderBy
]
<
a
[
orderBy
])
{
if
(
b
[
orderBy
]
<
a
[
orderBy
])
{
return
-
1
;
return
-
1
;
}
}
...
@@ -9,9 +16,10 @@ function descendingComparator(a, b, orderBy) {
...
@@ -9,9 +16,10 @@ function descendingComparator(a, b, orderBy) {
}
}
export
function
getComparator
(
order
,
orderBy
)
{
export
function
getComparator
(
order
,
orderBy
)
{
console
.
log
(
order
)
return
order
===
'desc'
return
order
===
'desc'
?
(
a
,
b
)
=>
descendingComparator
(
a
,
b
,
orderBy
)
?
(
a
,
b
)
=>
descendingComparator
(
a
,
b
,
orderBy
)
:
(
a
,
b
)
=>
-
descendingComparator
(
a
,
b
,
orderBy
);
:
(
a
,
b
)
=>
-
descendingComparator
(
a
,
b
,
orderBy
,
order
);
}
}
export
function
stableSort
(
array
,
comparator
)
{
export
function
stableSort
(
array
,
comparator
)
{
...
...
planner-front/src/components/UsersTasksCompoments/UsersTasksTableContainer/UsersTasksTableHead/UsersTasksTableHead.js
View file @
b6d42153
...
@@ -4,34 +4,84 @@ import { memo } from "react";
...
@@ -4,34 +4,84 @@ import { memo } from "react";
const
headCells
=
[
const
headCells
=
[
{
{
id
:
'name'
,
id
:
"priority"
,
numeric
:
false
,
label
:
"Приоритет"
,
disablePadding
:
false
,
canSort
:
true
,
label
:
'Dessert (100g serving)'
,
style
:
{
width
:
'4%'
}
},
},
{
{
id
:
'calories'
,
id
:
"createdAt"
,
numeric
:
true
,
label
:
"Дата создания"
,
disablePadding
:
false
,
canSort
:
true
,
label
:
'Calories'
,
style
:
{
width
:
'10%'
}
},
},
{
{
id
:
'fat'
,
id
:
"title"
,
numeric
:
true
,
label
:
"Заголовок"
,
disablePadding
:
false
,
canSort
:
true
,
label
:
'Fat (g)'
,
style
:
{
width
:
'25%'
}
},
},
{
{
id
:
'carbs'
,
id
:
"projectTitle"
,
numeric
:
true
,
label
:
"Проект"
,
disablePadding
:
false
,
canSort
:
true
,
label
:
'Carbs (g)'
,
style
:
{
width
:
'10%'
}
},
},
{
{
id
:
'protein'
,
id
:
"executorName"
,
numeric
:
true
,
label
:
"Исполнитель"
,
disablePadding
:
false
,
canSort
:
true
,
label
:
'Protein (g)'
,
style
:
{
width
:
'8%'
}
},
{
id
:
"authorName"
,
label
:
"Автор"
,
canSort
:
true
,
style
:
{
width
:
'8%'
}
},
{
id
:
"dateTimeStart"
,
label
:
"Дата и время выполнения"
,
canSort
:
false
,
style
:
{
width
:
'15%'
}
},
{
id
:
"dateTimeDeadLine"
,
label
:
"Дедлайн"
,
canSort
:
true
,
style
:
{
width
:
'10%'
}
},
{
id
:
"accomplish"
,
label
:
"Статус"
,
canSort
:
true
,
style
:
{
width
:
'7%'
}
},
{
id
:
"buttons"
,
label
:
""
,
canSort
:
false
,
style
:
{
width
:
'5%'
}
},
},
];
];
...
@@ -46,11 +96,10 @@ function UsersTasksTableHead({ order, orderBy, handleRequestSort }) {
...
@@ -46,11 +96,10 @@ function UsersTasksTableHead({ order, orderBy, handleRequestSort }) {
{
headCells
.
map
((
headCell
)
=>
(
{
headCells
.
map
((
headCell
)
=>
(
<
TableCell
<
TableCell
key
=
{
headCell
.
id
}
key
=
{
headCell
.
id
}
align
=
{
headCell
.
numeric
?
'right'
:
'left'
}
padding
=
{
headCell
.
disablePadding
?
'none'
:
'normal'
}
sortDirection
=
{
orderBy
===
headCell
.
id
?
order
:
false
}
sortDirection
=
{
orderBy
===
headCell
.
id
?
order
:
false
}
sx
=
{
headCell
.
style
}
>
>
<
TableSortLabel
{
headCell
.
canSort
?
<
TableSortLabel
active
=
{
orderBy
===
headCell
.
id
}
active
=
{
orderBy
===
headCell
.
id
}
direction
=
{
orderBy
===
headCell
.
id
?
order
:
'asc'
}
direction
=
{
orderBy
===
headCell
.
id
?
order
:
'asc'
}
onClick
=
{
createSortHandler
(
headCell
.
id
)}
onClick
=
{
createSortHandler
(
headCell
.
id
)}
...
@@ -61,7 +110,8 @@ function UsersTasksTableHead({ order, orderBy, handleRequestSort }) {
...
@@ -61,7 +110,8 @@ function UsersTasksTableHead({ order, orderBy, handleRequestSort }) {
{
order
===
'desc'
?
'sorted descending'
:
'sorted ascending'
}
{
order
===
'desc'
?
'sorted descending'
:
'sorted ascending'
}
<
/Box
>
<
/Box
>
)
:
null
}
)
:
null
}
<
/TableSortLabel
>
<
/TableSortLabel> : headCell.label
}
<
/TableCell
>
<
/TableCell
>
))}
))}
<
/TableRow
>
<
/TableRow
>
...
...
planner-front/src/components/UsersTasksCompoments/UsersTasksTableToolbar/UsersTasksTableToolbar.js
View file @
b6d42153
import
{
Toolbar
,
Typography
}
from
"@mui/material"
;
import
{
AppBar
,
Toolbar
,
Typography
}
from
"@mui/material"
;
import
{
memo
}
from
"react"
;
import
{
memo
}
from
"react"
;
function
UsersTasksTableToolbar
()
{
function
UsersTasksTableToolbar
()
{
return
(
return
(
<
Toolbar
>
<
AppBar
position
=
"static"
sx
=
{{
padding
:
3
}}
>
<
Typography
<
Typography
sx
=
{{
flex
:
'1 1 100%'
}}
sx
=
{{
flex
:
'1 1 100%'
}}
variant
=
"h6"
variant
=
"h6"
id
=
"tableTitle"
id
=
"tableTitle"
component
=
"div"
component
=
"div"
>
>
Nutrition
Задачи
сотрудников
<
/Typography
>
<
/Typography
>
<
/
Toolb
ar
>
<
/
AppB
ar
>
);
);
}
}
...
...
planner-front/src/containers/MonthCalendar/MonthCalendar.js
View file @
b6d42153
...
@@ -199,6 +199,7 @@ function MonthCalendar() {
...
@@ -199,6 +199,7 @@ function MonthCalendar() {
executor
:
userId
,
executor
:
userId
,
author
:
user
.
id
,
author
:
user
.
id
,
calendar
:
true
,
calendar
:
true
,
priority
:
currentTask
.
priority
===
''
?
null
:
currentTask
.
priority
}
}
delete
newTask
.
infoForCell
delete
newTask
.
infoForCell
delete
newTask
.
id
delete
newTask
.
id
...
...
planner-front/src/containers/UsersTasks/UsersTasks.js
View file @
b6d42153
import
*
as
React
from
'react'
;
import
Paper
from
'@mui/material/Paper'
;
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
{
shallowEqual
,
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
useEffect
,
useState
}
from
'react'
;
function
createData
(
name
,
calories
,
fat
,
carbs
,
protein
)
{
export
default
function
EnhancedTable
()
{
return
{
const
dispatch
=
useDispatch
();
name
,
calories
,
fat
,
carbs
,
protein
,
};
}
const
rows
=
[
const
{
tasks
}
=
useSelector
((
state
)
=>
state
.
tasks
,
shallowEqual
);
createData
(
'Cupcake'
,
305
,
3.7
,
67
,
4.3
),
const
projects
=
useSelector
((
state
)
=>
state
.
tasks
.
projects
);
createData
(
'Donut'
,
452
,
25.0
,
51
,
4.9
),
const
user
=
useSelector
((
state
)
=>
state
.
users
.
user
);
createData
(
'Eclair'
,
262
,
16.0
,
24
,
6.0
),
console
.
log
(
tasks
)
createData
(
'Frozen yoghurt'
,
159
,
6.0
,
24
,
4.0
),
const
[
order
,
setOrder
]
=
useState
(
'asc'
);
createData
(
'Gingerbread'
,
356
,
16.0
,
49
,
3.9
),
const
[
orderBy
,
setOrderBy
]
=
useState
(
'createdAt'
);
createData
(
'Honeycomb'
,
408
,
3.2
,
87
,
6.5
),
const
[
page
,
setPage
]
=
useState
(
0
);
createData
(
'Ice cream sandwich'
,
237
,
9.0
,
37
,
4.3
),
const
[
rowsPerPage
,
setRowsPerPage
]
=
useState
(
10
);
createData
(
'Jelly Bean'
,
375
,
0.0
,
94
,
0.0
),
createData
(
'KitKat'
,
518
,
26.0
,
65
,
7.0
),
createData
(
'Lollipop'
,
392
,
0.2
,
98
,
0.0
),
createData
(
'Marshmallow'
,
318
,
0
,
81
,
2.0
),
createData
(
'Nougat'
,
360
,
19.0
,
9
,
37.0
),
createData
(
'Oreo'
,
437
,
18.0
,
63
,
4.0
),
];
export
default
function
EnhancedTable
()
{
useEffect
(()
=>
{
const
[
order
,
setOrder
]
=
React
.
useState
(
'asc'
);
dispatch
(
fetchAllTasksByMembership
());
const
[
orderBy
,
setOrderBy
]
=
React
.
useState
(
'calories'
);
},
[
dispatch
]);
const
[
page
,
setPage
]
=
React
.
useState
(
0
);
const
[
rowsPerPage
,
setRowsPerPage
]
=
React
.
useState
(
5
);
const
handleRequestSort
=
(
event
,
property
)
=>
{
const
handleRequestSort
=
(
event
,
property
)
=>
{
const
isAsc
=
orderBy
===
property
&&
order
===
'asc'
;
const
isAsc
=
orderBy
===
property
&&
order
===
'asc'
;
...
@@ -58,12 +44,12 @@ export default function EnhancedTable() {
...
@@ -58,12 +44,12 @@ export default function EnhancedTable() {
order
=
{
order
}
order
=
{
order
}
orderBy
=
{
orderBy
}
orderBy
=
{
orderBy
}
handleRequestSort
=
{
handleRequestSort
}
handleRequestSort
=
{
handleRequestSort
}
rows
=
{
row
s
}
rows
=
{
task
s
}
page
=
{
page
}
page
=
{
page
}
rowsPerPage
=
{
rowsPerPage
}
rowsPerPage
=
{
rowsPerPage
}
/
>
/
>
<
UsersTasksTablePagination
<
UsersTasksTablePagination
count
=
{
row
s
.
length
}
count
=
{
task
s
.
length
}
rowsPerPage
=
{
rowsPerPage
}
rowsPerPage
=
{
rowsPerPage
}
page
=
{
page
}
page
=
{
page
}
handleChangePage
=
{
handleChangePage
}
handleChangePage
=
{
handleChangePage
}
...
...
planner-front/src/containers/WeekCalendar/WeekCalendar.js
View file @
b6d42153
...
@@ -178,6 +178,7 @@ function WeekCalendar() {
...
@@ -178,6 +178,7 @@ function WeekCalendar() {
executor
:
userId
,
executor
:
userId
,
author
:
user
.
id
,
author
:
user
.
id
,
calendar
:
true
,
calendar
:
true
,
priority
:
currentTask
.
priority
===
''
?
null
:
currentTask
.
priority
}
}
delete
newTask
.
infoForCell
delete
newTask
.
infoForCell
delete
newTask
.
id
delete
newTask
.
id
...
...
planner-front/src/store/reducers/tasksReducer.js
View file @
b6d42153
...
@@ -35,9 +35,9 @@ const initialState = {
...
@@ -35,9 +35,9 @@ const initialState = {
};
};
const
tasksRedu
с
er
=
(
state
=
initialState
,
action
)
=>
{
const
tasksRedu
с
er
=
(
state
=
initialState
,
action
)
=>
{
switch
(
action
.
type
)
{
switch
(
action
.
type
)
{
case
FETCH_CALENDAR_TASKS_REQUEST
:
case
FETCH_CALENDAR_TASKS_REQUEST
:
return
{...
state
,
loading
:
true
};
return
{
...
state
,
loading
:
true
};
case
FETCH_CALENDAR_TASKS_SUCCESS
:
case
FETCH_CALENDAR_TASKS_SUCCESS
:
const
newTasksWithoutInfoForCell
=
[]
const
newTasksWithoutInfoForCell
=
[]
const
newTasksWithInfoForCell
=
[]
const
newTasksWithInfoForCell
=
[]
...
@@ -56,7 +56,7 @@ const tasksReduсer = (state = initialState, action) => {
...
@@ -56,7 +56,7 @@ const tasksReduсer = (state = initialState, action) => {
})
})
}
}
}
}
newTasksWithoutInfoForCell
.
forEach
((
task
)
=>
{
newTasksWithoutInfoForCell
.
forEach
((
task
)
=>
{
if
(
task
.
dateTimeStart
&&
task
.
dateTimeDue
)
{
if
(
task
.
dateTimeStart
&&
task
.
dateTimeDue
)
{
if
(
new
Date
(
task
.
dateTimeDue
).
getTime
()
-
new
Date
(
task
.
dateTimeStart
).
getTime
()
<
(
24
*
3600000
)
&&
if
(
new
Date
(
task
.
dateTimeDue
).
getTime
()
-
new
Date
(
task
.
dateTimeStart
).
getTime
()
<
(
24
*
3600000
)
&&
new
Date
(
task
.
dateTimeDue
).
getTime
()
-
new
Date
(
task
.
dateTimeStart
).
getTime
()
>
0
)
{
new
Date
(
task
.
dateTimeDue
).
getTime
()
-
new
Date
(
task
.
dateTimeStart
).
getTime
()
>
0
)
{
...
@@ -70,7 +70,8 @@ const tasksReduсer = (state = initialState, action) => {
...
@@ -70,7 +70,8 @@ const tasksReduсer = (state = initialState, action) => {
const
timeEndHour
=
parseInt
(
timeEnd
.
split
(
':'
)[
0
])
const
timeEndHour
=
parseInt
(
timeEnd
.
split
(
':'
)[
0
])
const
timeStartMinute
=
parseInt
(
timeStart
.
split
(
':'
)[
1
])
const
timeStartMinute
=
parseInt
(
timeStart
.
split
(
':'
)[
1
])
const
timeEndMinute
=
parseInt
(
timeEnd
.
split
(
':'
)[
1
])
const
timeEndMinute
=
parseInt
(
timeEnd
.
split
(
':'
)[
1
])
const
newObj
=
{...
task
,
const
newObj
=
{
...
task
,
infoForCell
:
{
infoForCell
:
{
startDay
:
dayStart
,
startDay
:
dayStart
,
startHour
:
timeStartHour
,
startHour
:
timeStartHour
,
...
@@ -85,50 +86,57 @@ const tasksReduсer = (state = initialState, action) => {
...
@@ -85,50 +86,57 @@ 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
};
return
{
...
state
,
loading
:
false
,
tasks
:
action
.
tasks
,
projects
:
action
.
projects
};
case
FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS
:
case
FETCH_ALL_TASKS_BY_MEMBERSHIP_SUCCESS
:
return
{...
state
,
loading
:
false
,
tasks
:
action
.
tasks
,
projects
:
action
.
projects
};
console
.
log
(
action
.
tasks
)
const
newArr
=
action
.
tasks
.
map
((
task
)
=>
{
return
{
...
task
,
authorName
:
task
.
author
.
displayName
,
projectTitle
:
task
.
project
.
title
,
executorName
:
task
?.
executor
?.
displayName
||
null
,
}})
return
{
...
state
,
loading
:
false
,
tasks
:
newArr
,
projects
:
action
.
projects
};
case
FETCH_CALENDAR_TASKS_FAILURE
:
case
FETCH_CALENDAR_TASKS_FAILURE
:
return
{...
state
,
loading
:
false
,
error
:
action
.
error
};
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
case
ADD_NEW_TASK_SUCCESS
:
case
ADD_NEW_TASK_SUCCESS
:
return
{
...
state
,
loading
:
false
};
return
{
...
state
,
loading
:
false
};
case
ADD_NEW_TASK_REQUEST
:
case
ADD_NEW_TASK_REQUEST
:
return
{
...
state
,
loading
:
true
};
return
{
...
state
,
loading
:
true
};
case
ADD_NEW_TASK_FAILURE
:
case
ADD_NEW_TASK_FAILURE
:
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
case
FETCH_TASKS_BY_PROJECT_SUCCESS
:
case
FETCH_TASKS_BY_PROJECT_SUCCESS
:
return
{...
state
,
loading
:
false
,
tasks
:
action
.
tasks
};
return
{
...
state
,
loading
:
false
,
tasks
:
action
.
tasks
};
case
FETCH_TASKS_BY_PROJECT_REQUEST
:
case
FETCH_TASKS_BY_PROJECT_REQUEST
:
return
{...
state
,
loading
:
true
};
return
{
...
state
,
loading
:
true
};
case
FETCH_TASKS_BY_PROJECT_FAILURE
:
case
FETCH_TASKS_BY_PROJECT_FAILURE
:
return
{...
state
,
loading
:
false
,
error
:
action
.
error
};
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
case
EDIT_TASK_SUCCESS
:
case
EDIT_TASK_SUCCESS
:
return
{
...
state
,
loading
:
false
};
return
{
...
state
,
loading
:
false
};
case
EDIT_TASK_REQUEST
:
case
EDIT_TASK_REQUEST
:
return
{
...
state
,
loading
:
true
};
return
{
...
state
,
loading
:
true
};
case
EDIT_TASK_FAILURE
:
case
EDIT_TASK_FAILURE
:
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
case
DELETE_TASK_SUCCESS
:
case
DELETE_TASK_SUCCESS
:
return
{
...
state
,
loading
:
false
};
return
{
...
state
,
loading
:
false
};
case
DELETE_TASK_REQUEST
:
case
DELETE_TASK_REQUEST
:
return
{
...
state
,
loading
:
true
};
return
{
...
state
,
loading
:
true
};
case
DELETE_TASK_FAILURE
:
case
DELETE_TASK_FAILURE
:
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
case
DELETE_DATETIMETASK_SUCCESS
:
case
DELETE_DATETIMETASK_SUCCESS
:
return
{
...
state
,
loading
:
false
};
return
{
...
state
,
loading
:
false
};
case
DELETE_DATETIMETASK_REQUEST
:
case
DELETE_DATETIMETASK_REQUEST
:
return
{
...
state
,
loading
:
true
};
return
{
...
state
,
loading
:
true
};
case
DELETE_DATETIMETASK_FAILURE
:
case
DELETE_DATETIMETASK_FAILURE
:
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
case
ACTIVATE_CREATE_COPY_TASKS_MODE
:
case
ACTIVATE_CREATE_COPY_TASKS_MODE
:
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
}
}
default
:
default
:
return
state
;
return
state
;
}
}
};
};
export
default
tasksRedu
с
er
;
export
default
tasksRedu
с
er
;
\ No newline at end of file
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