updated investor in IO
This commit is contained in:
@@ -624,6 +624,11 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
||||
toast({
|
||||
render: () => <ToastBox message={res?.error?.data?.message } status={"error"} />,
|
||||
});
|
||||
}else if(res?.error?.status === 500){
|
||||
setIsLoading(false);
|
||||
toast({
|
||||
render: () => <ToastBox message={res?.error?.data?.message } status={"error"} />,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
setIsLoading(false);
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
} from "@chakra-ui/react";
|
||||
import React, { useContext, useEffect, useState } from "react";
|
||||
import { OPACITY_ON_LOAD } from "../../../Layout/animations";
|
||||
import DataTable from "../../../Components/DataTable/DataTable";
|
||||
import NormalTable from "../../../Components/DataTable/NormalTable";
|
||||
import { HiDotsVertical } from "react-icons/hi";
|
||||
import { Link, Link as RouterLink } from "react-router-dom";
|
||||
import Pagination from "../../../Components/Pagination";
|
||||
@@ -35,10 +35,16 @@ import { debounce } from "../../Master/Sponser/AddSponser";
|
||||
|
||||
const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter
|
||||
|
||||
const Investors = () => {
|
||||
const Investors = ({data}) => {
|
||||
const toast = useToast();
|
||||
const { investors, setInvestors, slideFromRight } =
|
||||
const { investors, setInvestors, slideFromRight, IODetails } =
|
||||
useContext(GlobalStateContext);
|
||||
|
||||
|
||||
console.log(IODetails?.investors);
|
||||
|
||||
|
||||
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [deleteAlert, setDeleteAlert] = useState(false);
|
||||
@@ -100,15 +106,17 @@ const Investors = () => {
|
||||
}, 300);
|
||||
|
||||
// Table filter
|
||||
const filteredData = investors.filter((item) => {
|
||||
const filteredData = IODetails?.investors?.filter((item) => {
|
||||
const name = item.firstName;
|
||||
const searchLower = searchTerm.toLowerCase();
|
||||
const nameMatches = name.toLowerCase().includes(searchLower);
|
||||
return nameMatches;
|
||||
});
|
||||
|
||||
|
||||
|
||||
const [ extractedArray, setExtractedArray ] = useState(filteredData?.map((item, index) => ({
|
||||
|
||||
const extractedArray = filteredData?.map((item, index) => ({
|
||||
id: item?.id,
|
||||
"Client ID": (
|
||||
<Text
|
||||
@@ -118,7 +126,7 @@ const Investors = () => {
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{item.clientId}
|
||||
{item?.clientReference_id}
|
||||
</Text>
|
||||
),
|
||||
"First name": (
|
||||
@@ -151,7 +159,7 @@ const Investors = () => {
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{`$${item.investedAmount}`}
|
||||
{`$${item.InvestedAmount_USD}`}
|
||||
</Text>
|
||||
),
|
||||
"Percentage": (
|
||||
@@ -162,7 +170,7 @@ const Investors = () => {
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{item.percentage}
|
||||
{item.Distribution_Per}%
|
||||
</Text>
|
||||
),
|
||||
"Market Value": (
|
||||
@@ -173,7 +181,7 @@ const Investors = () => {
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{`$${item.marketValue}`}
|
||||
{`$${item.Market_Value || 0}`}
|
||||
</Text>
|
||||
),
|
||||
"Return on Investment": (
|
||||
@@ -185,7 +193,7 @@ const Investors = () => {
|
||||
h={6}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{item.returnOnInvestment}
|
||||
{item.returnOnInvestment || 0}
|
||||
</Text>
|
||||
),
|
||||
"Distribution": (
|
||||
@@ -196,7 +204,7 @@ const Investors = () => {
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{`$${item.distribution}`}
|
||||
{`$${item.Distribution_Amt}`}
|
||||
</Text>
|
||||
),
|
||||
"Total Return": (
|
||||
@@ -207,7 +215,7 @@ const Investors = () => {
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{`$${item.totalReturn}`}
|
||||
{`$${item.Total_Return || 0}`}
|
||||
</Text>
|
||||
),
|
||||
"Total return on Investment": (
|
||||
@@ -218,10 +226,10 @@ const Investors = () => {
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{item.totalReturnOnInvestment}
|
||||
{item.Total_Return_On_Investment||0}
|
||||
</Text>
|
||||
),
|
||||
})));
|
||||
}));
|
||||
|
||||
const handleDelete = () => {
|
||||
const updatedSponsors = sponser.filter(
|
||||
@@ -383,12 +391,11 @@ const Investors = () => {
|
||||
</HStack>
|
||||
</Box>
|
||||
|
||||
<DataTable
|
||||
<NormalTable
|
||||
centered={true}
|
||||
emptyMessage={`We don't have any Sponers `}
|
||||
tableHeadRow={tableHeadRow}
|
||||
data={extractedArray}
|
||||
setData={setExtractedArray}
|
||||
isLoading={isLoading}
|
||||
viewActionId={actionId}
|
||||
setViewActionId={setActionId}
|
||||
|
||||
@@ -55,8 +55,8 @@ const ViewIOdata = () => {
|
||||
{ label: "Investment documents", content: <InvestmentDocument data={data?.data} /> },
|
||||
{ label: "Key merits", content: <KeyMerits data={data?.data} /> },
|
||||
{ label: "IO artifacts", content: <IOArtifacts data={data?.data} /> },
|
||||
// { label: "Investors", content: <Investors data={data?.data} /> },
|
||||
{ label: "Investors", content: <UnderConstruction h={'75vh'} /> },
|
||||
{ label: "Investors", content: <Investors data={data?.data} /> },
|
||||
// { label: "Investors", content: <UnderConstruction h={'75vh'} /> },
|
||||
{ label: "IO Cash Details", content: <IOCashDetails data={data?.data} /> },
|
||||
{ label: "IO NAV Details", content: <IONAVDetails data={data?.data} /> },
|
||||
// { label: "Distribution to Investors", content: <IONAVDetails data={data?.data} /> },
|
||||
@@ -85,7 +85,8 @@ const ViewIOdata = () => {
|
||||
index === 0 ||
|
||||
index === 1 ||
|
||||
index === 2 ||
|
||||
index === 3 ?
|
||||
index === 3 ||
|
||||
index === 4 ?
|
||||
false :
|
||||
!IODetails?.isInvestedAmount}
|
||||
key={index}
|
||||
|
||||
Reference in New Issue
Block a user