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

View File

@ -22,10 +22,10 @@ import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification";
import FileTracker from "@components/FileTracker/FileTracker";
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";
@ -53,7 +53,7 @@ export const ModalTiсket = ({
projectId,
projectName,
projectUsers,
projectOwnerId
projectOwnerId,
}) => {
const dispatch = useDispatch();
const [addSubtask, setAddSubtask] = useState(false);
@ -823,12 +823,27 @@ export const ModalTiсket = ({
<img src={link}></img>
<p onClick={copyTicketLink}>ссылка на задачу</p>
</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>
<p>в архив</p>
</div>
<div onClick={deleteTask} className={
(profileInfo.id_user === projectOwnerId) || (profileInfo.id_user === task.user_id) ? '' : 'disable'}>
<div
onClick={deleteTask}
className={
profileInfo.id_user === projectOwnerId ||
profileInfo.id_user === task.user_id
? ""
: "disable"
}
>
<img src={del}></img>
<p>удалить</p>
</div>

View File

@ -6,6 +6,7 @@ import DatePicker, { registerLocale } from "react-datepicker";
import { useDispatch, useSelector } from "react-redux";
import { Link, useNavigate, useParams } from "react-router-dom";
import { getProfileInfo } from "@redux/outstaffingSlice";
import {
deletePersonOnProject,
getBoarderLoader,
@ -13,8 +14,6 @@ import {
setToggleTab,
} from "@redux/projectsTrackerSlice";
import { getProfileInfo } from "@redux/outstaffingSlice";
import {
backendImg,
caseOfNum,
@ -1000,13 +999,26 @@ export const TicketFullScreen = () => {
<img src={link} alt="link"></img>
<p onClick={copyTicketLink}>ссылка на задачу</p>
</div>
<div onClick={archiveTask}
className={(profileInfo.id_user === projectInfo.owner_id) || (profileInfo.id_user === taskInfo.user_id) ? '' : 'disable'}>
<div
onClick={archiveTask}
className={
profileInfo.id_user === projectInfo.owner_id ||
profileInfo.id_user === taskInfo.user_id
? ""
: "disable"
}
>
<img src={archive} alt="arch"></img>
<p>в архив</p>
</div>
<div onClick={deleteTask}
className={(profileInfo.id_user === projectInfo.owner_id) || (profileInfo.id_user === taskInfo.user_id) ? '' : 'disable'}
<div
onClick={deleteTask}
className={
profileInfo.id_user === projectInfo.owner_id ||
profileInfo.id_user === taskInfo.user_id
? ""
: "disable"
}
>
<img src={del} alt="delete"></img>
<p>удалить</p>