bugs
This commit is contained in:
@@ -30,7 +30,7 @@ const DataTable = ({
|
||||
? `${(100 / Object.keys(data[0]).length).toFixed(2)}%`
|
||||
: "auto";
|
||||
return (
|
||||
<TableContainer overflowX={"hidden"} className="h-auto mb-3 w-100">
|
||||
<TableContainer overflowX={"auto"} className="h-auto mb-3 w-100">
|
||||
{data?.length === 0 ? (
|
||||
<EmptySearchList message={emptyMessage} />
|
||||
) : (
|
||||
|
||||
@@ -28,7 +28,6 @@ import {
|
||||
useGetDepositHistoryQuery,
|
||||
} from "../../../Services/deposit.request.service";
|
||||
|
||||
|
||||
import { ExternalLinkIcon } from "@chakra-ui/icons";
|
||||
import { TABLE_PAGINATION } from "../../../Constants/Paginations";
|
||||
|
||||
@@ -66,15 +65,11 @@ const DepositHistory = () => {
|
||||
isLoading: depositHistoryLoading,
|
||||
} = useGetDepositHistoryQuery({ page: currentPage, size: pageSize });
|
||||
|
||||
|
||||
// Use useEffect to refetch data when the component mounts
|
||||
useEffect(() => {
|
||||
// Use useEffect to refetch data when the component mounts
|
||||
useEffect(() => {
|
||||
refetch();
|
||||
}, [refetch]);
|
||||
|
||||
|
||||
|
||||
|
||||
// ====================================================[Table Setup]================================================================
|
||||
const tableHeadRow = [
|
||||
// "Sr.no",
|
||||
@@ -102,130 +97,132 @@ const DepositHistory = () => {
|
||||
});
|
||||
}, 300);
|
||||
|
||||
const filteredData = data?.data?.rows
|
||||
.filter((item) => {
|
||||
// Filter by name (case insensitive)
|
||||
const name = [item.firstName, item.lastName, item.countryName]
|
||||
.filter(Boolean)
|
||||
.join(" ");
|
||||
const searchLower = searchTerm.toLowerCase();
|
||||
const nameMatches = name.toLowerCase().includes(searchLower);
|
||||
|
||||
// Filter by status (Uncomment and use if needed)
|
||||
// const status = item.status;
|
||||
// const statusLower = status ? "active" : "inactive";
|
||||
|
||||
// const statusMatches =
|
||||
// statusFilter === "all" ||
|
||||
// (statusFilter === "active" && status === true) ||
|
||||
// (statusFilter === "inactive" && status === false);
|
||||
|
||||
|
||||
const filteredData = data?.data?.rows
|
||||
.filter((item) => {
|
||||
// Filter by name (case insensitive)
|
||||
const name = [item.firstName, item.lastName, item.countryName].filter(Boolean).join(' ');
|
||||
const searchLower = searchTerm.toLowerCase();
|
||||
const nameMatches = name.toLowerCase().includes(searchLower);
|
||||
|
||||
// Filter by status (Uncomment and use if needed)
|
||||
// const status = item.status;
|
||||
// const statusLower = status ? "active" : "inactive";
|
||||
|
||||
// const statusMatches =
|
||||
// statusFilter === "all" ||
|
||||
// (statusFilter === "active" && status === true) ||
|
||||
// (statusFilter === "inactive" && status === false);
|
||||
|
||||
return nameMatches;
|
||||
})
|
||||
.sort((b, a) => new Date(a.createdAt) - new Date(b.createdAt));
|
||||
|
||||
return nameMatches;
|
||||
})
|
||||
.sort((b, a) => new Date(a.createdAt) - new Date(b.createdAt));
|
||||
|
||||
// const handleView = (id) => {
|
||||
// setActionId(id);
|
||||
// onViewOpen();
|
||||
// };
|
||||
|
||||
const extractedArray =
|
||||
filteredData?.map((item, index) => ({
|
||||
"Sr.no": (
|
||||
<Text
|
||||
w={"30px"}
|
||||
justifyContent={slideFromRight ? "right" : "left"}
|
||||
as={"span"}
|
||||
color={"teal.900"}
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{index + 1}
|
||||
const extractedArray = filteredData?.map((item, index) => ({
|
||||
"Sr.no": (
|
||||
<Text
|
||||
w={"30px"}
|
||||
justifyContent={slideFromRight ? "right" : "left"}
|
||||
as={"span"}
|
||||
color={"teal.900"}
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{index + 1}
|
||||
</Text>
|
||||
),
|
||||
"Client ID": (
|
||||
<Text
|
||||
w={"60px"}
|
||||
justifyContent={slideFromRight ? "right" : "left"}
|
||||
as={"span"}
|
||||
color={"teal.900"}
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{item?.clientReference_id}
|
||||
</Text>
|
||||
),
|
||||
"First Name": (
|
||||
<Box isTruncated={true} w={"60px"}>
|
||||
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
|
||||
{item?.firstName}
|
||||
</Text>
|
||||
),
|
||||
"Client ID": (
|
||||
<Text
|
||||
w={"60px"}
|
||||
justifyContent={slideFromRight ? "right" : "left"}
|
||||
as={"span"}
|
||||
color={"teal.900"}
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{item?.clientReference_id}
|
||||
</Box>
|
||||
),
|
||||
"Last Name": (
|
||||
<Box w={"70px"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item?.lastName}
|
||||
</Text>
|
||||
),
|
||||
"First Name": (
|
||||
<Box isTruncated={true} w={"60px"}>
|
||||
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
|
||||
{item?.firstName}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Last Name": (
|
||||
<Box w={"70px"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item?.lastName}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
Country: (
|
||||
<Box w={"80px"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item?.countryName}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Phone Number": (
|
||||
<Box w={"80px"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item?.mobileNumber}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Amount in Investor currency": (
|
||||
<Box w={"100px"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{/* <Badge px={2} py={1}> */}
|
||||
{/* {item?.investorAmount} */}
|
||||
</Box>
|
||||
),
|
||||
Country: (
|
||||
<Box w={"80px"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item?.countryName}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Phone Number": (
|
||||
<Box w={"80px"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item?.mobileNumber}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Amount in Investor currency": (
|
||||
<Box
|
||||
w={"100px"}
|
||||
isTruncated={true}
|
||||
display={"flex"}
|
||||
justifyContent={"end"}
|
||||
>
|
||||
<Text as={"span"} color={"teal.900"} textAlign={"right"}>
|
||||
{parseFloat(item?.investorAmount || 0).toLocaleString(undefined, {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
})}
|
||||
<Badge ms={1} colorScheme="green">{item?.currencyCode}</Badge>
|
||||
{/* </Badge> */}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Deposit Date": (
|
||||
<Text
|
||||
w={"60px"}
|
||||
justifyContent={slideFromRight ? "right" : "left"}
|
||||
as={"span"}
|
||||
color={"teal.900"}
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{formatDate(item?.createdAt)}
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
})}
|
||||
<Badge ms={1} colorScheme="green">
|
||||
{item?.currencyCode}
|
||||
</Badge>
|
||||
</Text>
|
||||
),
|
||||
Status: (
|
||||
<Box w={"70px"} isTruncated={true} cursor={"pointer"}>
|
||||
<Text
|
||||
|
||||
as={"span"}
|
||||
color={item.transactionStatus === "Approved" ? "green.500" : "red.500"}
|
||||
fontWeight={700}
|
||||
>
|
||||
{item.transactionStatus}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Supporting's": (
|
||||
item.transactionStatus === "Approved" ? <Text
|
||||
</Box>
|
||||
),
|
||||
"Deposit Date": (
|
||||
<Text
|
||||
w={"60px"}
|
||||
justifyContent={slideFromRight ? "right" : "left"}
|
||||
as={"span"}
|
||||
color={"teal.900"}
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{formatDate(item?.createdAt)}
|
||||
</Text>
|
||||
),
|
||||
Status: (
|
||||
<Box w={"70px"} isTruncated={true} cursor={"pointer"}>
|
||||
<Text
|
||||
as={"span"}
|
||||
color={
|
||||
item.transactionStatus === "Approved" ? "green.500" : "red.500"
|
||||
}
|
||||
fontWeight={700}
|
||||
>
|
||||
{item.transactionStatus}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Supporting's":
|
||||
item.transactionStatus === "Approved" ? (
|
||||
<Text
|
||||
w={"60px"}
|
||||
justifyContent={slideFromRight ? "right" : "left"}
|
||||
as={"span"}
|
||||
@@ -235,33 +232,32 @@ const filteredData = data?.data?.rows
|
||||
>
|
||||
{/* {item?.supporting_FileName} */}
|
||||
<Badge
|
||||
px={2}
|
||||
py={0.5}
|
||||
display={"flex"}
|
||||
alignItems={"center"}
|
||||
textTransform={"inherit"}
|
||||
fontWeight={500}
|
||||
colorScheme={"forestGreen"}
|
||||
>
|
||||
<Link
|
||||
href={import.meta.env.VITE_IMAGE_URL + item?.supporting_FileName}
|
||||
isExternal
|
||||
px={2}
|
||||
py={0.5}
|
||||
display={"flex"}
|
||||
alignItems={"center"}
|
||||
textTransform={"inherit"}
|
||||
fontWeight={500}
|
||||
colorScheme={"forestGreen"}
|
||||
>
|
||||
<Box
|
||||
as="span"
|
||||
cursor={"pointer"}
|
||||
<Link
|
||||
href={import.meta.env.VITE_IMAGE_URL + item?.supporting_FileName}
|
||||
isExternal
|
||||
>
|
||||
View
|
||||
</Box>
|
||||
<ExternalLinkIcon />
|
||||
</Link>
|
||||
{/* <Link to="www.google.com" isExternal>
|
||||
<Box as="span" cursor={"pointer"}>
|
||||
View
|
||||
</Box>
|
||||
<ExternalLinkIcon />
|
||||
</Link>
|
||||
{/* <Link to="www.google.com" isExternal>
|
||||
<Box as="span">View</Box> <ExternalLinkIcon />
|
||||
</Link> */}
|
||||
</Badge>
|
||||
</Text>:""
|
||||
</Badge>
|
||||
</Text>
|
||||
) : (
|
||||
""
|
||||
),
|
||||
}))
|
||||
}));
|
||||
|
||||
const handleDelete = () => {
|
||||
const IOtype = investmentType.filter(
|
||||
@@ -308,7 +304,7 @@ const filteredData = data?.data?.rows
|
||||
/>
|
||||
|
||||
<HStack display={"flex"} alignItems={"center"}>
|
||||
<Pagination
|
||||
<Pagination
|
||||
isLoading={depositHistoryLoading}
|
||||
pageSize={pageSize}
|
||||
setPageSize={setPageSize}
|
||||
|
||||
@@ -45,7 +45,13 @@ import { ImMobile } from "react-icons/im";
|
||||
import { removeTrailingZeros } from "../../../Constants/Constants";
|
||||
// import { debounce } from "./AddIOCharges";
|
||||
|
||||
const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter
|
||||
const formatDate = (date) => {
|
||||
return new Date(date).toLocaleDateString('en-GB', {
|
||||
day: '2-digit',
|
||||
month: '2-digit',
|
||||
year: 'numeric',
|
||||
});
|
||||
}; // Simple date formatter
|
||||
|
||||
const ViewIOTable = () => {
|
||||
const navigate = useNavigate();
|
||||
@@ -72,6 +78,9 @@ const ViewIOTable = () => {
|
||||
size: pageSize,
|
||||
});
|
||||
|
||||
console.log(data);
|
||||
|
||||
|
||||
// ===============================[ Table Header ]
|
||||
const tableHeadRow = [
|
||||
"IO ID",
|
||||
@@ -79,7 +88,7 @@ const ViewIOTable = () => {
|
||||
"Sponsor",
|
||||
"Investment Type",
|
||||
"Goal Amount",
|
||||
"Holding Period",
|
||||
"Closing Date",
|
||||
"IO Status",
|
||||
// "Preview",
|
||||
"Action",
|
||||
@@ -133,7 +142,7 @@ const ViewIOTable = () => {
|
||||
</Box>
|
||||
),
|
||||
"Goal Amount": (
|
||||
<Box w={"100%"} display={"flex"} alignItems={"center"}>
|
||||
<Box w={"100%"}>
|
||||
<Text
|
||||
w={"100%"}
|
||||
textAlign={"center"}
|
||||
@@ -147,10 +156,11 @@ const ViewIOTable = () => {
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Holding Period": (
|
||||
"Closing Date": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
|
||||
{item.holdingPeriod ? item.holdingPeriod : "---"}
|
||||
{/* {item.closingDate ? item.closingDate : "---"} */}
|
||||
{formatDate(item.closingDate ? item.closingDate : "---")}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
|
||||
@@ -90,7 +90,7 @@ const InvestorDetails = () => {
|
||||
"E-mail ID",
|
||||
"Investor Type",
|
||||
"KYC Status",
|
||||
"Status",
|
||||
// "Status",
|
||||
"Action",
|
||||
];
|
||||
|
||||
@@ -182,7 +182,7 @@ const InvestorDetails = () => {
|
||||
"Investor Type": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text as={"span"} >
|
||||
<Badge colorScheme="green" variant={'outline'} fontWeight={"700"} px={2} py={0.5}>
|
||||
<Badge colorScheme={item.ioStatus ? "gray" : "green"} variant={'outline'} fontWeight={"700"} px={2} py={0.5}>
|
||||
{item?.investor_type?.investorTypeName}
|
||||
</Badge>
|
||||
</Text>
|
||||
@@ -207,7 +207,7 @@ const InvestorDetails = () => {
|
||||
as={'span'}
|
||||
fontWeight={"700"}
|
||||
textTransform={"none"}
|
||||
color={item.kycStatus ? "blue.500" : "red.500"}
|
||||
color={item.ioStatus ? "gray.500":item.kycStatus ? "blue.500" : "red.500"}
|
||||
px={2}
|
||||
py={0.5}
|
||||
variant={'solid'}
|
||||
@@ -228,6 +228,7 @@ const InvestorDetails = () => {
|
||||
placement="top"
|
||||
>
|
||||
<Button
|
||||
isDisabled={item.ioStatus}
|
||||
onClick={() => {
|
||||
navigate(`/investor-details/profile-view/${item.id}`);
|
||||
}}
|
||||
|
||||
@@ -184,7 +184,7 @@ const ViewHistory = () => {
|
||||
</Box>
|
||||
),
|
||||
"Amount in Investor currency": (
|
||||
<Box w={"100px"} isTruncated={true}>
|
||||
<Box w={"100px"} isTruncated={true} display={'flex'} justifyContent={'end'}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{parseFloat(item?.investorAmount||0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}<Badge ms={1} colorScheme="green">{item?.currencyCode}</Badge>
|
||||
</Text>
|
||||
|
||||
Reference in New Issue
Block a user