From ea219b717696cf618678abaa53789f73ea1f074d Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Fri, 19 Sep 2025 15:03:25 +0530 Subject: [PATCH 1/4] 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) && (
- {/* Buttons Section (aligned to right) */}
{ManageInfra && ( From 1ef82ad0b261de5ee32a44bca7577f77d5b8cd1b Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Fri, 19 Sep 2025 19:20:01 +0530 Subject: [PATCH 3/4] Only 1 project or no project is assigned then dropdown will be hide. --- src/components/Project/ProjectInfra.jsx | 53 +++++++++++++++++-------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/src/components/Project/ProjectInfra.jsx b/src/components/Project/ProjectInfra.jsx index 38821a6a..86195381 100644 --- a/src/components/Project/ProjectInfra.jsx +++ b/src/components/Project/ProjectInfra.jsx @@ -89,24 +89,43 @@ const ProjectInfra = ({ data, onDataChange, eachSiteEngineer }) => { className="dataTables_length text-start py-2 px-6 col-md-4 col-12" id="DataTables_Table_0_length" > - + ) : ( +
- - {servicesLoading && } - {assignedServices?.map((service) => ( - - ))} - - + {assignedServices?.length === 1 + ? assignedServices[0].name + : "No service available"} +
+ )}
{/* Buttons Section (aligned to right) */}
From 994f22e8c0404cb0a08ffe6f17639cec1b428d75 Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Sat, 20 Sep 2025 11:29:29 +0530 Subject: [PATCH 4/4] Changes in Infrastructure service dropdown. --- .../Project/Infrastructure/InfraTable.jsx | 2 +- src/components/Project/ProjectInfra.jsx | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/components/Project/Infrastructure/InfraTable.jsx b/src/components/Project/Infrastructure/InfraTable.jsx index fb484f6e..77c6f905 100644 --- a/src/components/Project/Infrastructure/InfraTable.jsx +++ b/src/components/Project/Infrastructure/InfraTable.jsx @@ -143,7 +143,7 @@ const InfraTable = ({ buildings, projectId}) => { // }, [handler]); return ( -
+
{projectBuilding && projectBuilding.length > 0 && ( diff --git a/src/components/Project/ProjectInfra.jsx b/src/components/Project/ProjectInfra.jsx index 86195381..0669c136 100644 --- a/src/components/Project/ProjectInfra.jsx +++ b/src/components/Project/ProjectInfra.jsx @@ -90,7 +90,7 @@ const ProjectInfra = ({ data, onDataChange, eachSiteEngineer }) => { id="DataTables_Table_0_length" > {servicesLoading ? ( - Loading... + ) : assignedServices?.length > 1 ? (