diff --git a/src/Components/DataTable/NormalTable.jsx b/src/Components/DataTable/NormalTable.jsx index 5243c1d..25028cb 100644 --- a/src/Components/DataTable/NormalTable.jsx +++ b/src/Components/DataTable/NormalTable.jsx @@ -30,7 +30,7 @@ const DataTable = ({ ? `${(100 / Object.keys(data[0]).length).toFixed(2)}%` : "auto"; return ( - + {data?.length === 0 ? ( ) : ( diff --git a/src/Pages/Deposit/DepositViewHistory/DepositHistory.jsx b/src/Pages/Deposit/DepositViewHistory/DepositHistory.jsx index 9422bb2..9d438b9 100644 --- a/src/Pages/Deposit/DepositViewHistory/DepositHistory.jsx +++ b/src/Pages/Deposit/DepositViewHistory/DepositHistory.jsx @@ -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": ( - - {index + 1} + const extractedArray = filteredData?.map((item, index) => ({ + "Sr.no": ( + + {index + 1} + + ), + "Client ID": ( + + {item?.clientReference_id} + + ), + "First Name": ( + + + {item?.firstName} - ), - "Client ID": ( - - {item?.clientReference_id} + + ), + "Last Name": ( + + + {item?.lastName} - ), - "First Name": ( - - - {item?.firstName} - - - ), - "Last Name": ( - - - {item?.lastName} - - - ), - Country: ( - - - {item?.countryName} - - - ), - "Phone Number": ( - - - {item?.mobileNumber} - - - ), - "Amount in Investor currency": ( - - - {/* */} - {/* {item?.investorAmount} */} + + ), + Country: ( + + + {item?.countryName} + + + ), + "Phone Number": ( + + + {item?.mobileNumber} + + + ), + "Amount in Investor currency": ( + + {parseFloat(item?.investorAmount || 0).toLocaleString(undefined, { - minimumFractionDigits: 2, - maximumFractionDigits: 2, - })} - {item?.currencyCode} - {/* */} - - - ), - "Deposit Date": ( - - {formatDate(item?.createdAt)} + minimumFractionDigits: 2, + maximumFractionDigits: 2, + })} + + {item?.currencyCode} + - ), - Status: ( - - - {item.transactionStatus} - - - ), - "Supporting's": ( - item.transactionStatus === "Approved" ? + ), + "Deposit Date": ( + + {formatDate(item?.createdAt)} + + ), + Status: ( + + + {item.transactionStatus} + + + ), + "Supporting's": + item.transactionStatus === "Approved" ? ( + {/* {item?.supporting_FileName} */} - - - View - - - - {/* + + View + + + + {/* View */} - - :"" + + + ) : ( + "" ), - })) + })); const handleDelete = () => { const IOtype = investmentType.filter( @@ -308,7 +304,7 @@ const filteredData = data?.data?.rows /> - 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 = () => { ), "Goal Amount": ( - + { ), - "Holding Period": ( + "Closing Date": ( - {item.holdingPeriod ? item.holdingPeriod : "---"} + {/* {item.closingDate ? item.closingDate : "---"} */} + {formatDate(item.closingDate ? item.closingDate : "---")} ), diff --git a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx index 275c2b6..0849835 100644 --- a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx +++ b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx @@ -90,7 +90,7 @@ const InvestorDetails = () => { "E-mail ID", "Investor Type", "KYC Status", - "Status", + // "Status", "Action", ]; @@ -182,7 +182,7 @@ const InvestorDetails = () => { "Investor Type": ( - + {item?.investor_type?.investorTypeName} @@ -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" >