Commit f156467b authored by Ermolaev Timur's avatar Ermolaev Timur

#154 починил все селекты

parent 604159dd
import { TableCell, TextField, Tooltip } from "@mui/material"; import { TableCell, TextField, Tooltip } from "@mui/material";
import moment from "moment"; import moment from "moment";
import { memo } from "react"; import { memo, useEffect } from "react";
import { accomplishStatuses, priorities } from "../../../../../../constants"; import { accomplishStatuses, priorities } from "../../../../../../constants";
import CustomSelect from "../../../../../UI/СustomSelect/СustomSelect" import CustomSelect from "../../../../../UI/СustomSelect/СustomSelect"
import { styled } from '@mui/material/styles'; import { styled } from '@mui/material/styles';
...@@ -15,7 +15,7 @@ const StyledTooltip = styled(({ className, ...props }) => ( ...@@ -15,7 +15,7 @@ const StyledTooltip = styled(({ className, ...props }) => (
`; `;
function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTask, allUserProjectsForModalTask, onDateChangeEditHandler, user }) { function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTask, allUserProjectsForModalTask, onDateChangeEditHandler, user }) {
return ( return (
<> <>
<TableCell sx={{ width: '4%' }}> <TableCell sx={{ width: '4%' }}>
...@@ -70,6 +70,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa ...@@ -70,6 +70,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa
variant={'outlined'} variant={'outlined'}
onChange={onChangeCurrentTaskHandler} onChange={onChangeCurrentTaskHandler}
id={'project'} id={'project'}
renderValue={(project)=>project.title}
items={allUserProjectsForModalTask} items={allUserProjectsForModalTask}
sx={{ width: '100%' }} sx={{ width: '100%' }}
/> />
......
import { FormControl, InputLabel, MenuItem, Select } from '@mui/material'; 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, renderValue}) {
return ( return (
<> <>
<FormControl variant={variant} sx={ sx?.width ? sx : { m: 0, minWidth: 125}}> <FormControl variant={variant} sx={ sx?.width ? sx : { m: 0, minWidth: 125}}>
...@@ -10,6 +10,7 @@ function СustomSelect({ value, onChange, label, variant = 'standard', items, id ...@@ -10,6 +10,7 @@ function СustomSelect({ value, onChange, label, variant = 'standard', items, id
labelId={`${id}-select-label`} labelId={`${id}-select-label`}
id={`${id}-select`} id={`${id}-select`}
value={value} value={value}
renderValue={renderValue ? renderValue : null}
onChange={onChange} onChange={onChange}
label={label} label={label}
name={name} name={name}
......
...@@ -92,6 +92,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa ...@@ -92,6 +92,7 @@ function EditRow({ buttons, dateTimeTasks, onChangeCurrentTaskHandler, currentTa
name={'executor'} name={'executor'}
variant={'outlined'} variant={'outlined'}
onChange={onChangeCurrentTaskHandler} onChange={onChangeCurrentTaskHandler}
renderValue={(executor)=>executor?.displayName}
id={'executor'} id={'executor'}
items={workers} items={workers}
sx={{ width: '100%' }} sx={{ width: '100%' }}
......
...@@ -138,7 +138,7 @@ export default function MyTasks() { ...@@ -138,7 +138,7 @@ export default function MyTasks() {
setAddFormStatus((prevState) => { return !prevState }) setAddFormStatus((prevState) => { return !prevState })
}, [dispatch, newTask, user]) }, [dispatch, newTask, user])
console.log(currentTask)
const deleteTaskHandler = useCallback((id) => { const deleteTaskHandler = useCallback((id) => {
dispatch(deleteTask(id)) dispatch(deleteTask(id))
}, [dispatch]) }, [dispatch])
......
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