fix layout

This commit is contained in:
Victor Batischev 2024-02-15 17:04:01 +03:00
commit 9a1ffb3c77
16 changed files with 163 additions and 23 deletions

View File

@ -11,9 +11,9 @@ import { LogoutButton } from "@components/LogoutButton/LogoutButton";
import rectangle from "assets/images/rectangle_secondPage.png"; import rectangle from "assets/images/rectangle_secondPage.png";
import { currentMonth } from "../../utils/calendarHelper";
import CalendarComponent from "./CalendarComponent"; import CalendarComponent from "./CalendarComponent";
import "./calendar.scss"; import "./calendar.scss";
import { currentMonth } from "../../utils/calendarHelper";
const Calendar = () => { const Calendar = () => {
if (localStorage.getItem("role_status") !== "18") { if (localStorage.getItem("role_status") !== "18") {

View File

@ -6,8 +6,8 @@ import calendarIcon from "assets/icons/calendar.svg";
import ellipse from "assets/icons/ellipse.png"; import ellipse from "assets/icons/ellipse.png";
import rectangle from "assets/images/rectangle__calendar.png"; import rectangle from "assets/images/rectangle__calendar.png";
import "./calendarComponent.scss";
import { calendarHelper, currentMonthAndDay } from "../../utils/calendarHelper"; import { calendarHelper, currentMonthAndDay } from "../../utils/calendarHelper";
import "./calendarComponent.scss";
const CalendarComponent = ({ onSelect }) => { const CalendarComponent = ({ onSelect }) => {
const [value, setValue] = useState(moment()); const [value, setValue] = useState(moment());

View File

@ -9,6 +9,7 @@ import { Link, useNavigate, useParams } from "react-router-dom";
import { getProfileInfo } from "@redux/outstaffingSlice"; import { getProfileInfo } from "@redux/outstaffingSlice";
import { getBoarderLoader, setToggleTab } from "@redux/projectsTrackerSlice"; import { getBoarderLoader, setToggleTab } from "@redux/projectsTrackerSlice";
import { getCorrectDate } from "@utils/calendarHelper";
import { import {
backendImg, backendImg,
caseOfNum, caseOfNum,
@ -21,7 +22,6 @@ import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification"; import { useNotification } from "@hooks/useNotification";
import { getCorrectDate } from "@utils/calendarHelper";
import { Footer } from "@components/Common/Footer/Footer"; import { Footer } from "@components/Common/Footer/Footer";
import { Loader } from "@components/Common/Loader/Loader"; import { Loader } from "@components/Common/Loader/Loader";
import FileTracker from "@components/FileTracker/FileTracker"; import FileTracker from "@components/FileTracker/FileTracker";

View File

@ -22,13 +22,13 @@ import {
setProjectBoardFetch setProjectBoardFetch
} from "@redux/projectsTrackerSlice"; } from "@redux/projectsTrackerSlice";
import { getCorrectDate } from "@utils/calendarHelper";
import { getCorrectRequestDate, urlForLocal } from "@utils/helper"; import { getCorrectRequestDate, urlForLocal } from "@utils/helper";
import { apiRequest } from "@api/request"; import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification"; import { useNotification } from "@hooks/useNotification";
import { getCorrectDate } from "@utils/calendarHelper";
import BaseButton from "@components/Common/BaseButton/BaseButton"; import BaseButton from "@components/Common/BaseButton/BaseButton";
import { Loader } from "@components/Common/Loader/Loader"; import { Loader } from "@components/Common/Loader/Loader";
import ModalLayout from "@components/Common/ModalLayout/ModalLayout"; import ModalLayout from "@components/Common/ModalLayout/ModalLayout";

View File

@ -12,11 +12,11 @@ import {
setRequestDate setRequestDate
} from "@redux/reportSlice"; } from "@redux/reportSlice";
import { getReports } from "@utils/calendarHelper";
import { urlForLocal } from "@utils/helper"; import { urlForLocal } from "@utils/helper";
import { apiRequest } from "@api/request"; import { apiRequest } from "@api/request";
import { getReports } from "@utils/calendarHelper";
import { Footer } from "@components/Common/Footer/Footer"; import { Footer } from "@components/Common/Footer/Footer";
import { Loader } from "@components/Common/Loader/Loader"; import { Loader } from "@components/Common/Loader/Loader";
import { Navigation } from "@components/Navigation/Navigation"; import { Navigation } from "@components/Navigation/Navigation";

View File

@ -11,11 +11,6 @@ import {
setSendRequest setSendRequest
} from "@redux/reportSlice"; } from "@redux/reportSlice";
import { getCorrectYYMMDD } from "@utils/helper";
import { apiRequest } from "@api/request";
import "@components/Calendar/calendarComponent.scss";
import { import {
calendarHelper, calendarHelper,
correctDay, correctDay,
@ -24,6 +19,11 @@ import {
getReports, getReports,
hourOfNum hourOfNum
} from "@utils/calendarHelper"; } from "@utils/calendarHelper";
import { getCorrectYYMMDD } from "@utils/helper";
import { apiRequest } from "@api/request";
import "@components/Calendar/calendarComponent.scss";
import BaseButton from "@components/Common/BaseButton/BaseButton"; import BaseButton from "@components/Common/BaseButton/BaseButton";
import arrow from "assets/icons/arrows/arrowCalendar.png"; import arrow from "assets/icons/arrows/arrowCalendar.png";

View File

@ -1,6 +1,6 @@
.profile-header { .profile-header {
width: 100%; width: 100%;
height: 80px; height: 66px;
background: #e1fccf; background: #e1fccf;
padding: 20px; padding: 20px;
display: flex; display: flex;
@ -17,7 +17,11 @@
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
height: 100%; height: 100%;
z-index: 9; z-index: 9999;
max-width: 1160px;
width: 100%;
margin: 0 auto;
padding: 0 15px;
.text { .text {
width: 100%; width: 100%;
@ -56,6 +60,10 @@
} }
} }
&__info {
background: white;
}
.auth-body { .auth-body {
opacity: 0; opacity: 0;
z-index: 99; z-index: 99;
@ -140,7 +148,7 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
min-height: 50px; min-height: 66px;
@media (max-width: 414px) { @media (max-width: 414px) {
display: none; display: none;

View File

@ -18,6 +18,7 @@ import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadc
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader"; import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
import arrow from "assets/icons/arrows/left-arrow.png"; import arrow from "assets/icons/arrows/left-arrow.png";
import arrowDown from "assets/icons/arrows/selectArrow.png";
import calendarIcon from "assets/icons/calendar.svg"; import calendarIcon from "assets/icons/calendar.svg";
import ellipse from "assets/icons/ellipse.png"; import ellipse from "assets/icons/ellipse.png";
import remove from "assets/icons/remove.svg"; import remove from "assets/icons/remove.svg";
@ -42,6 +43,7 @@ const ReportForm = () => {
useEffect(() => { useEffect(() => {
initListeners(); initListeners();
getProjectList();
}, []); }, []);
const [isFetching, setIsFetching] = useState(false); const [isFetching, setIsFetching] = useState(false);
@ -51,6 +53,10 @@ const ReportForm = () => {
? new Date(reportDate ? reportDate._d : editReport.created_at) ? new Date(reportDate ? reportDate._d : editReport.created_at)
: new Date() : new Date()
); );
const [projectList, setProjectList] = useState([]);
const [projectLoader, setProjectLoader] = useState(false);
const [selectedProject, setSelectedProject] = useState("Выберите проект");
const [openSelectProject, setOpenSelectProject] = useState(false);
const [datePickerOpen, setDatePickerOpen] = useState(false); const [datePickerOpen, setDatePickerOpen] = useState(false);
const [inputs, setInputs] = useState( const [inputs, setInputs] = useState(
@ -85,10 +91,12 @@ const ReportForm = () => {
(div) => (div) =>
div.classList && div.classList &&
(div.classList.contains("report-form__block-img") || (div.classList.contains("report-form__block-img") ||
div.classList.contains("react-datepicker-popper")) div.classList.contains("react-datepicker-popper") ||
div.classList.contains("report-form__project"))
) )
) { ) {
setDatePickerOpen(false); setDatePickerOpen(false);
setOpenSelectProject(false);
} }
}; };
@ -98,6 +106,17 @@ const ReportForm = () => {
setInputs((prev) => prev.filter((el, index) => index !== indexRemove)); setInputs((prev) => prev.filter((el, index) => index !== indexRemove));
}; };
const getProjectList = () => {
setProjectLoader(true);
apiRequest(
`/project/project-list?user_id=${localStorage.getItem(
"id"
)}&expand=columns`
).then((el) => {
setProjectLoader(false);
setProjectList(el?.projects);
});
};
const handler = () => { const handler = () => {
setIsFetching(true); setIsFetching(true);
for (let input of inputs) { for (let input of inputs) {
@ -113,6 +132,7 @@ const ReportForm = () => {
data: { data: {
user_id: localStorage.getItem("id"), user_id: localStorage.getItem("id"),
tasks: inputs, tasks: inputs,
project_id: selectedProject.id ? selectedProject.id : "",
difficulties: troublesInputValue, difficulties: troublesInputValue,
tomorrow: scheduledInputValue, tomorrow: scheduledInputValue,
created_at: getCreatedDate(startDate), created_at: getCreatedDate(startDate),
@ -144,6 +164,7 @@ const ReportForm = () => {
data: { data: {
tasks: inputs, tasks: inputs,
difficulties: troublesInputValue, difficulties: troublesInputValue,
project_id: selectedProject.id ? selectedProject.id : "",
tomorrow: scheduledInputValue, tomorrow: scheduledInputValue,
created_at: getCreatedDate(startDate), created_at: getCreatedDate(startDate),
status: 1 status: 1
@ -220,6 +241,58 @@ const ReportForm = () => {
setStartDate(date); setStartDate(date);
}} }}
/> />
{projectLoader ? (
<div className="loader__wrapper">
<Loader />
</div>
) : (
<>
<div className="report-form__task-list">
<img src={ellipse} alt="" />
<span>Выберите проект</span>
</div>
<div className="report-form__project">
<div
className="project__selected"
onClick={() => setOpenSelectProject(!openSelectProject)}
>
<p>
{selectedProject.name
? selectedProject.name
: selectedProject}
</p>
<img
className={
openSelectProject ? "project__selected--open" : ""
}
src={arrowDown}
alt="arrow"
/>
</div>
{openSelectProject && (
<div className="project__dropDown">
{Boolean(projectList.length) ? (
projectList.map((project) => {
return (
<span
onClick={() => {
setSelectedProject(project);
setOpenSelectProject(false);
}}
key={project.id}
>
{project.name}
</span>
);
})
) : (
<span>Проектов нет</span>
)}
</div>
)}
</div>
</>
)}
<div className="report-form__task-list"> <div className="report-form__task-list">
<img src={ellipse} alt="" /> <img src={ellipse} alt="" />
<span>Какие задачи выполнены?</span> <span>Какие задачи выполнены?</span>

View File

@ -107,6 +107,62 @@
} }
} }
.loader__wrapper {
max-width: 200px;
}
&__project {
position: relative;
max-width: 200px;
margin-top: 10px;
.project {
&__selected {
display: flex;
border-radius: 8px;
border: 1px solid gray;
cursor: pointer;
font-size: 18px;
padding: 5px;
justify-content: space-between;
align-items: center;
font-weight: 500;
img {
width: 16px;
height: 16px;
transition: all 0.3s ease;
}
&--open {
transform: rotate(180deg);
}
}
&__dropDown {
position: absolute;
border-radius: 8px;
display: flex;
flex-direction: column;
width: 100%;
background: white;
border: 1px solid #c2c2c2;
padding: 5px;
z-index: 100;
row-gap: 3px;
span {
cursor: pointer;
font-size: 16px;
&:hover {
font-weight: 600;
}
}
}
}
}
&__task { &__task {
&-number { &-number {
color: #282828; color: #282828;

View File

@ -8,13 +8,14 @@ import {
setSendRequest setSendRequest
} from "@redux/reportSlice"; } from "@redux/reportSlice";
import { apiRequest } from "@api/request";
import { import {
getCorrectDate, getCorrectDate,
getCreatedDate, getCreatedDate,
hourOfNum hourOfNum
} from "@utils/calendarHelper"; } from "@utils/calendarHelper";
import { apiRequest } from "@api/request";
import { Loader } from "@components/Common/Loader/Loader"; import { Loader } from "@components/Common/Loader/Loader";
import "./shortReport.scss"; import "./shortReport.scss";

View File

@ -2,11 +2,11 @@ import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
import { CKEditor } from "@ckeditor/ckeditor5-react"; import { CKEditor } from "@ckeditor/ckeditor5-react";
import React, { useState } from "react"; import React, { useState } from "react";
import { getCorrectDate } from "@utils/calendarHelper";
import { urlForLocal } from "@utils/helper"; import { urlForLocal } from "@utils/helper";
import { apiRequest } from "@api/request"; import { apiRequest } from "@api/request";
import { getCorrectDate } from "@utils/calendarHelper";
import TrackerTaskSubComment from "@components/TrackerTaskComment/TrackerTaskComment"; import TrackerTaskSubComment from "@components/TrackerTaskComment/TrackerTaskComment";
import del from "assets/icons/delete.svg"; import del from "assets/icons/delete.svg";

View File

@ -9,11 +9,11 @@ import {
setPartnerRequestInfo setPartnerRequestInfo
} from "@redux/outstaffingSlice"; } from "@redux/outstaffingSlice";
import { getCorrectDate } from "@utils/calendarHelper";
import { urlForLocal } from "@utils/helper"; import { urlForLocal } from "@utils/helper";
import { apiRequest } from "@api/request"; import { apiRequest } from "@api/request";
import { getCorrectDate } from "@utils/calendarHelper";
import { Footer } from "@components/Common/Footer/Footer"; import { Footer } from "@components/Common/Footer/Footer";
import { Loader } from "@components/Common/Loader/Loader"; import { Loader } from "@components/Common/Loader/Loader";
import ModalLayout from "@components/Common/ModalLayout/ModalLayout"; import ModalLayout from "@components/Common/ModalLayout/ModalLayout";

View File

@ -5,9 +5,10 @@ import { Navigate, useParams } from "react-router-dom";
import { getRequestDates, setRequestDate } from "@redux/reportSlice"; import { getRequestDates, setRequestDate } from "@redux/reportSlice";
import { getReports } from "@utils/calendarHelper";
import { apiRequest } from "@api/request"; import { apiRequest } from "@api/request";
import { getReports } from "@utils/calendarHelper";
import { Footer } from "@components/Common/Footer/Footer"; import { Footer } from "@components/Common/Footer/Footer";
import { Loader } from "@components/Common/Loader/Loader"; import { Loader } from "@components/Common/Loader/Loader";
import { Navigation } from "@components/Navigation/Navigation"; import { Navigation } from "@components/Navigation/Navigation";

View File

@ -1,8 +1,8 @@
import React from "react"; import React from "react";
import { Footer } from "@components/Common/Footer/Footer";
import { Navigation } from "@components/Navigation/Navigation"; import { Navigation } from "@components/Navigation/Navigation";
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader"; import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
import { Footer } from "@components/Common/Footer/Footer";
import "./payouts.scss"; import "./payouts.scss";

View File

@ -6,10 +6,10 @@ import { setToggleTab } from "@redux/projectsTrackerSlice";
import { copyProjectLink } from "@utils/helper"; import { copyProjectLink } from "@utils/helper";
import { Footer } from "@components/Common/Footer/Footer";
import { Navigation } from "@components/Navigation/Navigation"; import { Navigation } from "@components/Navigation/Navigation";
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs"; import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader"; import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
import { Footer } from "@components/Common/Footer/Footer";
import arrow from "assets/icons/arrows/arrowCalendar.png"; import arrow from "assets/icons/arrows/arrowCalendar.png";
import emailImg from "assets/icons/emailStatistics.svg"; import emailImg from "assets/icons/emailStatistics.svg";

View File

@ -4,13 +4,14 @@ import { Link, useParams } from "react-router-dom";
import { setEditReport } from "@redux/reportSlice"; import { setEditReport } from "@redux/reportSlice";
import { apiRequest } from "@api/request";
import { import {
getCorrectDate, getCorrectDate,
getCreatedDate, getCreatedDate,
hourOfNum hourOfNum
} from "@utils/calendarHelper"; } from "@utils/calendarHelper";
import { apiRequest } from "@api/request";
import { Footer } from "@components/Common/Footer/Footer"; import { Footer } from "@components/Common/Footer/Footer";
import { Loader } from "@components/Common/Loader/Loader"; import { Loader } from "@components/Common/Loader/Loader";
import { Navigation } from "@components/Navigation/Navigation"; import { Navigation } from "@components/Navigation/Navigation";