From ea219b717696cf618678abaa53789f73ea1f074d Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Fri, 19 Sep 2025 15:03:25 +0530 Subject: [PATCH] Adding Services Dropdown in Infrastructure. --- src/components/Project/ProjectInfra.jsx | 124 ++++++++++++++---------- 1 file changed, 72 insertions(+), 52 deletions(-) diff --git a/src/components/Project/ProjectInfra.jsx b/src/components/Project/ProjectInfra.jsx index 38c05567..c99b08c9 100644 --- a/src/components/Project/ProjectInfra.jsx +++ b/src/components/Project/ProjectInfra.jsx @@ -21,18 +21,17 @@ import { useProjectDetails, useProjectInfra } from "../../hooks/useProjects"; import { useDispatch, useSelector } from "react-redux"; import { refreshData } from "../../slices/localVariablesSlice"; import eventBus from "../../services/eventBus"; -import {useParams} from "react-router-dom"; +import { useParams } from "react-router-dom"; import GlobalModel from "../common/GlobalModel"; -const ProjectInfra = ( {data, onDataChange, eachSiteEngineer} ) => -{ +const ProjectInfra = ({ data, onDataChange, eachSiteEngineer }) => { // const projectId = useSelector((store)=>store.localVariables.projectId) const projectId = useSelectedProject(); const reloadedData = useSelector((store) => store.localVariables.reload); - const [ expandedBuildings, setExpandedBuildings ] = useState( [] ); - const {projectInfra,isLoading,error} = useProjectInfra(projectId) + const [expandedBuildings, setExpandedBuildings] = useState([]); + const { projectInfra, isLoading, error } = useProjectInfra(projectId) const { projects_Details, refetch, loading } = useProjectDetails(data?.id); - const [ project, setProject ] = useState( projects_Details ); + const [project, setProject] = useState(projects_Details); const ManageInfra = useHasUserPermission(MANAGE_PROJECT_INFRA); const ManageTask = useHasUserPermission(MANAGE_TASK) const [showModalFloor, setshowModalFloor] = useState(false); @@ -58,29 +57,29 @@ const ProjectInfra = ( {data, onDataChange, eachSiteEngineer} ) => return ( <> - {showModalBuilding && setshowModalBuilding( false )}> + {showModalBuilding && setshowModalBuilding(false)}> setshowModalBuilding( false )} + onClose={() => setshowModalBuilding(false)} /> - } - {showModalFloor && setshowModalFloor(false)}> + } + {showModalFloor && setshowModalFloor(false)}> setshowModalFloor(false)} - /> + project={projectInfra} + onClose={() => setshowModalFloor(false)} + /> } - {showModalWorkArea && setshowModalWorkArea(false)} > - setshowModalWorkArea(false)} - /> + {showModalWorkArea && setshowModalWorkArea(false)} > + setshowModalWorkArea(false)} + /> } - {showModalTask && ( setshowModalTask(false)}> + {showModalTask && ( setshowModalTask(false)}> setshowModalTask(false)} - /> + project={projectInfra} + onClose={() => setshowModalTask(false)} + /> )}
@@ -88,38 +87,59 @@ const ProjectInfra = ( {data, onDataChange, eachSiteEngineer} ) =>
- {ManageInfra && (<> - - - )} - + +
+ + {/* Buttons Section (aligned to right) */} +
+ {ManageInfra && ( + <> + + + )} + {(ManageTask || ManageInfra) && (