Compare commits
No commits in common. "dea1eb610437277ead71c5122c43138d58845e03" and "bd4bfacd6615e9dfcb145ef3e28e2f819d543ae0" have entirely different histories.
dea1eb6104
...
bd4bfacd66
@ -14,6 +14,7 @@ import {
|
||||
import {
|
||||
calendarHelper,
|
||||
correctDay,
|
||||
currentMonthAndDay,
|
||||
getCorrectDate,
|
||||
getReports,
|
||||
hourOfNum
|
||||
@ -28,6 +29,7 @@ import BaseButton from "@components/Common/BaseButton/BaseButton";
|
||||
import arrowLeft from "assets/icons/arrows/arrowCalendar_left.png";
|
||||
import arrowRight from "assets/icons/arrows/arrowCalendar_right.png";
|
||||
import calendarIcon from "assets/icons/calendar.svg";
|
||||
// import close from "assets/icons/closeProjectPersons.svg";
|
||||
import rectangle from "assets/images/rectangle__calendar.png";
|
||||
|
||||
export const ProfileCalendarComponent = React.memo(
|
||||
@ -173,13 +175,26 @@ export const ProfileCalendarComponent = React.memo(
|
||||
});
|
||||
}
|
||||
|
||||
const countHours = (day) => {
|
||||
let hours =
|
||||
reports
|
||||
.find((item) => moment(item.created_at).isSame(day, "date"))
|
||||
?.task.reduce((acc, task) => acc + task.hours_spent, 0) || 0;
|
||||
return `${hours} ${hourOfNum(hours)}`;
|
||||
};
|
||||
// function dddd(day) {
|
||||
// let index = day.format("D") - l;
|
||||
// console.log(`d ${day.format("d")}`);
|
||||
// if (day.format("d") != 0 && day.format("d") != 6) {
|
||||
// let elementAtIndex1 = reports[index];
|
||||
// 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 (
|
||||
<div className="calendar-component">
|
||||
@ -269,9 +284,10 @@ export const ProfileCalendarComponent = React.memo(
|
||||
<div className="form-date">{day.format("D")}</div>
|
||||
<div className="form-box">
|
||||
<div className="form-hours">
|
||||
<span>{countHours(day)}</span>
|
||||
<span>7/</span>
|
||||
</div>
|
||||
</div>
|
||||
{/* {currentMonthAndDay(day)} */}
|
||||
</Link>
|
||||
</button>
|
||||
))
|
||||
@ -292,16 +308,16 @@ export const ProfileCalendarComponent = React.memo(
|
||||
? `${getCorrectDate(startDate)} - ${getCorrectDate(endDate)}`
|
||||
: `${getCorrectDate(endDate)} - ${getCorrectDate(startDate)}`
|
||||
: activePeriod
|
||||
? "Выберите диапазон на календаре"
|
||||
: "Выбрать диапазон"}
|
||||
? "Выберите диапазон на календаре"
|
||||
: "Выбрать диапазон"}
|
||||
</span>
|
||||
|
||||
<span>
|
||||
{totalRangeHours
|
||||
? `${totalRangeHours} ${hourOfNum(totalRangeHours)}`
|
||||
: endDate
|
||||
? "0 часов"
|
||||
: ""}
|
||||
? "0 часов"
|
||||
: ""}
|
||||
</span>
|
||||
{endDate && (
|
||||
<BaseButton
|
||||
|
Loading…
Reference in New Issue
Block a user