обновила проект с гита

parent 9ed799cd
...@@ -17,6 +17,9 @@ export default function MyTaskToolBar(props) { ...@@ -17,6 +17,9 @@ export default function MyTaskToolBar(props) {
</Typography> </Typography>
<MultipleSelect <MultipleSelect
projects={props.projects} projects={props.projects}
onClose={props.onClose}
projectName={props.projectName}
setProjectName={props.setProjectName}
/> />
<Button color="inherit" onClick={props.onClick} >Добавить задачу</Button> <Button color="inherit" onClick={props.onClick} >Добавить задачу</Button>
</Toolbar> </Toolbar>
......
...@@ -31,18 +31,18 @@ function getStyles(name, personName, theme) { ...@@ -31,18 +31,18 @@ function getStyles(name, personName, theme) {
export default function MultipleSelect(props) { export default function MultipleSelect(props) {
const theme = useTheme(); const theme = useTheme();
const [projectName, setProjectName] = React.useState([]);
const handleChange = (event) => { const handleChange = (event) => {
const { const {
target: { value }, target: { value },
} = event; } = event;
setProjectName( props.setProjectName(
// On autofill we get a stringified value. // On autofill we get a stringified value.
typeof value === 'string' ? value.split(',') : value, typeof value === 'string' ? value.split(',') : value,
); );
}; };
console.log(projectName)
return ( return (
<div> <div>
<FormControl sx={{ m: 1, width: 250,borderColor:'white' }}> <FormControl sx={{ m: 1, width: 250,borderColor:'white' }}>
...@@ -51,17 +51,18 @@ console.log(projectName) ...@@ -51,17 +51,18 @@ console.log(projectName)
labelId="demo-multiple-name-label" labelId="demo-multiple-name-label"
id="demo-multiple-name" id="demo-multiple-name"
multiple multiple
value={projectName} value={props.projectName}
onChange={handleChange} onChange={handleChange}
input={<OutlinedInput label="Name" />} input={<OutlinedInput label="Name" />}
MenuProps={MenuProps} MenuProps={MenuProps}
sx={{color:'white' }} sx={{color:'white' }}
onClose={(e)=>{props.onClose(props.projectName)}}
> >
{props.projects.map((project) => ( {props.projects.map((project) => (
<MenuItem <MenuItem
key={project} key={project}
value={project} value={project}
style={getStyles(project, projectName, theme)} style={getStyles(project, props.projectName, theme)}
> >
{project} {project}
</MenuItem> </MenuItem>
......
...@@ -201,7 +201,31 @@ console.log(tasks) ...@@ -201,7 +201,31 @@ console.log(tasks)
const handleClose = () => { const handleClose = () => {
setModal({ ...modal, open: false, id: null }); setModal({ ...modal, open: false, id: null });
}; };
// ++++++++фильтрация по проектам+++++++++++++++
const [projectName, setProjectName] = React.useState([]);
const [filter, setFilter] = React.useState(false);
const onClose=(projectName)=>{
console.log(projectName)
setFilter(true)
}
useEffect(() => {
if (tasks && tasks?.length > 0) {
let currentTasks = [];
let i
for (i=0; i<projectName?.lenght; i++)
{currentTasks = tasks?.map((task) => {
if (task.project=projectName)
return {
...task,
};
})};
setRecievedTasks(currentTasks);
}
}, [filter==true]);
// ++++++++фильтрация по проектам+++++++++++++++
if ( if (
tasks && tasks &&
tasks?.length > 0 && tasks?.length > 0 &&
...@@ -216,6 +240,9 @@ console.log(tasks) ...@@ -216,6 +240,9 @@ console.log(tasks)
addTask(); addTask();
}} }}
projects={projects} projects={projects}
onClose={onClose}
projectName={projectName}
setProjectName={setProjectName}
/> />
<TableContainer> <TableContainer>
......
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