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';
import { memo } from 'react';
function СustomSelect({ value, onChange, label, variant = 'standard', items, id, defaultValue, name, sx}) {
console.log(value)
return (
<>
<FormControl variant={variant} sx={ sx?.width ? sx : { m: 0, minWidth: 125}}>
......
......@@ -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(() => {
if (currentTask?.project) {
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 {
return [{ value: '', text: 'Выберите проект' }]
}
......@@ -81,7 +82,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa
</TableCell>
<TableCell sx={{ width: '8%' }}>
<CustomSelect
value={currentTask.executor.id}
value={currentTask.executor}
name={'executor'}
variant={'outlined'}
onChange={onChangeCurrentTaskHandler}
......
......@@ -101,8 +101,8 @@ function UsersTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHan
if (!editMode) {
setCurrentTask({
...row,
project: {...row.project},
executor: {...row.executor}
project: { ...row.project },
executor: { ...row.executor }
})
} else {
editCurrentTaskHandler()
......@@ -152,6 +152,7 @@ function UsersTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHan
currentTask={currentTask}
allUserProjectsForModalTask={allUserProjectsForModalTask}
onDateChangeEditHandler={onDateChangeEditHandler}
user={user}
/>
</>
:
......@@ -159,7 +160,7 @@ function UsersTasksRow({ row, deleteTaskHandler, calendarOpen, deleteCopyTaskHan
<TableCell sx={{ width: '4%' }}>{row.priority ? row.priority : null}</TableCell>
<TableCell sx={{ width: '10%' }}>{moment(row.createdAt).format('DD.MM.YYYY')}</TableCell>
<Tooltip title={row.description}>
<TableCell sx={{ width: '25%', overflow: 'hidden', textOverflow: 'ellipsis' }}>
<TableCell sx={{ width: '25%' }}>
{row.title}
</TableCell>
</Tooltip>
......@@ -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: '7%' }}>
{accomplishStatuses.find((status) => {
if (status.value === row.accomplish) {
return status
}
return null
}).text}</TableCell>
{row.accomplishTranslate}
</TableCell>
<TableCell size='medium' sx={{ width: '5%', position: 'relative' }}>
{buttons}
</TableCell>
......
......@@ -68,7 +68,7 @@ const headCells = [
}
},
{
id: "accomplish",
id: "accomplishTranslate",
label: "Статус",
canSort: true,
style: {
......
import { accomplishStatuses } from "../../constants";
import {
ADD_NEW_TASK_FAILURE,
ADD_NEW_TASK_REQUEST,
......@@ -96,6 +97,12 @@ const tasksReduсer = (state = initialState, action) => {
authorName: task.author.displayName,
projectTitle: task.project.title,
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 };
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