Commit a2e91f14 authored by Ermolaev Timur's avatar Ermolaev Timur

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

parent 0577363c
...@@ -26,24 +26,24 @@ const exampleTasks=[ ...@@ -26,24 +26,24 @@ const exampleTasks=[
dateCreated:"26.10.2022" dateCreated:"26.10.2022"
},{ },{
user:"first", user:"first",
title:"задача3", title:"first",
description:"описание задачи11111", description:"описание задачи11111",
priority:"A", priority:"A",
author:"Ivan", author:"Ivan",
executor:"Arman", executor:"Arman",
dateTimeStart:"5.12.2022 16:00:00", dateTimeStart:"5.11.2022 16:00:00",
dateTimeDue:"27.10.2022 14:20:00", dateTimeDue:"5.11.2022 17:00:00",
id:1, id:1,
dateCreated:"26.10.2022" dateCreated:"26.10.2022"
},{ },{
user:"first", user:"first",
title:"задача на 4 xfcf", title:"second",
description:"описание задачи11111", description:"описание задачи11111",
priority:"A", priority:"A",
author:"Ivan", author:"Ivan",
executor:"Arman", executor:"Arman",
dateTimeStart:"5.11.2022 16:00:00", dateTimeStart:"5.11.2022 16:00:00",
dateTimeDue:"5.11.2022 21:20:00", dateTimeDue:"5.11.2022 17:00:00",
id:1, id:1,
dateCreated:"26.10.2022" dateCreated:"26.10.2022"
} }
...@@ -61,7 +61,7 @@ function MonthCalendarBody({month, year}) { ...@@ -61,7 +61,7 @@ function MonthCalendarBody({month, year}) {
setNewTasksWithInfoForCell(exampleTasks, month, year) setNewTasksWithInfoForCell(exampleTasks, month, year)
}, [month, year]) }, [month, year])
const getDaysInMonth = (month, year) => { const getDaysInMonth = () => {
return new Date(year, month + 1, 0).getDate(); return new Date(year, month + 1, 0).getDate();
} }
...@@ -100,6 +100,7 @@ function MonthCalendarBody({month, year}) { ...@@ -100,6 +100,7 @@ function MonthCalendarBody({month, year}) {
const createTaskInCellHandler = (month, year, dayOfWeek, dayNumber, dayHour) => { const createTaskInCellHandler = (month, year, dayOfWeek, dayNumber, dayHour) => {
const newTasks = [...tasksForCell] const newTasks = [...tasksForCell]
const newTask = { const newTask = {
id: Date.now(),
user:"first", user:"first",
title:"Новая", title:"Новая",
description:"описание задачи11111", description:"описание задачи11111",
...@@ -139,8 +140,18 @@ function MonthCalendarBody({month, year}) { ...@@ -139,8 +140,18 @@ function MonthCalendarBody({month, year}) {
setDaysInMonth(newDaysInMonth) setDaysInMonth(newDaysInMonth)
} }
const onChangeCellTaskTitle = (e, id) => { const onChangeCellTaskTitle = (e, task) => {
const {name, value} = e.target; 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 ( return (
...@@ -193,7 +204,7 @@ function MonthCalendarBody({month, year}) { ...@@ -193,7 +204,7 @@ function MonthCalendarBody({month, year}) {
variant="standard" variant="standard"
value={task.title} value={task.title}
name='title' name='title'
onChange={(e)=>{onChangeCellTaskTitle(e)}}></TextField> onChange={(e)=>{onChangeCellTaskTitle(e, task)}}></TextField>
</Grid> : null} </Grid> : null}
</Grid> </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