From a66bea4462eb4ad63ac856a0036540ac1fd2b3d2 Mon Sep 17 00:00:00 2001 From: M1kola Date: Thu, 31 Aug 2023 01:58:35 +0300 Subject: [PATCH] tracker tasks --- src/components/FileTracker/FileTracker.jsx | 47 +++++++++++++++++++ .../Modal/Tracker/ModalTicket/ModalTicket.jsx | 36 +++++--------- .../Tracker/ModalTicket/modalTicket.scss | 21 +++++++++ .../TicketFullScreen/TicketFullScreen.jsx | 10 +++- src/components/Navigation/Navigation.jsx | 1 + src/pages/ProjectTracker/ProjectTracker.js | 1 + 6 files changed, 89 insertions(+), 27 deletions(-) create mode 100644 src/components/FileTracker/FileTracker.jsx diff --git a/src/components/FileTracker/FileTracker.jsx b/src/components/FileTracker/FileTracker.jsx new file mode 100644 index 00000000..5b967636 --- /dev/null +++ b/src/components/FileTracker/FileTracker.jsx @@ -0,0 +1,47 @@ +import React, {useState} from "react"; +import { backendImg } from "@utils/helper"; +import close from "assets/icons/closeProjectPersons.svg"; + +import {apiRequest} from "@api/request"; + +const FileTracker = ({ file, setDeletedTask, taskId }) => { + const [openImg, setOpenImg] = useState(false) + function deleteFile(file) { + apiRequest("/file/detach", { + method: "DELETE", + data: { + file_id: file.id, + entity_type: 2, + entity_id: taskId, + status: 0, + }, + }).then(() => { + setDeletedTask(file); + }); + } + + return ( +
+ {if(openImg) setOpenImg(!openImg)}} + > + img + {if(!openImg) setOpenImg(!openImg)}} + /> + {!openImg && +
deleteFile(file)} + > + delete +
+ } +
+ ); +}; + +export default FileTracker; diff --git a/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx b/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx index 5547e1cc..8e249358 100644 --- a/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx +++ b/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx @@ -25,6 +25,7 @@ import { useNotification } from "@hooks/useNotification"; import AcceptModal from "@components/Modal/AcceptModal/AcceptModal"; import TrackerModal from "@components/Modal/Tracker/TrackerModal/TrackerModal"; import TrackerTaskComment from "@components/TrackerTaskComment/TrackerTaskComment"; +import FileTracker from "@components/FileTracker/FileTracker"; import archive from "assets/icons/archive.svg"; import arrow from "assets/icons/arrows/arrowStart.png"; @@ -52,6 +53,7 @@ export const ModalTiсket = ({ projectId, projectName, projectUsers, + projectOwnerId }) => { const dispatch = useDispatch(); const [addSubtask, setAddSubtask] = useState(false); @@ -371,19 +373,9 @@ export const ModalTiсket = ({ } function deleteFile(file) { - apiRequest("/file/detach", { - method: "DELETE", - data: { - file_id: file.id, - entity_type: 2, - entity_id: task.id, - status: 0, - }, - }).then(() => { - setTaskFiles((prevValue) => + setTaskFiles((prevValue) => prevValue.filter((item) => item.id !== file.id) ); - }); } function startTimer() { @@ -533,19 +525,12 @@ export const ModalTiсket = ({
{taskFiles.map((file) => { return ( -
- img -
deleteFile(file)} - > - delete -
-
); })}
@@ -838,11 +823,12 @@ export const ModalTiсket = ({

ссылка на задачу

-
+

в архив

-
+

удалить

diff --git a/src/components/Modal/Tracker/ModalTicket/modalTicket.scss b/src/components/Modal/Tracker/ModalTicket/modalTicket.scss index 3d1397d4..4ef41186 100644 --- a/src/components/Modal/Tracker/ModalTicket/modalTicket.scss +++ b/src/components/Modal/Tracker/ModalTicket/modalTicket.scss @@ -367,6 +367,7 @@ } .taskFile { + cursor: pointer; position: relative; .imgFile { max-width: 170px; @@ -400,6 +401,26 @@ } } } + + .ImgOpened { + position: fixed; + width: 100vw; + height: 100vh; + top: 0; + left: 0; + display: flex; + justify-content: center; + align-items: center; + z-index: 100; + background-color: rgba(0, 0, 0, 0.2); + + .imgFile { + width: 90vw; + height: 90vh; + max-width: none; + max-height: none; + } + } } .fileLoaded { diff --git a/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx b/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx index 54e92a72..e226ad79 100644 --- a/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx +++ b/src/components/Modal/Tracker/TicketFullScreen/TicketFullScreen.jsx @@ -13,6 +13,8 @@ import { setToggleTab, } from "@redux/projectsTrackerSlice"; +import { getProfileInfo } from "@redux/outstaffingSlice"; + import { backendImg, caseOfNum, @@ -75,6 +77,7 @@ export const TicketFullScreen = () => { minute: 0, seconds: 0, }); + const profileInfo = useSelector(getProfileInfo); const [timerId, setTimerId] = useState(null); const [dropListOpen, setDropListOpen] = useState(false); const [correctProjectUsers, setCorrectProjectUsers] = useState([]); @@ -997,11 +1000,14 @@ export const TicketFullScreen = () => { link

ссылка на задачу

-
+
arch

в архив

-
+
delete

удалить

diff --git a/src/components/Navigation/Navigation.jsx b/src/components/Navigation/Navigation.jsx index ba43bc79..fb83c23a 100644 --- a/src/components/Navigation/Navigation.jsx +++ b/src/components/Navigation/Navigation.jsx @@ -17,6 +17,7 @@ export const Navigation = () => { const [user] = useState( localStorage.getItem("role_status") === "18" ? "partner" : "developer" ); + const [navInfo] = useState({ developer: [ { diff --git a/src/pages/ProjectTracker/ProjectTracker.js b/src/pages/ProjectTracker/ProjectTracker.js index 18d83967..f5fdca57 100644 --- a/src/pages/ProjectTracker/ProjectTracker.js +++ b/src/pages/ProjectTracker/ProjectTracker.js @@ -546,6 +546,7 @@ export const ProjectTracker = () => { projectId={projectBoard.id} projectName={projectBoard.name} projectUsers={projectBoard.projectUsers} + projectOwnerId={projectBoard.owner_id} /> )}