tracker tasks
This commit is contained in:
parent
a66bea4462
commit
45438da61c
@ -1,47 +1,50 @@
|
||||
import React, {useState} from "react";
|
||||
import React, { useState } from "react";
|
||||
|
||||
import { backendImg } from "@utils/helper";
|
||||
|
||||
import { apiRequest } from "@api/request";
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
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>
|
||||
}
|
||||
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;
|
||||
|
@ -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);
|
||||
@ -373,9 +373,9 @@ export const ModalTiсket = ({
|
||||
}
|
||||
|
||||
function deleteFile(file) {
|
||||
setTaskFiles((prevValue) =>
|
||||
prevValue.filter((item) => item.id !== file.id)
|
||||
);
|
||||
setTaskFiles((prevValue) =>
|
||||
prevValue.filter((item) => item.id !== file.id)
|
||||
);
|
||||
}
|
||||
|
||||
function startTimer() {
|
||||
@ -525,12 +525,12 @@ export const ModalTiсket = ({
|
||||
<div className="task__files">
|
||||
{taskFiles.map((file) => {
|
||||
return (
|
||||
<FileTracker
|
||||
key={file.id}
|
||||
file={file}
|
||||
setDeletedTask={deleteFile}
|
||||
taskId={task.id}
|
||||
/>
|
||||
<FileTracker
|
||||
key={file.id}
|
||||
file={file}
|
||||
setDeletedTask={deleteFile}
|
||||
taskId={task.id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
@ -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>
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user