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
94d3fe63
Commit
94d3fe63
authored
Jan 15, 2023
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'task-154-fix/rework_mytasks_table' into 'development'
Task 154 fix/rework mytasks table See merge request
!122
parents
44db3680
f156467b
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
1108 additions
and
1348 deletions
+1108
-1348
tasks.ts
planner-api/src/routers/tasks.ts
+1
-0
CustomTableCell.js
...front/src/components/MyTasksCompoments/CustomTableCell.js
+0
-87
MyTaskToolBar.js
...r-front/src/components/MyTasksCompoments/MyTaskToolBar.js
+0
-76
DateTimePicker.js
...ts/MyTasksTableContainer/DateTimePicker/DateTimePicker.js
+51
-0
MyTaskNewTaskForm.js
...asksTableContainer/MyTaskNewTaskForm/MyTaskNewTaskForm.js
+112
-0
helpers.js
...oments/MyTasksTableContainer/MyTaskNewTaskForm/helpers.js
+5
-0
EditRow.js
...eContainer/MyTasksTableBody/MyTasksRow/EditRow/EditRow.js
+112
-0
MyTasksRow.js
...sTableContainer/MyTasksTableBody/MyTasksRow/MyTasksRow.js
+199
-0
TableForCopiesTasks.js
...ody/MyTasksRow/TableForCopiesTasks/TableForCopiesTasks.js
+89
-0
MyTasksTableBody.js
...yTasksTableContainer/MyTasksTableBody/MyTasksTableBody.js
+35
-0
helpers.js
...poments/MyTasksTableContainer/MyTasksTableBody/helpers.js
+34
-0
MyTasksTableContainer.js
...Compoments/MyTasksTableContainer/MyTasksTableContainer.js
+50
-0
MyTasksTableHead.js
...yTasksTableContainer/MyTasksTableHead/MyTasksTableHead.js
+114
-0
MyTasksTablePagination.js
...mpoments/MyTasksTablePagination/MyTasksTablePagination.js
+20
-0
CreateTaskFromButton.js
...TableToolbar/CreateTaskFromButton/CreateTaskFromButton.js
+30
-0
MyTasksTableToolbar.js
...asksCompoments/MyTasksTableToolbar/MyTasksTableToolbar.js
+43
-0
NewTaskForm.js
...ner-front/src/components/MyTasksCompoments/NewTaskForm.js
+0
-238
TableRowTask.js
...components/MyTasksCompoments/TableRowTask/TableRowTask.js
+0
-366
TaskModal.css
.../src/components/MyTasksCompoments/TaskModal/TaskModal.css
+0
-20
TaskModal.js
...t/src/components/MyTasksCompoments/TaskModal/TaskModal.js
+0
-104
СustomSelect.js
planner-front/src/components/UI/СustomSelect/СustomSelect.js
+2
-1
EditRow.js
...iner/UsersTasksTableBody/UsersTasksRow/EditRow/EditRow.js
+1
-0
MyTasks.js
planner-front/src/containers/MyTasks/MyTasks.js
+195
-312
MyTasksHeader.js
...ont/src/containers/MyTasks/MyTasksHeader/MyTasksHeader.js
+0
-141
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 @
94d3fe63
...
@@ -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/CustomTableCell.js
deleted
100644 → 0
View file @
44db3680
import
*
as
React
from
"react"
;
import
TableCell
from
"@mui/material/TableCell"
;
import
Input
from
"@mui/material/Input"
;
import
moment
from
"moment"
;
const
CustomTableCell
=
({
task
,
name
,
value
,
value2
,
onChange
,
onModalOpen
,
placeholder
,
user
,
width
,
})
=>
{
const
styles
=
{
width
:
width
,
padding
:
"1px 16px 1px 1px"
};
const
inputStyles
=
placeholder
?
{
width
:
"100%"
,
padding
:
"1px"
}
:
{
padding
:
"1px"
};
const
divStyle
=
{
display
:
"flex"
,
justifyContent
:
"space-between"
,
flexDirection
:
"column"
,
fontSize
:
"12px"
,
};
// if (name==='dateTimeDeadLine'){
// console.log('dateTimeDeadLine ', name, ' ', value)
// }
const
divTwoStyle
=
{
display
:
"flex"
,
flexDirection
:
"row"
,
fontSize
:
"12px"
,
};
const
duration
=
moment
.
duration
(
moment
(
task
?.
dateTimeTasks
[
0
]?.
dateTimeDue
).
diff
(
moment
(
task
?.
dateTimeTasks
[
0
]?.
dateTimeStart
)
)
);
const
hours
=
Math
.
round
(
duration
.
asHours
());
if
(
task
)
{
return
(
<>
<
TableCell
onClick
=
{(
e
)
=>
(
onModalOpen
?
onModalOpen
(
e
,
task
)
:
null
)}
align
=
"left"
style
=
{
styles
}
>
{(
task
.
isEditMode
&&
onChange
&&
name
!==
"author"
&&
task
.
author
?.
id
===
user
?.
id
)
||
placeholder
?
(
<
Input
placeholder
=
{
placeholder
}
value
=
{
value
}
name
=
{
name
}
onChange
=
{(
e
)
=>
onChange
(
e
,
task
)}
style
=
{
inputStyles
}
/
>
)
:
name
!==
"dateTimeStart"
?
(
<
span
>
{
value
}
<
/span
>
)
:
name
===
"dateTimeDeadLine"
&&
value
===
'Invalid date'
?
<
span
>
''
<
/span
>
:(
<
div
style
=
{
divStyle
}
>
<
div
style
=
{
divTwoStyle
}
>
<
span
title
=
{
moment
(
task
.
dateTimeTasks
[
0
]?.
dateTimeStart
)
.
utc
()
.
format
(
"DD/MM/YY"
)}
>
{
value
}
<
/span> <span> </
span
>
<
span
>
({
value2
})
<
/span></
div
>
<
span
>
часы
:{
hours
}
<
/span
>
<
/div
>
)}
<
/TableCell
>
<
/
>
);
}
};
export
default
CustomTableCell
;
planner-front/src/components/MyTasksCompoments/MyTaskToolBar.js
deleted
100644 → 0
View file @
44db3680
import
*
as
React
from
'react'
;
import
AppBar
from
'@mui/material/AppBar'
;
import
Box
from
'@mui/material/Box'
;
import
Toolbar
from
'@mui/material/Toolbar'
;
import
Typography
from
'@mui/material/Typography'
;
import
Button
from
'@mui/material/Button'
;
import
MultipleSelect
from
'../../components/UI/MultipleSelect/MultipleSelect'
;
import
Add
from
"@mui/icons-material/Add"
;
import
Close
from
"@mui/icons-material/Close"
;
// import { TaskSharp } from '@mui/icons-material';
export
default
function
MyTaskToolBar
({
projects
,
onClickActiveTasks
,
activeTasksOn
,
onCloseFilterByProjects
,
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
,
formStatus
,
onClick
})
{
let
projectsFilter
=
<><
/
>
if
(
Array
.
isArray
(
projects
))
{
projectsFilter
=
<
MultipleSelect
projects
=
{
projects
}
onCloseFilterByProjects
=
{
onCloseFilterByProjects
}
projectIdListForTaskSelect
=
{
projectIdListForTaskSelect
}
setProjectIdListForTaskSelect
=
{
setProjectIdListForTaskSelect
}
/
>
}
return
(
<
Box
sx
=
{{
flexGrow
:
1
}}
>
<
AppBar
position
=
"static"
>
<
Toolbar
>
<
Typography
variant
=
"h6"
component
=
"div"
sx
=
{{
flexGrow
:
1
}}
>
Мои
задачи
<
/Typography
>
<
Button
color
=
{
"inherit"
}
style
=
{{
backgroundColor
:
activeTasksOn
===
true
?
"red"
:
"inherit"
,
}}
onClick
=
{()
=>
onClickActiveTasks
()}
>
Активные
задачи
<
/Button
>
{
projectsFilter
}
<
Button
color
=
{
formStatus
===
true
?
"info"
:
"inherit"
}
style
=
{{
backgroundColor
:
formStatus
===
true
?
"white"
:
"inherit"
,
}}
onClick
=
{
onClick
}
>
{
formStatus
===
true
?
(
<>
<
Close
/>
<
span
style
=
{{
lineHeight
:
"16px"
}}
>
Скрыть
задачу
<
/span
>
<
/
>
)
:
(
<>
<
Add
/>
<
span
style
=
{{
lineHeight
:
"16px"
}}
>
Добавить
задачу
<
/span
>
<
/
>
)}
<
/Button
>
<
/Toolbar
>
<
/AppBar
>
<
/Box
>
);
}
planner-front/src/components/MyTasksCompoments/DateTimePicker/DateTimePicker.js
→
planner-front/src/components/MyTasksCompoments/
MyTasksTableContainer/
DateTimePicker/DateTimePicker.js
View file @
94d3fe63
import
React
,
{
useState
}
from
"react"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
TextField
from
"@mui/material/TextField"
;
import
TextField
from
"@mui/material/TextField"
;
import
{
LocalizationProvider
}
from
"@mui/x-date-pickers/LocalizationProvider"
;
import
{
LocalizationProvider
}
from
"@mui/x-date-pickers/LocalizationProvider"
;
import
{
DateTimePicker
}
from
"@mui/x-date-pickers/DateTimePicker"
;
import
{
DateTimePicker
}
from
"@mui/x-date-pickers/DateTimePicker"
;
import
{
AdapterMoment
}
from
"@mui/x-date-pickers/AdapterMoment"
;
import
{
AdapterMoment
}
from
"@mui/x-date-pickers/AdapterMoment"
;
import
{
AdapterDayjs
}
from
'@mui/x-date-pickers/AdapterDayjs'
;
import
moment
from
"moment"
;
import
moment
from
"moment"
;
export
default
function
MaterialUIPickers
({
task
,
name
,
onChange
,
})
{
export
default
function
MaterialUIPickers
({
task
,
name
,
onChange
,
currentTask
})
{
const
[
state
,
setState
]
=
useState
(
null
)
const
[
state
,
setState
]
=
useState
(
null
)
let
fullYear
=
new
Date
().
getFullYear
()
useEffect
(()
=>
{
let
month
=
new
Date
().
getMonth
()
if
(
!
task
.
dateTimeDeadLine
)
setState
(
null
)
let
day
=
new
Date
().
getDate
();
if
(
currentTask
)
setState
(
moment
(
task
.
dateTimeDeadLine
).
utc
())
console
.
log
(
'datepicker inside task'
,
task
,
'state '
,
state
)
},
[
task
.
dateTimeDeadLine
,
currentTask
])
return
(
return
(
<
LocalizationProvider
<
LocalizationProvider
...
@@ -24,27 +24,26 @@ export default function MaterialUIPickers({task, name,onChange, }) {
...
@@ -24,27 +24,26 @@ export default function MaterialUIPickers({task, name,onChange, }) {
adapterLocale
=
{
'ru-RU'
}
adapterLocale
=
{
'ru-RU'
}
>
>
<
DateTimePicker
<
DateTimePicker
minTime
=
{
moment
({
year
:
fullYear
,
month
:
month
,
day
:
day
,
hour
:
11
,
minute
:
0
})}
maxTime
=
{
moment
({
year
:
fullYear
,
month
:
month
,
day
:
day
,
hour
:
20
,
minute
:
0
})}
disablePast
=
{
true
}
disablePast
=
{
true
}
showTimeSelect
=
{
true
}
showTimeSelect
=
{
true
}
minutesStep
=
{
60
}
minutesStep
=
{
60
}
ampm
=
{
false
}
ampm
=
{
false
}
ampmInClock
=
{
false
}
ampmInClock
=
{
false
}
inputFormat
=
"DD/MM/YY HH:mm"
inputFormat
=
"DD/MM/YY HH:mm"
disabled
=
{
task
.
readOnly
}
renderInput
=
{(
params
)
=>
{
renderInput
=
{(
params
)
=>
{
return
(
return
(
<
TextField
<
TextField
{...
params
}
{...
params
}
sx
=
{{
width
:
"auto"
,
fontWeight
:
"200"
,
fontSize
:
5
}}
sx
=
{{
width
:
"auto"
,
fontWeight
:
"200"
,
fontSize
:
5
}}
name
=
{
name
}
name
=
{
name
}
value
=
{
moment
(
task
.
dateTimeDeadLine
).
utc
()}
/
>
/
>
)}}
)
}}
value
=
{
state
}
value
=
{
state
}
onChange
=
{(
newValue
)
=>
{
onChange
=
{(
newValue
)
=>
{
setState
(
newValue
)
setState
(
newValue
)
console
.
log
(
'newValue '
,
newValue
)
onChange
(
newValue
,
name
);
onChange
(
task
.
id
,
newValue
,
name
);
}}
}}
/
>
/
>
<
/LocalizationProvider
>
<
/LocalizationProvider
>
...
...
planner-front/src/components/MyTasksCompoments/MyTasksTableContainer/MyTaskNewTaskForm/MyTaskNewTaskForm.js
0 → 100644
View file @
94d3fe63
import
{
Box
,
Divider
,
Grid
,
IconButton
,
TextField
,
Tooltip
,
Typography
,
}
from
"@mui/material"
;
import
{
styled
}
from
'@mui/material/styles'
;
import
{
memo
}
from
"react"
;
import
{
priorities
}
from
"../../../../constants"
;
import
CustomSelect
from
"../../../UI/СustomSelect/СustomSelect"
import
MaterialUIPickers
from
"../DateTimePicker/DateTimePicker"
;
import
{
Save
}
from
"@mui/icons-material"
;
import
{
isValidate
}
from
"./helpers"
;
const
StyledTooltip
=
styled
(({
className
,
...
props
})
=>
(
<
Tooltip
{...
props
}
classes
=
{{
popper
:
className
}}
/
>
))
`
& .MuiTooltip-tooltip {
background: white;
}
`
;
function
MyTaskNewTaskForm
({
addFormStatus
,
onChangeNewTaskHandler
,
newTask
,
allUserProjectsForModalTask
,
onDateChangeHandler
,
createNewTaskHandler
})
{
return
(
<
Box
sx
=
{{
height
:
addFormStatus
?
'200px'
:
'0px'
,
transition
:
'all 0.3s linear'
,
visibility
:
addFormStatus
?
'visible'
:
'hidden'
,
transform
:
addFormStatus
?
'translateY(0)'
:
'translateY(-20vh)'
}}
>
<
Box
>
<
Divider
>
<
Typography
variant
=
"overline"
>
Добавить
новую
задачу
<
/Typography
>
<
/Divider
>
<
Box
sx
=
{{
backgroundColor
:
"#E8E8E8"
,
marginBottom
:
"2em"
,
}}
>
<
Grid
container
padding
=
{
2
}
>
<
Grid
item
xs
=
{
1
}
>
Приоритеты
<
/Grid
>
<
Grid
item
xs
=
{
5
}
>
Заголовок
<
/Grid
>
<
Grid
item
xs
=
{
2
}
>
Проект
<
/Grid
>
<
Grid
item
xs
=
{
3
}
>
Дедлайн
<
/Grid
>
<
Grid
item
xs
=
{
1
}
><
/Grid
>
<
/Grid
>
<
Grid
container
padding
=
{
2
}
alignItems
=
'center'
>
<
Grid
item
xs
=
{
1
}
>
<
CustomSelect
defaultValue
=
{
priorities
[
0
]?.
value
}
value
=
{
newTask
.
priority
}
name
=
{
'priority'
}
variant
=
{
'outlined'
}
onChange
=
{
onChangeNewTaskHandler
}
id
=
{
'priority-type'
}
items
=
{
priorities
}
sx
=
{{
width
:
'90%'
}}
/
>
<
/Grid
>
<
Grid
item
xs
=
{
5
}
>
<
StyledTooltip
title
=
{
<
TextField
id
=
"task-description"
value
=
{
newTask
.
description
}
variant
=
"outlined"
name
=
'description'
placeholder
=
'Описание'
sx
=
{{
width
:
'300px'
}}
onChange
=
{
onChangeNewTaskHandler
}
multiline
rows
=
{
5
}
/>}
>
<
TextField
id
=
"task-title"
value
=
{
newTask
.
title
}
variant
=
"outlined"
name
=
'title'
sx
=
{{
width
:
'90%'
}}
onChange
=
{
onChangeNewTaskHandler
}
/
>
<
/StyledTooltip
>
<
/Grid
>
<
Grid
item
xs
=
{
2
}
>
<
CustomSelect
value
=
{
newTask
.
project
}
name
=
{
'project'
}
variant
=
{
'outlined'
}
onChange
=
{
onChangeNewTaskHandler
}
id
=
{
'project'
}
items
=
{
allUserProjectsForModalTask
}
sx
=
{{
width
:
'90%'
}}
/
>
<
/Grid
>
<
Grid
item
xs
=
{
3
}
>
<
MaterialUIPickers
task
=
{
newTask
}
name
=
"dateTimeDeadLine"
onChange
=
{
onDateChangeHandler
}
/
>
<
/Grid
>
<
Grid
item
xs
=
{
1
}
>
<
IconButton
disabled
=
{
!
isValidate
(
newTask
.
title
,
newTask
.
description
)}
onClick
=
{
createNewTaskHandler
}
>
<
Save
/>
<
/IconButton
>
<
/Grid
>
<
/Grid
>
<
Grid
container
><
/Grid
>
<
/Box
>
<
Divider
/>
<
/Box
>
<
/Box>
)
;
}
export
default
memo
(
MyTaskNewTaskForm
)
\ No newline at end of file
planner-front/src/components/MyTasksCompoments/MyTasksTableContainer/MyTaskNewTaskForm/helpers.js
0 → 100644
View file @
94d3fe63
export
const
isValidate
=
(
title
,
description
)
=>
{
if
(
title
.
length
===
0
)
return
false
if
(
title
.
length
<
50
&&
description
.
length
<
100
)
return
true
return
false
}
\ No newline at end of file
planner-front/src/components/MyTasksCompoments/MyTasksTableContainer/MyTasksTableBody/MyTasksRow/EditRow/EditRow.js
0 → 100644
View file @
94d3fe63
import
{
TableCell
,
TextField
,
Tooltip
}
from
"@mui/material"
;
import
moment
from
"moment"
;
import
{
memo
,
useEffect
}
from
"react"
;
import
{
accomplishStatuses
,
priorities
}
from
"../../../../../../constants"
;
import
CustomSelect
from
"../../../../../UI/СustomSelect/СustomSelect"
import
{
styled
}
from
'@mui/material/styles'
;
import
MaterialUIPickers
from
"../../../DateTimePicker/DateTimePicker"
;
const
StyledTooltip
=
styled
(({
className
,
...
props
})
=>
(
<
Tooltip
{...
props
}
classes
=
{{
popper
:
className
}}
/
>
))
`
& .MuiTooltip-tooltip {
background: white;
}
`
;
function
EditRow
({
buttons
,
dateTimeTasks
,
onChangeCurrentTaskHandler
,
currentTask
,
allUserProjectsForModalTask
,
onDateChangeEditHandler
,
user
})
{
return
(
<>
<
TableCell
sx
=
{{
width
:
'4%'
}}
>
{
user
.
id
===
currentTask
.
author
.
id
?
<
CustomSelect
defaultValue
=
{
priorities
[
0
]?.
value
}
value
=
{
currentTask
.
priority
}
name
=
{
'priority'
}
variant
=
{
'outlined'
}
onChange
=
{
onChangeCurrentTaskHandler
}
id
=
{
'priority-type'
}
items
=
{
priorities
}
sx
=
{{
width
:
'100%'
}}
/
>
:
currentTask
.
priority
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'10%'
}}
>
{
moment
(
currentTask
.
createdAt
).
format
(
'DD.MM.YYYY'
)}
<
/TableCell
>
<
Tooltip
title
=
{
currentTask
.
description
}
>
<
TableCell
sx
=
{{
width
:
'28%'
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
}}
>
{
user
.
id
===
currentTask
.
author
.
id
?
<
StyledTooltip
title
=
{
<
TextField
id
=
"task-description"
value
=
{
currentTask
.
description
}
variant
=
"outlined"
name
=
'description'
placeholder
=
'Описание'
sx
=
{{
width
:
'300px'
}}
onChange
=
{
onChangeCurrentTaskHandler
}
multiline
rows
=
{
5
}
/>}
>
<
TextField
id
=
"task-title"
value
=
{
currentTask
.
title
}
variant
=
"outlined"
name
=
'title'
onChange
=
{
onChangeCurrentTaskHandler
}
sx
=
{{
width
:
'90%'
}}
/
>
<
/StyledTooltip
>
:
currentTask
.
title
}
<
/TableCell
>
<
/Tooltip
>
<
TableCell
sx
=
{{
width
:
'12%'
}}
>
{
user
.
id
===
currentTask
.
author
.
id
?
<
CustomSelect
value
=
{
currentTask
.
project
}
name
=
{
'project'
}
variant
=
{
'outlined'
}
onChange
=
{
onChangeCurrentTaskHandler
}
id
=
{
'project'
}
renderValue
=
{(
project
)
=>
project
.
title
}
items
=
{
allUserProjectsForModalTask
}
sx
=
{{
width
:
'100%'
}}
/
>
:
currentTask
.
projectTitle
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'11%'
}}
>
{
currentTask
.
authorName
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'13%'
}}
>
{
dateTimeTasks
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'12%'
}}
>
{
user
.
id
===
currentTask
.
author
.
id
?
<
MaterialUIPickers
task
=
{
currentTask
}
name
=
"dateTimeDeadLine"
onChange
=
{
onDateChangeEditHandler
}
currentTask
=
{
true
}
/
>
:
currentTask
.
dateTimeDeadLine
?
moment
(
currentTask
.
dateTimeDeadLine
).
utc
().
format
(
'DD.MM.YYYY HH:MM'
)
:
null
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'7%'
}}
>
<
CustomSelect
value
=
{
currentTask
.
accomplish
}
name
=
{
'accomplish'
}
variant
=
{
'outlined'
}
onChange
=
{
onChangeCurrentTaskHandler
}
id
=
{
'accomplish'
}
items
=
{
accomplishStatuses
}
sx
=
{{
width
:
'100px'
}}
/
>
<
/TableCell
>
<
TableCell
size
=
'medium'
sx
=
{{
width
:
'5%'
,
position
:
'relative'
}}
>
{
buttons
}
<
/TableCell
>
<
/>
)
}
export
default
memo
(
EditRow
)
\ No newline at end of file
planner-front/src/components/MyTasksCompoments/MyTasksTableContainer/MyTasksTableBody/MyTasksRow/MyTasksRow.js
0 → 100644
View file @
94d3fe63
import
{
Divider
,
IconButton
,
TableCell
,
TableRow
,
Tooltip
}
from
"@mui/material"
;
import
moment
from
"moment"
;
import
{
memo
,
useCallback
,
useMemo
,
useState
}
from
"react"
;
import
DeleteButton
from
"../../../../UI/DeleteButton/DeleteButton"
;
import
{
Done
,
Edit
}
from
"@mui/icons-material"
;
import
{
useSelector
}
from
"react-redux"
;
import
CalendarMonthIcon
from
'@mui/icons-material/CalendarMonth'
;
import
{
Box
}
from
"@mui/system"
;
import
KeyboardArrowDownIcon
from
'@mui/icons-material/KeyboardArrowDown'
;
import
KeyboardArrowUpIcon
from
'@mui/icons-material/KeyboardArrowUp'
;
import
TableForCopiesTasks
from
"./TableForCopiesTasks/TableForCopiesTasks"
;
import
EditRow
from
"./EditRow/EditRow"
;
const
editClass
=
{
cursor
:
'pointer'
,
transition
:
'0.5s'
,
"&:hover"
:
{
transition
:
'0.5s'
,
transform
:
'scale(1.2)'
}
}
function
MyTasksRow
({
row
,
deleteTaskHandler
,
calendarOpen
,
deleteCopyTaskHandler
,
currentTask
,
isEdit
,
setIsEdit
,
setCurrentTask
,
onChangeCurrentTaskHandler
,
allUserProjectsForModalTask
,
onDateChangeEditHandler
,
editCurrentTaskHandler
})
{
const
user
=
useSelector
((
state
)
=>
state
.
users
.
user
);
const
[
openCopies
,
setOpenCopies
]
=
useState
(
false
);
const
[
editMode
,
setEditMode
]
=
useState
(
false
);
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'
)
let
end
if
(
new
Date
(
row
.
dateTimeTasks
[
0
].
dateTimeDue
).
getMinutes
()
===
59
)
{
end
=
moment
(
row
.
dateTimeTasks
[
0
].
dateTimeDue
).
utc
().
add
(
1
,
'minutes'
).
format
(
'HH:mm'
)
}
else
{
end
=
moment
(
row
.
dateTimeTasks
[
0
].
dateTimeDue
).
utc
().
format
(
'HH:mm'
)
}
const
diff
=
parseInt
(
end
.
split
(
':'
)[
0
])
-
parseInt
(
start
.
split
(
':'
)[
0
])
return
<
Box
sx
=
{{
width
:
'90%'
,
display
:
'flex'
}}
>
<
Tooltip
title
=
{
moment
(
row
.
dateTimeTasks
[
0
].
dateTimeStart
).
utc
().
format
(
'YYYY'
)}
>
<
Box
>
{
`
${
date
}
(
${
start
}
-
${
end
}
)`
}
<
Divider
sx
=
{{
opacity
:
0
}}
/
>
{
`часы:
${
diff
}
`
}
<
/Box
>
<
/Tooltip
>
{
user
.
id
===
row
?.
executor
?.
id
?
<
Tooltip
title
=
"Перейти в календарь"
>
<
IconButton
sx
=
{{
marginLeft
:
'5px'
}}
onClick
=
{()
=>
{
calendarOpen
(
row
)
}}
>
<
CalendarMonthIcon
/>
<
/IconButton
>
<
/Tooltip
>
:
null
}
<
/Box
>
}
else
if
(
row
?.
dateTimeTasks
?.
length
>
1
)
{
return
(
<>
<
IconButton
aria
-
label
=
"expand row"
size
=
"small"
onClick
=
{()
=>
setOpenCopies
(
prevState
=>
!
prevState
)}
>
{
openCopies
?
<
KeyboardArrowUpIcon
/>
:
<
KeyboardArrowDownIcon
/>
}
<
/IconButton
>
{
user
.
id
===
row
?.
executor
?.
id
?
<
Tooltip
title
=
"Перейти в календарь"
>
<
IconButton
sx
=
{{
marginLeft
:
'5px'
}}
onClick
=
{()
=>
{
calendarOpen
(
row
)
}}
>
<
CalendarMonthIcon
/>
<
/IconButton
>
<
/Tooltip
>
:
null
}
<
/>
)
}
else
if
(
row
?.
dateTimeTasks
?.
length
===
0
)
{
return
(
<>
Копий
нет
{
user
.
id
===
row
?.
executor
?.
id
?
<
Tooltip
title
=
"Перейти в календарь"
>
<
IconButton
sx
=
{{
marginLeft
:
'5px'
}}
onClick
=
{()
=>
{
calendarOpen
(
row
)
}}
>
<
CalendarMonthIcon
/>
<
/IconButton
>
<
/Tooltip
>
:
null
}
<
/>
)
}
},
[
user
.
id
,
calendarOpen
,
row
,
openCopies
])
const
onClickEditButtonHandler
=
useCallback
(()
=>
{
if
(
!
editMode
)
{
setCurrentTask
({
...
row
,
project
:
{
...
row
.
project
},
executor
:
{
...
row
.
executor
}
})
}
else
{
editCurrentTaskHandler
()
setCurrentTask
({
priority
:
''
,
title
:
''
,
project
:
''
,
description
:
''
,
executor
:
''
,
})
}
setEditMode
((
prevState
)
=>
!
prevState
)
setIsEdit
((
prevState
)
=>
!
prevState
)
},
[
setIsEdit
,
editMode
,
row
,
setCurrentTask
,
editCurrentTaskHandler
])
const
buttons
=
useMemo
(()
=>
{
if
(
!
editMode
&&
isEdit
)
return
null
if
(
editMode
)
{
return
<
Done
sx
=
{
editClass
}
onClick
=
{()
=>
{
onClickEditButtonHandler
()
}}
/
>
}
else
{
if
(
user
.
id
===
row
?.
author
?.
id
)
{
return
(
<>
<
Edit
sx
=
{{
...
editClass
,
position
:
'absolute'
,
left
:
-
10
}}
onClick
=
{()
=>
{
onClickEditButtonHandler
()
}}
/
>
<
DeleteButton
onClick
=
{()
=>
{
deleteTaskHandler
(
row
.
id
)
}}
/
>
<
/>
)
}
else
if
(
user
.
id
===
row
?.
executor
?.
id
)
{
return
(
<
Edit
sx
=
{
editClass
}
onClick
=
{()
=>
{
onClickEditButtonHandler
()
}}
/>
)
}
else
{
return
null
}
}
},
[
deleteTaskHandler
,
row
,
user
.
id
,
editMode
,
isEdit
,
onClickEditButtonHandler
])
return
(
<>
<
TableRow
hover
key
=
{
row
.
id
}
>
{
editMode
?
<>
<
EditRow
buttons
=
{
buttons
}
dateTimeTasks
=
{
dateTimeTasks
}
onChangeCurrentTaskHandler
=
{(
e
)
=>
{
onChangeCurrentTaskHandler
(
e
)
}}
currentTask
=
{
currentTask
}
allUserProjectsForModalTask
=
{
allUserProjectsForModalTask
}
onDateChangeEditHandler
=
{
onDateChangeEditHandler
}
user
=
{
user
}
/
>
<
/
>
:
<>
<
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
:
'28%'
}}
>
{
row
.
title
}
<
/TableCell
>
<
/Tooltip
>
<
TableCell
sx
=
{{
width
:
'12%'
}}
>
{
row
.
projectTitle
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'11%'
}}
>
{
row
.
authorName
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'13%'
}}
>
{
dateTimeTasks
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'12%'
}}
>
{
row
.
dateTimeDeadLine
?
moment
(
row
.
dateTimeDeadLine
).
utc
().
format
(
'DD.MM.YYYY HH:mm'
)
:
null
}
<
/TableCell
>
<
TableCell
sx
=
{{
width
:
'7%'
}}
>
{
row
.
accomplishTranslate
}
<
/TableCell
>
<
TableCell
size
=
'medium'
sx
=
{{
width
:
'5%'
,
position
:
'relative'
}}
>
{
buttons
}
<
/TableCell
>
<
/>
}
<
/TableRow
>
{
row
.
dateTimeTasks
.
length
?
<
TableForCopiesTasks
task
=
{
row
}
openCopies
=
{
openCopies
}
user
=
{
user
}
deleteCopyTaskHandler
=
{
deleteCopyTaskHandler
}
/> : null
}
<
/>
)
}
export
default
memo
(
MyTasksRow
)
\ No newline at end of file
planner-front/src/components/MyTasksCompoments/MyTasksTableContainer/MyTasksTableBody/MyTasksRow/TableForCopiesTasks/TableForCopiesTasks.js
0 → 100644
View file @
94d3fe63
import
{
Collapse
,
IconButton
,
Table
,
TableBody
,
TableCell
,
TableHead
,
TableRow
,
Tooltip
,
Typography
}
from
"@mui/material"
;
import
RemoveIcon
from
'@mui/icons-material/Remove'
;
import
moment
from
"moment"
;
import
{
memo
}
from
"react"
;
import
{
Box
}
from
"@mui/system"
;
const
weekDays
=
[
"Вс"
,
"Пн"
,
"Вт"
,
"Ср"
,
"Чт"
,
"Пт"
,
"Сб"
];
function
TableForCopiesTasks
({
task
,
openCopies
,
user
,
deleteCopyTaskHandler
})
{
const
roudHourUp
=
(
dateIso
)
=>
{
let
m
=
moment
(
dateIso
);
let
roundUp
=
m
.
minute
()
||
m
.
second
()
||
m
.
millisecond
()
?
m
.
add
(
1
,
'hour'
).
startOf
(
'hour'
)
:
m
.
startOf
(
'hour'
);
return
roundUp
}
const
timeTransform
=
(
dateIso
)
=>
{
const
exp
=
roudHourUp
(
moment
.
utc
(
dateIso
)).
format
(
"HH:00"
)
return
exp
;
}
const
getDayOfWeek
=
(
dateIso
)
=>
{
const
date
=
moment
.
utc
(
dateIso
);
return
weekDays
[
date
.
day
()];
}
return
(
<
TableRow
>
<
TableCell
style
=
{{
paddingBottom
:
0
,
paddingTop
:
0
}}
colSpan
=
{
11
}
>
<
Collapse
in
=
{
openCopies
}
timeout
=
"auto"
unmountOnExit
>
<
Box
sx
=
{{
margin
:
1
}}
>
<
Typography
variant
=
"h6"
gutterBottom
component
=
"div"
>
Расписание
<
/Typography
>
<
Table
size
=
"small"
aria
-
label
=
"purchases"
sx
=
{{
backgroundColor
:
"#ebebeb"
}}
>
<
TableHead
>
<
TableRow
>
<
TableCell
colSpan
=
{
10
}
>
Дата
создания
<
/TableCell
>
<
TableCell
align
=
"right"
>
День
недели
<
/TableCell
>
<
TableCell
align
=
"right"
>
Начало
<
/TableCell
>
<
TableCell
align
=
"center"
colSpan
=
{
1
}
>
Окончание
<
/TableCell
>
<
TableCell
align
=
"center"
><
/TableCell
>
<
TableCell
align
=
"center"
><
/TableCell
>
<
/TableRow
>
<
/TableHead
>
<
TableBody
>
{
task
.
dateTimeTasks
.
map
((
dateTimeTask
,
index
)
=>
(
<
TableRow
key
=
{
index
}
>
<
TableCell
component
=
"th"
scope
=
"row"
colSpan
=
{
10
}
>
{
moment
(
task
.
createdAt
)
.
utc
()
.
format
(
"DD/MM"
)}
<
/TableCell
>
<
TableCell
align
=
"right"
>
{
getDayOfWeek
(
dateTimeTask
.
dateTimeStart
)},
{
moment
(
dateTimeTask
.
dateTimeStart
)
.
utc
()
.
format
(
"DD/MM"
)}
<
/TableCell
>
<
TableCell
align
=
"right"
>
{
timeTransform
(
dateTimeTask
.
dateTimeStart
)}
<
/TableCell
>
<
TableCell
align
=
"center"
colSpan
=
{
1
}
>
{
timeTransform
(
dateTimeTask
.
dateTimeDue
)}
<
/TableCell
>
{
task
.
author
.
id
===
user
.
id
?
(
<
TableCell
style
=
{{
width
:
'0%'
}}
>
<
Tooltip
title
=
"Удалить Копию"
>
<
IconButton
onClick
=
{()
=>
{
deleteCopyTaskHandler
(
dateTimeTask
.
id
);
}}
>
<
RemoveIcon
/>
<
/IconButton
>
<
/Tooltip
>
<
/TableCell>
)
: null
}
<
/TableRow
>
))}
<
/TableBody
>
<
/Table
>
<
/Box
>
<
/Collapse
>
<
/TableCell
>
<
/TableRow>
)
;
}
export
default
memo
(
TableForCopiesTasks
)
\ No newline at end of file
planner-front/src/components/MyTasksCompoments/MyTasksTableContainer/MyTasksTableBody/MyTasksTableBody.js
0 → 100644
View file @
94d3fe63
import
{
TableBody
}
from
"@mui/material"
;
import
{
memo
,
useState
}
from
"react"
;
import
{
getComparator
,
stableSort
}
from
"./helpers"
;
import
MyTasksRow
from
"./MyTasksRow/MyTasksRow"
;
function
MyTasksTableBody
({
rows
,
page
,
rowsPerPage
,
order
,
orderBy
,
deleteTaskHandler
,
calendarOpen
,
deleteCopyTaskHandler
,
currentTask
,
setCurrentTask
,
onChangeCurrentTaskHandler
,
allUserProjectsForModalTask
,
onDateChangeEditHandler
,
editCurrentTaskHandler
})
{
const
[
isEdit
,
setIsEdit
]
=
useState
(
false
)
return
(
<>
<
TableBody
>
{
stableSort
(
rows
,
getComparator
(
order
,
orderBy
))
.
slice
(
page
*
rowsPerPage
,
page
*
rowsPerPage
+
rowsPerPage
)
.
map
((
row
,
index
)
=>
{
return
(
<
MyTasksRow
key
=
{
row
.
id
}
deleteTaskHandler
=
{
deleteTaskHandler
}
row
=
{
row
}
deleteCopyTaskHandler
=
{
deleteCopyTaskHandler
}
calendarOpen
=
{
calendarOpen
}
isEdit
=
{
isEdit
}
setIsEdit
=
{
setIsEdit
}
currentTask
=
{
currentTask
}
setCurrentTask
=
{
setCurrentTask
}
onChangeCurrentTaskHandler
=
{
onChangeCurrentTaskHandler
}
allUserProjectsForModalTask
=
{
allUserProjectsForModalTask
}
onDateChangeEditHandler
=
{
onDateChangeEditHandler
}
editCurrentTaskHandler
=
{
editCurrentTaskHandler
}
/>
)
})}
<
/TableBody
>
<
/>
)
;
}
export
default
memo
(
MyTasksTableBody
)
\ No newline at end of file
planner-front/src/components/MyTasksCompoments/MyTasksTableContainer/MyTasksTableBody/helpers.js
0 → 100644
View file @
94d3fe63
function
descendingComparator
(
a
,
b
,
orderBy
,
order
)
{
if
(
!
b
[
orderBy
])
{
if
(
order
===
'asc'
)
{
return
1
}
return
-
1
}
if
(
b
[
orderBy
]
<
a
[
orderBy
])
{
return
-
1
;
}
if
(
b
[
orderBy
]
>
a
[
orderBy
])
{
return
1
;
}
return
0
;
}
export
function
getComparator
(
order
,
orderBy
)
{
return
order
===
'desc'
?
(
a
,
b
)
=>
descendingComparator
(
a
,
b
,
orderBy
)
:
(
a
,
b
)
=>
-
descendingComparator
(
a
,
b
,
orderBy
,
order
);
}
export
function
stableSort
(
array
,
comparator
)
{
const
stabilizedThis
=
array
.
map
((
el
,
index
)
=>
[
el
,
index
]);
stabilizedThis
.
sort
((
a
,
b
)
=>
{
const
order
=
comparator
(
a
[
0
],
b
[
0
]);
if
(
order
!==
0
)
{
return
order
;
}
return
a
[
1
]
-
b
[
1
];
});
return
stabilizedThis
.
map
((
el
)
=>
el
[
0
]);
}
planner-front/src/components/MyTasksCompoments/MyTasksTableContainer/MyTasksTableContainer.js
0 → 100644
View file @
94d3fe63
import
{
Table
,
TableContainer
,
}
from
"@mui/material"
;
import
{
memo
}
from
"react"
;
import
MyTaskNewTaskForm
from
"./MyTaskNewTaskForm/MyTaskNewTaskForm"
;
import
MyTasksTableBody
from
"./MyTasksTableBody/MyTasksTableBody"
;
import
MyTasksTableHead
from
"./MyTasksTableHead/MyTasksTableHead"
;
function
MyTasksTableContainer
({
order
,
orderBy
,
handleRequestSort
,
rows
,
page
,
rowsPerPage
,
addFormStatus
,
onChangeNewTaskHandler
,
newTask
,
allUserProjectsForModalTask
,
onDateChangeHandler
,
createNewTaskHandler
,
deleteTaskHandler
,
calendarOpen
,
deleteCopyTaskHandler
,
currentTask
,
setCurrentTask
,
onChangeCurrentTaskHandler
,
onDateChangeEditHandler
,
editCurrentTaskHandler
})
{
return
(
<
TableContainer
>
<
MyTaskNewTaskForm
addFormStatus
=
{
addFormStatus
}
onChangeNewTaskHandler
=
{(
e
)
=>
{
onChangeNewTaskHandler
(
e
)}}
newTask
=
{
newTask
}
allUserProjectsForModalTask
=
{
allUserProjectsForModalTask
}
onDateChangeHandler
=
{
onDateChangeHandler
}
createNewTaskHandler
=
{()
=>
{
createNewTaskHandler
()}}
/
>
<
Table
sx
=
{{
minWidth
:
750
}}
aria
-
labelledby
=
"tableTitle"
>
<
MyTasksTableHead
order
=
{
order
}
orderBy
=
{
orderBy
}
handleRequestSort
=
{
handleRequestSort
}
deleteTaskHandler
=
{
deleteTaskHandler
}
/
>
<
MyTasksTableBody
order
=
{
order
}
orderBy
=
{
orderBy
}
rows
=
{
rows
}
page
=
{
page
}
rowsPerPage
=
{
rowsPerPage
}
deleteTaskHandler
=
{
deleteTaskHandler
}
calendarOpen
=
{
calendarOpen
}
deleteCopyTaskHandler
=
{
deleteCopyTaskHandler
}
currentTask
=
{
currentTask
}
setCurrentTask
=
{
setCurrentTask
}
onChangeCurrentTaskHandler
=
{
onChangeCurrentTaskHandler
}
allUserProjectsForModalTask
=
{
allUserProjectsForModalTask
}
onDateChangeEditHandler
=
{
onDateChangeEditHandler
}
editCurrentTaskHandler
=
{
editCurrentTaskHandler
}
/
>
<
/Table
>
<
/TableContainer
>
);
}
export
default
memo
(
MyTasksTableContainer
)
\ No newline at end of file
planner-front/src/components/MyTasksCompoments/MyTasksTableContainer/MyTasksTableHead/MyTasksTableHead.js
0 → 100644
View file @
94d3fe63
import
{
Box
,
TableCell
,
TableHead
,
TableRow
,
TableSortLabel
}
from
"@mui/material"
;
import
{
visuallyHidden
}
from
'@mui/utils'
;
import
{
memo
}
from
"react"
;
const
headCells
=
[
{
id
:
"priority"
,
label
:
"Приоритет"
,
canSort
:
true
,
style
:
{
width
:
'4%'
}
},
{
id
:
"createdAt"
,
label
:
"Дата создания"
,
canSort
:
true
,
style
:
{
width
:
'10%'
}
},
{
id
:
"title"
,
label
:
"Заголовок"
,
canSort
:
true
,
style
:
{
width
:
'28%'
}
},
{
id
:
"projectTitle"
,
label
:
"Проект"
,
canSort
:
true
,
style
:
{
width
:
'12%'
}
},
{
id
:
"authorName"
,
label
:
"Автор"
,
canSort
:
true
,
style
:
{
width
:
'11%'
}
},
{
id
:
"dateTimeStart"
,
label
:
"Дата и время выполнения"
,
canSort
:
false
,
style
:
{
width
:
'15%'
}
},
{
id
:
"dateTimeDeadLine"
,
label
:
"Дедлайн"
,
canSort
:
true
,
style
:
{
width
:
'10%'
}
},
{
id
:
"accomplishTranslate"
,
label
:
"Статус"
,
canSort
:
true
,
style
:
{
width
:
'7%'
}
},
{
id
:
"buttons"
,
label
:
""
,
canSort
:
false
,
style
:
{
width
:
'5%'
}
},
];
function
MyTasksTableHead
({
order
,
orderBy
,
handleRequestSort
})
{
const
createSortHandler
=
(
property
)
=>
(
event
)
=>
{
handleRequestSort
(
event
,
property
);
};
return
(
<
TableHead
>
<
TableRow
>
{
headCells
.
map
((
headCell
)
=>
(
<
TableCell
key
=
{
headCell
.
id
}
sortDirection
=
{
orderBy
===
headCell
.
id
?
order
:
false
}
sx
=
{
headCell
.
style
}
>
{
headCell
.
canSort
?
<
TableSortLabel
active
=
{
orderBy
===
headCell
.
id
}
direction
=
{
orderBy
===
headCell
.
id
?
order
:
'asc'
}
onClick
=
{
createSortHandler
(
headCell
.
id
)}
>
{
headCell
.
label
}
{
orderBy
===
headCell
.
id
?
(
<
Box
component
=
"span"
sx
=
{
visuallyHidden
}
>
{
order
===
'desc'
?
'sorted descending'
:
'sorted ascending'
}
<
/Box
>
)
:
null
}
<
/TableSortLabel> : headCell.label
}
<
/TableCell
>
))}
<
/TableRow
>
<
/TableHead
>
);
}
export
default
memo
(
MyTasksTableHead
)
\ No newline at end of file
planner-front/src/components/MyTasksCompoments/MyTasksTablePagination/MyTasksTablePagination.js
0 → 100644
View file @
94d3fe63
import
{
TablePagination
}
from
"@mui/material"
;
import
{
memo
}
from
"react"
;
function
MyTasksTablePagination
({
count
,
rowsPerPage
,
page
,
handleChangePage
,
handleChangeRowsPerPage
})
{
return
(
<
TablePagination
rowsPerPageOptions
=
{[
5
,
10
,
25
]}
component
=
"div"
count
=
{
count
}
rowsPerPage
=
{
rowsPerPage
}
page
=
{
page
}
onPageChange
=
{
handleChangePage
}
onRowsPerPageChange
=
{
handleChangeRowsPerPage
}
/
>
);
}
export
default
memo
(
MyTasksTablePagination
)
\ No newline at end of file
planner-front/src/components/MyTasksCompoments/MyTasksTableToolbar/CreateTaskFromButton/CreateTaskFromButton.js
0 → 100644
View file @
94d3fe63
import
{
Button
}
from
'@mui/material'
;
import
{
Add
,
Close
}
from
"@mui/icons-material"
;
import
{
memo
}
from
'react'
;
function
CreateTaskFromButton
({
addFormStatus
,
onClick
})
{
return
(
<
Button
color
=
{
addFormStatus
===
true
?
"info"
:
"inherit"
}
style
=
{{
backgroundColor
:
addFormStatus
===
true
?
"white"
:
"inherit"
,
width
:
'250px'
}}
onClick
=
{
onClick
}
>
{
addFormStatus
===
true
?
(
<>
<
Close
/>
<
span
style
=
{{
lineHeight
:
"16px"
}}
>
Скрыть
задачу
<
/span
>
<
/
>
)
:
(
<>
<
Add
/>
<
span
style
=
{{
lineHeight
:
"16px"
}}
>
Добавить
задачу
<
/span
>
<
/
>
)}
<
/Button
>
);
}
export
default
memo
(
CreateTaskFromButton
)
\ No newline at end of file
planner-front/src/components/MyTasksCompoments/MyTasksTableToolbar/MyTasksTableToolbar.js
0 → 100644
View file @
94d3fe63
import
{
AppBar
,
Box
,
Typography
}
from
"@mui/material"
;
import
{
memo
,
useMemo
}
from
"react"
;
import
MultipleSelect
from
"../../UI/MultipleSelect/MultipleSelect"
;
import
CreateTaskFromButton
from
"./CreateTaskFromButton/CreateTaskFromButton"
;
function
MyTasksTableToolbar
({
addFormStatus
,
createTaskFromButtonHandler
,
projects
,
onCloseFilterByProjects
,
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
})
{
const
projectsFilter
=
useMemo
(()
=>
{
if
(
Array
.
isArray
(
projects
))
{
return
<
MultipleSelect
projects
=
{
projects
}
onCloseFilterByProjects
=
{
onCloseFilterByProjects
}
projectIdListForTaskSelect
=
{
projectIdListForTaskSelect
}
setProjectIdListForTaskSelect
=
{
setProjectIdListForTaskSelect
}
/
>
}
else
{
return
null
}
},
[
projects
,
onCloseFilterByProjects
,
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
])
return
(
<
AppBar
position
=
"static"
sx
=
{{
padding
:
3
}}
>
<
Box
sx
=
{{
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
sx
=
{{
flex
:
'1 1 100%'
}}
variant
=
"h6"
id
=
"tableTitle"
component
=
"div"
>
Мои
задачи
<
/Typography
>
{
projectsFilter
}
<
CreateTaskFromButton
addFormStatus
=
{
addFormStatus
}
onClick
=
{()
=>
{
createTaskFromButtonHandler
()
}}
/
>
<
/Box
>
<
/AppBar
>
);
}
export
default
memo
(
MyTasksTableToolbar
)
\ No newline at end of file
planner-front/src/components/MyTasksCompoments/NewTaskForm.js
deleted
100644 → 0
View file @
44db3680
import
*
as
React
from
"react"
;
import
{
Table
,
TableBody
,
TableCell
,
TableContainer
,
TableRow
,
TableHead
,
IconButton
,
Tooltip
,
Typography
,
Divider
,
}
from
"@mui/material"
;
import
{
useState
}
from
"react"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
AddBox
// , Luggage
}
from
"@mui/icons-material"
;
import
moment
from
"moment"
;
import
CustomTableCell
from
"./CustomTableCell"
;
import
MaterialUIPickers
from
"./DateTimePicker/DateTimePicker"
;
import
BasicSelect
from
"../UI/Select/Select"
;
import
{
addTask
}
from
"../../store/actions/tasksActions"
;
import
TaskModal
from
"./TaskModal/TaskModal"
;
// import {dateToISOLikeButLocal} from '../../helpers/CalendarHelpers';
// import DateTimePicker from "../Calendars/UI/DateTimePicker/DateTimePicker";
export
default
function
NewTaskForm
({
projects
,
setAddTaskForm
})
{
console
.
log
(
'new task form'
)
const
dispatch
=
useDispatch
();
const
user
=
useSelector
((
state
)
=>
state
.
users
.
user
);
const
currentDateTime
=
new
Date
();
const
dateTime
=
moment
(
currentDateTime
).
utc
().
format
();
const
[
task
,
setTask
]
=
useState
({
id
:
0
,
title
:
""
,
description
:
""
,
createdAt
:
dateTime
,
dateTimeStart
:
null
,
dateTimeDeadLine
:
null
,
dateTimeTasks
:
[],
dateTimeDue
:
null
,
project
:
projects
?
projects
.
find
(
project
=>
project
.
title
===
"Личные дела"
):
null
,
accomplish
:
"opened"
,
priority
:
"B"
,
author
:
{
id
:
user
.
id
},
// authorDisplayName: user.displayName,
executor
:
null
,
isEditMode
:
true
,
});
const
[
modal
,
setModal
]
=
useState
(
false
);
const
onModalOpen
=
(
event
,
task
)
=>
{
event
.
stopPropagation
();
setModal
(
true
);
};
console
.
log
(
'task '
,
task
)
const
handleClose
=
()
=>
{
setModal
(
false
);
};
const
onChange
=
(
e
,
task
)
=>
{
const
value
=
e
.
target
.
value
;
const
name
=
e
.
target
.
name
;
const
newTask
=
{
...
task
,
[
name
]:
value
};
setTask
(
newTask
);
};
const
onProjectChange
=
(
e
,
task
)
=>
{
const
value
=
e
.
target
.
value
;
const
project
=
projects
.
find
((
e
)
=>
e
.
id
===
value
);
const
newTask
=
{
...
task
};
newTask
.
project
=
project
;
setTask
(
newTask
);
};
const
onDateChange
=
(
id
,
value
,
property
)
=>
{
const
utcAvoidoffset
=
moment
(
value
).
utcOffset
(
0
,
true
).
format
()
const
newTask
=
{
...
task
,
[
property
]:
utcAvoidoffset
,
// [property]: moment.parseZone(value, "DD/MM/YYYY", true).format(),
};
setTask
(
newTask
);
};
const
handleAddTask
=
()
=>
{
console
.
log
(
'handle task new form '
,
task
)
dispatch
(
addTask
(
task
));
setAddTaskForm
();
};
return
(
<>
<
Divider
>
<
Typography
variant
=
"overline"
>
Добавить
новую
задачу
<
/Typography
>
<
/Divider
>
<
TableContainer
style
=
{{
backgroundColor
:
"#E8E8E8"
,
marginBottom
:
"2em"
,
}}
>
<
Table
sx
=
{{
minWidth
:
600
}}
aria
-
labelledby
=
"tableTitle"
>
<
TableHead
>
<
TableRow
>
{
header
.
map
((
headCell
)
=>
(
<
TableCell
key
=
{
headCell
.
id
}
align
=
"left"
padding
=
{
headCell
.
disablePadding
?
"none"
:
"normal"
}
style
=
{{
paddingLeft
:
"0"
}}
>
{
headCell
.
label
}
<
/TableCell
>
))}
<
/TableRow
>
<
/TableHead
>
<
TableBody
>
<
TableRow
hover
key
=
{
task
.
id
}
style
=
{{
paddingLeft
:
"40px"
}}
>
<
TableCell
style
=
{{
width
:
"40px"
,
padding
:
"0"
}}
><
/TableCell
>
<
TableCell
style
=
{{
width
:
"8%"
,
paddingLeft
:
"0"
}}
>
<
BasicSelect
items
=
{[
{
value
:
"A"
,
title
:
"A"
},
{
value
:
"B"
,
title
:
"B"
},
{
value
:
"C"
,
title
:
"C"
},
]}
task
=
{
task
}
value
=
{
task
.
priority
}
onChange
=
{
onChange
}
name
=
"priority"
/>
<
/TableCell
>
<
CustomTableCell
{...{
task
,
name
:
"title"
,
value
:
task
.
title
,
onModalOpen
,
user
:
user
,
placeholder
:
"Кликните для ввода информации по задаче"
,
width
:
"auto"
,
}}
/
>
<
TableCell
style
=
{{
width
:
"15%"
,
paddingLeft
:
"0"
}}
>
<
BasicSelect
items
=
{
projects
.
map
((
e
)
=>
({
value
:
e
?.
id
,
title
:
e
?.
title
,
}))}
task
=
{
task
}
onChange
=
{
onProjectChange
}
name
=
"project"
value
=
{
task
.
project
?.
id
}
/
>
<
/TableCell
>
<
TableCell
style
=
{{
width
:
"20%"
,
paddingLeft
:
"0"
}}
>
<
MaterialUIPickers
task
=
{
task
}
name
=
"dateTimeDeadLine"
onChange
=
{
onDateChange
}
/
>
{
/* <DateTimePicker/> */
}
<
/TableCell
>
<
TableCell
style
=
{{
width
:
"5%"
}}
>
<
Tooltip
title
=
"Добавить"
>
<
IconButton
size
=
"large"
onClick
=
{
handleAddTask
}
>
<
AddBox
fontSize
=
"large"
/>
<
/IconButton
>
<
/Tooltip
>
<
/TableCell
>
<
/TableRow
>
<
/TableBody
>
<
/Table
>
<
TaskModal
task
=
{
task
}
open
=
{
modal
}
handleClose
=
{
handleClose
}
onChange
=
{
onChange
}
user
=
{
user
}
/
>
<
/TableContainer
>
<
Divider
/>
<
/
>
);
}
export
const
header
=
[
{
id
:
"id"
,
numeric
:
true
,
disablePadding
:
true
,
label
:
""
,
},
{
id
:
"priority"
,
numeric
:
false
,
disablePadding
:
true
,
label
:
"Приоритет"
,
},
{
id
:
"title"
,
numeric
:
false
,
disablePadding
:
false
,
label
:
"Заголовок"
,
},
{
id
:
"projectName"
,
numeric
:
true
,
disablePadding
:
false
,
label
:
"Проект"
,
},
{
id
:
"dateTimeDeadLine"
,
numeric
:
true
,
disablePadding
:
false
,
label
:
"Дедлайн"
,
},
{
id
:
"add"
,
numeric
:
false
,
disablePadding
:
false
,
label
:
""
,
},
];
planner-front/src/components/MyTasksCompoments/TableRowTask/TableRowTask.js
deleted
100644 → 0
View file @
44db3680
import
*
as
React
from
"react"
;
import
{
TableCell
,
TableRow
,
IconButton
,
Tooltip
,
Collapse
,
Box
,
Table
,
TableBody
,
TableHead
,
Typography
}
from
"@mui/material"
;
import
{
Done
,
Edit
}
from
"@mui/icons-material"
;
import
RemoveIcon
from
'@mui/icons-material/Remove'
;
import
DeleteIcon
from
"@mui/icons-material/Delete"
;
import
moment
from
"moment"
;
import
CustomTableCell
from
"../CustomTableCell"
;
import
MaterialUIPickers
from
"../DateTimePicker/DateTimePicker"
;
import
BasicSelect
from
"../../UI/Select/Select"
;
import
CalendarMonthIcon
from
'@mui/icons-material/CalendarMonth'
;
import
KeyboardArrowDownIcon
from
'@mui/icons-material/KeyboardArrowDown'
;
import
KeyboardArrowUpIcon
from
'@mui/icons-material/KeyboardArrowUp'
;
import
{
useNavigate
}
from
"react-router-dom"
;
import
{
useDispatch
}
from
"react-redux"
;
import
{
activateCreateCopyTasksMode
}
from
"../../../store/actions/tasksActions"
;
import
{
TaskStatuses
}
from
"../../../helpers/TableTasksHelpers"
;
const
weekDays
=
[
"Вс"
,
"Пн"
,
"Вт"
,
"Ср"
,
"Чт"
,
"Пт"
,
"Сб"
];
const
TableRowTask
=
({
user
,
task
,
deleteHandle
,
handleEditTask
,
deleteDateTimeTask
,
onChange
,
onModalOpen
,
onProjectChange
,
uniqueProjects
,
onAuthorChange
,
onDateChange
,
onToggleEditMode
,
onToggleEditModeDone
,
})
=>
{
const
[
open
,
setOpen
]
=
React
.
useState
(
false
);
const
navigate
=
useNavigate
()
const
dispatch
=
useDispatch
()
const
roudHourUp
=
(
dateIso
)
=>
{
let
m
=
moment
(
dateIso
);
let
roundUp
=
m
.
minute
()
||
m
.
second
()
||
m
.
millisecond
()
?
m
.
add
(
1
,
'hour'
).
startOf
(
'hour'
)
:
m
.
startOf
(
'hour'
);
return
roundUp
}
const
timeTransform
=
(
dateIso
)
=>
{
const
exp
=
roudHourUp
(
moment
.
utc
(
dateIso
)).
format
(
"HH:"
+
"00"
)
return
exp
;
}
const
getDayOfWeek
=
(
dateIso
)
=>
{
const
date
=
moment
.
utc
(
dateIso
);
return
weekDays
[
date
.
day
()];
}
const
calendarOpen
=
(
taskId
)
=>
{
dispatch
(
activateCreateCopyTasksMode
(
task
,
navigate
))
}
return
(
<>
<
TableRow
hover
key
=
{
task
.
id
}
>
<
TableCell
component
=
"th"
scope
=
"row"
padding
=
"none"
><
/TableCell>
{
task
.
isEditMode
&&
task
.
author
.
id
===
user
.
id
?
(
<
TableCell
>
<
BasicSelect
items
=
{[
{
value
:
"A"
,
title
:
"A"
},
{
value
:
"B"
,
title
:
"B"
},
{
value
:
"C"
,
title
:
"C"
},
]}
task
=
{
task
}
value
=
{
task
.
priority
}
onChange
=
{
onChange
}
name
=
"priority"
user
=
{
user
}
/
>
<
/TableCell
>
)
:
(
<
CustomTableCell
{...{
task
,
name
:
"priority"
,
value
:
task
.
priority
,
user
:
user
}}
/
>
)}
<
CustomTableCell
{...{
task
,
name
:
"createdAt"
,
value
:
moment
(
task
.
createdAt
)
.
utc
()
.
format
(
"DD-MM-YY"
),
user
:
user
}}
/
>
<
CustomTableCell
{...{
task
,
name
:
"title"
,
value
:
task
.
title
,
onChange
,
onModalOpen
,
user
:
user
}}
/
>
{
task
.
isEditMode
&&
task
.
author
.
id
===
user
.
id
?
(
<
TableCell
>
<
BasicSelect
items
=
{
uniqueProjects
.
map
((
e
)
=>
({
value
:
e
?.
id
,
title
:
e
?.
title
,
}))}
task
=
{
task
}
onChange
=
{
onProjectChange
}
name
=
"project"
value
=
{
task
.
project
?.
id
}
user
=
{
user
}
/
>
<
/TableCell
>
)
:
(
<
CustomTableCell
{...{
task
,
name
:
"projectId"
,
value
:
task
.
project
?.
title
,
user
:
user
}}
/
>
)}
<
CustomTableCell
{...{
task
,
name
:
"author"
,
value
:
task
.
author
.
displayName
,
onChange
:
onAuthorChange
,
user
:
user
}}
/
>
{
task
.
dateTimeTasks
.
length
===
0
&&
task
.
author
.
id
===
user
.
id
?
(
<
TableCell
>
<
Tooltip
title
=
"Перейти в календарь"
>
<
IconButton
onClick
=
{()
=>
{
calendarOpen
(
task
)}}
>
<
CalendarMonthIcon
/>
<
/IconButton
>
<
/Tooltip
>
{
/* </TableCell> */
}
<
/TableCell
>
)
:
(
task
.
dateTimeTasks
.
length
>=
1
?
<
TableCell
>
<
IconButton
aria
-
label
=
"expand row"
size
=
"small"
onClick
=
{()
=>
setOpen
(
!
open
)}
>
{
open
?
<
KeyboardArrowUpIcon
/>
:
<
KeyboardArrowDownIcon
/>
}
<
/IconButton
>
<
/TableCell
>
:
<
CustomTableCell
{...{
task
,
name
:
"dateTimeStart"
,
value
:
moment
(
task
.
dateTimeTasks
[
0
]?.
dateTimeStart
)
.
utc
()
.
format
(
"DD/MM "
),
value2
:
moment
(
task
.
dateTimeTasks
[
0
]?.
dateTimeStart
)
.
utc
()
.
format
(
"kk:00"
)
+
" - "
+
moment
(
task
.
dateTimeTasks
[
0
]?.
dateTimeDue
)
.
utc
()
.
format
(
"kk:00"
),
user
:
user
}}
>
<
/CustomTableCell
>
)}
{
task
.
isEditMode
&&
task
.
author
.
id
===
user
.
id
?
(
<
TableCell
>
<
MaterialUIPickers
task
=
{
task
}
name
=
"dateTimeDeadLine"
onChange
=
{
onDateChange
}
user
=
{
user
}
/
>
<
/TableCell
>
)
:
(
<
CustomTableCell
{...{
task
,
name
:
"dateTimeDeadLine"
,
value
:
moment
(
task
.
dateTimeDeadLine
)
.
utc
()
.
format
(
"DD/MM kk:mm"
),
user
:
user
}}
/
>
)}
{
task
.
isEditMode
?
(
<
TableCell
>
<
BasicSelect
items
=
{[
{
value
:
"opened"
,
title
:
"создано"
},
{
value
:
"done"
,
title
:
"выполнено"
},
{
value
:
"failed"
,
title
:
"просрочено"
},
{
value
:
"progress"
,
title
:
"в работе"
},
{
value
:
"cancelled"
,
title
:
"отменено"
},
]}
task
=
{
task
}
onChange
=
{
onChange
}
name
=
"accomplish"
value
=
{
task
.
accomplish
}
user
=
{
user
}
/
>
<
/TableCell
>
)
:
(
<
CustomTableCell
{...{
task
,
name
:
"accomplish"
,
value
:
TaskStatuses
[
task
.
accomplish
],
user
:
user
}}
/
>
)}
<
TableCell
>
<
Tooltip
title
=
"Редактировать"
>
{
task
.
isEditMode
?
(
<
IconButton
aria
-
label
=
"done"
onClick
=
{()
=>
{
onToggleEditModeDone
(
task
.
id
);
handleEditTask
(
task
);
}}
>
<
Done
/>
<
/IconButton
>
)
:
(
<
IconButton
aria
-
label
=
"edit"
onClick
=
{()
=>
onToggleEditMode
(
task
.
id
)}
>
<
Edit
/>
<
/IconButton
>
)}
<
/Tooltip
>
<
/TableCell
>
{
task
.
author
.
id
===
user
.
id
?
(
<
TableCell
>
<
Tooltip
title
=
"Удалить"
>
<
IconButton
onClick
=
{(
id
)
=>
{
deleteHandle
(
task
.
id
);
}}
>
<
DeleteIcon
/>
<
/IconButton
>
<
/Tooltip
>
<
/TableCell>
)
:null
}
<
/TableRow
>
{
task
.
dateTimeTasks
.
length
>=
1
?
<
TableRow
>
<
TableCell
style
=
{{
paddingBottom
:
0
,
paddingTop
:
0
}}
colSpan
=
{
11
}
>
<
Collapse
in
=
{
open
}
timeout
=
"auto"
unmountOnExit
>
<
Box
sx
=
{{
margin
:
1
}}
>
<
Typography
variant
=
"h6"
gutterBottom
component
=
"div"
>
Расписание
<
/Typography
>
<
Table
size
=
"small"
aria
-
label
=
"purchases"
sx
=
{{
backgroundColor
:
"#ebebeb"
}}
>
<
TableHead
>
<
TableRow
>
<
TableCell
colSpan
=
{
10
}
>
Дата
создания
<
/TableCell
>
<
TableCell
align
=
"right"
>
День
недели
<
/TableCell
>
<
TableCell
align
=
"right"
>
Начало
<
/TableCell
>
<
TableCell
align
=
"center"
colSpan
=
{
1
}
>
Окончание
<
/TableCell
>
<
TableCell
align
=
"center"
><
/TableCell
>
<
TableCell
align
=
"center"
><
/TableCell
>
<
/TableRow
>
<
/TableHead
>
<
TableBody
>
{
task
.
dateTimeTasks
.
map
((
dateTimeTask
,
index
)
=>
(
<
TableRow
key
=
{
index
}
>
<
TableCell
component
=
"th"
scope
=
"row"
colSpan
=
{
10
}
>
{
moment
(
task
.
createdAt
)
.
utc
()
.
format
(
"DD/MM"
)}
<
/TableCell
>
<
TableCell
align
=
"right"
>
{
getDayOfWeek
(
dateTimeTask
.
dateTimeStart
)},
{
moment
(
dateTimeTask
.
dateTimeStart
)
.
utc
()
.
format
(
"DD/MM"
)}
<
/TableCell
>
<
TableCell
align
=
"right"
>
{
timeTransform
(
dateTimeTask
.
dateTimeStart
)}
<
/TableCell
>
<
TableCell
align
=
"center"
colSpan
=
{
1
}
>
{
timeTransform
(
dateTimeTask
.
dateTimeDue
)}
<
/TableCell
>
{
/* delete option datetimeTask */
}
{
task
.
author
.
id
===
user
.
id
?
(
<
TableCell
style
=
{{
width
:
'0%'
}}
>
<
Tooltip
title
=
"Удалить Копию"
>
<
IconButton
onClick
=
{(
id
)
=>
{
deleteDateTimeTask
(
dateTimeTask
.
id
);
}}
>
<
RemoveIcon
/>
<
/IconButton
>
<
/Tooltip
>
<
/TableCell>
)
:null
}
<
/TableRow
>
))}
<
/TableBody
>
<
/Table
>
<
/Box
>
<
/Collapse
>
<
/TableCell
>
<
/TableRow
>
:
<><
/>
}
<
/
>
)
}
export
default
TableRowTask
;
planner-front/src/components/MyTasksCompoments/TaskModal/TaskModal.css
deleted
100644 → 0
View file @
44db3680
.modal
{
display
:
flex
;
flex-direction
:
column
;
padding
:
10px
;
align-items
:
center
;
position
:
absolute
;
top
:
200px
;
left
:
200px
;
width
:
300px
;
height
:
300px
;
background-color
:
white
;
border
:
2px
solid
#000
;
box-shadow
:
24px
;
border-radius
:
5px
}
.modalBox
{
display
:
flex
;
justify-content
:
space-around
;
flex-direction
:
column
;
}
\ No newline at end of file
planner-front/src/components/MyTasksCompoments/TaskModal/TaskModal.js
deleted
100644 → 0
View file @
44db3680
import
{
Modal
,
IconButton
}
from
"@mui/material"
;
import
"./TaskModal.css"
;
import
{
Done
}
from
"@mui/icons-material"
;
import
Input
from
"@mui/material/Input"
;
import
TextField
from
"@mui/material/Input"
;
const
TaskModal
=
({
handleClose
,
open
,
task
,
onChange
,
user
})
=>
{
return
(
<
Modal
aria
-
labelledby
=
"modal-modal-title"
aria
-
describedby
=
"modal-modal-description"
BackdropProps
=
{{
style
:
{
backgroundColor
:
'rgba(255,255,255, 0)'
}
}}
closeAfterTransition
onClose
=
{
handleClose
}
open
=
{
open
}
>
{
task
?.
isEditMode
&&
task
.
author
.
id
===
user
.
id
?
(
<
div
className
=
"modal"
>
<
Input
label
=
"название"
color
=
"secondary"
value
=
{
task
.
title
}
name
=
"title"
onChange
=
{(
e
)
=>
onChange
(
e
,
task
)}
style
=
{{
width
:
"auto"
,
fontWeight
:
"600"
,
height
:
"40px"
,
fontWeight
:
"600"
,
width
:
"280px"
,
margin
:
"10px"
,
padding
:
"5px"
,
border
:
'2px solid #D3D3D3'
,
borderRadius
:
"5px"
}}
/
>
<
TextField
label
=
"описание"
value
=
{
task
.
description
}
name
=
"description"
onChange
=
{(
e
)
=>
onChange
(
e
,
task
)}
multiline
=
{
true
}
sx
=
{{
fontWeight
:
"400"
,
width
:
"280px"
,
margin
:
"10px"
,
padding
:
"5px"
,
border
:
'2px solid #D3D3D3'
,
borderRadius
:
"5px"
,
height
:
"300px"
,
whiteSpace
:
"normal"
}}
/
>
<
IconButton
aria
-
label
=
"done"
onClick
=
{
handleClose
}
sx
=
{{
margingBottom
:
"5px"
,
marginTop
:
"auto"
}}
>
<
Done
/>
<
/IconButton
>
<
/div
>
)
:
(
<
div
className
=
"modal"
>
{
task
&&
task
.
title
&&
(
<
div
style
=
{{
height
:
"40px"
,
fontWeight
:
"600"
,
width
:
"280px"
,
margin
:
"10px"
,
padding
:
"5px"
,
border
:
'2px solid #D3D3D3'
,
borderRadius
:
"5px"
}}
>
{
task
.
title
}
<
/div
>
)}
{
task
&&
task
.
description
&&
(
<
div
style
=
{{
margin
:
"10px"
,
border
:
'2px solid #D3D3D3'
,
borderRadius
:
"5px"
,
width
:
"280px"
,
height
:
"200px"
,
margin
:
"10px"
,
padding
:
"5px"
,
}}
>
{
task
.
description
}
<
/div
>
)}
<
IconButton
aria
-
label
=
"close"
onClick
=
{
handleClose
}
sx
=
{{
margingBottom
:
"5px"
,
marginTop
:
"auto"
}}
>
X
<
/IconButton
>
<
/div
>
)}
<
/Modal
>
);
};
export
default
TaskModal
;
planner-front/src/components/UI/СustomSelect/СustomSelect.js
View file @
94d3fe63
import
{
FormControl
,
InputLabel
,
MenuItem
,
Select
}
from
'@mui/material'
;
import
{
FormControl
,
InputLabel
,
MenuItem
,
Select
}
from
'@mui/material'
;
import
{
memo
}
from
'react'
;
import
{
memo
}
from
'react'
;
function
С
ustomSelect
({
value
,
onChange
,
label
,
variant
=
'standard'
,
items
,
id
,
defaultValue
,
name
,
sx
})
{
function
С
ustomSelect
({
value
,
onChange
,
label
,
variant
=
'standard'
,
items
,
id
,
defaultValue
,
name
,
sx
,
renderValue
})
{
return
(
return
(
<>
<>
<
FormControl
variant
=
{
variant
}
sx
=
{
sx
?.
width
?
sx
:
{
m
:
0
,
minWidth
:
125
}}
>
<
FormControl
variant
=
{
variant
}
sx
=
{
sx
?.
width
?
sx
:
{
m
:
0
,
minWidth
:
125
}}
>
...
@@ -10,6 +10,7 @@ function СustomSelect({ value, onChange, label, variant = 'standard', items, id
...
@@ -10,6 +10,7 @@ function СustomSelect({ value, onChange, label, variant = 'standard', items, id
labelId
=
{
`
${
id
}
-select-label`
}
labelId
=
{
`
${
id
}
-select-label`
}
id
=
{
`
${
id
}
-select`
}
id
=
{
`
${
id
}
-select`
}
value
=
{
value
}
value
=
{
value
}
renderValue
=
{
renderValue
?
renderValue
:
null
}
onChange
=
{
onChange
}
onChange
=
{
onChange
}
label
=
{
label
}
label
=
{
label
}
name
=
{
name
}
name
=
{
name
}
...
...
planner-front/src/components/UsersTasksCompoments/UsersTasksTableContainer/UsersTasksTableBody/UsersTasksRow/EditRow/EditRow.js
View file @
94d3fe63
...
@@ -92,6 +92,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa
...
@@ -92,6 +92,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa
name
=
{
'executor'
}
name
=
{
'executor'
}
variant
=
{
'outlined'
}
variant
=
{
'outlined'
}
onChange
=
{
onChangeCurrentTaskHandler
}
onChange
=
{
onChangeCurrentTaskHandler
}
renderValue
=
{(
executor
)
=>
executor
?.
displayName
}
id
=
{
'executor'
}
id
=
{
'executor'
}
items
=
{
workers
}
items
=
{
workers
}
sx
=
{{
width
:
'100%'
}}
sx
=
{{
width
:
'100%'
}}
...
...
planner-front/src/containers/MyTasks/MyTasks.js
View file @
94d3fe63
import
*
as
React
from
"react"
;
import
Paper
from
'@mui/material/Paper'
;
import
{
import
MyTasksTableToolbar
from
'../../components/MyTasksCompoments/MyTasksTableToolbar/MyTasksTableToolbar'
;
Box
,
import
MyTasksTablePagination
from
'../../components/MyTasksCompoments/MyTasksTablePagination/MyTasksTablePagination'
;
Table
,
import
MyTasksTableContainer
from
'../../components/MyTasksCompoments/MyTasksTableContainer/MyTasksTableContainer'
;
TableBody
,
import
{
activateCreateCopyTasksMode
,
fetchAllTasks
,
sortTaskByProjects
,
addTask
,
deleteTask
,
deleteDateTimeTask
,
editTask
}
from
'../../store/actions/tasksActions'
;
TableContainer
,
import
{
shallowEqual
,
useDispatch
,
useSelector
}
from
'react-redux'
;
TablePagination
,
import
{
useCallback
,
useEffect
,
useState
}
from
'react'
;
Paper
,
import
{
fetchAllUserProjects
,
fetchProjects
}
from
'../../store/actions/projectsActions'
;
}
from
"@mui/material"
;
import
moment
from
'moment'
;
import
{
useState
,
useEffect
}
from
"react"
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
TaskModal
from
"../../components/MyTasksCompoments/TaskModal/TaskModal"
;
export
default
function
MyTasks
()
{
import
EnhancedTableHead
from
"./MyTasksHeader/MyTasksHeader"
;
import
moment
from
"moment"
;
import
MyTaskToolBar
from
"../../components/MyTasksCompoments/MyTaskToolBar"
;
import
{
fetchAllTasks
,
deleteTask
,
editTask
,
deleteDateTimeTask
}
from
"../../store/actions/tasksActions"
;
import
NewTaskForm
from
"../../components/MyTasksCompoments/NewTaskForm"
;
import
TableRowTask
from
"../../components/MyTasksCompoments/TableRowTask/TableRowTask"
;
export
default
function
EnhancedTable
()
{
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
navigate
=
useNavigate
()
const
tasks
=
useSelector
((
state
)
=>
state
.
tasks
.
tasks
);
const
projects
=
useSelector
((
state
)
=>
state
.
tasks
.
projects
);
const
{
user
}
=
useSelector
((
state
)
=>
state
.
users
);
const
user
=
useSelector
((
state
)
=>
state
.
users
.
user
);
const
{
tasks
,
sortedTasks
}
=
useSelector
((
state
)
=>
state
.
tasks
,
shallowEqual
);
const
[
recievedTasks
,
setRecievedTasks
]
=
useState
([]);
const
{
allUserProjectsForModalTask
,
projects
}
=
useSelector
(
state
=>
state
.
projects
,
shallowEqual
)
const
[
addTaskForm
,
setAddTaskForm
]
=
useState
(
false
);
const
[
order
,
setOrder
]
=
useState
(
"asc"
);
const
[
newTask
,
setNewTask
]
=
useState
({
const
[
orderBy
,
setOrderBy
]
=
useState
(
"id"
);
priority
:
''
,
title
:
''
,
project
:
''
,
description
:
''
,
dateTimeDeadLine
:
null
,
})
const
[
currentTask
,
setCurrentTask
]
=
useState
({
priority
:
''
,
title
:
''
,
project
:
''
,
description
:
''
,
dateTimeDeadLine
:
null
,
})
const
[
order
,
setOrder
]
=
useState
(
'asc'
);
const
[
orderBy
,
setOrderBy
]
=
useState
(
'createdAt'
);
const
[
page
,
setPage
]
=
useState
(
0
);
const
[
page
,
setPage
]
=
useState
(
0
);
const
[
rowsPerPage
,
setRowsPerPage
]
=
useState
(
25
);
const
[
rowsPerPage
,
setRowsPerPage
]
=
useState
(
10
);
const
[
modal
,
setModal
]
=
useState
({
const
[
addFormStatus
,
setAddFormStatus
]
=
useState
(
false
);
open
:
false
,
const
[
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
]
=
useState
([]);
task
:
null
,
});
const
[
projectIdListForTaskSelect
,
setProjectIdListForTaskSelect
]
=
React
.
useState
([]);
// const [filterProjectTumbler, setFilterProjectTumbler] = React.useState(false);
// const[filteredActiveTasks, setActiveTasks] = React.useState([]);
const
[
activeTasksOn
,
setActiveTasksOn
]
=
React
.
useState
(
false
)
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
fetchAllTasks
());
dispatch
(
fetchAllTasks
());
if
(
tasks
&&
tasks
?.
length
>
0
)
{
dispatch
(
fetchAllUserProjects
())
setRecievedTasks
(
tasks
);
dispatch
(
fetchProjects
())
}
},
[
dispatch
]);
},
[
tasks
?.
length
,
addTaskForm
,
setAddTaskForm
,
// onClickActiveTasks,
// activeTasksOn,
dispatch
]);
// console.log('tasks ', tasks, 'projects ', projects,"recievedTasks ", recievedTasks )
useEffect
(()
=>
{
useEffect
(()
=>
{
let
filteredTasks
=
tasks
;
dispatch
(
sortTaskByProjects
(
projectIdListForTaskSelect
))
if
(
activeTasksOn
)
{
},
[
dispatch
,
projectIdListForTaskSelect
]);
filteredTasks
=
filteredTasks
.
filter
(
task
=>
task
.
accomplish
===
'opened'
||
task
.
accomplish
===
'progress'
)
}
if
(
projectIdListForTaskSelect
.
length
>
0
)
{
filteredTasks
=
filteredTasks
.
filter
(
task
=>
projectIdListForTaskSelect
.
includes
(
task
.
project
?.
id
))
}
setRecievedTasks
(
filteredTasks
)
},
[
activeTasksOn
,
projectIdListForTaskSelect
]);
const
handleRequestSort
=
(
property
)
=>
{
const
isAsc
=
orderBy
===
property
&&
order
===
"asc"
;
setOrder
(
isAsc
?
"desc"
:
"asc"
);
setOrderBy
(
property
);
};
const
handleChangePage
=
(
newPage
)
=>
{
setPage
(
newPage
);
};
const
handleChangeRowsPerPage
=
(
event
)
=>
{
setRowsPerPage
(
parseInt
(
event
.
target
.
value
,
10
));
setPage
(
0
);
};
const
onChange
=
(
e
,
task
)
=>
{
const
value
=
e
.
target
.
value
;
const
name
=
e
.
target
.
name
;
const
{
id
}
=
task
;
const
newTasks
=
recievedTasks
.
map
((
task
)
=>
{
if
(
task
.
id
===
id
)
{
return
{
...
task
,
[
name
]:
value
};
}
return
task
;
});
setRecievedTasks
(
newTasks
);
};
const
onAuthorChange
=
(
e
,
task
)
=>
{
const
value
=
e
.
target
.
value
;
const
{
id
}
=
task
;
const
newTasks
=
recievedTasks
.
map
((
task
)
=>
{
if
(
task
.
id
===
id
)
{
const
updated
=
{
...
task
};
updated
.
author
.
displayName
=
value
;
updated
.
authorDisplayName
=
value
;
return
updated
;
}
return
task
;
});
setRecievedTasks
(
newTasks
);
};
const
onDateChange
=
(
id
,
value
,
property
)
=>
{
const
utcAvoidoffset
=
moment
(
value
).
utcOffset
(
0
,
true
).
format
()
if
(
property
===
'dateTimeDeadLine'
)
{
console
.
log
(
'In edit mode datedLine ad onDate '
,
value
)
}
const
newTasks
=
recievedTasks
.
map
((
task
)
=>
{
const
onChangeNewTaskHandler
=
useCallback
((
e
)
=>
{
if
(
task
.
id
===
id
)
{
const
{
value
,
name
}
=
e
.
target
;
setNewTask
((
prevState
=>
{
return
{
return
{
...
task
,
...
prevState
,
[
property
]:
utcAvoidoffset
,
[
name
]:
value
// [property]: moment.parseZone(value, "DD/MM/YY", true).format(),
};
}
}
return
task
;
}));
});
},
[])
setRecievedTasks
(
newTasks
);
};
const
onProjectChange
=
(
e
,
task
)
=>
{
const
onChangeCurrentTaskHandler
=
useCallback
((
e
)
=>
{
const
value
=
e
.
target
.
value
;
const
{
value
,
name
}
=
e
.
target
;
const
project
=
projects
.
find
((
e
)
=>
e
.
id
===
value
);
setCurrentTask
((
prevState
=>
{
const
{
id
}
=
task
;
const
newTasks
=
recievedTasks
.
map
((
task
)
=>
{
if
(
task
.
id
===
id
)
{
const
updated
=
{
...
task
};
updated
.
project
=
project
;
updated
.
projectName
=
project
.
title
;
return
updated
;
}
return
task
;
});
setRecievedTasks
(
newTasks
);
};
const
onToggleEditMode
=
(
id
)
=>
{
const
newTasks
=
recievedTasks
.
map
((
task
)
=>
{
if
(
task
.
id
===
id
)
{
return
{
return
{
...
task
,
...
prevState
,
isEditMode
:
true
,
[
name
]:
value
readOnly
:
false
,
};
}
}
return
task
;
}));
});
},
[])
setRecievedTasks
(
newTasks
);
};
const
on
ToggleEditModeDone
=
(
id
)
=>
{
const
on
DateChangeEditHandler
=
useCallback
((
value
,
property
)
=>
{
const
newTasks
=
recievedTasks
.
map
((
task
)
=>
{
const
utcAvoidoffset
=
moment
(
value
).
utcOffset
(
0
,
true
).
format
()
if
(
task
.
id
===
id
)
{
setCurrentTask
((
prevState
=>
{
return
{
return
{
...
task
,
...
prevState
,
isEditMode
:
false
,
[
property
]:
utcAvoidoffset
readOnly
:
true
,
};
}
}
return
task
;
}));
});
},
[]);
setRecievedTasks
(
newTasks
);
};
const
handleEditTask
=
(
task
)
=>
{
dispatch
(
editTask
(
task
));
};
const
deleteHandle
=
(
id
)
=>
{
const
onDateChangeHandler
=
useCallback
((
value
,
property
)
=>
{
dispatch
(
deleteTask
(
id
));
const
utcAvoidoffset
=
moment
(
value
).
utcOffset
(
0
,
true
).
format
()
};
setNewTask
((
prevState
=>
{
return
{
const
deleteDateTimeTaskHandle
=
(
dateTimeTaskId
)
=>
{
...
prevState
,
dispatch
(
deleteDateTimeTask
(
dateTimeTaskId
))
[
property
]:
utcAvoidoffset
}
}
}));
},
[]);
const
onModalOpen
=
(
event
,
task
)
=>
{
const
handleRequestSort
=
useCallback
((
event
,
property
)
=>
{
event
.
stopPropagation
();
const
isAsc
=
orderBy
===
property
&&
order
===
'asc'
;
setModal
({
...
modal
,
open
:
true
,
id
:
task
.
id
});
setOrder
(
isAsc
?
'desc'
:
'asc'
);
};
setOrderBy
(
property
);
},
[
order
,
orderBy
]);
const
handleClose
=
()
=>
{
setModal
({
...
modal
,
open
:
false
,
id
:
null
});
};
// ++++++++фильтрация по проектам+++++++++++++++
const
handleChangePage
=
useCallback
((
event
,
newPage
)
=>
{
setPage
(
newPage
);
},
[]);
const
onCloseFilterByProjects
=
(
listProjectIds
)
=>
{
const
handleChangeRowsPerPage
=
useCallback
((
event
)
=>
{
setRowsPerPage
(
parseInt
(
event
.
target
.
value
,
10
));
setPage
(
0
);
},
[]);
const
createTaskFromButtonHandler
=
useCallback
(()
=>
{
if
(
addFormStatus
)
{
setNewTask
({
priority
:
''
,
title
:
''
,
project
:
''
,
description
:
''
,
dateTimeDeadLine
:
null
})
}
setAddFormStatus
((
prevState
)
=>
{
return
!
prevState
})
},
[
addFormStatus
])
const
createNewTaskHandler
=
useCallback
(()
=>
{
const
task
=
{
...
newTask
,
priority
:
newTask
.
priority
?
newTask
.
priority
:
null
,
project
:
newTask
.
project
?
newTask
.
project
:
null
,
executor
:
user
,
dateTimeDeadLine
:
new
Date
(
newTask
.
dateTimeDeadLine
)
instanceof
Date
&&
!
isNaN
(
new
Date
(
newTask
.
dateTimeDeadLine
))
?
newTask
.
dateTimeDeadLine
:
null
}
dispatch
(
addTask
(
task
))
setNewTask
({
priority
:
''
,
title
:
''
,
project
:
''
,
description
:
''
,
dateTimeDeadLine
:
null
})
setAddFormStatus
((
prevState
)
=>
{
return
!
prevState
})
},
[
dispatch
,
newTask
,
user
])
const
deleteTaskHandler
=
useCallback
((
id
)
=>
{
dispatch
(
deleteTask
(
id
))
},
[
dispatch
])
const
deleteCopyTaskHandler
=
useCallback
((
id
)
=>
{
dispatch
(
deleteDateTimeTask
(
id
))
},
[
dispatch
])
const
calendarOpen
=
useCallback
((
task
)
=>
{
dispatch
(
activateCreateCopyTasksMode
(
task
,
navigate
))
},
[
dispatch
,
navigate
])
const
editCurrentTaskHandler
=
useCallback
(()
=>
{
const
task
=
{
...
currentTask
,
priority
:
currentTask
.
priority
?
currentTask
.
priority
:
null
,
project
:
currentTask
.
project
?
currentTask
.
project
:
null
,
executor
:
user
,
dateTimeDeadLine
:
new
Date
(
currentTask
.
dateTimeDeadLine
)
instanceof
Date
&&
!
isNaN
(
new
Date
(
currentTask
.
dateTimeDeadLine
))
?
currentTask
.
dateTimeDeadLine
:
null
}
dispatch
(
editTask
(
task
))
setCurrentTask
({
priority
:
''
,
title
:
''
,
project
:
''
,
description
:
''
,
dateTimeDeadLine
:
null
})
},
[
dispatch
,
currentTask
,
user
])
const
onCloseFilterByProjects
=
useCallback
((
listProjectIds
)
=>
{
setProjectIdListForTaskSelect
(
listProjectIds
)
setProjectIdListForTaskSelect
(
listProjectIds
)
}
},
[])
const
onClickActiveTasks
=
()
=>
{
console
.
log
(
'active tasts before switched to '
,
activeTasksOn
)
// setActiveTasksOn((prevState)=>{return !prevState})
setActiveTasksOn
(
!
activeTasksOn
)
console
.
log
(
'active tasts after switch '
,
activeTasksOn
)
if
(
activeTasksOn
)
{
const
activeTasks
=
recievedTasks
.
filter
(
recievedTask
=>
recievedTask
.
accomplish
===
'opened'
||
recievedTask
.
accomplish
===
'progress'
)
console
.
log
(
'received tasks in switch'
,
recievedTasks
)
setRecievedTasks
(
activeTasks
)
}
else
{
setRecievedTasks
(
tasks
)
}
}
// if (
// tasks &&
// tasks?.length > 0
// &&
// recievedTasks &&
// recievedTasks?.length > 0
// ) {
return
(
return
(
<
Box
sx
=
{{
width
:
"fullwidth"
}}
>
<
Paper
sx
=
{{
width
:
'100%'
,
mb
:
2
}}
>
<
Paper
sx
=
{{
width
:
"100%"
,
mb
:
2
}}
>
<
MyTasksTableToolbar
<
MyTaskToolBar
addFormStatus
=
{
addFormStatus
}
onClick
=
{()
=>
setAddTaskForm
(
!
addTaskForm
)}
createTaskFromButtonHandler
=
{
createTaskFromButtonHandler
}
formStatus
=
{
addTaskForm
}
projects
=
{
projects
}
onCloseFilterByProjects
=
{
onCloseFilterByProjects
}
onCloseFilterByProjects
=
{
onCloseFilterByProjects
}
projectIdListForTaskSelect
=
{
projectIdListForTaskSelect
}
projectIdListForTaskSelect
=
{
projectIdListForTaskSelect
}
setProjectIdListForTaskSelect
=
{
setProjectIdListForTaskSelect
}
setProjectIdListForTaskSelect
=
{
setProjectIdListForTaskSelect
}
onClickActiveTasks
=
{
onClickActiveTasks
}
projects
=
{
projects
.
projects
}
activeTasksOn
=
{
activeTasksOn
}
/
>
{
addTaskForm
?
(
<
NewTaskForm
projects
=
{
projects
}
setAddTaskForm
=
{()
=>
setAddTaskForm
(
false
)}
/
>
/
>
)
:
null
}
<
MyTasksTableContainer
<
TableContainer
>
<
Table
sx
=
{{
minWidth
:
600
}}
aria
-
labelledby
=
"tableTitle"
size
=
'small'
>
<
EnhancedTableHead
order
=
{
order
}
order
=
{
order
}
orderBy
=
{
orderBy
}
orderBy
=
{
orderBy
}
onRequestSort
=
{
handleRequestSort
}
handleRequestSort
=
{
handleRequestSort
}
rowCount
=
{
recievedTasks
.
length
}
rows
=
{
projectIdListForTaskSelect
.
length
?
sortedTasks
:
tasks
}
/
>
page
=
{
page
}
<
TableBody
>
rowsPerPage
=
{
rowsPerPage
}
{
stableSort
(
recievedTasks
,
getComparator
(
order
,
orderBy
))
addFormStatus
=
{
addFormStatus
}
.
slice
(
page
*
rowsPerPage
,
page
*
rowsPerPage
+
rowsPerPage
)
onChangeNewTaskHandler
=
{
onChangeNewTaskHandler
}
.
map
((
task
,
index
)
=>
{
newTask
=
{
newTask
}
return
(
allUserProjectsForModalTask
=
{
allUserProjectsForModalTask
}
<
TableRowTask
onDateChangeHandler
=
{
onDateChangeHandler
}
key
=
{
index
}
createNewTaskHandler
=
{
createNewTaskHandler
}
user
=
{
user
}
deleteTaskHandler
=
{
deleteTaskHandler
}
task
=
{
task
}
calendarOpen
=
{
calendarOpen
}
deleteHandle
=
{
deleteHandle
}
deleteCopyTaskHandler
=
{
deleteCopyTaskHandler
}
handleEditTask
=
{
handleEditTask
}
currentTask
=
{
currentTask
}
deleteDateTimeTask
=
{
deleteDateTimeTaskHandle
}
setCurrentTask
=
{
setCurrentTask
}
onChange
=
{
onChange
}
onChangeCurrentTaskHandler
=
{
onChangeCurrentTaskHandler
}
onModalOpen
=
{
onModalOpen
}
onDateChangeEditHandler
=
{
onDateChangeEditHandler
}
onProjectChange
=
{
onProjectChange
}
editCurrentTaskHandler
=
{
editCurrentTaskHandler
}
uniqueProjects
=
{
projects
}
onDateChange
=
{
onDateChange
}
onToggleEditMode
=
{
onToggleEditMode
}
onToggleEditModeDone
=
{
onToggleEditModeDone
}
/
>
/
>
<
MyTasksTablePagination
);
count
=
{
projectIdListForTaskSelect
.
length
?
sortedTasks
.
length
:
tasks
.
length
}
})}
<
/TableBody
>
<
/Table
>
<
/TableContainer
>
<
TablePagination
rowsPerPageOptions
=
{[
5
,
10
,
25
]}
component
=
"div"
count
=
{
recievedTasks
.
length
}
rowsPerPage
=
{
rowsPerPage
}
rowsPerPage
=
{
rowsPerPage
}
page
=
{
page
}
page
=
{
page
}
onPageChan
ge
=
{
handleChangePage
}
handleChangePa
ge
=
{
handleChangePage
}
onRowsPerPageChan
ge
=
{
handleChangeRowsPerPage
}
handleChangeRowsPerPa
ge
=
{
handleChangeRowsPerPage
}
/
>
/
>
<
/Paper
>
<
/Paper
>
<
TaskModal
task
=
{
recievedTasks
.
find
((
task
)
=>
task
.
id
===
modal
.
id
)}
open
=
{
modal
.
open
}
handleClose
=
{
handleClose
}
onChange
=
{
onChange
}
user
=
{
user
}
/
>
<
/Box
>
);
);
}
// }
function
descendingComparator
(
a
,
b
,
orderBy
)
{
if
(
b
[
orderBy
]
<
a
[
orderBy
])
{
return
-
1
;
}
if
(
b
[
orderBy
]
>
a
[
orderBy
])
{
return
1
;
}
return
0
;
}
function
getComparator
(
order
,
orderBy
)
{
return
order
===
"desc"
?
(
a
,
b
)
=>
descendingComparator
(
a
,
b
,
orderBy
)
:
(
a
,
b
)
=>
-
descendingComparator
(
a
,
b
,
orderBy
);
}
function
stableSort
(
array
,
comparator
)
{
const
stabilizedThis
=
array
?.
map
((
el
,
index
)
=>
[
el
,
index
]);
stabilizedThis
.
sort
((
a
,
b
)
=>
{
const
order
=
comparator
(
a
[
0
],
b
[
0
]);
if
(
order
!==
0
)
{
return
order
;
}
return
a
[
1
]
-
b
[
1
];
});
return
stabilizedThis
.
map
((
el
)
=>
el
[
0
]);
}
}
planner-front/src/containers/MyTasks/MyTasksHeader/MyTasksHeader.js
deleted
100644 → 0
View file @
44db3680
import
*
as
React
from
"react"
;
import
PropTypes
from
"prop-types"
;
import
Box
from
"@mui/material/Box"
;
import
TableCell
from
"@mui/material/TableCell"
;
import
TableHead
from
"@mui/material/TableHead"
;
import
TableRow
from
"@mui/material/TableRow"
;
import
TableSortLabel
from
"@mui/material/TableSortLabel"
;
import
{
visuallyHidden
}
from
"@mui/utils"
;
const
headCells
=
[
{
id
:
"id"
,
numeric
:
true
,
disablePadding
:
true
,
label
:
""
,
canSort
:
true
,
},
{
id
:
"priority"
,
numeric
:
false
,
disablePadding
:
true
,
label
:
"Приоритет"
,
canSort
:
true
,
},
{
id
:
"createdAt"
,
numeric
:
true
,
disablePadding
:
false
,
label
:
"Дата создания"
,
canSort
:
true
,
},
{
id
:
"title"
,
numeric
:
true
,
disablePadding
:
false
,
label
:
"Заголовок"
,
canSort
:
true
,
},
{
id
:
"projectName"
,
numeric
:
true
,
disablePadding
:
false
,
label
:
"Проект"
,
canSort
:
true
,
},
{
id
:
"authorDisplayName"
,
numeric
:
true
,
disablePadding
:
false
,
label
:
"Автор"
,
canSort
:
true
,
},
{
id
:
"dateTimeStart"
,
numeric
:
true
,
disablePadding
:
false
,
label
:
"Дата и время выполнения"
,
canSort
:
false
,
},
{
id
:
"dateTimeDeadLine"
,
numeric
:
true
,
disablePadding
:
false
,
label
:
"Дедлайн"
,
canSort
:
true
,
},
{
id
:
"accomplish"
,
numeric
:
true
,
disablePadding
:
false
,
label
:
"Статус"
,
canSort
:
true
,
},
{
id
:
"change"
,
numeric
:
false
,
disablePadding
:
false
,
label
:
""
,
canSort
:
false
,
},
{
id
:
"delete"
,
numeric
:
false
,
disablePadding
:
false
,
label
:
""
,
canSort
:
false
,
},
];
export
default
function
EnhancedTableHead
({
order
,
orderBy
,
rowCount
,
onRequestSort
,
})
{
return
(
<
TableHead
>
<
TableRow
>
{
headCells
.
map
((
headCell
)
=>
(
<
TableCell
key
=
{
headCell
.
id
}
align
=
{
"left"
}
padding
=
{
headCell
.
disablePadding
?
"none"
:
"normal"
}
sortDirection
=
{
headCell
.
canSort
&&
orderBy
===
headCell
.
id
?
order
:
false
}
style
=
{{
paddingLeft
:
"0"
}}
>
{
headCell
.
canSort
?
(
<
TableSortLabel
active
=
{
orderBy
===
headCell
.
id
}
direction
=
{
orderBy
===
headCell
.
id
?
order
:
"asc"
}
onClick
=
{()
=>
onRequestSort
(
headCell
.
id
)}
>
{
headCell
.
label
}
{
orderBy
===
headCell
.
id
?
(
<
Box
component
=
"span"
sx
=
{
visuallyHidden
}
>
{
order
===
"desc"
?
"sorted descending"
:
"sorted ascending"
}
<
/Box
>
)
:
null
}
<
/TableSortLabel
>
)
:
(
<
span
>
{
headCell
.
label
}
<
/span
>
)}
<
/TableCell
>
))}
<
/TableRow
>
<
/TableHead
>
);
}
EnhancedTableHead
.
propTypes
=
{
onRequestSort
:
PropTypes
.
func
.
isRequired
,
order
:
PropTypes
.
oneOf
([
"asc"
,
"desc"
]).
isRequired
,
orderBy
:
PropTypes
.
string
.
isRequired
,
rowCount
:
PropTypes
.
number
.
isRequired
,
};
planner-front/src/containers/UsersTasks/UsersTasks.js
View file @
94d3fe63
...
@@ -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 @
94d3fe63
...
@@ -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 @
94d3fe63
...
@@ -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