mirror of
https://github.com/sergeyyarkov/todo-app.git
synced 2026-10-11 10:29:14 +03:00
render upd
This commit is contained in:
parent
7f5d9d260f
commit
792d013c08
@ -20,7 +20,7 @@ const CreateTodoModal = ({ isModalOpen, handleCloseModal }) => {
|
|||||||
const data = {
|
const data = {
|
||||||
title: elements.title.value,
|
title: elements.title.value,
|
||||||
description: elements.description.value,
|
description: elements.description.value,
|
||||||
category: elements.category.value,
|
categoryId: elements.category.value,
|
||||||
deadline: elements.deadline.value
|
deadline: elements.deadline.value
|
||||||
}
|
}
|
||||||
handleCloseModal()
|
handleCloseModal()
|
||||||
@ -87,7 +87,7 @@ const CreateTodoModal = ({ isModalOpen, handleCloseModal }) => {
|
|||||||
onChange={handleFieldChange}
|
onChange={handleFieldChange}
|
||||||
label="Категория"
|
label="Категория"
|
||||||
>
|
>
|
||||||
{categories.map((category, i) => <MenuItem key={i} value={category._id.$oid}>{category._id.$oid}</MenuItem>)}
|
{categories.map((category, i) => <MenuItem key={i} value={category._id.$oid}>{category.title}</MenuItem>)}
|
||||||
</Select>
|
</Select>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<TextField
|
<TextField
|
||||||
|
|||||||
@ -13,11 +13,11 @@ const UpdateTodoModal = ({ isModalOpen, handleCloseModal, selectedTodo, setSelec
|
|||||||
const data = {
|
const data = {
|
||||||
title: elements.title.value,
|
title: elements.title.value,
|
||||||
description: elements.description.value,
|
description: elements.description.value,
|
||||||
category: elements.category.value,
|
categoryId: elements.category.value,
|
||||||
deadline: elements.deadline.value
|
deadline: elements.deadline.value
|
||||||
}
|
}
|
||||||
handleCloseModal()
|
handleCloseModal()
|
||||||
console.log('Request on update:', data)
|
console.log('Request on update todo:', data)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleFieldChange = e => {
|
const handleFieldChange = e => {
|
||||||
@ -75,7 +75,7 @@ const UpdateTodoModal = ({ isModalOpen, handleCloseModal, selectedTodo, setSelec
|
|||||||
onChange={handleFieldChange}
|
onChange={handleFieldChange}
|
||||||
label="Категория"
|
label="Категория"
|
||||||
>
|
>
|
||||||
{categories.map((category, i) => <MenuItem key={i} value={category._id.$oid}>{category._id.$oid}</MenuItem>)}
|
{categories.map((category, i) => <MenuItem key={i} value={category._id.$oid}>{category.title}</MenuItem>)}
|
||||||
</Select>
|
</Select>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<TextField
|
<TextField
|
||||||
|
|||||||
@ -7,6 +7,9 @@ import DeleteIcon from '@material-ui/icons/Delete'
|
|||||||
import AlarmIcon from '@material-ui/icons/Alarm';
|
import AlarmIcon from '@material-ui/icons/Alarm';
|
||||||
import EditIcon from '@material-ui/icons/Edit';
|
import EditIcon from '@material-ui/icons/Edit';
|
||||||
|
|
||||||
|
|
||||||
|
import categories from '../../db/categories.json'
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
alarmIcon: {
|
alarmIcon: {
|
||||||
marginRight: 10
|
marginRight: 10
|
||||||
@ -62,7 +65,7 @@ const Todos = ({ data, fromTrashContainer }) => {
|
|||||||
<Card>
|
<Card>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<Typography className={classes.cardCategoryHeading} color="textSecondary" gutterBottom>
|
<Typography className={classes.cardCategoryHeading} color="textSecondary" gutterBottom>
|
||||||
CategoryId: {todo.categoryId}
|
{categories.find(category => category._id.$oid === todo.categoryId).title}
|
||||||
<span className={classes.cardAlarm}>
|
<span className={classes.cardAlarm}>
|
||||||
<AlarmIcon className={classes.alarmIcon} color='action' />
|
<AlarmIcon className={classes.alarmIcon} color='action' />
|
||||||
{todo.deadline}
|
{todo.deadline}
|
||||||
|
|||||||
@ -22,12 +22,4 @@
|
|||||||
"description": "some description",
|
"description": "some description",
|
||||||
"updatedAt": "2020-04-04",
|
"updatedAt": "2020-04-04",
|
||||||
"createdAt": "2020-01-01"
|
"createdAt": "2020-01-01"
|
||||||
},{
|
|
||||||
"_id": {
|
|
||||||
"$oid": "5ede83c823d3141d80145f2b"
|
|
||||||
},
|
|
||||||
"title": "upd category title",
|
|
||||||
"description": "upd category description",
|
|
||||||
"createdAt": "2020-06-08T18:30:32.811Z",
|
|
||||||
"updatedAt": "2020-06-08T18:32:34.962Z"
|
|
||||||
}]
|
}]
|
||||||
Loading…
x
Reference in New Issue
Block a user