вывела в ячейке Дата и время выполнения дату , время старта, время завершения и…

вывела в ячейке Дата и время выполнения дату , время старта, время завершения и количество часов на задачу
parent 2bceb759
import * as React from "react";
import TableCell from "@mui/material/TableCell";
import Input from "@mui/material/Input";
import moment from "moment";
const CustomTableCell = ({task,
name,
value,
value2,
value3,
onChange,
onModalOpen,
placeholder,
user
}) => {
const styles = { width: "auto", height: "10px"};
const divStyle={display:"flex",justifyContent:"space-between", flexDirection:"column",fontSize:"12px"}
const duration = moment.duration(moment(task.dateTimeDue).diff(moment(task.dateTimeStart)));
const hours = Math.round(duration.asHours());
if (task) {
return (
......@@ -22,7 +26,7 @@ const CustomTableCell = ({task,
align="left"
style={styles}
>
{task.isEditMode && onChange && name==!"author" && task.author.id==user.id ? (
{task.isEditMode && onChange && name!=="author" && task.author.id===user.id ? (
<Input
placeholder={placeholder}
value={value}
......@@ -30,38 +34,16 @@ const CustomTableCell = ({task,
onChange={(e) => onChange(e, task)}
style={styles}
/>
) : (
) : name!=="dateTimeStart" ? (
<span>{value}</span>
)}
</TableCell>
</>
);
}
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}
/>
) : (
<>
):(
<div style={divStyle}>
<span>{value}</span>
<div>{"valuehjlhlh"}</div>
<span>{value2}</span>
</>
)}
<span>часы:+{hours}</span>
</div>
)
}
</TableCell>
</>
);
......
......@@ -46,6 +46,8 @@ export default function EnhancedTable() {
});
const [projects,setProjects]=useState(['1','2'])
useEffect(() => {
dispatch(fetchAllTasks());
filterProjectsNamesFromTasks()
......@@ -207,7 +209,6 @@ useEffect(() => {
}
let uniqueTitlesProjects = [...new Set(rawSetProjectNames)];
setProjects(uniqueTitlesProjects)
}
}
......@@ -378,31 +379,21 @@ console.log(tasks)
name: "dateTimeStart",
value: moment(task.dateTimeStart)
.utc()
.format("DD-MM-YYYY hh:mm A"),
.format("DD-MM-YYYY "),
value2:moment(task.dateTimeStart)
.utc()
.format("hh:mm A")+
"-"+
.format("hh:mm A")+"-"+
moment(task.dateTimeDue)
.utc()
.format("hh:mm A"),
user:user
}}>
<span>"время заершения", {moment(task.dateTimeDue)
<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
}}
/> */}
</>
)}
......
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