Commit c8c720f0 authored by Ermolaev Timur's avatar Ermolaev Timur

Merge branch 'development' of…

Merge branch 'development' of ssh://git.attractor-school.com:30022/apollo64/crm-team-one into task-85-feature/create_week_calendar
parents e82f60d5 2c79ffcc
...@@ -27,7 +27,7 @@ import { User } from './User'; ...@@ -27,7 +27,7 @@ import { User } from './User';
@Column({ name: 'token', type: 'varchar',length:100, unique: true, nullable:true }) @Column({ name: 'token', type: 'varchar',length:100, unique: true, nullable:true })
token!: string; token!: string;
@OneToOne(()=>User,{nullable: false, eager:true}) @OneToOne(()=>User,{nullable: false, eager:true, onDelete:"CASCADE"})
@JoinColumn() @JoinColumn()
user!:User; user!:User;
......
...@@ -3,19 +3,29 @@ import TableCell from "@mui/material/TableCell"; ...@@ -3,19 +3,29 @@ import TableCell from "@mui/material/TableCell";
import Input from "@mui/material/Input"; import Input from "@mui/material/Input";
import moment from "moment"; import moment from "moment";
const CustomTableCell = ({task, const CustomTableCell = ({
task,
name, name,
value, value,
value2, value2,
value3,
onChange, onChange,
onModalOpen, onModalOpen,
placeholder, placeholder,
user user,
}) => { }) => {
const styles = { width: "auto", height: "10px"}; const styles = placeholder ? { width: "100%" } : { width: "auto" };
const divStyle={display:"flex",justifyContent:"space-between", flexDirection:"column",fontSize:"12px"} const divStyle = {
const duration = moment.duration(moment(task.dateTimeTasks[0]?.dateTimeDue).diff(moment(task.dateTimeTasks[0]?.dateTimeStart))); display: "flex",
justifyContent: "space-between",
flexDirection: "column",
fontSize: "12px",
};
const duration = moment.duration(
moment(task?.dateTimeTasks[0]?.dateTimeDue).diff(
moment(task?.dateTimeTasks[0]?.dateTimeStart)
)
);
const hours = Math.round(duration.asHours()); const hours = Math.round(duration.asHours());
if (task) { if (task) {
...@@ -24,9 +34,13 @@ const CustomTableCell = ({task, ...@@ -24,9 +34,13 @@ const CustomTableCell = ({task,
<TableCell <TableCell
onClick={(e) => (onModalOpen ? onModalOpen(e, task) : null)} onClick={(e) => (onModalOpen ? onModalOpen(e, task) : null)}
align="left" align="left"
style={styles} // style={styles}
> >
{task.isEditMode && onChange && name!=="author" && task.author.id===user.id ? ( {(task.isEditMode &&
onChange &&
name !== "author" &&
task.author?.id === user?.id) ||
placeholder ? (
<Input <Input
placeholder={placeholder} placeholder={placeholder}
value={value} value={value}
...@@ -34,16 +48,15 @@ const CustomTableCell = ({task, ...@@ -34,16 +48,15 @@ const CustomTableCell = ({task,
onChange={(e) => onChange(e, task)} onChange={(e) => onChange(e, task)}
style={styles} style={styles}
/> />
) : name!=="dateTimeStart" ? ( ) : name !== "dateTimeStart" ? (
<span>{value}</span> <span>{value}</span>
):( ) : (
<div style={divStyle}> <div style={divStyle}>
<span>{value}</span> <span>{value}</span>
<span>{value2}</span> <span>{value2}</span>
<span>часы:+{hours}</span> <span>часы:{hours}</span>
</div> </div>
) )}
}
</TableCell> </TableCell>
</> </>
); );
......
...@@ -9,10 +9,10 @@ export default function MaterialUIPickers(props) { ...@@ -9,10 +9,10 @@ export default function MaterialUIPickers(props) {
return ( return (
<LocalizationProvider <LocalizationProvider
dateAdapter={AdapterMoment} dateAdapter={AdapterMoment}
sx={{ width: "auto", fontSize: 5, fontWeight: "200" }} sx={{ width: "100%", fontSize: 5, fontWeight: "200" }}
> >
<DateTimePicker <DateTimePicker
inputFormat="DD-MM-YYYY hh:mm A" inputFormat="DD-MM-YY kk:mm A"
disabled={props.task.readOnly} disabled={props.task.readOnly}
renderInput={(params) => ( renderInput={(params) => (
<TextField <TextField
......
...@@ -19,29 +19,45 @@ import CustomTableCell from "./CustomTableCell"; ...@@ -19,29 +19,45 @@ import CustomTableCell from "./CustomTableCell";
import MaterialUIPickers from "./DateTimePicker/DateTimePicker"; import MaterialUIPickers from "./DateTimePicker/DateTimePicker";
import BasicSelect from "../UI/Select/Select"; import BasicSelect from "../UI/Select/Select";
import { addTask } from "../../store/actions/tasksActions"; import { addTask } from "../../store/actions/tasksActions";
import TaskModal from "./TaskModal/TaskModal";
export default function NewTaskForm({projects,setAddTaskForm,tasks}) { export default function NewTaskForm({
projects,
setAddTaskForm,
}) {
const dispatch = useDispatch(); const dispatch = useDispatch();
const user = useSelector((state) => state.users.user); const user = useSelector((state) => state.users.user);
const currentDateTime = new Date(); const currentDateTime = new Date();
const dateTime = moment(currentDateTime).utc().format(); const dateTime = moment(currentDateTime).utc().format();
const [task, setTask] = useState({ const [task, setTask] = useState({
id: 0, id: 0,
title: "", title: "",
description: "", description: "",
createdAt: dateTime, createdAt: dateTime,
dateTimeStart: null, dateTimeStart: null,
dateTimeDeadLine: null,
dateTimeTasks: [],
dateTimeDue: null, dateTimeDue: null,
project: projects[0], project: projects[0],
accomplish: "opened", accomplish: "opened",
priority: "B", priority: "B",
author: { id: user.id },
authorDisplayName: user.displayName, authorDisplayName: user.displayName,
executors: [], executors: [],
isEditMode: true, isEditMode: true,
}); });
const [modal, setModal] = useState(false);
const onModalOpen = (event, task) => {
event.stopPropagation();
setModal(true);
};
const handleClose = () => {
setModal(false);
};
const onChange = (e, task) => { const onChange = (e, task) => {
const value = e.target.value; const value = e.target.value;
const name = e.target.name; const name = e.target.name;
...@@ -78,8 +94,6 @@ export default function NewTaskForm({projects,setAddTaskForm,tasks}) { ...@@ -78,8 +94,6 @@ export default function NewTaskForm({projects,setAddTaskForm,tasks}) {
<TableContainer <TableContainer
style={{ style={{
backgroundColor: "#E8E8E8", backgroundColor: "#E8E8E8",
display: "flex",
alignItems: "center",
marginBottom: "2em", marginBottom: "2em",
}} }}
> >
...@@ -122,23 +136,14 @@ export default function NewTaskForm({projects,setAddTaskForm,tasks}) { ...@@ -122,23 +136,14 @@ export default function NewTaskForm({projects,setAddTaskForm,tasks}) {
value: moment(task.createdAt).format("DD-MM-YYYY hh:mm A"), value: moment(task.createdAt).format("DD-MM-YYYY hh:mm A"),
}} }}
/> />
<CustomTableCell <CustomTableCell
{...{ {...{
task, task,
name: "title", name: "title",
value: task.title, value: task.title,
onChange: onChange, onModalOpen,
placeholder: "Введите название задачи", user: user,
}} placeholder: "Кликните для ввода информации по задаче"
/>
<CustomTableCell
{...{
task,
name: "description",
value: task.description,
onChange: onChange,
placeholder: "Введите описание задачи",
}} }}
/> />
...@@ -155,44 +160,22 @@ export default function NewTaskForm({projects,setAddTaskForm,tasks}) { ...@@ -155,44 +160,22 @@ export default function NewTaskForm({projects,setAddTaskForm,tasks}) {
/> />
</TableCell> </TableCell>
<CustomTableCell {/* <TableCell>
{...{
task,
name: "author",
value: user.displayName,
}}
/>
<TableCell>
<MaterialUIPickers <MaterialUIPickers
task={task} task={task}
name="dateTimeStart" name="dateTimeStart"
onChange={onDateChange} onChange={onDateChange}
/> />
</TableCell> </TableCell> */}
<TableCell> <TableCell>
<MaterialUIPickers <MaterialUIPickers
task={task} task={task}
name="dateTimeDue" name="dateTimeDeadLine"
onChange={onDateChange} onChange={onDateChange}
/> />
</TableCell> </TableCell>
<TableCell>
<BasicSelect
items={[
{ value: "opened", title: "opened" },
{ value: "done", title: "done" },
{ value: "failed", title: "failed" },
]}
task={task}
onChange={onChange}
name="accomplish"
value={task.accomplish}
/>
</TableCell>
<TableCell> <TableCell>
<Tooltip title="Добавить"> <Tooltip title="Добавить">
<IconButton size="large" onClick={handleAddTask}> <IconButton size="large" onClick={handleAddTask}>
...@@ -201,8 +184,16 @@ export default function NewTaskForm({projects,setAddTaskForm,tasks}) { ...@@ -201,8 +184,16 @@ export default function NewTaskForm({projects,setAddTaskForm,tasks}) {
</Tooltip> </Tooltip>
</TableCell> </TableCell>
</TableRow> </TableRow>
</TableBody> </TableBody>
</Table> </Table>
<TaskModal
task={task}
open={modal}
handleClose={handleClose}
onChange={onChange}
user={user}
/>
</TableContainer> </TableContainer>
<Divider /> <Divider />
</> </>
...@@ -234,43 +225,20 @@ export const header = [ ...@@ -234,43 +225,20 @@ export const header = [
disablePadding: false, disablePadding: false,
label: "Заголовок", label: "Заголовок",
}, },
{
id: "description",
numeric: false,
disablePadding: false,
label: "Описание",
},
{ {
id: "projectName", id: "projectName",
numeric: true, numeric: true,
disablePadding: false, disablePadding: false,
label: "Проект", label: "Проект",
}, },
{
id: "authorDisplayName",
numeric: false,
disablePadding: false,
label: "Автор",
},
{
id: "dateTimeStart",
numeric: true,
disablePadding: false,
label: "Дата начала",
},
{ {
id: "dateTimeDue", id: "dateTimeDue",
numeric: true, numeric: true,
disablePadding: false, disablePadding: false,
label: "Дата завершения", label: "Дедлайн",
},
{
id: "accomplish",
numeric: false,
disablePadding: false,
label: "Статус",
}, },
{ {
id: "add", id: "add",
numeric: false, numeric: false,
......
import * as React from "react";
import {
TableCell,
TableRow,
IconButton,
Tooltip,
Collapse,
Box,
Table,
TableBody,
TableHead,
Typography
} from "@mui/material";
import { Done, Edit } from "@mui/icons-material";
import DeleteIcon from "@mui/icons-material/Delete";
import moment from "moment";
import CustomTableCell from "../CustomTableCell";
import MaterialUIPickers from "../DateTimePicker/DateTimePicker";
import BasicSelect from "../../UI/Select/Select";
import CalendarMonthIcon from '@mui/icons-material/CalendarMonth';
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
const TableRowTask= ({
user,
task,
deleteHandle,
handleEditTask,
onChange,
onModalOpen,
onProjectChange,
uniqueProjects,
onAuthorChange,
onDateChange,
onToggleEditMode,
onToggleEditModeDone,
})=>{
const [open, setOpen] = React.useState(false);
const dateTimeTransform =(dateIso)=>{
const event = new Date(dateIso);
return event.toLocaleString('ru-KZ', { timeZone: 'UTC' })
}
const dateTransform =(dateIso) => {
let date = new Date(dateIso);
return date.getDate()+'-' + (date.getMonth()+1) + '-'+ date.getFullYear().toString().slice(-2);
}
const timeTransform = (dateIso)=>{
return moment.utc(dateIso).format("HH:"+"00");
}
return (
<>
<TableRow hover key={task.id}>
<TableCell
component="th"
scope="row"
padding="none"
></TableCell>
{task.isEditMode && task.author.id===user.id ? (
<TableCell>
<BasicSelect
items={[
{ value: "A", title: "A" },
{ value: "B", title: "B" },
{ value: "C", title: "C" },
]}
task={task}
value={task.priority}
onChange={onChange}
name="priority"
user={user}
/>
</TableCell>
) : (
<CustomTableCell
{...{
task,
name: "priority",
value: task.priority,
user:user
}}
/>
)}
<CustomTableCell
{...{
task,
name: "createdAt",
value: moment(task.createdAt)
.utc()
.format("DD-MM-YY"),
user:user
}}
/>
<CustomTableCell
{...{
task,
name: "title",
value: task.title,
onChange,
onModalOpen,
user:user
}}
/>
{task.isEditMode && task.author.id===user.id ? (
<TableCell>
<BasicSelect
items={uniqueProjects.map((e) => ({
value: e?.id,
title: e?.title,
}))}
task={task}
onChange={onProjectChange}
name="project"
value={task.project?.id}
user={user}
/>
</TableCell>
) : (
<CustomTableCell
{...{
task,
name: "projectId",
value: task.project?.title,
user:user
}}
/>
)}
<CustomTableCell
{...{
task,
name: "author",
value: task.author.displayName,
onChange: onAuthorChange,
user:user
}}
/>
{task.isEditMode && task.author.id===user.id ? (
<TableCell>
{/* <MaterialUIPickers
task={task}
name="dateTimeStart"
onChange={onDateChange}
user={user}
/> */}
<TableCell>
<Tooltip title="Перейти в календарь">
<IconButton
onClick={(id) => { deleteHandle(task.id);}}
>
<CalendarMonthIcon />
</IconButton>
</Tooltip>
</TableCell>
</TableCell>
) : (
task.dateTimeTasks.length>1 ?
<TableCell>
<IconButton
aria-label="expand row"
size="small"
onClick={() => setOpen(!open)}
>
{open ? <KeyboardArrowUpIcon /> : <KeyboardArrowDownIcon />}
</IconButton>
</TableCell>
:
<CustomTableCell
{...{
task,
name: "dateTimeStart",
value: moment(task.dateTimeTasks[0]?.dateTimeStart)
.utc()
.format("DD-MM-YY "),
value2:moment(task.dateTimeTasks[0]?.dateTimeStart)
.utc()
.format("kk:mm")+" - "+
moment(task.dateTimeTasks[0]?.dateTimeDue)
.utc()
.format("kk:mm"),
user:user
}}>
</CustomTableCell>
)}
{/* <TableCell>
<MaterialUIPickers
task={task}
name="dateTimeStart"
onChange={onDateChange}
user={user}
/>
</TableCell> */}
{task.isEditMode && task.author.id===user.id ? (
<TableCell>
<MaterialUIPickers
task={task}
name="dateTimeDue"
onChange={onDateChange}
user={user}
/>
</TableCell>
) : (
<CustomTableCell
{...{
task,
name: "dateTimeDeadLine",
value: moment(task.dateTimeDeadLine
)
.utc()
.format("DD-MM-YY kk:mm"),
user:user
}}
/>
)}
{task.isEditMode ? (
<TableCell>
<BasicSelect
items={[
{ value: "opened", title: "opened" },
{ value: "done", title: "done" },
{ value: "failed", title: "failed" },
]}
task={task}
onChange={onChange}
name="accomplish"
value={task.accomplish}
user={user}
/>
</TableCell>
) : (
<CustomTableCell
{...{
task,
name: "accomplish",
value: task.accomplish,
user:user
}}
/>
)}
<TableCell>
<Tooltip title="Редактировать">
{task.isEditMode ? (
<IconButton
aria-label="done"
onClick={() => {
onToggleEditModeDone(task.id);
handleEditTask(task);
}}
>
<Done />
</IconButton>
) : (
<IconButton
aria-label="edit"
onClick={() => onToggleEditMode(task.id)}
>
<Edit />
</IconButton>
)}
</Tooltip>
</TableCell>
{task.author.id===user.id ?
(<TableCell>
<Tooltip title="Удалить">
<IconButton
onClick={(id) => {
deleteHandle(task.id);
}}
>
<DeleteIcon />
</IconButton>
</Tooltip>
</TableCell>):null}
</TableRow>
{task.dateTimeTasks.length>1?
<TableRow>
<TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={11}>
<Collapse in={open} timeout="auto" unmountOnExit>
<Box sx={{ margin: 1 }}>
<Typography variant="h6" gutterBottom component="div">
Расписание
</Typography>
<Table size="small" aria-label="purchases">
<TableHead>
<TableRow>
<TableCell colSpan={10} >Дата создания события</TableCell>
<TableCell align="right">дд-мм-гг</TableCell>
<TableCell align="right">Начало</TableCell>
<TableCell align="center" colSpan={1}>Окончание</TableCell>
</TableRow>
</TableHead>
<TableBody>
{task.dateTimeTasks.map((dateTimeTask, index) => (
<TableRow key={index}>
<TableCell component="th" scope="row" colSpan={10}>
{dateTimeTransform(dateTimeTask.createdAt)}
</TableCell>
<TableCell align="right">
{dateTransform(dateTimeTask.dateTimeStart)}
</TableCell>
<TableCell align="right">
{timeTransform(dateTimeTask.dateTimeStart)}
</TableCell>
<TableCell align="center" colSpan={1}>
{timeTransform(dateTimeTask.dateTimeDue)}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</Box>
</Collapse>
</TableCell>
</TableRow>
:<></>}
</>
)
}
export default TableRowTask;
...@@ -16,6 +16,7 @@ const TaskModal = ({handleClose,open,task,onChange,user }) => { ...@@ -16,6 +16,7 @@ const TaskModal = ({handleClose,open,task,onChange,user }) => {
open={open} open={open}
> >
{task?.isEditMode && task.author.id===user.id ? ( {task?.isEditMode && task.author.id===user.id ? (
<div className="modal"> <div className="modal">
<Input <Input
label="название" label="название"
......
...@@ -3,29 +3,19 @@ import { ...@@ -3,29 +3,19 @@ import {
Box, Box,
Table, Table,
TableBody, TableBody,
TableCell,
TableContainer, TableContainer,
TablePagination, TablePagination,
TableRow,
Paper, Paper,
IconButton,
Tooltip,
} from "@mui/material"; } from "@mui/material";
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { Done, Edit } from "@mui/icons-material";
import DeleteIcon from "@mui/icons-material/Delete";
import TaskModal from "../../components/MyTasksCompoments/TaskModal/TaskModal"; import TaskModal from "../../components/MyTasksCompoments/TaskModal/TaskModal";
import EnhancedTableHead from "./MyTasksHeader/MyTasksHeader"; import EnhancedTableHead from "./MyTasksHeader/MyTasksHeader";
import moment from "moment"; import moment from "moment";
import MyTaskToolBar from "../../components/MyTasksCompoments/MyTaskToolBar"; import MyTaskToolBar from "../../components/MyTasksCompoments/MyTaskToolBar";
import CustomTableCell from "../../components/MyTasksCompoments/CustomTableCell";
import MaterialUIPickers from "../../components/MyTasksCompoments/DateTimePicker/DateTimePicker";
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'; import TableRowTask from "../../components/MyTasksCompoments/TableRowTask/TableRowTask";
export default function EnhancedTable() { export default function EnhancedTable() {
...@@ -54,20 +44,21 @@ export default function EnhancedTable() { ...@@ -54,20 +44,21 @@ export default function EnhancedTable() {
if (tasks && tasks?.length > 0) { if (tasks && tasks?.length > 0) {
setRecievedTasks(tasks); setRecievedTasks(tasks);
} }
}, [tasks===undefined,tasks?.length]); }, [tasks?.length]);
useEffect(() => { useEffect(() => {
dispatch(fetchAllTasks()); dispatch(fetchAllTasks());
}, [addTaskForm, setAddTaskForm]); }, [addTaskForm, setAddTaskForm]);
const handleRequestSort = (event, property) => {
const handleRequestSort = ( property) => {
const isAsc = orderBy === property && order === "asc"; const isAsc = orderBy === property && order === "asc";
setOrder(isAsc ? "desc" : "asc"); setOrder(isAsc ? "desc" : "asc");
setOrderBy(property); setOrderBy(property);
}; };
const handleChangePage = (event, newPage) => { const handleChangePage = ( newPage) => {
setPage(newPage); setPage(newPage);
}; };
...@@ -110,7 +101,7 @@ useEffect(() => { ...@@ -110,7 +101,7 @@ useEffect(() => {
if (task.id === id) { if (task.id === id) {
return { return {
...task, ...task,
[property]: moment.parseZone(value, "DD/MM/YYYY", true).format(), [property]: moment.parseZone(value, "DD/MM/YY", true).format(),
}; };
} }
return task; return task;
...@@ -222,7 +213,8 @@ useEffect(() => { ...@@ -222,7 +213,8 @@ useEffect(() => {
return results; return results;
}, []); }, []);
console.log(tasks) console.log('tasks', tasks)
if ( if (
tasks && tasks &&
tasks?.length > 0 && tasks?.length > 0 &&
...@@ -243,8 +235,7 @@ console.log(tasks) ...@@ -243,8 +235,7 @@ console.log(tasks)
{addTaskForm ? ( {addTaskForm ? (
<NewTaskForm <NewTaskForm
tasks={recievedTasks} projects={uniqueProjects}
projects={rawProjects}
setAddTaskForm={()=>setAddTaskForm(false)} setAddTaskForm={()=>setAddTaskForm(false)}
/> />
) : null} ) : null}
...@@ -264,228 +255,22 @@ console.log(tasks) ...@@ -264,228 +255,22 @@ console.log(tasks)
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
.map((task, index) => { .map((task, index) => {
return ( return (
<TableRowTask
<TableRow hover key={task.id}> key ={index}
<TableCell
component="th"
scope="row"
padding="none"
></TableCell>
{task.isEditMode && task.author.id===user.id ? (
<TableCell>
<BasicSelect
items={[
{ value: "A", title: "A" },
{ value: "B", title: "B" },
{ value: "C", title: "C" },
]}
task={task}
value={task.priority}
onChange={onChange}
name="priority"
user={user} user={user}
/>
</TableCell>
) : (
<CustomTableCell
{...{
task,
name: "priority",
value: task.priority,
user:user
}}
/>
)}
<CustomTableCell
{...{
task,
name: "createdAt",
value: moment(task.createdAt)
.utc()
.format("DD-MM-YYYY hh:mm A"),
user:user
}}
/>
<CustomTableCell
{...{
task,
name: "title",
value: task.title,
onChange,
onModalOpen,
user:user
}}
/>
{task.isEditMode && task.author.id===user.id ? (
<TableCell>
<BasicSelect
items={uniqueProjects.map((e) => ({
value: e?.id,
title: e?.title,
}))}
task={task}
onChange={onProjectChange}
name="project"
value={task.project?.id}
user={user}
/>
</TableCell>
) : (
<CustomTableCell
{...{
task,
name: "projectId",
value: task.project?.title,
user:user
}}
/>
)}
<CustomTableCell
{...{
task,
name: "author",
value: task.author.displayName,
onChange: onAuthorChange,
user:user
}}
/>
{task.isEditMode && task.author.id===user.id ? (
<TableCell>
{/* <MaterialUIPickers
task={task}
name="dateTimeStart"
onChange={onDateChange}
user={user}
/> */}
<TableCell>
<Tooltip title="Перейти в календарь">
<IconButton
onClick={(id) => { deleteHandle(task.id);}}
>
<CalendarMonthIcon />
</IconButton>
</Tooltip>
</TableCell>
</TableCell>
) : (<>
<CustomTableCell
{...{
task,
name: "dateTimeStart",
value: moment(task.dateTimeTasks[0]?.dateTimeStart)
.utc()
.format("DD-MM-YYYY "),
value2:moment(task.dateTimeTasks[0]?.dateTimeStart)
.utc()
.format("hh:mm A")+"-"+
moment(task.dateTimeTasks[0]?.dateTimeDue)
.utc()
.format("hh:mm A"),
user:user
}}>
</CustomTableCell>
</>
)}
{/* <TableCell>
<MaterialUIPickers
task={task}
name="dateTimeStart"
onChange={onDateChange}
user={user}
/>
</TableCell> */}
{task.isEditMode && task.author.id===user.id ? (
<TableCell>
<MaterialUIPickers
task={task}
name="dateTimeDue"
onChange={onDateChange}
user={user}
/>
</TableCell>
) : (
<CustomTableCell
{...{
task,
name: "dateTimeDeadLine",
value: moment(task.dateTimeDeadLine
)
.utc()
.format("DD-MM-YYYY hh:mm A"),
user:user
}}
/>
)}
{task.isEditMode ? (
<TableCell>
<BasicSelect
items={[
{ value: "opened", title: "opened" },
{ value: "done", title: "done" },
{ value: "failed", title: "failed" },
]}
task={task} task={task}
deleteHandle={deleteHandle}
handleEditTask ={handleEditTask}
onChange={onChange} onChange={onChange}
name="accomplish" onModalOpen={onModalOpen}
value={task.accomplish} onProjectChange={onProjectChange}
user={user} uniqueProjects={uniqueProjects}
/> onAuthorChange={onAuthorChange}
</TableCell> onDateChange={onDateChange}
) : ( onToggleEditMode={onToggleEditMode}
<CustomTableCell onToggleEditModeDone={onToggleEditModeDone}
{...{
task,
name: "accomplish",
value: task.accomplish,
user:user
}}
/> />
)}
<TableCell>
<Tooltip title="Редактировать">
{task.isEditMode ? (
<IconButton
aria-label="done"
onClick={() => {
onToggleEditModeDone(task.id);
handleEditTask(task);
}}
>
<Done />
</IconButton>
) : (
<IconButton
aria-label="edit"
onClick={() => onToggleEditMode(task.id)}
>
<Edit />
</IconButton>
)}
</Tooltip>
</TableCell>
{task.author.id===user.id ?
(<TableCell>
<Tooltip title="Удалить">
<IconButton
onClick={(id) => {
deleteHandle(task.id);
}}
>
<DeleteIcon />
</IconButton>
</Tooltip>
</TableCell>):null}
</TableRow>
); );
})} })}
</TableBody> </TableBody>
......
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