изменила названия колонок, вывела данные в колонку дедлайн, вывела кнопку перехода в календарь

parent d19dd8ff
...@@ -5,6 +5,7 @@ import Input from "@mui/material/Input"; ...@@ -5,6 +5,7 @@ import Input from "@mui/material/Input";
const CustomTableCell = ({task, const CustomTableCell = ({task,
name, name,
value, value,
value2,
onChange, onChange,
onModalOpen, onModalOpen,
placeholder, placeholder,
...@@ -36,6 +37,35 @@ const CustomTableCell = ({task, ...@@ -36,6 +37,35 @@ const CustomTableCell = ({task,
</> </>
); );
} }
if (task && name=="dateTimeStart") {
return (
<>
<TableCell
onClick={(e) => (onModalOpen ? onModalOpen(e, task) : null)}
align="left"
style={styles}
>
{task.isEditMode && onChange && name==!"author" && task.author.id==user.id ? (
<Input
placeholder={placeholder}
value={value}
name={name}
onChange={(e) => onChange(e, task)}
style={styles}
/>
) : (
<>
<span>{value}</span>
<div>{"valuehjlhlh"}</div>
<span>{value2}</span>
</>
)}
</TableCell>
</>
);
}
}; };
export default CustomTableCell; export default CustomTableCell;
...@@ -25,7 +25,7 @@ import MaterialUIPickers from "../../components/MyTasksCompoments/DateTimePicker ...@@ -25,7 +25,7 @@ import MaterialUIPickers from "../../components/MyTasksCompoments/DateTimePicker
import BasicSelect from "../../components/UI/Select/Select"; import BasicSelect from "../../components/UI/Select/Select";
import { fetchAllTasks, deleteTask,editTask} from "../../store/actions/tasksActions"; import { fetchAllTasks, deleteTask,editTask} from "../../store/actions/tasksActions";
import NewTaskForm from "../../components/MyTasksCompoments/NewTaskForm"; import NewTaskForm from "../../components/MyTasksCompoments/NewTaskForm";
import CalendarMonthIcon from '@mui/icons-material/CalendarMonth';
export default function EnhancedTable() { export default function EnhancedTable() {
...@@ -221,7 +221,7 @@ useEffect(() => { ...@@ -221,7 +221,7 @@ useEffect(() => {
return results; return results;
}, []); }, []);
console.log(tasks)
if ( if (
tasks && tasks &&
tasks?.length > 0 && tasks?.length > 0 &&
...@@ -353,17 +353,69 @@ useEffect(() => { ...@@ -353,17 +353,69 @@ useEffect(() => {
user:user user:user
}} }}
/> />
{task.isEditMode && task.author.id===user.id ? (
<TableCell>
{/* <MaterialUIPickers
task={task}
name="dateTimeStart"
onChange={onDateChange}
user={user}
/> */}
<TableCell> <TableCell>
<Tooltip title="Перейти в календарь">
<IconButton
onClick={(id) => { deleteHandle(task.id);}}
>
<CalendarMonthIcon />
</IconButton>
</Tooltip>
</TableCell>
</TableCell>
) : (<>
<CustomTableCell
{...{
task,
name: "dateTimeStart",
value: moment(task.dateTimeStart)
.utc()
.format("DD-MM-YYYY hh:mm A"),
value2:moment(task.dateTimeStart)
.utc()
.format("hh:mm A")+
"-"+
moment(task.dateTimeDue)
.utc()
.format("hh:mm A"),
user:user
}}>
<span>"время заершения", {moment(task.dateTimeDue)
.utc()
.format("hh:mm A")}</span>
</CustomTableCell>
{/* <CustomTableCell
{...{
task,
name: "dateTimeStart",
value: moment(task.dateTimeDue)
.utc()
.format("DD-MM-YYYY hh:mm A"),
user:user
}}
/> */}
</>
)}
{/* <TableCell>
<MaterialUIPickers <MaterialUIPickers
task={task} task={task}
name="dateTimeStart" name="dateTimeStart"
onChange={onDateChange} onChange={onDateChange}
user={user} user={user}
/> />
</TableCell> */}
</TableCell> {task.isEditMode && task.author.id===user.id ? (
<TableCell> <TableCell>
<MaterialUIPickers <MaterialUIPickers
task={task} task={task}
...@@ -372,7 +424,18 @@ useEffect(() => { ...@@ -372,7 +424,18 @@ useEffect(() => {
user={user} user={user}
/> />
</TableCell> </TableCell>
) : (
<CustomTableCell
{...{
task,
name: "dateTimeDue",
value: moment(task.dateTimeDue)
.utc()
.format("DD-MM-YYYY hh:mm A"),
user:user
}}
/>
)}
{task.isEditMode ? ( {task.isEditMode ? (
<TableCell> <TableCell>
<BasicSelect <BasicSelect
......
...@@ -49,13 +49,13 @@ const headCells = [ ...@@ -49,13 +49,13 @@ const headCells = [
id: "dateTimeStart", id: "dateTimeStart",
numeric: true, numeric: true,
disablePadding: false, disablePadding: false,
label: "Дата начала", label: "Дата и время выполнения",
}, },
{ {
id: "dateTimeDue", id: "dateTimeDue",
numeric: true, numeric: true,
disablePadding: false, disablePadding: false,
label: ата завершения", label: едлайн",
}, },
{ {
id: "accomplish", id: "accomplish",
......
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