Commit a2e91f14 authored by Ermolaev Timur's avatar Ermolaev Timur

#24 небольшие изменения

parent 0577363c
......@@ -26,24 +26,24 @@ const exampleTasks=[
dateCreated:"26.10.2022"
},{
user:"first",
title:"задача3",
title:"first",
description:"описание задачи11111",
priority:"A",
author:"Ivan",
executor:"Arman",
dateTimeStart:"5.12.2022 16:00:00",
dateTimeDue:"27.10.2022 14:20:00",
dateTimeStart:"5.11.2022 16:00:00",
dateTimeDue:"5.11.2022 17:00:00",
id:1,
dateCreated:"26.10.2022"
},{
user:"first",
title:"задача на 4 xfcf",
title:"second",
description:"описание задачи11111",
priority:"A",
author:"Ivan",
executor:"Arman",
dateTimeStart:"5.11.2022 16:00:00",
dateTimeDue:"5.11.2022 21:20:00",
dateTimeDue:"5.11.2022 17:00:00",
id:1,
dateCreated:"26.10.2022"
}
......@@ -61,7 +61,7 @@ function MonthCalendarBody({month, year}) {
setNewTasksWithInfoForCell(exampleTasks, month, year)
}, [month, year])
const getDaysInMonth = (month, year) => {
const getDaysInMonth = () => {
return new Date(year, month + 1, 0).getDate();
}
......@@ -100,6 +100,7 @@ function MonthCalendarBody({month, year}) {
const createTaskInCellHandler = (month, year, dayOfWeek, dayNumber, dayHour) => {
const newTasks = [...tasksForCell]
const newTask = {
id: Date.now(),
user:"first",
title:"Новая",
description:"описание задачи11111",
......@@ -139,8 +140,18 @@ function MonthCalendarBody({month, year}) {
setDaysInMonth(newDaysInMonth)
}
const onChangeCellTaskTitle = (e, id) => {
const {name, value} = e.target;
const onChangeCellTaskTitle = (e, task) => {
const value = e.target.value;
const name = e.target.name;
const { id } = task;
const newTasks = tasksForCell.map(task => {
if (task.id === id) {
return { ...task, [name]: value };
}
return task;
});
setTasksForCell(newTasks);
exampleTasks = [...newTasks]
}
return (
......@@ -193,7 +204,7 @@ function MonthCalendarBody({month, year}) {
variant="standard"
value={task.title}
name='title'
onChange={(e)=>{onChangeCellTaskTitle(e)}}></TextField>
onChange={(e)=>{onChangeCellTaskTitle(e, task)}}></TextField>
</Grid> : null}
</Grid>
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment