Commit 9e60add3 authored by Ermolaev Timur's avatar Ermolaev Timur

#149 Пофиксил баги

parent 29c6594e
...@@ -319,7 +319,7 @@ router.put('/:taskId',auth,authAuthorOrExecutorOfTask,async(req:Request, res:Res ...@@ -319,7 +319,7 @@ router.put('/:taskId',auth,authAuthorOrExecutorOfTask,async(req:Request, res:Res
dateTimeDue,executor,accomplish,dateTimeDeadLine, dateTimeFactDeadLine,priority} = req.body; dateTimeDue,executor,accomplish,dateTimeDeadLine, dateTimeFactDeadLine,priority} = req.body;
const task = await taskFinderById(taskId) const task = await taskFinderById(taskId)
if (!task) return res.status(404).send({Message:'task not found'}) if (!task) return res.status(404).send({Message:'task not found'})
console.log(req.body)
console.log ('dateTimeDeadLine ', dateTimeDeadLine,'authorStatus ' console.log ('dateTimeDeadLine ', dateTimeDeadLine,'authorStatus '
,authorStatus,'executorStatus ',executorStatus) ,authorStatus,'executorStatus ',executorStatus)
......
...@@ -2,7 +2,6 @@ import { FormControl, InputLabel, MenuItem, Select } from '@mui/material'; ...@@ -2,7 +2,6 @@ import { FormControl, InputLabel, MenuItem, Select } from '@mui/material';
import { memo } from 'react'; import { memo } from 'react';
function СustomSelect({ value, onChange, label, variant = 'standard', items, id, defaultValue, name, sx}) { function СustomSelect({ value, onChange, label, variant = 'standard', items, id, defaultValue, name, sx}) {
console.log(value)
return ( return (
<> <>
<FormControl variant={variant} sx={ sx?.width ? sx : { m: 0, minWidth: 125}}> <FormControl variant={variant} sx={ sx?.width ? sx : { m: 0, minWidth: 125}}>
......
...@@ -19,7 +19,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa ...@@ -19,7 +19,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa
if (currentTask?.project) { if (currentTask?.project) {
currentTask.project = allUserProjectsForModalTask.find((project) => project?.value?.id === currentTask?.project?.id)?.value currentTask.project = allUserProjectsForModalTask.find((project) => project?.value?.id === currentTask?.project?.id)?.value
const arrUsers = currentTask?.project?.members.map((member) => { return { value: member.user, text: member.user.displayName } }) const arrUsers = currentTask?.project?.members.map((member) => { return { value: member.user, text: member.user.displayName } })
arrUsers.push({ value: null, text: 'Никто' }) arrUsers.push({ value: '', text: 'Никто' })
return arrUsers return arrUsers
} else { } else {
return [{ value: '', text: 'Выберите проект' }] return [{ value: '', text: 'Выберите проект' }]
......
...@@ -10,7 +10,6 @@ import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; ...@@ -10,7 +10,6 @@ import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp'; import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
import TableForCopiesTasks from "./TableForCopiesTasks/TableForCopiesTasks"; import TableForCopiesTasks from "./TableForCopiesTasks/TableForCopiesTasks";
import EditRow from "./EditRow/EditRow"; import EditRow from "./EditRow/EditRow";
import { accomplishStatuses } from "../../../../../constants";
const editClass = { const editClass = {
cursor: 'pointer', cursor: 'pointer',
......
...@@ -16,7 +16,6 @@ function descendingComparator(a, b, orderBy, order) { ...@@ -16,7 +16,6 @@ function descendingComparator(a, b, orderBy, order) {
} }
export function getComparator(order, orderBy) { export function getComparator(order, orderBy) {
console.log(order)
return order === 'desc' return order === 'desc'
? (a, b) => descendingComparator(a, b, orderBy) ? (a, b) => descendingComparator(a, b, orderBy)
: (a, b) => -descendingComparator(a, b, orderBy, order); : (a, b) => -descendingComparator(a, b, orderBy, order);
......
...@@ -115,12 +115,13 @@ export default function EnhancedTable() { ...@@ -115,12 +115,13 @@ export default function EnhancedTable() {
}, [addFormStatus]) }, [addFormStatus])
const createNewTaskHandler = useCallback(() => { const createNewTaskHandler = useCallback(() => {
if (newTask.priority === '' || newTask.project === '' || newTask.executor) { if (newTask.priority === '' || newTask.project === '' || newTask.executor === '') {
const task = { const task = {
...newTask, ...newTask,
priority: newTask.priority ? newTask.priority : null, priority: newTask.priority ? newTask.priority : null,
project: newTask.project ? newTask.project : null, project: newTask.project ? newTask.project : null,
executor: newTask.executor ? newTask.executor : null, executor: newTask.executor ? newTask.executor : null,
dateTimeDeadLine: new Date(newTask.dateTimeDeadLine) instanceof Date && !isNaN(new Date(newTask.dateTimeDeadLine)) ? newTask.dateTimeDeadLine : null
} }
dispatch(addTaskToUserTasksTable(task)) dispatch(addTaskToUserTasksTable(task))
} else { } else {
...@@ -151,12 +152,13 @@ export default function EnhancedTable() { ...@@ -151,12 +152,13 @@ export default function EnhancedTable() {
} }
const editCurrentTaskHandler = useCallback(() => { const editCurrentTaskHandler = useCallback(() => {
if (currentTask.priority === '' || currentTask.project === '' || currentTask.executor) { if (currentTask.priority === '' || currentTask.project === '' || currentTask.executor === '' || !Object.keys(currentTask.executor).length) {
const task = { const task = {
...currentTask, ...currentTask,
priority: currentTask.priority ? currentTask.priority : null, priority: currentTask.priority ? currentTask.priority : null,
project: currentTask.project ? currentTask.project : null, project: currentTask.project ? currentTask.project : null,
executor: currentTask.executor ? currentTask.executor : null, executor: currentTask.executor && currentTask.executor?.id ? currentTask.executor : null,
dateTimeDeadLine: new Date(currentTask.dateTimeDeadLine) instanceof Date && !isNaN(new Date(currentTask.dateTimeDeadLine)) ? currentTask.dateTimeDeadLine : null
} }
dispatch(editTaskUsers(task)) dispatch(editTaskUsers(task))
} else { } else {
......
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