task deadLine

This commit is contained in:
Николай Полтщук 2023-07-07 17:38:31 +03:00
parent b8ef0119d0
commit 8b9351e3f7
3 changed files with 69 additions and 55 deletions

View File

@ -1,15 +1,11 @@
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 { Link } from "react-router-dom";
import ru from "date-fns/locale/ru";
import React, { useEffect, useState } from "react";
import DatePicker, { registerLocale } from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";
import {
getCorrectDate
} from "../../../Calendar/calendarHelper";
import { useDispatch, useSelector } from "react-redux";
import { Link } from "react-router-dom";
import { getProfileInfo } from "@redux/outstaffingSlice";
import { setProjectBoardFetch } from "@redux/projectsTrackerSlice";
@ -24,6 +20,7 @@ import TrackerTaskComment from "@components/TrackerTaskComment/TrackerTaskCommen
import archive from "assets/icons/archive.svg";
import arrow from "assets/icons/arrows/arrowStart.png";
import fullScreen from "assets/icons/arrows/inFullScreen.svg";
import calendarIcon from "assets/icons/calendar.svg";
import category from "assets/icons/category.svg";
import close from "assets/icons/closeProjectPersons.svg";
import del from "assets/icons/delete.svg";
@ -33,8 +30,8 @@ import link from "assets/icons/link.svg";
import send from "assets/icons/send.svg";
import watch from "assets/icons/watch.svg";
import avatarMok from "assets/images/avatarMok.png";
import calendarIcon from "assets/icons/calendar.svg";
import { getCorrectDate } from "../../../Calendar/calendarHelper";
import "./modalTicket.scss";
registerLocale("ru", ru);
@ -361,7 +358,7 @@ export const ModalTiсket = ({
method: "PUT",
data: {
task_id: task.id,
dead_line: getCorrectRequestDate(date)
dead_line: getCorrectRequestDate(date),
},
}).then(() => {
dispatch(setProjectBoardFetch(projectId));
@ -620,10 +617,15 @@ export const ModalTiсket = ({
</div>
<div className="workers_box-middle">
<div className='deadLine'>
<div className='deadLine__container' onClick={() => setDatePickerOpen(!datePickerOpen)}>
<img src={calendarIcon} alt='calendar' />
<span>{deadLine ? getCorrectDate(deadLine) : 'Срок исполнения:'}</span>
<div className="deadLine">
<div
className="deadLine__container"
onClick={() => setDatePickerOpen(!datePickerOpen)}
>
<img src={calendarIcon} alt="calendar" />
<span>
{deadLine ? getCorrectDate(deadLine) : "Срок исполнения:"}
</span>
</div>
<DatePicker
className="datePicker"
@ -633,8 +635,8 @@ export const ModalTiсket = ({
onChange={(date) => {
setDatePickerOpen(false);
setStartDate(date);
setDeadLine(date)
selectDeadLine(date)
setDeadLine(date);
selectDeadLine(date);
}}
/>
</div>

View File

@ -1,25 +1,24 @@
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
import { CKEditor } from "@ckeditor/ckeditor5-react";
import ru from "date-fns/locale/ru";
import React, { useEffect, useState } from "react";
import DatePicker, { registerLocale } from "react-datepicker";
import { useDispatch, useSelector } from "react-redux";
import { Link, useNavigate, useParams } from "react-router-dom";
import {
deletePersonOnProject,
getBoarderLoader,
modalToggle, setProjectBoardFetch,
modalToggle,
setProjectBoardFetch,
setToggleTab,
} from "@redux/projectsTrackerSlice";
import { caseOfNum, getCorrectRequestDate, urlForLocal } from "@utils/helper";
import calendarIcon from "assets/icons/calendar.svg";
import {getCorrectDate} from "@components/Calendar/calendarHelper";
import DatePicker, { registerLocale } from "react-datepicker";
import ru from "date-fns/locale/ru";
registerLocale("ru", ru);
import { apiRequest } from "@api/request";
import { getCorrectDate } from "@components/Calendar/calendarHelper";
import BaseButton from "@components/Common/BaseButton/BaseButton";
import { Footer } from "@components/Common/Footer/Footer";
import { Loader } from "@components/Common/Loader/Loader";
@ -31,6 +30,7 @@ import TrackerTaskComment from "@components/TrackerTaskComment/TrackerTaskCommen
import arrow from "assets/icons/arrows/arrowCalendar.png";
import arrowStart from "assets/icons/arrows/arrowStart.png";
import calendarIcon from "assets/icons/calendar.svg";
import close from "assets/icons/close.png";
import del from "assets/icons/delete.svg";
import edit from "assets/icons/edit.svg";
@ -45,6 +45,8 @@ import avatarMok from "assets/images/avatarMok.png";
import "./ticketFullScreen.scss";
registerLocale("ru", ru);
export const TicketFullScreen = () => {
const [modalAddWorker, setModalAddWorker] = useState(false);
const ticketId = useParams();
@ -70,15 +72,17 @@ export const TicketFullScreen = () => {
const [correctProjectUsers, setCorrectProjectUsers] = useState([]);
const [dropListMembersOpen, setDropListMembersOpen] = useState(false);
const [users, setUsers] = useState([]);
const [deadLine, setDeadLine] = useState('');
const [deadLine, setDeadLine] = useState("");
const [datePickerOpen, setDatePickerOpen] = useState(false);
const [startDate, setStartDate] = useState(null);
useEffect(() => {
apiRequest(`/task/get-task?task_id=${ticketId.id}`).then((taskInfo) => {
setTaskInfo(taskInfo);
setDeadLine(taskInfo.dead_line)
setStartDate(taskInfo.dead_line ? new Date(taskInfo.dead_line) : new Date())
setDeadLine(taskInfo.dead_line);
setStartDate(
taskInfo.dead_line ? new Date(taskInfo.dead_line) : new Date()
);
setInputsValue({
title: taskInfo.title,
description: taskInfo.description,
@ -378,10 +382,9 @@ export const TicketFullScreen = () => {
method: "PUT",
data: {
task_id: taskInfo.id,
dead_line: getCorrectRequestDate(date)
dead_line: getCorrectRequestDate(date),
},
}).then(() => {
});
}).then(() => {});
}
return (
@ -772,10 +775,17 @@ export const TicketFullScreen = () => {
</div>
<div className="workers_box-middle">
<div className='deadLine'>
<div className='deadLine__container' onClick={() => setDatePickerOpen(!datePickerOpen)}>
<img src={calendarIcon} alt='calendar' />
<span>{deadLine ? getCorrectDate(deadLine) : 'Срок исполнения:'}</span>
<div className="deadLine">
<div
className="deadLine__container"
onClick={() => setDatePickerOpen(!datePickerOpen)}
>
<img src={calendarIcon} alt="calendar" />
<span>
{deadLine
? getCorrectDate(deadLine)
: "Срок исполнения:"}
</span>
</div>
<DatePicker
className="datePicker"
@ -785,8 +795,8 @@ export const TicketFullScreen = () => {
onChange={(date) => {
setDatePickerOpen(false);
setStartDate(date);
setDeadLine(date)
selectDeadLine(date)
setDeadLine(date);
selectDeadLine(date);
}}
/>
</div>

View File

@ -33,9 +33,6 @@ import TrackerModal from "@components/Modal/Tracker/TrackerModal/TrackerModal";
import { Navigation } from "@components/Navigation/Navigation";
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
import {
getCorrectDate
} from "../../components/Calendar/calendarHelper";
import arrow from "assets/icons/arrows/arrowCalendar.png";
import arrowDown from "assets/icons/arrows/selectArrow.png";
@ -51,6 +48,8 @@ import accept from "assets/images/accept.png";
import archive from "assets/images/archiveIcon.png";
import avatarMok from "assets/images/avatarMok.png";
import { getCorrectDate } from "../../components/Calendar/calendarHelper";
export const ProjectTracker = () => {
const dispatch = useDispatch();
const projectId = useParams();
@ -552,7 +551,7 @@ export const ProjectTracker = () => {
>
<div className="board__head">
<span>{column.title}</span>
<div className='board__head__more'>
<div className="board__head__more">
<span
className="add"
onClick={() =>
@ -657,7 +656,10 @@ export const ProjectTracker = () => {
</div>
<div className="tasks__board__item__deadLine">
<p>Срок исполнения:</p>
<span>{task.dead_line ? getCorrectDate(task.dead_line) : 'Не выбран'}
<span>
{task.dead_line
? getCorrectDate(task.dead_line)
: "Не выбран"}
</span>
</div>
<div className="tasks__board__item__info">