diff --git a/src/components/Project/Team/TeamAssignToProject.jsx b/src/components/Project/Team/TeamAssignToProject.jsx
index 9c99333a..45673f9d 100644
--- a/src/components/Project/Team/TeamAssignToProject.jsx
+++ b/src/components/Project/Team/TeamAssignToProject.jsx
@@ -1,4 +1,4 @@
-import React, { useState } from "react";
+import React, { useEffect, useState } from "react";
import TeamEmployeeList from "./TeamEmployeeList";
import { useOrganization } from "../../../hooks/useDirectory";
import { useOrganizationsList } from "../../../hooks/useOrganization";
@@ -14,56 +14,48 @@ const TeamAssignToProject = ({ closeModal }) => {
const project = useSelectedProject();
const { data, isLoading, isError, error } =
useProjectAssignedOrganizationsName(project);
- const { control, watch, formState: { errors } } = useForm({
+ const { control, watch, setValue, formState: { errors } } = useForm({
defaultValues: { organizationId: "" },
});
+
+ useEffect(() => {
+ if (data?.length === 1) {
+ setValue("organizationId", data[0].id, {
+ shouldValidate: true,
+ shouldDirty: true,
+ });
+ }
+ }, [data, setValue]);
+
return (
{/*
Assign Employee To Project
*/}
Assign Employee To Project
-
-
- {!isLoading && data && (
- <>
- {data.length === 1 && (
-
{data[0].name}
- )}
-
- {/* If multiple organizations → show dropdown */}
- {data.length > 1 && (
-
-
(
-
- )}
- />
- {errors.organizationId && (
-
- {errors.organizationId.message}
-
- )}
-
- )}
- >
+
+
(
+
+ )}
+ />
+ {errors.organizationId && (
+ {errors.organizationId.message}
)}
- {/* */}
-
diff --git a/src/pages/Home/SubscriptionPlans.jsx b/src/pages/Home/SubscriptionPlans.jsx
index 6c47826b..f6357ff3 100644
--- a/src/pages/Home/SubscriptionPlans.jsx
+++ b/src/pages/Home/SubscriptionPlans.jsx
@@ -108,64 +108,56 @@ const SubscriptionPlans = () => {
if (!mod || !mod.name) return null;
return (
-
-
-
);
})}