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
d38e42bc
Commit
d38e42bc
authored
Dec 24, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#129
добавил проект в месячном календаре
parent
465fd444
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
125 additions
and
98 deletions
+125
-98
copyTasks.ts
planner-api/src/routers/copyTasks.ts
+2
-1
CalendarModalTaskContent.js
...dars/CalendarModalTaskContent/CalendarModalTaskContent.js
+62
-47
Helpers.js
.../components/Calendars/CalendarModalTaskContent/Helpers.js
+2
-2
ModalTask.js
...ner-front/src/components/Calendars/ModalTask/ModalTask.js
+5
-5
MonthCalendarBody.js
...dars/MonthCalendar/MonthCalendarBody/MonthCalendarBody.js
+4
-2
СustomSelect.js
planner-front/src/components/UI/СustomSelect/СustomSelect.js
+1
-1
MonthCalendar.js
planner-front/src/containers/MonthCalendar/MonthCalendar.js
+6
-2
projectsReducer.js
planner-front/src/store/reducers/projectsReducer.js
+42
-38
tasksReducer.js
planner-front/src/store/reducers/tasksReducer.js
+1
-0
No files found.
planner-api/src/routers/copyTasks.ts
View file @
d38e42bc
...
...
@@ -22,7 +22,7 @@ router.post("/make-copy",auth,authAuthorOrExecutorOfTask, async(req:Request, res
/** change date time of copy of task in calendar view */
router
.
put
(
"/change-copy/:dateTimeTaskId"
,
auth
,
authAuthorOrExecutorOfTask
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
const
{
dateTimeTaskId
}
=
req
.
params
const
{
executorStatus
,
authorStatus
,
task
,
dateTimeStart
,
dateTimeDue
,
description
,
title
,
priority
}
=
req
.
body
const
{
executorStatus
,
authorStatus
,
task
,
dateTimeStart
,
dateTimeDue
,
description
,
title
,
priority
,
project
}
=
req
.
body
if
(
authorStatus
){
task
.
title
=
title
;
task
.
description
=
description
;
...
...
@@ -73,6 +73,7 @@ router.put("/change-copy/:dateTimeTaskId",auth, authAuthorOrExecutorOfTask, asyn
task
.
title
=
title
;
task
.
description
=
description
;
task
.
priority
=
priority
;
task
.
project
=
project
await
task
.
save
()
return
res
.
send
({
task
})
})
...
...
planner-front/src/components/Calendars/CalendarModalTaskContent/CalendarModalTaskContent.js
View file @
d38e42bc
import
{
Button
,
TextField
}
from
"@mui/material"
;
import
{
memo
}
from
"react"
;
import
{
useSelector
}
from
"react-redux"
;
import
{
priorities
}
from
"../../../constants"
;
import
CustomSelect
from
'../../UI/СustomSelect/СustomSelect'
import
{
isValidate
}
from
"./Helpers"
;
function
CalendarModalTaskContent
({
title
,
onChangeCurrentTaskHandler
,
description
,
priority
,
sendNewTaskHandler
,
deleteTaskHandler
,
startHour
,
endHour
,
id
})
{
function
CalendarModalTaskContent
({
title
,
onChangeCurrentTaskHandler
,
description
,
priority
,
project
,
sendNewTaskHandler
,
deleteTaskHandler
,
startHour
,
endHour
,
id
})
{
return
(
<>
<
TextField
id
=
"task-description-title"
value
=
{
title
}
label
=
"Название"
variant
=
"outlined"
sx
=
{{
marginBottom
:
'30px'
}}
name
=
'title'
onChange
=
{(
e
)
=>
{
onChangeCurrentTaskHandler
(
e
)
}}
/
>
<
TextField
id
=
"task-description"
multiline
rows
=
{
4
}
value
=
{
description
}
label
=
"Описание"
variant
=
"outlined"
sx
=
{{
marginBottom
:
'30px'
}}
name
=
'description'
onChange
=
{(
e
)
=>
{
onChangeCurrentTaskHandler
(
e
)
}}
/
>
<
CustomSelect
defaultValue
=
{
null
}
value
=
{
priority
}
name
=
{
'priority'
}
variant
=
{
'outlined'
}
onChange
=
{(
e
)
=>
{
onChangeCurrentTaskHandler
(
e
)
}}
label
=
{
'Приоритет'
}
id
=
{
'priority-type'
}
items
=
{
priorities
}
/
>
<
div
style
=
{{
display
:
'flex'
,
gap
:
'20px'
,
margin
:
'20px 0'
}}
>
const
{
allUserProjectsForModalTask
}
=
useSelector
(
state
=>
state
.
projects
)
return
(
<>
<
TextField
id
=
"task-
startHour
"
value
=
{
startHour
}
label
=
"
От
"
id
=
"task-
description-title
"
value
=
{
title
}
label
=
"
Название
"
variant
=
"outlined"
name
=
'startHour'
sx
=
{{
marginBottom
:
'30px'
}}
name
=
'title'
onChange
=
{(
e
)
=>
{
onChangeCurrentTaskHandler
(
e
)
}}
/
>
<
TextField
id
=
"task-endHour"
value
=
{
endHour
}
label
=
"До"
id
=
"task-description"
multiline
rows
=
{
4
}
value
=
{
description
}
label
=
"Описание"
variant
=
"outlined"
name
=
'endHour'
sx
=
{{
marginBottom
:
'30px'
}}
name
=
'description'
onChange
=
{(
e
)
=>
{
onChangeCurrentTaskHandler
(
e
)
}}
/
>
<
/div
>
<
div
style
=
{{
display
:
'flex'
,
gap
:
'20px'
,
margin
:
'10px 0'
}}
>
<
Button
id
=
'test_button_save_task'
onClick
=
{
sendNewTaskHandler
}
disabled
=
{
!
isValidate
(
title
,
startHour
,
endHour
)}
>
Сохранить
<
/Button
>
<
Button
onClick
=
{
deleteTaskHandler
}
disabled
=
{
!
id
}
>
Удалить
<
/Button
>
<
/div
>
<
/>
)
;
<
div
style
=
{{
display
:
'flex'
,
gap
:
'20px'
,
margin
:
'20px 0'
}}
>
<
CustomSelect
defaultValue
=
{
null
}
value
=
{
priority
}
name
=
{
'priority'
}
variant
=
{
'outlined'
}
onChange
=
{(
e
)
=>
{
onChangeCurrentTaskHandler
(
e
)
}}
label
=
{
'Приоритет'
}
id
=
{
'priority-type'
}
items
=
{
priorities
}
/
>
<
CustomSelect
value
=
{
project
}
name
=
{
'project'
}
variant
=
{
'outlined'
}
onChange
=
{(
e
)
=>
{
onChangeCurrentTaskHandler
(
e
)
}}
label
=
{
'Проект'
}
id
=
{
'project'
}
items
=
{
allUserProjectsForModalTask
}
/
>
<
/div
>
<
div
style
=
{{
display
:
'flex'
,
gap
:
'20px'
,
margin
:
'20px 0'
}}
>
<
TextField
id
=
"task-startHour"
value
=
{
startHour
}
label
=
"От"
variant
=
"outlined"
name
=
'startHour'
onChange
=
{(
e
)
=>
{
onChangeCurrentTaskHandler
(
e
)
}}
/
>
<
TextField
id
=
"task-endHour"
value
=
{
endHour
}
label
=
"До"
variant
=
"outlined"
name
=
'endHour'
onChange
=
{(
e
)
=>
{
onChangeCurrentTaskHandler
(
e
)
}}
/
>
<
/div
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'space-between'
,
margin
:
'10px 0'
}}
>
<
Button
id
=
'test_button_save_task'
onClick
=
{
sendNewTaskHandler
}
disabled
=
{
!
isValidate
(
title
,
project
,
startHour
,
endHour
)}
>
Сохранить
<
/Button
>
<
Button
onClick
=
{
deleteTaskHandler
}
disabled
=
{
!
id
}
>
Удалить
<
/Button
>
<
/div
>
<
/>
)
;
}
export
default
memo
(
CalendarModalTaskContent
);
\ No newline at end of file
planner-front/src/components/Calendars/CalendarModalTaskContent/Helpers.js
View file @
d38e42bc
export
const
isValidate
=
(
title
,
startHour
,
endHour
)
=>
{
if
(
title
)
{
export
const
isValidate
=
(
title
,
project
,
startHour
,
endHour
)
=>
{
if
(
title
&&
project
)
{
const
startHourInt
=
parseInt
(
startHour
)
const
endHourInt
=
parseInt
(
endHour
)
if
(
startHourInt
>=
8
&&
startHourInt
<=
24
)
{
...
...
planner-front/src/components/Calendars/ModalTask/ModalTask.js
View file @
d38e42bc
...
...
@@ -26,16 +26,16 @@ export default function ModalTask({ modal, handleClose, children, week }) {
const
getYCordinatesToModal
=
useCallback
(()
=>
{
if
(
week
)
{
if
(
windowDimenion
.
winHeight
>
modal
.
yClick
С
ordinates
+
4
5
0
)
{
if
(
windowDimenion
.
winHeight
>
modal
.
yClick
С
ordinates
+
4
7
0
)
{
return
modal
.
yClick
С
ordinates
-
modal
.
yDivClick
}
else
{
return
modal
.
yClick
С
ordinates
-
4
5
0
return
modal
.
yClick
С
ordinates
-
4
7
0
}
}
else
{
if
(
windowDimenion
.
winHeight
>
modal
.
yClick
С
ordinates
+
4
5
0
)
{
if
(
windowDimenion
.
winHeight
>
modal
.
yClick
С
ordinates
+
4
7
0
)
{
return
modal
.
yClick
С
ordinates
-
modal
.
yDiv
-
modal
.
yDivClick
}
else
{
return
modal
.
yClick
С
ordinates
-
modal
.
yDiv
-
modal
.
yDivClick
-
((
modal
.
yClick
С
ordinates
+
4
5
0
)
-
windowDimenion
.
winHeight
)
-
30
return
modal
.
yClick
С
ordinates
-
modal
.
yDiv
-
modal
.
yDivClick
-
((
modal
.
yClick
С
ordinates
+
4
7
0
)
-
windowDimenion
.
winHeight
)
-
30
}
}
},
[
windowDimenion
.
winHeight
,
modal
])
...
...
@@ -55,7 +55,7 @@ export default function ModalTask({ modal, handleClose, children, week }) {
top
:
getYCordinatesToModal
(),
left
:
getXCordinatesToModal
(),
width
:
270
,
height
:
4
5
0
,
height
:
4
7
0
,
bgcolor
:
'background.paper'
,
border
:
'2px solid #000'
,
boxShadow
:
24
,
...
...
planner-front/src/components/Calendars/MonthCalendar/MonthCalendarBody/MonthCalendarBody.js
View file @
d38e42bc
...
...
@@ -6,10 +6,11 @@ import CalendarStandartCell from "../../CalendarStandartCell/CalendarStandartCel
import
ModalTask
from
"../../ModalTask/ModalTask"
import
MonthCalendarModalContent
from
"../../CalendarModalTaskContent/CalendarModalTaskContent"
;
import
CalendarRowDay
from
"./CalendarRowDay/CalendarRowDay"
;
import
{
useSelector
}
from
"react-redux"
;
function
MonthCalendarBody
({
month
,
year
,
tasks
,
createTaskInCellHandler
,
currentTask
,
setCurrentTask
,
hourFormat
,
setHourFormat
,
onChangeCurrentTaskHandler
,
sendNewTaskHandler
,
deleteTaskHandler
,
cellSizes
,
hoursInDay
,
daysInMonth
,
dragTaskHandler
,
createCopyTask
,
setCopyTask
,
copyTask
})
{
function
MonthCalendarBody
({
month
,
year
,
tasks
,
createTaskInCellHandler
,
currentTask
,
setCurrentTask
,
hourFormat
,
setHourFormat
,
onChangeCurrentTaskHandler
,
sendNewTaskHandler
,
deleteTaskHandler
,
cellSizes
,
hoursInDay
,
daysInMonth
,
dragTaskHandler
,
createCopyTask
,
setCopyTask
,
copyTask
})
{
const
[
currentLine
,
setCurrentLine
]
=
useState
(
''
)
const
[
modal
,
setModal
]
=
useState
({
open
:
false
,
y
:
0
,
x
:
0
,
});
const
handleOpen
=
useCallback
((
e
)
=>
{
...
...
@@ -89,6 +90,7 @@ function MonthCalendarBody({ month, year, tasks, createTaskInCellHandler, curren
title
=
{
currentTask
.
title
}
description
=
{
currentTask
.
description
}
priority
=
{
currentTask
.
priority
}
project
=
{
currentTask
.
project
}
id
=
{
currentTask
.
id
}
startHour
=
{
currentTask
.
infoForCell
?.
startHour
}
endHour
=
{
currentTask
.
infoForCell
?.
endHour
}
...
...
planner-front/src/components/UI/СustomSelect/СustomSelect.js
View file @
d38e42bc
...
...
@@ -5,7 +5,7 @@ function СustomSelect({ value, onChange, label, variant = 'standard', items, id
return
(
<>
<
FormControl
variant
=
{
variant
}
sx
=
{{
m
:
0
,
minWidth
:
12
0
}}
>
<
FormControl
variant
=
{
variant
}
sx
=
{{
m
:
0
,
minWidth
:
12
5
}}
>
<
InputLabel
id
=
{
`
${
id
}
-select-label`
}
>
{
label
}
<
/InputLabel
>
<
Select
labelId
=
{
`
${
id
}
-select-label`
}
...
...
planner-front/src/containers/MonthCalendar/MonthCalendar.js
View file @
d38e42bc
...
...
@@ -25,7 +25,7 @@ function MonthCalendar() {
const
[
userId
,
setUserId
]
=
useState
(
''
)
const
[
userCalendarId
,
setUserCalendarId
]
=
useState
(
null
)
const
[
modal
,
setModal
]
=
useState
(
false
)
console
.
log
(
currentTask
)
useEffect
(()
=>
{
setDateNow
({
month
:
new
Date
().
getMonth
(),
...
...
@@ -38,10 +38,12 @@ function MonthCalendar() {
setUserId
(
userCalendarId
)
dispatch
(
fetchCalendarTasks
(
userCalendarId
))
dispatch
(
fetchCurrentCalendarDisplayName
(
userCalendarId
))
dispatch
(
fetchAllUserProjects
())
}
else
{
setUserId
(
user
.
id
)
dispatch
(
fetchCalendarTasks
(
user
.
id
))
dispatch
(
fetchCurrentCalendarDisplayName
(
user
.
id
))
dispatch
(
fetchAllUserProjects
())
}
},
[
userCalendarId
,
dispatch
,
user
.
id
])
...
...
@@ -145,7 +147,8 @@ function MonthCalendar() {
startHour
:
hour
,
endHour
:
hourDue
,
startDay
:
dayNumber
}
},
project
:
allUserProjects
[
0
]?.
id
}
setCurrentTask
((
newTask
))
},
[
dateNow
.
month
,
dateNow
.
year
,
hourFormat
])
...
...
@@ -294,6 +297,7 @@ function MonthCalendar() {
createCopyTask
=
{
createCopyTask
}
copyTask
=
{
copyTask
}
setCopyTask
=
{
setCopyTask
}
allUserProjects
=
{
allUserProjects
}
/
>
<
/
>
...
...
planner-front/src/store/reducers/projectsReducer.js
View file @
d38e42bc
import
{
DELETE_MEMBER_FAILURE
,
DELETE_MEMBER_REQUEST
,
DELETE_MEMBER_SUCCESS
,
DELETE_PROJECT_FAILURE
,
DELETE_PROJECT_REQUEST
,
DELETE_PROJECT_SUCCESS
,
FETCH_ALL_USER_PROJECTS_SUCCESS
,
FETCH_PROJECTS_ERROR
,
FETCH_PROJECTS_REQUEST
,
FETCH_PROJECTS_SUCCESS
,
FETCH_PROJECT_SUCCESS
}
from
"../actionTypes/projectsActionTypes"
;
import
{
DELETE_MEMBER_FAILURE
,
DELETE_MEMBER_REQUEST
,
DELETE_MEMBER_SUCCESS
,
DELETE_PROJECT_FAILURE
,
DELETE_PROJECT_REQUEST
,
DELETE_PROJECT_SUCCESS
,
FETCH_ALL_USER_PROJECTS_SUCCESS
,
FETCH_PROJECTS_ERROR
,
FETCH_PROJECTS_REQUEST
,
FETCH_PROJECTS_SUCCESS
,
FETCH_PROJECT_SUCCESS
}
from
"../actionTypes/projectsActionTypes"
;
const
initialState
=
{
allUserProjects
:
[],
projects
:
[],
project
:
""
,
loading
:
false
,
error
:
null
};
const
projectsReducer
=
(
state
=
initialState
,
action
)
=>
{
switch
(
action
.
type
)
{
case
FETCH_PROJECTS_REQUEST
:
return
{...
state
,
loading
:
true
};
case
FETCH_PROJECTS_SUCCESS
:
return
{...
state
,
loading
:
false
,
projects
:
action
.
projects
};
case
FETCH_PROJECTS_ERROR
:
return
{...
state
,
loading
:
false
,
error
:
action
.
error
};
case
FETCH_PROJECT_SUCCESS
:
return
{...
state
,
loading
:
false
,
project
:
action
.
project
}
case
DELETE_MEMBER_SUCCESS
:
return
{...
state
,
loading
:
false
};
case
DELETE_MEMBER_REQUEST
:
return
{...
state
,
loading
:
true
};
case
DELETE_MEMBER_FAILURE
:
return
{...
state
,
loading
:
false
,
error
:
action
.
error
};
case
DELETE_PROJECT_SUCCESS
:
return
{...
state
,
loading
:
false
};
case
DELETE_PROJECT_REQUEST
:
return
{...
state
,
loading
:
true
};
case
DELETE_PROJECT_FAILURE
:
return
{...
state
,
loading
:
false
,
error
:
action
.
error
};
case
FETCH_ALL_USER_PROJECTS_SUCCESS
:
return
{...
state
,
loading
:
false
,
allUserProjects
:
action
.
projects
}
default
:
return
state
;
}
};
export
default
projectsReducer
;
\ No newline at end of file
allUserProjectsForModalTask
:
[],
allUserProjects
:
[],
projects
:
[],
project
:
""
,
loading
:
false
,
error
:
null
};
const
projectsReducer
=
(
state
=
initialState
,
action
)
=>
{
switch
(
action
.
type
)
{
case
FETCH_PROJECTS_REQUEST
:
return
{
...
state
,
loading
:
true
};
case
FETCH_PROJECTS_SUCCESS
:
return
{
...
state
,
loading
:
false
,
projects
:
action
.
projects
};
case
FETCH_PROJECTS_ERROR
:
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
case
FETCH_PROJECT_SUCCESS
:
return
{
...
state
,
loading
:
false
,
project
:
action
.
project
}
case
DELETE_MEMBER_SUCCESS
:
return
{
...
state
,
loading
:
false
};
case
DELETE_MEMBER_REQUEST
:
return
{
...
state
,
loading
:
true
};
case
DELETE_MEMBER_FAILURE
:
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
case
DELETE_PROJECT_SUCCESS
:
return
{
...
state
,
loading
:
false
};
case
DELETE_PROJECT_REQUEST
:
return
{
...
state
,
loading
:
true
};
case
DELETE_PROJECT_FAILURE
:
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
case
FETCH_ALL_USER_PROJECTS_SUCCESS
:
const
newArr
=
action
.
projects
.
map
((
project
)
=>
{
return
{
value
:
project
.
id
,
text
:
project
.
title
}
})
return
{
...
state
,
loading
:
false
,
allUserProjects
:
action
.
projects
,
allUserProjectsForModalTask
:
newArr
}
default
:
return
state
;
}
};
export
default
projectsReducer
;
\ No newline at end of file
planner-front/src/store/reducers/tasksReducer.js
View file @
d38e42bc
...
...
@@ -38,6 +38,7 @@ const tasksReduсer = (state = initialState, action) => {
for
(
let
copy
of
task
.
dateTimeTasks
)
{
newTasksWithoutInfoForCell
.
push
({
...
copy
,
project
:
task
?.
project
?.
id
,
mainTaskId
:
task
.
id
,
executor
:
task
.
executor
,
author
:
task
.
author
,
...
...
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