tracker tasks

This commit is contained in:
Николай Полтщук 2023-08-31 01:58:48 +03:00
parent a66bea4462
commit 45438da61c
3 changed files with 88 additions and 58 deletions

View File

@ -1,11 +1,13 @@
import React, {useState} from "react"; import React, { useState } from "react";
import { backendImg } from "@utils/helper"; import { backendImg } from "@utils/helper";
import { apiRequest } from "@api/request";
import close from "assets/icons/closeProjectPersons.svg"; import close from "assets/icons/closeProjectPersons.svg";
import {apiRequest} from "@api/request";
const FileTracker = ({ file, setDeletedTask, taskId }) => { const FileTracker = ({ file, setDeletedTask, taskId }) => {
const [openImg, setOpenImg] = useState(false) const [openImg, setOpenImg] = useState(false);
function deleteFile(file) { function deleteFile(file) {
apiRequest("/file/detach", { apiRequest("/file/detach", {
method: "DELETE", method: "DELETE",
@ -21,25 +23,26 @@ const FileTracker = ({ file, setDeletedTask, taskId }) => {
} }
return ( return (
<div className={openImg ? "taskFile ImgOpened" : "taskFile"} key={file.id} <div
onClick={() => className={openImg ? "taskFile ImgOpened" : "taskFile"}
{if(openImg) setOpenImg(!openImg)}} key={file.id}
onClick={() => {
if (openImg) setOpenImg(!openImg);
}}
> >
<img <img
className="imgFile" className="imgFile"
src={backendImg(file.file?.url)} src={backendImg(file.file?.url)}
alt="img" alt="img"
onClick={() => onClick={() => {
{if(!openImg) setOpenImg(!openImg)}} if (!openImg) setOpenImg(!openImg);
}}
/> />
{!openImg && {!openImg && (
<div <div className="deleteFile" onClick={() => deleteFile(file)}>
className="deleteFile"
onClick={() => deleteFile(file)}
>
<img src={close} alt="delete" /> <img src={close} alt="delete" />
</div> </div>
} )}
</div> </div>
); );
}; };

View File

@ -22,10 +22,10 @@ import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification"; import { useNotification } from "@hooks/useNotification";
import FileTracker from "@components/FileTracker/FileTracker";
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";
@ -53,7 +53,7 @@ export const ModalTiсket = ({
projectId, projectId,
projectName, projectName,
projectUsers, projectUsers,
projectOwnerId projectOwnerId,
}) => { }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const [addSubtask, setAddSubtask] = useState(false); const [addSubtask, setAddSubtask] = useState(false);
@ -823,12 +823,27 @@ 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} className={(profileInfo.id_user === projectOwnerId) || (profileInfo.id_user === task.user_id) ? '' : 'disable'}> <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} className={ <div
(profileInfo.id_user === projectOwnerId) || (profileInfo.id_user === task.user_id) ? '' : 'disable'}> 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>

View File

@ -6,6 +6,7 @@ import DatePicker, { registerLocale } from "react-datepicker";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { Link, useNavigate, useParams } from "react-router-dom"; import { Link, useNavigate, useParams } from "react-router-dom";
import { getProfileInfo } from "@redux/outstaffingSlice";
import { import {
deletePersonOnProject, deletePersonOnProject,
getBoarderLoader, getBoarderLoader,
@ -13,8 +14,6 @@ import {
setToggleTab, setToggleTab,
} from "@redux/projectsTrackerSlice"; } from "@redux/projectsTrackerSlice";
import { getProfileInfo } from "@redux/outstaffingSlice";
import { import {
backendImg, backendImg,
caseOfNum, caseOfNum,
@ -1000,13 +999,26 @@ 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
className={(profileInfo.id_user === projectInfo.owner_id) || (profileInfo.id_user === taskInfo.user_id) ? '' : 'disable'}> 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
className={(profileInfo.id_user === projectInfo.owner_id) || (profileInfo.id_user === taskInfo.user_id) ? '' : 'disable'} 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>