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
Hide 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>=>{
router
.
post
(
'/users'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
const
{
user
,
title
,
description
,
project
,
executor
,
dateTimeStart
,
dateTimeDue
,
dateTimeDeadLine
,
priority
}
=
req
.
body
;
const
newTask
=
new
Task
();
console
.
log
(
'project '
,
project
,
)
newTask
.
title
=
title
;
newTask
.
description
=
description
;
if
(
project
)
{
...
...
@@ -165,11 +166,13 @@ router.post('/users', auth, async(req:Request, res:Response):Promise<Response>=>
newTask
.
executor
=
executor
;
newTask
.
priority
=
priority
;
await
newTask
.
save
();
const
newDateTimeTask
=
new
DateTimeTask
();
if
(
dateTimeDue
&&
dateTimeStart
){
const
newDateTimeTask
=
new
DateTimeTask
();
newDateTimeTask
.
dateTimeStart
=
dateTimeStart
newDateTimeTask
.
dateTimeDue
=
dateTimeDue
newDateTimeTask
.
task
=
newTask
await
newDateTimeTask
.
save
()
}
return
res
.
send
({
newTask
});
})
...
...
planner-front/src/components/MyTasksCompoments/NewTaskForm.js
View file @
5c5a9798
...
...
@@ -127,14 +127,7 @@ export default function NewTaskForm({ projects, setAddTaskForm }) {
/>
<
/TableCell
>
<
CustomTableCell
{...{
task
,
name
:
"createdAt"
,
value
:
moment
(
task
.
createdAt
).
format
(
"DD-MM-YYYY hh:mm A"
),
width
:
"15%"
,
}}
/
>
<
CustomTableCell
{...{
...
...
@@ -161,14 +154,6 @@ export default function NewTaskForm({ projects, setAddTaskForm }) {
/
>
<
/TableCell
>
{
/* <TableCell>
<MaterialUIPickers
task={task}
name="dateTimeStart"
onChange={onDateChange}
/>
</TableCell> */
}
<
TableCell
style
=
{{
width
:
"20%"
,
paddingLeft
:
"0"
}}
>
<
MaterialUIPickers
task
=
{
task
}
...
...
@@ -213,12 +198,6 @@ export const header = [
disablePadding
:
true
,
label
:
"Приоритет"
,
},
{
id
:
"createdAt"
,
numeric
:
true
,
disablePadding
:
false
,
label
:
"Дата создания"
,
},
{
id
:
"title"
,
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}) {
console
.
log
(
'select name '
,
name
)
console
.
log
(
'select task '
,
task
)
console
.
log
(
'select items '
,
items
)
// console.log('select value ', value)
return
(
<
Box
sx
=
{{
minWidth
:
60
,
m
:
0
}}
>
<
FormControl
fullWidth
>
...
...
@@ -28,7 +27,7 @@ export default function BasicSelect({value,label,name,onChange,task,items}) {
<
MenuItem
key
=
{
index
}
value
=
{
item
.
value
}
>
{
item
.
title
}
<
/MenuItem
>
)):
<><
/>
}
)):
null
}
<
/Select
>
<
/FormControl
>
<
/Box
>
...
...
planner-front/src/components/UsersTasksCompoments/NewTaskForm.js
View file @
5c5a9798
...
...
@@ -40,7 +40,7 @@ export default function NewTaskForm({
dateTimeDeadLine
:
null
,
dateTimeTasks
:
[],
dateTimeDue
:
null
,
project
:
[]
,
project
:
null
,
accomplish
:
"opened"
,
priority
:
"B"
,
author
:
{
id
:
user
.
id
},
...
...
@@ -48,8 +48,8 @@ export default function NewTaskForm({
executor
:
null
,
isEditMode
:
true
,
});
console
.
log
(
'NewTaskForm currentProject '
,
currentProject
,
'projects '
,
projects
)
const
[
modal
,
setModal
]
=
useState
(
false
);
console
.
log
(
'NewTaskForm currentProject '
,
currentProject
)
const
onModalOpen
=
(
event
,
task
)
=>
{
event
.
stopPropagation
();
...
...
@@ -79,9 +79,12 @@ export default function NewTaskForm({
const
onExecutorChange
=
(
e
,
task
)
=>
{
const
{
value
,
name
}
=
e
.
target
.
value
;
const
executorMember
=
currentProject
.
find
((
member
)
=>
member
.
user
.
id
===
value
);
let
executorMember
=
null
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
);
};
...
...
@@ -142,15 +145,9 @@ export default function NewTaskForm({
/>
<
/TableCell
>
{
/* <CustomTableCell
{...{
task,
name: "createdAt",
value: moment(task.createdAt).format("DD-MM-YYYY hh:mm A"),
}}
/> */
}
<
CustomTableCell
colSpan
=
{
2
}
colSpan
=
{
3
}
{...{
task
,
name
:
"title"
,
...
...
@@ -175,10 +172,10 @@ export default function NewTaskForm({
<
/TableCell
>
<
TableCell
>
<
BasicSelect
items
=
{
currentProject
?.
members
.
map
((
member
)
=>
({
items
=
{
currentProject
?
currentProject
?
.
members
.
map
((
member
)
=>
({
value
:
member
?.
user
?.
id
,
title
:
member
?.
user
?.
displayName
,
}))}
}))
:
null
}
task
=
{
task
}
onChange
=
{
onExecutorChange
}
name
=
"executor"
...
...
@@ -187,13 +184,7 @@ export default function NewTaskForm({
/
>
<
/TableCell
>
{
/* <TableCell>
<MaterialUIPickers
task={task}
name="dateTimeStart"
onChange={onDateChange}
/>
</TableCell> */
}
<
TableCell
>
<
MaterialUIPickers
...
...
@@ -245,7 +236,7 @@ export const header = [
numeric
:
false
,
disablePadding
:
false
,
label
:
"Заголовок"
,
colSpan
:
2
colSpan
:
3
},
{
id
:
"projectName"
,
...
...
planner-front/src/containers/UsersTasks/UsersTasks.js
View file @
5c5a9798
...
...
@@ -83,20 +83,6 @@ export default function UsersTasks() {
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
newTasks
=
recievedTasks
.
map
((
task
)
=>
{
...
...
planner-front/src/store/actions/tasksActions.js
View file @
5c5a9798
...
...
@@ -268,7 +268,7 @@ export const deleteDateTimeTask = (dateTimeTaskId) => {
/** add new task in UserTas
l
ks Table */
/** add new task in UserTasks Table */
const
addTaskToUserTasksTableRequest
=
()
=>
{
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