investor Api
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item.clientId}
|
||||
{item.clientReference_id}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
@@ -144,39 +154,46 @@ const InvestorDetails = () => {
|
||||
Country: (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item.country}
|
||||
{item.countryName}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Phone Number": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item.phoneNumber}
|
||||
{item.mobileNumber}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"E-mail ID": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item.emailID}
|
||||
{item.emailAddress}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Investor Type": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
<Badge fontWeight={'500'} px={2} py={0.5}>{item.investorTypeName}</Badge>
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"KYC Status": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Badge fontWeight={'500'} textTransform={'none'} color={item.kycStatus === "Completed" ? "blue" : "red"} px={2} py={0.5}>
|
||||
{item.kycStatus}
|
||||
{item.KYCStatus}
|
||||
</Badge>
|
||||
</Box>
|
||||
),
|
||||
Status: (
|
||||
<Switch
|
||||
size={"sm"}
|
||||
colorScheme="forestGreen"
|
||||
onChange={() => handleUpdateStatus(item.id)}
|
||||
isChecked={item.status}
|
||||
/>
|
||||
),
|
||||
// Status: (
|
||||
// <Switch
|
||||
// size={"sm"}
|
||||
// colorScheme="forestGreen"
|
||||
// onChange={() => handleUpdateStatus(item.id)}
|
||||
// isChecked={item.status}
|
||||
// />
|
||||
// ),
|
||||
Action: (
|
||||
<Box display={"flex"} justifyContent={"space-between"} gap={2}>
|
||||
<Tooltip
|
||||
@@ -258,7 +275,7 @@ const InvestorDetails = () => {
|
||||
<Select focusBorderColor="green.500" size={'sm'} fontSize={'xs'} cursor={'pointer'}>
|
||||
<option value="" selected disabled hidden>Status</option>
|
||||
|
||||
<option value="all">All</option>
|
||||
<option value="all">All</option>
|
||||
<option value="ban">Ban</option>
|
||||
<option value="unban">UnBan</option>
|
||||
</Select>
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user