From 630c11985de1ff108604e1ddc6338e8f21587f14 Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Sat, 13 Dec 2025 11:18:11 +0530 Subject: [PATCH] Correction in Subscription page. --- .../Project/Team/TeamAssignToProject.jsx | 76 ++++++------- src/pages/Home/SubscriptionPlans.jsx | 102 ++++++++---------- 2 files changed, 81 insertions(+), 97 deletions(-) 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 ( -
-

- -

+ + + -
-
- {mod.features && mod.features.length > 0 ? ( -
    - {mod.features.map((feat) => ( -
  • - +
    +
    + {mod.features?.length > 0 ? ( +
      + {mod.features.map((feat) => ( +
    • + + {feat.name} +
    • + ))} +
    + ) : ( +

    No additional features

    + )} +
    +
    +
- {feat.name} - - ))} - - ) : ( -

- No additional features -

- )} -
-
-
); })}