-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2562 from ever-co/stage
Release
- Loading branch information
Showing
23 changed files
with
295 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,40 @@ | ||
import { UserInfo } from 'lib/features/team/user-team-card/user-info'; | ||
import { useTeamMemberCard } from '@app/hooks'; | ||
import { useModal } from '@app/hooks'; | ||
import { FaCheck } from "react-icons/fa6"; | ||
import { useEffect } from 'react'; | ||
import { IEmployee } from '@app/interfaces'; | ||
|
||
export default function TeamMember({ member, item }: { member: any; item: any }) { | ||
export default function TeamMember( | ||
{ member, item, onCheckMember, membersList, validate } | ||
: | ||
{ member: any; item: any; onCheckMember: any; membersList: any; validate: any } | ||
) { | ||
const memberInfo = useTeamMemberCard(member); | ||
const { assignTask } = useTeamMemberCard(member); | ||
const { closeModal } = useModal(); | ||
const checkAssign = membersList.assignedMembers.some((el:IEmployee) => el.id === member.employeeId); | ||
const checkUnassign = membersList.unassignedMembers.some((el:IEmployee) => el.id === member.employeeId); | ||
|
||
return ( | ||
<div | ||
onClick={() => { | ||
useEffect(() => { | ||
if (validate) { | ||
if (checkAssign) { | ||
assignTask(item); | ||
closeModal(); | ||
}} | ||
} else if (checkUnassign) { | ||
memberInfo.unassignTask(item); | ||
} | ||
} | ||
}, [validate, checkAssign, checkUnassign, item, assignTask, memberInfo]); | ||
|
||
const assignMember = () => { | ||
onCheckMember(member.employee); | ||
} | ||
|
||
className="w-100 cursor-pointer" | ||
return ( | ||
<div | ||
onClick={() => { assignMember() }} | ||
className="w-100 cursor-pointer flex items-center" | ||
> | ||
<UserInfo memberInfo={memberInfo} className="2xl:w-[20.625rem] w-100 pointer-events-none" /> | ||
{checkAssign ? (<FaCheck size={17} fill="#3826a6" />) : (<></>)} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.