diff --git a/src/components/PartnerPersonCard/PartnerPersonCard.jsx b/src/components/PartnerPersonCard/PartnerPersonCard.jsx index 9f3b03b4..ac62ebb2 100644 --- a/src/components/PartnerPersonCard/PartnerPersonCard.jsx +++ b/src/components/PartnerPersonCard/PartnerPersonCard.jsx @@ -15,7 +15,10 @@ export const PartnerPersonCard = ({ name, img, userId }) => {

{name}

- + Подробный отчет
arrow diff --git a/src/components/ProfileCalendar/ProfileCalendarComponent.jsx b/src/components/ProfileCalendar/ProfileCalendarComponent.jsx index f273bf09..dc3b55c7 100644 --- a/src/components/ProfileCalendar/ProfileCalendarComponent.jsx +++ b/src/components/ProfileCalendar/ProfileCalendarComponent.jsx @@ -96,14 +96,14 @@ export const ProfileCalendarComponent = React.memo( )}-${correctDay(new Date(day).getDate())}` === date.created_at ) { if (userId) { - return `../view/${date.created_at}/${userId}` + return `../view/${date.created_at}/${userId}`; } return `../view/${date.created_at}/${localStorage.getItem("id")}`; } } if (userId) { - return "#" + return "#"; } return "../../report"; @@ -123,7 +123,9 @@ export const ProfileCalendarComponent = React.memo( startDate._d )}`; apiRequest( - `/reports/index?${requestDates}&user_id=${userId ? userId : localStorage.getItem("id")}` + `/reports/index?${requestDates}&user_id=${ + userId ? userId : localStorage.getItem("id") + }` ).then((reports) => { let spendTime = 0; reports.map((report) => { @@ -172,9 +174,7 @@ export const ProfileCalendarComponent = React.memo(
- {!userId && -

Мои отчеты за

- } + {!userId &&

Мои отчеты за

}

{month}  diff --git a/src/pages/PartnerEmployeeReport/PartnerEmployeeReport.jsx b/src/pages/PartnerEmployeeReport/PartnerEmployeeReport.jsx index cc31f54b..8906d88d 100644 --- a/src/pages/PartnerEmployeeReport/PartnerEmployeeReport.jsx +++ b/src/pages/PartnerEmployeeReport/PartnerEmployeeReport.jsx @@ -1,20 +1,21 @@ +import moment from "moment/moment"; import React, { useEffect, useState } from "react"; +import { useDispatch, useSelector } from "react-redux"; import { Navigate, useParams } from "react-router-dom"; -import { Footer } from "@components/Common/Footer/Footer"; -import { Navigation } from "@components/Navigation/Navigation"; -import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs"; -import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader"; -import { ProfileCalendarComponent } from "@components/ProfileCalendar/ProfileCalendarComponent"; +import { getRequestDates, setRequestDate } from "@redux/reportSlice"; import { apiRequest } from "@api/request"; -import "./partnerEmployeeReport.scss"; -import moment from "moment/moment"; -import { useDispatch, useSelector } from "react-redux"; -import { getRequestDates, setRequestDate } from "@redux/reportSlice"; import { getReports } from "@components/Calendar/calendarHelper"; +import { Footer } from "@components/Common/Footer/Footer"; import { Loader } from "@components/Common/Loader/Loader"; +import { Navigation } from "@components/Navigation/Navigation"; +import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs"; +import { ProfileCalendarComponent } from "@components/ProfileCalendar/ProfileCalendarComponent"; +import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader"; + +import "./partnerEmployeeReport.scss"; export const PartnerEmployeeReport = () => { // if ( @@ -25,7 +26,7 @@ export const PartnerEmployeeReport = () => { const params = useParams(); const dispatch = useDispatch(); - const [userInfo, setUserInfo] = useState({}) + const [userInfo, setUserInfo] = useState({}); const [value, setValue] = useState(moment()); const [reports, setReports] = useState([]); const [totalHours, setTotalHours] = useState(0); @@ -39,38 +40,36 @@ export const PartnerEmployeeReport = () => { }, []); useEffect(() => { - apiRequest( - `/resume?userId=${params.uuid}` - ).then((res) => { - setUserInfo(res) + apiRequest(`/resume?userId=${params.uuid}`).then((res) => { + setUserInfo(res); }); - }, []) + }, []); useEffect(() => { setLoader(true); if (!requestDates) { return; } - apiRequest( - `/reports/index?${requestDates}&user_id=${params.uuid}` - ).then((reports) => { - let spendTime = 0; + apiRequest(`/reports/index?${requestDates}&user_id=${params.uuid}`).then( + (reports) => { + let spendTime = 0; - reports - .filter( - (item) => new Date(item.created_at).getMonth() === value.month() - ) - .map((report) => { - spendTime += report.task.reduce( - (acc, task) => acc + task.hours_spent, - 0 - ); - }); + reports + .filter( + (item) => new Date(item.created_at).getMonth() === value.month() + ) + .map((report) => { + spendTime += report.task.reduce( + (acc, task) => acc + task.hours_spent, + 0 + ); + }); - setTotalHours(Math.floor(spendTime)); - setReports(reports); - setLoader(false); - }); + setTotalHours(Math.floor(spendTime)); + setReports(reports); + setLoader(false); + } + ); }, [requestDates]); return ( @@ -84,11 +83,11 @@ export const PartnerEmployeeReport = () => { { name: "Данные моего персонала", link: "/profile/employees" } ]} /> - {!Object.keys(userInfo).length ? + {!Object.keys(userInfo).length ? (

- +
- : + ) : ( <>
@@ -96,15 +95,16 @@ export const PartnerEmployeeReport = () => {

{userInfo.position}

- {userInfo?.stack && userInfo.stack.map((skill, index) => { - return {skill} - })} + {userInfo?.stack && + userInfo.stack.map((skill, index) => { + return {skill}; + })}
{loader ? (
- +
) : (
@@ -123,7 +123,7 @@ export const PartnerEmployeeReport = () => { )}
- } + )}
diff --git a/src/pages/PartnerСategories/PartnerСategories.jsx b/src/pages/PartnerСategories/PartnerСategories.jsx index 68ed8a12..4ebf2784 100644 --- a/src/pages/PartnerСategories/PartnerСategories.jsx +++ b/src/pages/PartnerСategories/PartnerСategories.jsx @@ -7,6 +7,7 @@ import { apiRequest } from "@api/request"; // import { setPartnerEmployees } from "@redux/outstaffingSlice"; import { Footer } from "@components/Common/Footer/Footer"; +import { Loader } from "@components/Common/Loader/Loader"; import { Navigation } from "@components/Navigation/Navigation"; import PartnerPersonCard from "@components/PartnerPersonCard/PartnerPersonCard"; import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs"; @@ -24,7 +25,6 @@ import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader"; // import TestImg from "assets/images/partnerProfile/PersonalTesters.svg"; // import BackEndImg from "assets/images/partnerProfile/personalBackEnd.svg"; import "./partnerСategories.scss"; -import { Loader } from "@components/Common/Loader/Loader"; export const PartnerCategories = () => { // const dispatch = useDispatch(); @@ -33,12 +33,12 @@ export const PartnerCategories = () => { } const [staff, setStaff] = useState([]); - const [loader, setLoader] = useState(false) + const [loader, setLoader] = useState(false); useEffect(() => { - setLoader(true) + setLoader(true); apiRequest("/project/my-employee").then((el) => { - setLoader(false) + setLoader(false); setStaff(el.managerEmployees); }); }, []); @@ -157,9 +157,9 @@ export const PartnerCategories = () => { ]} />

Данные персонала

- {loader ? - - : + {loader ? ( + + ) : (
{staff.map((card) => { return ( @@ -205,7 +205,7 @@ export const PartnerCategories = () => { {/* );*/} {/*})}*/}
- } + )}
diff --git a/src/pages/ViewReport/ViewReport.jsx b/src/pages/ViewReport/ViewReport.jsx index 26cd5e98..d9e5ffe6 100644 --- a/src/pages/ViewReport/ViewReport.jsx +++ b/src/pages/ViewReport/ViewReport.jsx @@ -20,7 +20,6 @@ import arrow from "assets/icons/arrows/left-arrow.png"; import "./viewReport.scss"; export const ViewReport = () => { - const params = useParams(); const [previousReportDay] = useState(new Date(params.date)); const [nextReportDay] = useState(new Date(params.date)); @@ -37,31 +36,31 @@ export const ViewReport = () => { setTaskText([]); setDifficulties([]); setTomorrowTask([]); - apiRequest( - `reports/find-by-date?user_id=${params.id}&date=${day}` - ).then((res) => { - let spendTime = 0; - for (const item of res) { - if (item.difficulties) { - setDifficulties((prevArray) => [...prevArray, item.difficulties]); - } - if (item.tomorrow) { - setTomorrowTask((prevArray) => [...prevArray, item.tomorrow]); - } - item.task.map((task) => { - const taskInfo = { - hours: task.hours_spent, - task: task.task, - id: task.id - }; - spendTime += Math.floor(task.hours_spent); + apiRequest(`reports/find-by-date?user_id=${params.id}&date=${day}`).then( + (res) => { + let spendTime = 0; + for (const item of res) { + if (item.difficulties) { + setDifficulties((prevArray) => [...prevArray, item.difficulties]); + } + if (item.tomorrow) { + setTomorrowTask((prevArray) => [...prevArray, item.tomorrow]); + } + item.task.map((task) => { + const taskInfo = { + hours: task.hours_spent, + task: task.task, + id: task.id + }; + spendTime += Math.floor(task.hours_spent); - setTaskText((prevArray) => [...prevArray, taskInfo]); - }); + setTaskText((prevArray) => [...prevArray, taskInfo]); + }); + } + setTotalHours(Math.floor(spendTime)); + setLoader(false); } - setTotalHours(Math.floor(spendTime)); - setLoader(false); - }); + ); previousReportDay.setDate(previousReportDay.getDate() - 1); nextReportDay.setDate(nextReportDay.getDate() + 1); } @@ -86,7 +85,7 @@ export const ViewReport = () => {
- {localStorage.getItem("role_status") !== "18" && + {localStorage.getItem("role_status") !== "18" && ( <> { ]} />

- Ваши отчеты - просмотр отчета за день + Ваши отчеты - просмотр отчета за день

- } - + )} + #

Вернуться

@@ -119,7 +124,9 @@ export const ViewReport = () => {
previousDay()}> - +
arrow
@@ -208,12 +215,13 @@ export const ViewReport = () => { )} {!Boolean(taskText.length) && !loader && (
- {localStorage.getItem("role_status") === "4" ? + {localStorage.getItem("role_status") === "4" ? (

В этот день вы не заполняли отчет -

: +

+ ) : (

Отчет за день не заполнен

- } + )}
)}