Compare commits

..

3 Commits

Author SHA1 Message Date
Victor Batischev
dea1eb6104 resolve 2024-04-22 17:03:14 +03:00
Victor Batischev
ee20b49993 fix total hours 2024-04-22 17:01:37 +03:00
Victor Batischev
0e04e19c1b total day hours 2024-04-22 17:00:37 +03:00

View File

@ -14,7 +14,6 @@ import {
import { import {
calendarHelper, calendarHelper,
correctDay, correctDay,
currentMonthAndDay,
getCorrectDate, getCorrectDate,
getReports, getReports,
hourOfNum hourOfNum
@ -29,7 +28,6 @@ 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(
@ -175,26 +173,13 @@ export const ProfileCalendarComponent = React.memo(
}); });
} }
// function dddd(day) { const countHours = (day) => {
// let index = day.format("D") - l; let hours =
// console.log(`d ${day.format("d")}`); reports
// if (day.format("d") != 0 && day.format("d") != 6) { .find((item) => moment(item.created_at).isSame(day, "date"))
// let elementAtIndex1 = reports[index]; ?.task.reduce((acc, task) => acc + task.hours_spent, 0) || 0;
// if (elementAtIndex1 && elementAtIndex1.task) { return `${hours} ${hourOfNum(hours)}`;
// 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">
@ -284,10 +269,9 @@ 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>7/</span> <span>{countHours(day)}</span>
</div> </div>
</div> </div>
{/* {currentMonthAndDay(day)} */}
</Link> </Link>
</button> </button>
)) ))
@ -308,16 +292,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