Adding Dropdown in Daily Task Planning and call api. #412
@ -55,7 +55,7 @@ const InfraPlanning = () => {
|
|||||||
|
|
||||||
if (isFetched && (!projectInfra || projectInfra.length === 0)) {
|
if (isFetched && (!projectInfra || projectInfra.length === 0)) {
|
||||||
return (
|
return (
|
||||||
<div className="card text-center">
|
<div className="text-center">
|
||||||
<p className="my-3">No Result Found</p>
|
<p className="my-3">No Result Found</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -63,11 +63,9 @@ const InfraPlanning = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="col-md-12 col-lg-12 col-xl-12 order-0 mb-4">
|
<div className="col-md-12 col-lg-12 col-xl-12 order-0 mb-4">
|
||||||
<div className="card">
|
|
||||||
<div className="card-body" style={{ padding: "0.5rem" }}>
|
<div className="card-body" style={{ padding: "0.5rem" }}>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<InfraTable buildings={projectInfra} projectId={selectedProject} />
|
<InfraTable buildings={projectInfra} projectId={selectedProject} />
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -129,7 +129,7 @@ const ProjectInfra = ( {data, onDataChange, eachSiteEngineer} ) =>
|
|||||||
<div className="row ">
|
<div className="row ">
|
||||||
{isLoading && <p>Loading....</p>}
|
{isLoading && <p>Loading....</p>}
|
||||||
{projectInfra && projectInfra?.length > 0 && (
|
{projectInfra && projectInfra?.length > 0 && (
|
||||||
<InfraTable
|
<InfraTable
|
||||||
buildings={projectInfra}
|
buildings={projectInfra}
|
||||||
projectId={projectId}
|
projectId={projectId}
|
||||||
// handleFloor={submitData}
|
// handleFloor={submitData}
|
||||||
|
@ -6,6 +6,7 @@ import { useDispatch } from "react-redux";
|
|||||||
import { setProjectId } from "../../slices/localVariablesSlice";
|
import { setProjectId } from "../../slices/localVariablesSlice";
|
||||||
import { useSelectedProject } from "../../slices/apiDataManager";
|
import { useSelectedProject } from "../../slices/apiDataManager";
|
||||||
import { useProjectAssignedServices } from "../../hooks/useProjects";
|
import { useProjectAssignedServices } from "../../hooks/useProjects";
|
||||||
|
|
||||||
const TaskPlannng = () => {
|
const TaskPlannng = () => {
|
||||||
const selectedProject = useSelectedProject();
|
const selectedProject = useSelectedProject();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@ -35,30 +36,53 @@ const TaskPlannng = () => {
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* 🔹 Service Dropdown */}
|
<div className="card">
|
||||||
<div className="mb-3">
|
<div className="card-body">
|
||||||
<select
|
{/* Service Dropdown */}
|
||||||
id="serviceSelect"
|
<div className="mb-3 ms-2">
|
||||||
className="form-select"
|
{assignedServices?.length > 1 ? (
|
||||||
value={selectedService}
|
<select
|
||||||
onChange={handleServiceChange}
|
id="serviceSelect"
|
||||||
style={{ fontSize: "0.875rem", height: "35px", width: "190px" }}
|
className="form-select"
|
||||||
>
|
value={selectedService}
|
||||||
{servicesLoading && <option>Loading...</option>}
|
onChange={handleServiceChange}
|
||||||
{assignedServices?.map((service) => (
|
style={{ fontSize: "0.875rem", height: "35px", width: "190px" }}
|
||||||
<option key={service.id} value={service.id}>
|
>
|
||||||
{service.name}
|
{assignedServices.map((service) => (
|
||||||
</option>
|
<option key={service.id} value={service.id}>
|
||||||
))}
|
{service.name}
|
||||||
</select>
|
</option>
|
||||||
</div>
|
))}
|
||||||
|
</select>
|
||||||
|
) : (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
fontSize: "0.875rem",
|
||||||
|
height: "35px",
|
||||||
|
width: "190px",
|
||||||
|
border: "1px solid #ced4da",
|
||||||
|
borderRadius: "0.25rem",
|
||||||
|
padding: "4px 8px",
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{assignedServices?.length === 1
|
||||||
|
? assignedServices[0].name
|
||||||
|
: "No service available"}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* 🔹 InfraPlanning only when project is selected */}
|
|
||||||
{selectedProject ? (
|
{/* Infra Planning Component */}
|
||||||
<InfraPlanning selectedService={selectedService} />
|
{selectedProject ? (
|
||||||
) : (
|
<InfraPlanning selectedService={selectedService} />
|
||||||
<div className="text-center">Please Select Project</div>
|
) : (
|
||||||
)}
|
<div className="text-center">Please Select Project</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user