Files
tanami-admin-panel/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx

145 lines
4.9 KiB
React
Raw Normal View History

2024-07-05 20:02:10 +05:30
import {
Box,
Button,
Input,
Tab,
TabList,
TabPanel,
TabPanels,
Tabs,
Text,
useDisclosure,
2024-07-05 20:02:10 +05:30
} from "@chakra-ui/react";
import { useNavigate, useParams } from "react-router-dom";
import GlobalStateContext from "../../../Contexts/GlobalStateContext";
import { useContext, useEffect, useState } from "react";
import FormInputView from "../../../Components/FormInputView";
import { useForm } from "react-hook-form"; // assuming react-hook-form is used
import { OPACITY_ON_LOAD } from "../../../Layout/animations";
import { ArrowBackIcon } from "@chakra-ui/icons";
import CustomAlertDialog from "../../../Components/CustomAlertDialog";
import ViewIOdataHeader from "./ViewIOdataHeader";
import ViewIOdetails from "./ViewIOdetails";
import ViewIOdocs from "./ViewIOdocs";
import ViewKeyMerits from "./ViewKeyMerits";
import ViewIOartifacts from "./ViewIOartifacts";
import ViewInvestors from "./ViewInvestors";
import ViewIOcash from "./ViewIOcash";
import ViewIOnav from "./ViewIOnav";
import ViewDistribution from "./ViewDistribution";
2024-07-08 20:42:55 +05:30
import InvestmentDocument from "../CreateIO/InvestmentDocument";
import KeyMerits from "../CreateIO/KeyMerits";
2024-08-22 18:48:45 +05:30
import Investors from "../CreateIO/Investors";
import EditIO from "../EditIO/EditIO";
2024-07-09 19:05:08 +05:30
import IOArtifacts from "../CreateIO/IOArtifacts";
2024-11-14 12:08:17 +05:30
// import IOCashDetails from "../CreateIO/IOCashDetailsold";
// import IONAVDetails from "../CreateIO/IONAVDetailsOld";
import { useGetIOprepopulateDataQuery } from "../../../Services/io.service";
2024-08-14 12:19:27 +05:30
import UnderConstruction from "../../UnderConstruction";
2024-08-22 12:10:07 +05:30
import Destribution from "../CreateIO/Destribution";
2024-11-14 12:08:17 +05:30
import IOCashDetails from "../CreateIO/IOCashDetails/IOCashDetails";
import IONAVDetails from "../CreateIO/IONAVDetails/IONAVDetails";
import IOTransaction from "../CreateIO/IOTransaction/IOTransaction";
2024-07-09 14:49:05 +05:30
2024-07-05 20:02:10 +05:30
const ViewIOdata = () => {
2024-08-22 18:48:45 +05:30
const params = useParams();
const id = params?.id;
const { data, error, isLoading } = useGetIOprepopulateDataQuery();
const { isOpen, onOpen, onClose } = useDisclosure();
2024-07-05 20:02:10 +05:30
const navigate = useNavigate();
const [isEditing, setIsEditing] = useState(false);
2024-08-16 15:02:02 +05:30
const { IODetails, setIODetails } = useContext(GlobalStateContext);
2024-08-26 16:05:03 +05:30
console.log(IODetails?.isInvestedAmount);
2024-07-05 20:02:10 +05:30
const tabs = [
{ label: "IO Details", content: <ViewIOdetails data={data?.data} /> },
2024-08-22 18:48:45 +05:30
{
2024-11-21 16:05:51 +05:30
label: "Investment documents",
2024-08-22 18:48:45 +05:30
content: <InvestmentDocument data={data?.data} />,
},
{ label: "Key merits", content: <KeyMerits data={data?.data} /> },
{ label: "IO artifacts", content: <IOArtifacts data={data?.data} /> },
2024-08-16 16:33:20 +05:30
{ 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} /> },
2024-08-22 18:48:45 +05:30
{
label: "Distribution to Investors",
content: <Destribution data={data?.data} />,
},
2024-11-14 12:08:17 +05:30
{
label: "IO Transaction",
content: <IOTransaction data={data?.data} />,
},
2024-08-22 12:10:07 +05:30
// { label: "Distribution to Investors", content: <UnderConstruction h={'75vh'} /> },
2024-07-05 20:02:10 +05:30
];
return (
2024-08-22 18:48:45 +05:30
<Box
{...OPACITY_ON_LOAD}
overflowY={"scroll"}
overflowX={"hidden"}
height={"100vh"}
pb={14}
>
2024-07-08 20:42:55 +05:30
<Box paddingInline={"12px"} mt={2}>
{/* <span
2024-07-05 20:02:10 +05:30
onClick={() => navigate(-1)}
style={{ fontSize: "15px", cursor: "pointer" }}
>
<ArrowBackIcon cursor={"pointer"} /> Back
2024-07-08 20:42:55 +05:30
</span> */}
2024-07-05 20:02:10 +05:30
<ViewIOdataHeader />
</Box>
<Tabs mt={4}>
2024-08-22 18:48:45 +05:30
<TabList justifyContent={"space-between"} pe={4} alignItems={"center"}>
<Box display={"flex"}>
{tabs.map(({ label }, index) => (
<Tab
px={3}
2024-11-21 17:42:27 +05:30
isDisabled={
index === 0 ||
index === 1 ||
index === 2 ||
index === 3 ||
index === 4 ||
index === 8
? false
: !IODetails?.isInvestedAmount
}
2024-11-21 16:05:51 +05:30
// isDisabled={
// index === 0 ||
// index === 1 ||
// index === 2 ||
// index === 3 ||
// index === 4
// ? false
// : !IODetails?.isInvestedAmount
// }
2024-08-22 18:48:45 +05:30
key={index}
2024-11-14 12:08:17 +05:30
fontSize={"xs"}
2024-08-22 18:48:45 +05:30
_selected={{
color: "#004118",
borderBottom: "2px solid #38a169",
}}
2024-11-14 12:08:17 +05:30
fontWeight={500}
2024-08-22 18:48:45 +05:30
>
{label}
</Tab>
))}
2024-07-09 14:49:05 +05:30
</Box>
2024-07-05 20:02:10 +05:30
</TabList>
<TabPanels>
{tabs.map(({ content }, index) => (
2024-08-22 18:48:45 +05:30
<TabPanel key={index}>{content}</TabPanel>
2024-07-05 20:02:10 +05:30
))}
</TabPanels>
</Tabs>
</Box>
);
};
export default ViewIOdata;