total day hours
This commit is contained in:
parent
1bdabd32bf
commit
0e04e19c1b
@ -14,7 +14,6 @@ import {
|
||||
import {
|
||||
calendarHelper,
|
||||
correctDay,
|
||||
currentMonthAndDay,
|
||||
getCorrectDate,
|
||||
getReports,
|
||||
hourOfNum
|
||||
@ -29,7 +28,6 @@ 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(
|
||||
@ -174,9 +172,14 @@ export const ProfileCalendarComponent = React.memo(
|
||||
});
|
||||
}
|
||||
|
||||
// function errorr(TotalRangeHours) {
|
||||
// console.error(TotalRangeHours);
|
||||
// }
|
||||
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)}`;
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="calendar-component">
|
||||
<div className="calendar-component__header">
|
||||
@ -265,10 +268,9 @@ export const ProfileCalendarComponent = React.memo(
|
||||
<div className="form-date">{day.format("D")}</div>
|
||||
<div className="form-box">
|
||||
<div className="form-hours">
|
||||
<span>7/Час</span>
|
||||
<span>{countHours(day)}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/* {currentMonthAndDay(day)} */}
|
||||
</Link>
|
||||
</button>
|
||||
))
|
||||
|
Loading…
Reference in New Issue
Block a user