Commit 4903e1d5 authored by Ermolaev Timur's avatar Ermolaev Timur

Merge branch 'task-159-fix/fix_bugs' into 'development'

#159 пофиксил баги с отображением данных в инпуте, а также с вылетами

See merge request !129
parents fe9eacab d0304198
......@@ -47,6 +47,7 @@ function CalendarModalTaskContent({ title, onChangeCurrentTaskHandler, descripti
value={project}
name={'project'}
variant={'outlined'}
renderValue={(project)=>project?.title}
onChange={(e) => { onChangeCurrentTaskHandler(e) }}
label={'Проект'}
id={'project'}
......
......@@ -4,7 +4,7 @@ import MultipleSelect from "../../UI/MultipleSelect/MultipleSelect";
import CreateTaskFromButton from "./CreateTaskFromButton/CreateTaskFromButton";
function MyTasksTableToolbar({ addFormStatus, createTaskFromButtonHandler, projects, onCloseFilterByProjects, projectIdListForTaskSelect, setProjectIdListForTaskSelect, activeTasksOn, setActiveTasksOn }) {
function MyTasksTableToolbar({ addFormStatus, createTaskFromButtonHandler, projects, onCloseFilterByProjects, projectIdListForTaskSelect, setProjectIdListForTaskSelect, activeTasksStatus, setActiveTasksStatus }) {
const projectsFilter = useMemo(() => {
if (Array.isArray(projects)) {
......@@ -31,7 +31,7 @@ function MyTasksTableToolbar({ addFormStatus, createTaskFromButtonHandler, proje
Мои задачи
</Typography>
<FormControlLabel
control={<Switch color='error' checked={activeTasksOn} onChange={() => { setActiveTasksOn(prevState=>!prevState) }} />}
control={<Switch color='error' checked={activeTasksStatus} onChange={() => { setActiveTasksStatus(prevState=>!prevState) }} />}
label="Активные задачи"
labelPlacement="end"
/>
......
import { Button } from "@mui/material";
import { Button, TextField } from "@mui/material";
import { Box } from "@mui/system";
import { memo } from "react";
import FormElement from "../../UI/Form/FormElement/FormElement"
import { isValidate } from "./helpers";
......@@ -9,18 +8,21 @@ const NewProjectModalContent = ({ inputChangeHandler, projectTitle, createNewPro
return <>
<FormElement
onChange={(e)=>{inputChangeHandler(e)}}
<TextField
onChange={(e) => { inputChangeHandler(e) }}
name={"title"}
label={"Название"}
state={projectTitle}
value={projectTitle}
id="project-title"
variant="outlined"
sx={{width: '100%'}}
/>
<Box sx={{ display: 'flex', justifyContent: 'space-between', marginTop: '10px'}}>
<Box sx={{ display: 'flex', justifyContent: 'space-between', marginTop: '10px' }}>
<Button
type="submit"
color="primary"
variant="outlined"
onClick={()=>{createNewProjectHandler()}}
onClick={() => { createNewProjectHandler() }}
disabled={!isValidate(projectTitle)}
>
Создать
......@@ -29,7 +31,7 @@ const NewProjectModalContent = ({ inputChangeHandler, projectTitle, createNewPro
type="submit"
color="primary"
variant="outlined"
onClick={()=>{handleClose()}}
onClick={() => { handleClose() }}
>
Отмена
</Button>
......
......@@ -4,7 +4,7 @@ import MultipleSelect from "../../UI/MultipleSelect/MultipleSelect";
import CreateTaskFromButton from "./CreateTaskFromButton/CreateTaskFromButton";
function UsersTasksTableToolbar({ addFormStatus, createTaskFromButtonHandler, projects, onCloseFilterByProjects, projectIdListForTaskSelect, setProjectIdListForTaskSelect, activeTasksOn, setActiveTasksOn}) {
function UsersTasksTableToolbar({ addFormStatus, createTaskFromButtonHandler, projects, onCloseFilterByProjects, projectIdListForTaskSelect, setProjectIdListForTaskSelect, activeTasksStatus, setActiveTasksStatus}) {
const projectsFilter = useMemo(() => {
if (Array.isArray(projects)) {
......@@ -31,7 +31,7 @@ return (
Задачи сотрудников
</Typography>
<FormControlLabel
control={<Switch color='error' checked={activeTasksOn} onChange={() => { setActiveTasksOn(prevState=>!prevState) }} />}
control={<Switch color='error' checked={activeTasksStatus} onChange={() => { setActiveTasksStatus(prevState=>!prevState) }} />}
label="Активные задачи"
labelPlacement="end"
/>
......
......@@ -149,7 +149,7 @@ function MonthCalendar() {
endHour: hourDue,
startDay: dayNumber
},
project: allUserProjects[0].id
project: allUserProjects[0]
}
setCurrentTask((newTask))
}, [dateNow.month, dateNow.year, hourFormat, allUserProjects])
......
......@@ -39,7 +39,7 @@ export default function MyTasks() {
const [rowsPerPage, setRowsPerPage] = useState(10);
const [addFormStatus, setAddFormStatus] = useState(false);
const [projectIdListForTaskSelect, setProjectIdListForTaskSelect] = useState([]);
const [activeTasksOn, setActiveTasksOn] = useState(false)
const [activeTasksStatus, setActiveTasksStatus] = useState(false)
useEffect(() => {
dispatch(fetchAllTasks());
......@@ -48,8 +48,8 @@ export default function MyTasks() {
}, [dispatch]);
useEffect(() => {
dispatch(sortTaskByProjects(projectIdListForTaskSelect, activeTasksOn))
}, [dispatch, projectIdListForTaskSelect, activeTasksOn, tasks]);
dispatch(sortTaskByProjects(projectIdListForTaskSelect, activeTasksStatus))
}, [dispatch, projectIdListForTaskSelect, activeTasksStatus, tasks]);
const onChangeNewTaskHandler = useCallback((e) => {
......@@ -184,8 +184,8 @@ export default function MyTasks() {
projectIdListForTaskSelect={projectIdListForTaskSelect}
setProjectIdListForTaskSelect={setProjectIdListForTaskSelect}
projects={projects.projects}
activeTasksOn={activeTasksOn}
setActiveTasksOn={setActiveTasksOn}
activeTasksStatus={activeTasksStatus}
setActiveTasksStatus={setActiveTasksStatus}
/>
<MyTasksTableContainer
order={order}
......
......@@ -4,7 +4,6 @@ import { useDispatch, useSelector } from "react-redux";
import { createProject, deleteProject, fetchProjects } from "../../store/actions/projectsActions";
import FullProject from "../FullProject/FullProject";
import ProjectsWrapper from "../../components/ProjectsComponents/ProjectsWrapper/ProjectsWrapper";
import { useNavigate } from "react-router-dom";
import DefaultModal from "../../components/UI/DefaultModal/DefaultModal";
import NewProjectModalContent from "../../components/ProjectsComponents/NewProjectModalContent/NewProjectModalContent";
......@@ -13,7 +12,6 @@ const Projects = () => {
const { user } = useSelector(state => state.users)
const dispatch = useDispatch();
const navigate = useNavigate()
const [currentProject, setCurrentProject] = useState(null)
const [projectTitle, setProjectTitle] = useState('');
......@@ -47,11 +45,10 @@ const Projects = () => {
const handleClose = useCallback(() => {
setModal(false)
setProjectTitle('')
}, [])
console.log(currentProject)
return <>
<Grid container justifyContent='space-between'>
......
......@@ -40,7 +40,7 @@ export default function UsersTasks() {
const [rowsPerPage, setRowsPerPage] = useState(10);
const [addFormStatus, setAddFormStatus] = useState(false);
const [projectIdListForTaskSelect, setProjectIdListForTaskSelect] = useState([]);
const [activeTasksOn, setActiveTasksOn] = useState(false)
const [activeTasksStatus, setActiveTasksStatus] = useState(false)
useEffect(() => {
dispatch(fetchAllTasksByMembership());
......@@ -49,8 +49,8 @@ export default function UsersTasks() {
}, [dispatch]);
useEffect(() => {
dispatch(sortTaskByProjects(projectIdListForTaskSelect, activeTasksOn))
}, [dispatch, projectIdListForTaskSelect, activeTasksOn, tasks]);
dispatch(sortTaskByProjects(projectIdListForTaskSelect, activeTasksStatus))
}, [dispatch, projectIdListForTaskSelect, activeTasksStatus, tasks]);
const onChangeNewTaskHandler = useCallback((e) => {
......@@ -195,8 +195,8 @@ export default function UsersTasks() {
projectIdListForTaskSelect={projectIdListForTaskSelect}
setProjectIdListForTaskSelect={setProjectIdListForTaskSelect}
projects={projects.projects}
activeTasksOn={activeTasksOn}
setActiveTasksOn={setActiveTasksOn}
activeTasksStatus={activeTasksStatus}
setActiveTasksStatus={setActiveTasksStatus}
/>
<UsersTasksTableContainer
order={order}
......
......@@ -87,7 +87,7 @@ function WeekCalendar() {
}, [])
const onChangeProjectHandler = useCallback((e, value) => {
setWorkerInfo((prevState) => { return { ...prevState, project: value.id } });
setWorkerInfo((prevState) => { return { ...prevState, project: value } });
}, []);
const onChangeWorkerHandler = useCallback((e, value) => {
......@@ -148,7 +148,7 @@ function WeekCalendar() {
month: month,
startYear: year,
},
project: allUserProjects[0]?.id
project: allUserProjects[0]
}
setCurrentTask((newTask))
}, [hourFormat, allUserProjects])
......
......@@ -135,7 +135,7 @@ export const addTask = (task) => {
return async (dispatch) => {
dispatch(addTaskRequest());
try {
const response = await axios.post("/tasks", task);
await axios.post("/tasks", task);
dispatch(addTaskSuccess())
dispatch(fetchAllTasks())
} catch (error) {
......
......@@ -48,7 +48,7 @@ const tasksReduсer = (state = initialState, action) => {
for (let copy of task.dateTimeTasks) {
newTasksWithoutInfoForCell.push({
...copy,
project: task?.project?.id,
project: task?.project,
mainTaskId: task.id,
executor: task.executor,
author: task.author,
......
......@@ -15,15 +15,12 @@ const usersReducer = (state = initialState, action) => {
case REGISTER_USER_REQUEST:
return {...state, loading: true};
case REGISTER_USER_SUCCESS:
console.log("register.user " , action)
return {...state, loading: false};
case REGISTER_USER_FAILURE:
return {...state, loading: false, registerError: action.error};
case LOGIN_USER_SUCCESS:
console.log("action.user " , action)
return {...state, user: action.user};
case LOGIN_USER_FAILURE:
console.log("action.error" , action.error)
return {...state, loginError: action.error};
case LOGOUT_USER_SUCCESS:
return {...state, user: null};
......
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