diff --git a/src/components/HeaderComponent.tsx b/src/components/HeaderComponent.tsx index 3aad3cf..f8cb4dd 100644 --- a/src/components/HeaderComponent.tsx +++ b/src/components/HeaderComponent.tsx @@ -98,6 +98,7 @@ const HeaderComponent = ({ tenantDefaultValue, isTenantShow, isCohortShow, + showSearch = true, }: any) => { const { t } = useTranslation(); const queryClient = useQueryClient(); @@ -664,15 +665,18 @@ const HeaderComponent = ({ display: "flex", flexDirection: isMobile || isMediumScreen ? "column" : "row", gap: isMobile || isMediumScreen ? "8px" : "5%", - marginTop: "20px", + marginTop: showSearch ? "20px" : "10px", + p: showSearch ? "1%" : "1%", }} > - - - + {showSearch && ( + + + + )} {showAddNew && ( { const userInfo = response?.userData; setAdminInfo(userInfo); - const tenantId = userInfo?.tenantData?.[0]?.tenantId; - localStorage.setItem("tenantId", tenantId); //set user info in zustand store if (typeof window !== "undefined" && window.localStorage) { localStorage.setItem("adminInfo", JSON.stringify(userInfo)); diff --git a/src/pages/tenant.tsx b/src/pages/tenant.tsx index c5001a4..2053b4f 100644 --- a/src/pages/tenant.tsx +++ b/src/pages/tenant.tsx @@ -251,11 +251,11 @@ const Tenant: React.FC = () => { "ui:help": "Password must be at least 8 characters long, with at least one letter and one number.", }, - role: { - "ui:widget": "select", - "ui:placeholder": "Select a role", - // "ui:help": "Select a role.", - }, + // role: { + // "ui:widget": "select", + // "ui:placeholder": "Select a role", + // // "ui:help": "Select a role.", + // }, status: { "ui:widget": "CustomRadioWidget", "ui:options": { @@ -403,7 +403,7 @@ const Tenant: React.FC = () => { useEffect(() => { fetchTenantList(); - }, [openAddNewCohort]); + }, [openAddNewCohort, filters]); // const getFormData = async () => { // try { @@ -761,7 +761,6 @@ const Tenant: React.FC = () => { newValue: any ) => { setStatusValue(newValue); - setSelectedFilter(newValue); setPageSize(Numbers.TEN); setPageLimit(Numbers.TEN); @@ -1261,11 +1260,12 @@ const Tenant: React.FC = () => { handleSearch: handleSearch, showAddNew: adminRole == true ? true : false, // showAddNew: true, + showSearch: false, statusArchived: true, handleAddUserClick: handleAddUserClick, statusValue: statusValue, setStatusValue: setStatusValue, - showSort: true, + showSort: false, selectedBlockCode: selectedBlockCode, setSelectedBlockCode: setSelectedBlockCode, selectedDistrictCode: selectedDistrictCode, diff --git a/src/services/CohortService/cohortService.ts b/src/services/CohortService/cohortService.ts index babe477..2f0f224 100644 --- a/src/services/CohortService/cohortService.ts +++ b/src/services/CohortService/cohortService.ts @@ -1,6 +1,8 @@ import { CohortMemberList } from "@/utils/Interfaces"; import { deleteApi, get, patch, post, put } from "../RestClient"; import config from "@/utils/urlConstants.json"; +import axios from 'axios'; + export interface cohortListFilter { type: string; status: string[]; @@ -251,26 +253,34 @@ data:any let apiUrl: string = `${process.env.NEXT_PUBLIC_BASE_URL}/${config.URLS.ROLES_LIST}`; try { - const response = await post(apiUrl, data); - console.log({response}); - + const response = await post(apiUrl, data); return response?.data; } catch (error) { console.error("Error in Getting cohort List Details", error); return error; } }; - export const userCreate = async (data: cohortListData,userTenantId:string): Promise => { - let apiUrl: string = `${process.env.NEXT_PUBLIC_BASE_URL}/${config.URLS.USER_CREATE}`; + + export const userCreate = async (data: cohortListData, userTenantId: string): Promise => { + const apiUrl: string = `${process.env.NEXT_PUBLIC_BASE_URL}/${config.URLS.USER_CREATE}`; try { - const response = await post(apiUrl, data); - return response?.data; + const token=localStorage.getItem('token') + const headers = { + 'Authorization': `Bearer ${token}`, + 'Content-Type':'application/json', + 'tenantid': userTenantId , + }; + + const response = await axios.post(apiUrl, data, { headers }); + console.log({response}); + return response?.data; } catch (error) { - console.error("Error in Getting cohort List Details", error); - return error; + console.error('Error in Creating User:', error); + return error ; } }; + export const deleteUser = async ( userId: string