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
31841a26
Commit
31841a26
authored
Jan 13, 2023
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#149
Начал работать над колонкой с копиями задач
parent
d33a0a95
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
40 deletions
+101
-40
UsersTasksRow.js
...tainer/UsersTasksTableBody/UsersTasksRow/UsersTasksRow.js
+81
-0
UsersTasksTableBody.js
...TableContainer/UsersTasksTableBody/UsersTasksTableBody.js
+10
-38
UsersTasksTableContainer.js
...ents/UsersTasksTableContainer/UsersTasksTableContainer.js
+2
-1
UsersTasks.js
planner-front/src/containers/UsersTasks/UsersTasks.js
+8
-1
No files found.
planner-front/src/components/UsersTasksCompoments/UsersTasksTableContainer/UsersTasksTableBody/UsersTasksRow/UsersTasksRow.js
0 → 100644
View file @
31841a26
import
{
Divider
,
IconButton
,
TableCell
,
TableRow
,
Tooltip
}
from
"@mui/material"
;
import
moment
from
"moment"
;
import
{
memo
,
useMemo
}
from
"react"
;
import
DeleteButton
from
"../../../../UI/DeleteButton/DeleteButton"
;
import
{
Edit
}
from
"@mui/icons-material"
;
import
{
useSelector
}
from
"react-redux"
;
import
CalendarMonthIcon
from
'@mui/icons-material/CalendarMonth'
;
import
{
Box
}
from
"@mui/system"
;
function
UsersTasksRow
({
row
,
deleteTaskHandler
,
calendarOpen
})
{
const
user
=
useSelector
((
state
)
=>
state
.
users
.
user
);
const
dateTimeTasks
=
useMemo
(()
=>
{
if
(
row
.
dateTimeTasks
.
length
===
1
)
{
const
date
=
moment
(
row
.
dateTimeTasks
[
0
].
dateTimeStart
).
utc
().
format
(
'DD.MM'
)
const
start
=
moment
(
row
.
dateTimeTasks
[
0
].
dateTimeStart
).
utc
().
format
(
'HH:mm'
)
const
end
=
moment
(
row
.
dateTimeTasks
[
0
].
dateTimeDue
).
utc
().
add
(
1
,
'minutes'
).
format
(
'HH:mm'
)
const
diff
=
parseInt
(
end
.
split
(
':'
)[
0
])
-
parseInt
(
start
.
split
(
':'
)[
0
])
return
<
Box
sx
=
{{
width
:
'90%'
,
display
:
'flex'
}}
>
<
Box
>
{
`
${
date
}
(
${
start
}
-
${
end
}
)`
}
<
Divider
sx
=
{{
opacity
:
0
}}
/
>
{
`часы:
${
diff
}
`
}
<
/Box
>
{
user
.
id
===
row
?.
executor
?.
id
?
<
Tooltip
title
=
"Перейти в календарь"
>
<
IconButton
sx
=
{{
marginLeft
:
'5px'
}}
onClick
=
{()
=>
{
calendarOpen
(
row
)}}
>
<
CalendarMonthIcon
/>
<
/IconButton
>
<
/Tooltip
>
:
null
}
<
/Box
>
}
else
{
return
null
}
},
[
user
.
id
,
calendarOpen
,
row
])
return
(
<>
<
TableRow
hover
key
=
{
row
.
id
}
>
<
TableCell
sx
=
{{
width
:
'4%'
}}
>
{
row
.
priority
?
row
.
priority
:
null
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'10%'
}}
>
{
moment
(
row
.
createdAt
).
format
(
'DD.MM.YYYY'
)}
<
/TableCell
>
<
Tooltip
title
=
{
row
.
description
}
>
<
TableCell
sx
=
{{
width
:
'25%'
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
}}
>
{
row
.
title
}
<
/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%'
}}
>
{
dateTimeTasks
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'10%'
}}
>
{
row
.
dateTimeDeadLine
?
moment
(
row
.
dateTimeDeadLine
).
utc
().
format
(
'DD.MM.YYYY HH:MM'
)
:
null
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'7%'
}}
>
{
row
.
accomplish
}
<
/TableCell
>
<
TableCell
size
=
'medium'
sx
=
{{
width
:
'5%'
,
position
:
'relative'
}}
>
{
user
.
id
===
row
.
author
.
id
?
<>
<
Edit
sx
=
{{
position
:
'absolute'
,
left
:
-
10
}}
/
>
<
DeleteButton
onClick
=
{()
=>
{
deleteTaskHandler
(
row
.
id
)
}}
/
>
<
/
>
:
<
Edit
/>
}
<
/TableCell
>
<
/TableRow
>
<
/>
)
;
}
export
default
memo
(
UsersTasksRow
)
\ No newline at end of file
planner-front/src/components/UsersTasksCompoments/UsersTasksTableContainer/UsersTasksTableBody/UsersTasksTableBody.js
View file @
31841a26
import
{
TableBody
,
TableCell
,
TableRow
,
Tooltip
}
from
"@mui/material"
;
import
{
TableBody
}
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
{
Edit
}
from
"@mui/icons-material"
;
import
UsersTasksRow
from
"./UsersTasksRow/UsersTasksRow"
;
import
{
useSelector
}
from
"react-redux"
;
function
UsersTasksTableBody
({
rows
,
page
,
rowsPerPage
,
order
,
orderBy
,
deleteTaskHandler
,
calendarOpen
})
{
function
UsersTasksTableBody
({
rows
,
page
,
rowsPerPage
,
order
,
orderBy
,
deleteTaskHandler
})
{
const
user
=
useSelector
((
state
)
=>
state
.
users
.
user
);
return
(
<>
return
(
<>
<
TableBody
>
<
TableBody
>
{
stableSort
(
rows
,
getComparator
(
order
,
orderBy
))
{
stableSort
(
rows
,
getComparator
(
order
,
orderBy
))
.
slice
(
page
*
rowsPerPage
,
page
*
rowsPerPage
+
rowsPerPage
)
.
slice
(
page
*
rowsPerPage
,
page
*
rowsPerPage
+
rowsPerPage
)
.
map
((
row
,
index
)
=>
{
.
map
((
row
,
index
)
=>
{
return
(
return
(
<
TableRow
<
UsersTasksRow
hover
key
=
{
row
.
id
}
key
=
{
row
.
id
}
>
deleteTaskHandler
=
{
deleteTaskHandler
}
<
TableCell
sx
=
{{
width
:
'4%'
}}
>
{
row
.
priority
?
row
.
priority
:
null
}
<
/TableCell
>
row
=
{
row
}
<
TableCell
sx
=
{{
width
:
'10%'
}}
>
{
moment
(
row
.
createdAt
).
format
(
'DD.MM.YYYY'
)}
<
/TableCell
>
calendarOpen
=
{
calendarOpen
}
<
Tooltip
title
=
{
row
.
description
}
>
/>
)
<
TableCell
sx
=
{{
width
:
'25%'
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
}}
>
{
row
.
title
}
<
/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'
}}
>
{
user
.
id
===
row
.
author
.
id
?
<>
<
Edit
sx
=
{{
position
:
'absolute'
,
left
:
-
10
}}
/
>
<
DeleteButton
onClick
=
{()
=>
{
deleteTaskHandler
(
row
.
id
)
}}
/
>
<
/
>
:
<
Edit
/>
}
<
/TableCell
>
<
/TableRow
>
);
})}
})}
<
/TableBody
>
<
/TableBody
>
<
/>
)
;
<
/>
)
;
}
}
...
...
planner-front/src/components/UsersTasksCompoments/UsersTasksTableContainer/UsersTasksTableContainer.js
View file @
31841a26
...
@@ -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
,
createNewTaskHandler
,
deleteTaskHandler
})
{
function
UsersTasksTableContainer
({
order
,
orderBy
,
handleRequestSort
,
rows
,
page
,
rowsPerPage
,
addFormStatus
,
onChangeNewTaskHandler
,
newTask
,
allUserProjectsForModalTask
,
onDateChange
,
createNewTaskHandler
,
deleteTaskHandler
,
calendarOpen
})
{
return
(
return
(
<
TableContainer
>
<
TableContainer
>
<
NewTaskForm
<
NewTaskForm
...
@@ -33,6 +33,7 @@ function UsersTasksTableContainer({ order, orderBy, handleRequestSort, rows, pag
...
@@ -33,6 +33,7 @@ function UsersTasksTableContainer({ order, orderBy, handleRequestSort, rows, pag
page
=
{
page
}
page
=
{
page
}
rowsPerPage
=
{
rowsPerPage
}
rowsPerPage
=
{
rowsPerPage
}
deleteTaskHandler
=
{
deleteTaskHandler
}
deleteTaskHandler
=
{
deleteTaskHandler
}
calendarOpen
=
{
calendarOpen
}
/
>
/
>
<
/Table
>
<
/Table
>
<
/TableContainer
>
<
/TableContainer
>
...
...
planner-front/src/containers/UsersTasks/UsersTasks.js
View file @
31841a26
...
@@ -2,14 +2,16 @@ import Paper from '@mui/material/Paper';
...
@@ -2,14 +2,16 @@ 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
{
addTaskToUserTasksTable
,
deleteTaskUsers
,
fetchAllTasksByMembership
}
from
'../../store/actions/tasksActions'
;
import
{
a
ctivateCreateCopyTasksMode
,
a
ddTaskToUserTasksTable
,
deleteTaskUsers
,
fetchAllTasksByMembership
}
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
}
from
'../../store/actions/projectsActions'
;
import
moment
from
'moment'
;
import
moment
from
'moment'
;
import
{
useNavigate
}
from
'react-router-dom'
;
export
default
function
EnhancedTable
()
{
export
default
function
EnhancedTable
()
{
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
navigate
=
useNavigate
()
const
{
tasks
}
=
useSelector
((
state
)
=>
state
.
tasks
);
const
{
tasks
}
=
useSelector
((
state
)
=>
state
.
tasks
);
const
{
allUserProjectsForModalTask
}
=
useSelector
(
state
=>
state
.
projects
,
shallowEqual
)
const
{
allUserProjectsForModalTask
}
=
useSelector
(
state
=>
state
.
projects
,
shallowEqual
)
...
@@ -110,6 +112,10 @@ export default function EnhancedTable() {
...
@@ -110,6 +112,10 @@ export default function EnhancedTable() {
dispatch
(
deleteTaskUsers
(
id
))
dispatch
(
deleteTaskUsers
(
id
))
},
[
dispatch
])
},
[
dispatch
])
const
calendarOpen
=
(
task
)
=>
{
dispatch
(
activateCreateCopyTasksMode
(
task
,
navigate
))
}
return
(
return
(
<
Paper
sx
=
{{
width
:
'100%'
,
mb
:
2
}}
>
<
Paper
sx
=
{{
width
:
'100%'
,
mb
:
2
}}
>
<
UsersTasksTableToolbar
<
UsersTasksTableToolbar
...
@@ -130,6 +136,7 @@ export default function EnhancedTable() {
...
@@ -130,6 +136,7 @@ export default function EnhancedTable() {
onDateChange
=
{
onDateChange
}
onDateChange
=
{
onDateChange
}
createNewTaskHandler
=
{
createNewTaskHandler
}
createNewTaskHandler
=
{
createNewTaskHandler
}
deleteTaskHandler
=
{
deleteTaskHandler
}
deleteTaskHandler
=
{
deleteTaskHandler
}
calendarOpen
=
{
calendarOpen
}
/
>
/
>
<
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