This commit is contained in:
YasinShaikh123
2024-10-11 16:03:30 +05:30
2 changed files with 25 additions and 15 deletions

View File

@@ -21,6 +21,7 @@ import { useEffect, useState } from 'react';
import { TABLE_PAGINATION } from '../../Constants/Paginations';
import Pagination from '../../Components/Pagination';
import { AddIcon } from '@chakra-ui/icons';
import { useGetFawateerInvestorsQuery } from '../../Services/fawateer.request.service';
const SelectInvestorModal = ({ isOpen, setValue, onClose, setId}) => {
@@ -46,7 +47,7 @@ const SelectInvestorModal = ({ isOpen, setValue, onClose, setId}) => {
data: investorDetails,
isLoading: investorDetailsLoading,
error,
} = useGetInvestorsQuery({
} = useGetFawateerInvestorsQuery({
page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
search: debouncedSearchTerm,
@@ -65,14 +66,14 @@ const handleCheckboxChange = (id) => {
setSelectorInvestor(investor)
console.log(investor);
setId(investor?.principal_xid)
// setValue("investorName",`${selectedInvestor?.principal?.firstName} ${selectedInvestor?.principal?.lastName}`)
// setValue("investorName",`${selectedInvestor?.firstName} ${selectedInvestor?.lastName}`)
// setValue("clientId",selectedInvestor?.clientReference_id)
return
};
const handleAdd = () => {
console.log(selectedInvestor);
setValue("investorName",`${selectedInvestor?.principal?.firstName} ${selectedInvestor?.principal?.lastName}`)
setValue("investorName",`${selectedInvestor?.firstName} ${selectedInvestor?.lastName}`)
setValue("clientId",selectedInvestor?.clientReference_id)
return onClose()
}
@@ -86,7 +87,7 @@ console.log(investor);
"Client ID",
"First Name",
"Last Name",
"Country",
// "Country",
"Phone Number",
"E-mail ID",
// "Type",
@@ -119,35 +120,28 @@ console.log(investor);
"First Name": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.principal?.firstName}
{item?.firstName}
</Text>
</Box>
),
"Last Name": (
<Box w={"70px"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.principal?.lastName}
</Text>
</Box>
),
Country: (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.country?.countryName}
{item?.lastName}
</Text>
</Box>
),
"Phone Number": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.principal?.mobileNumber}
{item?.phoneNumber}
</Text>
</Box>
),
"E-mail ID": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.principal?.emailAddress}
{item?.emailAddress}
</Text>
</Box>
),

View File

@@ -24,6 +24,21 @@ export const fawateerRequest = createApi({
providesTags: ["getFawateerRequest"],
}),
getFawateerInvestors: builder.query({
query: ({ page, size, search }) => {
let baseURL = `/fawateer/admin/investors?search=${search || ""}`;
if (page !== undefined && size !== undefined) {
baseURL += `&page=${page}&size=${size}`; // Only add pagination if both are defined
}
return baseURL;
},
providesTags: ["getFawateerRequest"],
}),
getFawateerForMakerRequest: builder.query({
query: ({ page, size, searchTerm }) => {
let baseURL = `/fawateer/admin?search_data=${searchTerm || ""}`;
@@ -68,4 +83,5 @@ export const {
useApproveCommentMutation,
useRejectCommentMutation,
useGetFawateerForMakerRequestQuery,
useGetFawateerInvestorsQuery
} = fawateerRequest;