diff --git a/src/components/Activities/InfraPlanning.jsx b/src/components/Activities/InfraPlanning.jsx index dc237c63..0e9c9590 100644 --- a/src/components/Activities/InfraPlanning.jsx +++ b/src/components/Activities/InfraPlanning.jsx @@ -55,7 +55,7 @@ const InfraPlanning = () => { if (isFetched && (!projectInfra || projectInfra.length === 0)) { return ( -
+

No Result Found

); @@ -63,11 +63,9 @@ const InfraPlanning = () => { return (
-
-
diff --git a/src/components/Project/ProjectInfra.jsx b/src/components/Project/ProjectInfra.jsx index 0669c136..08ea6e3a 100644 --- a/src/components/Project/ProjectInfra.jsx +++ b/src/components/Project/ProjectInfra.jsx @@ -162,7 +162,7 @@ const ProjectInfra = ({ data, onDataChange, eachSiteEngineer }) => {
{isLoading &&

Loading....

} {projectInfra && projectInfra?.length > 0 && ( - { -const selectedProject = useSelectedProject(); -const dispatch = useDispatch(); -const { projectNames = [], loading: projectLoading } = useProjectName(); + const selectedProject = useSelectedProject(); + const dispatch = useDispatch(); + const { projectNames = [], loading: projectLoading } = useProjectName(); -useEffect(() => { - if (!selectedProject) { - dispatch(setProjectId(projectNames[0]?.id)); - } -}, [projectNames, selectedProject?.id, dispatch]); + // Service dropdown state + const { data: assignedServices, isLoading: servicesLoading } = + useProjectAssignedServices(selectedProject); + const [selectedService, setSelectedService] = useState(""); + useEffect(() => { + if (!selectedProject && projectNames?.length > 0) { + dispatch(setProjectId(projectNames[0]?.id)); + } + }, [projectNames, selectedProject, dispatch]); + + const handleServiceChange = (e) => { + setSelectedService(e.target.value); + }; return (
@@ -26,11 +35,45 @@ useEffect(() => { { label: "Daily Task Planning" }, ]} /> - {selectedProject ? ( - - ) : ( -
Please Select Project
- )} + +
+
+ {/* Service Dropdown */} +
+ {assignedServices?.length > 1 ? ( + + ) : ( +
+ {assignedServices?.length === 1 + ?
{ assignedServices[0].name}
+ : "No service available"} +
+ )} +
+ + + {/* Infra Planning Component */} + {selectedProject ? ( + + ) : ( +
Please Select Project
+ )} +
+
); };