This commit is contained in:
YasinShaikh123
2024-10-18 20:12:21 +05:30
25 changed files with 639 additions and 226 deletions

View File

@@ -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.": (
<Text

View File

@@ -21,6 +21,7 @@ import Pagination from "../../../../Components/Pagination";
import ToastBox from "../../../../Components/ToastBox";
import ReasonBanModal from "./ReasonBanModal";
import { useGetbanInvestorQuery } from "../../../../Services/ban.investor.service";
import { TABLE_PAGINATION } from "../../../../Constants/Paginations";
const formatDate = (date) => 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": (
<Text
@@ -130,81 +150,82 @@ const BankInvestor = () => {
{item.id}
</Text>
),
"Date": (
Date: (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{formatDate(item?.date)}
{formatDate(item?.date)}
</Text>
</Box>
),
"Client ID": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.clientReference_id}
{item?.clientReference_id}
</Text>
</Box>
),
"First Name": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.firstName}
{item?.firstName}
</Text>
</Box>
),
"Last Name": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.lastName}
{item?.lastName}
</Text>
</Box>
),
Country: (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.country}
{item?.country}
</Text>
</Box>
),
"Phone Number": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.phoneNumber}
{item?.phoneNumber}
</Text>
</Box>
),
"E-mail ID": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.emailAddress}
{item?.emailAddress}
</Text>
</Box>
),
"KYC Status": (
<Box w={"auto"} isTruncated={true}>
<Badge
fontWeight={"500"}
textTransform={"none"}
color={item?.KYCStatus === false ? "red" : "blue"}
px={2}
py={0.5}
variant={'ghost'}
>
{item?.KYCStatus === true ? "Completed" : "Incompleted"}
</Badge>
<Badge
fontWeight={"500"}
textTransform={"none"}
color={item?.KYCStatus === false ? "red" : "blue"}
px={2}
py={0.5}
variant={"ghost"}
>
{item?.KYCStatus === true ? "Completed" : "Incompleted"}
</Badge>
</Box>
),
Action: (
<Box w={"auto"} isTruncated={true}>
<Badge
cursor={"pointer"}
cursor={"pointer"}
fontWeight={"500"}
textTransform={"none"}
colorScheme={"red"}
px={2}
py={0.5}
onClick={()=>{
setActionId(item?.id)
onOpen()}}
onClick={() => {
setActionId(item?.id);
onOpen();
}}
>
Ban Investor
</Badge>
@@ -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)}
/>
<HStack display={"flex"} alignItems={"center"}>
{/* <Select
focusBorderColor="green.500"
size={"sm"}
fontSize={"xs"}
cursor={"pointer"}
onChange={(e) => setStatus(e.target.value)}
value={status}
>
<option value="" defaultValue={""} disabled hidden>
Status
</option>
<option value="">Status</option>
<option value="0">Ban</option>
<option value="1">UnBan</option>
</Select> */}
<Select
focusBorderColor="green.500"
size={"sm"}
fontSize={"xs"}
cursor={"pointer"}
placeholder='KYC Status'
w={180}
rounded={"md"}
onChange={(e) => setKyc(e.target.value)}
value={kyc}
>
<option value="all">All</option>
<option value="ban">Ban</option>
<option value="unban">UnBan</option>
<option value="" defaultValue={""} disabled hidden>
KYC Status
</option>
<option value="">KYC Status</option>
<option value="0">Incompleted</option>
<option value="1">Completed</option>
</Select>
<Select
focusBorderColor="green.500"
size={"sm"}
fontSize={"xs"}
cursor={"pointer"}
placeholder='Country'
w={180}
rounded={"md"}
onChange={(e) => setCountry(e.target.value)}
value={country}
>
<option value="all">All</option>
<option value="ban">Ban</option>
<option value="unban">UnBan</option>
<option value="" defaultValue={""} disabled hidden>
Country
</option>
<option value="">All</option>
<option value="1">Behrain</option>
<option value="2">Kuwait</option>
<option value="3">Oman</option>
<option value="4">Qatar</option>
<option value="5">Saudi arabia</option>
<option value="6">United arab emirates</option>
</Select>
</HStack>
</HStack>
@@ -302,11 +352,7 @@ const BankInvestor = () => {
alertHandler={handleDelete}
isLoading={isLoading}
/>
<ReasonBanModal
isOpen={isOpen}
onClose={onClose}
id={actionId}
/>
<ReasonBanModal isOpen={isOpen} onClose={onClose} id={actionId} />
</Box>
);
};

