From 5c72dae35a70a44c87e8367f932f076f087bdf62 Mon Sep 17 00:00:00 2001 From: Mikola Date: Thu, 26 Oct 2023 14:44:39 +0300 Subject: [PATCH 01/59] marks --- .../TicketFullScreen/TicketFullScreen.jsx | 103 +++++++++++++++++- src/pages/ProjectTracker/ProjectTracker.js | 2 + 2 files changed, 104 insertions(+), 1 deletion(-) diff --git a/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx b/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx index 8950a8bc..656f28e3 100644 --- a/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx +++ b/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx @@ -53,6 +53,7 @@ import archive from "assets/images/archiveIcon.png"; import avatarMok from "assets/images/avatarMok.png"; import "./ticketFullScreen.scss"; +import arrowDown from "assets/icons/arrows/selectArrow.png"; registerLocale("ru", ru); @@ -88,6 +89,9 @@ export const TicketFullScreen = () => { const [uploadedFile, setUploadedFile] = useState(null); const [taskFiles, setTaskFiles] = useState([]); const [acceptModalOpen, setAcceptModalOpen] = useState(false); + const [taskTags, setTaskTags] = useState([]); + const [selectTagsOpen, setSelectTagsOpen] = useState(false); + const [correctProjectTags, setCorrectProjectTags] = useState([]); const { showNotification } = useNotification(); useEffect(() => { @@ -103,6 +107,7 @@ export const TicketFullScreen = () => { description: taskInfo.description, comment: "", }); + setTaskTags(taskInfo.mark) apiRequest( `/comment/get-by-entity?entity_type=2&entity_id=${taskInfo.id}` ).then((res) => { @@ -148,7 +153,7 @@ export const TicketFullScreen = () => { }); }); apiRequest( - `/project/get-project?project_id=${taskInfo.project_id}&expand=columns` + `/project/get-project?project_id=${taskInfo.project_id}&expand=columns,mark` ).then((res) => { setProjectInfo(res); setCorrectProjectUsers(res.projectUsers); @@ -158,6 +163,18 @@ export const TicketFullScreen = () => { ); }, []); + useEffect(() => { + let tagIds = taskTags.map((tag) => tag.id); + if (projectInfo.mark) { + setCorrectProjectTags( + projectInfo.mark.reduce((acc, cur) => { + if (!tagIds.includes(cur.id)) acc.push(cur); + return acc; + }, []) + ); + } + }, [taskTags, projectInfo]); + function deleteTask() { apiRequest("/task/update-task", { method: "PUT", @@ -481,6 +498,33 @@ export const TicketFullScreen = () => { setAcceptModalOpen(false); } + function deleteTagFromTask(tagId) { + apiRequest("/mark/detach", { + method: "DELETE", + data: { + mark_id: tagId, + entity_type: 2, + entity_id: taskInfo.id, + }, + }).then(() => { + setTaskTags((prevValue) => prevValue.filter((tag) => tag.id !== tagId)); + }); + } + + function addTagToTask(tagId) { + apiRequest("/mark/attach", { + method: "POST", + data: { + mark_id: tagId, + entity_type: 2, + entity_id: taskInfo.id, + }, + }).then((data) => { + setSelectTagsOpen(false); + setTaskTags((prevValue) => [...prevValue, data.mark]); + }); + } + return (
@@ -991,6 +1035,63 @@ export const TicketFullScreen = () => {
+
+
+ {taskTags.map((tag) => { + return ( +
+

{tag.slug}

+ delete deleteTagFromTask(tag.id)} + /> +
+ ); + })} +
+
setSelectTagsOpen(!selectTagsOpen)} + > + Выберите тег + arrow +
+ {selectTagsOpen && ( +
+ setSelectTagsOpen(false)} + className="tags__dropDown__close" + src={close} + alt="close" + /> + {correctProjectTags.map((tag) => { + return ( +
addTagToTask(tag.id)} + > +

{tag.slug}

+ +
+ ); + })} + {!Boolean(correctProjectTags.length) && ( +

Нет тегов

+ )} +
+ )} +
{ diff --git a/src/pages/ProjectTracker/ProjectTracker.js b/src/pages/ProjectTracker/ProjectTracker.js index b26786f3..c6edb0dc 100644 --- a/src/pages/ProjectTracker/ProjectTracker.js +++ b/src/pages/ProjectTracker/ProjectTracker.js @@ -335,6 +335,8 @@ export const ProjectTracker = () => { ...prevState, edit: false, })); + setTagInfo({description: "", name: ""}) + setColor("#aabbcc") }); } From db0f0e1f2474c241bc898aa1acf56d08ee11dfd7 Mon Sep 17 00:00:00 2001 From: Mikola Date: Thu, 26 Oct 2023 14:45:14 +0300 Subject: [PATCH 02/59] marks --- .../TicketFullScreen/TicketFullScreen.jsx | 94 +++++++++---------- src/pages/ProjectTracker/ProjectTracker.js | 4 +- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx b/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx index 656f28e3..7c24717b 100644 --- a/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx +++ b/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx @@ -38,6 +38,7 @@ import TrackerTaskComment from "@components/TrackerTaskComment/TrackerTaskCommen import arrow from "assets/icons/arrows/arrowCalendar.png"; import arrowStart from "assets/icons/arrows/arrowStart.png"; +import arrowDown from "assets/icons/arrows/selectArrow.png"; import calendarIcon from "assets/icons/calendar.svg"; import close from "assets/icons/close.png"; import fileDelete from "assets/icons/closeProjectPersons.svg"; @@ -53,7 +54,6 @@ import archive from "assets/images/archiveIcon.png"; import avatarMok from "assets/images/avatarMok.png"; import "./ticketFullScreen.scss"; -import arrowDown from "assets/icons/arrows/selectArrow.png"; registerLocale("ru", ru); @@ -107,7 +107,7 @@ export const TicketFullScreen = () => { description: taskInfo.description, comment: "", }); - setTaskTags(taskInfo.mark) + setTaskTags(taskInfo.mark); apiRequest( `/comment/get-by-entity?entity_type=2&entity_id=${taskInfo.id}` ).then((res) => { @@ -167,10 +167,10 @@ export const TicketFullScreen = () => { let tagIds = taskTags.map((tag) => tag.id); if (projectInfo.mark) { setCorrectProjectTags( - projectInfo.mark.reduce((acc, cur) => { - if (!tagIds.includes(cur.id)) acc.push(cur); - return acc; - }, []) + projectInfo.mark.reduce((acc, cur) => { + if (!tagIds.includes(cur.id)) acc.push(cur); + return acc; + }, []) ); } }, [taskTags, projectInfo]); @@ -1039,57 +1039,57 @@ export const TicketFullScreen = () => {
{taskTags.map((tag) => { return ( -
-

{tag.slug}

- delete deleteTagFromTask(tag.id)} - /> -
+
+

{tag.slug}

+ delete deleteTagFromTask(tag.id)} + /> +
); })}
setSelectTagsOpen(!selectTagsOpen)} + className="tags__select" + onClick={() => setSelectTagsOpen(!selectTagsOpen)} > Выберите тег arrow
{selectTagsOpen && ( -
- setSelectTagsOpen(false)} - className="tags__dropDown__close" - src={close} - alt="close" - /> - {correctProjectTags.map((tag) => { - return ( -
addTagToTask(tag.id)} - > -

{tag.slug}

- -
- ); - })} - {!Boolean(correctProjectTags.length) && ( -

Нет тегов

- )} -
+
+ setSelectTagsOpen(false)} + className="tags__dropDown__close" + src={close} + alt="close" + /> + {correctProjectTags.map((tag) => { + return ( +
addTagToTask(tag.id)} + > +

{tag.slug}

+ +
+ ); + })} + {!Boolean(correctProjectTags.length) && ( +

Нет тегов

+ )} +
)}
{ ...prevState, edit: false, })); - setTagInfo({description: "", name: ""}) - setColor("#aabbcc") + setTagInfo({ description: "", name: "" }); + setColor("#aabbcc"); }); } From 6a74ddb424359ce2a4ce39c5ff1fee9b0c7fcf5b Mon Sep 17 00:00:00 2001 From: MaxOvs19 Date: Fri, 27 Oct 2023 18:32:37 +0300 Subject: [PATCH 03/59] Fixed calendar and req profile --- src/components/Navigation/Navigation.jsx | 4 ++-- src/components/ProfileCalendar/ProfileCalendarComponent.jsx | 2 ++ src/components/ProfileHeader/ProfileHeader.jsx | 6 +++--- src/pages/Tracker/Tracker.jsx | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/Navigation/Navigation.jsx b/src/components/Navigation/Navigation.jsx index fb83c23a..cbac4365 100644 --- a/src/components/Navigation/Navigation.jsx +++ b/src/components/Navigation/Navigation.jsx @@ -73,8 +73,8 @@ export const Navigation = () => { if (localStorage.getItem("role_status") === "18") { return; } - apiRequest(`/profile/${localStorage.getItem("cardId")}`).then( - (profileInfo) => dispatch(setProfileInfo(profileInfo)) + apiRequest(`/user/me`).then((profileInfo) => + dispatch(setProfileInfo(profileInfo.userCard)) ); }, [dispatch]); diff --git a/src/components/ProfileCalendar/ProfileCalendarComponent.jsx b/src/components/ProfileCalendar/ProfileCalendarComponent.jsx index 3a862508..d7d78bde 100644 --- a/src/components/ProfileCalendar/ProfileCalendarComponent.jsx +++ b/src/components/ProfileCalendar/ProfileCalendarComponent.jsx @@ -329,6 +329,8 @@ export const ProfileCalendarComponent = React.memo( styles={"clear-days"} onClick={() => { resetRangeDays(); + toggleActivePeriod(); + toggleRangeDays(); }} > Сбросить diff --git a/src/components/ProfileHeader/ProfileHeader.jsx b/src/components/ProfileHeader/ProfileHeader.jsx index eb592312..96daa0fe 100644 --- a/src/components/ProfileHeader/ProfileHeader.jsx +++ b/src/components/ProfileHeader/ProfileHeader.jsx @@ -26,9 +26,9 @@ export const ProfileHeader = () => { if (localStorage.getItem("role_status") === "18") { return; } - apiRequest(`/profile/${localStorage.getItem("cardId")}`).then( - (profileInfo) => dispatch(setProfileInfo(profileInfo)) - ); + apiRequest(`/user/me`).then((profileInfo) => { + dispatch(setProfileInfo(profileInfo.userCard)); + }); }, [dispatch]); const handler = () => { diff --git a/src/pages/Tracker/Tracker.jsx b/src/pages/Tracker/Tracker.jsx index 3020d102..6ec7ac93 100644 --- a/src/pages/Tracker/Tracker.jsx +++ b/src/pages/Tracker/Tracker.jsx @@ -129,7 +129,7 @@ export const Tracker = () => { e.target.closest("img").classList.toggle("open-desc-item"); e.target .closest("td") - .querySelector(".taskList__table__name-project") + ?.querySelector(".taskList__table__name-project") .classList.toggle("hide-desc"); } From 6dd8ac76044a6c8f99b7eb992b9361b4984c737c Mon Sep 17 00:00:00 2001 From: Mikola Date: Sat, 28 Oct 2023 17:57:32 +0300 Subject: [PATCH 04/59] outClick --- .../Modal/Tracker/ModalTicket/ModalTicket.jsx | 57 +++++++++++++++- .../Tracker/ModalTicket/modalTicket.scss | 5 ++ .../TicketFullScreen/TicketFullScreen.jsx | 64 +++++++++++++++++- src/pages/ProjectTracker/ProjectTracker.js | 67 +++++++++++++++++++ 4 files changed, 189 insertions(+), 4 deletions(-) diff --git a/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx b/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx index 1ad5296f..6c042713 100644 --- a/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx +++ b/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx @@ -94,6 +94,7 @@ export const ModalTiсket = ({ const [acceptModalOpen, setAcceptModalOpen] = useState(false); const [selectTagsOpen, setSelectTagsOpen] = useState(false); const { showNotification } = useNotification(); + const [commentSendDisable, setCommentSendDisable] = useState(false) function deleteTask() { apiRequest("/task/update-task", { @@ -144,6 +145,8 @@ export const ModalTiсket = ({ } function createComment() { + if (!inputsValue.comment) return + setCommentSendDisable(true) apiRequest("/comment/create", { method: "POST", data: { @@ -153,6 +156,7 @@ export const ModalTiсket = ({ }, }).then((res) => { let newComment = res; + setCommentSendDisable(false) newComment.created_at = new Date(); newComment.subComments = []; setInputsValue((prevValue) => ({ ...prevValue, comment: "" })); @@ -285,6 +289,7 @@ export const ModalTiсket = ({ } useEffect(() => { + initListeners() apiRequest( `/comment/get-by-entity?entity_type=2&entity_id=${task.id}` ).then((res) => { @@ -502,14 +507,60 @@ export const ModalTiсket = ({ setAcceptModalOpen(false); } + const initListeners = () => { + document.addEventListener("click", closeByClickingOut); + }; + + const closeByClickingOut = (event) => { + const path = event.path || (event.composedPath && event.composedPath()); + + if ( + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("button-add-worker") || + div.classList.contains("dropdownList")) + ) + ) { + setDropListOpen(false); + setDropListMembersOpen(false) + } + + if ( + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("deadLine") || + div.classList.contains("react-datepicker-popper")) + ) + ) { + setDatePickerOpen(false) + } + + if ( + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("tags") || + div.classList.contains("tags__dropDown")) + ) + ) { + setSelectTagsOpen(false) + } + } + return (
setActive(false)} + onClick={(e) => { + if(e.target.className.includes('modal-tiket')) setActive(false) + }} >
e.stopPropagation()} >

@@ -646,7 +697,7 @@ export const ModalTiсket = ({ })); }} /> - +

{comments.map((comment) => { diff --git a/src/components/Modal/Tracker/ModalTicket/modalTicket.scss b/src/components/Modal/Tracker/ModalTicket/modalTicket.scss index 1fcbc308..810b9e16 100644 --- a/src/components/Modal/Tracker/ModalTicket/modalTicket.scss +++ b/src/components/Modal/Tracker/ModalTicket/modalTicket.scss @@ -584,6 +584,11 @@ margin-right: 18px; } + .disable { + pointer-events: none; + opacity: 0.5; + } + //&:focus-within { // border: 1px solid #0000004d; //} diff --git a/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx b/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx index 7c24717b..04aed23c 100644 --- a/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx +++ b/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx @@ -93,8 +93,10 @@ export const TicketFullScreen = () => { const [selectTagsOpen, setSelectTagsOpen] = useState(false); const [correctProjectTags, setCorrectProjectTags] = useState([]); const { showNotification } = useNotification(); + const [commentSendDisable, setCommentSendDisable] = useState(false) useEffect(() => { + initListeners() apiRequest(`/task/get-task?task_id=${ticketId.id}&expand=mark`).then( (taskInfo) => { setTaskInfo(taskInfo); @@ -217,6 +219,8 @@ export const TicketFullScreen = () => { } function createComment() { + if (!inputsValue.comment) return + setCommentSendDisable(true) apiRequest("/comment/create", { method: "POST", data: { @@ -226,6 +230,7 @@ export const TicketFullScreen = () => { }, }).then((res) => { let newComment = res; + setCommentSendDisable(false) newComment.created_at = new Date(); newComment.subComments = []; setInputsValue((prevValue) => ({ ...prevValue, comment: "" })); @@ -525,6 +530,63 @@ export const TicketFullScreen = () => { }); } + const initListeners = () => { + document.addEventListener("click", closeByClickingOut); + }; + + const closeByClickingOut = (event) => { + const path = event.path || (event.composedPath && event.composedPath()); + + if ( + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("button-add-worker") || + div.classList.contains("dropdownList")) + ) + ) { + setDropListOpen(false); + setDropListMembersOpen(false) + } + + if ( + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("deadLine") || + div.classList.contains("react-datepicker-popper")) + ) + ) { + setDatePickerOpen(false) + } + + if ( + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("tags") || + div.classList.contains("tags__dropDown")) + ) + ) { + setSelectTagsOpen(false) + } + + if ( + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("addPerson") || + div.classList.contains("persons__list")) + ) + ) { + setPersonListOpen(false) + } + } + return (
@@ -820,7 +882,7 @@ export const TicketFullScreen = () => { })); }} /> - send + send
{comments.map((comment) => { diff --git a/src/pages/ProjectTracker/ProjectTracker.js b/src/pages/ProjectTracker/ProjectTracker.js index 651ff383..1afa5725 100644 --- a/src/pages/ProjectTracker/ProjectTracker.js +++ b/src/pages/ProjectTracker/ProjectTracker.js @@ -90,6 +90,7 @@ export const ProjectTracker = () => { useEffect(() => { dispatch(activeLoader()); dispatch(setProjectBoardFetch(projectId.id)); + initListeners() }, []); useEffect(() => { @@ -353,6 +354,72 @@ export const ProjectTracker = () => { }); } + const initListeners = () => { + document.addEventListener("click", closeByClickingOut); + }; + + const closeByClickingOut = (event) => { + const path = event.path || (event.composedPath && event.composedPath()); + + if ( + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("addPerson") || + div.classList.contains("persons__list")) + ) + ) { + setPersonListOpen(false); + } + + if ( + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("tasks__head__executor") || + div.classList.contains("tasks__head__executorDropdown")) + ) + ) { + setSelectedExecutorOpen(false); + } + + if ( + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("tasks__head__tags") || + div.classList.contains("tags__list")) + ) + ) { + setTags({ + open: false, + add: false, + edit: false, + }); + } + + if ( + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("board__head__more") || + div.classList.contains("column__select")) + ) + ) { + setOpenColumnSelect((prevState) => { + const newState = {} + for (const key in prevState) { + newState[key] = false; + } + return newState; + }) + } + }; + return (
From 7fb04005bb3ab4f4930ab8270fde6710ac81bf21 Mon Sep 17 00:00:00 2001 From: Mikola Date: Sat, 28 Oct 2023 17:57:58 +0300 Subject: [PATCH 05/59] outClick --- .../Modal/Tracker/ModalTicket/ModalTicket.jsx | 72 ++++++++-------- .../TicketFullScreen/TicketFullScreen.jsx | 83 ++++++++++--------- src/pages/ProjectTracker/ProjectTracker.js | 62 +++++++------- 3 files changed, 112 insertions(+), 105 deletions(-) diff --git a/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx b/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx index 6c042713..c5055a9f 100644 --- a/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx +++ b/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx @@ -94,7 +94,7 @@ export const ModalTiсket = ({ const [acceptModalOpen, setAcceptModalOpen] = useState(false); const [selectTagsOpen, setSelectTagsOpen] = useState(false); const { showNotification } = useNotification(); - const [commentSendDisable, setCommentSendDisable] = useState(false) + const [commentSendDisable, setCommentSendDisable] = useState(false); function deleteTask() { apiRequest("/task/update-task", { @@ -145,8 +145,8 @@ export const ModalTiсket = ({ } function createComment() { - if (!inputsValue.comment) return - setCommentSendDisable(true) + if (!inputsValue.comment) return; + setCommentSendDisable(true); apiRequest("/comment/create", { method: "POST", data: { @@ -156,7 +156,7 @@ export const ModalTiсket = ({ }, }).then((res) => { let newComment = res; - setCommentSendDisable(false) + setCommentSendDisable(false); newComment.created_at = new Date(); newComment.subComments = []; setInputsValue((prevValue) => ({ ...prevValue, comment: "" })); @@ -289,7 +289,7 @@ export const ModalTiсket = ({ } useEffect(() => { - initListeners() + initListeners(); apiRequest( `/comment/get-by-entity?entity_type=2&entity_id=${task.id}` ).then((res) => { @@ -515,53 +515,51 @@ export const ModalTiсket = ({ const path = event.path || (event.composedPath && event.composedPath()); if ( - event && - !path.find( - (div) => - div.classList && - (div.classList.contains("button-add-worker") || - div.classList.contains("dropdownList")) - ) + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("button-add-worker") || + div.classList.contains("dropdownList")) + ) ) { setDropListOpen(false); - setDropListMembersOpen(false) + setDropListMembersOpen(false); } if ( - event && - !path.find( - (div) => - div.classList && - (div.classList.contains("deadLine") || - div.classList.contains("react-datepicker-popper")) - ) + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("deadLine") || + div.classList.contains("react-datepicker-popper")) + ) ) { - setDatePickerOpen(false) + setDatePickerOpen(false); } if ( - event && - !path.find( - (div) => - div.classList && - (div.classList.contains("tags") || - div.classList.contains("tags__dropDown")) - ) + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("tags") || + div.classList.contains("tags__dropDown")) + ) ) { - setSelectTagsOpen(false) + setSelectTagsOpen(false); } - } + }; return (
{ - if(e.target.className.includes('modal-tiket')) setActive(false) + if (e.target.className.includes("modal-tiket")) setActive(false); }} > -
+

@@ -697,7 +695,11 @@ export const ModalTiсket = ({ })); }} /> - +

{comments.map((comment) => { diff --git a/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx b/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx index 04aed23c..f3a90041 100644 --- a/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx +++ b/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx @@ -93,10 +93,10 @@ export const TicketFullScreen = () => { const [selectTagsOpen, setSelectTagsOpen] = useState(false); const [correctProjectTags, setCorrectProjectTags] = useState([]); const { showNotification } = useNotification(); - const [commentSendDisable, setCommentSendDisable] = useState(false) + const [commentSendDisable, setCommentSendDisable] = useState(false); useEffect(() => { - initListeners() + initListeners(); apiRequest(`/task/get-task?task_id=${ticketId.id}&expand=mark`).then( (taskInfo) => { setTaskInfo(taskInfo); @@ -219,8 +219,8 @@ export const TicketFullScreen = () => { } function createComment() { - if (!inputsValue.comment) return - setCommentSendDisable(true) + if (!inputsValue.comment) return; + setCommentSendDisable(true); apiRequest("/comment/create", { method: "POST", data: { @@ -230,7 +230,7 @@ export const TicketFullScreen = () => { }, }).then((res) => { let newComment = res; - setCommentSendDisable(false) + setCommentSendDisable(false); newComment.created_at = new Date(); newComment.subComments = []; setInputsValue((prevValue) => ({ ...prevValue, comment: "" })); @@ -538,54 +538,54 @@ export const TicketFullScreen = () => { const path = event.path || (event.composedPath && event.composedPath()); if ( - event && - !path.find( - (div) => - div.classList && - (div.classList.contains("button-add-worker") || - div.classList.contains("dropdownList")) - ) + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("button-add-worker") || + div.classList.contains("dropdownList")) + ) ) { setDropListOpen(false); - setDropListMembersOpen(false) + setDropListMembersOpen(false); } if ( - event && - !path.find( - (div) => - div.classList && - (div.classList.contains("deadLine") || - div.classList.contains("react-datepicker-popper")) - ) + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("deadLine") || + div.classList.contains("react-datepicker-popper")) + ) ) { - setDatePickerOpen(false) + setDatePickerOpen(false); } if ( - event && - !path.find( - (div) => - div.classList && - (div.classList.contains("tags") || - div.classList.contains("tags__dropDown")) - ) + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("tags") || + div.classList.contains("tags__dropDown")) + ) ) { - setSelectTagsOpen(false) + setSelectTagsOpen(false); } if ( - event && - !path.find( - (div) => - div.classList && - (div.classList.contains("addPerson") || - div.classList.contains("persons__list")) - ) + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("addPerson") || + div.classList.contains("persons__list")) + ) ) { - setPersonListOpen(false) + setPersonListOpen(false); } - } + }; return (
@@ -882,7 +882,12 @@ export const TicketFullScreen = () => { })); }} /> - send + send
{comments.map((comment) => { diff --git a/src/pages/ProjectTracker/ProjectTracker.js b/src/pages/ProjectTracker/ProjectTracker.js index 1afa5725..20b13c89 100644 --- a/src/pages/ProjectTracker/ProjectTracker.js +++ b/src/pages/ProjectTracker/ProjectTracker.js @@ -90,7 +90,7 @@ export const ProjectTracker = () => { useEffect(() => { dispatch(activeLoader()); dispatch(setProjectBoardFetch(projectId.id)); - initListeners() + initListeners(); }, []); useEffect(() => { @@ -362,37 +362,37 @@ export const ProjectTracker = () => { const path = event.path || (event.composedPath && event.composedPath()); if ( - event && - !path.find( - (div) => - div.classList && - (div.classList.contains("addPerson") || - div.classList.contains("persons__list")) - ) + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("addPerson") || + div.classList.contains("persons__list")) + ) ) { setPersonListOpen(false); } if ( - event && - !path.find( - (div) => - div.classList && - (div.classList.contains("tasks__head__executor") || - div.classList.contains("tasks__head__executorDropdown")) - ) + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("tasks__head__executor") || + div.classList.contains("tasks__head__executorDropdown")) + ) ) { setSelectedExecutorOpen(false); } if ( - event && - !path.find( - (div) => - div.classList && - (div.classList.contains("tasks__head__tags") || - div.classList.contains("tags__list")) - ) + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("tasks__head__tags") || + div.classList.contains("tags__list")) + ) ) { setTags({ open: false, @@ -402,21 +402,21 @@ export const ProjectTracker = () => { } if ( - event && - !path.find( - (div) => - div.classList && - (div.classList.contains("board__head__more") || - div.classList.contains("column__select")) - ) + event && + !path.find( + (div) => + div.classList && + (div.classList.contains("board__head__more") || + div.classList.contains("column__select")) + ) ) { setOpenColumnSelect((prevState) => { - const newState = {} + const newState = {}; for (const key in prevState) { newState[key] = false; } return newState; - }) + }); } }; From c2c57e3791c5b3dd49022021573ef3ac596394bc Mon Sep 17 00:00:00 2001 From: Mikola Date: Mon, 30 Oct 2023 01:35:06 +0300 Subject: [PATCH 06/59] create task with tags --- .../Modal/Tracker/ModalTicket/ModalTicket.jsx | 2 +- .../TicketFullScreen/TicketFullScreen.jsx | 2 +- .../Tracker/TrackerModal/TrackerModal.jsx | 92 +++++++++++-- .../Tracker/TrackerModal/trackerModal.scss | 122 +++++++++++++++++- src/pages/ProjectTracker/ProjectTracker.js | 1 + 5 files changed, 202 insertions(+), 17 deletions(-) diff --git a/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx b/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx index c5055a9f..c962ad91 100644 --- a/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx +++ b/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx @@ -933,7 +933,7 @@ export const ModalTiсket = ({ className="tags__select" onClick={() => setSelectTagsOpen(!selectTagsOpen)} > - Выберите тег + Выберете тег { className="tags__select" onClick={() => setSelectTagsOpen(!selectTagsOpen)} > - Выберите тег + Выберете тег { const dispatch = useDispatch(); const projectBoard = useSelector(getProjectBoard); @@ -76,6 +78,9 @@ export const TrackerModal = ({ ); const [selectExecutorTaskOpen, setSelectExecutorTaskOpen] = useState(false); const [correctProjectUsers, setCorrectProjectUsers] = useState([]); + const [correctProjectTags, setCorrectProjectTags] = useState([]); + const [taskTags, setTaskTags] = useState([]); + const [selectTagsOpen, setSelectTagsOpen] = useState(false) const [selectColumnPriorityOpen, setSelectColumnPriorityOpen] = useState(false); const { showNotification } = useNotification(); @@ -135,6 +140,18 @@ export const TrackerModal = ({ type: "error", }); } else { + for (let i = 0; i < taskTags.length; i++) { + apiRequest("/mark/attach", { + method: "POST", + data: { + mark_id: taskTags[i].id, + entity_type: 2, + entity_id: res.id + }, + }).then(() => { + setTaskTags([]) + }); + } if (selectedExecutorTask.user_id) { apiRequest("/task/update-task", { method: "PUT", @@ -306,6 +323,18 @@ export const TrackerModal = ({ } }, [active]); + useEffect(() => { + let tagIds = taskTags.map((tag) => tag.id); + if (projectMarks) { + setCorrectProjectTags( + projectMarks.reduce((acc, cur) => { + if (!tagIds.includes(cur.id)) acc.push(cur); + return acc; + }, []) + ); + } + }, [taskTags, projectMarks]); + return (
- Этап -
- Backlog - arrow +
+

Создатель : {profileInfo?.fio}

+ avatar
+ {/*Этап*/} + {/*
*/} + {/* Backlog*/} + {/* arrow*/} + {/*
*/}
@@ -445,16 +485,40 @@ export const TrackerModal = ({ />
-
-

Создатель : {profileInfo?.fio}

- avatar +
+
+
+ {taskTags.map((tag) => { + return
+

{tag.slug}

+ delete setTaskTags((prevState) => prevState.filter((prevTag) => prevTag.id !== tag.id))} + /> +
+ }) + } +
+
setSelectTagsOpen(!selectTagsOpen)}> + Выберете тег + arrow +
+
+ {selectTagsOpen && +
+ setSelectTagsOpen(false)}/> + {correctProjectTags.map((tag) => { + return
setTaskTags((prevState) => ([...prevState, tag]))}> +

{tag.slug}

+ +
+ }) + } + {Boolean(!correctProjectTags.length) &&

Нет тегов

} +
+ }
diff --git a/src/components/Modal/Tracker/TrackerModal/trackerModal.scss b/src/components/Modal/Tracker/TrackerModal/trackerModal.scss index 76e26246..2f7bd14e 100644 --- a/src/components/Modal/Tracker/TrackerModal/trackerModal.scss +++ b/src/components/Modal/Tracker/TrackerModal/trackerModal.scss @@ -357,7 +357,6 @@ display: flex; align-items: center; column-gap: 9.5px; - margin-bottom: 30px; p { color: #2D4A17; font-size: 14px; @@ -371,6 +370,127 @@ } } + &__tags { + display: flex; + flex-direction: column; + position: relative; + + .tags { + &__selected { + width: 393px; + font-weight: 300; + line-height: 18px; + font-size: 15px; + margin-bottom: 17.5px; + border-radius: 8px; + display: flex; + flex-direction: column; + row-gap: 8px; + + &__name { + cursor: pointer; + display: flex; + justify-content: space-between; + padding: 5px; + border-radius: 8px; + border: 1px solid #e4e4e4; + + img { + transition: all 0.3s ease; + } + + .arrow--open { + transform: rotate(180deg); + } + } + + &__items { + display: flex; + flex-wrap: wrap; + padding: 0; + width: 100%; + gap: 8px; + max-width: 393px; + + .selectedTag { + display: flex; + padding: 3px 5px 3px 8px; + border-radius: 8px; + align-items: center; + column-gap: 8px; + + p { + font-weight: 600; + font-size: 15px; + margin: 0; + line-height: 15px; + color: white; + } + + .delete { + cursor: pointer; + width: 12px; + height: 12px; + } + } + } + } + + &__dropDown { + display: flex; + flex-direction: column; + width: 100%; + position: absolute; + border-radius: 8px; + border: 1px solid #e4e4e4; + top: 90%; + z-index: 101; + padding: 20px 10px 10px; + background: white; + row-gap: 8px; + + .close { + position: absolute; + cursor: pointer; + width: 20px; + height: 20px; + right: 5px; + top: 0; + } + + .tag__item { + display: flex; + width: 100%; + cursor: pointer; + column-gap: 8px; + padding: 5px; + border: 1px solid #ececec; + border-radius: 8px; + justify-content: space-between; + + p { + font-size: 18px; + font-weight: 500; + margin: 0; + line-height: 20px; + text-decoration: none; + } + + span { + width: 18px; + height: 18px; + border-radius: 50px; + } + } + + .noTags { + text-align: center; + font-size: 18px; + } + } + } + } + .select__executor { background: #F1F1F1; width: 393px; diff --git a/src/pages/ProjectTracker/ProjectTracker.js b/src/pages/ProjectTracker/ProjectTracker.js index 20b13c89..25d95d23 100644 --- a/src/pages/ProjectTracker/ProjectTracker.js +++ b/src/pages/ProjectTracker/ProjectTracker.js @@ -469,6 +469,7 @@ export const ProjectTracker = () => { selectedTab={selectedTab} priorityTask={priorityTask} projectUsers={projectBoard.projectUsers} + projectMarks={projectBoard.mark} /> {loader && } From 512a8c61212582e4f9a4802b5b54ff177c3749b6 Mon Sep 17 00:00:00 2001 From: Mikola Date: Mon, 30 Oct 2023 01:35:28 +0300 Subject: [PATCH 07/59] create task with tags --- .../Tracker/TrackerModal/TrackerModal.jsx | 107 ++++++++++++------ 1 file changed, 70 insertions(+), 37 deletions(-) diff --git a/src/components/Modal/Tracker/TrackerModal/TrackerModal.jsx b/src/components/Modal/Tracker/TrackerModal/TrackerModal.jsx index 160f104d..0b893a2f 100644 --- a/src/components/Modal/Tracker/TrackerModal/TrackerModal.jsx +++ b/src/components/Modal/Tracker/TrackerModal/TrackerModal.jsx @@ -35,11 +35,11 @@ import ModalLayout from "@components/Common/ModalLayout/ModalLayout"; import arrowCreateTask from "assets/icons/arrows/arrowCreateTask.svg"; import arrowRight from "assets/icons/arrows/arrowRightCreateTask.svg"; import arrowDown from "assets/icons/arrows/selectArrow.png"; +import close from "assets/icons/close.png"; import calendarImg from "assets/icons/createTaskCalendar.svg"; import avatarMok from "assets/images/avatarMok.png"; import "./trackerModal.scss"; -import close from "assets/icons/close.png"; registerLocale("ru", ru); @@ -52,7 +52,7 @@ export const TrackerModal = ({ projectId, priorityTask, projectUsers, - projectMarks + projectMarks, }) => { const dispatch = useDispatch(); const projectBoard = useSelector(getProjectBoard); @@ -80,7 +80,7 @@ export const TrackerModal = ({ const [correctProjectUsers, setCorrectProjectUsers] = useState([]); const [correctProjectTags, setCorrectProjectTags] = useState([]); const [taskTags, setTaskTags] = useState([]); - const [selectTagsOpen, setSelectTagsOpen] = useState(false) + const [selectTagsOpen, setSelectTagsOpen] = useState(false); const [selectColumnPriorityOpen, setSelectColumnPriorityOpen] = useState(false); const { showNotification } = useNotification(); @@ -146,10 +146,10 @@ export const TrackerModal = ({ data: { mark_id: taskTags[i].id, entity_type: 2, - entity_id: res.id + entity_id: res.id, }, }).then(() => { - setTaskTags([]) + setTaskTags([]); }); } if (selectedExecutorTask.user_id) { @@ -327,10 +327,10 @@ export const TrackerModal = ({ let tagIds = taskTags.map((tag) => tag.id); if (projectMarks) { setCorrectProjectTags( - projectMarks.reduce((acc, cur) => { - if (!tagIds.includes(cur.id)) acc.push(cur); - return acc; - }, []) + projectMarks.reduce((acc, cur) => { + if (!tagIds.includes(cur.id)) acc.push(cur); + return acc; + }, []) ); } }, [taskTags, projectMarks]); @@ -436,12 +436,12 @@ export const TrackerModal = ({

Создатель : {profileInfo?.fio}

avatar
{/*Этап*/} @@ -486,39 +486,72 @@ export const TrackerModal = ({
-
-
+
+
{taskTags.map((tag) => { - return
-

{tag.slug}

- +

{tag.slug}

+ delete setTaskTags((prevState) => prevState.filter((prevTag) => prevTag.id !== tag.id))} - /> -
- }) - } + onClick={() => + setTaskTags((prevState) => + prevState.filter( + (prevTag) => prevTag.id !== tag.id + ) + ) + } + /> +
+ ); + })}
-
setSelectTagsOpen(!selectTagsOpen)}> +
setSelectTagsOpen(!selectTagsOpen)} + > Выберете тег - arrow + arrow
- {selectTagsOpen && -
- setSelectTagsOpen(false)}/> - {correctProjectTags.map((tag) => { - return
setTaskTags((prevState) => ([...prevState, tag]))}> + {selectTagsOpen && ( +
+ setSelectTagsOpen(false)} + /> + {correctProjectTags.map((tag) => { + return ( +
+ setTaskTags((prevState) => [...prevState, tag]) + } + >

{tag.slug}

- }) - } - {Boolean(!correctProjectTags.length) &&

Нет тегов

} -
- } + ); + })} + {Boolean(!correctProjectTags.length) && ( +

Нет тегов

+ )} +
+ )}
From ad111d0c6c6f79f69f85c0c1e7cbbdf951d13e6b Mon Sep 17 00:00:00 2001 From: MaxOvs19 Date: Mon, 30 Oct 2023 11:40:40 +0300 Subject: [PATCH 08/59] Fixed req in candidate --- src/components/Candidate/Candidate.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Candidate/Candidate.jsx b/src/components/Candidate/Candidate.jsx index 9ec8fe06..b7a4126c 100644 --- a/src/components/Candidate/Candidate.jsx +++ b/src/components/Candidate/Candidate.jsx @@ -32,7 +32,7 @@ const Candidate = () => { if (localStorage.getItem("role_status") !== "18") { return ; } - const { id: candidateId } = useParams(); + // const { id: candidateId } = useParams(); const navigate = useNavigate(); @@ -47,10 +47,10 @@ const Candidate = () => { }, []); useEffect(() => { - apiRequest(`/profile/${candidateId}`, { - params: Number(candidateId), - }).then((el) => dispatch(currentCandidate(el))); - }, [dispatch, candidateId]); + apiRequest(`/user/me`, {}).then((el) => + dispatch(currentCandidate(el.userCard)) + ); + }, [dispatch]); const { position_id, skillValues, vc_text: text } = currentCandidateObj; From 7304b01a5dd62e9fb7db479c654ef6725bad3909 Mon Sep 17 00:00:00 2001 From: Mikola Date: Fri, 3 Nov 2023 16:23:21 +0300 Subject: [PATCH 09/59] registration --- .../Modal/AcceptModal/AcceptModal.jsx | 9 ++-- .../ModalRegistration/ModalRegistration.jsx | 53 +++++++++++++++---- .../ModalRegistration/modalRegistration.scss | 5 ++ .../Modal/Tracker/ModalTicket/ModalTicket.jsx | 1 + .../TicketFullScreen/TicketFullScreen.jsx | 5 +- src/pages/ProjectTracker/ProjectTracker.js | 24 ++++++++- 6 files changed, 81 insertions(+), 16 deletions(-) diff --git a/src/components/Modal/AcceptModal/AcceptModal.jsx b/src/components/Modal/AcceptModal/AcceptModal.jsx index a2b3750b..c115a4fe 100644 --- a/src/components/Modal/AcceptModal/AcceptModal.jsx +++ b/src/components/Modal/AcceptModal/AcceptModal.jsx @@ -4,15 +4,18 @@ import close from "assets/icons/closeProjectPersons.svg"; import "./acceptModal.scss"; -export const AcceptModal = ({ closeModal, agreeHandler }) => { +export const AcceptModal = ({title, closeModal, agreeHandler }) => { return (

- Вы точно хотите переместить задачу в архив? + {title}

-
{acceptModalOpen && ( - + )}
diff --git a/src/pages/ProjectTracker/ProjectTracker.js b/src/pages/ProjectTracker/ProjectTracker.js index 25d95d23..9a19dd5c 100644 --- a/src/pages/ProjectTracker/ProjectTracker.js +++ b/src/pages/ProjectTracker/ProjectTracker.js @@ -39,6 +39,7 @@ import { Navigation } from "@components/Navigation/Navigation"; import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs"; import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader"; import TrackerSelectColumn from "@components/TrackerSelectColumn/TrackerSelectColumn"; +import AcceptModal from "@components/Modal/AcceptModal/AcceptModal"; import arrow from "assets/icons/arrows/arrowCalendar.png"; import arrowDown from "assets/icons/arrows/selectArrow.png"; @@ -74,6 +75,8 @@ export const ProjectTracker = () => { add: false, edit: false, }); + const [acceptModalOpen, setAcceptModalOpen] = useState(false); + const [currentColumnDelete, setCurrentColumnDelete] = useState(null) const [color, setColor] = useState("#aabbcc"); const [tagInfo, setTagInfo] = useState({ description: "", name: "" }); const [checkBoxParticipateTasks, setCheckBoxParticipateTasks] = @@ -420,6 +423,10 @@ export const ProjectTracker = () => { } }; + function closeAcceptModal() { + setAcceptModalOpen(false); + } + return (
@@ -905,7 +912,15 @@ export const ProjectTracker = () => {
deleteColumn(column)} + onClick={() => { + if (column.tasks.length) { + setAcceptModalOpen(true) + setCurrentColumnDelete(column) + } else { + deleteColumn(column) + } + } + } > delete Удалить @@ -1051,6 +1066,13 @@ export const ProjectTracker = () => { )}
+ {acceptModalOpen && ( + deleteColumn(currentColumnDelete)} + /> + )}