diff --git a/src/App.js b/src/App.js index 3eeca2a6..69635b0e 100644 --- a/src/App.js +++ b/src/App.js @@ -88,8 +88,9 @@ const App = () => { } /> } /> } /> + } /> } /> - } /> + } /> } /> } /> } /> diff --git a/src/components/Calendar/calendarComponent.scss b/src/components/Calendar/calendarComponent.scss index 7aab544f..1d525bd3 100644 --- a/src/components/Calendar/calendarComponent.scss +++ b/src/components/Calendar/calendarComponent.scss @@ -7,7 +7,7 @@ padding-right: 54px; padding-top: 48px; padding-bottom: 40px; - font-family: 'LabGrotesque', sans-serif; + font-family: "LabGrotesque", sans-serif; &__header { display: flex; @@ -56,7 +56,6 @@ } h3 { - font-size: 2.5em; font-weight: 400; font-style: normal; @@ -142,8 +141,8 @@ button { margin: 0 auto; - //width: 125px; - //height: 42px; + width: 125px; + height: 42px; padding: 0 5px; box-shadow: 0 0 59px rgba(44, 44, 44, 0.05); border-radius: 5px; @@ -157,40 +156,31 @@ line-height: normal; text-align: center; - a { - display: flex; - align-items: center; - justify-content: center; - width: 115px; - height: 42px; - text-decoration: none; - color: #000000; - - img { - width: 16px; - height: 16px; - margin: 0 10px 0 0; - } - - @media (max-width: 1200px) { - width: 90px; - height: 40px; - } + img { + width: 16px; + height: 16px; + margin: 0 10px 0 0; @media (max-width: 968px) { - width: 62px; - height: 40px; - font-size: 10px; + margin-right: 2px; - img { - margin-right: 2px; - } - } - - @media (max-width: 610px) { - img { + @media (max-width: 610px) { display: none; } + } + } + + @media (max-width: 1200px) { + width: 90px; + height: 40px; + } + + @media (max-width: 968px) { + width: 62px; + height: 40px; + font-size: 10px; + + @media (max-width: 610px) { width: auto; height: auto; } diff --git a/src/components/ProfileCalendar/ProfileCalendar.js b/src/components/ProfileCalendar/ProfileCalendar.js index 8eb07cf5..67f3f9ee 100644 --- a/src/components/ProfileCalendar/ProfileCalendar.js +++ b/src/components/ProfileCalendar/ProfileCalendar.js @@ -1,99 +1,127 @@ -import React, { useEffect, useState } from 'react' -import {useDispatch, useSelector} from 'react-redux' +import React, { useEffect, useState } from "react"; +import { useDispatch, useSelector } from "react-redux"; -import {getReports} from '../Calendar/calendarHelper' -import {Link, Navigate} from 'react-router-dom' +import { getReports } from "../Calendar/calendarHelper"; +import { Link, Navigate } from "react-router-dom"; import moment from "moment"; -import {ProfileCalendarComponent} from "./ProfileCalendarComponent"; -import {Loader} from "../Loader/Loader"; -import {ProfileHeader} from "../ProfileHeader/ProfileHeader"; -import {ProfileBreadcrumbs} from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs" -import { Footer } from '../Footer/Footer' +import { ProfileCalendarComponent } from "./ProfileCalendarComponent"; +import { Loader } from "../Loader/Loader"; +import { ProfileHeader } from "../ProfileHeader/ProfileHeader"; +import { ProfileBreadcrumbs } from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs"; +import { Footer } from "../Footer/Footer"; +import { Navigation } from "../Navigation/Navigation"; +import { ViewReport } from "../../pages/ViewReport/ViewReport"; -import {urlForLocal} from "../../helper"; +import { urlForLocal } from "../../helper"; -import {apiRequest} from "../../api/request"; -import { getProfileInfo } from '../../redux/outstaffingSlice' -import {getRequestDates, setReportDate, setRequestDate} from "../../redux/reportSlice"; - -import 'moment/locale/ru' -import './profileCalendar.scss' -import { Navigation } from '../Navigation/Navigation'; +import { apiRequest } from "../../api/request"; +import { getProfileInfo } from "../../redux/outstaffingSlice"; +import { + getRequestDates, + setReportDate, + setRequestDate, +} from "../../redux/reportSlice"; +import "moment/locale/ru"; +import "./profileCalendar.scss"; export const ProfileCalendar = () => { - if(localStorage.getItem('role_status') === '18') { - return + if (localStorage.getItem("role_status") === "18") { + return ; + } + const dispatch = useDispatch(); + const profileInfo = useSelector(getProfileInfo); + const requestDates = useSelector(getRequestDates); + const [value, setValue] = useState(moment()); + const [reports, setReports] = useState([]); + const [totalHours, setTotalHours] = useState(0); + const [loader, setLoader] = useState(true); + + function setValueHandler(value) { + setValue(value); + } + + useEffect(() => { + dispatch(setRequestDate(getReports(moment()))); + }, []); + + useEffect(() => { + setLoader(true); + if (!requestDates) { + return; } - const dispatch = useDispatch(); - const profileInfo = useSelector(getProfileInfo) - const requestDates = useSelector(getRequestDates) - const [value, setValue] = useState(moment()) - const [reports, setReports] = useState([]); - const [totalHours, setTotalHours] = useState(0); - const [loader, setLoader] = useState(true) + apiRequest( + `/reports/reports-by-date?${requestDates}&user_card_id=${localStorage.getItem( + "cardId" + )}` + ).then((reports) => { + let spendTime = 0; + for (const report of reports) { + report.task.map((task) => { + if (task.hours_spent) { + spendTime += Number(task.hours_spent); + } + }); + } + setTotalHours(spendTime); + setReports(reports); + setLoader(false); + }); + }, [requestDates]); - function setValueHandler (value) { - setValue(value) - } - - useEffect(() => { - dispatch(setRequestDate(getReports(moment()))) - },[]); - - useEffect( () => { - setLoader(true) - if (!requestDates) { - return - } - apiRequest(`/reports/reports-by-date?${requestDates}&user_card_id=${localStorage.getItem('cardId')}`) - .then((reports) => { - let spendTime = 0; - for (const report of reports) { - report.task.map((task) => { - if(task.hours_spent) { - spendTime += Number(task.hours_spent) - } - }) - } - setTotalHours(spendTime); - setReports(reports) - setLoader(false) - }) - }, [requestDates]); - - return ( -
- - -
- -

Ваши отчеты

-
-
- avatar -

{profileInfo.fio}, {profileInfo.specification} разработчик

-
- - - -
- {loader ? -
- -
- : -
-
- -
-
- } -
-