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
5c5a9798
Commit
5c5a9798
authored
Dec 20, 2022
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#110
create task added in users Tasks
parent
2c813db9
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
62 deletions
+20
-62
tasks.ts
planner-api/src/routers/tasks.ts
+4
-1
NewTaskForm.js
...ner-front/src/components/MyTasksCompoments/NewTaskForm.js
+1
-22
Select.js
planner-front/src/components/UI/Select/Select.js
+1
-2
NewTaskForm.js
...-front/src/components/UsersTasksCompoments/NewTaskForm.js
+13
-22
UsersTasks.js
planner-front/src/containers/UsersTasks/UsersTasks.js
+0
-14
tasksActions.js
planner-front/src/store/actions/tasksActions.js
+1
-1
No files found.
planner-api/src/routers/tasks.ts
View file @
5c5a9798
...
@@ -112,6 +112,7 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
...
@@ -112,6 +112,7 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
router
.
post
(
'/users'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
router
.
post
(
'/users'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
const
{
user
,
title
,
description
,
project
,
executor
,
dateTimeStart
,
dateTimeDue
,
dateTimeDeadLine
,
priority
}
=
req
.
body
;
const
{
user
,
title
,
description
,
project
,
executor
,
dateTimeStart
,
dateTimeDue
,
dateTimeDeadLine
,
priority
}
=
req
.
body
;
const
newTask
=
new
Task
();
const
newTask
=
new
Task
();
console
.
log
(
'project '
,
project
,
)
newTask
.
title
=
title
;
newTask
.
title
=
title
;
newTask
.
description
=
description
;
newTask
.
description
=
description
;
if
(
project
)
{
if
(
project
)
{
...
@@ -165,11 +166,13 @@ router.post('/users', auth, async(req:Request, res:Response):Promise<Response>=>
...
@@ -165,11 +166,13 @@ router.post('/users', auth, async(req:Request, res:Response):Promise<Response>=>
newTask
.
executor
=
executor
;
newTask
.
executor
=
executor
;
newTask
.
priority
=
priority
;
newTask
.
priority
=
priority
;
await
newTask
.
save
();
await
newTask
.
save
();
if
(
dateTimeDue
&&
dateTimeStart
){
const
newDateTimeTask
=
new
DateTimeTask
();
const
newDateTimeTask
=
new
DateTimeTask
();
newDateTimeTask
.
dateTimeStart
=
dateTimeStart
newDateTimeTask
.
dateTimeStart
=
dateTimeStart
newDateTimeTask
.
dateTimeDue
=
dateTimeDue
newDateTimeTask
.
dateTimeDue
=
dateTimeDue
newDateTimeTask
.
task
=
newTask
newDateTimeTask
.
task
=
newTask
await
newDateTimeTask
.
save
()
await
newDateTimeTask
.
save
()
}
return
res
.
send
({
newTask
});
return
res
.
send
({
newTask
});
})
})
...
...
planner-front/src/components/MyTasksCompoments/NewTaskForm.js
View file @
5c5a9798
...
@@ -127,14 +127,7 @@ export default function NewTaskForm({ projects, setAddTaskForm }) {
...
@@ -127,14 +127,7 @@ export default function NewTaskForm({ projects, setAddTaskForm }) {
/>
/>
<
/TableCell
>
<
/TableCell
>
<
CustomTableCell
{...{
task
,
name
:
"createdAt"
,
value
:
moment
(
task
.
createdAt
).
format
(
"DD-MM-YYYY hh:mm A"
),
width
:
"15%"
,
}}
/
>
<
CustomTableCell
<
CustomTableCell
{...{
{...{
...
@@ -161,14 +154,6 @@ export default function NewTaskForm({ projects, setAddTaskForm }) {
...
@@ -161,14 +154,6 @@ export default function NewTaskForm({ projects, setAddTaskForm }) {
/
>
/
>
<
/TableCell
>
<
/TableCell
>
{
/* <TableCell>
<MaterialUIPickers
task={task}
name="dateTimeStart"
onChange={onDateChange}
/>
</TableCell> */
}
<
TableCell
style
=
{{
width
:
"20%"
,
paddingLeft
:
"0"
}}
>
<
TableCell
style
=
{{
width
:
"20%"
,
paddingLeft
:
"0"
}}
>
<
MaterialUIPickers
<
MaterialUIPickers
task
=
{
task
}
task
=
{
task
}
...
@@ -213,12 +198,6 @@ export const header = [
...
@@ -213,12 +198,6 @@ export const header = [
disablePadding
:
true
,
disablePadding
:
true
,
label
:
"Приоритет"
,
label
:
"Приоритет"
,
},
},
{
id
:
"createdAt"
,
numeric
:
true
,
disablePadding
:
false
,
label
:
"Дата создания"
,
},
{
{
id
:
"title"
,
id
:
"title"
,
numeric
:
false
,
numeric
:
false
,
...
...
planner-front/src/components/UI/Select/Select.js
View file @
5c5a9798
...
@@ -11,7 +11,6 @@ export default function BasicSelect({value,label,name,onChange,task,items}) {
...
@@ -11,7 +11,6 @@ export default function BasicSelect({value,label,name,onChange,task,items}) {
console
.
log
(
'select name '
,
name
)
console
.
log
(
'select name '
,
name
)
console
.
log
(
'select task '
,
task
)
console
.
log
(
'select task '
,
task
)
console
.
log
(
'select items '
,
items
)
console
.
log
(
'select items '
,
items
)
// console.log('select value ', value)
return
(
return
(
<
Box
sx
=
{{
minWidth
:
60
,
m
:
0
}}
>
<
Box
sx
=
{{
minWidth
:
60
,
m
:
0
}}
>
<
FormControl
fullWidth
>
<
FormControl
fullWidth
>
...
@@ -28,7 +27,7 @@ export default function BasicSelect({value,label,name,onChange,task,items}) {
...
@@ -28,7 +27,7 @@ export default function BasicSelect({value,label,name,onChange,task,items}) {
<
MenuItem
key
=
{
index
}
value
=
{
item
.
value
}
>
<
MenuItem
key
=
{
index
}
value
=
{
item
.
value
}
>
{
item
.
title
}
{
item
.
title
}
<
/MenuItem
>
<
/MenuItem
>
)):
<><
/>
}
)):
null
}
<
/Select
>
<
/Select
>
<
/FormControl
>
<
/FormControl
>
<
/Box
>
<
/Box
>
...
...
planner-front/src/components/UsersTasksCompoments/NewTaskForm.js
View file @
5c5a9798
...
@@ -40,7 +40,7 @@ export default function NewTaskForm({
...
@@ -40,7 +40,7 @@ export default function NewTaskForm({
dateTimeDeadLine
:
null
,
dateTimeDeadLine
:
null
,
dateTimeTasks
:
[],
dateTimeTasks
:
[],
dateTimeDue
:
null
,
dateTimeDue
:
null
,
project
:
[]
,
project
:
null
,
accomplish
:
"opened"
,
accomplish
:
"opened"
,
priority
:
"B"
,
priority
:
"B"
,
author
:
{
id
:
user
.
id
},
author
:
{
id
:
user
.
id
},
...
@@ -48,8 +48,8 @@ export default function NewTaskForm({
...
@@ -48,8 +48,8 @@ export default function NewTaskForm({
executor
:
null
,
executor
:
null
,
isEditMode
:
true
,
isEditMode
:
true
,
});
});
console
.
log
(
'NewTaskForm currentProject '
,
currentProject
,
'projects '
,
projects
)
const
[
modal
,
setModal
]
=
useState
(
false
);
const
[
modal
,
setModal
]
=
useState
(
false
);
console
.
log
(
'NewTaskForm currentProject '
,
currentProject
)
const
onModalOpen
=
(
event
,
task
)
=>
{
const
onModalOpen
=
(
event
,
task
)
=>
{
event
.
stopPropagation
();
event
.
stopPropagation
();
...
@@ -79,9 +79,12 @@ export default function NewTaskForm({
...
@@ -79,9 +79,12 @@ export default function NewTaskForm({
const
onExecutorChange
=
(
e
,
task
)
=>
{
const
onExecutorChange
=
(
e
,
task
)
=>
{
const
{
value
,
name
}
=
e
.
target
.
value
;
const
{
value
,
name
}
=
e
.
target
.
value
;
const
executorMember
=
currentProject
.
find
((
member
)
=>
member
.
user
.
id
===
value
);
let
executorMember
=
null
const
newTask
=
{
...
task
};
const
newTask
=
{
...
task
};
newTask
[{
name
}]
=
executorMember
.
user
;
if
(
name
===
'executor'
&&
value
!==
null
)
{
executorMember
=
currentProject
.
find
((
member
)
=>
member
.
user
.
id
===
value
);
newTask
.
executor
=
executorMember
?.
user
;
}
setTask
(
newTask
);
setTask
(
newTask
);
};
};
...
@@ -142,15 +145,9 @@ export default function NewTaskForm({
...
@@ -142,15 +145,9 @@ export default function NewTaskForm({
/>
/>
<
/TableCell
>
<
/TableCell
>
{
/* <CustomTableCell
{...{
task,
name: "createdAt",
value: moment(task.createdAt).format("DD-MM-YYYY hh:mm A"),
}}
/> */
}
<
CustomTableCell
<
CustomTableCell
colSpan
=
{
2
}
colSpan
=
{
3
}
{...{
{...{
task
,
task
,
name
:
"title"
,
name
:
"title"
,
...
@@ -175,10 +172,10 @@ export default function NewTaskForm({
...
@@ -175,10 +172,10 @@ export default function NewTaskForm({
<
/TableCell
>
<
/TableCell
>
<
TableCell
>
<
TableCell
>
<
BasicSelect
<
BasicSelect
items
=
{
currentProject
?.
members
.
map
((
member
)
=>
({
items
=
{
currentProject
?
currentProject
?
.
members
.
map
((
member
)
=>
({
value
:
member
?.
user
?.
id
,
value
:
member
?.
user
?.
id
,
title
:
member
?.
user
?.
displayName
,
title
:
member
?.
user
?.
displayName
,
}))}
}))
:
null
}
task
=
{
task
}
task
=
{
task
}
onChange
=
{
onExecutorChange
}
onChange
=
{
onExecutorChange
}
name
=
"executor"
name
=
"executor"
...
@@ -187,13 +184,7 @@ export default function NewTaskForm({
...
@@ -187,13 +184,7 @@ export default function NewTaskForm({
/
>
/
>
<
/TableCell
>
<
/TableCell
>
{
/* <TableCell>
<MaterialUIPickers
task={task}
name="dateTimeStart"
onChange={onDateChange}
/>
</TableCell> */
}
<
TableCell
>
<
TableCell
>
<
MaterialUIPickers
<
MaterialUIPickers
...
@@ -245,7 +236,7 @@ export const header = [
...
@@ -245,7 +236,7 @@ export const header = [
numeric
:
false
,
numeric
:
false
,
disablePadding
:
false
,
disablePadding
:
false
,
label
:
"Заголовок"
,
label
:
"Заголовок"
,
colSpan
:
2
colSpan
:
3
},
},
{
{
id
:
"projectName"
,
id
:
"projectName"
,
...
...
planner-front/src/containers/UsersTasks/UsersTasks.js
View file @
5c5a9798
...
@@ -83,20 +83,6 @@ export default function UsersTasks() {
...
@@ -83,20 +83,6 @@ export default function UsersTasks() {
setRecievedTasks
(
newTasks
);
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
onDateChange
=
(
id
,
value
,
property
)
=>
{
const
newTasks
=
recievedTasks
.
map
((
task
)
=>
{
const
newTasks
=
recievedTasks
.
map
((
task
)
=>
{
...
...
planner-front/src/store/actions/tasksActions.js
View file @
5c5a9798
...
@@ -268,7 +268,7 @@ export const deleteDateTimeTask = (dateTimeTaskId) => {
...
@@ -268,7 +268,7 @@ export const deleteDateTimeTask = (dateTimeTaskId) => {
/** add new task in UserTas
l
ks Table */
/** add new task in UserTasks Table */
const
addTaskToUserTasksTableRequest
=
()
=>
{
const
addTaskToUserTasksTableRequest
=
()
=>
{
return
{
type
:
ADD_NEW_TASK_REQUEST
}
return
{
type
:
ADD_NEW_TASK_REQUEST
}
};
};
...
...
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