#89 added delete edit buttons to the fall out datetimeTals

parent a60811ad
...@@ -13,6 +13,7 @@ import { ...@@ -13,6 +13,7 @@ import {
} from "@mui/material"; } from "@mui/material";
import { Done, Edit } from "@mui/icons-material"; import { Done, Edit } from "@mui/icons-material";
import RemoveIcon from '@mui/icons-material/Remove';
import DeleteIcon from "@mui/icons-material/Delete"; import DeleteIcon from "@mui/icons-material/Delete";
import moment from "moment"; import moment from "moment";
import CustomTableCell from "../CustomTableCell"; import CustomTableCell from "../CustomTableCell";
...@@ -29,6 +30,8 @@ const TableRowTask= ({ ...@@ -29,6 +30,8 @@ const TableRowTask= ({
task, task,
deleteHandle, deleteHandle,
handleEditTask, handleEditTask,
deleteDateTimeTask,
handleEditDateTimeTask,
onChange, onChange,
onModalOpen, onModalOpen,
onProjectChange, onProjectChange,
...@@ -56,6 +59,9 @@ const TableRowTask= ({ ...@@ -56,6 +59,9 @@ const TableRowTask= ({
return weekDays[date.day()]; return weekDays[date.day()];
} }
// const handleEditDateTimeTask =(dateTimeTask)=>{
// console.log('edit handleEditDateTimeTask')
// }
return ( return (
...@@ -304,13 +310,16 @@ const TableRowTask= ({ ...@@ -304,13 +310,16 @@ const TableRowTask= ({
<Typography variant="h6" gutterBottom component="div"> <Typography variant="h6" gutterBottom component="div">
Расписание Расписание
</Typography> </Typography>
<Table size="small" aria-label="purchases"> <Table size="small" aria-label="purchases" sx={{
backgroundColor: "#ebebeb"}}>
<TableHead> <TableHead>
<TableRow> <TableRow>
<TableCell colSpan={10} >Дата создания</TableCell> <TableCell colSpan={10} >Дата создания</TableCell>
<TableCell align="right">День недели</TableCell> <TableCell align="right">День недели</TableCell>
<TableCell align="right">Начало</TableCell> <TableCell align="right">Начало</TableCell>
<TableCell align="center" colSpan={1}>Окончание</TableCell> <TableCell align="center" colSpan={1}>Окончание</TableCell>
<TableCell align="center" ></TableCell>
<TableCell align="center" ></TableCell>
</TableRow> </TableRow>
</TableHead> </TableHead>
<TableBody> <TableBody>
...@@ -332,6 +341,46 @@ const TableRowTask= ({ ...@@ -332,6 +341,46 @@ const TableRowTask= ({
<TableCell align="center" colSpan={1}> <TableCell align="center" colSpan={1}>
{timeTransform(dateTimeTask.dateTimeDue)} {timeTransform(dateTimeTask.dateTimeDue)}
</TableCell> </TableCell>
{/* Edit option datetimeTask */}
<TableCell style={{width:'0%'}}>
<Tooltip title="Редактировать Копию">
{task.isEditMode ? (
<IconButton
aria-label="done"
onClick={() => {
onToggleEditModeDone(dateTimeTask.id);
handleEditDateTimeTask(dateTimeTask);
}}
>
<Done />
</IconButton>
) : (
<IconButton
aria-label="edit"
onClick={() => onToggleEditMode(dateTimeTask.id)}
>
<Edit />
</IconButton>
)}
</Tooltip>
</TableCell >
{/* delete option datetimeTask */}
{task.author.id===user.id ?
(<TableCell style={{width:'0%'}}>
<Tooltip title="Удалить Копию">
<IconButton
onClick={(id) => {
deleteDateTimeTask(dateTimeTask.id);
}}
>
<RemoveIcon />
</IconButton>
</Tooltip>
</TableCell>):null}
</TableRow> </TableRow>
))} ))}
</TableBody> </TableBody>
......
...@@ -162,6 +162,16 @@ useEffect(() => { ...@@ -162,6 +162,16 @@ useEffect(() => {
dispatch(deleteTask(id)); dispatch(deleteTask(id));
}; };
const deleteDateTimeTask=(dateTImeTaskId)=>{
console.log('delete by dateTImeTaskId')
// dispatch(deleteDateTimeTask(dateTImeTaskId))
}
const handleEditDateTimeTask=(dateTimeTask)=>{
console.log('edit by dateTImeTask')
// dispatch(handleEditDateTimeTask(dateTimeTask))
}
const onModalOpen = (event, task) => { const onModalOpen = (event, task) => {
event.stopPropagation(); event.stopPropagation();
...@@ -261,6 +271,8 @@ console.log('tasks', tasks) ...@@ -261,6 +271,8 @@ console.log('tasks', tasks)
task={task} task={task}
deleteHandle={deleteHandle} deleteHandle={deleteHandle}
handleEditTask ={handleEditTask} handleEditTask ={handleEditTask}
handleEditDateTimeTask={handleEditDateTimeTask}
deleteDateTimeTask={deleteDateTimeTask}
onChange={onChange} onChange={onChange}
onModalOpen={onModalOpen} onModalOpen={onModalOpen}
onProjectChange={onProjectChange} onProjectChange={onProjectChange}
......
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