View File

@@ -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)}
</Text>
),
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"}
</Badge>
@@ -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)}
/>
<HStack display={"flex"} alignItems={"center"}>
{/* <Select
focusBorderColor="green.500"
size={"sm"}
fontSize={"xs"}
cursor={"pointer"}
onChange={(e) => setStatus(e.target.value)}
value={status}
>
<option value="" defaultValue={""} disabled hidden>
Status
</option>
<option value="">Status</option>
<option value="0">Ban</option>
<option value="1">UnBan</option>
</Select> */}
<Select
focusBorderColor="green.500"
size={"sm"}
fontSize={"xs"}
cursor={"pointer"}
placeholder="KYC Status"
w={180}
rounded={"md"}
onChange={(e) => setKyc(e.target.value)}
value={kyc}
>
<option value="all">All</option>
<option value="ban">Ban</option>
<option value="unban">UnBan</option>
<option value="" defaultValue={""} disabled hidden>
KYC Status
</option>
<option value="">KYC Status</option>
<option value="0">Incompleted</option>
<option value="1">Completed</option>
</Select>
<Select
focusBorderColor="green.500"
size={"sm"}
fontSize={"xs"}
cursor={"pointer"}
placeholder="Country"
w={180}
rounded={"md"}
onChange={(e) => setCountry(e.target.value)}
value={country}
>
<option value="all">All</option>
<option value="ban">Ban</option>
<option value="unban">UnBan</option>
<option value="" defaultValue={""} disabled hidden>
Country
</option>
<option value="">All</option>
<option value="1">Behrain</option>
<option value="2">Kuwait</option>
<option value="3">Oman</option>
<option value="4">Qatar</option>
<option value="5">Saudi arabia</option>
<option value="6">United arab emirates</option>
</Select>
</HStack>
</HStack>

View File

