Compare commits
No commits in common. "4a81441d354b588e92f4cc7a7f3a6900826ddd49" and "cdba3b41127d4d6cfb85139261945d737d6a7d35" have entirely different histories.
4a81441d35
...
cdba3b4112
@ -42,7 +42,6 @@ import { PartnerEmployees } from "@pages/PartnerEmployees/PartnerEmployees";
|
|||||||
import { AuthForCandidate } from "@pages/AuthForCandidate/AuthForCandidate";
|
import { AuthForCandidate } from "@pages/AuthForCandidate/AuthForCandidate";
|
||||||
import { RegistrationForCandidate } from "@pages/RegistrationForCandidate/RegistrationForCandidate";
|
import { RegistrationForCandidate } from "@pages/RegistrationForCandidate/RegistrationForCandidate";
|
||||||
import { ProfileCandidate } from "@pages/ProfileCandidate/ProfileCandidate";
|
import { ProfileCandidate } from "@pages/ProfileCandidate/ProfileCandidate";
|
||||||
import { PartnerEmployeeReport } from "@pages/PartnerEmployeeReport/PartnerEmployeeReport";
|
|
||||||
import { PassingTests } from "@pages/Quiz/PassingTests";
|
import { PassingTests } from "@pages/Quiz/PassingTests";
|
||||||
import Blog from "./pages/Blog/Blog";
|
import Blog from "./pages/Blog/Blog";
|
||||||
import Statistics from "@pages/Statistics/Statistics";
|
import Statistics from "@pages/Statistics/Statistics";
|
||||||
@ -121,7 +120,7 @@ const App = () => {
|
|||||||
<Route exact path="calendar" element={<ProfileCalendar />} />
|
<Route exact path="calendar" element={<ProfileCalendar />} />
|
||||||
<Route exact path="calendar/view/" element={<ProfileCalendar />} />
|
<Route exact path="calendar/view/" element={<ProfileCalendar />} />
|
||||||
<Route exact path="summary" element={<Summary />} />
|
<Route exact path="summary" element={<Summary />} />
|
||||||
<Route exact path="view/:date/:id" element={<ViewReport />} />
|
<Route exact path="view/:id" element={<ViewReport />} />
|
||||||
<Route exact path="tracker" element={<Tracker />} />
|
<Route exact path="tracker" element={<Tracker />} />
|
||||||
<Route exact path="statistics/:id" element={<Statistics/>}/>
|
<Route exact path="statistics/:id" element={<Statistics/>}/>
|
||||||
<Route exact path="payouts" element={<Payouts />} />
|
<Route exact path="payouts" element={<Payouts />} />
|
||||||
@ -130,10 +129,8 @@ const App = () => {
|
|||||||
<Route exact path="add-request" element={<PartnerAddRequest />} />
|
<Route exact path="add-request" element={<PartnerAddRequest />} />
|
||||||
<Route exact path="edit-request" element={<PartnerAddRequest />} />
|
<Route exact path="edit-request" element={<PartnerAddRequest />} />
|
||||||
<Route exact path="bid" element={<PartnerBid />} />
|
<Route exact path="bid" element={<PartnerBid />} />
|
||||||
<Route exact path="employees" element={<PartnerCategories />} />
|
<Route exact path="categories" element={<PartnerCategories />} />
|
||||||
<Route exact path="employees/report/:uuid" element={<PartnerEmployeeReport />} />
|
|
||||||
<Route exact path="treaties" element={<PartnerTreaties />} />
|
<Route exact path="treaties" element={<PartnerTreaties />} />
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
exact
|
exact
|
||||||
path="categories/employees"
|
path="categories/employees"
|
||||||
|
@ -53,7 +53,7 @@ export const Navigation = () => {
|
|||||||
name: "Запросы"
|
name: "Запросы"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/employees",
|
path: "/categories",
|
||||||
name: "Персонал"
|
name: "Персонал"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -15,10 +15,7 @@ export const PartnerPersonCard = ({ name, img, userId }) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="partnerPersonCard__info">
|
<div className="partnerPersonCard__info">
|
||||||
<h2 className="partnerPersonCard__name">{name}</h2>
|
<h2 className="partnerPersonCard__name">{name}</h2>
|
||||||
<Link
|
<Link className="partnerPersonCard__report" to={`calendar/${userId}`}>
|
||||||
className="partnerPersonCard__report"
|
|
||||||
to={`/profile/employees/report/${userId}`}
|
|
||||||
>
|
|
||||||
Подробный отчет
|
Подробный отчет
|
||||||
<div className="partnerPersonCard__more">
|
<div className="partnerPersonCard__more">
|
||||||
<img src={rightArrow} alt="arrow" />
|
<img src={rightArrow} alt="arrow" />
|
||||||
|
@ -32,7 +32,6 @@ import rectangle from "assets/images/rectangle__calendar.png";
|
|||||||
|
|
||||||
export const ProfileCalendarComponent = React.memo(
|
export const ProfileCalendarComponent = React.memo(
|
||||||
({
|
({
|
||||||
userId,
|
|
||||||
value,
|
value,
|
||||||
setValueHandler,
|
setValueHandler,
|
||||||
reports,
|
reports,
|
||||||
@ -95,17 +94,9 @@ export const ProfileCalendarComponent = React.memo(
|
|||||||
new Date(day).getMonth() + 1
|
new Date(day).getMonth() + 1
|
||||||
)}-${correctDay(new Date(day).getDate())}` === date.created_at
|
)}-${correctDay(new Date(day).getDate())}` === date.created_at
|
||||||
) {
|
) {
|
||||||
if (userId) {
|
return `../view/${date.created_at}`;
|
||||||
return `../view/${date.created_at}/${userId}`;
|
|
||||||
}
|
|
||||||
return `../view/${date.created_at}/${localStorage.getItem("id")}`;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userId) {
|
|
||||||
return "#";
|
|
||||||
}
|
|
||||||
|
|
||||||
return "../../report";
|
return "../../report";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,9 +114,7 @@ export const ProfileCalendarComponent = React.memo(
|
|||||||
startDate._d
|
startDate._d
|
||||||
)}`;
|
)}`;
|
||||||
apiRequest(
|
apiRequest(
|
||||||
`/reports/index?${requestDates}&user_id=${
|
`/reports/index?${requestDates}&user_id =${localStorage.getItem("id")}`
|
||||||
userId ? userId : localStorage.getItem("id")
|
|
||||||
}`
|
|
||||||
).then((reports) => {
|
).then((reports) => {
|
||||||
let spendTime = 0;
|
let spendTime = 0;
|
||||||
reports.map((report) => {
|
reports.map((report) => {
|
||||||
@ -174,7 +163,7 @@ export const ProfileCalendarComponent = React.memo(
|
|||||||
<div className="calendar-component">
|
<div className="calendar-component">
|
||||||
<div className="calendar-component__header">
|
<div className="calendar-component__header">
|
||||||
<div className="calendar-component__header-info">
|
<div className="calendar-component__header-info">
|
||||||
{!userId && <h3>Мои отчеты за </h3>}
|
<h3>Мои отчеты за </h3>
|
||||||
<p className="calendar__hours">
|
<p className="calendar__hours">
|
||||||
{month}
|
{month}
|
||||||
<span>
|
<span>
|
||||||
|
@ -1,131 +0,0 @@
|
|||||||
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 { getRequestDates, setRequestDate } from "@redux/reportSlice";
|
|
||||||
|
|
||||||
import { apiRequest } from "@api/request";
|
|
||||||
|
|
||||||
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 (
|
|
||||||
// localStorage.getItem("role_status") !== "18"
|
|
||||||
// ) {
|
|
||||||
// return <Navigate to="/profile/categories" replace />;
|
|
||||||
// }
|
|
||||||
|
|
||||||
const params = useParams();
|
|
||||||
const dispatch = useDispatch();
|
|
||||||
const [userInfo, setUserInfo] = useState({});
|
|
||||||
const [value, setValue] = useState(moment());
|
|
||||||
const [reports, setReports] = useState([]);
|
|
||||||
const [totalHours, setTotalHours] = useState(0);
|
|
||||||
const requestDates = useSelector(getRequestDates);
|
|
||||||
const [startRangeDays, setStartRangeDays] = useState(false);
|
|
||||||
const [startDate, setStartDate] = useState(null);
|
|
||||||
const [loader, setLoader] = useState(true);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
dispatch(setRequestDate(getReports(moment())));
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
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;
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}, [requestDates]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="employeeReport">
|
|
||||||
<ProfileHeader />
|
|
||||||
<Navigation />
|
|
||||||
<div className="container">
|
|
||||||
<ProfileBreadcrumbs
|
|
||||||
links={[
|
|
||||||
{ name: "Главная", link: "/profile" },
|
|
||||||
{ name: "Данные моего персонала", link: "/profile/employees" }
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
{!Object.keys(userInfo).length ? (
|
|
||||||
<div className="employeeReport__loader">
|
|
||||||
<Loader style={"green"} height={80} width={80} />
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<div className="employeeReport__info">
|
|
||||||
<div className="employeeReport__name">
|
|
||||||
<h2>{userInfo.fio}</h2>
|
|
||||||
<p>{userInfo.position}</p>
|
|
||||||
</div>
|
|
||||||
<div className="employeeReport__skills">
|
|
||||||
{userInfo?.stack &&
|
|
||||||
userInfo.stack.map((skill, index) => {
|
|
||||||
return <span key={index}>{skill}</span>;
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="employeeReport__wrapper">
|
|
||||||
{loader ? (
|
|
||||||
<div className="employeeReport__loader">
|
|
||||||
<Loader style={"green"} height={80} width={80} />
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div className="employeeReport__calendar ">
|
|
||||||
<ProfileCalendarComponent
|
|
||||||
userId={params.uuid}
|
|
||||||
setValueHandler={(value) => setValue(value)}
|
|
||||||
value={value}
|
|
||||||
reports={reports}
|
|
||||||
totalHours={totalHours}
|
|
||||||
startRangeDays={startRangeDays}
|
|
||||||
toggleRangeDays={() => setStartRangeDays(!startRangeDays)}
|
|
||||||
startDate={startDate}
|
|
||||||
setStartDateRange={(date) => setStartDate(date)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<Footer />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
@ -1,70 +0,0 @@
|
|||||||
.employeeReport {
|
|
||||||
background: #F1F1F1;
|
|
||||||
height: 100%;
|
|
||||||
min-height: 100vh;
|
|
||||||
font-family: "LabGrotesque", sans-serif;
|
|
||||||
|
|
||||||
.container {
|
|
||||||
margin-top: 23px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__info {
|
|
||||||
padding: 10px 15px;
|
|
||||||
background: white;
|
|
||||||
display: flex;
|
|
||||||
border-radius: 15px;
|
|
||||||
column-gap: 15px;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__name {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
row-gap: 10px;
|
|
||||||
width: 100%;
|
|
||||||
h2 {
|
|
||||||
font-size: 20px;
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
font-size: 15px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&__skills {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 7px;
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
span {
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 14px;
|
|
||||||
color: #263238;
|
|
||||||
background: #8DC63F;
|
|
||||||
border-radius: 12px;
|
|
||||||
padding: 5px;
|
|
||||||
max-width: 130px;
|
|
||||||
height: 24px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 0 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&__calendar {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__wrapper {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
min-height: 620px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__loader {
|
|
||||||
margin: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,7 +7,6 @@ import { apiRequest } from "@api/request";
|
|||||||
|
|
||||||
// import { setPartnerEmployees } from "@redux/outstaffingSlice";
|
// import { setPartnerEmployees } from "@redux/outstaffingSlice";
|
||||||
import { Footer } from "@components/Common/Footer/Footer";
|
import { Footer } from "@components/Common/Footer/Footer";
|
||||||
import { Loader } from "@components/Common/Loader/Loader";
|
|
||||||
import { Navigation } from "@components/Navigation/Navigation";
|
import { Navigation } from "@components/Navigation/Navigation";
|
||||||
import PartnerPersonCard from "@components/PartnerPersonCard/PartnerPersonCard";
|
import PartnerPersonCard from "@components/PartnerPersonCard/PartnerPersonCard";
|
||||||
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
|
import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs";
|
||||||
@ -33,12 +32,9 @@ export const PartnerCategories = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const [staff, setStaff] = useState([]);
|
const [staff, setStaff] = useState([]);
|
||||||
const [loader, setLoader] = useState(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLoader(true);
|
|
||||||
apiRequest("/project/my-employee").then((el) => {
|
apiRequest("/project/my-employee").then((el) => {
|
||||||
setLoader(false);
|
|
||||||
setStaff(el.managerEmployees);
|
setStaff(el.managerEmployees);
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
@ -153,59 +149,55 @@ export const PartnerCategories = () => {
|
|||||||
<ProfileBreadcrumbs
|
<ProfileBreadcrumbs
|
||||||
links={[
|
links={[
|
||||||
{ name: "Главная", link: "/profile" },
|
{ name: "Главная", link: "/profile" },
|
||||||
{ name: "Данные моего персонала", link: "/profile/employees" }
|
{ name: "Данные моего персонала", link: "/profile/categories" }
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<h2 className="partnerCategories__title">Данные персонала</h2>
|
<h2 className="partnerCategories__title">Данные персонала</h2>
|
||||||
{loader ? (
|
<div className="partnerCategories__items">
|
||||||
<Loader style={"green"} height={80} width={80} />
|
{staff.map((card) => {
|
||||||
) : (
|
return (
|
||||||
<div className="partnerCategories__items">
|
<PartnerPersonCard
|
||||||
{staff.map((card) => {
|
key={card.id}
|
||||||
return (
|
name={card.employee.fio}
|
||||||
<PartnerPersonCard
|
img={card.employee.avatar}
|
||||||
key={card.id}
|
userId={card.user_id}
|
||||||
name={card.employee.fio}
|
/>
|
||||||
img={card.employee.avatar}
|
);
|
||||||
userId={card.user_id}
|
})}
|
||||||
/>
|
{/*{personalInfoItems.map((item, index) => {*/}
|
||||||
);
|
{/* return (*/}
|
||||||
})}
|
{/* <Link*/}
|
||||||
{/*{personalInfoItems.map((item, index) => {*/}
|
{/* to={item.link}*/}
|
||||||
{/* return (*/}
|
{/* key={index}*/}
|
||||||
{/* <Link*/}
|
{/* className={*/}
|
||||||
{/* to={item.link}*/}
|
{/* item.available*/}
|
||||||
{/* key={index}*/}
|
{/* ? "partnerCategories__item item"*/}
|
||||||
{/* className={*/}
|
{/* : "partnerCategories__item item item__disable"*/}
|
||||||
{/* item.available*/}
|
{/* }*/}
|
||||||
{/* ? "partnerCategories__item item"*/}
|
{/* onClick={() => {*/}
|
||||||
{/* : "partnerCategories__item item item__disable"*/}
|
{/* dispatch(setPartnerEmployees(mokPersons));*/}
|
||||||
{/* }*/}
|
{/* }}*/}
|
||||||
{/* onClick={() => {*/}
|
{/* >*/}
|
||||||
{/* dispatch(setPartnerEmployees(mokPersons));*/}
|
{/* <div className="item__title">*/}
|
||||||
{/* }}*/}
|
{/* <img src={item.img} alt={item.title} />*/}
|
||||||
{/* >*/}
|
{/* <h4>{item.title}</h4>*/}
|
||||||
{/* <div className="item__title">*/}
|
{/* </div>*/}
|
||||||
{/* <img src={item.img} alt={item.title} />*/}
|
{/* <div className="item__info">*/}
|
||||||
{/* <h4>{item.title}</h4>*/}
|
{/* <p>{item.description}</p>*/}
|
||||||
{/* </div>*/}
|
{/* <div className="more">*/}
|
||||||
{/* <div className="item__info">*/}
|
{/* <img src={rightArrow} alt="arrow" />*/}
|
||||||
{/* <p>{item.description}</p>*/}
|
{/* </div>*/}
|
||||||
{/* <div className="more">*/}
|
{/* </div>*/}
|
||||||
{/* <img src={rightArrow} alt="arrow" />*/}
|
{/* {!item.available && (*/}
|
||||||
{/* </div>*/}
|
{/* <div className="item__disableHover">*/}
|
||||||
{/* </div>*/}
|
{/* <p>У вас нет персонала из категории</p>*/}
|
||||||
{/* {!item.available && (*/}
|
{/* <button>Подобрать</button>*/}
|
||||||
{/* <div className="item__disableHover">*/}
|
{/* </div>*/}
|
||||||
{/* <p>У вас нет персонала из категории</p>*/}
|
{/* )}*/}
|
||||||
{/* <button>Подобрать</button>*/}
|
{/* </Link>*/}
|
||||||
{/* </div>*/}
|
{/* );*/}
|
||||||
{/* )}*/}
|
{/*})}*/}
|
||||||
{/* </Link>*/}
|
</div>
|
||||||
{/* );*/}
|
|
||||||
{/*})}*/}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<Footer />
|
<Footer />
|
||||||
</div>
|
</div>
|
||||||
|
@ -973,7 +973,7 @@ export const ProjectTracker = () => {
|
|||||||
<div className="tasks__board__item__info__more">
|
<div className="tasks__board__item__info__more">
|
||||||
<img src={filesBoard} alt="filesImg" />
|
<img src={filesBoard} alt="filesImg" />
|
||||||
<span>
|
<span>
|
||||||
{task.file_count ? task.file_count : 0}{" "}
|
{task.files ? task.files : 0}{" "}
|
||||||
{/* {caseOfNum(0, "files")} */}
|
{/* {caseOfNum(0, "files")} */}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,9 +20,13 @@ import arrow from "assets/icons/arrows/left-arrow.png";
|
|||||||
import "./viewReport.scss";
|
import "./viewReport.scss";
|
||||||
|
|
||||||
export const ViewReport = () => {
|
export const ViewReport = () => {
|
||||||
const params = useParams();
|
if (localStorage.getItem("role_status") === "18") {
|
||||||
const [previousReportDay] = useState(new Date(params.date));
|
return <Navigate to="/profile" replace />;
|
||||||
const [nextReportDay] = useState(new Date(params.date));
|
}
|
||||||
|
|
||||||
|
const dateReport = useParams();
|
||||||
|
const [previousReportDay] = useState(new Date(dateReport.id));
|
||||||
|
const [nextReportDay] = useState(new Date(dateReport.id));
|
||||||
|
|
||||||
const [taskText, setTaskText] = useState([]);
|
const [taskText, setTaskText] = useState([]);
|
||||||
const [difficulties, setDifficulties] = useState([]);
|
const [difficulties, setDifficulties] = useState([]);
|
||||||
@ -36,31 +40,31 @@ export const ViewReport = () => {
|
|||||||
setTaskText([]);
|
setTaskText([]);
|
||||||
setDifficulties([]);
|
setDifficulties([]);
|
||||||
setTomorrowTask([]);
|
setTomorrowTask([]);
|
||||||
apiRequest(`reports/find-by-date?user_id=${params.id}&date=${day}`).then(
|
apiRequest(
|
||||||
(res) => {
|
`reports/find-by-date?user_id=${localStorage.getItem("id")}&date=${day}`
|
||||||
let spendTime = 0;
|
).then((res) => {
|
||||||
for (const item of res) {
|
let spendTime = 0;
|
||||||
if (item.difficulties) {
|
for (const item of res) {
|
||||||
setDifficulties((prevArray) => [...prevArray, item.difficulties]);
|
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]);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
setTotalHours(Math.floor(spendTime));
|
if (item.tomorrow) {
|
||||||
setLoader(false);
|
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]);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
setTotalHours(Math.floor(spendTime));
|
||||||
|
setLoader(false);
|
||||||
|
});
|
||||||
previousReportDay.setDate(previousReportDay.getDate() - 1);
|
previousReportDay.setDate(previousReportDay.getDate() - 1);
|
||||||
nextReportDay.setDate(nextReportDay.getDate() + 1);
|
nextReportDay.setDate(nextReportDay.getDate() + 1);
|
||||||
}
|
}
|
||||||
@ -76,7 +80,7 @@ export const ViewReport = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getReportFromDate(params.date);
|
getReportFromDate(dateReport.id);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -85,28 +89,17 @@ export const ViewReport = () => {
|
|||||||
<Navigation />
|
<Navigation />
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<div className="viewReport__info">
|
<div className="viewReport__info">
|
||||||
{localStorage.getItem("role_status") !== "18" && (
|
<ProfileBreadcrumbs
|
||||||
<>
|
links={[
|
||||||
<ProfileBreadcrumbs
|
{ name: "Главная", link: "/profile" },
|
||||||
links={[
|
{ name: "Ваша отчетность", link: "/profile/calendar" },
|
||||||
{ name: "Главная", link: "/profile" },
|
{ name: "Просмотр отчета за день", link: "/profile/view" }
|
||||||
{ name: "Ваша отчетность", link: "/profile/calendar" },
|
]}
|
||||||
{ name: "Просмотр отчета за день", link: "/profile/view" }
|
/>
|
||||||
]}
|
<h2 className="viewReport__title">
|
||||||
/>
|
Ваши отчеты - <span>просмотр отчета за день</span>
|
||||||
<h2 className="viewReport__title">
|
</h2>
|
||||||
Ваши отчеты - <span>просмотр отчета за день</span>
|
<Link className="viewReport__back" to={`/profile/calendar`}>
|
||||||
</h2>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<Link
|
|
||||||
className="viewReport__back"
|
|
||||||
to={
|
|
||||||
localStorage.getItem("role_status") === "18"
|
|
||||||
? `/profile/employees/report/${params.id}`
|
|
||||||
: `/profile/calendar`
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<img src={arrow} alt="#" />
|
<img src={arrow} alt="#" />
|
||||||
<p>Вернуться</p>
|
<p>Вернуться</p>
|
||||||
</Link>
|
</Link>
|
||||||
@ -124,24 +117,22 @@ export const ViewReport = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="viewReport__switch-date">
|
<div className="viewReport__switch-date">
|
||||||
<div onClick={() => previousDay()}>
|
<div onClick={() => previousDay()}>
|
||||||
<Link
|
<Link to={`../view/${getCreatedDate(previousReportDay)}`}>
|
||||||
to={`../view/${getCreatedDate(previousReportDay)}/${params.id}`}
|
|
||||||
>
|
|
||||||
<div className="viewReport__switch-date__prev switch-date">
|
<div className="viewReport__switch-date__prev switch-date">
|
||||||
<img src={arrowSwitchDate} alt="arrow" />
|
<img src={arrowSwitchDate} alt="arrow" />
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>{getCorrectDate(params.date)}</p>
|
<p>{getCorrectDate(dateReport.id)}</p>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
onClick={() => nextDay()}
|
onClick={() => nextDay()}
|
||||||
className={`${
|
className={`${
|
||||||
getCreatedDate(currentDay) === params.date ? "disable" : ""
|
getCreatedDate(currentDay) === dateReport.id ? "disable" : ""
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<Link to={`../view/${getCreatedDate(nextReportDay)}/${params.id}`}>
|
<Link to={`../view/${getCreatedDate(nextReportDay)}`}>
|
||||||
<div className={`viewReport__switch-date__next switch-date`}>
|
<div className={`viewReport__switch-date__next switch-date`}>
|
||||||
<img src={arrowSwitchDate} alt="arrow" />
|
<img src={arrowSwitchDate} alt="arrow" />
|
||||||
</div>
|
</div>
|
||||||
@ -215,13 +206,9 @@ export const ViewReport = () => {
|
|||||||
)}
|
)}
|
||||||
{!Boolean(taskText.length) && !loader && (
|
{!Boolean(taskText.length) && !loader && (
|
||||||
<div className="viewReport__noTask">
|
<div className="viewReport__noTask">
|
||||||
{localStorage.getItem("role_status") === "4" ? (
|
<p>
|
||||||
<p>
|
В этот день вы <span>не заполняли</span> отчет
|
||||||
В этот день вы <span>не заполняли</span> отчет
|
</p>
|
||||||
</p>
|
|
||||||
) : (
|
|
||||||
<p>Отчет за день не заполнен</p>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<Footer />
|
<Footer />
|
||||||
|
Loading…
Reference in New Issue
Block a user