From 46d8031d4d961ead9e3378c7dbd7273b493fde35 Mon Sep 17 00:00:00 2001 From: "Siddhesh.More" Date: Wed, 21 Aug 2024 16:04:05 +0530 Subject: [PATCH] deposite api --- src/App.jsx | 1 + src/Contexts/GlobalStateProvider.jsx | 33 ++--------------- .../InvestorDetails/InvestorDetails.jsx | 2 +- .../InvestorDetails/ProfileView.jsx | 13 +++++-- .../InvestorDetails/ViewInvestorDetails.jsx | 36 +++++++++---------- 5 files changed, 30 insertions(+), 55 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index e163d62..22329ab 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -58,6 +58,7 @@ const App = () => { // isOnline ? ( // isAuthenticate || isAuthenticatedInCookie === "true" ? ( localStorage.getItem('accessToken') && localStorage.getItem('refreshToken') ? ( + // true ? ( ) : ( diff --git a/src/Contexts/GlobalStateProvider.jsx b/src/Contexts/GlobalStateProvider.jsx index aac69de..8a1b5f2 100644 --- a/src/Contexts/GlobalStateProvider.jsx +++ b/src/Contexts/GlobalStateProvider.jsx @@ -3,7 +3,7 @@ import React, { useState } from "react"; import GlobalStateContext from "./GlobalStateContext"; import { effect, useColorMode } from "@chakra-ui/react"; import { v4 as uuidv4 } from "uuid"; -import { TbClock2 } from "react-icons/tb"; +import { TbClock2 } from "react-icons/tb"; import { CiWallet } from "react-icons/ci"; import { HiOutlineReceiptPercent } from "react-icons/hi2"; import { IoMdQrScanner } from "react-icons/io"; @@ -713,36 +713,7 @@ const GlobalStateProvider = ({ children }) => { ]); const [viewInvestor, setViewInvestor] = useState([ - { - id: 1, - dealId: "UWE3424992", - dealName: "KKR Private Equity Fund", - sponsorName: "KKR", - investAmount: "$100,000", - holdingPeriod: "4-5 years", - estimatedReturn: "50-60%", - kycStatus: "Open", - }, - { - id: 2, - dealId: "UWE3424992", - dealName: "Blackstone Real Estate Income Trust", - sponsorName: "Blackstone", - investAmount: "$100,000", - holdingPeriod: "4-5 years", - estimatedReturn: "50-60%", - kycStatus: "Pending", - }, - { - id: 3, - dealId: "UWE3424992", - dealName: "J.P. Morgan", - sponsorName: "J.P. Morgan", - investAmount: "$100,000", - holdingPeriod: "4-5 years", - estimatedReturn: "50-60%", - kycStatus: "Closed", - }, + ]); const [transaction, setTransaction] = useState([ { diff --git a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx index e785d4e..132e646 100644 --- a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx +++ b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx @@ -142,7 +142,7 @@ const InvestorDetails = () => { {item.clientReference_id} - + ), "First Name": ( diff --git a/src/Pages/Investor_Management/InvestorDetails/ProfileView.jsx b/src/Pages/Investor_Management/InvestorDetails/ProfileView.jsx index 08f3c9c..7372d33 100644 --- a/src/Pages/Investor_Management/InvestorDetails/ProfileView.jsx +++ b/src/Pages/Investor_Management/InvestorDetails/ProfileView.jsx @@ -25,7 +25,7 @@ import { useGetInvestorsDetailsByIdQuery } from "../../../Services/investor.deta const ProfileView = () => { const navigate = useNavigate(); const params = useParams(); - const { InvestorDetails } = useContext(GlobalStateContext); + const { InvestorDetails,setViewInvestor } = useContext(GlobalStateContext); const { reset } = useForm(); // assuming react-hook-form const id = params?.id; @@ -36,6 +36,13 @@ const ProfileView = () => { const foundObject = data?.data; + + useEffect(()=>{ + setViewInvestor(data?.data?.protfolio) + },[data]) + + + @@ -237,7 +244,7 @@ const ProfileView = () => { View Details { Portfolio { const [actionId, setActionId] = useState(false); const [mouseEntered, setMouseEntered] = useState(false); const [mouseEnteredId, setMouseEnteredId] = useState(""); - + useEffect(() => { // Simulate loading const timer = setTimeout(() => { @@ -70,21 +70,15 @@ const ViewInvestorDetails = () => { "Action", ]; - const handleUpdateStatus = debounce((id) => { - setViewInvestor((prevData) => - prevData.map((viewInvestor) => - viewInvestor.id === id ? { ...viewInvestor } : viewInvestor - ) - ); - toast({ - render: () => , - }); - }, 300); +console.log(viewInvestor); + + + // ====================================================[Table Filter]================================================================ const filteredData = viewInvestor?.filter((item) => { // Filter by name (case insensitive) - const name = item.dealId; + const name = item.sponsorName; const searchLower = searchTerm.toLowerCase(); const nameMatches = name?.toLowerCase().includes(searchLower); @@ -100,6 +94,8 @@ const ViewInvestorDetails = () => { return nameMatches; }); + console.log(filteredData); + const extractedArray = filteredData?.map((item) => ({ id: item?.id, "Sr N/O": ( @@ -109,13 +105,13 @@ const ViewInvestorDetails = () => { color={"gray.600"} className="d-flex align-items-center fw-bold web-text-small" > - {item.id} + {item.IOId} ), "Deal Name": ( - {item.dealName} + {item.investmentTypeName} ), @@ -129,21 +125,21 @@ const ViewInvestorDetails = () => { "Investment Amount": ( - {item.investAmount} + {item.investedAmount} ), "Holding Period": ( - {item.holdingPeriod} + {item.Investor_Holidings} ), "Estimated return": ( - {item.estimatedReturn} + {item.TotalReturn} ), @@ -153,16 +149,16 @@ const ViewInvestorDetails = () => { fontWeight={"500"} textTransform={"none"} color={ - item.kycStatus === "Open" + item.statusAdmin === "Open" ? "green" - : item.kycStatus === "Pending" + : item.statusAdmin === "Pending" ? "blue" : "red" } px={2} py={0.5} > - {item.kycStatus} + {item.statusAdmin} ),