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

226 lines
5.6 KiB
React
Raw Normal View History

2024-07-05 15:33:08 +05:30
import {
Box,
Button,
Input,
Tab,
TabList,
TabPanel,
TabPanels,
Tabs,
Text,
} from "@chakra-ui/react";
2024-07-05 11:55:52 +05:30
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";
2024-07-05 15:33:08 +05:30
import DataTable from "../../Components/DataTable/DataTable";
import CustomAlertDialog from "../../Components/CustomAlertDialog";
import FormInputMain from "../../Components/FormInputMain";
import InvestmentDocuments from "./InvestmentDocuments";
import ViewIOdataHeader from "./ViewIOdataHeader";
2024-07-05 11:55:52 +05:30
const ViewIOdata = () => {
const navigate = useNavigate();
const params = useParams();
const { viewIO } = useContext(GlobalStateContext);
const { reset } = useForm(); // assuming react-hook-form
2024-07-05 15:28:02 +05:30
2024-07-05 11:55:52 +05:30
const id = params?.id;
2024-07-05 15:33:08 +05:30
const foundObject = viewIO.find(
(item) => item?.id.toString() === id.toString()
2024-07-05 11:55:52 +05:30
);
if (!foundObject) {
return <Box>Loading...</Box>;
}
const formFields = [
{
2024-07-05 15:33:08 +05:30
label: "IO Name (English)",
value: foundObject.DealName,
width: "49%",
section: "",
2024-07-05 11:55:52 +05:30
},
{
2024-07-05 15:33:08 +05:30
label: "IO Name (Arabic)",
2024-07-05 11:55:52 +05:30
value: foundObject.SponsorName,
2024-07-05 15:33:08 +05:30
width: "49%",
section: "",
},
{
label: "Description (English)",
value: foundObject.IOstatus,
width: "49%",
section: "",
},
{
label: "Description (Arabic)",
value: foundObject.IOstatus,
width: "49%",
section: "",
},
{
label: "Investment Type (English)",
value: foundObject.DealName,
width: "49%",
section: "",
},
{
label: "Investment Type (Arabic)",
value: foundObject.DealID,
width: "49%",
section: "",
},
{
label: "Sponser Name (English)",
value: foundObject.IOstatus,
width: "49%",
section: "",
},
{
label: "Goal Amount (English)",
value: foundObject.IOstatus,
width: "49%",
section: "",
2024-07-05 11:55:52 +05:30
},
{
2024-07-05 15:33:08 +05:30
label: "Minimum Investment Amount (English)",
2024-07-05 11:55:52 +05:30
value: foundObject.IOstatus,
2024-07-05 15:33:08 +05:30
width: "32.3%",
section: "",
},
{
label: "Maximum Investment Amount (English)",
value: foundObject.IOstatus,
width: "32.3%",
section: "",
},
{
label: "Holding Period (English)",
value: foundObject.IOstatus,
width: "32.3%",
section: "",
},
{
label: "Expected Return Estimated (English)",
value: foundObject.IOstatus,
width: "32.3%",
section: "",
},
{
label: "Closing Date (English)",
value: foundObject.IOstatus,
width: "32.3%",
section: "",
},
{
label: "IO Status (English)",
value: foundObject.IOstatus,
width: "32.3%",
section: "",
2024-07-05 11:55:52 +05:30
},
];
const groupedFields = formFields.reduce((groups, field) => {
const { section } = field;
if (!groups[section]) {
groups[section] = [];
}
groups[section].push(field);
return groups;
}, {});
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"} pb={14}>
2024-07-05 15:33:08 +05:30
<Box paddingInline={"12px"}>
<span
onClick={() => navigate(-1)}
style={{ fontSize: "15px", cursor: "pointer" }}
>
<ArrowBackIcon cursor={"pointer"} /> Back
</span>
<ViewIOdataHeader />
</Box>
<Tabs mt={4}>
<TabList>
<Tab
fontSize={"sm"}
_selected={{ color: "#004118", borderBottom: "2px solid #38a169" }}
>
IO Details
</Tab>
<Tab
fontSize={"sm"}
_selected={{ color: "#004118", borderBottom: "2px solid #38a169" }}
>
Investment Documents
</Tab>
<Tab
fontSize={"sm"}
_selected={{ color: "#004118", borderBottom: "2px solid #38a169" }}
>
Key Merits
</Tab>
<Tab
fontSize={"sm"}
_selected={{ color: "#004118", borderBottom: "2px solid #38a169" }}
>
IO artifacts
</Tab>
<Tab
fontSize={"sm"}
_selected={{ color: "#004118", borderBottom: "2px solid #38a169" }}
>
Investors
</Tab>
<Tab
fontSize={"sm"}
_selected={{ color: "#004118", borderBottom: "2px solid #38a169" }}
>
IO Cash detail
</Tab>
<Tab
fontSize={"sm"}
_selected={{ color: "#004118", borderBottom: "2px solid #38a169" }}
>
IO NAV detail
</Tab>
<Tab
fontSize={"sm"}
_selected={{ color: "#004118", borderBottom: "2px solid #38a169" }}
>
Distribution
</Tab>
</TabList>
<TabPanels>
<TabPanel>
<FormInputView groupedFields={groupedFields} />
</TabPanel>
<TabPanel>
<FormInputView groupedFields={groupedFields} />
</TabPanel>
<TabPanel>
<FormInputView groupedFields={groupedFields} />
</TabPanel>
<TabPanel>
<FormInputView groupedFields={groupedFields} />
</TabPanel>
<TabPanel>
<FormInputView groupedFields={groupedFields} />
</TabPanel>
<TabPanel></TabPanel>
</TabPanels>
</Tabs>
2024-07-05 11:55:52 +05:30
</Box>
);
};
export default ViewIOdata;