Compare commits

..

No commits in common. "dea1eb610437277ead71c5122c43138d58845e03" and "bd4bfacd6615e9dfcb145ef3e28e2f819d543ae0" have entirely different histories.

View File

@ -14,6 +14,7 @@ import {
import { import {
calendarHelper, calendarHelper,
correctDay, correctDay,
currentMonthAndDay,
getCorrectDate, getCorrectDate,
getReports, getReports,
hourOfNum hourOfNum
@ -28,6 +29,7 @@ import BaseButton from "@components/Common/BaseButton/BaseButton";
import arrowLeft from "assets/icons/arrows/arrowCalendar_left.png"; import arrowLeft from "assets/icons/arrows/arrowCalendar_left.png";
import arrowRight from "assets/icons/arrows/arrowCalendar_right.png"; import arrowRight from "assets/icons/arrows/arrowCalendar_right.png";
import calendarIcon from "assets/icons/calendar.svg"; import calendarIcon from "assets/icons/calendar.svg";
// import close from "assets/icons/closeProjectPersons.svg";
import rectangle from "assets/images/rectangle__calendar.png"; import rectangle from "assets/images/rectangle__calendar.png";
export const ProfileCalendarComponent = React.memo( export const ProfileCalendarComponent = React.memo(
@ -173,13 +175,26 @@ export const ProfileCalendarComponent = React.memo(
}); });
} }
const countHours = (day) => { // function dddd(day) {
let hours = // let index = day.format("D") - l;
reports // console.log(`d ${day.format("d")}`);
.find((item) => moment(item.created_at).isSame(day, "date")) // if (day.format("d") != 0 && day.format("d") != 6) {
?.task.reduce((acc, task) => acc + task.hours_spent, 0) || 0; // let elementAtIndex1 = reports[index];
return `${hours} ${hourOfNum(hours)}`; // if (elementAtIndex1 && elementAtIndex1.task) {
}; // let totalHoursSpent = elementAtIndex1.task.reduce(
// (total, task) => total + task.hours_spent,
// 0
// );
// console.log(`index ${index}`);
// console.log(elementAtIndex1);
// console.log(`h ${totalHoursSpent}`);
// return totalHoursSpent;
// }
// } else {
// setL(l + 1);
// console.log(`l ${l}`);
// }
// }
return ( return (
<div className="calendar-component"> <div className="calendar-component">
@ -269,9 +284,10 @@ export const ProfileCalendarComponent = React.memo(
<div className="form-date">{day.format("D")}</div> <div className="form-date">{day.format("D")}</div>
<div className="form-box"> <div className="form-box">
<div className="form-hours"> <div className="form-hours">
<span>{countHours(day)}</span> <span>7/</span>
</div> </div>
</div> </div>
{/* {currentMonthAndDay(day)} */}
</Link> </Link>
</button> </button>
)) ))
@ -292,16 +308,16 @@ 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