diff --git a/src/Contexts/GlobalStateProvider.jsx b/src/Contexts/GlobalStateProvider.jsx index 30ca43c..a08761d 100644 --- a/src/Contexts/GlobalStateProvider.jsx +++ b/src/Contexts/GlobalStateProvider.jsx @@ -531,6 +531,7 @@ const GlobalStateProvider = ({ children }) => { phoneNumber: "8940035906", address: "Saudi Arabia", emailID: "john@gmail.com", + InvestorType:"Retail", bankName: "Lorem Text", branchAddress: "Hohenzollernring 58, 95444", iban: "DE 1234 5678 9012 3456", @@ -549,6 +550,7 @@ const GlobalStateProvider = ({ children }) => { phoneNumber: "8940035906", address: "Saudi Arabia", emailID: "john@gmail.com", + InvestorType:"Accredited Investors", bankName: "Lorem Text", branchAddress: "Hohenzollernring 58, 95444", iban: "DE 1234 5678 9012 3456", @@ -567,6 +569,7 @@ const GlobalStateProvider = ({ children }) => { phoneNumber: "8940035906", address: "Saudi Arabia", emailID: "john@gmail.com", + InvestorType:"Retail", bankName: "Lorem Text", branchAddress: "Hohenzollernring 58, 95444", iban: "DE 1234 5678 9012 3456", @@ -585,6 +588,7 @@ const GlobalStateProvider = ({ children }) => { phoneNumber: "8940035906", address: "Saudi Arabia", emailID: "john@gmail.com", + InvestorType:"Accredited Investors", bankName: "Lorem Text", branchAddress: "Hohenzollernring 58, 95444", iban: "DE 1234 5678 9012 3456", @@ -603,6 +607,7 @@ const GlobalStateProvider = ({ children }) => { phoneNumber: "8940035906", address: "Saudi Arabia", emailID: "john@gmail.com", + InvestorType:"Retail", bankName: "Lorem Text", branchAddress: "Hohenzollernring 58, 95444", iban: "DE 1234 5678 9012 3456", @@ -621,6 +626,7 @@ const GlobalStateProvider = ({ children }) => { phoneNumber: "8940035906", address: "Saudi Arabia", emailID: "john@gmail.com", + InvestorType:"Accredited Investors", bankName: "Lorem Text", branchAddress: "Hohenzollernring 58, 95444", iban: "DE 1234 5678 9012 3456", @@ -639,6 +645,7 @@ const GlobalStateProvider = ({ children }) => { phoneNumber: "8940035906", address: "Saudi Arabia", emailID: "john@gmail.com", + InvestorType:"Retail", bankName: "Lorem Text", branchAddress: "Hohenzollernring 58, 95444", iban: "DE 1234 5678 9012 3456", @@ -657,6 +664,7 @@ const GlobalStateProvider = ({ children }) => { phoneNumber: "8940035906", address: "Saudi Arabia", emailID: "john@gmail.com", + InvestorType:"Accredited Investors", bankName: "Lorem Text", branchAddress: "Hohenzollernring 58, 95444", iban: "DE 1234 5678 9012 3456", @@ -675,6 +683,7 @@ const GlobalStateProvider = ({ children }) => { phoneNumber: "8940035906", address: "Saudi Arabia", emailID: "john@gmail.com", + InvestorType:"Retail", bankName: "Lorem Text", branchAddress: "Hohenzollernring 58, 95444", iban: "DE 1234 5678 9012 3456", @@ -693,6 +702,7 @@ const GlobalStateProvider = ({ children }) => { phoneNumber: "8940035906", address: "Saudi Arabia", emailID: "john@gmail.com", + InvestorType:"Accredited Investors", bankName: "Lorem Text", branchAddress: "Hohenzollernring 58, 95444", iban: "DE 1234 5678 9012 3456", diff --git a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx index 921ae16..9dd4e68 100644 --- a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx +++ b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx @@ -36,6 +36,7 @@ import CustomAlertDialog from "../../../Components/CustomAlertDialog"; import ToastBox from "../../../Components/ToastBox"; import { debounce } from "../../Master/Sponser/AddSponser"; import InvestmentDetailsEdit from "./InvestmentDetailsEdit"; +import { useGetInvestorsQuery } from "../../../Services/investor.details.service"; const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter @@ -54,6 +55,12 @@ const InvestorDetails = () => { const {isOpen: isEditOpen,onOpen: onEditOpen,onClose: onEditClose,} = useDisclosure(); const btnRef = React.useRef() + + const {data: investorDetails,isLoading: investorDetailsLoading,error,} = useGetInvestorsQuery({ page: 1, size: 10 }); + + console.log(investorDetails); + + useEffect(() => { // Simulate loading const timer = setTimeout(() => { @@ -73,6 +80,7 @@ const InvestorDetails = () => { "Country", "Phone Number", "E-mail ID", + "Investor Type", "KYC Status", "Status", "Action", @@ -90,9 +98,9 @@ const InvestorDetails = () => { }, 300); // ====================================================[Table Filter]================================================================ - const filteredData = InvestorDetails?.filter((item) => { + const filteredData = investorDetails?.data?.rows?.filter((item) => { // Filter by name (case insensitive) - const name = item.firstName; + const name = item.clientReference_id; const searchLower = searchTerm.toLowerCase(); const nameMatches = name?.toLowerCase().includes(searchLower); @@ -108,6 +116,8 @@ const InvestorDetails = () => { return nameMatches; }); + console.log(investorDetails); + const extractedArray = filteredData?.map((item) => ({ id: item?.id, "Sr N/O": ( @@ -123,7 +133,7 @@ const InvestorDetails = () => { "Client ID": ( - {item.clientId} + {item.clientReference_id} ), @@ -144,39 +154,46 @@ const InvestorDetails = () => { Country: ( - {item.country} + {item.countryName} ), "Phone Number": ( - {item.phoneNumber} + {item.mobileNumber} ), "E-mail ID": ( - {item.emailID} + {item.emailAddress} + + + ), + "Investor Type": ( + + + {item.investorTypeName} ), "KYC Status": ( - {item.kycStatus} + {item.KYCStatus} ), - Status: ( - handleUpdateStatus(item.id)} - isChecked={item.status} - /> - ), + // Status: ( + // handleUpdateStatus(item.id)} + // isChecked={item.status} + // /> + // ), Action: ( { diff --git a/src/Services/investor.details.service.js b/src/Services/investor.details.service.js index 034b44d..fd734bd 100644 --- a/src/Services/investor.details.service.js +++ b/src/Services/investor.details.service.js @@ -1,7 +1,8 @@ // investorDetails.service.js import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react"; +import { api } from "./api.service"; -const baseUrl = import.meta.env.VITE_API_BASE_URL + "/api"; +const baseUrl = api?.defaults.baseURL; // Define a service using a base URL and expected endpoints export const investorDetails = createApi({ @@ -9,15 +10,15 @@ export const investorDetails = createApi({ baseQuery: fetchBaseQuery({ baseUrl }), tagTypes: [], endpoints: (builder) => ({ + getInvestors: builder.query({ - query: () => "/getInvestors", - }), - getInvestorById: builder.query({ - query: (id) => `/getInvestor/${id}`, + query: ({ page, size }) => + `/investorDetails/admin?page=${page}&size=${size}`, + providesTags: ["getInvestors"], }), + }), }); // Export hooks for usage in functional components -export const { useGetInvestorsQuery, useGetInvestorByIdQuery } = - investorDetails; +export const { useGetInvestorsQuery } = investorDetails;