Merge branch 'task-89-fix/DE_and_cosmetic_fix' into 'development'

Task 89 fix/de and cosmetic fix

See merge request !61
parents d02f5e73 7aab4e6b
......@@ -63,15 +63,16 @@ router.put("/change-copy", authAuthorOrExecutorOfTask, async(req:Request, res: R
})
/**delete copyTask by dateTimeTaskId */
router.delete('/:id', authAuthorOrExecutorOfTask, async(req:Request, res:Response):Promise<Response>=>{
const {id} = req.params
router.delete('/:dateTimeTaskId', async(req:Request, res:Response):Promise<Response>=>{
// router.delete('/:dateTimeTaskId', authAuthorOrExecutorOfTask, async(req:Request, res:Response):Promise<Response>=>{
const {dateTimeTaskId} = req.params
await myDataSource
.createQueryBuilder()
.delete()
.from(DateTimeTask)
.where("id = :id", { id })
.where("id = :dateTimeTaskId", { dateTimeTaskId })
.execute()
return res.send({message:"delete succesfully"})
return res.send({message:"copyTask delete succesfully"})
}
)
......
......@@ -13,6 +13,7 @@ import {
} from "@mui/material";
import { Done, Edit } from "@mui/icons-material";
import RemoveIcon from '@mui/icons-material/Remove';
import DeleteIcon from "@mui/icons-material/Delete";
import moment from "moment";
import CustomTableCell from "../CustomTableCell";
......@@ -22,13 +23,15 @@ import CalendarMonthIcon from '@mui/icons-material/CalendarMonth';
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
const weekDays = ["Вс","Пн","Вт","Ср","Чт","Пт","Сб" ];
const TableRowTask= ({
user,
task,
deleteHandle,
handleEditTask,
deleteDateTimeTask,
handleEditDateTimeTask,
onChange,
onModalOpen,
onProjectChange,
......@@ -40,16 +43,21 @@ const TableRowTask= ({
})=>{
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 roudHourUp =(dateIso)=>{
let m = moment(dateIso);
let roundUp = m.minute() || m.second() || m.millisecond() ? m.add(1, 'hour').startOf('hour') : m.startOf('hour');
return roundUp
}
const timeTransform = (dateIso)=>{
return moment.utc(dateIso).format("HH:"+"00");
const exp = roudHourUp(moment.utc(dateIso)).format("HH:"+"00")
return exp;
}
const getDayOfWeek = (dateIso) => {
const date = moment.utc(dateIso);
return weekDays[date.day()];
}
return (
......@@ -298,23 +306,30 @@ const TableRowTask= ({
<Typography variant="h6" gutterBottom component="div">
Расписание
</Typography>
<Table size="small" aria-label="purchases">
<Table size="small" aria-label="purchases" sx={{
backgroundColor: "#ebebeb"}}>
<TableHead>
<TableRow>
<TableCell colSpan={10} >Дата создания события</TableCell>
<TableCell align="right">дд-мм-гг</TableCell>
<TableCell colSpan={10} >Дата создания</TableCell>
<TableCell align="right">День недели</TableCell>
<TableCell align="right">Начало</TableCell>
<TableCell align="center" colSpan={1}>Окончание</TableCell>
<TableCell align="center" ></TableCell>
<TableCell align="center" ></TableCell>
</TableRow>
</TableHead>
<TableBody>
{task.dateTimeTasks.map((dateTimeTask, index) => (
<TableRow key={index}>
<TableCell component="th" scope="row" colSpan={10}>
{dateTimeTransform(dateTimeTask.createdAt)}
{moment(task.createdAt)
.utc()
.format("DD/MM")}
</TableCell>
<TableCell align="right">
{dateTransform(dateTimeTask.dateTimeStart)}
{getDayOfWeek(dateTimeTask.dateTimeStart)}, {moment(dateTimeTask.dateTimeStart)
.utc()
.format("DD/MM")}
</TableCell>
<TableCell align="right">
{timeTransform(dateTimeTask.dateTimeStart)}
......@@ -322,6 +337,46 @@ const TableRowTask= ({
<TableCell align="center" colSpan={1}>
{timeTransform(dateTimeTask.dateTimeDue)}
</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>
))}
</TableBody>
......
......@@ -162,6 +162,16 @@ useEffect(() => {
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) => {
event.stopPropagation();
......@@ -261,6 +271,8 @@ console.log('tasks', tasks)
task={task}
deleteHandle={deleteHandle}
handleEditTask ={handleEditTask}
handleEditDateTimeTask={handleEditDateTimeTask}
deleteDateTimeTask={deleteDateTimeTask}
onChange={onChange}
onModalOpen={onModalOpen}
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