tracker tasks create modal

This commit is contained in:
Mikola 2023-09-13 17:46:56 +03:00
parent a84672f76f
commit a3ff812b8a
2 changed files with 113 additions and 102 deletions

View File

@ -18,7 +18,9 @@ export const ModalLayout = ({
>
<div
className={
styles ? `modal-layout__content ${styles}` : `modal-layout__content ${type}`
styles
? `modal-layout__content ${styles}`
: `modal-layout__content ${type}`
}
onClick={(e) => e.stopPropagation()}
>

View File

@ -1,11 +1,10 @@
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
import { CKEditor } from "@ckeditor/ckeditor5-react";
import React, { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import ru from "date-fns/locale/ru";
import DatePicker, {registerLocale} from "react-datepicker";
import React, { useEffect, useState } from "react";
import DatePicker, { registerLocale } from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";
import {getCorrectDate} from "@components/Calendar/calendarHelper";
import { useDispatch, useSelector } from "react-redux";
import { getProfileInfo } from "@redux/outstaffingSlice";
import {
@ -23,22 +22,24 @@ import {
setProjectBoardFetch,
} from "@redux/projectsTrackerSlice";
import {getCorrectRequestDate, urlForLocal} from "@utils/helper";
import { getCorrectRequestDate, urlForLocal } from "@utils/helper";
import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification";
import { getCorrectDate } from "@components/Calendar/calendarHelper";
import BaseButton from "@components/Common/BaseButton/BaseButton";
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 calendarImg from "assets/icons/createTaskCalendar.svg";
import avatarMok from "assets/images/avatarMok.png";
import arrowCreateTask from "assets/icons/arrows/arrowCreateTask.svg"
import calendarImg from "assets/icons/createTaskCalendar.svg"
import arrowRight from "assets/icons/arrows/arrowRightCreateTask.svg"
import "./trackerModal.scss";
registerLocale("ru", ru);
export const TrackerModal = ({
@ -78,8 +79,8 @@ export const TrackerModal = ({
const [selectColumnPriorityOpen, setSelectColumnPriorityOpen] =
useState(false);
const { showNotification } = useNotification();
const [deadLineDate, setDeadLineDate] = useState('')
const [datePickerOpen, setDatePickerOpen] = useState(false)
const [deadLineDate, setDeadLineDate] = useState("");
const [datePickerOpen, setDatePickerOpen] = useState(false);
const [startDate, setStartDate] = useState(new Date());
function createTab() {
@ -124,7 +125,7 @@ export const TrackerModal = ({
user_id: localStorage.getItem("id"),
column_id: selectedTab,
priority: priorityTask,
dead_line: deadLineDate ? getCorrectRequestDate(deadLineDate) : ''
dead_line: deadLineDate ? getCorrectRequestDate(deadLineDate) : "",
},
}).then((res) => {
if (res.status === 500) {
@ -154,7 +155,7 @@ export const TrackerModal = ({
setDescriptionTicket("");
dispatch(setProjectBoardFetch(projectBoard.id));
}
setDeadLineDate('')
setDeadLineDate("");
showNotification({
show: true,
text: "Задача создана",
@ -402,15 +403,15 @@ export const TrackerModal = ({
{modalType === "createTiketProject" && (
<>
<div className="title-project">
<div className='createTaskHead'>
<div className="createTaskHead">
<span>Этап</span>
<div className='createTaskHead__selectColumn'>
<div className="createTaskHead__selectColumn">
<span>Backlog</span>
<img src={arrowCreateTask} alt='arrow' />
<img src={arrowCreateTask} alt="arrow" />
</div>
</div>
<div className='createTaskBody'>
<div className='createTaskBody__left'>
<div className="createTaskBody">
<div className="createTaskBody__left">
<h4>Введите название и описание задачи</h4>
<div className="input-container">
<input
@ -443,18 +444,22 @@ export const TrackerModal = ({
}}
/>
</div>
<div className='createTaskBody__right'>
<div className='createTaskBody__right__owner'>
<div className="createTaskBody__right">
<div className="createTaskBody__right__owner">
<p>Создатель : {profileInfo?.fio}</p>
<img
src={
profileInfo.photo ? urlForLocal(profileInfo.photo) : avatarMok
profileInfo.photo
? urlForLocal(profileInfo.photo)
: avatarMok
}
alt="avatar"
/>
</div>
<div
onClick={() => setSelectExecutorTaskOpen(!selectExecutorTaskOpen)}
onClick={() =>
setSelectExecutorTaskOpen(!selectExecutorTaskOpen)
}
className={
selectExecutorTaskOpen
? "select__executor select__executor--open"
@ -505,11 +510,15 @@ export const TrackerModal = ({
</div>
)}
</div>
<div className='createTaskBody__right__deadLine'>
<img src={calendarImg} alt='calendar' />
<div className="createTaskBody__right__deadLine">
<img src={calendarImg} alt="calendar" />
<span>Срок исполнения</span>
<img src={arrowRight} className='arrow' alt='arrow' />
<p onClick={() => setDatePickerOpen(!datePickerOpen)}>{deadLineDate ? getCorrectDate(deadLineDate) : "Дата не выбрана"}</p>
<img src={arrowRight} className="arrow" alt="arrow" />
<p onClick={() => setDatePickerOpen(!datePickerOpen)}>
{deadLineDate
? getCorrectDate(deadLineDate)
: "Дата не выбрана"}
</p>
<DatePicker
className="datePicker"
open={datePickerOpen}