From 9b372889017e6584eb4fbe1d96695bdb8566c098 Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Fri, 19 Sep 2025 16:32:34 +0530 Subject: [PATCH 1/3] Adding Dropdown in Daily Task Planning and call api. --- src/pages/Activities/TaskPlannng.jsx | 52 +++++++++++++++++++++------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/src/pages/Activities/TaskPlannng.jsx b/src/pages/Activities/TaskPlannng.jsx index 25cf63f2..6ab0c7df 100644 --- a/src/pages/Activities/TaskPlannng.jsx +++ b/src/pages/Activities/TaskPlannng.jsx @@ -1,22 +1,30 @@ -import React,{useEffect,useRef} from "react"; +import React, { useEffect, useState } from "react"; import Breadcrumb from "../../components/common/Breadcrumb"; import InfraPlanning from "../../components/Activities/InfraPlanning"; import { useProjectName } from "../../hooks/useProjects"; -import { useDispatch, useSelector } from "react-redux"; +import { useDispatch } from "react-redux"; import { setProjectId } from "../../slices/localVariablesSlice"; import { useSelectedProject } from "../../slices/apiDataManager"; - +import { useProjectAssignedServices } from "../../hooks/useProjects"; const TaskPlannng = () => { -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,8 +34,28 @@ useEffect(() => { { label: "Daily Task Planning" }, ]} /> + + {/* 🔹 Service Dropdown */} +
+ +
+ + {/* 🔹 InfraPlanning only when project is selected */} {selectedProject ? ( - + ) : (
Please Select Project
)} From 9223f7a1768ea61544224d76bce87212d2965fc7 Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Fri, 19 Sep 2025 20:03:36 +0530 Subject: [PATCH 2/3] Adding Card in Daily Progress Report. --- src/components/Activities/InfraPlanning.jsx | 4 +- src/components/Project/ProjectInfra.jsx | 2 +- src/pages/Activities/TaskPlannng.jsx | 70 ++++++++++++++------- 3 files changed, 49 insertions(+), 27 deletions(-) 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 38c05567..a0a137cf 100644 --- a/src/components/Project/ProjectInfra.jsx +++ b/src/components/Project/ProjectInfra.jsx @@ -129,7 +129,7 @@ const ProjectInfra = ( {data, onDataChange, eachSiteEngineer} ) =>
{isLoading &&

Loading....

} {projectInfra && projectInfra?.length > 0 && ( - { const selectedProject = useSelectedProject(); const dispatch = useDispatch(); @@ -35,30 +36,53 @@ const TaskPlannng = () => { ]} /> - {/* 🔹 Service Dropdown */} -
- -
+
+
+ {/* Service Dropdown */} +
+ {assignedServices?.length > 1 ? ( + + ) : ( +
+ {assignedServices?.length === 1 + ? assignedServices[0].name + : "No service available"} +
+ )} +
- {/* 🔹 InfraPlanning only when project is selected */} - {selectedProject ? ( - - ) : ( -
Please Select Project
- )} + + {/* Infra Planning Component */} + {selectedProject ? ( + + ) : ( +
Please Select Project
+ )} +
+
); }; From 58b5da17939b3df2274e0cfffe733537d2eb6911 Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Sat, 20 Sep 2025 11:39:14 +0530 Subject: [PATCH 3/3] Changes in Daily Task planning --- src/pages/Activities/TaskPlannng.jsx | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/pages/Activities/TaskPlannng.jsx b/src/pages/Activities/TaskPlannng.jsx index d24b6a30..6e5c4987 100644 --- a/src/pages/Activities/TaskPlannng.jsx +++ b/src/pages/Activities/TaskPlannng.jsx @@ -39,7 +39,7 @@ const TaskPlannng = () => {
{/* Service Dropdown */} -
+
{assignedServices?.length > 1 ? ( ) : (
{assignedServices?.length === 1 - ? assignedServices[0].name + ?
{ assignedServices[0].name}
: "No service available"}
)}