2024-06-28 15:11:57 +05:30
|
|
|
import React, { useContext, useEffect, useState } from "react";
|
2024-06-26 17:45:13 +05:30
|
|
|
import { OPACITY_ON_LOAD } from "../../Layout/animations";
|
|
|
|
|
import {
|
|
|
|
|
Box,
|
|
|
|
|
Divider,
|
|
|
|
|
FormControl,
|
|
|
|
|
FormLabel,
|
|
|
|
|
Heading,
|
|
|
|
|
Input,
|
|
|
|
|
Select,
|
|
|
|
|
Textarea,
|
|
|
|
|
Button,
|
|
|
|
|
Text,
|
2024-06-27 11:50:59 +05:30
|
|
|
Image,
|
2024-06-26 17:45:13 +05:30
|
|
|
} from "@chakra-ui/react";
|
|
|
|
|
import { useForm, Controller } from "react-hook-form";
|
|
|
|
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
|
|
|
import * as yup from "yup";
|
2024-06-27 11:50:59 +05:30
|
|
|
import { AddIcon, CloseIcon, WarningTwoIcon } from "@chakra-ui/icons";
|
2024-06-26 17:45:13 +05:30
|
|
|
import { TiWarning } from "react-icons/ti";
|
|
|
|
|
import GlobalStateContext from "../../Contexts/GlobalStateContext";
|
|
|
|
|
import { useNavigate } from "react-router-dom";
|
|
|
|
|
import FormField from "../../Components/FormField";
|
|
|
|
|
import { v4 as uuidv4 } from "uuid";
|
2024-06-28 15:11:57 +05:30
|
|
|
import AddIOCharges from "./AddIOCharges";
|
2024-07-01 12:33:55 +05:30
|
|
|
import FormInputMain from "../../Components/FormInputMain";
|
2024-06-26 17:45:13 +05:30
|
|
|
|
|
|
|
|
const schema = yup.object().shape({
|
2024-07-03 12:13:09 +05:30
|
|
|
ioName: yup.string().required("Arabic name is required"),
|
|
|
|
|
ioNameArabic: yup.string().required("Investment Object name is required"),
|
|
|
|
|
discription: yup.string().required("Sponser name is required"),
|
|
|
|
|
discriptionArabic: yup.string().required("Arabic name is required"),
|
|
|
|
|
typeName: yup.string().required("Investment Object name is required"),
|
|
|
|
|
typeNameArabic: yup.string().required("Sponser name is required"),
|
|
|
|
|
sponserName: yup.string().required("Arabic name is required"),
|
|
|
|
|
sponserNameArabic: yup
|
|
|
|
|
.string()
|
|
|
|
|
.required("Investment Object name is required"),
|
|
|
|
|
holdingPeriod: yup.string().required("Sponser name is required"),
|
|
|
|
|
holdingPeriodArabic: yup.string().required("Arabic name is required"),
|
|
|
|
|
ioStartus: yup.string().required("Investment Object name is required"),
|
|
|
|
|
ioStartusArabic: yup.string().required("Sponser name is required"),
|
|
|
|
|
goalAmount: yup.string().required("Arabic name is required"),
|
|
|
|
|
closingDate: yup.string().required("Investment Object name is required"),
|
|
|
|
|
minInvestment: yup.string().required("Sponser name is required"),
|
|
|
|
|
maxInvestment: yup.string().required("Arabic name is required"),
|
|
|
|
|
expectedReturn: yup.string().required("Investment Object name is required"),
|
|
|
|
|
originalValue: yup.string().required("Sponser name is required"),
|
|
|
|
|
keyname: yup.string().required("Arabic name is required"),
|
|
|
|
|
keyNameArabic: yup.string().required("Investment Object name is required"),
|
|
|
|
|
keyDescription: yup.string().required("Sponser name is required"),
|
|
|
|
|
keyDescriptionArabic: yup.string().required("Sponser name is required"),
|
|
|
|
|
docType: yup.string().required("Sponser name is required"),
|
|
|
|
|
|
2024-06-27 11:50:59 +05:30
|
|
|
destributedAmount: yup
|
|
|
|
|
.number()
|
|
|
|
|
.required("Distributed Amount is required")
|
|
|
|
|
.positive("Must be a positive number"),
|
|
|
|
|
year: yup.string().required("Year is required"),
|
|
|
|
|
tenure: yup
|
|
|
|
|
.number()
|
|
|
|
|
.required("Tenure is required")
|
|
|
|
|
.positive("Must be a positive number"),
|
|
|
|
|
annualReturn: yup
|
|
|
|
|
.number()
|
|
|
|
|
.required("Annual Return is required")
|
|
|
|
|
.positive("Must be a positive number"),
|
|
|
|
|
miniInvest: yup
|
|
|
|
|
.number()
|
|
|
|
|
.required("Minimum Invest is required")
|
|
|
|
|
.positive("Must be a positive number"),
|
|
|
|
|
quaterly: yup.string().required("Quaterly is required"),
|
|
|
|
|
targetClose: yup.date().required("Target close date is required"),
|
|
|
|
|
annualyield: yup
|
|
|
|
|
.number()
|
|
|
|
|
.required("Annual Yield is required")
|
|
|
|
|
.positive("Must be a positive number"),
|
2024-07-03 12:13:09 +05:30
|
|
|
iconUpload: yup.mixed().required("Profile image is required"),
|
|
|
|
|
bannerImages: yup.mixed().required("Profile image is required"),
|
|
|
|
|
otherImage: yup.mixed().required("Profile image is required"),
|
|
|
|
|
docAttach: yup.mixed().required("Profile image is required"),
|
|
|
|
|
videos: yup.mixed().required("Profile image is required"),
|
2024-06-26 17:45:13 +05:30
|
|
|
});
|
|
|
|
|
|
2024-06-27 11:50:59 +05:30
|
|
|
const startYear = 2024;
|
|
|
|
|
const endYear = 2124;
|
2024-06-28 15:11:57 +05:30
|
|
|
const years = Array.from(
|
|
|
|
|
{ length: endYear - startYear + 1 },
|
|
|
|
|
(_, i) => startYear + i
|
|
|
|
|
).map((year) => ({ value: year, label: year }));
|
|
|
|
|
|
2024-06-25 12:05:39 +05:30
|
|
|
const CreateIO = () => {
|
2024-06-26 17:45:13 +05:30
|
|
|
const navigate = useNavigate();
|
2024-07-01 12:33:55 +05:30
|
|
|
const { sponser, setSponser, investment, setInvestment } =
|
|
|
|
|
useContext(GlobalStateContext);
|
2024-06-27 11:50:59 +05:30
|
|
|
const [bannerImageData, setBannerImageData] = useState(null);
|
|
|
|
|
const [otherImageData, setOtherImageData] = useState(null);
|
|
|
|
|
const [selectedBannerImageData, setSelectedBannerImageData] = useState(null);
|
|
|
|
|
const [selectedOtherImageData, setSelectedOtherImageData] = useState(null);
|
2024-06-28 15:11:57 +05:30
|
|
|
const [charges, setCharges] = useState([]);
|
|
|
|
|
const [totalCharge, setTotalCharge] = useState(0.0);
|
|
|
|
|
const [totalAmount, setTotalAmount] = useState(0.0);
|
2024-06-27 11:50:59 +05:30
|
|
|
|
2024-06-26 17:45:13 +05:30
|
|
|
const {
|
|
|
|
|
control,
|
|
|
|
|
handleSubmit,
|
2024-06-27 11:50:59 +05:30
|
|
|
reset,
|
2024-06-28 15:11:57 +05:30
|
|
|
watch,
|
2024-06-27 18:46:12 +05:30
|
|
|
setValue,
|
2024-06-26 17:45:13 +05:30
|
|
|
formState: { errors },
|
|
|
|
|
} = useForm({
|
|
|
|
|
resolver: yupResolver(schema),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
console.log(errors);
|
|
|
|
|
|
2024-06-28 15:11:57 +05:30
|
|
|
const destributedAmount = Number(watch().destributedAmount) || 0;
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const calculateTotalCharge = () => {
|
|
|
|
|
const totalChargeValue = charges.reduce(
|
|
|
|
|
(acc, { value }) => acc + Number(value),
|
|
|
|
|
0
|
|
|
|
|
);
|
|
|
|
|
setTotalCharge(totalChargeValue);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const calculateTotalAmount = () => {
|
|
|
|
|
const totalChargeValue = charges.reduce(
|
|
|
|
|
(acc, { value }) => acc + Number(value),
|
|
|
|
|
0
|
|
|
|
|
);
|
|
|
|
|
setTotalAmount(destributedAmount + totalChargeValue);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
calculateTotalCharge();
|
|
|
|
|
calculateTotalAmount();
|
|
|
|
|
}, [charges, destributedAmount]);
|
|
|
|
|
|
2024-06-26 17:45:13 +05:30
|
|
|
const onSubmit = (data) => {
|
2024-06-27 18:46:12 +05:30
|
|
|
// setValue("banner_image", selectedBannerImageData);
|
|
|
|
|
data.banner_image = selectedBannerImageData;
|
2024-07-01 12:33:55 +05:30
|
|
|
const updatedData = { ...data, status: "Available" };
|
2024-06-27 18:46:12 +05:30
|
|
|
console.log(selectedBannerImageData);
|
2024-07-01 12:33:55 +05:30
|
|
|
setInvestment([...investment, updatedData]);
|
2024-06-27 11:50:59 +05:30
|
|
|
navigate("/view-io");
|
|
|
|
|
reset();
|
2024-06-26 17:45:13 +05:30
|
|
|
};
|
|
|
|
|
|
2024-06-27 11:50:59 +05:30
|
|
|
// Extract options for the select input
|
|
|
|
|
const sponserOptions = sponser.map((item) => ({
|
|
|
|
|
value: item.sponserName,
|
|
|
|
|
label: item.sponserName,
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
const handleBannerImageChange = (e) => {
|
|
|
|
|
const file = e.target.files[0];
|
|
|
|
|
setBannerImageData(file);
|
|
|
|
|
if (file) {
|
|
|
|
|
const reader = new FileReader();
|
|
|
|
|
reader.onloadend = () => {
|
|
|
|
|
setSelectedBannerImageData(reader.result);
|
|
|
|
|
};
|
|
|
|
|
reader.readAsDataURL(file);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2024-06-28 15:11:57 +05:30
|
|
|
// Handler for file input
|
|
|
|
|
const handleOtherImageChange = (e) => {
|
|
|
|
|
const files = Array.from(e.target.files);
|
|
|
|
|
const newImageData = [...(otherImageData || []), ...files]; // Ensure otherImageData is an array
|
|
|
|
|
|
|
|
|
|
setOtherImageData(newImageData);
|
|
|
|
|
|
|
|
|
|
const readers = files.map((file) => {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
const reader = new FileReader();
|
|
|
|
|
reader.onloadend = () => {
|
|
|
|
|
resolve(reader.result);
|
|
|
|
|
};
|
|
|
|
|
reader.onerror = reject;
|
|
|
|
|
reader.readAsDataURL(file);
|
|
|
|
|
});
|
2024-06-27 11:50:59 +05:30
|
|
|
});
|
2024-06-26 17:45:13 +05:30
|
|
|
|
2024-06-28 15:11:57 +05:30
|
|
|
Promise.all(readers)
|
|
|
|
|
.then((results) => {
|
|
|
|
|
setSelectedOtherImageData([
|
|
|
|
|
...(selectedOtherImageData || []),
|
|
|
|
|
...results,
|
|
|
|
|
]); // Ensure selectedOtherImageData is an array
|
|
|
|
|
})
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
console.error("Error reading files:", error);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
// Function to remove a specific image
|
|
|
|
|
const removeOtherImage = (index) => {
|
|
|
|
|
const newImageData = otherImageData.filter((_, i) => i !== index);
|
2024-07-03 12:13:09 +05:30
|
|
|
const newSelectedImageData = selectedOtherImageData.filter(
|
2024-06-28 15:11:57 +05:30
|
|
|
(_, i) => i !== index
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
setOtherImageData(newImageData);
|
|
|
|
|
setSelectedOtherImageData(newSelectedImageData);
|
|
|
|
|
};
|
2024-06-26 17:45:13 +05:30
|
|
|
|
2024-07-01 12:33:55 +05:30
|
|
|
const formFields = [
|
|
|
|
|
{
|
2024-07-03 12:13:09 +05:30
|
|
|
label: "IO Name (English)",
|
|
|
|
|
placeHolder: " ",
|
2024-07-01 12:33:55 +05:30
|
|
|
name: "ioName",
|
|
|
|
|
type: "text",
|
|
|
|
|
isRequired: true,
|
2024-07-03 12:13:09 +05:30
|
|
|
section: "create IO",
|
2024-07-01 12:33:55 +05:30
|
|
|
},
|
|
|
|
|
{
|
2024-07-03 12:13:09 +05:30
|
|
|
label: "IO Name (Arabic)",
|
|
|
|
|
placeHolder: " ",
|
2024-07-01 12:33:55 +05:30
|
|
|
name: "ioNameArabic",
|
|
|
|
|
type: "text",
|
|
|
|
|
isRequired: true,
|
2024-07-03 12:13:09 +05:30
|
|
|
section: "create IO",
|
2024-07-01 12:33:55 +05:30
|
|
|
},
|
|
|
|
|
{
|
2024-07-03 12:13:09 +05:30
|
|
|
label: "Description (English)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "discription",
|
|
|
|
|
type: "text",
|
2024-07-01 12:33:55 +05:30
|
|
|
isRequired: true,
|
2024-07-03 12:13:09 +05:30
|
|
|
section: "create IO",
|
2024-07-01 12:33:55 +05:30
|
|
|
},
|
|
|
|
|
{
|
2024-07-03 12:13:09 +05:30
|
|
|
label: "Description (Arabic)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "discriptionArabic",
|
|
|
|
|
type: "text",
|
|
|
|
|
isRequired: true,
|
|
|
|
|
section: "create IO",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Investment Type Name (English)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "typeName",
|
|
|
|
|
type: "select",
|
2024-07-01 12:33:55 +05:30
|
|
|
isRequired: true,
|
2024-07-03 12:13:09 +05:30
|
|
|
section: "create IO",
|
|
|
|
|
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 Name (Arabic)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "typeNameArabic",
|
|
|
|
|
type: "select",
|
|
|
|
|
isRequired: true,
|
|
|
|
|
section: "create IO",
|
|
|
|
|
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-01 12:33:55 +05:30
|
|
|
},
|
|
|
|
|
{
|
2024-07-03 12:13:09 +05:30
|
|
|
label: "Sponser Name (English)",
|
|
|
|
|
placeHolder: " ",
|
2024-07-01 12:33:55 +05:30
|
|
|
name: "sponserName",
|
|
|
|
|
type: "text",
|
|
|
|
|
isRequired: true,
|
2024-07-03 12:13:09 +05:30
|
|
|
section: "create IO",
|
2024-07-01 12:33:55 +05:30
|
|
|
},
|
|
|
|
|
{
|
2024-07-03 12:13:09 +05:30
|
|
|
label: "Sponser Name (Arabic)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "sponserNameArabic",
|
|
|
|
|
type: "text",
|
2024-07-01 12:33:55 +05:30
|
|
|
isRequired: true,
|
2024-07-03 12:13:09 +05:30
|
|
|
section: "create IO",
|
2024-07-01 12:33:55 +05:30
|
|
|
},
|
|
|
|
|
{
|
2024-07-03 12:13:09 +05:30
|
|
|
label: "Holding Period (English)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "holdingPeriod",
|
|
|
|
|
type: "text",
|
2024-07-01 12:33:55 +05:30
|
|
|
isRequired: true,
|
2024-07-03 12:13:09 +05:30
|
|
|
section: "create IO",
|
2024-07-01 12:33:55 +05:30
|
|
|
},
|
|
|
|
|
{
|
2024-07-03 12:13:09 +05:30
|
|
|
label: "Holding Period (English)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "holdingPeriodArabic",
|
|
|
|
|
type: "text",
|
2024-07-01 12:33:55 +05:30
|
|
|
isRequired: true,
|
2024-07-03 12:13:09 +05:30
|
|
|
section: "create IO",
|
2024-07-01 12:33:55 +05:30
|
|
|
},
|
|
|
|
|
{
|
2024-07-03 12:13:09 +05:30
|
|
|
label: "IO Status (English)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "ioStartus",
|
2024-07-01 12:33:55 +05:30
|
|
|
type: "select",
|
2024-07-03 12:13:09 +05:30
|
|
|
isRequired: true,
|
|
|
|
|
section: "create IO",
|
2024-07-01 12:33:55 +05:30
|
|
|
options: [
|
|
|
|
|
{
|
2024-07-03 12:13:09 +05:30
|
|
|
label: "option 1",
|
|
|
|
|
value: "option 1",
|
2024-07-01 12:33:55 +05:30
|
|
|
},
|
|
|
|
|
{
|
2024-07-03 12:13:09 +05:30
|
|
|
label: "option 2",
|
|
|
|
|
value: "option 2",
|
2024-07-01 12:33:55 +05:30
|
|
|
},
|
|
|
|
|
{
|
2024-07-03 12:13:09 +05:30
|
|
|
label: "option 3",
|
|
|
|
|
value: "option 3",
|
2024-07-01 12:33:55 +05:30
|
|
|
},
|
|
|
|
|
{
|
2024-07-03 12:13:09 +05:30
|
|
|
label: "option 4",
|
|
|
|
|
value: "option 4",
|
2024-07-01 12:33:55 +05:30
|
|
|
},
|
|
|
|
|
],
|
2024-07-03 12:13:09 +05:30
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "IO Status (Arabic)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "ioStartusArabic",
|
|
|
|
|
type: "select",
|
2024-07-01 12:33:55 +05:30
|
|
|
isRequired: true,
|
2024-07-03 12:13:09 +05:30
|
|
|
section: "create IO",
|
|
|
|
|
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: "Goal Amount (English)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "goalAmount",
|
|
|
|
|
type: "number",
|
|
|
|
|
isRequired: true,
|
|
|
|
|
section: "create IO",
|
2024-07-01 12:33:55 +05:30
|
|
|
},
|
|
|
|
|
{
|
2024-07-03 12:13:09 +05:30
|
|
|
label: "Closing Date (English)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "closingDate",
|
2024-07-01 12:33:55 +05:30
|
|
|
type: "date",
|
|
|
|
|
isRequired: true,
|
2024-07-03 12:13:09 +05:30
|
|
|
section: "create IO",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Minimum Investment Amount (English)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "minInvestment",
|
|
|
|
|
type: "number",
|
|
|
|
|
isRequired: true,
|
|
|
|
|
section: "create IO",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Maximum Investment Amount (English)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "maxInvestment",
|
|
|
|
|
type: "number",
|
|
|
|
|
isRequired: true,
|
|
|
|
|
section: "create IO",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Expected Return Estimated (English)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "expectedReturn",
|
|
|
|
|
type: "number",
|
|
|
|
|
isRequired: true,
|
|
|
|
|
section: "create IO",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Original Valuation (English)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "originalValue",
|
|
|
|
|
type: "number",
|
|
|
|
|
isRequired: true,
|
|
|
|
|
section: "create IO",
|
2024-07-01 12:33:55 +05:30
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
2024-07-03 12:13:09 +05:30
|
|
|
label: "Name (English)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "keyname",
|
|
|
|
|
type: "text",
|
|
|
|
|
isRequired: true,
|
|
|
|
|
section: "Key Merits",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Name (Arabic)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "keyNameArabic",
|
|
|
|
|
type: "text",
|
|
|
|
|
isRequired: true,
|
|
|
|
|
section: "Key Merits",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Description (English)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "keyDescription",
|
|
|
|
|
type: "textarea",
|
|
|
|
|
isRequired: true,
|
|
|
|
|
section: "Key Merits",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Description (Arabic)",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "keyDescriptionArabic",
|
|
|
|
|
type: "textarea",
|
|
|
|
|
isRequired: true,
|
|
|
|
|
section: "Key Merits",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Icon",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "iconUpload",
|
2024-07-01 12:33:55 +05:30
|
|
|
type: "fileNormal",
|
|
|
|
|
isRequired: true,
|
2024-07-03 12:13:09 +05:30
|
|
|
section: "Key Merits",
|
2024-07-01 12:33:55 +05:30
|
|
|
},
|
2024-07-03 12:13:09 +05:30
|
|
|
|
2024-07-01 12:33:55 +05:30
|
|
|
{
|
2024-07-03 12:13:09 +05:30
|
|
|
label: "Banner Images ",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "bannerImages",
|
2024-07-01 12:33:55 +05:30
|
|
|
type: "fileNormal",
|
|
|
|
|
isRequired: true,
|
2024-07-03 12:13:09 +05:30
|
|
|
section: "Images",
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
label: "Other Images",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "otherImage",
|
|
|
|
|
type: "fileNormal",
|
|
|
|
|
isRequired: true,
|
|
|
|
|
section: "Images",
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
label: "Type",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "docType",
|
|
|
|
|
type: "text",
|
|
|
|
|
isRequired: true,
|
|
|
|
|
section: "Documents",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Attachment",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "type",
|
|
|
|
|
type: "docAttach",
|
|
|
|
|
isRequired: true,
|
|
|
|
|
section: "Documents",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "Videos",
|
|
|
|
|
placeHolder: " ",
|
|
|
|
|
name: "videos",
|
|
|
|
|
type: "fileNormal",
|
|
|
|
|
isRequired: true,
|
|
|
|
|
section: "Videos",
|
2024-07-01 12:33:55 +05:30
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const groupedFields = formFields.reduce((groups, field) => {
|
|
|
|
|
const { section } = field;
|
|
|
|
|
if (!groups[section]) {
|
|
|
|
|
groups[section] = [];
|
|
|
|
|
}
|
|
|
|
|
groups[section].push(field);
|
|
|
|
|
return groups;
|
|
|
|
|
}, {});
|
|
|
|
|
|
2024-06-25 12:05:39 +05:30
|
|
|
return (
|
2024-06-26 17:45:13 +05:30
|
|
|
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"} pb={14}>
|
2024-07-01 12:33:55 +05:30
|
|
|
<FormInputMain
|
|
|
|
|
groupedFields={groupedFields}
|
|
|
|
|
control={control}
|
|
|
|
|
errors={errors}
|
|
|
|
|
onSubmit={handleSubmit(onSubmit)}
|
2024-07-03 12:13:09 +05:30
|
|
|
></FormInputMain>
|
2024-06-25 12:05:39 +05:30
|
|
|
</Box>
|
2024-06-26 17:45:13 +05:30
|
|
|
);
|
|
|
|
|
};
|
2024-06-25 12:05:39 +05:30
|
|
|
|
2024-06-26 17:45:13 +05:30
|
|
|
export default CreateIO;
|