@@ -322,6 +322,7 @@ const Notification = () => {
onSubmit={handleSubmit(onSubmit)}
btnLoading={isLoading}
>
<Box overflow={'scroll'} h={'58vh'}>
<NormalTable
centered={true}
emptyMessage={`We don't have any Sponers `}
@@ -332,6 +333,7 @@ const Notification = () => {
selectedRadio={selectedRadio}
showRadioButton={true}
/>
</Box>
</FormInputMain>
</Box>
);

View File

@@ -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": (
<Text

View File

@@ -45,7 +45,6 @@ const DepositHistory = () => {
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": (
<Text
w={"10px"}

View File

@@ -1,28 +1,37 @@
import { Badge, Box, Button, FormControl, FormHelperText, FormLabel, HStack, Text } from '@chakra-ui/react'
import React, { useState } from 'react'
import { OPACITY_ON_LOAD } from '../../Layout/animations'
import NormalTable from '../../Components/DataTable/NormalTable';
import { useGetUnbanInvestorQuery } from '../../Services/ban.investor.service';
import { formatDate, generateSerialNumber } from '../../Constants/Constants';
import { TABLE_PAGINATION } from '../../Constants/Paginations';
import ReactQuill from 'react-quill';
import 'react-quill/dist/quill.snow.css'; // Importing the Quill snow theme
import {
Badge,
Box,
Button,
FormControl,
FormHelperText,
FormLabel,
HStack,
Input,
Text,
useToast,
} from "@chakra-ui/react";
import React, { useState } from "react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
import NormalTable from "../../Components/DataTable/NormalTable";
import { useGetUnbanInvestorQuery } from "../../Services/ban.investor.service";
import { formatDate, generateSerialNumber } from "../../Constants/Constants";
import { TABLE_PAGINATION } from "../../Constants/Paginations";
import ReactQuill from "react-quill";
import "react-quill/dist/quill.snow.css"; // Importing the Quill snow theme
import { useSendCustomEmailMutation } from "../../Services/contact.service";
import { EmailIcon } from "@chakra-ui/icons";
import ToastBox from "../../Components/ToastBox";
const EmailNotification = () => {
const [isLoading, setIsLoading] = useState(false);
const [ selectedRadio, setSelectedRadio] = useState([])
const [value, setValue] = useState('');
const [isLoading, setIsLoading] = useState(false);
const [selectedRadio, setSelectedRadio] = useState([]);
const [subject, setSubject] = useState("");
const [value, setValue] = useState(""); // Quill content (body)
const toast = useToast();
const {
data : investorDetails,
isLoading: investorDetailsLoading,
refetch,
} = useGetUnbanInvestorQuery();
const [sendCustomNotification] = useSendCustomEmailMutation();
// ====================================================[Table Setup]================================================================
// ===========================[Table Setup]==============================
const tableHeadRow = [
"Sr N/O",
"Date",
@@ -35,11 +44,17 @@ const EmailNotification = () => {
"KYC Status",
];
const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
const {
data: investorDetails,
isLoading: investorDetailsLoading,
refetch,
} = useGetUnbanInvestorQuery({
page: currentPage, // Omit pagination for search
size: 10000, // Omit pagination for search
});
const extractedArray = investorDetails?.data?.rows?.map((item, idx) => ({
id: item?.principal_xid,
@@ -50,7 +65,7 @@ const EmailNotification = () => {
color={"gray.600"}
className="d-flex align-items-center fw-bold web-text-small"
>
{generateSerialNumber(idx,currentPage, pageSize )}
{generateSerialNumber(idx, currentPage, pageSize)}
</Text>
),
Date: (
@@ -110,7 +125,7 @@ const EmailNotification = () => {
color={item?.KYCStatus === false ? "red" : "blue"}
px={2}
py={0.5}
variant={'ghost'}
variant={"ghost"}
>
{item?.KYCStatus === true ? "Completed" : "Incompleted"}
</Badge>
@@ -118,71 +133,171 @@ const EmailNotification = () => {
),
}));
console.log(value);
const modules = {
toolbar: [
[{ 'header': '1'}, { 'header': '2'}, { 'font': [] }],
[{size: []}],
['bold', 'italic', 'underline', 'strike', 'blockquote'],
[{'list': 'ordered'}, {'list': 'bullet'}],
// ['link', 'image', 'video'],
['clean']
// [{ header: "1" }, { header: "2" },
// // { font: [] }
// ],
// [{ size: [] }],
["bold", "italic", "underline", "strike", "blockquote"],
[{ list: "ordered" }, { list: "bullet" }],
["clean"],
],
};
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"} pb={14} >
// Main submission logic
const handleSend = async (e) => {
e.preventDefault(); // Prevent default form submission
if (!subject || !value) {
toast({
render: () => (
<ToastBox status={"error"} message={"Subject or email body cannot be empty"} />
),
});
return;
}
if (selectedRadio.length === 0) {
toast({
render: () => (
<ToastBox status={"error"} message={"Please select at least one recipient"} />
),
});
return;
}
setIsLoading(true);
const emailPayload = {
subject,
body: value,
principal_xid: selectedRadio,
};
{/* <Box py={4}> */}
<FormControl mb={6}>
<HStack py={4} pb={3} w={'100%'} justifyContent={'space-between'} alignItems={'center'}>
<Text as={'span'} fontSize={'sm'}>Customize your email</Text>
<Button rounded={'xs'} size={'sm'}>Preview</Button>
</HStack>
<ReactQuill
theme="snow"
value={value}
onChange={setValue}
modules={modules}
placeholder="Start typing here..."
style={{
// height: '400px',
// borderRadius: '8px',
// border: '1px solid #ddd',
// padding: '10px',
// backgroundColor: '#f9f9f9' ,
}}
/>
<FormHelperText fontSize={'xs'}>We'll never share your email.</FormHelperText>
</FormControl>
try {
const res = await sendCustomNotification(emailPayload)
console.log(res);
if (res?.error) {
toast({
render: () => (
<ToastBox status={"error"} message={res?.error?.data?.message} />
),
});
setIsLoading(false)
}else if(res?.data){
toast({
render: () => (
<ToastBox message={res?.data?.message} />
),
});
setIsLoading(false)
setSubject("")
setValue("")
setSelectedRadio([])
}else{
toast({
render: () => (
<ToastBox status={'error'} message={"Something went wrong"} />
),
});
setIsLoading(false)
}
{/* <Box mt={4}>
<strong>Output:</strong>
<Box border="1px solid #ddd" p={2} mt={2} dangerouslySetInnerHTML={{ __html: value }} />
</Box> */}
{/* </Box> */}
} catch (error) {
}
};
return (
<Box
as={"form"}
{...OPACITY_ON_LOAD}
overflowY={"scroll"}
height={"100vh"}
pb={14}
pt={4}
>
<FormControl mb={0}>
{/* <HStack
py={4}
pb={3}
w={"100%"}
justifyContent={"space-between"}
alignItems={"center"}
>
<Text as={"span"} fontSize={"sm"}>
Customize your email
</Text>
</HStack> */}
<FormControl isRequired mb={3} p={1}>
<FormLabel fontSize={"sm"}>Subject</FormLabel>
<Input
size={"md"}
value={subject}
onChange={(e) => setSubject(e.target.value)}
focusBorderColor="forestGreen.300"
rounded={0.5}
type="text"
/>
{/* <FormHelperText>Entered subject will be reflected on emails subject body.</FormHelperText> */}
</FormControl>
<FormControl minH={400} isRequired mb={3} p={1}>
<FormLabel fontSize={"sm"}>Create Custom body</FormLabel>
<ReactQuill
theme="snow"
style={{
height:300
}}
value={value}
onChange={setValue}
modules={modules}
placeholder="Start typing here..."
/>
</FormControl>
{/* <FormHelperText fontSize={"xs"}>
We'll never share your email.
</FormHelperText> */}
</FormControl>
<Box overflow={'scroll'} h={'58vh'}>
<NormalTable
centered={true}
emptyMessage={`We don't have any Sponers `}
emptyMessage={`We don't have any Sponsors`}
tableHeadRow={tableHeadRow}
data={extractedArray}
// isLoading={isLoading}
setSelectedRadio={setSelectedRadio}
selectedRadio={selectedRadio}
showRadioButton={true}
/>
</Box>
)
}
</Box>
export default EmailNotification
<HStack justifyContent={"flex-end"} px={2}>
<Button
rightIcon={<EmailIcon />}
rounded={"sm"}
size={"sm"}
colorScheme="forestGreen"
type="submit"
isLoading={isLoading}
onClick={handleSend}
>
Send Email
</Button>
</HStack>
</Box>
);
};
export default EmailNotification;

View File

@@ -42,9 +42,6 @@ import { exportToExcel, generateSerialNumber } from "../../Constants/Constants";
import { LuFileSpreadsheet } from "react-icons/lu";
const FawateerRequest = () => {
const navigate = useNavigate();
const toast = useToast();

View File

@@ -202,7 +202,7 @@ const ApproveHistory = () => {
fontWeight={"500"}
className="d-flex align-items-center web-text-small"
>
<Badge
{item?.spportFile_path&&<Badge
px={2}
py={0.5}
textTransform={"inherit"}
@@ -223,7 +223,7 @@ const ApproveHistory = () => {
</Box>
<ExternalLinkIcon />
</Link>
</Badge>
</Badge>}
</Text>
),
Status: (

View File

@@ -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": (
@@ -223,7 +223,7 @@ import {
fontWeight={"500"}
className="d-flex align-items-center web-text-small"
>
<Badge
{item?.spportFile_path&&<Badge
px={2}
py={0.5}
textTransform={"inherit"}
@@ -244,7 +244,7 @@ import {
</Box>
<ExternalLinkIcon />
</Link>
</Badge>
</Badge>}
</Text>
),
Status: (

View File

@@ -324,6 +324,8 @@ const IOCashDetails = () => {
variant={"outline"}
rounded={"sm"}
fontSize={"xs"}
isDisabled={ioCashExporteDetails?.length === 0}
>
Export xls
</Button>

View File

@@ -236,6 +236,7 @@ const IONAVDetails = () => {
variant={"outline"}
rounded={"sm"}
fontSize={"xs"}
isDisabled={ioNavExport?.length === 0}
>
Export xls
</Button>

View File

@@ -504,6 +504,7 @@ console.log(IODetails?.investors);
fontSize={"xs"}
w={100}
me={2}
isDisabled={exportInvestorDetails?.length === 0}
>
Export xls
</Button>

View File

@@ -372,6 +372,8 @@ const InvestorDetails = () => {
fontSize={"xs"}
w={100}
me={2}
isDisabled={exportInvestor?.length === 0}
>
Export xls
</Button>

View File

@@ -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": (
<Text

View File

@@ -30,7 +30,6 @@ const ViewHistory = () => {
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

View File

@@ -213,11 +213,11 @@ export const nav = [
path: "/notification",
icon: MdNotificationsNone,
},
// {
// title: "Email Notification",
// path: "/email",
// icon: AtSignIcon,
// },
{
title: "Email Notification",
path: "/email",
icon: AtSignIcon,
},
{
title: "Contact Details",
path: "/contact",

View File

@@ -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"],
}),

View File

@@ -51,9 +51,26 @@ export const contact = createApi({
body: data,
}),
}),
sendCustomEmail : builder.mutation({
query: (data) => ({
url: `/notification/admin/send-custom-email`,
method: "POST",
body: data,
}),
}),
}),
});
// Export hooks for usage in functional components
export const { useGetContactQuery, useUpdateContactMutation, useSendNotificationMutation } = contact;
export const { useGetContactQuery, useUpdateContactMutation, useSendNotificationMutation, useSendCustomEmailMutation } = contact;

View File

@@ -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"],
}),
}),
});

