This commit is contained in:
2024-08-22 12:10:11 +05:30
5 changed files with 30 additions and 55 deletions

View File

@@ -58,6 +58,7 @@ const App = () => {
// isOnline ? (
// isAuthenticate || isAuthenticatedInCookie === "true" ? (
localStorage.getItem('accessToken') && localStorage.getItem('refreshToken') ? (
// true ? (
<DefaultLayout isOnline={isOnline} />
) : (
<Login />

View File

@@ -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([
{

View File

@@ -142,7 +142,7 @@ const InvestorDetails = () => {
<Text as={"span"} color={"teal.900"}>
{item.clientReference_id}
</Text>
</Box>
</Box>
),
"First Name": (
<Box w={"auto"} isTruncated={true}>

View File

@@ -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
</Tab>
<Tab
isDisabled={true}
// isDisabled={true}
fontSize={"sm"}
_selected={{
color: "#004118",
@@ -247,7 +254,7 @@ const ProfileView = () => {
Portfolio
</Tab>
<Tab
isDisabled={true}
// isDisabled={true}
fontSize={"sm"}
_selected={{
color: "#004118",

View File

@@ -47,7 +47,7 @@ const ViewInvestorDetails = () => {
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: () => <ToastBox message={"Status changed succesfully.!"} />,
});
}, 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}
</Text>
),
"Deal Name": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item.dealName}
{item.investmentTypeName}
</Text>
</Box>
),
@@ -129,21 +125,21 @@ const ViewInvestorDetails = () => {
"Investment Amount": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item.investAmount}
{item.investedAmount}
</Text>
</Box>
),
"Holding Period": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item.holdingPeriod}
{item.Investor_Holidings}
</Text>
</Box>
),
"Estimated return": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item.estimatedReturn}
{item.TotalReturn}
</Text>
</Box>
),
@@ -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}
</Badge>
</Box>
),