diff --git a/src/Components/EmptySearchList.jsx b/src/Components/EmptySearchList.jsx
index dc37c9e..f455898 100644
--- a/src/Components/EmptySearchList.jsx
+++ b/src/Components/EmptySearchList.jsx
@@ -13,7 +13,7 @@ const EmptySearchList = ({message}) => {
>
{message}
- Posts of rubix will appear here.
+ Posts of tanami will appear here.
)
diff --git a/src/Components/FormField.jsx b/src/Components/FormField.jsx
index dfa60cc..7005683 100644
--- a/src/Components/FormField.jsx
+++ b/src/Components/FormField.jsx
@@ -1,5 +1,5 @@
-import { FormControl, FormLabel, Input, Textarea } from '@chakra-ui/react';
-import React from 'react'
+import { FormControl, FormLabel, Input, Textarea, Select, Checkbox, RadioGroup, Radio, Stack } from '@chakra-ui/react';
+import React from 'react';
import { Controller } from 'react-hook-form';
import { TiWarning } from 'react-icons/ti';
@@ -8,40 +8,82 @@ const FormField = ({
control,
name,
type = "text",
+ options = [],
errors,
isRequired,
arabic,
...props
}) => (
- //
- //
-
+
{label}
{
- return type === "textarea" ? (
-
- ) : (
-
- );
+ switch (type) {
+ case 'textarea':
+ return (
+
+ );
+ case 'select':
+ return (
+
+ );
+ case 'checkbox':
+ return (
+
+ {label}
+
+ );
+ case 'radio':
+ return (
+
+
+ {options.map((option, index) => (
+
+ {option.label}
+
+ ))}
+
+
+ );
+ default:
+ return (
+
+ );
+ }
}}
/>
{errors[name] && (
@@ -52,4 +94,4 @@ const FormField = ({
);
-export default FormField
\ No newline at end of file
+export default FormField;
diff --git a/src/Components/InvestmentCard/InvestmentCard.jsx b/src/Components/InvestmentCard/InvestmentCard.jsx
index 072203e..6b08414 100644
--- a/src/Components/InvestmentCard/InvestmentCard.jsx
+++ b/src/Components/InvestmentCard/InvestmentCard.jsx
@@ -1,4 +1,5 @@
import {
+ Badge,
Box,
Button,
Card,
@@ -10,101 +11,135 @@ import {
Text,
Tooltip,
} from "@chakra-ui/react";
+import { OPACITY_ON_LOAD } from "../../Layout/animations";
-
-const InvestmentCard = ({investment}) => {
+const InvestmentCard = ({ investment }) => {
return (
-
-
+
+
-
-
-
- {investment?.title}
-
-
- Sponsor:{" "}
-
- {investment?.sponsor}
- {" "}
-
-
- Ann return:{" "}
-
- {investment?.annReturn}
- {" "}
-
-
- Ann Yield:{" "}
-
- {investment?.annYield}
- {" "}
-
-
-
-
-
-
- Min.Invests:{" "}
-
- {investment?.minInvests}
- {" "}
-
-
- Targ Close:{" "}
-
- {investment?.targClose}
- {" "}
-
-
- Holding per:{" "}
-
- {investment?.holdingPer}
- {" "}
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ {investment?.title}
+
+ {investment?.status === "Available"
+ ? "Available"
+ : investment?.status === "Upcomming"
+ ? "Upcomming"
+ : "Closed"}
+
+
+
+ Sponsor:{" "}
+
+ {investment?.sponsor}
+ {" "}
+
+
+ Ann return:{" "}
+
+ {investment?.annReturn}
+ {" "}
+
+
+ Ann Yield:{" "}
+
+ {investment?.annYield}
+ {" "}
+
+
+
+
+
+
+ Min.Invests:{" "}
+
+ {investment?.minInvests}
+ {" "}
+
+
+ Targ Close:{" "}
+
+ {investment?.targClose}
+ {" "}
+
+
+ Holding per:{" "}
+
+ {investment?.holdingPer}
+ {" "}
+
+
+
+
+
+
+
+ $ 500,000.450
+ {investment?.progressValue} % Funded
+
+ {/* */}
+
+ {/* */}
+
+
+
+
+
+
+
);
};
diff --git a/src/Contexts/GlobalStateProvider.jsx b/src/Contexts/GlobalStateProvider.jsx
index 3718cd9..7c802db 100644
--- a/src/Contexts/GlobalStateProvider.jsx
+++ b/src/Contexts/GlobalStateProvider.jsx
@@ -276,6 +276,7 @@ const GlobalStateProvider = ({ children }) => {
targClose: "24 December",
holdingPer: "5-7 years",
progressValue: 80,
+ status: "Available"
},
{
imgSrc:
@@ -288,6 +289,7 @@ const GlobalStateProvider = ({ children }) => {
targClose: "24 December",
holdingPer: "5-7 years",
progressValue: 80,
+ status: "Upcomming"
},
{
imgSrc:
@@ -300,6 +302,7 @@ const GlobalStateProvider = ({ children }) => {
targClose: "24 December",
holdingPer: "5-7 years",
progressValue: 80,
+ status: "Closed"
},
]);
diff --git a/src/Pages/IO_Management/CreateIO.jsx b/src/Pages/IO_Management/CreateIO.jsx
index db9be00..0e8d424 100644
--- a/src/Pages/IO_Management/CreateIO.jsx
+++ b/src/Pages/IO_Management/CreateIO.jsx
@@ -1,22 +1,173 @@
-import { Box, Image, Text } from "@chakra-ui/react"
-// import error from "../assets/Error.svg"
-import robot from "../../assets/robot.png"
-// import robot from "../assets/robot.png"
-const CreateIO = () => {
- return (
-
-
-
- {/* The requested URL was not found on this server. */}
-
- )
-}
+import React, { useContext } from "react";
+import { OPACITY_ON_LOAD } from "../../Layout/animations";
+import {
+ Box,
+ Divider,
+ FormControl,
+ FormLabel,
+ Heading,
+ Input,
+ Select,
+ Textarea,
+ Button,
+ Text,
+} from "@chakra-ui/react";
+import { useForm, Controller } from "react-hook-form";
+import { yupResolver } from "@hookform/resolvers/yup";
+import * as yup from "yup";
+import { WarningTwoIcon } from "@chakra-ui/icons";
+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";
-export default CreateIO
\ No newline at end of file
+const schema = yup.object().shape({
+ sponserName: yup.string().required("Sponser name is required"),
+ mobileNo: yup.string().required("Mobile no is required"),
+ sponserAddress: yup.string().required("Sponser address is required"),
+
+ bankName: yup.string().required("Bank Name is required"),
+ accountNumber: yup.string().required("Account Number is required"),
+ swiftCode: yup.string().required("SWIFT/BIC Code is required"),
+ bankEmail: yup.string().email("Invalid email format"),
+
+ // routingNumber: yup.string().required("Routing Number is required"),
+ // iban: yup.string().required("IBAN is required"),
+ // accountType: yup.string().required("Account Type is required"),
+ // bankPhoneNumber: yup.string().required("Bank Phone Number is required"),
+ // bankBranch: yup.string().required("Bank Branch is required"),
+ // branchAddress: yup.string().required("Branch Address is required"),
+ // ifscCode: yup.string().required("IFSC Code is required"),
+ // accountHolderName: yup.string().required("Account Holder's Name is required"),
+});
+
+
+
+export function debounce(func, delay) {
+ let debounceTimer;
+ return function(...args) {
+ clearTimeout(debounceTimer);
+ debounceTimer = setTimeout(() => func.apply(this, args), delay);
+ };
+}
+const CreateIO = () => {
+ const navigate = useNavigate();
+ const { sponser, setSponser } = useContext(GlobalStateContext);
+ const {
+ control,
+ handleSubmit,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(schema),
+ });
+
+ console.log(errors);
+
+ const onSubmit = (data) => {
+ setSponser([
+ {
+ ...data,
+ status: true,
+ id: uuidv4(),
+ createdAt: new Date().toISOString(),
+ },
+ ...sponser,
+ ]);
+ navigate("/sponser");
+ };
+
+
+ // Extract options for the select input
+ const sponserOptions = sponser.map(item => ({
+ value: item.id,
+ label: item.sponserName
+ }));
+
+ return (
+
+
+
+
+
+ );
+};
+
+export default CreateIO;
diff --git a/src/Pages/IO_Management/ViewIO.jsx b/src/Pages/IO_Management/ViewIO.jsx
index c35d5f2..4c8fb4e 100644
--- a/src/Pages/IO_Management/ViewIO.jsx
+++ b/src/Pages/IO_Management/ViewIO.jsx
@@ -1,6 +1,7 @@
import {
Box,
Image,
+ Input,
Skeleton,
Tab,
TabIndicator,
@@ -16,26 +17,51 @@ import { useContext, useEffect, useState } from "react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
import InvestmentCard from "../../Components/InvestmentCard/InvestmentCard";
import GlobalStateContext from "../../Contexts/GlobalStateContext";
-// import robot from "../assets/robot.png"
+import Pagination from "../../Components/Pagination";
+import EmptySearchList from "../../Components/EmptySearchList";
+
const ExchangeRate = () => {
+ const [searchTerm, setSearchTerm] = useState("");
const { investment, setInvestment } = useContext(GlobalStateContext);
const [isLoading, setIsLoading] = useState(true);
-
-
-
useEffect(() => {
// Simulate loading
const timer = setTimeout(() => {
setIsLoading(false);
}, 1500);
-
// Cleanup the timer on component unmount
return () => clearTimeout(timer);
}, []);
+ // ====================================================[Table Filter]================================================================
+ const filteredData = investment.filter((item) => {
+ // Filter by name (case insensitive)
+ const name = item.title;
+ const searchLower = searchTerm.toLowerCase();
+ const nameMatches = name.toLowerCase().includes(searchLower);
+ // Filter by status
+ // const status = item.status;
+ // const statusLower = status ? "active" : "inactive";
+ // const statusMatches =
+ // statusFilter === "all" ||
+ // (statusFilter === "active" && status === true) ||
+ // (statusFilter === "inactive" && status === false);
+
+ return nameMatches;
+ });
+
+ const availableInvestments = filteredData.filter(
+ (item) => item.status === "Available"
+ );
+ const upcomingInvestments = filteredData.filter(
+ (item) => item.status === "Upcomming"
+ );
+ const closedInvestments = filteredData.filter(
+ (item) => item.status === "Closed"
+ );
return (
@@ -54,18 +80,103 @@ const ExchangeRate = () => {
/>
- {investment?.map((investmentDetails, index) => (
-
- ))}
+
+ setSearchTerm(e.target.value)}
+ />
+
+
+ {filteredData?.length === 0 ? (
+
+ ) : (
+ filteredData?.map((investmentDetails, index) => (
+
+
+
+ ))
+ )}
+
- two!
+
+ setSearchTerm(e.target.value)}
+ />
+
+
+ {availableInvestments?.length === 0 ? (
+
+ ) : (
+ availableInvestments?.map((investmentDetails, index) => (
+
+
+
+ ))
+ )}
+
- three!
+
+ setSearchTerm(e.target.value)}
+ />
+
+
+ {upcomingInvestments?.length === 0 ? (
+
+ ) : (
+ upcomingInvestments?.map((investmentDetails, index) => (
+
+
+
+ ))
+ )}
+
- three!
+
+ setSearchTerm(e.target.value)}
+ />
+
+
+ {closedInvestments?.length === 0 ? (
+
+ ) : (
+ closedInvestments?.map((investmentDetails, index) => (
+
+
+
+ ))
+ )}
diff --git a/src/Pages/Investor_Management/InvestorDetails.jsx b/src/Pages/Investor_Management/InvestorDetails.jsx
index 8b0eb35..7cbf8e5 100644
--- a/src/Pages/Investor_Management/InvestorDetails.jsx
+++ b/src/Pages/Investor_Management/InvestorDetails.jsx
@@ -141,38 +141,9 @@ const InvestorDetails = () => {
// ),
Action: (
-
-
-
- {/* {formatDate(item.createdAt)} */}
- {item.Action}
-
-
-
-
+
),
}));