trackerTask #12

Merged
nik.polishuk merged 4 commits from trackerTask into main 2024-02-01 23:15:29 +03:00
5 changed files with 24 additions and 26 deletions
Showing only changes of commit 0acbef4195 - Show all commits

View File

@ -51,9 +51,7 @@ export const ProfileCalendar = () => {
return; return;
} }
apiRequest( apiRequest(
`/reports/index?${requestDates}&user_id =${localStorage.getItem( `/reports/index?${requestDates}&user_id =${localStorage.getItem("id")}`
"id"
)}`
).then((reports) => { ).then((reports) => {
let spendTime = 0; let spendTime = 0;

View File

@ -114,9 +114,7 @@ export const ProfileCalendarComponent = React.memo(
startDate._d startDate._d
)}`; )}`;
apiRequest( apiRequest(
`/reports/index?${requestDates}&user_id =${localStorage.getItem( `/reports/index?${requestDates}&user_id =${localStorage.getItem("id")}`
"id"
)}`
).then((reports) => { ).then((reports) => {
let spendTime = 0; let spendTime = 0;
reports.map((report) => { reports.map((report) => {
@ -273,15 +271,15 @@ export const ProfileCalendarComponent = React.memo(
? `${getCorrectDate(startDate)} - ${getCorrectDate(endDate)}` ? `${getCorrectDate(startDate)} - ${getCorrectDate(endDate)}`
: `${getCorrectDate(endDate)} - ${getCorrectDate(startDate)}` : `${getCorrectDate(endDate)} - ${getCorrectDate(startDate)}`
: activePeriod : activePeriod
? "Выберите диапазон на календаре" ? "Выберите диапазон на календаре"
: "Выбрать диапазон"} : "Выбрать диапазон"}
</span> </span>
<span> <span>
{totalRangeHours {totalRangeHours
? `${totalRangeHours} ${hourOfNum(totalRangeHours)}` ? `${totalRangeHours} ${hourOfNum(totalRangeHours)}`
: endDate : endDate
? "0 часов" ? "0 часов"
: ""} : ""}
</span> </span>
{endDate && ( {endDate && (
<BaseButton <BaseButton

View File

@ -39,9 +39,7 @@ export const ShortReport = () => {
setTomorrowTask([]); setTomorrowTask([]);
setTotalHours(0); setTotalHours(0);
apiRequest( apiRequest(
`reports/find-by-date?user_id=${localStorage.getItem( `reports/find-by-date?user_id=${localStorage.getItem("id")}&date=${day}`
"id"
)}&date=${day}`
).then((res) => { ).then((res) => {
let spendTime = 0; let spendTime = 0;
for (const item of res) { for (const item of res) {

View File

@ -2,15 +2,15 @@ import React, { useEffect, useState } from "react";
// import { useDispatch } from "react-redux"; // import { useDispatch } from "react-redux";
// import { Link } from "react-router-dom"; // import { Link } from "react-router-dom";
import { Navigate } from "react-router-dom"; import { Navigate } from "react-router-dom";
// import { setPartnerEmployees } from "@redux/outstaffingSlice";
import { apiRequest } from "@api/request";
// import { setPartnerEmployees } from "@redux/outstaffingSlice";
import { Footer } from "@components/Common/Footer/Footer"; import { Footer } from "@components/Common/Footer/Footer";
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";
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader"; import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
import { Navigation } from "@components/Navigation/Navigation";
import { apiRequest } from "@api/request";
// import rightArrow from "assets/icons/arrows/arrowRight.svg"; // import rightArrow from "assets/icons/arrows/arrowRight.svg";
// import avatarImg from "assets/images/avatarMok.png"; // import avatarImg from "assets/images/avatarMok.png";
@ -23,7 +23,6 @@ import { apiRequest } from "@api/request";
// import SmmImg from "assets/images/partnerProfile/PersonalSMM.svg"; // import SmmImg from "assets/images/partnerProfile/PersonalSMM.svg";
// import TestImg from "assets/images/partnerProfile/PersonalTesters.svg"; // import TestImg from "assets/images/partnerProfile/PersonalTesters.svg";
// import BackEndImg from "assets/images/partnerProfile/personalBackEnd.svg"; // import BackEndImg from "assets/images/partnerProfile/personalBackEnd.svg";
import "./partnerСategories.scss"; import "./partnerСategories.scss";
export const PartnerCategories = () => { export const PartnerCategories = () => {
@ -32,13 +31,13 @@ export const PartnerCategories = () => {
return <Navigate to="/profile" replace />; return <Navigate to="/profile" replace />;
} }
const [staff, setStaff] = useState([]) const [staff, setStaff] = useState([]);
useEffect(() => { useEffect(() => {
apiRequest("/project/my-employee").then((el) => { apiRequest("/project/my-employee").then((el) => {
setStaff(el.managerEmployees) setStaff(el.managerEmployees);
}) });
}, []) }, []);
// const [personalInfoItems] = useState([ // const [personalInfoItems] = useState([
// { // {
@ -156,7 +155,14 @@ export const PartnerCategories = () => {
<h2 className="partnerCategories__title">Данные персонала</h2> <h2 className="partnerCategories__title">Данные персонала</h2>
<div className="partnerCategories__items"> <div className="partnerCategories__items">
{staff.map((card) => { {staff.map((card) => {
return <PartnerPersonCard key={card.id} name={card.employee.fio} img={card.employee.avatar} userId={card.user_id} /> return (
<PartnerPersonCard
key={card.id}
name={card.employee.fio}
img={card.employee.avatar}
userId={card.user_id}
/>
);
})} })}
{/*{personalInfoItems.map((item, index) => {*/} {/*{personalInfoItems.map((item, index) => {*/}
{/* return (*/} {/* return (*/}

View File

@ -41,9 +41,7 @@ export const ViewReport = () => {
setDifficulties([]); setDifficulties([]);
setTomorrowTask([]); setTomorrowTask([]);
apiRequest( apiRequest(
`reports/find-by-date?user_id=${localStorage.getItem( `reports/find-by-date?user_id=${localStorage.getItem("id")}&date=${day}`
"id"
)}&date=${day}`
).then((res) => { ).then((res) => {
let spendTime = 0; let spendTime = 0;
for (const item of res) { for (const item of res) {