commit
e145e6084c
@ -71,6 +71,7 @@ export const ProjectTiket = ({ project, index }) => {
|
|||||||
active={modalAdd}
|
active={modalAdd}
|
||||||
setActive={setModalAdd}
|
setActive={setModalAdd}
|
||||||
defautlInput={project.name}
|
defautlInput={project.name}
|
||||||
|
projectId={project.id}
|
||||||
></TrackerModal>
|
></TrackerModal>
|
||||||
|
|
||||||
<ModalSelect active={modalSelect}>
|
<ModalSelect active={modalSelect}>
|
||||||
|
@ -7,6 +7,7 @@ import {
|
|||||||
getValueModalType,
|
getValueModalType,
|
||||||
setProject,
|
setProject,
|
||||||
setProjectBoardFetch,
|
setProjectBoardFetch,
|
||||||
|
editProjectName
|
||||||
} from "../../../redux/projectsTrackerSlice";
|
} from "../../../redux/projectsTrackerSlice";
|
||||||
|
|
||||||
import "./trackerModal.scss";
|
import "./trackerModal.scss";
|
||||||
@ -17,6 +18,7 @@ export const TrackerModal = ({
|
|||||||
selectedTab,
|
selectedTab,
|
||||||
defautlInput,
|
defautlInput,
|
||||||
titleProject,
|
titleProject,
|
||||||
|
projectId
|
||||||
}) => {
|
}) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const projectBoard = useSelector(getProjectBoard);
|
const projectBoard = useSelector(getProjectBoard);
|
||||||
@ -24,7 +26,7 @@ export const TrackerModal = ({
|
|||||||
const modalType = useSelector(getValueModalType);
|
const modalType = useSelector(getValueModalType);
|
||||||
|
|
||||||
const [emailWorker, setEmailWorker] = useState("");
|
const [emailWorker, setEmailWorker] = useState("");
|
||||||
const [ProjectName, setProjectName] = useState(defautlInput);
|
const [projectName, setProjectName] = useState(defautlInput);
|
||||||
const [valueColumn, setValueColumn] = useState("");
|
const [valueColumn, setValueColumn] = useState("");
|
||||||
const [nameProject, setNameProject] = useState("");
|
const [nameProject, setNameProject] = useState("");
|
||||||
|
|
||||||
@ -73,10 +75,17 @@ export const TrackerModal = ({
|
|||||||
setDescriptionTicket("");
|
setDescriptionTicket("");
|
||||||
}
|
}
|
||||||
|
|
||||||
function editProject() {}
|
function editProject() {
|
||||||
|
apiRequest("/project/update", {
|
||||||
function editProjectName(value) {
|
method: "PUT",
|
||||||
setProjectName(value);
|
data: {
|
||||||
|
project_id: projectId,
|
||||||
|
name: projectName
|
||||||
|
},
|
||||||
|
}).then((res) => {
|
||||||
|
setActive(false)
|
||||||
|
dispatch(editProjectName({id: projectId, name: projectName}))
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function createProject() {
|
function createProject() {
|
||||||
@ -88,7 +97,7 @@ export const TrackerModal = ({
|
|||||||
data: {
|
data: {
|
||||||
user_id: localStorage.getItem("id"),
|
user_id: localStorage.getItem("id"),
|
||||||
name: nameProject,
|
name: nameProject,
|
||||||
status: 1,
|
status: 19,
|
||||||
},
|
},
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
const result = { ...res, columns: [] };
|
const result = { ...res, columns: [] };
|
||||||
@ -162,8 +171,8 @@ export const TrackerModal = ({
|
|||||||
<div className="input-container">
|
<div className="input-container">
|
||||||
<input
|
<input
|
||||||
className="name-project"
|
className="name-project"
|
||||||
value={ProjectName}
|
value={projectName}
|
||||||
onChange={(e) => editProjectName(e.target.value)}
|
onChange={(e) => setProjectName(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -38,45 +38,9 @@ export const Tracker = () => {
|
|||||||
const [allTasks, setAllTasks] = useState([]);
|
const [allTasks, setAllTasks] = useState([]);
|
||||||
const [filteredAllTasks, setFilteredAllTasks] = useState([]);
|
const [filteredAllTasks, setFilteredAllTasks] = useState([]);
|
||||||
const [loader, setLoader] = useState(false);
|
const [loader, setLoader] = useState(false);
|
||||||
|
const [filterCompleteTasks, setFilterCompleteTasks] = useState([]);
|
||||||
|
// const [allCompletedTasks, setAllCompletedTasks] = useState([])
|
||||||
|
|
||||||
const [archiveProjects] = useState([
|
|
||||||
{
|
|
||||||
name: "Будущее России",
|
|
||||||
date: "7 марта 2023 г",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Будущее России",
|
|
||||||
date: "7 марта 2023 г",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
const [completeTasks] = useState([
|
|
||||||
{
|
|
||||||
name: "PR - 2245",
|
|
||||||
description: "Сверстать часть таблицы. Сверстать часть таблицы",
|
|
||||||
dateComplete: "7 марта 2023 г",
|
|
||||||
avatarDo: avatarTest,
|
|
||||||
project: "Будущее России",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "PR - 2245",
|
|
||||||
description: "Сверстать часть таблицы. Сверстать часть таблицы",
|
|
||||||
dateComplete: "7 марта 2023 г",
|
|
||||||
avatarDo: avatarTest,
|
|
||||||
project: "Будущее России",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "PR - 2245",
|
|
||||||
description: "Сверстать часть таблицы. Сверстать часть таблицы",
|
|
||||||
dateComplete: "7 марта 2023 г",
|
|
||||||
avatarDo: avatarTest,
|
|
||||||
project: "Будущее России",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
const [filterCompleteTasks, setFilterCompleteTasks] = useState(completeTasks);
|
|
||||||
|
|
||||||
// Modal State
|
|
||||||
const [modalCreateProject, setModalCreateProject] = useState(false);
|
const [modalCreateProject, setModalCreateProject] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -88,6 +52,11 @@ export const Tracker = () => {
|
|||||||
).then((el) => {
|
).then((el) => {
|
||||||
dispatch(setAllProjects(el.projects));
|
dispatch(setAllProjects(el.projects));
|
||||||
setLoader(false);
|
setLoader(false);
|
||||||
|
// setAllCompletedTasks(el.projects.filter((project) => {
|
||||||
|
// if (project.status === 10 && project.columns.length) {
|
||||||
|
// return project
|
||||||
|
// }
|
||||||
|
// }).map((project) => { return project.columns}))
|
||||||
});
|
});
|
||||||
apiRequest(
|
apiRequest(
|
||||||
`/task/get-user-tasks?user_id=${localStorage.getItem("id")}`
|
`/task/get-user-tasks?user_id=${localStorage.getItem("id")}`
|
||||||
@ -120,21 +89,21 @@ export const Tracker = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function filterArchiveTasks(e) {
|
function filterArchiveTasks(e) {
|
||||||
setFilterCompleteTasks(
|
// setFilterCompleteTasks(
|
||||||
completeTasks.filter((item) => {
|
// completeTasks.filter((item) => {
|
||||||
if (!e.target.value) {
|
// if (!e.target.value) {
|
||||||
return item;
|
// return item;
|
||||||
}
|
// }
|
||||||
if (
|
// if (
|
||||||
item.name.toLowerCase().startsWith(e.target.value.toLowerCase()) ||
|
// item.name.toLowerCase().startsWith(e.target.value.toLowerCase()) ||
|
||||||
item.description
|
// item.description
|
||||||
.toLowerCase()
|
// .toLowerCase()
|
||||||
.startsWith(e.target.value.toLowerCase())
|
// .startsWith(e.target.value.toLowerCase())
|
||||||
) {
|
// ) {
|
||||||
return item;
|
// return item;
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -340,19 +309,19 @@ export const Tracker = () => {
|
|||||||
<div className="archive__projects">
|
<div className="archive__projects">
|
||||||
<div className="archive__title">
|
<div className="archive__title">
|
||||||
<h3>Архив проектов:</h3>
|
<h3>Архив проектов:</h3>
|
||||||
<p>{archiveProjects.length} проект(ов)</p>
|
<p>{projects.filter((project) => project.status === 10).length} проект(ов)</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="archive__tasksWrapper">
|
<div className="archive__tasksWrapper">
|
||||||
{Boolean(archiveProjects) ? (
|
{Boolean(projects.filter((project) => project.status === 10).length) ? (
|
||||||
archiveProjects.map((project, index) => {
|
projects.map((project, index) => {
|
||||||
return (
|
return project.status === 10 ? (
|
||||||
<div className="archive__completeTask" key={index}>
|
<div className="archive__completeTask" key={index}>
|
||||||
<div className="archive__completeTask__description">
|
<div className="archive__completeTask__description">
|
||||||
<p>{project.name}</p>
|
<p>{project.name}</p>
|
||||||
<p className="date">{project.date}</p>
|
<p className="date">{project.date}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
): '';
|
||||||
})
|
})
|
||||||
) : (
|
) : (
|
||||||
<div className="archive__noItem">
|
<div className="archive__noItem">
|
||||||
|
@ -27,9 +27,11 @@ export const projectsTrackerSlice = createSlice({
|
|||||||
state.toggleTab = action.payload;
|
state.toggleTab = action.payload;
|
||||||
},
|
},
|
||||||
deleteProject: (state, action) => {
|
deleteProject: (state, action) => {
|
||||||
state.projects = state.projects.filter(
|
state.projects.forEach((project) => {
|
||||||
(project) => project.id !== action.payload.id
|
if (project.id === action.payload.id) {
|
||||||
);
|
project.status = 10
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
activeLoader: (state) => {
|
activeLoader: (state) => {
|
||||||
state.boardLoader = true
|
state.boardLoader = true
|
||||||
@ -53,6 +55,13 @@ export const projectsTrackerSlice = createSlice({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
editProjectName: (state, action) => {
|
||||||
|
state.projects.forEach((project) => {
|
||||||
|
if (project.id === action.payload.id) {
|
||||||
|
project.name = action.payload.name
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
modalToggle: (state, action) => {
|
modalToggle: (state, action) => {
|
||||||
state.modalType = action.payload;
|
state.modalType = action.payload;
|
||||||
},
|
},
|
||||||
@ -72,7 +81,8 @@ export const {
|
|||||||
moveProjectTask,
|
moveProjectTask,
|
||||||
setToggleTab,
|
setToggleTab,
|
||||||
modalToggle,
|
modalToggle,
|
||||||
activeLoader
|
activeLoader,
|
||||||
|
editProjectName
|
||||||
} = projectsTrackerSlice.actions;
|
} = projectsTrackerSlice.actions;
|
||||||
|
|
||||||
export const getProjects = (state) => state.tracker.projects;
|
export const getProjects = (state) => state.tracker.projects;
|
||||||
|
Loading…
Reference in New Issue
Block a user