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 }) => {
{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 ? (
{userInfo.position}
Вернуться
@@ -119,7 +124,9 @@ export const ViewReport = () => {В этот день вы не заполняли отчет -
: + + ) : (Отчет за день не заполнен
- } + )}