Merge branch 'main' of https://github.com/apuc/outstaffing-react into fixed-pages
This commit is contained in:
commit
04d3f68da8
@ -94,6 +94,7 @@ export const ModalTiсket = ({
|
||||
const [acceptModalOpen, setAcceptModalOpen] = useState(false);
|
||||
const [selectTagsOpen, setSelectTagsOpen] = useState(false);
|
||||
const { showNotification } = useNotification();
|
||||
const [commentSendDisable, setCommentSendDisable] = useState(false);
|
||||
|
||||
function deleteTask() {
|
||||
apiRequest("/task/update-task", {
|
||||
@ -144,6 +145,8 @@ export const ModalTiсket = ({
|
||||
}
|
||||
|
||||
function createComment() {
|
||||
if (!inputsValue.comment) return;
|
||||
setCommentSendDisable(true);
|
||||
apiRequest("/comment/create", {
|
||||
method: "POST",
|
||||
data: {
|
||||
@ -153,6 +156,7 @@ export const ModalTiсket = ({
|
||||
},
|
||||
}).then((res) => {
|
||||
let newComment = res;
|
||||
setCommentSendDisable(false);
|
||||
newComment.created_at = new Date();
|
||||
newComment.subComments = [];
|
||||
setInputsValue((prevValue) => ({ ...prevValue, comment: "" }));
|
||||
@ -285,6 +289,7 @@ export const ModalTiсket = ({
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
initListeners();
|
||||
apiRequest(
|
||||
`/comment/get-by-entity?entity_type=2&entity_id=${task.id}`
|
||||
).then((res) => {
|
||||
@ -502,15 +507,59 @@ export const ModalTiсket = ({
|
||||
setAcceptModalOpen(false);
|
||||
}
|
||||
|
||||
const initListeners = () => {
|
||||
document.addEventListener("click", closeByClickingOut);
|
||||
};
|
||||
|
||||
const closeByClickingOut = (event) => {
|
||||
const path = event.path || (event.composedPath && event.composedPath());
|
||||
|
||||
if (
|
||||
event &&
|
||||
!path.find(
|
||||
(div) =>
|
||||
div.classList &&
|
||||
(div.classList.contains("button-add-worker") ||
|
||||
div.classList.contains("dropdownList"))
|
||||
)
|
||||
) {
|
||||
setDropListOpen(false);
|
||||
setDropListMembersOpen(false);
|
||||
}
|
||||
|
||||
if (
|
||||
event &&
|
||||
!path.find(
|
||||
(div) =>
|
||||
div.classList &&
|
||||
(div.classList.contains("deadLine") ||
|
||||
div.classList.contains("react-datepicker-popper"))
|
||||
)
|
||||
) {
|
||||
setDatePickerOpen(false);
|
||||
}
|
||||
|
||||
if (
|
||||
event &&
|
||||
!path.find(
|
||||
(div) =>
|
||||
div.classList &&
|
||||
(div.classList.contains("tags") ||
|
||||
div.classList.contains("tags__dropDown"))
|
||||
)
|
||||
) {
|
||||
setSelectTagsOpen(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={active ? "modal-tiket active" : "modal-tiket"}
|
||||
onClick={() => setActive(false)}
|
||||
>
|
||||
<div
|
||||
className="modal-tiket__content"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
onClick={(e) => {
|
||||
if (e.target.className.includes("modal-tiket")) setActive(false);
|
||||
}}
|
||||
>
|
||||
<div className="modal-tiket__content">
|
||||
<div className="content">
|
||||
<h3 className="title-project">
|
||||
<img src={category} className="title-project__category"></img>
|
||||
@ -646,7 +695,11 @@ export const ModalTiсket = ({
|
||||
}));
|
||||
}}
|
||||
/>
|
||||
<img src={send} onClick={createComment}></img>
|
||||
<img
|
||||
className={commentSendDisable ? "disable" : ""}
|
||||
src={send}
|
||||
onClick={createComment}
|
||||
></img>
|
||||
</div>
|
||||
<div className="comments__list">
|
||||
{comments.map((comment) => {
|
||||
@ -880,7 +933,7 @@ export const ModalTiсket = ({
|
||||
className="tags__select"
|
||||
onClick={() => setSelectTagsOpen(!selectTagsOpen)}
|
||||
>
|
||||
<span>Выберите тег</span>
|
||||
<span>Выберете тег</span>
|
||||
<img
|
||||
className={selectTagsOpen ? "open" : ""}
|
||||
src={arrowDown}
|
||||
|
@ -584,6 +584,11 @@
|
||||
margin-right: 18px;
|
||||
}
|
||||
|
||||
.disable {
|
||||
pointer-events: none;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
//&:focus-within {
|
||||
// border: 1px solid #0000004d;
|
||||
//}
|
||||
|
@ -93,8 +93,10 @@ export const TicketFullScreen = () => {
|
||||
const [selectTagsOpen, setSelectTagsOpen] = useState(false);
|
||||
const [correctProjectTags, setCorrectProjectTags] = useState([]);
|
||||
const { showNotification } = useNotification();
|
||||
const [commentSendDisable, setCommentSendDisable] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
initListeners();
|
||||
apiRequest(`/task/get-task?task_id=${ticketId.id}&expand=mark`).then(
|
||||
(taskInfo) => {
|
||||
setTaskInfo(taskInfo);
|
||||
@ -217,6 +219,8 @@ export const TicketFullScreen = () => {
|
||||
}
|
||||
|
||||
function createComment() {
|
||||
if (!inputsValue.comment) return;
|
||||
setCommentSendDisable(true);
|
||||
apiRequest("/comment/create", {
|
||||
method: "POST",
|
||||
data: {
|
||||
@ -226,6 +230,7 @@ export const TicketFullScreen = () => {
|
||||
},
|
||||
}).then((res) => {
|
||||
let newComment = res;
|
||||
setCommentSendDisable(false);
|
||||
newComment.created_at = new Date();
|
||||
newComment.subComments = [];
|
||||
setInputsValue((prevValue) => ({ ...prevValue, comment: "" }));
|
||||
@ -525,6 +530,63 @@ export const TicketFullScreen = () => {
|
||||
});
|
||||
}
|
||||
|
||||
const initListeners = () => {
|
||||
document.addEventListener("click", closeByClickingOut);
|
||||
};
|
||||
|
||||
const closeByClickingOut = (event) => {
|
||||
const path = event.path || (event.composedPath && event.composedPath());
|
||||
|
||||
if (
|
||||
event &&
|
||||
!path.find(
|
||||
(div) =>
|
||||
div.classList &&
|
||||
(div.classList.contains("button-add-worker") ||
|
||||
div.classList.contains("dropdownList"))
|
||||
)
|
||||
) {
|
||||
setDropListOpen(false);
|
||||
setDropListMembersOpen(false);
|
||||
}
|
||||
|
||||
if (
|
||||
event &&
|
||||
!path.find(
|
||||
(div) =>
|
||||
div.classList &&
|
||||
(div.classList.contains("deadLine") ||
|
||||
div.classList.contains("react-datepicker-popper"))
|
||||
)
|
||||
) {
|
||||
setDatePickerOpen(false);
|
||||
}
|
||||
|
||||
if (
|
||||
event &&
|
||||
!path.find(
|
||||
(div) =>
|
||||
div.classList &&
|
||||
(div.classList.contains("tags") ||
|
||||
div.classList.contains("tags__dropDown"))
|
||||
)
|
||||
) {
|
||||
setSelectTagsOpen(false);
|
||||
}
|
||||
|
||||
if (
|
||||
event &&
|
||||
!path.find(
|
||||
(div) =>
|
||||
div.classList &&
|
||||
(div.classList.contains("addPerson") ||
|
||||
div.classList.contains("persons__list"))
|
||||
)
|
||||
) {
|
||||
setPersonListOpen(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<section className="ticket-full-screen">
|
||||
<ProfileHeader />
|
||||
@ -820,7 +882,12 @@ export const TicketFullScreen = () => {
|
||||
}));
|
||||
}}
|
||||
/>
|
||||
<img src={send} onClick={createComment} alt="send"></img>
|
||||
<img
|
||||
className={commentSendDisable ? "disable" : ""}
|
||||
src={send}
|
||||
onClick={createComment}
|
||||
alt="send"
|
||||
></img>
|
||||
</div>
|
||||
<div className="comments__list">
|
||||
{comments.map((comment) => {
|
||||
@ -1059,7 +1126,7 @@ export const TicketFullScreen = () => {
|
||||
className="tags__select"
|
||||
onClick={() => setSelectTagsOpen(!selectTagsOpen)}
|
||||
>
|
||||
<span>Выберите тег</span>
|
||||
<span>Выберете тег</span>
|
||||
<img
|
||||
className={selectTagsOpen ? "open" : ""}
|
||||
src={arrowDown}
|
||||
|
@ -35,6 +35,7 @@ import ModalLayout from "@components/Common/ModalLayout/ModalLayout";
|
||||
import arrowCreateTask from "assets/icons/arrows/arrowCreateTask.svg";
|
||||
import arrowRight from "assets/icons/arrows/arrowRightCreateTask.svg";
|
||||
import arrowDown from "assets/icons/arrows/selectArrow.png";
|
||||
import close from "assets/icons/close.png";
|
||||
import calendarImg from "assets/icons/createTaskCalendar.svg";
|
||||
import avatarMok from "assets/images/avatarMok.png";
|
||||
|
||||
@ -51,6 +52,7 @@ export const TrackerModal = ({
|
||||
projectId,
|
||||
priorityTask,
|
||||
projectUsers,
|
||||
projectMarks,
|
||||
}) => {
|
||||
const dispatch = useDispatch();
|
||||
const projectBoard = useSelector(getProjectBoard);
|
||||
@ -76,6 +78,9 @@ export const TrackerModal = ({
|
||||
);
|
||||
const [selectExecutorTaskOpen, setSelectExecutorTaskOpen] = useState(false);
|
||||
const [correctProjectUsers, setCorrectProjectUsers] = useState([]);
|
||||
const [correctProjectTags, setCorrectProjectTags] = useState([]);
|
||||
const [taskTags, setTaskTags] = useState([]);
|
||||
const [selectTagsOpen, setSelectTagsOpen] = useState(false);
|
||||
const [selectColumnPriorityOpen, setSelectColumnPriorityOpen] =
|
||||
useState(false);
|
||||
const { showNotification } = useNotification();
|
||||
@ -135,6 +140,18 @@ export const TrackerModal = ({
|
||||
type: "error",
|
||||
});
|
||||
} else {
|
||||
for (let i = 0; i < taskTags.length; i++) {
|
||||
apiRequest("/mark/attach", {
|
||||
method: "POST",
|
||||
data: {
|
||||
mark_id: taskTags[i].id,
|
||||
entity_type: 2,
|
||||
entity_id: res.id,
|
||||
},
|
||||
}).then(() => {
|
||||
setTaskTags([]);
|
||||
});
|
||||
}
|
||||
if (selectedExecutorTask.user_id) {
|
||||
apiRequest("/task/update-task", {
|
||||
method: "PUT",
|
||||
@ -306,6 +323,18 @@ export const TrackerModal = ({
|
||||
}
|
||||
}, [active]);
|
||||
|
||||
useEffect(() => {
|
||||
let tagIds = taskTags.map((tag) => tag.id);
|
||||
if (projectMarks) {
|
||||
setCorrectProjectTags(
|
||||
projectMarks.reduce((acc, cur) => {
|
||||
if (!tagIds.includes(cur.id)) acc.push(cur);
|
||||
return acc;
|
||||
}, [])
|
||||
);
|
||||
}
|
||||
}, [taskTags, projectMarks]);
|
||||
|
||||
return (
|
||||
<ModalLayout
|
||||
active={active}
|
||||
@ -404,11 +433,22 @@ export const TrackerModal = ({
|
||||
<>
|
||||
<div className="title-project">
|
||||
<div className="createTaskHead">
|
||||
<span>Этап</span>
|
||||
<div className="createTaskHead__selectColumn">
|
||||
<span>Backlog</span>
|
||||
<img src={arrowCreateTask} alt="arrow" />
|
||||
<div className="createTaskBody__right__owner">
|
||||
<p>Создатель : {profileInfo?.fio}</p>
|
||||
<img
|
||||
src={
|
||||
profileInfo.photo
|
||||
? urlForLocal(profileInfo.photo)
|
||||
: avatarMok
|
||||
}
|
||||
alt="avatar"
|
||||
/>
|
||||
</div>
|
||||
{/*<span>Этап</span>*/}
|
||||
{/*<div className="createTaskHead__selectColumn">*/}
|
||||
{/* <span>Backlog</span>*/}
|
||||
{/* <img src={arrowCreateTask} alt="arrow" />*/}
|
||||
{/*</div>*/}
|
||||
</div>
|
||||
<div className="createTaskBody">
|
||||
<div className="createTaskBody__left">
|
||||
@ -445,17 +485,74 @@ export const TrackerModal = ({
|
||||
/>
|
||||
</div>
|
||||
<div className="createTaskBody__right">
|
||||
<div className="createTaskBody__right__owner">
|
||||
<p>Создатель : {profileInfo?.fio}</p>
|
||||
<div className="createTaskBody__right__tags">
|
||||
<div className="tags__selected">
|
||||
<div className="tags__selected__items">
|
||||
{taskTags.map((tag) => {
|
||||
return (
|
||||
<div
|
||||
className="selectedTag"
|
||||
key={tag.id}
|
||||
style={{ background: tag.color }}
|
||||
>
|
||||
<p>{tag.slug}</p>
|
||||
<img
|
||||
src={
|
||||
profileInfo.photo
|
||||
? urlForLocal(profileInfo.photo)
|
||||
: avatarMok
|
||||
src={close}
|
||||
className="delete"
|
||||
alt="delete"
|
||||
onClick={() =>
|
||||
setTaskTags((prevState) =>
|
||||
prevState.filter(
|
||||
(prevTag) => prevTag.id !== tag.id
|
||||
)
|
||||
)
|
||||
}
|
||||
alt="avatar"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<div
|
||||
className="tags__selected__name"
|
||||
onClick={() => setSelectTagsOpen(!selectTagsOpen)}
|
||||
>
|
||||
Выберете тег
|
||||
<img
|
||||
className={
|
||||
selectTagsOpen ? "arrow arrow--open" : "arrow"
|
||||
}
|
||||
src={arrowDown}
|
||||
alt="arrow"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{selectTagsOpen && (
|
||||
<div className="tags__dropDown">
|
||||
<img
|
||||
src={close}
|
||||
className="close"
|
||||
onClick={() => setSelectTagsOpen(false)}
|
||||
/>
|
||||
{correctProjectTags.map((tag) => {
|
||||
return (
|
||||
<div
|
||||
className="tag__item"
|
||||
key={tag.id}
|
||||
onClick={() =>
|
||||
setTaskTags((prevState) => [...prevState, tag])
|
||||
}
|
||||
>
|
||||
<p>{tag.slug}</p>
|
||||
<span style={{ background: tag.color }} />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
{Boolean(!correctProjectTags.length) && (
|
||||
<p className="noTags">Нет тегов</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
onClick={() =>
|
||||
setSelectExecutorTaskOpen(!selectExecutorTaskOpen)
|
||||
|
@ -357,7 +357,6 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
column-gap: 9.5px;
|
||||
margin-bottom: 30px;
|
||||
p {
|
||||
color: #2D4A17;
|
||||
font-size: 14px;
|
||||
@ -371,6 +370,127 @@
|
||||
}
|
||||
}
|
||||
|
||||
&__tags {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
|
||||
.tags {
|
||||
&__selected {
|
||||
width: 393px;
|
||||
font-weight: 300;
|
||||
line-height: 18px;
|
||||
font-size: 15px;
|
||||
margin-bottom: 17.5px;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
row-gap: 8px;
|
||||
|
||||
&__name {
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 5px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #e4e4e4;
|
||||
|
||||
img {
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.arrow--open {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
|
||||
&__items {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
gap: 8px;
|
||||
max-width: 393px;
|
||||
|
||||
.selectedTag {
|
||||
display: flex;
|
||||
padding: 3px 5px 3px 8px;
|
||||
border-radius: 8px;
|
||||
align-items: center;
|
||||
column-gap: 8px;
|
||||
|
||||
p {
|
||||
font-weight: 600;
|
||||
font-size: 15px;
|
||||
margin: 0;
|
||||
line-height: 15px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.delete {
|
||||
cursor: pointer;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__dropDown {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #e4e4e4;
|
||||
top: 90%;
|
||||
z-index: 101;
|
||||
padding: 20px 10px 10px;
|
||||
background: white;
|
||||
row-gap: 8px;
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
right: 5px;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.tag__item {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
column-gap: 8px;
|
||||
padding: 5px;
|
||||
border: 1px solid #ececec;
|
||||
border-radius: 8px;
|
||||
justify-content: space-between;
|
||||
|
||||
p {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
margin: 0;
|
||||
line-height: 20px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
span {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 50px;
|
||||
}
|
||||
}
|
||||
|
||||
.noTags {
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.select__executor {
|
||||
background: #F1F1F1;
|
||||
width: 393px;
|
||||
|
@ -90,6 +90,7 @@ export const ProjectTracker = () => {
|
||||
useEffect(() => {
|
||||
dispatch(activeLoader());
|
||||
dispatch(setProjectBoardFetch(projectId.id));
|
||||
initListeners();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
@ -353,6 +354,72 @@ export const ProjectTracker = () => {
|
||||
});
|
||||
}
|
||||
|
||||
const initListeners = () => {
|
||||
document.addEventListener("click", closeByClickingOut);
|
||||
};
|
||||
|
||||
const closeByClickingOut = (event) => {
|
||||
const path = event.path || (event.composedPath && event.composedPath());
|
||||
|
||||
if (
|
||||
event &&
|
||||
!path.find(
|
||||
(div) =>
|
||||
div.classList &&
|
||||
(div.classList.contains("addPerson") ||
|
||||
div.classList.contains("persons__list"))
|
||||
)
|
||||
) {
|
||||
setPersonListOpen(false);
|
||||
}
|
||||
|
||||
if (
|
||||
event &&
|
||||
!path.find(
|
||||
(div) =>
|
||||
div.classList &&
|
||||
(div.classList.contains("tasks__head__executor") ||
|
||||
div.classList.contains("tasks__head__executorDropdown"))
|
||||
)
|
||||
) {
|
||||
setSelectedExecutorOpen(false);
|
||||
}
|
||||
|
||||
if (
|
||||
event &&
|
||||
!path.find(
|
||||
(div) =>
|
||||
div.classList &&
|
||||
(div.classList.contains("tasks__head__tags") ||
|
||||
div.classList.contains("tags__list"))
|
||||
)
|
||||
) {
|
||||
setTags({
|
||||
open: false,
|
||||
add: false,
|
||||
edit: false,
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
event &&
|
||||
!path.find(
|
||||
(div) =>
|
||||
div.classList &&
|
||||
(div.classList.contains("board__head__more") ||
|
||||
div.classList.contains("column__select"))
|
||||
)
|
||||
) {
|
||||
setOpenColumnSelect((prevState) => {
|
||||
const newState = {};
|
||||
for (const key in prevState) {
|
||||
newState[key] = false;
|
||||
}
|
||||
return newState;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="tracker">
|
||||
<ProfileHeader />
|
||||
@ -402,6 +469,7 @@ export const ProjectTracker = () => {
|
||||
selectedTab={selectedTab}
|
||||
priorityTask={priorityTask}
|
||||
projectUsers={projectBoard.projectUsers}
|
||||
projectMarks={projectBoard.mark}
|
||||
/>
|
||||
|
||||
{loader && <Loader style="green" />}
|
||||
|
Loading…
Reference in New Issue
Block a user