total day hours

This commit is contained in:
Victor Batischev 2024-04-22 17:00:37 +03:00
parent 1bdabd32bf
commit 0e04e19c1b

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(
@ -174,9 +172,14 @@ export const ProfileCalendarComponent = React.memo(
}); });
} }
// function errorr(TotalRangeHours) { const countHours = (day) => {
// console.error(TotalRangeHours); 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 ( return (
<div className="calendar-component"> <div className="calendar-component">
<div className="calendar-component__header"> <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-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>
)) ))