From 1db74db26f9745a0c4901f3cb94adf10022a89d6 Mon Sep 17 00:00:00 2001 From: Peterson Rodrigues dos Santos Date: Sat, 9 Mar 2024 21:02:37 -0300 Subject: [PATCH 01/33] Peterson_impl_feature_Finish_My_Team_filter_or_Tasks_Tab --- .../TeamMemberTasks/MyTeamMember.jsx | 144 ++++++++++ .../TeamMemberTasks/TeamMemberTasks.jsx | 250 ++++++++++++++---- 2 files changed, 336 insertions(+), 58 deletions(-) create mode 100644 src/components/TeamMemberTasks/MyTeamMember.jsx diff --git a/src/components/TeamMemberTasks/MyTeamMember.jsx b/src/components/TeamMemberTasks/MyTeamMember.jsx new file mode 100644 index 0000000000..d250f5f63c --- /dev/null +++ b/src/components/TeamMemberTasks/MyTeamMember.jsx @@ -0,0 +1,144 @@ +import React, { useState, useMemo, useRef } from 'react'; +import { Link } from 'react-router-dom'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { + faBell, + faCircle, + faCheck, + faTimes, + faExpandArrowsAlt, + faCompressArrowsAlt, +} from '@fortawesome/free-solid-svg-icons'; +import { Table, Progress, Modal, ModalHeader, ModalBody } from 'reactstrap'; + +//! ============================================================================================ +//! IMPORTAÇÕES DO OUTRO CÓDIGO +import CopyToClipboard from 'components/common/Clipboard/CopyToClipboard'; + +import hasPermission from 'utils/permissions'; +import './style.css'; +import { boxStyle } from 'styles'; + +import Warning from 'components/Warnings/Warnings'; +import { useDispatch, useSelector } from 'react-redux'; +import moment from 'moment-timezone'; + +import ReviewButton from './ReviewButton'; +import { getProgressColor, getProgressValue } from '../../utils/effortColors'; +import TeamMemberTaskIconsInfo from './TeamMemberTaskIconsInfo'; +import { showTimeOffRequestModal } from '../../actions/timeOffRequestAction'; +import GoogleDocIcon from '../../components/common/GoogleDocIcon' + +//! ============================================================================================ + +export const MyTeamMember = ( + {user, + usersWithTasks, + handleOpenTaskNotificationModal, + handleMarkAsDoneModal, + handleRemoveFromTaskModal, + handleTaskModalOption, + showWhoHasTimeOff, + onTimeOff, + goingOnTimeOff +} + ) => { + + const thisWeekHours = user.totalTangibleHrs; + + const totalHoursRemaining = usersWithTasks.reduce((total, task) => { + task.hoursLogged = task.hoursLogged || 0; + task.estimatedHours = task.estimatedHours || 0; + if (task.status !== 'Complete' && task.isAssigned !== 'false') { + return total + Math.max(0, task.estimatedHours - task.hoursLogged); + } + return total; + }, 0); + + const activeTasks = usersWithTasks.filter( + task => + !task.resources?.some( + resource => resource.userID === user.personId && resource.completedTask, + ), + ); + + console.log('activeTasks', activeTasks); + + const test = usersWithTasks.filter(item => { + !item.tasks.resources?.some( + resource => resource.userID === user.personId && resource.completedTask, + ), + console.log('item.task', item.tasks); + }); + + console.log('test', test) + + const canTruncate = activeTasks.length > NUM_TASKS_SHOW_TRUNCATE; + const [isTruncated, setIsTruncated] = useState(canTruncate); + + + const NUM_TASKS_SHOW_TRUNCATE = 6; + + console.log('canTruncate', canTruncate) + + const numTasksToShow = isTruncated ? NUM_TASKS_SHOW_TRUNCATE : activeTasks.length; + + console.log('numTasksToShow', numTasksToShow) + + + + return ( + <> + + +
+ +
+ + = user.weeklycommittedHours ? 'green' : 'red', + }} + icon={faCircle} + data-testid="icon" + /> +
+ + +