This commit is contained in:
rockyeverlast
2024-07-05 20:03:09 +05:30
2 changed files with 73 additions and 262 deletions

View File

@@ -280,45 +280,27 @@ const GlobalStateProvider = ({ children }) => {
const [create, setCreate] = useState([
{
id: 1,
sponserName: "John Doe",
sponserNameArabic: "الرجاء إدخال القيمة",
mobileNo: "1234567890",
sponserAddress: "123 Main St, Springfield, USA",
accountHolderName: "John Doe",
bankName: "Example Bank",
accountNumber: "1234567890",
bankBranch: "Main Branch",
branchAddress: "456 Elm St, Springfield, USA",
ifscCode: "IFSC12345",
swiftCode: "SWIFT56789",
routingNumber: "987654321",
iban: "IBAN987654321",
accountType: "savings",
bankPhoneNumber: "9876543210",
bankEmail: "john.doe@example.com",
sponserName: "Commercial",
description: "Investment Private Company",
status: true,
createdAt: "45",
},
{
id: 2,
sponserName: "Jane Smith",
sponserNameArabic: "الرجاء إدخال القيمة",
mobileNo: "9876543210",
sponserAddress: "456 Oak St, Metropolis, USA",
accountHolderName: "Jane Smith",
bankName: "Another Bank",
accountNumber: "0987654321",
bankBranch: "Downtown Branch",
branchAddress: "789 Pine St, Metropolis, USA",
ifscCode: "IFSC54321",
swiftCode: "SWIFT98765",
routingNumber: "123456789",
iban: "IBAN123456789",
accountType: "checking",
bankPhoneNumber: "1234567890",
bankEmail: "jane.smith@example.com",
status: false,
createdAt: "45",
sponserName: "Commercial",
description: "Investment Private",
status: true,
},
{
id: 3,
sponserName: "Commercial",
description: "Investment Private",
status: true,
},
{
id: 4,
sponserName: "Commercial",
description: "Investment Private",
status: true,
},
]);

View File

@@ -116,12 +116,6 @@ const years = Array.from(
(_, i) => startYear + i
).map((year) => ({ value: year, label: year }));
const CreateIO = () => {
const navigate = useNavigate();
const { create, setCreate, sponser, setSponser, investment, setInvestment } =
@@ -153,14 +147,46 @@ const CreateIO = () => {
});
const tabs = [
{ label: 'IO Details', content: <IODetails control={control} errors={errors} /> },
{ label: 'Investment documents', content: <InvestmentDocument control={control} errors={errors} /> },
{ label: 'Key merits', content: <KeyMerits control={control} errors={errors} /> },
{ label: 'IO artifacts', content: <IOArtifacts control={control} errors={errors} /> },
{ label: 'Investors', content: <Investors control={control} errors={errors} /> },
{ label: 'IO Cash Details', content: <IOCashDetails control={control} errors={errors} /> },
{ label: 'IO NAV Details', content: <IONAVDetails control={control} errors={errors} /> },
{ label: 'Distribution', content: <Distribution control={control} errors={errors} /> },
{
label: "IO Details",
content: <IODetails control={control} errors={errors} />,
isDisabled: false,
},
{
label: "Investment documents",
content: <InvestmentDocument control={control} errors={errors} />,
isDisabled: false,
},
{
label: "Key merits",
content: <KeyMerits control={control} errors={errors} />,
isDisabled: true,
},
{
label: "IO artifacts",
content: <IOArtifacts control={control} errors={errors} />,
isDisabled: true,
},
{
label: "Investors",
content: <Investors control={control} errors={errors} />,
isDisabled: true,
},
{
label: "IO Cash Details",
content: <IOCashDetails control={control} errors={errors} />,
isDisabled: true,
},
{
label: "IO NAV Details",
content: <IONAVDetails control={control} errors={errors} />,
isDisabled: true,
},
{
label: "Distribution",
content: <Distribution control={control} errors={errors} />,
isDisabled: true,
},
];
useEffect(() => {
@@ -267,226 +293,29 @@ const CreateIO = () => {
setSelectedOtherImageData(newSelectedImageData);
};
const keyMerits = [
{
label: "Name (English)",
placeHolder: " ",
name: "keyname",
type: "text",
isRequired: true,
section: " ",
width: "32.3%",
},
{
label: "Name (Arabic)",
placeHolder: " ",
name: "keyNameArabic",
type: "text",
isRequired: true,
section: " ",
width: "32.3%",
},
{
label: "Icon",
placeHolder: " ",
name: "iconUpload",
type: "fileNormal",
isRequired: true,
section: " ",
width: "32.3%",
},
{
label: "Description (English)",
placeHolder: " ",
name: "keyDescription",
type: "textarea",
isRequired: true,
section: " ",
width: "32.3%",
},
{
label: "Description (Arabic)",
placeHolder: " ",
name: "keyDescriptionArabic",
type: "textarea",
isRequired: true,
section: " ",
width: "32.3%",
},
];
const images = [
{
label: "Banner Images ",
placeHolder: " ",
name: "bannerImages",
type: "fileNormal",
isRequired: true,
section: " ",
width: "32.3%",
},
{
label: "Other Images",
placeHolder: " ",
name: "otherImage",
type: "fileNormal",
isRequired: true,
section: " ",
width: "32.3%",
},
];
const documents = [
{
label: "Type",
placeHolder: " ",
name: "docType",
type: "text",
isRequired: true,
section: " ",
width: "32.3%",
},
{
label: "Attachment",
placeHolder: " ",
name: "type",
type: "docAttach",
isRequired: true,
section: " ",
width: "32.3%",
},
];
const Videos = [
{
label: "Videos",
placeHolder: " ",
name: "videos",
type: "fileNormal",
isRequired: true,
section: " ",
width: "32.3%",
},
];
const groupedFieldsTwo = keyMerits.reduce((groups, field) => {
const { section } = field;
if (!groups[section]) {
groups[section] = [];
}
groups[section].push(field);
return groups;
}, {});
const groupedFieldsThree = images.reduce((groups, field) => {
const { section } = field;
if (!groups[section]) {
groups[section] = [];
}
groups[section].push(field);
return groups;
}, {});
const groupedFieldsFour = documents.reduce((groups, field) => {
const { section } = field;
if (!groups[section]) {
groups[section] = [];
}
groups[section].push(field);
return groups;
}, {});
const groupedFieldsFive = Videos.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={10}>
<Tabs mt={2}>
<TabList>
{tabs.map(({label}, index) => (
<Tab
disabled={true}
key={index}
fontSize={"sm"}
_selected={{ color: "#004118", borderBottom: "2px solid #38a169" }}
>
{label}
</Tab>))}
{tabs.map(({ label, isDisabled }, index) => (
<Tab
isDisabled={isDisabled}
key={index}
fontSize={"sm"}
_selected={{
color: "#004118",
borderBottom: "2px solid #38a169",
}}
>
{label}
</Tab>
))}
</TabList>
<TabPanels>
{tabs.map(({content}, index) => (
<TabPanel key={index}>
{content}
</TabPanel>))}
{/* <TabPanel>
<IODetails control={control} errors={errors} />
</TabPanel>
<TabPanel>
<InvestmentDocument control={control} errors={errors}/>
</TabPanel>
<TabPanel>
<FormInputMain
width={"23.8%"}
groupedFields={groupedFieldsThree}
control={control}
errors={errors}
onSubmit={handleSubmit(onSubmit)}
/>
</TabPanel>
<TabPanel>
<FormInputMain
width={"23.8%"}
groupedFields={groupedFieldsFour}
control={control}
errors={errors}
onSubmit={handleSubmit(onSubmit)}
/>
</TabPanel>
<TabPanel>
<FormInputMain
width={"23.8%"}
groupedFields={groupedFieldsFive}
control={control}
errors={errors}
onSubmit={handleSubmit(onSubmit)}
/>
</TabPanel>
<TabPanel></TabPanel> */}
{tabs.map(({ content }, index) => (
<TabPanel>{content}</TabPanel>
))}
</TabPanels>
</Tabs>
</Box>