tracker tasks
This commit is contained in:
parent
86d29475aa
commit
a66bea4462
47
src/components/FileTracker/FileTracker.jsx
Normal file
47
src/components/FileTracker/FileTracker.jsx
Normal file
@ -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 (
|
||||||
|
<div className={openImg ? "taskFile ImgOpened" : "taskFile"} key={file.id}
|
||||||
|
onClick={() =>
|
||||||
|
{if(openImg) setOpenImg(!openImg)}}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
className="imgFile"
|
||||||
|
src={backendImg(file.file?.url)}
|
||||||
|
alt="img"
|
||||||
|
onClick={() =>
|
||||||
|
{if(!openImg) setOpenImg(!openImg)}}
|
||||||
|
/>
|
||||||
|
{!openImg &&
|
||||||
|
<div
|
||||||
|
className="deleteFile"
|
||||||
|
onClick={() => deleteFile(file)}
|
||||||
|
>
|
||||||
|
<img src={close} alt="delete" />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default FileTracker;
|
@ -25,6 +25,7 @@ import { useNotification } from "@hooks/useNotification";
|
|||||||
import AcceptModal from "@components/Modal/AcceptModal/AcceptModal";
|
import AcceptModal from "@components/Modal/AcceptModal/AcceptModal";
|
||||||
import TrackerModal from "@components/Modal/Tracker/TrackerModal/TrackerModal";
|
import TrackerModal from "@components/Modal/Tracker/TrackerModal/TrackerModal";
|
||||||
import TrackerTaskComment from "@components/TrackerTaskComment/TrackerTaskComment";
|
import TrackerTaskComment from "@components/TrackerTaskComment/TrackerTaskComment";
|
||||||
|
import FileTracker from "@components/FileTracker/FileTracker";
|
||||||
|
|
||||||
import archive from "assets/icons/archive.svg";
|
import archive from "assets/icons/archive.svg";
|
||||||
import arrow from "assets/icons/arrows/arrowStart.png";
|
import arrow from "assets/icons/arrows/arrowStart.png";
|
||||||
@ -52,6 +53,7 @@ export const ModalTiсket = ({
|
|||||||
projectId,
|
projectId,
|
||||||
projectName,
|
projectName,
|
||||||
projectUsers,
|
projectUsers,
|
||||||
|
projectOwnerId
|
||||||
}) => {
|
}) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const [addSubtask, setAddSubtask] = useState(false);
|
const [addSubtask, setAddSubtask] = useState(false);
|
||||||
@ -371,19 +373,9 @@ export const ModalTiсket = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function deleteFile(file) {
|
function deleteFile(file) {
|
||||||
apiRequest("/file/detach", {
|
setTaskFiles((prevValue) =>
|
||||||
method: "DELETE",
|
|
||||||
data: {
|
|
||||||
file_id: file.id,
|
|
||||||
entity_type: 2,
|
|
||||||
entity_id: task.id,
|
|
||||||
status: 0,
|
|
||||||
},
|
|
||||||
}).then(() => {
|
|
||||||
setTaskFiles((prevValue) =>
|
|
||||||
prevValue.filter((item) => item.id !== file.id)
|
prevValue.filter((item) => item.id !== file.id)
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function startTimer() {
|
function startTimer() {
|
||||||
@ -533,19 +525,12 @@ export const ModalTiсket = ({
|
|||||||
<div className="task__files">
|
<div className="task__files">
|
||||||
{taskFiles.map((file) => {
|
{taskFiles.map((file) => {
|
||||||
return (
|
return (
|
||||||
<div className="taskFile" key={file.id}>
|
<FileTracker
|
||||||
<img
|
key={file.id}
|
||||||
className="imgFile"
|
file={file}
|
||||||
src={backendImg(file.file?.url)}
|
setDeletedTask={deleteFile}
|
||||||
alt="img"
|
taskId={task.id}
|
||||||
/>
|
/>
|
||||||
<div
|
|
||||||
className="deleteFile"
|
|
||||||
onClick={() => deleteFile(file)}
|
|
||||||
>
|
|
||||||
<img src={close} alt="delete" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
@ -838,11 +823,12 @@ export const ModalTiсket = ({
|
|||||||
<img src={link}></img>
|
<img src={link}></img>
|
||||||
<p onClick={copyTicketLink}>ссылка на задачу</p>
|
<p onClick={copyTicketLink}>ссылка на задачу</p>
|
||||||
</div>
|
</div>
|
||||||
<div onClick={archiveTask}>
|
<div onClick={archiveTask} className={(profileInfo.id_user === projectOwnerId) || (profileInfo.id_user === task.user_id) ? '' : 'disable'}>
|
||||||
<img src={archive}></img>
|
<img src={archive}></img>
|
||||||
<p>в архив</p>
|
<p>в архив</p>
|
||||||
</div>
|
</div>
|
||||||
<div onClick={deleteTask}>
|
<div onClick={deleteTask} className={
|
||||||
|
(profileInfo.id_user === projectOwnerId) || (profileInfo.id_user === task.user_id) ? '' : 'disable'}>
|
||||||
<img src={del}></img>
|
<img src={del}></img>
|
||||||
<p>удалить</p>
|
<p>удалить</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -367,6 +367,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.taskFile {
|
.taskFile {
|
||||||
|
cursor: pointer;
|
||||||
position: relative;
|
position: relative;
|
||||||
.imgFile {
|
.imgFile {
|
||||||
max-width: 170px;
|
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 {
|
.fileLoaded {
|
||||||
|
@ -13,6 +13,8 @@ import {
|
|||||||
setToggleTab,
|
setToggleTab,
|
||||||
} from "@redux/projectsTrackerSlice";
|
} from "@redux/projectsTrackerSlice";
|
||||||
|
|
||||||
|
import { getProfileInfo } from "@redux/outstaffingSlice";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
backendImg,
|
backendImg,
|
||||||
caseOfNum,
|
caseOfNum,
|
||||||
@ -75,6 +77,7 @@ export const TicketFullScreen = () => {
|
|||||||
minute: 0,
|
minute: 0,
|
||||||
seconds: 0,
|
seconds: 0,
|
||||||
});
|
});
|
||||||
|
const profileInfo = useSelector(getProfileInfo);
|
||||||
const [timerId, setTimerId] = useState(null);
|
const [timerId, setTimerId] = useState(null);
|
||||||
const [dropListOpen, setDropListOpen] = useState(false);
|
const [dropListOpen, setDropListOpen] = useState(false);
|
||||||
const [correctProjectUsers, setCorrectProjectUsers] = useState([]);
|
const [correctProjectUsers, setCorrectProjectUsers] = useState([]);
|
||||||
@ -997,11 +1000,14 @@ export const TicketFullScreen = () => {
|
|||||||
<img src={link} alt="link"></img>
|
<img src={link} alt="link"></img>
|
||||||
<p onClick={copyTicketLink}>ссылка на задачу</p>
|
<p onClick={copyTicketLink}>ссылка на задачу</p>
|
||||||
</div>
|
</div>
|
||||||
<div onClick={archiveTask}>
|
<div onClick={archiveTask}
|
||||||
|
className={(profileInfo.id_user === projectInfo.owner_id) || (profileInfo.id_user === taskInfo.user_id) ? '' : 'disable'}>
|
||||||
<img src={archive} alt="arch"></img>
|
<img src={archive} alt="arch"></img>
|
||||||
<p>в архив</p>
|
<p>в архив</p>
|
||||||
</div>
|
</div>
|
||||||
<div onClick={deleteTask}>
|
<div onClick={deleteTask}
|
||||||
|
className={(profileInfo.id_user === projectInfo.owner_id) || (profileInfo.id_user === taskInfo.user_id) ? '' : 'disable'}
|
||||||
|
>
|
||||||
<img src={del} alt="delete"></img>
|
<img src={del} alt="delete"></img>
|
||||||
<p>удалить</p>
|
<p>удалить</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -17,6 +17,7 @@ export const Navigation = () => {
|
|||||||
const [user] = useState(
|
const [user] = useState(
|
||||||
localStorage.getItem("role_status") === "18" ? "partner" : "developer"
|
localStorage.getItem("role_status") === "18" ? "partner" : "developer"
|
||||||
);
|
);
|
||||||
|
|
||||||
const [navInfo] = useState({
|
const [navInfo] = useState({
|
||||||
developer: [
|
developer: [
|
||||||
{
|
{
|
||||||
|
@ -546,6 +546,7 @@ export const ProjectTracker = () => {
|
|||||||
projectId={projectBoard.id}
|
projectId={projectBoard.id}
|
||||||
projectName={projectBoard.name}
|
projectName={projectBoard.name}
|
||||||
projectUsers={projectBoard.projectUsers}
|
projectUsers={projectBoard.projectUsers}
|
||||||
|
projectOwnerId={projectBoard.owner_id}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user