diff --git a/src/Pages/AccountDeletion/DeletionHistory.jsx b/src/Pages/AccountDeletion/DeletionHistory.jsx
index 530f39b..1108499 100644
--- a/src/Pages/AccountDeletion/DeletionHistory.jsx
+++ b/src/Pages/AccountDeletion/DeletionHistory.jsx
@@ -18,13 +18,13 @@ import CustomAlertDialog from "../../Components/CustomAlertDialog";
import { formatDate } from "../../Components/Functions/UTCConvertor";
import { CheckIcon, CloseIcon } from "@chakra-ui/icons";
import { useGetDeleteHistoryQuery } from "../../Services/delete.request.service";
+import { TABLE_PAGINATION } from "../../Constants/Paginations";
// import { formatDate } from "../../Components/Functions/UTCConvertor";
const DeletionHistory = () => {
const toast = useToast();
const { slideFromRight, setDeleteHistory } =
useContext(GlobalStateContext);
- const [searchTerm, setSearchTerm] = useState("");
const [deleteAlert, setDeleteAlert] = useState(false);
const [actionId, setActionId] = useState(false);
const [mouseEntered, setMouseEntered] = useState(false);
@@ -32,11 +32,35 @@ const DeletionHistory = () => {
+ // =========================== [Use State] =============================
+ const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
+ const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
+ const [searchTerm, setSearchTerm] = useState("");
+ const [debouncedSearchTerm, setDebouncedSearchTerm] = useState("");
+
+ // Debounce the search term to avoid making a request on every keystroke
+ useEffect(() => {
+ const handler = setTimeout(() => {
+ setDebouncedSearchTerm(searchTerm);
+ }, 500); // Adjust delay as needed
+ return () => {
+ clearTimeout(handler);
+ };
+ }, [searchTerm]);
+
+
const {
data: deleteHistory,
isLoading,
refetch
- } = useGetDeleteHistoryQuery()
+ } = useGetDeleteHistoryQuery({
+ page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
+ size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
+ search: debouncedSearchTerm,
+ },
+ {
+ skip: debouncedSearchTerm === "" && searchTerm !== "", // Skip if search is empty and it's not the initial request
+ })
const formatDate = (date) => {
return new Date(date).toLocaleDateString('en-GB', {
@@ -51,19 +75,7 @@ const DeletionHistory = () => {
refetch();
}, [refetch]);
-// console.log(deleteHistory?.data);
- // ====================================================[Table Filter]================================================================
- const filteredData = deleteHistory?.data?.rows?.filter((item) => {
- // Filter by name (case insensitive)
- const name = item?.country;
- const searchLower = searchTerm.toLowerCase();
- const nameMatches = name.toLowerCase().includes(searchLower);
-
- return nameMatches;
- });
-
- console.log(deleteHistory);
// ====================================================[Table Setup]================================================================
const tableHeadRow = [
"Sr No.",
@@ -76,7 +88,7 @@ const DeletionHistory = () => {
"Status"
];
- const extractedArray = filteredData?.map((item, index) => ({
+ const extractedArray = deleteHistory?.data?.rows?.map((item, index) => ({
id: item?.id,
"Sr No.": (
new Date(date).toLocaleDateString(); // Simple date formatter
@@ -30,18 +31,12 @@ const BankInvestor = () => {
const thirdField = useRef();
const { bankInvestor, setBankInvestor, slideFromRight } =
useContext(GlobalStateContext);
- const [searchTerm, setSearchTerm] = useState("");
const [isLoading, setIsLoading] = useState(true);
const [deleteAlert, setDeleteAlert] = useState(false);
const [actionId, setActionId] = useState(false);
const [mouseEntered, setMouseEntered] = useState(false);
const [mouseEnteredId, setMouseEnteredId] = useState("");
- const {
- isOpen: isOpen,
- onOpen: onOpen,
- onClose: onClose,
- } = useDisclosure();
-
+ const { isOpen: isOpen, onOpen: onOpen, onClose: onClose } = useDisclosure();
const formatDate = (date) => {
return new Date(date).toLocaleDateString("en-GB", {
@@ -51,15 +46,43 @@ const BankInvestor = () => {
});
};
+ // =========================== [Use State] =============================
+ const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
+ const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
+ const [searchTerm, setSearchTerm] = useState("");
+ const [debouncedSearchTerm, setDebouncedSearchTerm] = useState("");
+
+ const [status, setStatus] = useState("");
+ const [kyc, setKyc] = useState("");
+ const [country, setCountry] = useState("");
+
+ // Debounce the search term to avoid making a request on every keystroke
+ useEffect(() => {
+ const handler = setTimeout(() => {
+ setDebouncedSearchTerm(searchTerm);
+ }, 500); // Adjust delay as needed
+ return () => {
+ clearTimeout(handler);
+ };
+ }, [searchTerm]);
- console.log(localStorage.getItem("refreshToken"));
const {
data,
isLoading: unbanLoading,
error,
- refetch
- } = useGetbanInvestorQuery();
-
+ refetch,
+ } = useGetbanInvestorQuery(
+ {
+ page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
+ size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
+ search: debouncedSearchTerm,
+ KYCStatus: kyc,
+ country_xid: country,
+ },
+ {
+ skip: debouncedSearchTerm === "" && searchTerm !== "", // Skip if search is empty and it's not the initial request
+ }
+ );
useEffect(() => {
// Simulate loading
@@ -115,10 +138,7 @@ const BankInvestor = () => {
return nameMatches;
});
-
- console.log(filteredData);
-
- const extractedArray = filteredData?.map((item) => ({
+ const extractedArray = data?.data?.rows?.map((item) => ({
id: item?.id,
"Sr N/O": (
{
{item.id}
),
- "Date": (
+ Date: (
- {formatDate(item?.date)}
+ {formatDate(item?.date)}
),
"Client ID": (
- {item?.clientReference_id}
+ {item?.clientReference_id}
),
"First Name": (
- {item?.firstName}
+ {item?.firstName}
),
"Last Name": (
- {item?.lastName}
+ {item?.lastName}
),
Country: (
- {item?.country}
+ {item?.country}
),
"Phone Number": (
- {item?.phoneNumber}
+ {item?.phoneNumber}
),
"E-mail ID": (
- {item?.emailAddress}
+ {item?.emailAddress}
),
"KYC Status": (
-
- {item?.KYCStatus === true ? "Completed" : "Incompleted"}
-
+
+ {item?.KYCStatus === true ? "Completed" : "Incompleted"}
+
),
Action: (
{
- setActionId(item?.id)
- onOpen()}}
+ onClick={() => {
+ setActionId(item?.id);
+ onOpen();
+ }}
>
Ban Investor
@@ -212,6 +233,8 @@ const BankInvestor = () => {
),
}));
+ console.log(extractedArray);
+
const handleDelete = () => {
const updatedInvestorDetails = InvestorDetails.filter(
(sponsor) => sponsor.id !== actionId
@@ -253,32 +276,59 @@ const BankInvestor = () => {
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
/>
+
+ {/* */}
+
+
@@ -302,11 +352,7 @@ const BankInvestor = () => {
alertHandler={handleDelete}
isLoading={isLoading}
/>
-
+
);
};
diff --git a/src/Pages/Admin/Investor/UnbanInvestor/UnbanInvestor.jsx b/src/Pages/Admin/Investor/UnbanInvestor/UnbanInvestor.jsx
index 834f5ab..96f24db 100644
--- a/src/Pages/Admin/Investor/UnbanInvestor/UnbanInvestor.jsx
+++ b/src/Pages/Admin/Investor/UnbanInvestor/UnbanInvestor.jsx
@@ -41,20 +41,6 @@ const UnbanInvestor = () => {
const [mouseEntered, setMouseEntered] = useState(false);
const [mouseEnteredId, setMouseEnteredId] = useState("");
const { isOpen: isOpen, onOpen: onOpen, onClose: onClose } = useDisclosure();
- const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
- const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
- const [searchTerm, setSearchTerm] = useState("");
- const [debouncedSearchTerm, setDebouncedSearchTerm] = useState("");
-
- // Debounce the search term to avoid making a request on every keystroke
- useEffect(() => {
- const handler = setTimeout(() => {
- setDebouncedSearchTerm(searchTerm);
- }, 500); // Adjust delay as needed
- return () => {
- clearTimeout(handler);
- };
- }, [searchTerm]);
const formatDate = (date) => {
return new Date(date).toLocaleDateString("en-GB", {
@@ -64,19 +50,43 @@ const UnbanInvestor = () => {
});
};
+ // =========================== [Use State] =============================
+ const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
+ const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
+ const [searchTerm, setSearchTerm] = useState("");
+ const [debouncedSearchTerm, setDebouncedSearchTerm] = useState("");
+
+ const [status, setStatus] = useState("");
+ const [kyc, setKyc] = useState("");
+ const [country, setCountry] = useState("");
+
+ // Debounce the search term to avoid making a request on every keystroke
+ useEffect(() => {
+ const handler = setTimeout(() => {
+ setDebouncedSearchTerm(searchTerm);
+ }, 500); // Adjust delay as needed
+ return () => {
+ clearTimeout(handler);
+ };
+ }, [searchTerm]);
+
const {
data,
isLoading: unbanLoading,
error,
refetch,
- } = useGetUnbanInvestorQuery({
- page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
- size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
- search: debouncedSearchTerm,
- },
- {
- skip: debouncedSearchTerm === "" && searchTerm !== "", // Skip if search is empty and it's not the initial request
- });
+ } = useGetUnbanInvestorQuery(
+ {
+ page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
+ size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
+ search: debouncedSearchTerm,
+ KYCStatus: kyc,
+ country_xid: country,
+ },
+ {
+ skip: debouncedSearchTerm === "" && searchTerm !== "", // Skip if search is empty and it's not the initial request
+ }
+ );
useEffect(() => {
// Simulate loading
@@ -132,7 +142,7 @@ const UnbanInvestor = () => {
color={"gray.600"}
className="d-flex align-items-center fw-bold web-text-small"
>
- {generateSerialNumber(index,currentPage, pageSize )}
+ {generateSerialNumber(index, currentPage, pageSize)}
),
Date: (
@@ -192,7 +202,7 @@ const UnbanInvestor = () => {
color={item?.KYCStatus === false ? "red" : "blue"}
px={2}
py={0.5}
- variant={'ghost'}
+ variant={"ghost"}
>
{item?.KYCStatus === true ? "Completed" : "Incompleted"}
@@ -207,9 +217,9 @@ const UnbanInvestor = () => {
colorScheme={"red"}
px={2}
py={0.5}
- onClick={()=>{
- setActionId(item?.id)
- onOpen()
+ onClick={() => {
+ setActionId(item?.id);
+ onOpen();
}}
>
Ban Investor
@@ -260,31 +270,57 @@ const UnbanInvestor = () => {
onChange={(e) => setSearchTerm(e.target.value)}
/>
+ {/* */}
+
+
diff --git a/src/Pages/Deposit/DepositRequest/DepositRequest.jsx b/src/Pages/Deposit/DepositRequest/DepositRequest.jsx
index 1d074fb..c10fa8a 100644
--- a/src/Pages/Deposit/DepositRequest/DepositRequest.jsx
+++ b/src/Pages/Deposit/DepositRequest/DepositRequest.jsx
@@ -47,7 +47,6 @@ const DepositRequest = () => {
const toast = useToast();
const { depositRequest, setDepositRequest, slideFromRight } =
useContext(GlobalStateContext);
- const [searchTerm, setSearchTerm] = useState("");
const [isLoading, setIsLoading] = useState(true);
const [deleteAlert, setDeleteAlert] = useState(false);
const [actionId, setActionId] = useState("");
@@ -63,9 +62,25 @@ const DepositRequest = () => {
onOpen: onRejectOpen,
onClose: onRejectClose,
} = useDisclosure();
+
+
+ // =========================== [Use State] =============================
const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
+ const [searchTerm, setSearchTerm] = useState("");
+ const [debouncedSearchTerm, setDebouncedSearchTerm] = useState("");
+
+ // Debounce the search term to avoid making a request on every keystroke
+ useEffect(() => {
+ const handler = setTimeout(() => {
+ setDebouncedSearchTerm(searchTerm);
+ }, 500); // Adjust delay as needed
+ return () => {
+ clearTimeout(handler);
+ };
+ }, [searchTerm]);
+
const formatDate = (date) => {
return new Date(date).toLocaleDateString("en-GB", {
@@ -80,7 +95,14 @@ const DepositRequest = () => {
isLoading: depositRequestLoading,
error,
refetch,
- } = useGetDepositRequestQuery({ page: currentPage, size: pageSize });
+ } = useGetDepositRequestQuery({
+ page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
+ size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
+ search: debouncedSearchTerm,
+ },
+ {
+ skip: debouncedSearchTerm === "" && searchTerm !== "", // Skip if search is empty and it's not the initial request
+ });
// Use useEffect to refetch data when the component mounts
useEffect(() => {
@@ -135,7 +157,7 @@ const DepositRequest = () => {
})
.sort((b, a) => new Date(a.createdAt) - new Date(b.createdAt));
- const extractedArray = filteredData?.map((item, idx) => ({
+ const extractedArray = data?.data?.rows?.map((item, idx) => ({
// id: item?.id,
"Sr.no": (
{
const toast = useToast();
const { depositHistory, setDepositHistory, slideFromRight } =
useContext(GlobalStateContext);
- const [searchTerm, setSearchTerm] = useState("");
const [isLoading, setIsLoading] = useState(true);
const [deleteAlert, setDeleteAlert] = useState(false);
const [actionId, setActionId] = useState(false);
@@ -62,15 +61,36 @@ const DepositHistory = () => {
// onClose: onRejectClose,
// } = useDisclosure();
+ // =========================== [Use State] =============================
const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
+ const [searchTerm, setSearchTerm] = useState("");
+ const [debouncedSearchTerm, setDebouncedSearchTerm] = useState("");
+ // Debounce the search term to avoid making a request on every keystroke
+ useEffect(() => {
+ const handler = setTimeout(() => {
+ setDebouncedSearchTerm(searchTerm);
+ }, 500); // Adjust delay as needed
+ return () => {
+ clearTimeout(handler);
+ };
+ }, [searchTerm]);
+
+
const {
data,
error,
refetch,
isLoading: depositHistoryLoading,
- } = useGetDepositHistoryQuery({ page: currentPage, size: pageSize });
+ } = useGetDepositHistoryQuery({
+ page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
+ size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
+ search: debouncedSearchTerm,
+ },
+ {
+ skip: debouncedSearchTerm === "" && searchTerm !== "", // Skip if search is empty and it's not the initial request
+ });
// Use useEffect to refetch data when the component mounts
useEffect(() => {
@@ -131,7 +151,7 @@ const DepositHistory = () => {
// onViewOpen();
// };
- const extractedArray = filteredData?.map((item, idx) => ({
+ const extractedArray = data?.data?.rows?.map((item, idx) => ({
"Sr.no": (
{
const navigate = useNavigate();
const toast = useToast();
diff --git a/src/Pages/FawateerChecker/ApproveHistory/ApproveHistoryMaker.jsx b/src/Pages/FawateerChecker/ApproveHistory/ApproveHistoryMaker.jsx
index db922eb..dc26721 100644
--- a/src/Pages/FawateerChecker/ApproveHistory/ApproveHistoryMaker.jsx
+++ b/src/Pages/FawateerChecker/ApproveHistory/ApproveHistoryMaker.jsx
@@ -137,7 +137,7 @@ import {
"Status",
];
- const extractedArray = filteredData?.map((item, idx) => ({
+ const extractedArray = data?.data?.rows?.map((item, idx) => ({
// id: item?.id,
"Sr.no": (
diff --git a/src/Pages/WithDrawal/DrawalRequest/PendingRequest.jsx b/src/Pages/WithDrawal/DrawalRequest/PendingRequest.jsx
index 9bb35bf..21bd4f7 100644
--- a/src/Pages/WithDrawal/DrawalRequest/PendingRequest.jsx
+++ b/src/Pages/WithDrawal/DrawalRequest/PendingRequest.jsx
@@ -29,15 +29,12 @@ const PendingRequest = () => {
const toast = useToast();
const { slideFromRight, pendingRequest, setPendingRequest } =
useContext(GlobalStateContext);
- const [searchTerm, setSearchTerm] = useState("");
const [isLoading, setIsLoading] = useState(true);
const [deleteAlert, setDeleteAlert] = useState(false);
const [actionId, setActionId] = useState(false);
const [mouseEntered, setMouseEntered] = useState(false);
const [mouseEnteredId, setMouseEnteredId] = useState("");
- const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
- const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
const formatDate = (date) => {
return new Date(date).toLocaleDateString('en-GB', {
@@ -58,12 +55,41 @@ const PendingRequest = () => {
onClose: onRejectClose,
} = useDisclosure();
+
+
+
+
+ // =========================== [Use State] =============================
+ const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
+ const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
+ const [searchTerm, setSearchTerm] = useState("");
+ const [debouncedSearchTerm, setDebouncedSearchTerm] = useState("");
+
+ // Debounce the search term to avoid making a request on every keystroke
+ useEffect(() => {
+ const handler = setTimeout(() => {
+ setDebouncedSearchTerm(searchTerm);
+ }, 500); // Adjust delay as needed
+ return () => {
+ clearTimeout(handler);
+ };
+ }, [searchTerm]);
+
+
+
const {
data,
isLoading: drawalRequestLoading,
error,
refetch
- } = useGetDrawalRequestQuery({ page: currentPage, size: pageSize });
+ } = useGetDrawalRequestQuery({
+ page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
+ size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
+ search: debouncedSearchTerm,
+ },
+ {
+ skip: debouncedSearchTerm === "" && searchTerm !== "", // Skip if search is empty and it's not the initial request
+ });
@@ -122,7 +148,7 @@ const PendingRequest = () => {
- const extractedArray = filteredData?.map((item, idx) => ({
+ const extractedArray = data?.data?.rows?.map((item, idx) => ({
// id: item?.id,
"Sr.no": (
{
const toast = useToast();
const { slideFromRight, viewHistory, setViewHistory } =
useContext(GlobalStateContext);
- const [searchTerm, setSearchTerm] = useState("");
const [isLoading, setIsLoading] = useState(true);
const [deleteAlert, setDeleteAlert] = useState(false);
const [actionId, setActionId] = useState(false);
@@ -56,15 +55,39 @@ const ViewHistory = () => {
});
};
+
+
+
+ // =========================== [Use State] =============================
const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
+ const [searchTerm, setSearchTerm] = useState("");
+ const [debouncedSearchTerm, setDebouncedSearchTerm] = useState("");
+
+ // Debounce the search term to avoid making a request on every keystroke
+ useEffect(() => {
+ const handler = setTimeout(() => {
+ setDebouncedSearchTerm(searchTerm);
+ }, 500); // Adjust delay as needed
+ return () => {
+ clearTimeout(handler);
+ };
+ }, [searchTerm]);
+
const {
data,
error,
isLoading: drawalHistoryLoading,
refetch
- } = useGetDrawalHistoryQuery({ page: currentPage, size: pageSize });
+ } = useGetDrawalHistoryQuery({
+ page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
+ size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
+ search: debouncedSearchTerm,
+ },
+ {
+ skip: debouncedSearchTerm === "" && searchTerm !== "", // Skip if search is empty and it's not the initial request
+ });
// Use useEffect to refetch data when the component mounts
diff --git a/src/Services/ban.investor.service.js b/src/Services/ban.investor.service.js
index fb525aa..beaba8f 100644
--- a/src/Services/ban.investor.service.js
+++ b/src/Services/ban.investor.service.js
@@ -20,18 +20,18 @@ export const banInvestorDetails = createApi({
getUnbanInvestor: builder.query({
- query: ({ page, size, search, kycStatus, country }) => {
+ query: ({ page, size, search, userStatus, KYCStatus, country_xid }) => {
// Start with the base URL, including searchTerm
- let baseURL = `/investorDetails/admin/getAllUnbanned?search=${search || ""}`;
+ let baseURL = `/investorDetails/admin/getAllUnbanned?search=${search || ""}&userStatus=${userStatus ||""}&KYCStatus=${KYCStatus || ""}&country_xid=${country_xid||""}`;
// Conditionally append kycStatus if it's defined
- if (kycStatus) {
- baseURL += `&kycStatus=${kycStatus}`;
+ if (KYCStatus) {
+ baseURL += `&KYCStatus=${KYCStatus}`;
}
// Conditionally append country if it's defined
- if (country) {
- baseURL += `&country=${country}`;
+ if (country_xid) {
+ baseURL += `&country_xid=${country_xid}`;
}
// Conditionally append page and size parameters if they are defined
@@ -41,13 +41,33 @@ export const banInvestorDetails = createApi({
return baseURL;
},
- providesTags: ["getBanInvestor"],
+ providesTags: ["getUnbanInvestor"],
}),
getbanInvestor: builder.query({
- query: () => `/investorDetails/admin/getAllBanned`,
+ query: ({ page, size, search, userStatus, KYCStatus, country_xid }) => {
+ // Start with the base URL, including searchTerm
+ let baseURL = `/investorDetails/admin/getAllBanned?search=${search || ""}&userStatus=${userStatus ||""}&KYCStatus=${KYCStatus || ""}&country_xid=${country_xid||""}`;
+
+ // Conditionally append kycStatus if it's defined
+ if (KYCStatus) {
+ baseURL += `&KYCStatus=${KYCStatus}`;
+ }
+
+ // Conditionally append country if it's defined
+ if (country_xid) {
+ baseURL += `&country_xid=${country_xid}`;
+ }
+
+ // Conditionally append page and size parameters if they are defined
+ if (page !== undefined && size !== undefined) {
+ baseURL += `&page=${page}&size=${size}`;
+ }
+
+ return baseURL;
+ },
providesTags: ["getBanInvestor"],
}),
diff --git a/src/Services/delete.request.service.js b/src/Services/delete.request.service.js
index 61e657f..a8aabb5 100644
--- a/src/Services/delete.request.service.js
+++ b/src/Services/delete.request.service.js
@@ -41,8 +41,14 @@ export const deleteRequest = createApi({
}),
getDeleteHistory: builder.query({
- query: () => `/account/admin/history`,
- providesTags: ["getDeleteHistory"],
+ query: ({ page, size, search }) => {
+ let baseURL = `/account/admin/history?search=${search || ""}`;
+ if (page !== undefined && size !== undefined) {
+ baseURL += `&page=${page}&size=${size}`; // Only add pagination if both are defined
+ }
+ return baseURL;
+ },
+ providesTags: ["getDrawalRequest"],
}),
}),
});
diff --git a/src/Services/deposit.request.service.js b/src/Services/deposit.request.service.js
index 65a77fb..1a8ccd2 100644
--- a/src/Services/deposit.request.service.js
+++ b/src/Services/deposit.request.service.js
@@ -11,10 +11,30 @@ export const depositRequest = createApi({
baseQuery: baseQuery,
tagTypes: ["getDepositRequest", "getDepositHistory"],
endpoints: (builder) => ({
+
+
+
+
getDepositRequest: builder.query({
- query: ({page, size}) => `/deposit/admin/pending-requests?page=${page}&size=${size}`,
+ query: ({ page, size, search, userStatus, KYCStatus, country_xid }) => {
+ // Start with the base URL, including searchTerm
+ let baseURL = `/deposit/admin/pending-requests?search=${search || ""}`;
+
+ // Conditionally append page and size parameters if they are defined
+ if (page !== undefined && size !== undefined) {
+ baseURL += `&page=${page}&size=${size}`;
+ }
+
+ return baseURL;
+ },
providesTags: ["getDepositRequest"],
}),
+
+
+
+
+
+
getDepositRequestById: builder.query({
query: (id) => `/deposit/admin/getById/${id}`,
@@ -38,10 +58,30 @@ export const depositRequest = createApi({
invalidatesTags: ["getDepositRequest", "getDepositHistory"],
}),
+
+
+
getDepositHistory: builder.query({
- query: ({page, size}) => `/deposit/admin/history?page=${page}&size=${size}`,
+ query: ({ page, size, search, userStatus, KYCStatus, country_xid }) => {
+ // Start with the base URL, including searchTerm
+ let baseURL = `/deposit/admin/history?search=${search || ""}`;
+
+ // Conditionally append page and size parameters if they are defined
+ if (page !== undefined && size !== undefined) {
+ baseURL += `&page=${page}&size=${size}`;
+ }
+
+ return baseURL;
+ },
providesTags: ["getDepositHistory"],
}),
+
+
+
+
+
+
+
}),
});
diff --git a/src/Services/drawal.request.service.js b/src/Services/drawal.request.service.js
index 11c87c1..5ed9e3b 100644
--- a/src/Services/drawal.request.service.js
+++ b/src/Services/drawal.request.service.js
@@ -12,8 +12,17 @@ export const drawalRequest = createApi({
tagTypes: ["getDrawalRequest", "getDepositHistory"],
endpoints: (builder) => ({
+
+
+
getDrawalRequest: builder.query({
- query: () => `/withdrawal/admin`,
+ query: ({ page, size, search }) => {
+ let baseURL = `/withdrawal/admin?search=${search || ""}`;
+ if (page !== undefined && size !== undefined) {
+ baseURL += `&page=${page}&size=${size}`; // Only add pagination if both are defined
+ }
+ return baseURL;
+ },
providesTags: ["getDrawalRequest"],
}),
@@ -39,10 +48,23 @@ export const drawalRequest = createApi({
invalidatesTags: ["getDepositRequest", "getDepositHistory"],
}),
+
getDrawalHistory: builder.query({
- query: () => `/withdrawal/admin/history`,
+ query: ({ page, size, search, userStatus, KYCStatus, country_xid }) => {
+ // Start with the base URL, including searchTerm
+ let baseURL = `/withdrawal/admin/history?search=${search || ""}`;
+
+ // Conditionally append page and size parameters if they are defined
+ if (page !== undefined && size !== undefined) {
+ baseURL += `&page=${page}&size=${size}`;
+ }
+
+ return baseURL;
+ },
providesTags: ["getDepositHistory"],
}),
+
+
}),
});
diff --git a/src/Services/investor.details.service.js b/src/Services/investor.details.service.js
index f01c239..9de2784 100644
--- a/src/Services/investor.details.service.js
+++ b/src/Services/investor.details.service.js
@@ -28,6 +28,9 @@ export const investorDetails = createApi({
}),
+
+
+
// =====[get investment details ]
getInvestorsDetailsById: builder.query({
query: (id) => `/investorDetails/admin/byId/${id}`,