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

116 lines
4.1 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-07-09 14:49:05 +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-07-10 12:02:35 +05:30
import IOCashDetails from "../CreateIO/IOCashDetails";
import IONAVDetails from "../CreateIO/IONAVDetails";
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-07-09 14:49:05 +05:30
2024-07-05 20:02:10 +05:30
const ViewIOdata = () => {
2024-08-20 13:00:22 +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);
console.log(IODetails?.isInvestedAmount);
2024-07-05 20:02:10 +05:30
2024-08-16 15:12:37 +05:30
2024-07-05 20:02:10 +05:30
const tabs = [
{ label: "IO Details", content: <ViewIOdetails data={data?.data} /> },
{ label: "Investment documents", 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 12:10:07 +05:30
{ label: "Distribution to Investors", content: <Destribution data={data?.data} /> },
// { label: "Distribution to Investors", content: <UnderConstruction h={'75vh'} /> },
2024-07-05 20:02:10 +05:30
];
return (
2024-07-22 14:50:31 +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-07-09 14:49:05 +05:30
<TabList justifyContent={'space-between'} pe={4} alignItems={'center'}>
<Box display={'flex'} >
2024-07-05 20:02:10 +05:30
{tabs.map(({ label }, index) => (
<Tab
2024-08-16 15:24:18 +05:30
px={3}
2024-08-16 15:02:02 +05:30
isDisabled={
index === 0 ||
index === 1 ||
index === 2 ||
2024-08-16 16:33:20 +05:30
index === 3 ||
index === 4 ?
2024-08-16 15:02:02 +05:30
false :
!IODetails?.isInvestedAmount}
2024-07-05 20:02:10 +05:30
key={index}
fontSize={"sm"}
_selected={{
color: "#004118",
borderBottom: "2px solid #38a169",
}}
>
{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-16 15:02:02 +05:30
<TabPanel key={index}>{content}</TabPanel>
2024-07-05 20:02:10 +05:30
))}
</TabPanels>
</Tabs>
</Box>
);
};
export default ViewIOdata;