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
e23e8c1b
Commit
e23e8c1b
authored
Nov 16, 2022
by
Нелли Ибрагимова
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
сохранение для проверки функции редактирования задачи
parent
71855735
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
228 additions
and
3 deletions
+228
-3
NewTaskForm.js
...ner-front/src/components/MyTasksCompoments/NewTaskForm.js
+197
-0
constants.js
planner-front/src/constants.js
+1
-1
MyTasks.js
planner-front/src/containers/MyTasks/MyTasks.js
+30
-2
No files found.
planner-front/src/components/MyTasksCompoments/NewTaskForm.js
0 → 100644
View file @
e23e8c1b
import
*
as
React
from
"react"
;
import
{
Box
,
Table
,
TableBody
,
TableCell
,
TableContainer
,
TableRow
,
Paper
,
IconButton
,
Tooltip
,
Input
,
}
from
"@mui/material"
;
import
{
useState
,
useEffect
}
from
"react"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
Done
,
Edit
,
NavigateNextOutlined
}
from
"@mui/icons-material"
;
import
DeleteIcon
from
"@mui/icons-material/Delete"
;
import
TaskModal
from
"../../components/MyTasksCompoments/TaskModal/TaskModal"
;
import
moment
from
"moment"
;
import
CustomTableCell
from
"../../components/MyTasksCompoments/CustomTableCell"
;
import
MaterialUIPickers
from
"../../components/MyTasksCompoments/DateTimePicker/DateTimePicker"
;
import
BasicSelect
from
"../../components/UI/Select/Select"
;
import
{
fetchAllTasks
,
deleteTask
,
editTask
,
addTask
}
from
"../../store/actions/tasksActions"
;
export
default
function
NewTaskForm
(
props
)
{
// const onToggleEditModeDone = (id) => {
// const newTasks = recievedTasks.map((task) => {
// if (task.id === id) {
// return {
// ...task,
// isEditMode: false,
// readOnly: true,
// };
// }
// return task;
// });
// setRecievedTasks(newTasks);
// };
const
task
=
{
id
:
0
,
title
:
""
,
description
:
""
,
createdAt
:
""
,
dateTimeStart
:
null
,
dateTimeDue
:
null
,
accomplish
:
""
,
priority
:
""
,
author
:
{
name
:
""
,
},
executors
:
[
{
name
:
""
}
],
isEditMode
:
false
,
readOnly
:
true
};
const
onToggleEditMode
=
(
id
)
=>
{
console
.
log
(
task
)
return
{
...
task
,
isEditMode
:
true
,
readOnly
:
false
,
};
};
console
.
log
(
task
)
return
(
<
TableRow
hover
key
=
{
task
.
id
}
>
<
TableCell
component
=
"th"
scope
=
"row"
padding
=
"none"
><
/TableCell
>
<
CustomTableCell
{...{
task
,
name
:
"priority"
,
value
:
task
.
priority
,
onChange
:
props
.
onChange
,
}}
/
>
<
CustomTableCell
{...{
task
,
name
:
"createdAt"
,
value
:
task
.
createdAt
,
}}
/
>
<
CustomTableCell
{...{
task
,
name
:
"title"
,
value
:
task
.
title
,
onChange
:
props
.
onChange
,
onModalOpen
:
props
.
onModalOpen
,
}}
/
>
{
task
.
isEditMode
?
(
<
BasicSelect
items
=
{[
"project1"
,
"project2"
,
"project3"
]}
task
=
{
task
}
onChange
=
{
props
.
onChange
}
/
>
)
:
(
<
CustomTableCell
{...{
task
,
name
:
"project"
,
value
:
task
.
project
?.
title
,
onChange
:
props
.
onChange
,
}}
/
>
)}
<
CustomTableCell
{...{
task
,
name
:
"author"
,
value
:
task
.
author
.
displayName
,
onChange
:
props
.
onAuthorChange
,
}}
/
>
<
TableCell
>
<
MaterialUIPickers
task
=
{
task
}
name
=
"dateTimeStart"
onChange
=
{
props
.
onDateChange
}
/
>
<
/TableCell
>
<
TableCell
>
<
MaterialUIPickers
task
=
{
task
}
name
=
"dateTimeDue"
onChange
=
{
props
.
onDateChange
}
/
>
<
/TableCell
>
{
task
.
isEditMode
?
(
<
BasicSelect
items
=
{[
"opened"
,
"done"
,
"failed"
]}
task
=
{
task
}
onChange
=
{
props
.
onChange
}
/
>
)
:
(
<
CustomTableCell
{...{
task
,
name
:
"accomplish"
,
value
:
task
.
accomplish
,
}}
/
>
)}
<
TableCell
>
{
task
.
isEditMode
?
(
<
IconButton
aria
-
label
=
"done"
onClick
=
{()
=>
{
props
.
onToggleEditModeDone
(
task
.
id
);
props
.
HandleEditTask
(
task
)
}}
>
<
Done
/>
<
/IconButton
>
)
:
(
<
IconButton
aria
-
label
=
"edit"
onClick
=
{()
=>
onToggleEditMode
(
task
.
id
)}
>
<
Edit
/>
<
/IconButton
>
)}
<
/TableCell
>
<
TableCell
>
<
Tooltip
title
=
"Delete"
>
<
IconButton
onClick
=
{(
id
)
=>
{
props
.
deleteHandle
(
task
.
id
);
}}
>
<
DeleteIcon
/>
<
/IconButton
>
<
/Tooltip
>
<
/TableCell
>
<
/TableRow
>
);
}
planner-front/src/constants.js
View file @
e23e8c1b
export
const
apiUrl
=
"http://localhost:800
0
"
;
export
const
apiUrl
=
"http://localhost:800
1
"
;
export
const
uploadsUrl
=
`
${
apiUrl
}
/uploads`
;
planner-front/src/containers/MyTasks/MyTasks.js
View file @
e23e8c1b
...
...
@@ -24,6 +24,7 @@ import CustomTableCell from "../../components/MyTasksCompoments/CustomTableCell"
import
MaterialUIPickers
from
"../../components/MyTasksCompoments/DateTimePicker/DateTimePicker"
;
import
BasicSelect
from
"../../components/UI/Select/Select"
;
import
{
fetchAllTasks
,
deleteTask
,
editTask
,
addTask
}
from
"../../store/actions/tasksActions"
;
import
NewTaskForm
from
"../../components/MyTasksCompoments/NewTaskForm"
;
function
descendingComparator
(
a
,
b
,
orderBy
)
{
...
...
@@ -149,6 +150,7 @@ console.log(tasks)
};
const
onToggleEditMode
=
(
id
)
=>
{
console
.
log
(
id
)
const
newTasks
=
recievedTasks
.
map
((
task
)
=>
{
if
(
task
.
id
===
id
)
{
return
{
...
...
@@ -162,6 +164,20 @@ console.log(tasks)
setRecievedTasks
(
newTasks
);
};
const
onToggleEditModeDone
=
(
id
)
=>
{
const
newTasks
=
recievedTasks
.
map
((
task
)
=>
{
if
(
task
.
id
===
id
)
{
return
{
...
task
,
isEditMode
:
false
,
readOnly
:
true
,
};
}
return
task
;
});
setRecievedTasks
(
newTasks
);
};
const
HandleEditTask
=
(
task
)
=>
{
dispatch
(
editTask
(
task
))
}
...
...
@@ -264,10 +280,22 @@ console.log(tasks)
</TableCell>
</TableRow> */
}
{
/* <NewTaskForm
onChange={onChange}
onModalOpen={onModalOpen}
onAuthorChange={onAuthorChange}
onDateChange={onDateChange}
onToggleEditMode={onToggleEditMode}
onToggleEditModeDone={onToggleEditModeDone}
HandleEditTask={HandleEditTask}
deleteHandle={deleteHandle}
/> */
}
{
stableSort
(
recievedTasks
,
getComparator
(
order
,
orderBy
))
.
slice
(
page
*
rowsPerPage
,
page
*
rowsPerPage
+
rowsPerPage
)
.
map
((
task
,
index
)
=>
{
return
(
<
TableRow
hover
key
=
{
task
.
id
}
>
<
TableCell
component
=
"th"
...
...
@@ -311,7 +339,7 @@ console.log(tasks)
{...{
task
,
name
:
"project"
,
value
:
task
.
project
,
value
:
task
.
project
?.
title
,
onChange
:
onChange
,
}}
/
>
...
...
@@ -361,7 +389,7 @@ console.log(tasks)
{
task
.
isEditMode
?
(
<
IconButton
aria
-
label
=
"done"
onClick
=
{()
=>
{
onToggleEditMode
(
task
.
id
);
HandleEditTask
(
task
)
}}
onClick
=
{()
=>
{
onToggleEditMode
Done
(
task
.
id
);
HandleEditTask
(
task
)
}}
>
<
Done
/>
<
/IconButton
>
...
...
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