Commit fe5adeb6 authored by Ermolaev Timur's avatar Ermolaev Timur

#149 Небольшие изменения

parent 97c343f3
...@@ -2,7 +2,7 @@ import { FormControl, InputLabel, MenuItem, Select } from '@mui/material'; ...@@ -2,7 +2,7 @@ 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}}>
......
...@@ -15,12 +15,13 @@ const StyledTooltip = styled(({ className, ...props }) => ( ...@@ -15,12 +15,13 @@ const StyledTooltip = styled(({ className, ...props }) => (
`; `;
function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTask, allUserProjectsForModalTask, onDateChangeEditHandler }) { function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTask, allUserProjectsForModalTask, onDateChangeEditHandler, user }) {
const workers = useMemo(() => { const workers = useMemo(() => {
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
return currentTask?.project?.members.map((member) => { return { value: member.user.id, text: member.user.displayName } }) const arrUsers = currentTask?.project?.members.map((member) => { return { value: member.user, text: member.user.displayName } })
arrUsers.push({value: null, text: 'Никто'})
return arrUsers
} else { } else {
return [{ value: '', text: 'Выберите проект' }] return [{ value: '', text: 'Выберите проект' }]
} }
...@@ -81,7 +82,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa ...@@ -81,7 +82,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa
</TableCell> </TableCell>
<TableCell sx={{ width: '8%' }}> <TableCell sx={{ width: '8%' }}>
<CustomSelect <CustomSelect
value={currentTask.executor.id} value={currentTask.executor}
name={'executor'} name={'executor'}
variant={'outlined'} variant={'outlined'}
onChange={onChangeCurrentTaskHandler} onChange={onChangeCurrentTaskHandler}
......
...@@ -101,8 +101,8 @@ function UsersTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHan ...@@ -101,8 +101,8 @@ function UsersTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHan
if (!editMode) { if (!editMode) {
setCurrentTask({ setCurrentTask({
...row, ...row,
project: {...row.project}, project: { ...row.project },
executor: {...row.executor} executor: { ...row.executor }
}) })
} else { } else {
editCurrentTaskHandler() editCurrentTaskHandler()
...@@ -152,6 +152,7 @@ function UsersTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHan ...@@ -152,6 +152,7 @@ function UsersTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHan
currentTask={currentTask} currentTask={currentTask}
allUserProjectsForModalTask={allUserProjectsForModalTask} allUserProjectsForModalTask={allUserProjectsForModalTask}
onDateChangeEditHandler={onDateChangeEditHandler} onDateChangeEditHandler={onDateChangeEditHandler}
user={user}
/> />
</> </>
: :
...@@ -159,7 +160,7 @@ function UsersTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHan ...@@ -159,7 +160,7 @@ function UsersTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHan
<TableCell sx={{ width: '4%' }}>{row.priority ? row.priority : null}</TableCell> <TableCell sx={{ width: '4%' }}>{row.priority ? row.priority : null}</TableCell>
<TableCell sx={{ width: '10%' }}>{moment(row.createdAt).format('DD.MM.YYYY')}</TableCell> <TableCell sx={{ width: '10%' }}>{moment(row.createdAt).format('DD.MM.YYYY')}</TableCell>
<Tooltip title={row.description}> <Tooltip title={row.description}>
<TableCell sx={{ width: '25%', overflow: 'hidden', textOverflow: 'ellipsis' }}> <TableCell sx={{ width: '25%' }}>
{row.title} {row.title}
</TableCell> </TableCell>
</Tooltip> </Tooltip>
...@@ -173,12 +174,8 @@ function UsersTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHan ...@@ -173,12 +174,8 @@ function UsersTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHan
<TableCell sx={{ width: '10%' }}>{row.dateTimeDeadLine ? moment(row.dateTimeDeadLine).utc().format('DD.MM.YYYY HH:MM') : null}</TableCell> <TableCell sx={{ width: '10%' }}>{row.dateTimeDeadLine ? moment(row.dateTimeDeadLine).utc().format('DD.MM.YYYY HH:MM') : null}</TableCell>
<TableCell sx={{ width: '7%' }}> <TableCell sx={{ width: '7%' }}>
{accomplishStatuses.find((status) => { {row.accomplishTranslate}
if (status.value === row.accomplish) { </TableCell>
return status
}
return null
}).text}</TableCell>
<TableCell size='medium' sx={{ width: '5%', position: 'relative' }}> <TableCell size='medium' sx={{ width: '5%', position: 'relative' }}>
{buttons} {buttons}
</TableCell> </TableCell>
......
...@@ -68,7 +68,7 @@ const headCells = [ ...@@ -68,7 +68,7 @@ const headCells = [
} }
}, },
{ {
id: "accomplish", id: "accomplishTranslate",
label: "Статус", label: "Статус",
canSort: true, canSort: true,
style: { style: {
......
import { accomplishStatuses } from "../../constants";
import { import {
ADD_NEW_TASK_FAILURE, ADD_NEW_TASK_FAILURE,
ADD_NEW_TASK_REQUEST, ADD_NEW_TASK_REQUEST,
...@@ -96,6 +97,12 @@ const tasksReduсer = (state = initialState, action) => { ...@@ -96,6 +97,12 @@ const tasksReduсer = (state = initialState, action) => {
authorName: task.author.displayName, authorName: task.author.displayName,
projectTitle: task.project.title, projectTitle: task.project.title,
executorName: task?.executor?.displayName || null, executorName: task?.executor?.displayName || null,
accomplishTranslate: accomplishStatuses.find((status) => {
if (status.value === task.accomplish) {
return status
}
return null
}).text
}}) }})
return { ...state, loading: false, tasks: newArr, projects: action.projects }; return { ...state, loading: false, tasks: newArr, projects: action.projects };
case FETCH_CALENDAR_TASKS_FAILURE: case FETCH_CALENDAR_TASKS_FAILURE:
......
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