From 01b43ecc1341cabff9612a38945ff5da133d5e5f Mon Sep 17 00:00:00 2001 From: "kartik.sharma" Date: Sat, 17 May 2025 13:14:17 +0530 Subject: [PATCH] modified assign task popup from daily task planning. 1. adjusting margin and padding. 2. All the fonts are same. 3. Bold the 1 number and adding line into the unit. --- src/components/Project/AssignRole.jsx | 179 +++++++++++++++++++------- 1 file changed, 135 insertions(+), 44 deletions(-) diff --git a/src/components/Project/AssignRole.jsx b/src/components/Project/AssignRole.jsx index 8212cdf4..b502829f 100644 --- a/src/components/Project/AssignRole.jsx +++ b/src/components/Project/AssignRole.jsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, useRef } from "react"; import { useDispatch, useSelector } from "react-redux"; import { changeMaster } from "../../slices/localVariablesSlice"; import useMaster from "../../hooks/masterHook/useMaster"; @@ -35,6 +35,48 @@ const AssignRoleModel = ({ assignData, onClose }) => { }) ), }); + + const [isHelpVisibleTarget, setIsHelpVisibleTarget] = useState(false); + const helpPopupRefTarget = useRef(null); + + const [isHelpVisible, setIsHelpVisible] = useState(false); + + const handleHelpClickTarget = () => { + setIsHelpVisibleTarget(!isHelpVisibleTarget); + }; + + const [isHelpVisiblePending, setIsHelpVisiblePending] = useState(false); + const helpPopupRefPending = useRef(null); + + const handleHelpClickPending = () => { + setIsHelpVisiblePending(!isHelpVisiblePending); + }; + + const handleClickOutside = (event) => { + if ( + helpPopupRefTarget.current && + !helpPopupRefTarget.current.contains(event.target) && + isHelpVisibleTarget + ) { + setIsHelpVisibleTarget(false); + } + if ( + helpPopupRefPending.current && + !helpPopupRefPending.current.contains(event.target) && + isHelpVisiblePending + ) { + setIsHelpVisiblePending(false); + } + }; + + useEffect(() => { + document.addEventListener("mousedown", handleClickOutside); + return () => { + document.removeEventListener("mousedown", handleClickOutside); + }; + }, [isHelpVisibleTarget, isHelpVisiblePending]); + + const [plannedTask, setPlannedTask] = useState(); const selectedProject = useSelector( (store) => store.localVariables.projectId @@ -156,12 +198,12 @@ const AssignRoleModel = ({ assignData, onClose }) => { aria-label="Close" >
- Assign Task -
+

Assign Task

+

- - Work Location: + +

Work Location :

{[ assignData?.building?.name, assignData?.floor?.floorName, @@ -186,16 +228,15 @@ const AssignRoleModel = ({ assignData, onClose }) => {
- -
- Select Team +
+ Select Team
{displayedSelection}
    @@ -275,7 +316,7 @@ const AssignRoleModel = ({ assignData, onClose }) => {

    {emp.firstName} {emp.lastName}

    - + {loading ? ( @@ -347,42 +388,70 @@ const AssignRoleModel = ({ assignData, onClose }) => {
    -
    -
    + {isHelpVisiblePending && ( +
    +

    + Pending Task +

    +
    + )} + +
-
- +
(
{ className="form-control form-control-sm" {...field} id="defaultFormControlInput" - aria-describedby="defaultFormControlHelp" + aria-describedby="defaultFormControlHelp" /> - { - assignData?.workItem?.workItem?.activityMaster - ?.unitOfMeasurement - } + + {assignData?.workItem?.workItem?.activityMaster?.unitOfMeasurement} + + + + + + +
)} />
{errors.plannedTask && ( -
- {errors.plannedTask.message} +
{errors.plannedTask.message}
+ )} + + {isHelpVisible && ( +
+ {/* Add your help content here */} +

Enter the target value for today's task.

)}
- - - {errors.selectedEmployees && (

{errors.selectedEmployees.message}

)} - -