Files
tanami-admin-panel/src/Pages/IO_Management/CreateIO/IODetails.jsx

232 lines
4.4 KiB
React
Raw Normal View History

2024-07-05 15:28:02 +05:30
import React from "react";
import FormInputMain from "../../../Components/FormInputMain";
2024-07-08 12:22:27 +05:30
import { useNavigate } from "react-router-dom";
2024-07-05 15:28:02 +05:30
2024-07-08 12:22:27 +05:30
const IODetails = ({ enableNextTab, control, errors, index, handleSubmit }) => {
const navigate = useNavigate()
2024-07-05 15:28:02 +05:30
const formFields = [
{
label: "IO Name (English)",
placeHolder: " ",
name: "ioName",
type: "text",
2024-07-08 12:22:27 +05:30
2024-07-05 15:28:02 +05:30
section: " ",
width: "49%",
},
{
label: "IO Name (Arabic)",
placeHolder: " ",
name: "ioNameArabic",
type: "text",
2024-07-08 12:22:27 +05:30
2024-07-05 15:28:02 +05:30
section: " ",
width: "49%",
},
{
label: "Description (English)",
placeHolder: " ",
name: "discription",
type: "textarea",
2024-07-08 12:22:27 +05:30
2024-07-05 15:28:02 +05:30
section: " ",
width: "49%",
},
{
label: "Description (Arabic)",
placeHolder: " ",
name: "discriptionArabic",
type: "textarea",
2024-07-08 12:22:27 +05:30
2024-07-05 15:28:02 +05:30
section: " ",
width: "49%",
},
{
label: "Investment Type (English)",
placeHolder: " ",
name: "typeName",
type: "select",
2024-07-08 12:22:27 +05:30
2024-07-05 15:28:02 +05:30
section: " ",
width: "49%",
options: [
{
label: "option 1",
value: "option 1",
},
{
label: "option 2",
value: "option 2",
},
{
label: "option 3",
value: "option 3",
},
{
label: "option 4",
value: "option 4",
},
],
},
{
label: "Investment Type (Arabic)",
placeHolder: " ",
name: "typeNameArabic",
type: "select",
2024-07-08 12:22:27 +05:30
2024-07-05 15:28:02 +05:30
section: " ",
width: "49%",
options: [
{
label: "option 1",
value: "option 1",
},
{
label: "option 2",
value: "option 2",
},
{
label: "option 3",
value: "option 3",
},
{
label: "option 4",
value: "option 4",
},
],
},
{
label: "Sponser Name (English)",
placeHolder: " ",
name: "sponserName",
type: "text",
2024-07-08 12:22:27 +05:30
section: " ",
width: "49%",
},
{
label: "Sponser Name (Arabic)",
placeHolder: " ",
name: "sponserNameArabic",
type: "text",
2024-07-05 15:28:02 +05:30
section: " ",
width: "49%",
},
{
label: "Goal Amount (English)",
placeHolder: " ",
name: "goalAmount",
type: "Number",
2024-07-08 12:22:27 +05:30
2024-07-05 15:28:02 +05:30
section: " ",
width: "49%",
},
{
label: "Minimum Investment Amount (English)",
placeHolder: " ",
name: "minInvestment",
type: "number",
2024-07-08 12:22:27 +05:30
2024-07-05 15:28:02 +05:30
section: " ",
width: "32.3%",
},
{
label: "Maximum Investment Amount (English)",
placeHolder: " ",
name: "maxInvestment",
type: "number",
2024-07-08 12:22:27 +05:30
2024-07-05 15:28:02 +05:30
section: " ",
width: "32.3%",
},
{
label: "Holding Period (English)",
placeHolder: " ",
name: "holdingPeriod",
type: "number",
2024-07-08 12:22:27 +05:30
2024-07-05 15:28:02 +05:30
section: " ",
width: "32.3%",
},
{
label: "Expected Return Estimated (English)",
placeHolder: " ",
name: "expectedReturn",
type: "number",
2024-07-08 12:22:27 +05:30
2024-07-05 15:28:02 +05:30
section: " ",
width: "32.3%",
},
{
label: "Closing Date (English)",
placeHolder: " ",
name: "closingDate",
type: "date",
2024-07-08 12:22:27 +05:30
2024-07-05 15:28:02 +05:30
section: " ",
width: "32.3%",
2024-07-08 12:22:27 +05:30
},
2024-07-05 15:28:02 +05:30
{
2024-07-08 12:22:27 +05:30
label: "IO status",
2024-07-05 15:28:02 +05:30
placeHolder: " ",
2024-07-08 12:22:27 +05:30
name: "ioStatus",
type: "select",
2024-07-05 15:28:02 +05:30
section: " ",
width: "32.3%",
2024-07-08 12:22:27 +05:30
options: [
{
label: "option 1",
value: "option 1",
},
{
label: "option 2",
value: "option 2",
},
{
label: "option 3",
value: "option 3",
},
{
label: "option 4",
value: "option 4",
},
],
2024-07-05 15:28:02 +05:30
},
];
const groupedFields = formFields.reduce((groups, field) => {
const { section } = field;
if (!groups[section]) {
groups[section] = [];
}
groups[section].push(field);
return groups;
}, {});
2024-07-08 12:22:27 +05:30
const onSubmit = (e) =>{
e.preventDefault();
enableNextTab(index)
}
2024-07-05 15:28:02 +05:30
return (
<FormInputMain
p={0.1}
2024-07-08 12:22:27 +05:30
w={'auto'}
2024-07-05 15:28:02 +05:30
width={"23.8%"}
groupedFields={groupedFields}
control={control}
errors={errors}
2024-07-08 12:22:27 +05:30
// onSubmit={handleSubmit(onSubmit)}
onSubmit={onSubmit}
submitTitle={"Next"}
2024-07-05 15:28:02 +05:30
/>
);
};
export default IODetails;