View File

@@ -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"],
}),
}),
});

View File

@@ -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"],
}),
}),
});

View File

@@ -15,7 +15,7 @@ export const fawateerRequest = createApi({
getFawateerRequest: builder.query({
query: ({ page, size, searchTerm }) => {
let baseURL = `/fawateer/admin/Pending?search_data=${searchTerm || ""}`;
let baseURL = `/fawateer/admin/Pending?search=${searchTerm || ""}`;
if (page !== undefined && size !== undefined) {
baseURL += `&page=${page}&size=${size}`; // Only add pagination if both are defined
}
@@ -41,7 +41,7 @@ export const fawateerRequest = createApi({
getFawateerForMakerRequest: builder.query({
query: ({ page, size, searchTerm }) => {
let baseURL = `/fawateer/admin?search_data=${searchTerm || ""}`;
let baseURL = `/fawateer/admin?search=${searchTerm || ""}`;
if (page !== undefined && size !== undefined) {
baseURL += `&page=${page}&size=${size}`; // Only add pagination if both are defined
}

View File

@@ -28,6 +28,9 @@ export const investorDetails = createApi({
}),
// =====[get investment details ]
getInvestorsDetailsById: builder.query({
query: (id) => `/investorDetails/admin/byId/${id}`,

View File

@@ -328,7 +328,7 @@ export const ioService = createApi({
getSponserMaster: builder.query({
query: ({ page, size, searchTerm }) => {
let baseURL = `/sponsor/admin/?search_data=${searchTerm || ""}`;
let baseURL = `/sponsor/admin/?search=${searchTerm || ""}`;
if (page !== undefined && size !== undefined) {
baseURL += `&page=${page}&size=${size}`; // Only add pagination if both are defined
}