diff --git a/src/Contexts/GlobalStateProvider.jsx b/src/Contexts/GlobalStateProvider.jsx
index b3cce1a..b172727 100644
--- a/src/Contexts/GlobalStateProvider.jsx
+++ b/src/Contexts/GlobalStateProvider.jsx
@@ -1557,6 +1557,123 @@ const GlobalStateProvider = ({ children }) => {
},
]);
+ const [approved, setApproved] = useState([
+ {
+ id: 1,
+ transactionDate: "02-Jan-24",
+ particulars: "Cash Reserve- Initated",
+ amount: "50,000.00",
+ Comments: "",
+ user: "Faisal",
+ entryDate: "02-Jan-24",
+ },
+ {
+ id: 2,
+ transactionDate: "12-Feb-24",
+ particulars: "Fees & Expense",
+ amount: "-22,000.00",
+ Comments: "",
+ user: "Faisal",
+ entryDate: "13-Feb-24",
+ },
+ {
+ id: 3,
+ transactionDate: "12-Feb-24",
+ particulars: "Distribution Received From Sponsor",
+ amount: "50,000.00",
+ Comments: "",
+ user: "Nawab",
+ entryDate: "24-Mar-24",
+ },
+ {
+ id: 4,
+ transactionDate: "28-Mar-24",
+ particulars: "Distribution Paid To Investors",
+ amount: "-40,000.00",
+ Comments: "",
+ user: "Faisal",
+ entryDate: "28-Mar-24",
+ },
+ {
+ id: 5,
+ transactionDate: "26-Jun-24",
+ particulars: "Distribution Received From Sponsor",
+ amount: "70,000.00",
+ Comments: "",
+ user: "Faisal",
+ entryDate: "27-Jun-24",
+ },
+ {
+ id: 6,
+ transactionDate: "28-Jun-24",
+ particulars: "Distribution Paid To Investors",
+ amount: "-60,000.00",
+ Comments: "",
+ user: "Nawab",
+ entryDate: "28-Jun-24",
+ },
+ ]);
+
+ const [iONAVDetail, setIONAVDetail] = useState([
+ {
+ id: 1,
+ valuationDate: "01-Jul-24",
+ nav: "1,229,750.00 ",
+ lastUpdate: "12.56",
+ investmentClose: "29.45",
+ updatedBy: "Nawab",
+ updatedOn: "01-Jul-24",
+ },
+ {
+ id: 2,
+ valuationDate: "25-Apr-24",
+ nav: "1,092,500.00",
+ lastUpdate: "15.00",
+ investmentClose: "15.00",
+ updatedBy: "Faisal",
+ updatedOn: "25-Apr-24",
+ },
+ {
+ id: 3,
+ valuationDate: "02-Jan-24",
+ nav: "950,000.00",
+ lastUpdate: "",
+ investmentClose: "",
+ updatedBy: "Faisal",
+ updatedOn: "02-Jan-24",
+ },
+ ]);
+
+ const [iOTransaction, setIOTransaction] = useState([
+ {
+ id: 1,
+ transactionName: "Amount Invested",
+ amount: "995,000",
+ createdBy: "Faisal",
+ createdOn: "27-Oct-24",
+ approvedBy: "Nawab",
+ approvedOn: "28-Oct-24",
+ },
+ {
+ id: 2,
+ transactionName: "Distribution To Sponser",
+ amount: "40,000",
+ createdBy: "Faisal",
+ createdOn: "30-Oct-24",
+ approvedBy: "Nawab",
+ approvedOn: "31-Oct-24",
+ },
+ {
+ id: 3,
+ transactionName: "Amount Invested",
+ amount: "995,000",
+ createdBy: "Faisal",
+ createdOn: "27-Oct-24",
+ approvedBy: "Nawab",
+ approvedOn: "28-Oct-24",
+ },
+ ]);
+
const [InvestorWallet, setInvestorWallet] = useState(null);
// ==============[ prod state ]===============================
@@ -1643,7 +1760,13 @@ const GlobalStateProvider = ({ children }) => {
fawateerRequest,
setFawateerRequest,
approveHistory,
- setApproveHistory
+ setApproveHistory,
+ approved,
+ setApproved,
+ iONAVDetail,
+ setIONAVDetail,
+ iOTransaction,
+ setIOTransaction,
}}
>
{children}
diff --git a/src/Pages/Fawateer/CreateRequest.jsx b/src/Pages/Fawateer/CreateRequest.jsx
index 3bd9e39..0529ef9 100644
--- a/src/Pages/Fawateer/CreateRequest.jsx
+++ b/src/Pages/Fawateer/CreateRequest.jsx
@@ -1,17 +1,27 @@
import React, { useState } from "react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
-import { Box, Button, HStack, Input, InputGroup, InputRightAddon, Textarea, useDisclosure, Image, Icon, VStack, Text, useToast } from "@chakra-ui/react";
import {
- FormControl,
- FormLabel,
- FormHelperText,
+ Box,
+ Button,
+ HStack,
+ Input,
+ InputGroup,
+ InputRightAddon,
+ Textarea,
+ useDisclosure,
+ Image,
+ Icon,
+ VStack,
+ Text,
+ useToast,
} from "@chakra-ui/react";
+import { FormControl, FormLabel, FormHelperText } from "@chakra-ui/react";
import { DeleteIcon, Search2Icon } from "@chakra-ui/icons";
import SelectInvestorModal from "./SelectInvestorModal";
import { Controller, useForm } from "react-hook-form"; // Import useForm
import { yupResolver } from "@hookform/resolvers/yup"; // Import resolver for Yup
import * as Yup from "yup"; // Import Yup for validation
-import { motion } from 'framer-motion'; // Import Framer Motion for animations
+import { motion } from "framer-motion"; // Import Framer Motion for animations
import { bytesToMB } from "../../Constants/Constants";
import { useCreateFawateerRequestMutation } from "../../Services/fawateer.maker.service";
import ToastBox from "../../Components/ToastBox";
@@ -23,60 +33,66 @@ const validationSchema = Yup.object().shape({
investorName: Yup.string().required("Investor name is required"),
clientId: Yup.string().required("Client ID is required"),
transaction_date: Yup.date()
- .required('Date is required')
- .transform((value, originalValue) => {
- return originalValue === "" ? null : value; // Convert empty strings to null
- })
- .typeError('Please enter a valid date').max(new Date(), "Date cannot be in the future"),
+ .required("Date is required")
+ .transform((value, originalValue) => {
+ return originalValue === "" ? null : value; // Convert empty strings to null
+ })
+ .typeError("Please enter a valid date")
+ .max(new Date(), "Date cannot be in the future"),
transaction_amount: Yup.number()
- .required("Transaction amount is required")
- .transform((value, originalValue) => originalValue === "" ? null : value) // Convert empty strings to null
- .typeError('Transaction amount must be a number') // Custom error message if it's not a number
- .positive('Transaction amount must be greater than zero'),
+ .required("Transaction amount is required")
+ .transform((value, originalValue) => (originalValue === "" ? null : value)) // Convert empty strings to null
+ .typeError("Transaction amount must be a number") // Custom error message if it's not a number
+ .positive("Transaction amount must be greater than zero"),
spportFile_path: Yup.mixed().required("Support file is required"),
makerComment: Yup.string(),
});
const CreateRequest = () => {
- const toast = useToast()
- const navigate=useNavigate()
+ const toast = useToast();
+ const navigate = useNavigate();
const { isOpen, onOpen, onClose } = useDisclosure();
const [selectedInvestor, setSelectorInvestor] = useState({});
const [filePreview, setFilePreview] = useState(null); // State for previewing the file
const [fileType, setFileType] = useState(null); // State to store file type for conditional rendering
- const[ isLoading, setIsLoading ] = useState(false)
- const [id, setId ] = useState(null)
+ const [isLoading, setIsLoading] = useState(false);
+ const [id, setId] = useState(null);
// Initialize useForm with the resolver for Yup validation
- const {control, register, handleSubmit, setValue,reset, formState: { errors } } = useForm({
+ const {
+ control,
+ register,
+ handleSubmit,
+ setValue,
+ reset,
+ formState: { errors },
+ } = useForm({
resolver: yupResolver(validationSchema),
});
-
- const [ creatFawaateerRequest ] = useCreateFawateerRequestMutation()
-
+ const [creatFawaateerRequest] = useCreateFawateerRequestMutation();
const onSubmit = async (data) => {
console.log(data);
- setIsLoading(true)
-
+ setIsLoading(true);
+
// Convert data to FormData
const formData = new FormData();
-
- // Append each field from the data object to the FormData
- Object.keys(data).forEach((key) => {
- if (key === "spportFile_path" && data[key] instanceof FileList) {
- // Append the first file from FileList (assuming single file input)
- formData.append(key, data[key][0]); // Append the file
- } else {
- formData.append(key, data[key]); // Append other fields
- }
- });
-
+
+ // Append each field from the data object to the FormData
+ Object.keys(data).forEach((key) => {
+ if (key === "spportFile_path" && data[key] instanceof FileList) {
+ // Append the first file from FileList (assuming single file input)
+ formData.append(key, data[key][0]); // Append the file
+ } else {
+ formData.append(key, data[key]); // Append other fields
+ }
+ });
+
try {
// Make the API call with formData
const res = await creatFawaateerRequest({ data: formData, id });
-
+
if (res?.error) {
toast({
render: () => (
@@ -84,39 +100,35 @@ const CreateRequest = () => {
),
});
setIsLoading(false);
- reset()
- return
+ reset();
+ return;
} else if (res?.data) {
toast({
- render: () => (
-
- ),
+ render: () => ,
});
setIsLoading(false);
- navigate('/fawateer-history')
- return
+ navigate("/fawateer-history");
+ return;
} else {
toast({
render: () => (
-
+
),
});
setIsLoading(false);
- return
+ return;
}
-
} catch (error) {
console.error("Error:", error);
toast({
render: () => (
-
+
),
});
setIsLoading(false);
- return
+ return;
}
};
-
// Handle file change and preview
const handleFileChange = (e) => {
@@ -137,15 +149,12 @@ const CreateRequest = () => {
}
};
-
-
-
return (
{
onSubmit={handleSubmit(onSubmit)}
>
{/* Investor Name Field */}
-
+
Investor name
-
+
{
{...register("investorName")}
_placeholder={{ fontSize: "sm" }}
/>
-
+
Search
- {errors.investorName?.message}
+
+ {errors.investorName?.message}
+
{/* Client ID Field */}
@@ -193,7 +220,13 @@ const CreateRequest = () => {
placeholder={"Client ID"}
{...register("clientId")}
/>
- {errors.clientId?.message}
+
+ {errors.clientId?.message}
+
{/* Date Field */}
@@ -208,10 +241,21 @@ const CreateRequest = () => {
fontSize={"sm"}
rounded={"sm"}
type={"date"}
- max={new Date().toISOString().split("T")[0]} // Disable future dates
- {...register("transaction_date")}
+ max={new Date().toLocaleDateString("en-CA")} // Ensures max is in local timezone
+ {...register("transaction_date", {
+ setValueAs: (value) => {
+ // Convert date string to local timezone Date object
+ return value ? new Date(value) : undefined;
+ },
+ })}
/>
- {errors.transaction_date?.message}
+
+ {errors.transaction_date?.message}
+
{/* Amount Field */}
@@ -220,19 +264,35 @@ const CreateRequest = () => {
Amount (BHD)
(
-
- )}
- />
-
+ name="transaction_amount"
+ control={control}
+ render={({ field }) => (
+
+ )}
+ />
+
{errors.transaction_amount?.message}
-
+
{/* Support File Field with Preview */}
-
+
Support file
@@ -249,7 +309,13 @@ const CreateRequest = () => {
{...register("spportFile_path")}
// onChange={handleFileChange}
/>
- {errors.spportFile_path?.message}
+
+ {errors.spportFile_path?.message}
+
{/* Animated Preview */}
{filePreview && fileType?.type.startsWith("image/") && (
@@ -259,14 +325,55 @@ const CreateRequest = () => {
transition={{ duration: 0.5 }}
style={{ marginTop: "10px" }}
>
-
-
- setFilePreview(null)} className="link" rounded={'md'} color={'red.700'} cursor={'pointer'} p={1.5} position={'absolute'} top={0} right={0} as={DeleteIcon} boxSize={7} />
-
- File Name: {fileType?.name}
- File Size: {bytesToMB(fileType?.size)} Mb
- File Type: {fileType?.type}
-
+
+
+ setFilePreview(null)}
+ className="link"
+ rounded={"md"}
+ color={"red.700"}
+ cursor={"pointer"}
+ p={1.5}
+ position={"absolute"}
+ top={0}
+ right={0}
+ as={DeleteIcon}
+ boxSize={7}
+ />
+
+
+ File Name:{" "}
+
+ {" "}
+ {fileType?.name}
+
+
+
+ File Size:{" "}
+
+ {" "}
+ {bytesToMB(fileType?.size)} Mb
+
+
+
+ File Type:{" "}
+
+ {" "}
+ {fileType?.type}
+
+
@@ -274,7 +381,7 @@ const CreateRequest = () => {
{/* Description Field */}
-
+
Description
@@ -287,12 +394,18 @@ const CreateRequest = () => {
placeholder={"Description"}
{...register("makerComment")}
/>
- {errors.makerComment?.message}
+
+ {errors.makerComment?.message}
+
{/* Submit Button */}
-
-
-
+
);
};
diff --git a/src/Pages/FawateerChecker/ApproveRequest/ApproveRequest.jsx b/src/Pages/FawateerChecker/ApproveRequest/ApproveRequest.jsx
index 52f3760..cb45a29 100644
--- a/src/Pages/FawateerChecker/ApproveRequest/ApproveRequest.jsx
+++ b/src/Pages/FawateerChecker/ApproveRequest/ApproveRequest.jsx
@@ -138,7 +138,7 @@ import RequestRejectModal from "./RequestRejectModal";
"Deposit Date",
"Deposit Amount (BHD)",
"Support Image",
- "Action",
+ "Action",
];
diff --git a/src/Pages/IO_Management/CreateIO/AddCashDetails.jsx b/src/Pages/IO_Management/CreateIO/AddCashDetails.jsx
index 695de3d..5b26c14 100644
--- a/src/Pages/IO_Management/CreateIO/AddCashDetails.jsx
+++ b/src/Pages/IO_Management/CreateIO/AddCashDetails.jsx
@@ -56,7 +56,7 @@ const AddCashDetails = ({ isOpen, onClose, firstField, actionId, setActionId, da
const [updateVideoArtifacts] = useUpdateVideoArtifactsMutation()
// const {
// data
- // } = useGetArtifactsQuery(id)
+ // } = useGetArtifactsQuery(id)
const {
control,
@@ -91,11 +91,11 @@ const AddCashDetails = ({ isOpen, onClose, firstField, actionId, setActionId, da
render: () => ,
});
}
-
+
} catch (error) {
console.log(error);
-
+ setIsLoading(false);
}
};
diff --git a/src/Pages/IO_Management/CreateIO/CreateIO.jsx b/src/Pages/IO_Management/CreateIO/CreateIO.jsx
index cc0599e..b5a81eb 100644
--- a/src/Pages/IO_Management/CreateIO/CreateIO.jsx
+++ b/src/Pages/IO_Management/CreateIO/CreateIO.jsx
@@ -8,8 +8,8 @@ import IODetails from "./IODetails";
import KeyMerits from "./KeyMerits";
import IOArtifacts from "./IOArtifacts";
import Investors from "./Investors";
-import IOCashDetails from "./IOCashDetails";
-import IONAVDetails from "./IONAVDetails";
+// import IOCashDetails from "./IOCashDetailsold";
+// import IONAVDetails from "./IONAVDetailsOld";
import InvestmentDocument from "./InvestmentDocument"; // Ensure this is the correct import
import ViewIOdataHeader from "../ViewIO/ViewIOdataHeader";
import { useParams } from "react-router-dom";
@@ -17,6 +17,9 @@ import FullscreenLoaders from "../../../Components/Loaders/FullscreenLoaders";
import { useGetIOprepopulateDataQuery } from "../../../Services/io.service";
import UnderConstruction from "../../UnderConstruction";
import Destribution from "./Destribution";
+import IOCashDetails from "./IOCashDetails/IOCashDetails";
+import IONAVDetails from "./IONAVDetails/IONAVDetails";
+import IOTransaction from "./IOTransaction/IOTransaction";
const CreateIO = () => {
const id = useParams()?.id;
@@ -75,6 +78,11 @@ const CreateIO = () => {
Content: Destribution,
isDisabled: id ? true : true,
},
+ {
+ label: "IO Transaction",
+ Content: IOTransaction,
+ isDisabled: id ? true : true,
+ },
];
const [tabs, setTabs] = useState(initialTabsState);
@@ -114,7 +122,8 @@ const CreateIO = () => {
{
const { navDetails, setNavDetails, IODetails } =
useContext(GlobalStateContext);
- const firstField = useRef();
- const { isOpen, onOpen, onClose } = useDisclosure();
- const [searchTerm, setSearchTerm] = useState("");
- const [isLoading, setIsLoading] = useState(true);
- const [deleteAlert, setDeleteAlert] = useState(false);
- const [actionId, setActionId] = useState(false);
- const [mouseEntered, setMouseEntered] = useState(false);
- const [mouseEnteredId, setMouseEnteredId] = useState("");
+ const firstField = useRef();
+ const { isOpen, onOpen, onClose } = useDisclosure();
+ const [searchTerm, setSearchTerm] = useState("");
+ const [isLoading, setIsLoading] = useState(true);
+ const [deleteAlert, setDeleteAlert] = useState(false);
+ const [actionId, setActionId] = useState(false);
+ const [mouseEntered, setMouseEntered] = useState(false);
+ const [mouseEnteredId, setMouseEnteredId] = useState("");
+ console.log(IODetails?.ioNAVHistory);
+
+ const formatDate = (date) => {
+ return new Date(date).toLocaleDateString("en-GB", {
+ day: "2-digit",
+ month: "2-digit",
+ year: "numeric",
+ });
+ };
- console.log(IODetails?.ioNAVHistory);
-
- const formatDate = (date) => {
- return new Date(date).toLocaleDateString('en-GB', {
- day: '2-digit',
- month: '2-digit',
- year: 'numeric',
- });
- };
-
useEffect(() => {
// Simulate loading
const timer = setTimeout(() => {
@@ -42,32 +54,38 @@ const Destribution = () => {
return () => clearTimeout(timer);
}, []);
- // Table setup
- const tableHeadRow = [
- // "Sr.No",
- "Date",
- "Amount",
- "% of Investment"
- ];
+ // Table setup
+ const tableHeadRow = [
+ // "Sr.No",
+ "Date",
+ "Amount",
+ "% of Investment",
+ ];
- // Table filter
- const filteredData = IODetails?.distributionToInvestor?.filter((item) => {
- const name = item?.transactionAmount;
- const searchLower = searchTerm.toLowerCase();
- const nameMatches = name.toLowerCase().includes(searchLower);
- return nameMatches;
- }).sort((b, a) => new Date(a.transactionDate) - new Date(b.transactionDate));
+ // Table filter
+ const filteredData = IODetails?.distributionToInvestor
+ ?.filter((item) => {
+ const name = item?.transactionAmount;
+ const searchLower = searchTerm.toLowerCase();
+ const nameMatches = name.toLowerCase().includes(searchLower);
+ return nameMatches;
+ })
+ .sort((b, a) => new Date(a.transactionDate) - new Date(b.transactionDate));
- const extractedArray=filteredData?.map((item, index) => ({
+ const extractedArray = filteredData?.map((item, index) => ({
id: item?.id,
- "Sr.No": {item?.id},
- "Date": (
+ "Sr.No": (
+
+ {item?.id}
+
+ ),
+ Date: (
{
{formatDate(item.transactionDate)}
),
- "Amount": (
+ Amount: (
{
fontWeight={"500"}
className="d-flex align-items-center web-text-small"
>
- $
+
+ $
+
{`${parseFloat(item.transactionAmount || 0).toLocaleString(undefined, {
- minimumFractionDigits: 2,
- maximumFractionDigits: 2,
- })}`}
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}`}
),
"% of Investment": (
@@ -106,12 +126,8 @@ const Destribution = () => {
),
}));
-
-
const handleDelete = () => {
- const updatedNav = navDetails.filter(
- (sponsor) => sponsor.id !== actionId
- );
+ const updatedNav = navDetails.filter((sponsor) => sponsor.id !== actionId);
setTimeout(() => {
setNavDetails(updatedNav);
@@ -121,12 +137,11 @@ const Destribution = () => {
setIsLoading(true);
};
-
const Total = () => {
return (
-
+
| {
wordBreak="normal"
overflowWrap="normal"
>
-
- ${IODetails?.total_distributeToInvestor_amt?.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
+
+ $
+
+ {IODetails?.total_distributeToInvestor_amt?.toLocaleString(
+ undefined,
+ { minimumFractionDigits: 2, maximumFractionDigits: 2 }
+ )}
|
{
);
};
+ return (
+
+
+
+ setSearchTerm(e.target.value)}
+ />
+
+
+ }
+ setMouseEnteredId={setMouseEnteredId}
+ setMouseEntered={setMouseEntered}
+ />
+ setDeleteAlert(false)}
+ isOpen={deleteAlert}
+ message={"Are you sure you want to delete sponers?"}
+ alertHandler={handleDelete}
+ isLoading={isLoading}
+ />
- return (
-
-
- setSearchTerm(e.target.value)}
- />
-
-
+
+ );
+};
- }
- setMouseEnteredId={setMouseEnteredId}
- setMouseEntered={setMouseEntered}
- />
-
- setDeleteAlert(false)}
- isOpen={deleteAlert}
- message={"Are you sure you want to delete sponers?"}
- alertHandler={handleDelete}
- isLoading={isLoading}
- />
-
-
-
-
-
-
-
- )
-}
-
-export default Destribution
\ No newline at end of file
+export default Destribution;
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/AddCaseDetails.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/AddCaseDetails.jsx
new file mode 100644
index 0000000..3bc016d
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/AddCaseDetails.jsx
@@ -0,0 +1,255 @@
+import {
+ Box,
+ Button,
+ Drawer,
+ DrawerBody,
+ DrawerCloseButton,
+ DrawerContent,
+ DrawerFooter,
+ DrawerHeader,
+ DrawerOverlay,
+ FormControl,
+ FormErrorMessage,
+ FormLabel,
+ Input,
+ Select,
+ Stack,
+ Textarea,
+ useToast,
+} from "@chakra-ui/react";
+import * as yup from "yup";
+import React, { useState, useEffect, useContext } from "react";
+import { useForm, Controller } from "react-hook-form";
+import { yupResolver } from "@hookform/resolvers/yup";
+import { v4 as uuidv4 } from "uuid";
+import { useParams } from "react-router-dom";
+import CustomAlertDialog from "../../../../Components/CustomAlertDialog";
+import { useCreateIoCashMutation, useCreateVideoArtifactsMutation, useUpdateVideoArtifactsMutation } from "../../../../Services/io.service";
+import ToastBox from "../../../../Components/ToastBox";
+import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import CurrencyInput from "../../../../Components/CurrencyInput";
+
+const cashDetails = yup.object().shape({
+ transactionDate: yup.string().required("Date is required"),
+ ioTransType_xid: yup.number().required("Cash transaction is required"),
+ transactionAmount: yup.number().required("Transaction Amount is required"),
+ comments: yup.string().notRequired(),
+});
+
+const AddCaseDetails = ({ isOpen, onClose, firstField, actionId, setActionId, data }) => {
+ const params = useParams()
+ const id = params?.id
+ const [file, setFile] = useState("");
+ const [fileName, setFileName] = useState("");
+ const [isLoading, setIsLoading] = useState(false)
+ const [alert, setAlert] = useState(false);
+ const toast = useToast();
+
+ console.log(isOpen);
+
+
+
+
+ // ======================[ Cotext Api ]
+ const { IODetails } = useContext(GlobalStateContext);
+ const found = data?.find((item) => item?.id === actionId);
+
+
+ const [createArtifactsVideo] = useCreateVideoArtifactsMutation()
+ const [updateVideoArtifacts] = useUpdateVideoArtifactsMutation()
+ // const {
+ // data
+ // } = useGetArtifactsQuery(id)
+
+ const {
+ control,
+ handleSubmit,
+ watch,
+ reset,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(cashDetails),
+ });
+
+
+ const [createIoCash] = useCreateIoCashMutation()
+
+
+ const onSubmit = async (data) => {
+
+ setIsLoading(true)
+
+ try {
+
+ const res = await createIoCash({ data, id })
+ if (res?.data) {
+ setIsLoading(false);
+ toast({
+ render: () => ,
+ });
+ handleClose()
+ }else if(res?.error){
+ setIsLoading(false);
+ toast({
+ render: () => ,
+ });
+ }
+
+ } catch (error) {
+ console.log(error);
+ setIsLoading(false);
+ }
+
+ };
+
+
+
+ const handleConfirm = () => {
+ handleSubmit(onSubmit)();
+ };
+
+ const handleSave = () => {
+ handleSubmit(onSubmit)();
+ };
+
+ const handleClose = () => {
+ setAlert(false)
+ onClose()
+ reset({
+ transactionAmount:""
+ })
+ }
+
+ return (
+ <>
+
+
+
+
+ IO Cash Details
+
+
+
+
+ Date Selection
+ (
+
+ )}
+ />
+
+ {errors.transactionDate?.message}
+
+
+
+
+
+ Cash transaction
+ (
+
+ )}
+ />
+
+ {errors.ioTransType_xid?.message}
+
+
+
+
+
+
+
+ Transaction Amount
+ (
+
+ )}
+ />
+
+ {errors.transactionAmount?.message}
+
+
+
+
+
+
+ Comments
+ (
+
+ )}
+ />
+
+ {errors.comments?.message}
+
+
+
+
+
+
+
+
+ Cancel
+
+
+ setAlert(true)}
+ >
+ Save
+
+
+
+
+
+
+ setAlert(false)}
+ alertHandler={handleSave}
+ message={"Are you sure you want to add cash details?"}
+ isLoading={isLoading}
+ />
+ >
+ );
+};
+
+export default AddCaseDetails;
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/AddPending.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/AddPending.jsx
new file mode 100644
index 0000000..7209f35
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/AddPending.jsx
@@ -0,0 +1,251 @@
+import {
+ Box,
+ Button,
+ Drawer,
+ DrawerBody,
+ DrawerCloseButton,
+ DrawerContent,
+ DrawerFooter,
+ DrawerHeader,
+ DrawerOverlay,
+ FormControl,
+ FormErrorMessage,
+ FormLabel,
+ Input,
+ Select,
+ Stack,
+ Textarea,
+ useToast,
+} from "@chakra-ui/react";
+import * as yup from "yup";
+import React, { useState, useEffect, useContext } from "react";
+import { useForm, Controller } from "react-hook-form";
+import { yupResolver } from "@hookform/resolvers/yup";
+import { v4 as uuidv4 } from "uuid";
+import { useParams } from "react-router-dom";
+import CustomAlertDialog from "../../../../Components/CustomAlertDialog";
+import { useCreateIoCashMutation, useCreateVideoArtifactsMutation, useUpdateVideoArtifactsMutation } from "../../../../Services/io.service";
+import ToastBox from "../../../../Components/ToastBox";
+import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import CurrencyInput from "../../../../Components/CurrencyInput";
+
+const cashDetails = yup.object().shape({
+ transactionDate: yup.string().required("Date is required"),
+ ioTransType_xid: yup.number().required("Cash transaction is required"),
+ transactionAmount: yup.number().required("Transaction Amount is required"),
+ comments: yup.string().notRequired(),
+});
+
+const AddPending = ({ isOpen, onClose, firstField, actionId, setActionId, data }) => {
+ const params = useParams()
+ const id = params?.id
+ const [file, setFile] = useState("");
+ const [fileName, setFileName] = useState("");
+ const [isLoading, setIsLoading] = useState(false)
+ const [alert, setAlert] = useState(false);
+ const toast = useToast();
+
+
+
+ // ======================[ Cotext Api ]
+ const { IODetails } = useContext(GlobalStateContext);
+ const found = data?.find((item) => item?.id === actionId);
+
+
+ const [createArtifactsVideo] = useCreateVideoArtifactsMutation()
+ const [updateVideoArtifacts] = useUpdateVideoArtifactsMutation()
+ // const {
+ // data
+ // } = useGetArtifactsQuery(id)
+
+ const {
+ control,
+ handleSubmit,
+ watch,
+ reset,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(cashDetails),
+ });
+
+
+ const [createIoCash] = useCreateIoCashMutation()
+
+
+ const onSubmit = async (data) => {
+
+ setIsLoading(true)
+
+ try {
+
+ const res = await createIoCash({ data, id })
+ if (res?.data?.statusCode === 200) {
+ setIsLoading(false);
+ toast({
+ render: () => ,
+ });
+ handleClose()
+ }else if(res?.error?.status === 400){
+ setIsLoading(false);
+ toast({
+ render: () => ,
+ });
+ }
+
+ } catch (error) {
+ console.log(error);
+ }
+
+ };
+
+
+
+ const handleConfirm = () => {
+ handleSubmit(onSubmit)();
+ };
+
+ const handleSave = () => {
+ handleSubmit(onSubmit)();
+ };
+
+ const handleClose = () => {
+ setAlert(false)
+ onClose()
+ reset({
+ transactionAmount:""
+ })
+ }
+
+ return (
+ <>
+
+
+
+
+ IO Cash Details
+
+
+
+
+ Date Selection
+ (
+
+ )}
+ />
+
+ {errors.transactionDate?.message}
+
+
+
+
+
+ Cash transaction
+ (
+
+ )}
+ />
+
+ {errors.ioTransType_xid?.message}
+
+
+
+
+
+
+
+ Transaction Amount
+ (
+
+ )}
+ />
+
+ {errors.transactionAmount?.message}
+
+
+
+
+
+
+ Comments
+ (
+
+ )}
+ />
+
+ {errors.comments?.message}
+
+
+
+
+
+
+
+
+ Cancel
+
+
+ setAlert(true)}
+ >
+ Save
+
+
+
+
+
+
+ setAlert(false)}
+ alertHandler={handleSave}
+ message={"Are you sure you want to add cash details?"}
+ isLoading={isLoading}
+ />
+ >
+ );
+};
+
+export default AddPending;
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/AddRejected.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/AddRejected.jsx
new file mode 100644
index 0000000..197df0c
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/AddRejected.jsx
@@ -0,0 +1,251 @@
+import {
+ Box,
+ Button,
+ Drawer,
+ DrawerBody,
+ DrawerCloseButton,
+ DrawerContent,
+ DrawerFooter,
+ DrawerHeader,
+ DrawerOverlay,
+ FormControl,
+ FormErrorMessage,
+ FormLabel,
+ Input,
+ Select,
+ Stack,
+ Textarea,
+ useToast,
+} from "@chakra-ui/react";
+import * as yup from "yup";
+import React, { useState, useEffect, useContext } from "react";
+import { useForm, Controller } from "react-hook-form";
+import { yupResolver } from "@hookform/resolvers/yup";
+import { v4 as uuidv4 } from "uuid";
+import { useParams } from "react-router-dom";
+import CustomAlertDialog from "../../../../Components/CustomAlertDialog";
+import { useCreateIoCashMutation, useCreateVideoArtifactsMutation, useUpdateVideoArtifactsMutation } from "../../../../Services/io.service";
+import ToastBox from "../../../../Components/ToastBox";
+import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import CurrencyInput from "../../../../Components/CurrencyInput";
+
+const cashDetails = yup.object().shape({
+ transactionDate: yup.string().required("Date is required"),
+ ioTransType_xid: yup.number().required("Cash transaction is required"),
+ transactionAmount: yup.number().required("Transaction Amount is required"),
+ comments: yup.string().notRequired(),
+});
+
+const AddRejected = ({ isOpen, onClose, firstField, actionId, setActionId, data }) => {
+ const params = useParams()
+ const id = params?.id
+ const [file, setFile] = useState("");
+ const [fileName, setFileName] = useState("");
+ const [isLoading, setIsLoading] = useState(false)
+ const [alert, setAlert] = useState(false);
+ const toast = useToast();
+
+
+
+ // ======================[ Cotext Api ]
+ const { IODetails } = useContext(GlobalStateContext);
+ const found = data?.find((item) => item?.id === actionId);
+
+
+ const [createArtifactsVideo] = useCreateVideoArtifactsMutation()
+ const [updateVideoArtifacts] = useUpdateVideoArtifactsMutation()
+ // const {
+ // data
+ // } = useGetArtifactsQuery(id)
+
+ const {
+ control,
+ handleSubmit,
+ watch,
+ reset,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(cashDetails),
+ });
+
+
+ const [createIoCash] = useCreateIoCashMutation()
+
+
+ const onSubmit = async (data) => {
+
+ setIsLoading(true)
+
+ try {
+
+ const res = await createIoCash({ data, id })
+ if (res?.data?.statusCode === 200) {
+ setIsLoading(false);
+ toast({
+ render: () => ,
+ });
+ handleClose()
+ }else if(res?.error?.status === 400){
+ setIsLoading(false);
+ toast({
+ render: () => ,
+ });
+ }
+
+ } catch (error) {
+ console.log(error);
+ }
+
+ };
+
+
+
+ const handleConfirm = () => {
+ handleSubmit(onSubmit)();
+ };
+
+ const handleSave = () => {
+ handleSubmit(onSubmit)();
+ };
+
+ const handleClose = () => {
+ setAlert(false)
+ onClose()
+ reset({
+ transactionAmount:""
+ })
+ }
+
+ return (
+ <>
+
+
+
+
+ IO Cash Details
+
+
+
+
+ Date Selection
+ (
+
+ )}
+ />
+
+ {errors.transactionDate?.message}
+
+
+
+
+
+ Cash transaction
+ (
+
+ )}
+ />
+
+ {errors.ioTransType_xid?.message}
+
+
+
+
+
+
+
+ Transaction Amount
+ (
+
+ )}
+ />
+
+ {errors.transactionAmount?.message}
+
+
+
+
+
+
+ Comments
+ (
+
+ )}
+ />
+
+ {errors.comments?.message}
+
+
+
+
+
+
+
+
+ Cancel
+
+
+ setAlert(true)}
+ >
+ Save
+
+
+
+
+
+
+ setAlert(false)}
+ alertHandler={handleSave}
+ message={"Are you sure you want to add cash details?"}
+ isLoading={isLoading}
+ />
+ >
+ );
+};
+
+export default AddRejected;
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx
new file mode 100644
index 0000000..749498b
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx
@@ -0,0 +1,397 @@
+import {
+ Avatar,
+ Badge,
+ Box,
+ Button,
+ HStack,
+ Input,
+ Table,
+ Tag,
+ Tbody,
+ Text,
+ Th,
+ Tooltip,
+ Tr,
+ useDisclosure,
+ useToast,
+} from "@chakra-ui/react";
+import React, { useContext, useEffect, useRef, useState } from "react";
+import { AddIcon, DeleteIcon, EditIcon, ViewIcon } from "@chakra-ui/icons";
+import { LuFileSpreadsheet } from "react-icons/lu";
+import * as XLSX from "xlsx";
+import { OPACITY_ON_LOAD } from "../../../../Layout/animations";
+import NormalTable from "../../../../Components/DataTable/NormalTable";
+import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import CustomAlertDialog from "../../../../Components/CustomAlertDialog";
+import ToastBox from "../../../../Components/ToastBox";
+import AddCashDetails from "../AddCashDetails";
+import { debounce } from "../../../Admin/Contact";
+import AddApproved from "./AddCaseDetails";
+import { useUpdateIOCaseMutation } from "../../../../Services/io.service";
+import { useParams } from "react-router-dom";
+import AddCaseDetails from "./AddCaseDetails";
+
+const formatDate = (date) => new Date(date).toLocaleDateString();
+
+const Approved = () => {
+ const firstField = useRef();
+ const params = useParams();
+ const toast = useToast();
+ const id = params?.id;
+ const { isOpen, onOpen, onClose } = useDisclosure();
+ const { IODetails, approved, setApproved } = useContext(GlobalStateContext);
+ const [searchTerm, setSearchTerm] = useState("");
+ const [isLoading, setIsLoading] = useState(true);
+ const [deleteAlert, setDeleteAlert] = useState(false);
+ const [actionId, setActionId] = useState(false);
+ const [mouseEntered, setMouseEntered] = useState(false);
+ const [mouseEnteredId, setMouseEnteredId] = useState("");
+
+ useEffect(() => {
+ // Simulate loading
+ const timer = setTimeout(() => {
+ setIsLoading(false);
+ }, 1500);
+
+ // Cleanup the timer on component unmount
+ return () => clearTimeout(timer);
+ }, []);
+
+ const formatDate = (date) => {
+ return new Date(date).toLocaleDateString("en-GB", {
+ day: "2-digit",
+ month: "2-digit",
+ year: "numeric",
+ });
+ };
+
+ console.log("==============", IODetails?.ioCashStatusHistory?.Approved);
+
+ // Table filter
+ const filteredData = IODetails?.ioCashStatusHistory?.Approved?.filter(
+ (item) => {
+ // Filter by name (case insensitive)
+ const name = item.transactionDate;
+ const searchLower = searchTerm.toLowerCase();
+ const nameMatches = name.toLowerCase().includes(searchLower);
+ return nameMatches;
+ }
+ );
+
+ const [updateIOCase] = useUpdateIOCaseMutation();
+
+ const tableHeadRow = [
+ "Sr No.",
+ "Transaction date",
+ "Transaction Type",
+ "Amount",
+ "Comments",
+ "Update by",
+ "Update On",
+ ];
+
+ const extractedArray = filteredData?.map((item, index) => ({
+ id: item?.id,
+ "Sr No.": (
+
+ {index + 1}.
+
+ ),
+ "Transaction date": (
+
+ {formatDate(item?.transactionDate)}
+
+ ),
+ "Transaction Type": (
+
+ {item?.transactionType}
+
+ ),
+ Amount: (
+
+
+ $
+
+ {parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+ ),
+ Comments: (
+
+ {item?.comments ? item?.comments : "---"}
+
+ ),
+ "Update by": (
+
+ {/* */}
+ {item?.modifier?.firstName}
+
+ ),
+ "Update On": (
+
+ {formatDate(item.updatedAt)}
+
+ ),
+ }));
+
+ const handleDelete = () => {
+ const updatedSponsors = sponser.filter(
+ (sponsor) => sponsor.id !== actionId
+ );
+
+ setTimeout(() => {
+ setCaseDetails(updatedSponsors);
+ setDeleteAlert(false);
+ setIsLoading(false);
+ }, 100);
+ setIsLoading(true);
+ };
+
+ const ioCashExporteDetails = IODetails?.ioCashStatusHistory?.Approved?.map(
+ (item, index) => ({
+ "Transaction date": item?.transactionDate,
+ "Transaction type": item?.transactionType,
+ Amount: parseFloat(item?.transactionAmount) || 0,
+ Comments: item?.comments,
+ })
+ );
+
+ const exportToExcelNew = (data, fileName) => {
+ const worksheet = XLSX.utils.json_to_sheet(data);
+ const workbook = XLSX.utils.book_new();
+ XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1");
+
+ // Export file
+ XLSX.writeFile(workbook, `${fileName}.xlsx`);
+ };
+
+ const Total = () => {
+ return (
+
+
+
+ |
+ Balance in IO Cash
+ |
+
+ {" "}
+ |
+
+ {" "}
+ |
+
+
+ $
+
+ {/* {IODetails?.ioCash} */}
+ {parseFloat(IODetails?.ioCash || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+ |
+
+ {}
+ |
+
+ {" "}
+ |
+ |
+ |
+
+
+
+ );
+ };
+
+ const handleAdd = async () => {
+ try {
+ const res = await updateIOCase(id);
+ if (res?.data) {
+ // toast({
+ // render: () => (
+ //
+ // ),
+ // });
+ setIsLoading(false);
+ onOpen();
+ } else if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsLoading(false);
+ }
+ } catch (error) {}
+ };
+
+ return (
+
+
+
+ setSearchTerm(e.target.value)}
+ />
+
+
+
+ exportToExcelNew(ioCashExporteDetails, "IO Cash History")
+ }
+ leftIcon={}
+ colorScheme="forestGreen"
+ size={"sm"}
+ variant={"outline"}
+ rounded={"sm"}
+ fontSize={"xs"}
+ isDisabled={ioCashExporteDetails?.length === 0}
+ >
+ Export xls
+
+ {/* }
+ colorScheme={"forestGreen"}
+ rounded={"sm"}
+ fontSize={"xs"}
+ size={"sm"}
+ fontWeight={500}
+ >
+ Add
+ */}
+ {/* {IODetails?.isInvestedAmount ? (
+ localStorage?.getItem('role') ==="Maker" && }
+ colorScheme="forestGreen"
+ size={"sm"}
+ rounded={"sm"}
+ fontSize={"xs"}
+ >
+ Add
+
+ ) : null} */}
+
+
+
+
+ }
+ setMouseEnteredId={setMouseEnteredId}
+ setMouseEntered={setMouseEntered}
+ />
+
+ {/* setDeleteAlert(false)}
+ isOpen={deleteAlert}
+ message={"Are you sure you want to delete sponers?"}
+ alertHandler={handleDelete}
+ isLoading={isLoading}
+ /> */}
+
+
+
+ );
+};
+
+export default Approved;
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/IOCashDetails.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/IOCashDetails.jsx
new file mode 100644
index 0000000..3055a43
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/IOCashDetails.jsx
@@ -0,0 +1,130 @@
+import {
+ Box,
+ Button,
+ Tab,
+ TabList,
+ TabPanel,
+ TabPanels,
+ Tabs,
+ useDisclosure,
+ useToast,
+} from "@chakra-ui/react";
+import React, { useContext, useRef } from "react";
+import Approved from "./Approved";
+import Pending from "./Pending";
+import Rejected from "./Rejected";
+import { AddIcon } from "@chakra-ui/icons";
+import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import AddCaseDetails from "./AddCaseDetails";
+import { useUpdateIOCaseMutation } from "../../../../Services/io.service";
+import ToastBox from "../../../../Components/ToastBox";
+import { useParams } from "react-router-dom";
+
+const IOCashDetails = () => {
+ const params = useParams();
+ const toast = useToast();
+ const id = params?.id;
+ const { IODetails} = useContext(GlobalStateContext);
+ const { isOpen, onOpen, onClose } = useDisclosure();
+ const firstField = useRef();
+
+ const [updateIOCase] = useUpdateIOCaseMutation();
+
+ const handleAdd = async () => {
+
+
+ try {
+ const res = await updateIOCase(id);
+ if (res?.data) {
+ // toast({
+ // render: () => (
+ //
+ // ),
+ // });
+ // setIsLoading(false);
+ onOpen();
+ } else if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsLoading(false);
+ }
+ } catch (error) {}
+ };
+
+ return (
+
+
+
+
+
+ Approved
+
+
+ Pending
+
+
+ Rejected
+
+
+ {IODetails?.isInvestedAmount ? (
+ localStorage?.getItem('role') ==="Maker" &&
+ }
+ colorScheme="forestGreen"
+ size={"sm"}
+ rounded={"sm"}
+ fontSize={"xs"}
+ >
+ Add
+
+ ) : null}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default IOCashDetails;
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx
new file mode 100644
index 0000000..fa7e9db
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx
@@ -0,0 +1,465 @@
+import {
+ Avatar,
+ Badge,
+ Box,
+ Button,
+ HStack,
+ Input,
+ Table,
+ Tag,
+ Tbody,
+ Text,
+ Th,
+ Tooltip,
+ Tr,
+ useDisclosure,
+ useToast,
+} from "@chakra-ui/react";
+import React, { useContext, useEffect, useRef, useState } from "react";
+import {
+ AddIcon,
+ CheckIcon,
+ CloseIcon,
+ DeleteIcon,
+ EditIcon,
+ ViewIcon,
+} from "@chakra-ui/icons";
+import { LuFileSpreadsheet } from "react-icons/lu";
+import { OPACITY_ON_LOAD } from "../../../../Layout/animations";
+import NormalTable from "../../../../Components/DataTable/NormalTable";
+import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import CustomAlertDialog from "../../../../Components/CustomAlertDialog";
+import ToastBox from "../../../../Components/ToastBox";
+import AddCashDetails from "../AddCashDetails";
+import { debounce } from "../../../Admin/Contact";
+import AddPending from "./AddPending";
+import { useParams } from "react-router-dom";
+import { useUpdateIOCaseMutation } from "../../../../Services/io.service";
+import RequestApproveModal from "./RequestApproveModal";
+import RequestRejectModal from "./RequestRejectModal";
+import AddCaseDetails from "./AddCaseDetails";
+
+const formatDate = (date) => new Date(date).toLocaleDateString();
+
+const Pending = () => {
+ const toast = useToast();
+ const params = useParams();
+ const id = params?.id;
+ const firstField = useRef();
+ const { isOpen, onOpen, onClose } = useDisclosure();
+ const { IODetails, approved, setApproved } = useContext(GlobalStateContext);
+ const [searchTerm, setSearchTerm] = useState("");
+ const [isLoading, setIsLoading] = useState(true);
+ const [deleteAlert, setDeleteAlert] = useState(false);
+ const [actionId, setActionId] = useState(false);
+ const [mouseEntered, setMouseEntered] = useState(false);
+ const [mouseEnteredId, setMouseEnteredId] = useState("");
+
+ const [updateIOCase] = useUpdateIOCaseMutation();
+ const {
+ isOpen: isConfirmOpen,
+ onOpen: onConfirmOpen,
+ onClose: onConfirmClose,
+ } = useDisclosure();
+ const {
+ isOpen: isRejectOpen,
+ onOpen: onRejectOpen,
+ onClose: onRejectClose,
+ } = useDisclosure();
+
+ useEffect(() => {
+ // Simulate loading
+ const timer = setTimeout(() => {
+ setIsLoading(false);
+ }, 1500);
+
+ // Cleanup the timer on component unmount
+ return () => clearTimeout(timer);
+ }, []);
+
+ const formatDate = (date) => {
+ return new Date(date).toLocaleDateString("en-GB", {
+ day: "2-digit",
+ month: "2-digit",
+ year: "numeric",
+ });
+ };
+
+ // Table filter
+ const filteredData = IODetails?.ioCashStatusHistory?.Pending?.filter(
+ (item) => {
+ // Filter by name (case insensitive)
+ const name = item?.transactionDate;
+ const searchLower = searchTerm?.toLowerCase();
+ const nameMatches = name?.toLowerCase().includes(searchLower);
+ return nameMatches;
+ }
+ );
+
+ const tableHeadRow = [
+ "Sr No.",
+ "Transaction date",
+ "Transaction Type",
+ "Amount",
+ "Comments",
+ "Update by",
+ "Update On",
+ ...(localStorage?.getItem('role')!=="Maker" ? ["Actions"] : []),
+
+ ];
+
+ const extractedArray = filteredData?.map((item, index) => ({
+ id: item?.id,
+ "Sr No.": (
+
+ {index + 1}.
+
+ ),
+ "Transaction date": (
+
+ {formatDate(item?.transactionDate)}
+
+ ),
+ "Transaction Type": (
+
+ {item?.transactionType}
+
+ ),
+ Amount: (
+
+
+ $
+
+ {parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+ ),
+ Comments: (
+
+ {item?.comments}
+
+ ),
+ "Update by": (
+
+ {/* */}
+ {item?.modifier?.firstName}
+
+ ),
+ "Update On": (
+
+ {formatDate(item.updatedAt)}
+
+ ),
+ Actions: (
+
+ {localStorage?.getItem("role") !== "Maker" ?
+ {index===0&&
+
+ {
+ setActionId(item.id);
+ onConfirmOpen();
+ }}
+ colorScheme="green"
+ variant={"solid"}
+ cursor={"pointer"}
+ >
+
+
+
+
+ {
+ setActionId(item.id);
+ onRejectOpen();
+ }}
+ py={1}
+ // variant={"solid"}
+ >
+
+
+ }
+
+ : {
+ setActionId(item.id);
+ }}
+ >
+ View
+ }
+
+ ),
+ }));
+
+ const handleDelete = () => {
+ const updatedSponsors = sponser.filter(
+ (sponsor) => sponsor.id !== actionId
+ );
+
+ setTimeout(() => {
+ setCaseDetails(updatedSponsors);
+ setDeleteAlert(false);
+ setIsLoading(false);
+ }, 100);
+ setIsLoading(true);
+ };
+
+ const ioCashExporteDetails = IODetails?.ioCashStatusHistory?.Approved?.map(
+ (item, index) => ({
+ "Transaction date": item?.transactionDate,
+ "Transaction type": item?.transactionType,
+ Amount: parseFloat(item?.transactionAmount) || 0,
+ Comments: item?.comments,
+ })
+ );
+
+ const Total = () => {
+ return (
+
+
+
+ |
+ Balance in IO Cash
+ |
+
+ {" "}
+ |
+
+ {}
+ |
+
+
+ $
+
+ {parseFloat(IODetails?.ioCash || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+ |
+
+ {" "}
+ |
+ |
+ |
+ |
+
+
+
+ );
+ };
+
+ const handleAdd = async () => {
+ try {
+ const res = await updateIOCase(id);
+ if (res?.data) {
+ // toast({
+ // render: () => (
+ //
+ // ),
+ // });
+ setIsLoading(false);
+ onOpen();
+ } else if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsLoading(false);
+ }
+ } catch (error) {}
+ };
+
+ return (
+
+
+
+ setSearchTerm(e.target.value)}
+ />
+
+ {/*
+ {IODetails?.isInvestedAmount ? (
+ localStorage?.getItem('role') ==="Maker"&& }
+ colorScheme="forestGreen"
+ size={"sm"}
+ rounded={"sm"}
+ fontSize={"xs"}
+ >
+ Add
+
+ ) : null}
+ */}
+
+
+
+ }
+ setMouseEnteredId={setMouseEnteredId}
+ setMouseEntered={setMouseEntered}
+ />
+
+ setDeleteAlert(false)}
+ isOpen={deleteAlert}
+ message={"Are you sure you want to delete sponers?"}
+ alertHandler={handleDelete}
+ isLoading={isLoading}
+ />
+
+
+
+
+
+
+ );
+};
+
+export default Pending;
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx
new file mode 100644
index 0000000..470fdc8
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx
@@ -0,0 +1,357 @@
+import {
+ Avatar,
+ Badge,
+ Box,
+ Button,
+ HStack,
+ Input,
+ Table,
+ Tag,
+ Tbody,
+ Text,
+ Th,
+ Tooltip,
+ Tr,
+ useDisclosure,
+ useToast,
+ } from "@chakra-ui/react";
+ import React, { useContext, useEffect, useRef, useState } from "react";
+ import { AddIcon} from "@chakra-ui/icons";
+ import { OPACITY_ON_LOAD } from "../../../../Layout/animations";
+ import NormalTable from "../../../../Components/DataTable/NormalTable";
+ import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+ import CustomAlertDialog from "../../../../Components/CustomAlertDialog";
+ import AddCashDetails from "../AddCashDetails";
+import AddRejected from "./AddRejected";
+import { useUpdateIOCaseMutation } from "../../../../Services/io.service";
+import { useParams } from "react-router-dom";
+import ToastBox from "../../../../Components/ToastBox";
+import AddCaseDetails from "./AddCaseDetails";
+
+ const formatDate = (date) => new Date(date).toLocaleDateString();
+
+ const Rejected = () => {
+ const params = useParams()
+ const id = params?.id
+ const toast = useToast();
+ const firstField = useRef();
+ const { isOpen, onOpen, onClose } = useDisclosure();
+ const { IODetails, approved, setApproved } =
+ useContext(GlobalStateContext);
+ const [searchTerm, setSearchTerm] = useState("");
+ const [isLoading, setIsLoading] = useState(true);
+ const [deleteAlert, setDeleteAlert] = useState(false);
+ const [actionId, setActionId] = useState(false);
+ const [mouseEntered, setMouseEntered] = useState(false);
+ const [mouseEnteredId, setMouseEnteredId] = useState("");
+
+ const [updateIOCase] = useUpdateIOCaseMutation()
+
+ useEffect(() => {
+ // Simulate loading
+ const timer = setTimeout(() => {
+ setIsLoading(false);
+ }, 1500);
+
+ // Cleanup the timer on component unmount
+ return () => clearTimeout(timer);
+ }, []);
+
+ const formatDate = (date) => {
+ return new Date(date).toLocaleDateString("en-GB", {
+ day: "2-digit",
+ month: "2-digit",
+ year: "numeric",
+ });
+ };
+
+
+ // Table filter
+ const filteredData = IODetails?.ioCashStatusHistory?.Reject?.filter((item) => {
+ // Filter by name (case insensitive)
+ const name = item.transactionDate;
+ const searchLower = searchTerm.toLowerCase();
+ const nameMatches = name.toLowerCase().includes(searchLower);
+ return nameMatches;
+ });
+
+ const tableHeadRow = [
+ "Sr No.",
+ "Transaction date",
+ "Transaction Type",
+ "Amount",
+ "Comments",
+ "Update by",
+ "Update On",
+ ];
+
+ const extractedArray = filteredData?.map((item, index) => ({
+ id: item?.id,
+ "Sr No.": (
+
+ {index + 1}.
+
+ ),
+ "Transaction date": (
+
+ {formatDate(item?.transactionDate)}
+
+ ),
+ "Transaction Type": (
+
+ {item?.transactionType}
+
+ ),
+ "Amount": (
+
+
+ $
+
+ {parseFloat(IODetails?.ioCash || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+ ),
+ "Comments": (
+
+ {item?.comments}
+
+ ),
+ "Update by": (
+
+ {/* */}
+ {item?.modifier?.firstName}
+
+ ),
+ "Update On": (
+
+ {formatDate(item.updatedAt)}
+
+ ),
+ }));
+
+ const handleDelete = () => {
+ const updatedSponsors = sponser.filter(
+ (sponsor) => sponsor.id !== actionId
+ );
+
+ setTimeout(() => {
+ setCaseDetails(updatedSponsors);
+ setDeleteAlert(false);
+ setIsLoading(false);
+ }, 100);
+ setIsLoading(true);
+ };
+
+ const Total = () => {
+ return (
+
+
+
+ |
+ Balance in IO Cash
+ |
+
+ {" "}
+ |
+
+ {}
+ |
+
+ {"48,000.00"}
+ |
+
+ {" "}
+ |
+ |
+ |
+
+
+
+ );
+ };
+
+
+ const handleAdd = async () =>{
+ try {
+ const res = await updateIOCase(id)
+ if (res?.data) {
+ // toast({
+ // render: () => (
+ //
+ // ),
+ // });
+ setIsLoading(false);
+ onOpen()
+
+ } else if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsLoading(false);
+ }
+ } catch (error) {
+ }
+ }
+
+ return (
+
+
+
+ setSearchTerm(e.target.value)}
+ />
+
+ {/*
+ {IODetails?.isInvestedAmount ? (
+ localStorage?.getItem('role') ==="Maker"&& }
+ colorScheme="forestGreen"
+ size={"sm"}
+ rounded={"sm"}
+ fontSize={"xs"}
+ >
+ Add
+
+ ) : null}
+ */}
+
+
+
+ }
+ setMouseEnteredId={setMouseEnteredId}
+ setMouseEntered={setMouseEntered}
+ />
+
+ setDeleteAlert(false)}
+ isOpen={deleteAlert}
+ message={"Are you sure you want to delete sponers?"}
+ alertHandler={handleDelete}
+ isLoading={isLoading}
+ />
+
+
+
+ );
+ };
+
+ export default Rejected;
+
\ No newline at end of file
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/RequestApproveModal.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/RequestApproveModal.jsx
new file mode 100644
index 0000000..c771b46
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/RequestApproveModal.jsx
@@ -0,0 +1,176 @@
+import {
+ Box,
+ Button,
+ FormControl,
+ FormHelperText,
+ FormLabel,
+ Input,
+ Modal,
+ ModalBody,
+ ModalCloseButton,
+ ModalContent,
+ ModalFooter,
+ ModalHeader,
+ ModalOverlay,
+ Text,
+ Textarea,
+ useDisclosure,
+ useToast,
+} from "@chakra-ui/react";
+import React, { useEffect, useState } from "react";
+import * as yup from "yup";
+import { yupResolver } from "@hookform/resolvers/yup";
+import { useForm } from "react-hook-form";
+import ToastBox from "../../../../Components/ToastBox";
+import { useApproveIOCaseMutation } from "../../../../Services/io.service";
+
+export const conformModalSchema = yup.object().shape({
+ // checkerComment: yup.string().required("Comment is required")
+ // .max(50, "Investment name cannot be more than 50 characters"),
+ checkerComment: yup
+ .string()
+ .required("Comment is required")
+ .max(200, "Approve Comment cannot be more than 200 characters"),
+});
+
+const RequestApproveModal = ({ isOpen, onClose, firstField ,id}) => {
+ const [isBtnLoading , setIsBtnLoading] = useState(false)
+
+ const toast = useToast()
+
+ const {
+ register,
+ reset,
+ watch,
+ handleSubmit,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(conformModalSchema),
+ });
+
+ const [ approveIOCase ] = useApproveIOCaseMutation()
+
+
+ const onSubmit = async(data) => {
+ console.log(data, "tewxttttt");
+ setIsBtnLoading(true)
+ try {
+ const res = await approveIOCase({data,id})
+ if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }else if(res?.data){
+ toast({
+ render: () => (
+
+ ),
+ });
+ onClose()
+ setIsBtnLoading(false)
+ }else{
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }
+ } catch (error) {
+
+ }
+ };
+
+ const handleFileChange = (event) => {
+ const selectedFile = event.target.files[0];
+ setFile(selectedFile);
+ };
+
+
+ const { data, isLoading } =
+ (id, {
+ skip: !id,
+ });
+
+ useEffect(() => {
+ if (data) {
+ reset({
+ investorAmount: data?.data?.investorAmount,
+ });
+ }
+ }, [data, reset]);
+
+ const heandleOnClose = () =>{
+ reset()
+ onClose()
+ }
+
+ return (
+
+
+
+ Approve Comment
+
+ {isLoading ? (
+
+ ) : (
+
+
+
+ Comment
+
+ {errors.checkerComment && (
+
+ {errors.checkerComment.message}
+
+ )}
+
+ Maximum length should be 200 characters. You have entered
+ {watch("checkerComment")?.length || 0} characters.
+
+
+
+
+
+ Cancel
+
+
+ Send
+
+
+
+ )}
+
+
+ );
+};
+
+export default RequestApproveModal;
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/RequestRejectModal.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/RequestRejectModal.jsx
new file mode 100644
index 0000000..3a44d26
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/RequestRejectModal.jsx
@@ -0,0 +1,164 @@
+import {
+ Box,
+ Button,
+ FormControl,
+ FormLabel,
+ Input,
+ Modal,
+ ModalBody,
+ ModalCloseButton,
+ ModalContent,
+ ModalFooter,
+ ModalHeader,
+ ModalOverlay,
+ Text,
+ Textarea,
+ useDisclosure,
+ useToast,
+} from "@chakra-ui/react";
+import React, { useEffect, useState } from "react";
+import * as yup from "yup";
+import { yupResolver } from "@hookform/resolvers/yup";
+import { useForm } from "react-hook-form";
+import ToastBox from "../../../../Components/ToastBox";
+import { useRejectIOCaseMutation } from "../../../../Services/io.service";
+
+export const conformModalSchema = yup.object().shape({
+ comments: yup.string().required("Comment is required"),
+});
+
+const RequestRejectModal = ({ isOpen, onClose, firstField ,id}) => {
+ const [isBtnLoading , setIsBtnLoading] = useState(false)
+
+ const toast = useToast()
+
+ const {
+ register,
+ reset,
+ handleSubmit,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(conformModalSchema),
+ });
+
+ const [ rejectIOCase ] = useRejectIOCaseMutation()
+
+
+ const onSubmit = async(data) => {
+ console.log(data, "tewxttttt");
+ setIsBtnLoading(true)
+ try {
+ const res = await rejectIOCase({data,id})
+ if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }else if(res?.data){
+ toast({
+ render: () => (
+
+ ),
+ });
+ onClose()
+ setIsBtnLoading(false)
+ }else{
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }
+ } catch (error) {
+
+ }
+ };
+
+ const handleFileChange = (event) => {
+ const selectedFile = event.target.files[0];
+ setFile(selectedFile);
+ };
+
+
+ const { data, isLoading } =
+ (id, {
+ skip: !id,
+ });
+
+ useEffect(() => {
+ if (data) {
+ reset({
+ investorAmount: data?.data?.investorAmount,
+ });
+ }
+ }, [data, reset]);
+
+ const heandleOnClose = () =>{
+ reset()
+ onClose()
+ }
+
+ return (
+
+
+
+ Reject Comment
+
+ {isLoading ? (
+
+ ) : (
+
+
+
+ Comment
+
+ {errors.comments && (
+
+ {errors.comments.message}
+
+ )}
+
+
+
+
+ Cancel
+
+
+ Send
+
+
+
+ )}
+
+
+ );
+};
+
+export default RequestRejectModal;
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetailsOld.jsx
similarity index 92%
rename from src/Pages/IO_Management/CreateIO/IOCashDetails.jsx
rename to src/Pages/IO_Management/CreateIO/IOCashDetailsOld.jsx
index 6ba03f8..ff9acf7 100644
--- a/src/Pages/IO_Management/CreateIO/IOCashDetails.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetailsOld.jsx
@@ -29,7 +29,7 @@ import { exportToExcel, exportToExcelNew } from "../../../Constants/Constants";
const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter
-const IOCashDetails = () => {
+const IOCashDetailsOld = () => {
const toast = useToast();
const firstField = useRef();
const { isOpen, onOpen, onClose } = useDisclosure();
@@ -134,9 +134,9 @@ const IOCashDetails = () => {
{/* {parseFloat(item.transactionAmount || 0).toLocaleString()} */}
{`${parseFloat(item.transactionAmount || 0).toLocaleString(undefined, {
- minimumFractionDigits: 2,
- maximumFractionDigits: 2,
- })}`}
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}`}
),
Comments: (
@@ -180,8 +180,6 @@ const IOCashDetails = () => {
),
}));
-
-
const customHeaders = [
{ label: "Date", key: "transactionDate" },
{ label: "Transaction type", key: "transactionType" },
@@ -192,12 +190,12 @@ const IOCashDetails = () => {
// Add more headers as needed
];
- const ioCashExporteDetails = IODetails?.ioCashHistory?.map((item, index) =>({
- "Date": item?.transactionDate,
+ const ioCashExporteDetails = IODetails?.ioCashHistory?.map((item, index) => ({
+ Date: item?.transactionDate,
"Transaction type": item?.transactionType,
- "Amount":parseFloat(item?.transactionAmount) || 0,
- "Comments": item?.comments
- }))
+ Amount: parseFloat(item?.transactionAmount) || 0,
+ Comments: item?.comments,
+ }));
console.log(ioCashExporteDetails);
@@ -312,8 +310,7 @@ const IOCashDetails = () => {
onChange={(e) => setSearchTerm(e.target.value)}
/>
-
-
+
exportToExcelNew(ioCashExporteDetails, "IO Cash History")
@@ -324,25 +321,24 @@ const IOCashDetails = () => {
variant={"outline"}
rounded={"sm"}
fontSize={"xs"}
-
isDisabled={ioCashExporteDetails?.length === 0}
>
Export xls
- {IODetails?.isInvestedAmount ? (
- }
- colorScheme="forestGreen"
- size={"sm"}
- rounded={"sm"}
- fontSize={"xs"}
- >
- Add IO Cash
-
- ) : null}
-
+ {IODetails?.isInvestedAmount ? (
+ }
+ colorScheme="forestGreen"
+ size={"sm"}
+ rounded={"sm"}
+ fontSize={"xs"}
+ >
+ Add IO Cash
+
+ ) : null}
+
@@ -376,4 +372,4 @@ const IOCashDetails = () => {
);
};
-export default IOCashDetails;
+export default IOCashDetailsOld;
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/AddNavDetails.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/AddNavDetails.jsx
new file mode 100644
index 0000000..0427829
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/AddNavDetails.jsx
@@ -0,0 +1,260 @@
+import {
+ Box,
+ Button,
+ Drawer,
+ DrawerBody,
+ DrawerCloseButton,
+ DrawerContent,
+ DrawerFooter,
+ DrawerHeader,
+ DrawerOverlay,
+ FormControl,
+ FormErrorMessage,
+ FormLabel,
+ HStack,
+ Input,
+ Select,
+ Stack,
+ Text,
+ Textarea,
+ VStack,
+ useToast,
+} from "@chakra-ui/react";
+import * as yup from "yup";
+import React, { useState, useEffect, useContext } from "react";
+import { useForm, Controller } from "react-hook-form";
+import { yupResolver } from "@hookform/resolvers/yup";
+import { v4 as uuidv4 } from "uuid";
+import { useParams } from "react-router-dom";
+import CustomAlertDialog from "../../../../Components/CustomAlertDialog";
+import ToastBox from "../../../../Components/ToastBox";
+import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import CurrencyInput from "../../../../Components/CurrencyInput";
+import { useAddNavDetailsMutation } from "../../../../Services/io.service";
+import { formatDatee } from "../../../../Components/FormField";
+
+const ioNav = yup.object().shape({
+ transactionDate: yup.string().required("Date is required"),
+ transactionAmount: yup.number().required("New NAV is required"),
+ comments: yup.string().notRequired(),
+});
+
+const AddNavDetails = ({ isOpen, onClose, firstField, actionId, setActionId, data }) => {
+ const params = useParams()
+ const id = params?.id
+ const [file, setFile] = useState("");
+ const [fileName, setFileName] = useState("");
+ const [isLoading, setIsLoading] = useState(false)
+ const [alert, setAlert] = useState(false);
+ const toast = useToast();
+
+
+
+ // ======================[ Cotext Api ]
+ const { IODetails } = useContext(GlobalStateContext);
+ const found = data?.find((item) => item?.id === actionId);
+
+
+ const [addNavDetails] = useAddNavDetailsMutation()
+ // const {
+ // data
+ // } = useGetArtifactsQuery(id)
+
+ const {
+ control,
+ handleSubmit,
+ watch,
+ reset,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(ioNav),
+ });
+
+
+ const onSubmit = async (data) => {
+
+ setIsLoading(true)
+
+ try {
+
+ const res = await addNavDetails({ data, id })
+ if (res?.data?.statusCode === 201) {
+ setIsLoading(false);
+ toast({
+ render: () => ,
+ });
+ handleClose()
+ }else if(res?.error?.status === 400){
+ toast({
+ render: () => ,
+ });
+ handleClose()
+ }
+
+
+ } catch (error) {
+ console.log(error);
+
+ }
+
+ };
+
+
+
+ const handleConfirm = () => {
+ handleSubmit(onSubmit)();
+ };
+
+ const handleSave = () => {
+ handleSubmit(onSubmit)();
+ };
+
+ const handleClose = () => {
+ setIsLoading(false);
+ setAlert(false)
+ onClose()
+ reset({
+ transactionDate:"",
+ transactionAmount:"",
+ comments:""
+ })
+ }
+
+
+
+
+const today = formatDatee(new Date(), 'yyyy-MM-dd');
+
+function calculatePercentage(newNav, currNav) {
+const per = (newNav - currNav) / currNav * 100
+return per.toFixed(2)
+}
+
+
+console.log(calculatePercentage(1092500, 976070));
+
+
+
+ return (
+ <>
+
+
+
+
+ IO Nav Details
+
+
+
+
+ Date Selection
+ (
+
+ )}
+ />
+
+ {errors.transactionDate?.message}
+
+
+
+
+
+
+ New NAV
+ (
+
+ )}
+ />
+
+ {errors.transactionAmount?.message}
+
+
+
+
+
+
+ Current nav
+
+ {parseFloat(IODetails?.ioNAV || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+
+
+
+ Live return %
+ {calculatePercentage(watch()?.transactionAmount||IODetails?.ioNAV,IODetails?.ioNAV)}
+
+
+
+
+
+
+ Comments
+ (
+
+ )}
+ />
+
+ {errors.comments?.message}
+
+
+
+
+
+
+
+
+ Cancel
+
+
+ setAlert(true)}
+ >
+ Save
+
+
+
+
+
+
+ setAlert(false)}
+ alertHandler={handleSave}
+ message={"Are you sure you want to add NAV details?"}
+ isLoading={isLoading}
+ />
+ >
+ );
+};
+
+export default AddNavDetails;
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx
new file mode 100644
index 0000000..3b1a0a8
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx
@@ -0,0 +1,298 @@
+import {
+ Avatar,
+ Badge,
+ Box,
+ Button,
+ HStack,
+ Input,
+ Table,
+ Tag,
+ Tbody,
+ Text,
+ Th,
+ Tooltip,
+ Tr,
+ useDisclosure,
+ useToast,
+} from "@chakra-ui/react";
+import React, { useContext, useEffect, useRef, useState } from "react";
+import { AddIcon, DeleteIcon, EditIcon, ViewIcon } from "@chakra-ui/icons";
+import { LuFileSpreadsheet } from "react-icons/lu";
+import { OPACITY_ON_LOAD } from "../../../../Layout/animations";
+import NormalTable from "../../../../Components/DataTable/NormalTable";
+import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import CustomAlertDialog from "../../../../Components/CustomAlertDialog";
+import * as XLSX from "xlsx";
+import ToastBox from "../../../../Components/ToastBox";
+import AddCashDetails from "../AddCashDetails";
+import { debounce } from "../../../Admin/Contact";
+import { useParams } from "react-router-dom";
+import { useUpdateIOCaseMutation } from "../../../../Services/io.service";
+import AddApproved from "./AddNavDetails";
+import AddNavDetails from "./AddNavDetails";
+
+const formatDate = (date) => new Date(date).toLocaleDateString();
+
+const Approved = () => {
+ const params = useParams();
+ const toast = useToast();
+ const id = params?.id;
+ const firstField = useRef();
+ const { isOpen, onOpen, onClose } = useDisclosure();
+ const { IODetails, iONAVDetail, setIONAVDetail } =
+ useContext(GlobalStateContext);
+ const [searchTerm, setSearchTerm] = useState("");
+ const [isLoading, setIsLoading] = useState(true);
+ const [deleteAlert, setDeleteAlert] = useState(false);
+ const [actionId, setActionId] = useState(false);
+ const [mouseEntered, setMouseEntered] = useState(false);
+ const [mouseEnteredId, setMouseEnteredId] = useState("");
+ const [updateIOCase] = useUpdateIOCaseMutation();
+
+ useEffect(() => {
+ // Simulate loading
+ const timer = setTimeout(() => {
+ setIsLoading(false);
+ }, 1500);
+
+ // Cleanup the timer on component unmount
+ return () => clearTimeout(timer);
+ }, []);
+
+ const formatDate = (date) => {
+ return new Date(date).toLocaleDateString("en-GB", {
+ day: "2-digit",
+ month: "2-digit",
+ year: "numeric",
+ });
+ };
+
+ // Table filter
+ const filteredData = IODetails?.ioNAVStatusHistory?.Approved?.filter(
+ (item) => {
+ // Filter by name (case insensitive)
+ const name = item.transactionAmount;
+ const searchLower = searchTerm?.toLowerCase();
+ const nameMatches = name?.toLowerCase().includes(searchLower);
+ return nameMatches;
+ }
+ );
+
+ const tableHeadRow = [
+ "Sr No.",
+ "Valuation date",
+ "NAV",
+ "Last Nav Update",
+ "Investment Closed",
+ "Comments",
+ "Updated By",
+ ];
+
+ const extractedArray = filteredData?.map((item, index) => ({
+ id: item?.id,
+ "Sr No.": (
+
+ {index + 1}.
+
+ ),
+ "Valuation date": (
+
+ {formatDate(item?.transactionDate)}
+
+ ),
+ NAV: (
+
+
+ $
+
+ {parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+ ),
+ "Last Nav Update": (
+
+ {item.previousNAVvalue && `${item.previousNAVvalue}`}
+
+ ),
+ "Investment Closed": (
+
+ {item?.initialNAVvalue && `${item?.initialNAVvalue}`}
+
+ ),
+ Comments: (
+
+ {item?.comments ? item?.comments : "---"}
+
+ ),
+ "Updated By": (
+
+ {/* */}
+ {item?.modifier?.firstName}
+
+ ),
+ }));
+
+ const handleAdd = async () => {
+ try {
+ const res = await updateIOCase(id);
+ if (res?.data) {
+ // toast({
+ // render: () => (
+ //
+ // ),
+ // });
+ setIsLoading(false);
+ onOpen();
+ } else if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsLoading(false);
+ }
+ } catch (error) {}
+ };
+
+ const handleDelete = () => {
+ const updatedSponsors = sponser.filter(
+ (sponsor) => sponsor.id !== actionId
+ );
+
+ setTimeout(() => {
+ setCaseDetails(updatedSponsors);
+ setDeleteAlert(false);
+ setIsLoading(false);
+ }, 100);
+ setIsLoading(true);
+ };
+
+ const exportToExcelNew = (data, fileName) => {
+ const worksheet = XLSX.utils.json_to_sheet(data);
+ const workbook = XLSX.utils.book_new();
+ XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1");
+
+ // Export file
+ XLSX.writeFile(workbook, `${fileName}.xlsx`);
+ };
+
+ const ioNavExport = IODetails?.ioNAVStatusHistory?.Approved?.map(
+ (item, index) => ({
+ ID: item?.id, // Keep as integer if it's already a number
+ "Valuation date": formatDate(item?.transactionDate), // Assuming this is a date, no conversion needed
+ NAV: parseFloat(item?.transactionAmount) || 0, // Convert to float
+ "Last Nav Update": parseFloat(item?.previousNAVvalue) || 0, // Convert to float
+ "Investment Closed": parseFloat(item?.initialNAVvalue) || 0, // Convert to float
+ Comments: item?.comments, // Keep as string
+ // "Transaction Type": item?.transactionType,
+ "Updated By": item?.creator?.firstName, // Keep as string
+ // "Update On": formatDate(item?.updatedAt) // Assuming this is a date, no conversion needed
+ })
+ );
+
+ return (
+
+
+
+ setSearchTerm(e.target.value)}
+ />
+
+
+ exportToExcelNew(ioNavExport, "Io Nav details")}
+ leftIcon={}
+ colorScheme="forestGreen"
+ size={"sm"}
+ variant={"outline"}
+ rounded={"sm"}
+ fontSize={"xs"}
+ isDisabled={ioNavExport?.length === 0}
+ >
+ Export xls
+
+ {/* {IODetails?.isInvestedAmount
+ ? localStorage?.getItem("role") === "Maker" && (
+ }
+ colorScheme="forestGreen"
+ size={"sm"}
+ rounded={"sm"}
+ fontSize={"xs"}
+ >
+ Add
+
+ )
+ : null} */}
+
+
+
+
+
+
+ setDeleteAlert(false)}
+ isOpen={deleteAlert}
+ message={"Are you sure you want to delete sponers?"}
+ alertHandler={handleDelete}
+ isLoading={isLoading}
+ />
+
+
+
+ );
+};
+
+export default Approved;
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/IONAVDetails.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/IONAVDetails.jsx
new file mode 100644
index 0000000..03cf067
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/IONAVDetails.jsx
@@ -0,0 +1,184 @@
+// import { Tab, TabList, TabPanel, TabPanels, Tabs } from "@chakra-ui/react";
+// import React from "react";
+// import Approved from "./Approved";
+// import Pending from "./Pending";
+// import Rejected from "./Rejected";
+
+// const IONAVDetails = () => {
+// return (
+//
+//
+//
+// Approved
+//
+//
+// Pending
+//
+//
+// Rejected
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+// );
+// };
+
+// export default IONAVDetails;
+
+import {
+ Box,
+ Button,
+ Tab,
+ TabList,
+ TabPanel,
+ TabPanels,
+ Tabs,
+ useDisclosure,
+ useToast,
+} from "@chakra-ui/react";
+import React, { useContext, useRef } from "react";
+import Approved from "./Approved";
+import Pending from "./Pending";
+import Rejected from "./Rejected";
+import { AddIcon } from "@chakra-ui/icons";
+import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import ToastBox from "../../../../Components/ToastBox";
+import { useParams } from "react-router-dom";
+import AddNavDetails from "./AddNavDetails";
+import { useUpdateIOCaseMutation } from "../../../../Services/io.service";
+
+const IONAVDetails = () => {
+ const params = useParams();
+ const toast = useToast();
+ const id = params?.id;
+ const { IODetails } = useContext(GlobalStateContext);
+ const { isOpen, onOpen, onClose } = useDisclosure();
+ const firstField = useRef();
+
+ const [updateIOCase] = useUpdateIOCaseMutation();
+
+ const handleAdd = async () => {
+ try {
+ const res = await updateIOCase(id);
+ if (res?.data) {
+ // toast({
+ // render: () => (
+ //
+ // ),
+ // });
+ // setIsLoading(false);
+ onOpen();
+ } else if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsLoading(false);
+ }
+ } catch (error) {}
+ };
+
+ return (
+
+
+
+
+
+ Approved
+
+
+ Pending
+
+
+ Rejected
+
+
+ {IODetails?.isInvestedAmount
+ ? localStorage?.getItem("role") === "Maker" && (
+ }
+ colorScheme="forestGreen"
+ size={"sm"}
+ rounded={"sm"}
+ fontSize={"xs"}
+ >
+ Add
+
+ )
+ : null}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default IONAVDetails;
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx
new file mode 100644
index 0000000..928532a
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx
@@ -0,0 +1,338 @@
+import {
+ Avatar,
+ Badge,
+ Box,
+ Button,
+ HStack,
+ Input,
+ Text,
+ Tooltip,
+ useDisclosure,
+ useToast,
+} from "@chakra-ui/react";
+import React, { useContext, useEffect, useRef, useState } from "react";
+import { OPACITY_ON_LOAD } from "../../../../Layout/animations";
+import NormalTable from "../../../../Components/DataTable/NormalTable";
+import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import CustomAlertDialog from "../../../../Components/CustomAlertDialog";
+import { AddIcon, CheckIcon, CloseIcon, ViewIcon } from "@chakra-ui/icons";
+import { useParams } from "react-router-dom";
+import { useUpdateIOCaseMutation } from "../../../../Services/io.service";
+import ToastBox from "../../../../Components/ToastBox";
+import AddNavDetails from "./AddNavDetails";
+import RequestApproveModal from "./RequestApproveModal";
+import RequestRejectModal from "./RequestRejectModal";
+
+const formatDate = (date) => new Date(date).toLocaleDateString();
+
+const Pending = () => {
+ const params = useParams();
+ const toast = useToast();
+ const id = params?.id;
+ const firstField = useRef();
+ const { isOpen, onOpen, onClose } = useDisclosure();
+ const { IODetails, iONAVDetail, setIONAVDetail } =
+ useContext(GlobalStateContext);
+ const [searchTerm, setSearchTerm] = useState("");
+ const [isLoading, setIsLoading] = useState(true);
+ const [deleteAlert, setDeleteAlert] = useState(false);
+ const [actionId, setActionId] = useState(false);
+ const [mouseEntered, setMouseEntered] = useState(false);
+ const [mouseEnteredId, setMouseEnteredId] = useState("");
+
+ const [updateIOCase] = useUpdateIOCaseMutation();
+
+ const {
+ isOpen: isConfirmOpen,
+ onOpen: onConfirmOpen,
+ onClose: onConfirmClose,
+ } = useDisclosure();
+ const {
+ isOpen: isRejectOpen,
+ onOpen: onRejectOpen,
+ onClose: onRejectClose,
+ } = useDisclosure();
+
+ useEffect(() => {
+ // Simulate loading
+ const timer = setTimeout(() => {
+ setIsLoading(false);
+ }, 1500);
+
+ // Cleanup the timer on component unmount
+ return () => clearTimeout(timer);
+ }, []);
+
+ const formatDate = (date) => {
+ return new Date(date).toLocaleDateString("en-GB", {
+ day: "2-digit",
+ month: "2-digit",
+ year: "numeric",
+ });
+ };
+
+ // Table filter
+ const filteredData = IODetails?.ioNAVStatusHistory?.Pending?.filter(
+ (item) => {
+ // Filter by name (case insensitive)
+ const name = item?.transactionDate;
+ const searchLower = searchTerm?.toLowerCase();
+ const nameMatches = name?.toLowerCase().includes(searchLower);
+ return nameMatches;
+ }
+ );
+
+ const tableHeadRow = [
+ "Sr No.",
+ "Valuation date",
+ "NAV",
+ "Last Nav Update",
+ "Investment Closed",
+ "Comments",
+ "Updated By",
+ ...(localStorage?.getItem("role") !== "Maker" ? ["Status"] : []),
+ ];
+
+ const extractedArray = filteredData?.map((item, index) => ({
+ id: item?.id,
+ "Sr No.": (
+
+ {index + 1}.
+
+ ),
+ "Valuation date": (
+
+ {formatDate(item?.transactionDate)}
+
+ ),
+ NAV: (
+
+
+ $
+
+ {parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+ ),
+ "Last Nav Update": (
+
+ {item.previousNAVvalue && `${item.previousNAVvalue}`}
+
+ ),
+ "Investment Closed": (
+
+ {item?.initialNAVvalue && `${item?.initialNAVvalue}`}
+
+ ),
+ Comments: (
+
+ {item?.comments ? item?.comments : "---"}
+
+ ),
+ "Updated By": (
+
+ {/* */}
+ {item?.modifier?.firstName}
+
+ ),
+ Status: (
+
+
+
+
+ {
+ setActionId(item.id);
+ onConfirmOpen();
+ }}
+ colorScheme="green"
+ variant={"solid"}
+ cursor={"pointer"}
+ >
+
+
+
+
+ {
+ setActionId(item.id);
+ onRejectOpen();
+ }}
+ py={1}
+ // variant={"solid"}
+ >
+
+
+
+
+
+
+ ),
+ }));
+
+ const handleDelete = () => {
+ const updatedSponsors = sponser.filter(
+ (sponsor) => sponsor.id !== actionId
+ );
+
+ setTimeout(() => {
+ setCaseDetails(updatedSponsors);
+ setDeleteAlert(false);
+ setIsLoading(false);
+ }, 100);
+ setIsLoading(true);
+ };
+
+ const handleAdd = async () => {
+ try {
+ const res = await updateIOCase(id);
+ if (res?.data) {
+ // toast({
+ // render: () => (
+ //
+ // ),
+ // });
+ setIsLoading(false);
+ onOpen();
+ } else if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsLoading(false);
+ }
+ } catch (error) {}
+ };
+
+ return (
+
+
+
+ setSearchTerm(e.target.value)}
+ />
+ {/* {IODetails?.isInvestedAmount
+ ? localStorage?.getItem("role") === "Maker" && (
+ }
+ colorScheme="forestGreen"
+ size={"sm"}
+ rounded={"sm"}
+ fontSize={"xs"}
+ >
+ Add
+
+ )
+ : null} */}
+
+
+
+
+
+ setDeleteAlert(false)}
+ isOpen={deleteAlert}
+ message={"Are you sure you want to delete sponers?"}
+ alertHandler={handleDelete}
+ isLoading={isLoading}
+ />
+
+
+
+
+ );
+};
+
+export default Pending;
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx
new file mode 100644
index 0000000..2603e3f
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx
@@ -0,0 +1,257 @@
+import {
+ Avatar,
+ Badge,
+ Box,
+ Button,
+ HStack,
+ Input,
+ Table,
+ Tag,
+ Tbody,
+ Text,
+ Th,
+ Tooltip,
+ Tr,
+ useDisclosure,
+ useToast,
+} from "@chakra-ui/react";
+import React, { useContext, useEffect, useRef, useState } from "react";
+import { AddIcon, DeleteIcon, EditIcon, ViewIcon } from "@chakra-ui/icons";
+import { LuFileSpreadsheet } from "react-icons/lu";
+import { OPACITY_ON_LOAD } from "../../../../Layout/animations";
+import NormalTable from "../../../../Components/DataTable/NormalTable";
+import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import CustomAlertDialog from "../../../../Components/CustomAlertDialog";
+import ToastBox from "../../../../Components/ToastBox";
+import AddCashDetails from "../AddCashDetails";
+import { debounce } from "../../../Admin/Contact";
+import { useUpdateIOCaseMutation } from "../../../../Services/io.service";
+import { useParams } from "react-router-dom";
+import AddNavDetails from "./AddNavDetails";
+
+const formatDate = (date) => new Date(date).toLocaleDateString();
+
+const Rejected = () => {
+ const params = useParams();
+ const toast = useToast();
+ const id = params?.id;
+ const firstField = useRef();
+ const { isOpen, onOpen, onClose } = useDisclosure();
+ const { IODetails, iONAVDetail, setIONAVDetail } =
+ useContext(GlobalStateContext);
+ const [searchTerm, setSearchTerm] = useState("");
+ const [isLoading, setIsLoading] = useState(true);
+ const [deleteAlert, setDeleteAlert] = useState(false);
+ const [actionId, setActionId] = useState(false);
+ const [mouseEntered, setMouseEntered] = useState(false);
+ const [mouseEnteredId, setMouseEnteredId] = useState("");
+ const [updateIOCase] = useUpdateIOCaseMutation();
+
+ useEffect(() => {
+ // Simulate loading
+ const timer = setTimeout(() => {
+ setIsLoading(false);
+ }, 1500);
+
+ // Cleanup the timer on component unmount
+ return () => clearTimeout(timer);
+ }, []);
+
+ const formatDate = (date) => {
+ return new Date(date).toLocaleDateString("en-GB", {
+ day: "2-digit",
+ month: "2-digit",
+ year: "numeric",
+ });
+ };
+
+ // Table filter
+ const filteredData = IODetails?.ioNAVStatusHistory?.Reject?.filter((item) => {
+ // Filter by name (case insensitive)
+ const name = item.transactionAmount;
+ const searchLower = searchTerm.toLowerCase();
+ const nameMatches = name.toLowerCase().includes(searchLower);
+ return nameMatches;
+ });
+
+ const tableHeadRow = [
+ "Sr No.",
+ "Valuation date",
+ "NAV",
+ "Last Nav Update",
+ "Investment Closed",
+ "Comments",
+ "Updated By",
+ ];
+
+ const extractedArray = filteredData?.map((item, index) => ({
+ id: item?.id,
+ "Sr No.": (
+
+ {index + 1}.
+
+ ),
+ "Valuation date": (
+
+ {formatDate(item?.transactionDate)}
+
+ ),
+ NAV: (
+
+
+ $
+
+ {parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+ ),
+ "Last Nav Update": (
+
+ {item.previousNAVvalue && `${item.previousNAVvalue}`}
+
+ ),
+ "Investment Closed": (
+
+ {item?.initialNAVvalue && `${item?.initialNAVvalue}`}
+
+ ),
+ Comments: (
+
+ {item?.comments ? item?.comments : "---"}
+
+ ),
+ "Updated By": (
+
+ {/* */}
+ {item?.modifier?.firstName}
+
+ ),
+ }));
+
+ const handleDelete = () => {
+ const updatedSponsors = sponser.filter(
+ (sponsor) => sponsor.id !== actionId
+ );
+
+ setTimeout(() => {
+ setCaseDetails(updatedSponsors);
+ setDeleteAlert(false);
+ setIsLoading(false);
+ }, 100);
+ setIsLoading(true);
+ };
+
+ const handleAdd = async () => {
+ try {
+ const res = await updateIOCase(id);
+ if (res?.data) {
+ // toast({
+ // render: () => (
+ //
+ // ),
+ // });
+ setIsLoading(false);
+ onOpen();
+ } else if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsLoading(false);
+ }
+ } catch (error) {}
+ };
+
+ return (
+
+
+
+ setSearchTerm(e.target.value)}
+ />
+
+ {/* {IODetails?.isInvestedAmount
+ ? localStorage?.getItem("role") === "Maker" && (
+ }
+ colorScheme="forestGreen"
+ size={"sm"}
+ rounded={"sm"}
+ fontSize={"xs"}
+ >
+ Add
+
+ )
+ : null} */}
+
+
+
+
+
+ setDeleteAlert(false)}
+ isOpen={deleteAlert}
+ message={"Are you sure you want to delete sponers?"}
+ alertHandler={handleDelete}
+ isLoading={isLoading}
+ />
+
+
+
+ );
+};
+
+export default Rejected;
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/RequestApproveModal.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/RequestApproveModal.jsx
new file mode 100644
index 0000000..edad9d3
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/RequestApproveModal.jsx
@@ -0,0 +1,176 @@
+import {
+ Box,
+ Button,
+ FormControl,
+ FormHelperText,
+ FormLabel,
+ Input,
+ Modal,
+ ModalBody,
+ ModalCloseButton,
+ ModalContent,
+ ModalFooter,
+ ModalHeader,
+ ModalOverlay,
+ Text,
+ Textarea,
+ useDisclosure,
+ useToast,
+} from "@chakra-ui/react";
+import React, { useEffect, useState } from "react";
+import * as yup from "yup";
+import { yupResolver } from "@hookform/resolvers/yup";
+import { useForm } from "react-hook-form";
+import ToastBox from "../../../../Components/ToastBox";
+import { useApproveIOCaseMutation, useApproveIONavMutation } from "../../../../Services/io.service";
+
+export const conformModalSchema = yup.object().shape({
+ // checkerComment: yup.string().required("Comment is required")
+ // .max(50, "Investment name cannot be more than 50 characters"),
+ checkerComment: yup
+ .string()
+ .required("Comment is required")
+ .max(200, "Approve Comment cannot be more than 200 characters"),
+});
+
+const RequestApproveModal = ({ isOpen, onClose, firstField ,id}) => {
+ const [isBtnLoading , setIsBtnLoading] = useState(false)
+
+ const toast = useToast()
+
+ const {
+ register,
+ reset,
+ watch,
+ handleSubmit,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(conformModalSchema),
+ });
+
+ const [ approveIONav ] = useApproveIONavMutation()
+
+
+ const onSubmit = async(data) => {
+ console.log(data, "tewxttttt");
+ setIsBtnLoading(true)
+ try {
+ const res = await approveIONav({data,id})
+ if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }else if(res?.data){
+ toast({
+ render: () => (
+
+ ),
+ });
+ onClose()
+ setIsBtnLoading(false)
+ }else{
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }
+ } catch (error) {
+
+ }
+ };
+
+ const handleFileChange = (event) => {
+ const selectedFile = event.target.files[0];
+ setFile(selectedFile);
+ };
+
+
+ const { data, isLoading } =
+ (id, {
+ skip: !id,
+ });
+
+ useEffect(() => {
+ if (data) {
+ reset({
+ investorAmount: data?.data?.investorAmount,
+ });
+ }
+ }, [data, reset]);
+
+ const heandleOnClose = () =>{
+ reset()
+ onClose()
+ }
+
+ return (
+
+
+
+ Approve Comment
+
+ {isLoading ? (
+
+ ) : (
+
+
+
+ Comment
+
+ {errors.checkerComment && (
+
+ {errors.checkerComment.message}
+
+ )}
+
+ Maximum length should be 200 characters. You have entered
+ {watch("checkerComment")?.length || 0} characters.
+
+
+
+
+
+ Cancel
+
+
+ Send
+
+
+
+ )}
+
+
+ );
+};
+
+export default RequestApproveModal;
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/RequestRejectModal.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/RequestRejectModal.jsx
new file mode 100644
index 0000000..3a44d26
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/RequestRejectModal.jsx
@@ -0,0 +1,164 @@
+import {
+ Box,
+ Button,
+ FormControl,
+ FormLabel,
+ Input,
+ Modal,
+ ModalBody,
+ ModalCloseButton,
+ ModalContent,
+ ModalFooter,
+ ModalHeader,
+ ModalOverlay,
+ Text,
+ Textarea,
+ useDisclosure,
+ useToast,
+} from "@chakra-ui/react";
+import React, { useEffect, useState } from "react";
+import * as yup from "yup";
+import { yupResolver } from "@hookform/resolvers/yup";
+import { useForm } from "react-hook-form";
+import ToastBox from "../../../../Components/ToastBox";
+import { useRejectIOCaseMutation } from "../../../../Services/io.service";
+
+export const conformModalSchema = yup.object().shape({
+ comments: yup.string().required("Comment is required"),
+});
+
+const RequestRejectModal = ({ isOpen, onClose, firstField ,id}) => {
+ const [isBtnLoading , setIsBtnLoading] = useState(false)
+
+ const toast = useToast()
+
+ const {
+ register,
+ reset,
+ handleSubmit,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(conformModalSchema),
+ });
+
+ const [ rejectIOCase ] = useRejectIOCaseMutation()
+
+
+ const onSubmit = async(data) => {
+ console.log(data, "tewxttttt");
+ setIsBtnLoading(true)
+ try {
+ const res = await rejectIOCase({data,id})
+ if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }else if(res?.data){
+ toast({
+ render: () => (
+
+ ),
+ });
+ onClose()
+ setIsBtnLoading(false)
+ }else{
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }
+ } catch (error) {
+
+ }
+ };
+
+ const handleFileChange = (event) => {
+ const selectedFile = event.target.files[0];
+ setFile(selectedFile);
+ };
+
+
+ const { data, isLoading } =
+ (id, {
+ skip: !id,
+ });
+
+ useEffect(() => {
+ if (data) {
+ reset({
+ investorAmount: data?.data?.investorAmount,
+ });
+ }
+ }, [data, reset]);
+
+ const heandleOnClose = () =>{
+ reset()
+ onClose()
+ }
+
+ return (
+
+
+
+ Reject Comment
+
+ {isLoading ? (
+
+ ) : (
+
+
+
+ Comment
+
+ {errors.comments && (
+
+ {errors.comments.message}
+
+ )}
+
+
+
+
+ Cancel
+
+
+ Send
+
+
+
+ )}
+
+
+ );
+};
+
+export default RequestRejectModal;
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetailsOld.jsx
similarity index 100%
rename from src/Pages/IO_Management/CreateIO/IONAVDetails.jsx
rename to src/Pages/IO_Management/CreateIO/IONAVDetailsOld.jsx
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ApproveDistrubationModal.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ApproveDistrubationModal.jsx
new file mode 100644
index 0000000..639d4b7
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ApproveDistrubationModal.jsx
@@ -0,0 +1,179 @@
+import {
+ Box,
+ Button,
+ FormControl,
+ FormHelperText,
+ FormLabel,
+ Input,
+ Modal,
+ ModalBody,
+ ModalCloseButton,
+ ModalContent,
+ ModalFooter,
+ ModalHeader,
+ ModalOverlay,
+ Text,
+ Textarea,
+ useDisclosure,
+ useToast,
+ } from "@chakra-ui/react";
+ import React, { useEffect, useState } from "react";
+ import * as yup from "yup";
+ import { yupResolver } from "@hookform/resolvers/yup";
+ import { useForm } from "react-hook-form";
+ import ToastBox from "../../../../Components/ToastBox";
+ import { useApproveDistributedMutation } from "../../../../Services/io.service";
+
+ export const conformModalSchema = yup.object().shape({
+ // checkerComment: yup.string().required("Comment is required")
+ // .max(50, "Investment name cannot be more than 50 characters"),
+ checkerComment: yup
+ .string()
+ .required("Comment is required")
+ .max(200, "Approve Comment cannot be more than 200 characters"),
+ });
+
+ const ApproveDistrubationModal = ({ isOpen, onClose, firstField ,id, onBigModalClose}) => {
+ const [isBtnLoading , setIsBtnLoading] = useState(false)
+
+ const toast = useToast()
+
+
+
+ const {
+ register,
+ reset,
+ watch,
+ handleSubmit,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(conformModalSchema),
+ });
+
+ const [ approveDistributed ] = useApproveDistributedMutation()
+
+
+ const onSubmit = async(data) => {
+ setIsBtnLoading(true)
+ try {
+ const res = await approveDistributed({data,id})
+ if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }else if(res?.data){
+ toast({
+ render: () => (
+
+ ),
+ });
+ onClose()
+ onBigModalClose()
+ setIsBtnLoading(false)
+ }else{
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }
+ } catch (error) {
+
+ }
+ };
+
+ const handleFileChange = (event) => {
+ const selectedFile = event.target.files[0];
+ setFile(selectedFile);
+ };
+
+
+ const { data, isLoading } =
+ (id, {
+ skip: !id,
+ });
+
+ useEffect(() => {
+ if (data) {
+ reset({
+ investorAmount: data?.data?.investorAmount,
+ });
+ }
+ }, [data, reset]);
+
+ const heandleOnClose = () =>{
+ reset()
+ onClose()
+ }
+
+ return (
+
+
+
+ Approve Comment
+
+ {isLoading ? (
+
+ ) : (
+
+
+
+ Comment
+
+ {errors.checkerComment && (
+
+ {errors.checkerComment.message}
+
+ )}
+
+ Maximum length should be 200 characters. You have entered
+ {watch("checkerComment")?.length || 0} characters.
+
+
+
+
+
+ Cancel
+
+
+ Send
+
+
+
+ )}
+
+
+ );
+ };
+
+ export default ApproveDistrubationModal;
+
\ No newline at end of file
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ApproveInvestedModal.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ApproveInvestedModal.jsx
new file mode 100644
index 0000000..8ea065e
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ApproveInvestedModal.jsx
@@ -0,0 +1,177 @@
+import {
+ Box,
+ Button,
+ FormControl,
+ FormHelperText,
+ FormLabel,
+ Input,
+ Modal,
+ ModalBody,
+ ModalCloseButton,
+ ModalContent,
+ ModalFooter,
+ ModalHeader,
+ ModalOverlay,
+ Text,
+ Textarea,
+ useDisclosure,
+ useToast,
+ } from "@chakra-ui/react";
+ import React, { useEffect, useState } from "react";
+ import * as yup from "yup";
+ import { yupResolver } from "@hookform/resolvers/yup";
+ import { useForm } from "react-hook-form";
+ import ToastBox from "../../../../Components/ToastBox";
+ import { useApproveInvestedMutation } from "../../../../Services/io.service";
+
+ export const conformModalSchema = yup.object().shape({
+ // checkerComment: yup.string().required("Comment is required")
+ // .max(50, "Investment name cannot be more than 50 characters"),
+ checkerComment: yup
+ .string()
+ .required("Comment is required")
+ .max(200, "Approve Comment cannot be more than 200 characters"),
+ });
+
+ const ApproveInvestedModal = ({ isOpen, onClose, firstField ,id,onBigModalClose}) => {
+ const [isBtnLoading , setIsBtnLoading] = useState(false)
+
+ const toast = useToast()
+
+ const {
+ register,
+ reset,
+ watch,
+ handleSubmit,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(conformModalSchema),
+ });
+
+ const [ approveInvested ] = useApproveInvestedMutation()
+
+
+ const onSubmit = async(data) => {
+ setIsBtnLoading(true)
+ try {
+ const res = await approveInvested({data,id})
+ if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }else if(res?.data){
+ toast({
+ render: () => (
+
+ ),
+ });
+ onClose()
+ onBigModalClose()
+ setIsBtnLoading(false)
+ }else{
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }
+ } catch (error) {
+
+ }
+ };
+
+ const handleFileChange = (event) => {
+ const selectedFile = event.target.files[0];
+ setFile(selectedFile);
+ };
+
+
+ const { data, isLoading } =
+ (id, {
+ skip: !id,
+ });
+
+ useEffect(() => {
+ if (data) {
+ reset({
+ investorAmount: data?.data?.investorAmount,
+ });
+ }
+ }, [data, reset]);
+
+ const heandleOnClose = () =>{
+ reset()
+ onClose()
+ }
+
+ return (
+
+
+
+ Approve Comment
+
+ {isLoading ? (
+
+ ) : (
+
+
+
+ Comment
+
+ {errors.checkerComment && (
+
+ {errors.checkerComment.message}
+
+ )}
+
+ Maximum length should be 200 characters. You have entered
+ {watch("checkerComment")?.length || 0} characters.
+
+
+
+
+
+ Cancel
+
+
+ Send
+
+
+
+ )}
+
+
+ );
+ };
+
+ export default ApproveInvestedModal;
+
\ No newline at end of file
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/Approved.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/Approved.jsx
new file mode 100644
index 0000000..e0f9160
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/Approved.jsx
@@ -0,0 +1,249 @@
+import {
+ Avatar,
+ Badge,
+ Box,
+ Button,
+ HStack,
+ Input,
+ Table,
+ Tag,
+ Tbody,
+ Text,
+ Th,
+ Tooltip,
+ Tr,
+ useDisclosure,
+ useToast,
+ } from "@chakra-ui/react";
+ import React, { useContext, useEffect, useRef, useState } from "react";
+ import { AddIcon, DeleteIcon, EditIcon, ViewIcon } from "@chakra-ui/icons";
+ import { LuFileSpreadsheet } from "react-icons/lu";
+ import { OPACITY_ON_LOAD } from "../../../../Layout/animations";
+ import NormalTable from "../../../../Components/DataTable/NormalTable";
+ import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+ import CustomAlertDialog from "../../../../Components/CustomAlertDialog";
+ import ToastBox from "../../../../Components/ToastBox";
+ import AddCashDetails from "../AddCashDetails";
+ import { debounce } from "../../../Admin/Contact";
+
+ const formatDate = (date) => new Date(date).toLocaleDateString();
+
+ const Approved = () => {
+ const toast = useToast();
+ const firstField = useRef();
+ const { isOpen, onOpen, onClose } = useDisclosure();
+ const { IODetails, iOTransaction, setIOTransaction } =
+ useContext(GlobalStateContext);
+ const [searchTerm, setSearchTerm] = useState("");
+ const [isLoading, setIsLoading] = useState(true);
+ const [deleteAlert, setDeleteAlert] = useState(false);
+ const [actionId, setActionId] = useState(false);
+ const [mouseEntered, setMouseEntered] = useState(false);
+ const [mouseEnteredId, setMouseEnteredId] = useState("");
+
+ useEffect(() => {
+ // Simulate loading
+ const timer = setTimeout(() => {
+ setIsLoading(false);
+ }, 1500);
+
+ // Cleanup the timer on component unmount
+ return () => clearTimeout(timer);
+ }, []);
+
+ const formatDate = (date) => {
+ return new Date(date).toLocaleDateString("en-GB", {
+ day: "2-digit",
+ month: "2-digit",
+ year: "numeric",
+ });
+ };
+
+
+ // Table filter
+ const filteredData = IODetails?.ioTransactionRecords?.Approved?.filter((item) => {
+ // Filter by name (case insensitive)
+ const name = item?.transactionAmount;
+ const searchLower = searchTerm?.toLowerCase();
+ const nameMatches = name?.toLowerCase().includes(searchLower);
+ return nameMatches;
+ });
+
+ const tableHeadRow = [
+ "Sr No.",
+ "Transaction Date",
+ "Transaction Name",
+ "Amount",
+ "Created By",
+ "Created On",
+ "Approved By",
+ "Approved On",
+ ];
+
+ const extractedArray = filteredData?.map((item, index) => ({
+ id: item?.id,
+ "Sr No.": (
+
+ {index + 1}.
+
+ ),
+ "Transaction Date": (
+
+ {formatDate(item?.transactionDate)}
+
+ ),
+ "Transaction Name": (
+
+ {item?.transactionType}
+
+ ),
+ "Amount": (
+
+
+ $
+
+ {/* {item?.transactionAmount} */}
+ {parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+ ),
+ "Created By": (
+
+ {item?.creator?.firstName}
+
+ ),
+ "Created On": (
+
+ {formatDate(item?.createdAt)}
+
+ ),
+ "Approved By": (
+ <>
+
+ {item?.modifier?.firstName}
+
+ {/*
+
+ {item?.creator?.firstName}
+ */}
+ >
+ ),
+ "Approved On": (
+
+ {item?.modifier ? formatDate(item?.updatedAt) : "---" }
+ {}
+
+ ),
+ }));
+
+ const handleDelete = () => {
+ const updatedSponsors = sponser.filter(
+ (sponsor) => sponsor.id !== actionId
+ );
+
+ setTimeout(() => {
+ setCaseDetails(updatedSponsors);
+ setDeleteAlert(false);
+ setIsLoading(false);
+ }, 100);
+ setIsLoading(true);
+ };
+
+ return (
+
+
+
+ setSearchTerm(e.target.value)}
+ />
+
+
+
+
+
+ setDeleteAlert(false)}
+ isOpen={deleteAlert}
+ message={"Are you sure you want to delete sponers?"}
+ alertHandler={handleDelete}
+ isLoading={isLoading}
+ />
+
+ );
+ };
+
+ export default Approved;
+
\ No newline at end of file
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ApprovedCancelTransaction.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ApprovedCancelTransaction.jsx
new file mode 100644
index 0000000..1233c75
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ApprovedCancelTransaction.jsx
@@ -0,0 +1,161 @@
+import {
+ Box,
+ Button,
+ FormControl,
+ FormHelperText,
+ FormLabel,
+ Modal,
+ ModalBody,
+ ModalCloseButton,
+ ModalContent,
+ ModalFooter,
+ ModalHeader,
+ ModalOverlay,
+ Text,
+ Textarea,
+ useToast,
+ } from "@chakra-ui/react";
+ import React, { useEffect, useState } from "react";
+ import { yupResolver } from "@hookform/resolvers/yup";
+ import { useForm } from "react-hook-form";
+ import ToastBox from "../../../../Components/ToastBox";
+ import {useApproveCancleTransactionMutation, useApproveExitTransactionMutation} from "../../../../Services/io.service";
+
+
+ const ApprovedCancelTransaction = ({ isOpen, onClose, firstField ,id,onBigModalClose}) => {
+ const [isBtnLoading , setIsBtnLoading] = useState(false)
+
+ const toast = useToast()
+
+ const {
+ register,
+ reset,
+ watch,
+ handleSubmit,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(),
+ });
+
+ const [ approveCancleTransaction ] = useApproveCancleTransactionMutation()
+
+
+ const onSubmit = async(data) => {
+ setIsBtnLoading(true)
+ try {
+ const res = await approveCancleTransaction({data,id})
+ if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }else if(res?.data){
+ toast({
+ render: () => (
+
+ ),
+ });
+ onClose()
+ onBigModalClose()
+ setIsBtnLoading(false)
+ }else{
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }
+ } catch (error) {
+
+ }
+ };
+
+
+ const { data, isLoading } =
+ (id, {
+ skip: !id,
+ });
+
+ useEffect(() => {
+ if (data) {
+ reset({
+ investorAmount: data?.data?.investorAmount,
+ });
+ }
+ }, [data, reset]);
+
+ const heandleOnClose = () =>{
+ reset()
+ onClose()
+ }
+
+ return (
+
+
+
+ Approve Comment
+
+ {isLoading ? (
+
+ ) : (
+
+
+
+ Comment
+
+ {errors.checkerComment && (
+
+ {errors.checkerComment.message}
+
+ )}
+
+ Maximum length should be 200 characters. You have entered
+ {watch("checkerComment")?.length || 0} characters.
+
+
+
+
+
+ Cancel
+
+
+ Send
+
+
+
+ )}
+
+
+ );
+ };
+
+ export default ApprovedCancelTransaction;
+
\ No newline at end of file
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ApprovedExit.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ApprovedExit.jsx
new file mode 100644
index 0000000..2b3f4fa
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ApprovedExit.jsx
@@ -0,0 +1,175 @@
+import {
+ Box,
+ Button,
+ FormControl,
+ FormHelperText,
+ FormLabel,
+ Input,
+ Modal,
+ ModalBody,
+ ModalCloseButton,
+ ModalContent,
+ ModalFooter,
+ ModalHeader,
+ ModalOverlay,
+ Text,
+ Textarea,
+ useToast,
+ } from "@chakra-ui/react";
+ import React, { useEffect, useState } from "react";
+ import * as yup from "yup";
+ import { yupResolver } from "@hookform/resolvers/yup";
+ import { useForm } from "react-hook-form";
+ import ToastBox from "../../../../Components/ToastBox";
+ import { useApproveExitTransactionMutation } from "../../../../Services/io.service";
+
+ export const conformModalSchema = yup.object().shape({
+ checkerComment: yup
+ .string()
+ .required("Comment is required")
+ .max(200, "Approve Comment cannot be more than 200 characters"),
+ });
+
+ const ApprovedExit = ({ isOpen, onClose, firstField ,id,onBigModalClose}) => {
+ const [isBtnLoading , setIsBtnLoading] = useState(false)
+
+ const toast = useToast()
+
+ const {
+ register,
+ reset,
+ watch,
+ handleSubmit,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(conformModalSchema),
+ });
+
+ const [ approveExitTransaction ] = useApproveExitTransactionMutation()
+
+
+ const onSubmit = async(data) => {
+ setIsBtnLoading(true)
+ try {
+ const res = await approveExitTransaction({data,id})
+ if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }else if(res?.data){
+ toast({
+ render: () => (
+
+ ),
+ });
+ onClose()
+ onBigModalClose()
+ setIsBtnLoading(false)
+ }else{
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }
+ } catch (error) {
+
+ }
+ };
+
+ const handleFileChange = (event) => {
+ const selectedFile = event.target.files[0];
+ setFile(selectedFile);
+ };
+
+
+ const { data, isLoading } =
+ (id, {
+ skip: !id,
+ });
+
+ useEffect(() => {
+ if (data) {
+ reset({
+ investorAmount: data?.data?.investorAmount,
+ });
+ }
+ }, [data, reset]);
+
+ const heandleOnClose = () =>{
+ reset()
+ onClose()
+ }
+
+
+ return (
+
+
+
+ Approve Comment
+
+ {isLoading ? (
+
+ ) : (
+
+
+
+ Comment
+
+ {errors.checkerComment && (
+
+ {errors.checkerComment.message}
+
+ )}
+
+ Maximum length should be 200 characters. You have entered
+ {watch("checkerComment")?.length || 0} characters.
+
+
+
+
+
+ Cancel
+
+
+ Send
+
+
+
+ )}
+
+
+ );
+ };
+
+ export default ApprovedExit;
+
\ No newline at end of file
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/IOTransaction.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/IOTransaction.jsx
new file mode 100644
index 0000000..7ac057d
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/IOTransaction.jsx
@@ -0,0 +1,54 @@
+import { Tab, TabList, TabPanel, TabPanels, Tabs } from "@chakra-ui/react";
+import React from "react";
+import Approved from "./Approved";
+import Pending from "./Pending";
+import Rejected from "./Rejected";
+
+const IOTransaction = () => {
+ return (
+
+
+
+ Approved
+
+
+ Pending
+
+
+ Rejected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default IOTransaction;
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx
new file mode 100644
index 0000000..a8db39d
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx
@@ -0,0 +1,295 @@
+import {
+ Avatar,
+ Badge,
+ Box,
+ Button,
+ HStack,
+ Input,
+ Table,
+ Tag,
+ Tbody,
+ Text,
+ Th,
+ Tooltip,
+ Tr,
+ useDisclosure,
+ useToast,
+} from "@chakra-ui/react";
+import React, { useContext, useEffect, useRef, useState } from "react";
+import { OPACITY_ON_LOAD } from "../../../../Layout/animations";
+import NormalTable from "../../../../Components/DataTable/NormalTable";
+import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import CustomAlertDialog from "../../../../Components/CustomAlertDialog";
+import { CheckIcon, CloseIcon, ViewIcon } from "@chakra-ui/icons";
+import RequestApproveModal from "./RequestApproveModal";
+import RequestRejectModal from "./RequestRejectModal";
+import ViewAmountInvested from "./ViewAmountInvested";
+import ViewDistributionInvestor from "./ViewDistributionInvestor";
+import ViewExit from "./ViewExit";
+import ViewCancel from "./ViewCancel";
+
+const formatDate = (date) => new Date(date).toLocaleDateString();
+
+const Pending = () => {
+ const toast = useToast();
+ const firstField = useRef();
+ const { isOpen, onOpen, onClose } = useDisclosure();
+ const { IODetails, iOTransaction, setIOTransaction } =
+ useContext(GlobalStateContext);
+ const [searchTerm, setSearchTerm] = useState("");
+ const [isLoading, setIsLoading] = useState(true);
+ const [deleteAlert, setDeleteAlert] = useState(false);
+ const [actionId, setActionId] = useState(false);
+ const [mouseEntered, setMouseEntered] = useState(false);
+ const [mouseEnteredId, setMouseEnteredId] = useState("");
+
+ const {
+ isOpen: isConfirmOpen,
+ onOpen: onConfirmOpen,
+ onClose: onConfirmClose,
+ } = useDisclosure();
+ const {
+ isOpen: isRejectOpen,
+ onOpen: onRejectOpen,
+ onClose: onRejectClose,
+ } = useDisclosure();
+ const {
+ isOpen: isInvestmentOpen,
+ onOpen: onInvestmentOpen,
+ onClose: onInvestmentClose,
+ } = useDisclosure();
+ const {
+ isOpen: isDistInvestorOpen,
+ onOpen: onDistInvestorOpen,
+ onClose: onDistInvestorClose,
+ } = useDisclosure();
+ const {
+ isOpen: isExitOpen,
+ onOpen: onExitOpen,
+ onClose: onExitClose,
+ } = useDisclosure();
+ const {
+ isOpen: isCancelOpen,
+ onOpen: onCancelOpen,
+ onClose: onCancelClose,
+ } = useDisclosure();
+
+ useEffect(() => {
+ // Simulate loading
+ const timer = setTimeout(() => {
+ setIsLoading(false);
+ }, 1500);
+
+ // Cleanup the timer on component unmount
+ return () => clearTimeout(timer);
+ }, []);
+
+ const formatDate = (date) => {
+ return new Date(date).toLocaleDateString("en-GB", {
+ day: "2-digit",
+ month: "2-digit",
+ year: "numeric",
+ });
+ };
+
+ console.log(
+ "==============panding",
+ IODetails?.ioTransactionRecords?.Pending
+ );
+
+ // Table filter
+ // const filteredData = IODetails?.ioTransactionRecords?.Pending?.filter((item) => {
+ // // Filter by name (case insensitive)
+ // const name = item.transactionName;
+ // const searchLower = searchTerm?.toLowerCase();
+ // const nameMatches = name?.toLowerCase().includes(searchLower);
+ // return nameMatches;
+ // });
+
+ const tableHeadRow = [
+ "Sr No.",
+ "Transaction Date",
+ "Transaction Name",
+ "Amount",
+ "Created By",
+ "Created On",
+ "Approved By",
+ "Approved On",
+ "Actions",
+ ];
+
+ const extractedArray = IODetails?.ioTransactionRecords?.Pending?.map(
+ (item, index) => ({
+ id: item?.id,
+ "Sr No.": (
+
+ {index + 1}.
+
+ ),
+ "Transaction Date": (
+
+ {formatDate(item?.transactionDate)}
+
+ ),
+ "Transaction Name": (
+
+ {item?.transactionType}
+
+ ),
+ Amount: (
+
+
+ $
+
+ {parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+ ),
+ "Created By": (
+
+ {item?.creator?.firstName}
+
+ ),
+ "Created On": (
+
+ {formatDate(item?.createdAt)}
+
+ ),
+ "Approved By": (
+
+ {item?.modifier?.firstName}
+
+ ),
+ "Approved On": (
+
+ {item?.modifier ? formatDate(item?.updatedAt) : "---"}
+
+ ),
+ Actions: (
+
+ {
+ setActionId(item.id); // Set the action ID for all cases
+ if (item?.transactionType === "Amount Invested") {
+ onInvestmentOpen();
+ } else if (item?.transactionType === "Distribution To Investor") {
+ onDistInvestorOpen();
+ } else if (item?.transactionType === "Exit") {
+ onExitOpen();
+ } else if (item?.transactionType === "Cancel") {
+ onCancelOpen();
+ }
+ }}
+ >
+ {localStorage?.getItem("role") === "Maker" ? : null} {localStorage?.getItem("role") === "Maker" ? "View" : "Approve / Reject"}
+
+
+ ),
+ })
+ );
+
+ const handleDelete = () => {
+ const updatedSponsors = sponser.filter(
+ (sponsor) => sponsor.id !== actionId
+ );
+
+ setTimeout(() => {
+ setCaseDetails(updatedSponsors);
+ setDeleteAlert(false);
+ setIsLoading(false);
+ }, 100);
+ setIsLoading(true);
+ };
+
+ return (
+
+
+
+ setSearchTerm(e.target.value)}
+ />
+
+
+
+
+
+ setDeleteAlert(false)}
+ isOpen={deleteAlert}
+ message={"Are you sure you want to delete sponers?"}
+ alertHandler={handleDelete}
+ isLoading={isLoading}
+ />
+
+
+
+
+
+
+
+
+ );
+};
+
+export default Pending;
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx
new file mode 100644
index 0000000..942b450
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx
@@ -0,0 +1,219 @@
+import {
+ Avatar,
+ Badge,
+ Box,
+ Button,
+ HStack,
+ Input,
+ Table,
+ Tag,
+ Tbody,
+ Text,
+ Th,
+ Tooltip,
+ Tr,
+ useDisclosure,
+ useToast,
+ } from "@chakra-ui/react";
+ import React, { useContext, useEffect, useRef, useState } from "react";
+ import { AddIcon, DeleteIcon, EditIcon, ViewIcon } from "@chakra-ui/icons";
+ import { LuFileSpreadsheet } from "react-icons/lu";
+ import { OPACITY_ON_LOAD } from "../../../../Layout/animations";
+ import NormalTable from "../../../../Components/DataTable/NormalTable";
+ import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+ import CustomAlertDialog from "../../../../Components/CustomAlertDialog";
+ import ToastBox from "../../../../Components/ToastBox";
+ import AddCashDetails from "../AddCashDetails";
+ import { debounce } from "../../../Admin/Contact";
+
+ const formatDate = (date) => new Date(date).toLocaleDateString();
+
+ const Rejected = () => {
+ const toast = useToast();
+ const firstField = useRef();
+ const { isOpen, onOpen, onClose } = useDisclosure();
+ const { IODetails, iOTransaction, setIOTransaction } =
+ useContext(GlobalStateContext);
+ const [searchTerm, setSearchTerm] = useState("");
+ const [isLoading, setIsLoading] = useState(true);
+ const [deleteAlert, setDeleteAlert] = useState(false);
+ const [actionId, setActionId] = useState(false);
+ const [mouseEntered, setMouseEntered] = useState(false);
+ const [mouseEnteredId, setMouseEnteredId] = useState("");
+
+ useEffect(() => {
+ // Simulate loading
+ const timer = setTimeout(() => {
+ setIsLoading(false);
+ }, 1500);
+
+ // Cleanup the timer on component unmount
+ return () => clearTimeout(timer);
+ }, []);
+
+ const formatDate = (date) => {
+ return new Date(date).toLocaleDateString("en-GB", {
+ day: "2-digit",
+ month: "2-digit",
+ year: "numeric",
+ });
+ };
+
+
+ // Table filter
+ // const filteredData = IODetails?.ioTransactionRecords?.Reject?.filter((item) => {
+ // // Filter by name (case insensitive)
+ // const name = item.transactionName;
+ // const searchLower = searchTerm.toLowerCase();
+ // const nameMatches = name.toLowerCase().includes(searchLower);
+ // return nameMatches;
+ // });
+
+ const tableHeadRow = [
+ "Sr No.",
+ "Transaction Name",
+ "Amount",
+ "Created By",
+ "Created On",
+ "Approved By",
+ "Approved On",
+ ];
+
+ const extractedArray = IODetails?.ioTransactionRecords?.Reject?.map((item, index) => ({
+ id: item?.id,
+ "Sr No.": (
+
+ {index + 1}.
+
+ ),
+ "Transaction Name": (
+
+ {item?.transactionType}
+
+ ),
+ "Amount": (
+
+
+ $
+
+ {parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+ ),
+ "Created By": (
+
+ {item?.creator?.firstName}
+
+ ),
+ "Created On": (
+
+ {formatDate(item?.createdAt)}
+
+ ),
+ "Approved By": (
+
+ {item?.modifier?.firstName}
+
+ ),
+ "Approved On": (
+
+ {formatDate(item?.updatedAt)}
+
+ ),
+ }));
+
+ const handleDelete = () => {
+ const updatedSponsors = sponser.filter(
+ (sponsor) => sponsor.id !== actionId
+ );
+
+ setTimeout(() => {
+ setCaseDetails(updatedSponsors);
+ setDeleteAlert(false);
+ setIsLoading(false);
+ }, 100);
+ setIsLoading(true);
+ };
+
+ return (
+
+
+
+ setSearchTerm(e.target.value)}
+ />
+
+
+
+
+
+ setDeleteAlert(false)}
+ isOpen={deleteAlert}
+ message={"Are you sure you want to delete sponers?"}
+ alertHandler={handleDelete}
+ isLoading={isLoading}
+ />
+
+ );
+ };
+
+ export default Rejected;
+
\ No newline at end of file
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/RequestApproveModal.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/RequestApproveModal.jsx
new file mode 100644
index 0000000..507aeb2
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/RequestApproveModal.jsx
@@ -0,0 +1,175 @@
+import {
+ Box,
+ Button,
+ FormControl,
+ FormHelperText,
+ FormLabel,
+ Input,
+ Modal,
+ ModalBody,
+ ModalCloseButton,
+ ModalContent,
+ ModalFooter,
+ ModalHeader,
+ ModalOverlay,
+ Text,
+ Textarea,
+ useDisclosure,
+ useToast,
+} from "@chakra-ui/react";
+import React, { useEffect, useState } from "react";
+import * as yup from "yup";
+import { yupResolver } from "@hookform/resolvers/yup";
+import { useForm } from "react-hook-form";
+import ToastBox from "../../../../Components/ToastBox";
+import { useApproveDistributionMutation, useApproveIOCaseMutation, useApproveIONavMutation } from "../../../../Services/io.service";
+
+export const conformModalSchema = yup.object().shape({
+ // checkerComment: yup.string().required("Comment is required")
+ // .max(50, "Investment name cannot be more than 50 characters"),
+ checkerComment: yup
+ .string()
+ .required("Comment is required")
+ .max(200, "Approve Comment cannot be more than 200 characters"),
+});
+
+const RequestApproveModal = ({ isOpen, onClose, firstField ,id}) => {
+ const [isBtnLoading , setIsBtnLoading] = useState(false)
+
+ const toast = useToast()
+
+ const {
+ register,
+ reset,
+ watch,
+ handleSubmit,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(conformModalSchema),
+ });
+
+ const [ approveDistribution ] = useApproveDistributionMutation()
+
+
+ const onSubmit = async(data) => {
+ setIsBtnLoading(true)
+ try {
+ const res = await approveDistribution({data,id})
+ if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }else if(res?.data){
+ toast({
+ render: () => (
+
+ ),
+ });
+ onClose()
+ setIsBtnLoading(false)
+ }else{
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }
+ } catch (error) {
+
+ }
+ };
+
+ const handleFileChange = (event) => {
+ const selectedFile = event.target.files[0];
+ setFile(selectedFile);
+ };
+
+
+ const { data, isLoading } =
+ (id, {
+ skip: !id,
+ });
+
+ useEffect(() => {
+ if (data) {
+ reset({
+ investorAmount: data?.data?.investorAmount,
+ });
+ }
+ }, [data, reset]);
+
+ const heandleOnClose = () =>{
+ reset()
+ onClose()
+ }
+
+ return (
+
+
+
+ Approve Comment
+
+ {isLoading ? (
+
+ ) : (
+
+
+
+ Comment
+
+ {errors.checkerComment && (
+
+ {errors.checkerComment.message}
+
+ )}
+
+ Maximum length should be 200 characters. You have entered
+ {watch("checkerComment")?.length || 0} characters.
+
+
+
+
+
+ Cancel
+
+
+ Send
+
+
+
+ )}
+
+
+ );
+};
+
+export default RequestApproveModal;
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/RequestExitApproveModal.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/RequestExitApproveModal.jsx
new file mode 100644
index 0000000..5bc15c7
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/RequestExitApproveModal.jsx
@@ -0,0 +1,176 @@
+import {
+ Box,
+ Button,
+ FormControl,
+ FormHelperText,
+ FormLabel,
+ Input,
+ Modal,
+ ModalBody,
+ ModalCloseButton,
+ ModalContent,
+ ModalFooter,
+ ModalHeader,
+ ModalOverlay,
+ Text,
+ Textarea,
+ useDisclosure,
+ useToast,
+ } from "@chakra-ui/react";
+ import React, { useEffect, useState } from "react";
+ import * as yup from "yup";
+ import { yupResolver } from "@hookform/resolvers/yup";
+ import { useForm } from "react-hook-form";
+ import ToastBox from "../../../../Components/ToastBox";
+ import { useApproveDistributionMutation, useApproveExitMutation, useApproveIOCaseMutation, useApproveIONavMutation } from "../../../../Services/io.service";
+
+ export const conformModalSchema = yup.object().shape({
+ // checkerComment: yup.string().required("Comment is required")
+ // .max(50, "Investment name cannot be more than 50 characters"),
+ checkerComment: yup
+ .string()
+ .required("Comment is required")
+ .max(200, "Approve Comment cannot be more than 200 characters"),
+ });
+
+ const RequestApproveModal = ({ isOpen, onClose, firstField ,id}) => {
+ const [isBtnLoading , setIsBtnLoading] = useState(false)
+
+ const toast = useToast()
+
+ const {
+ register,
+ reset,
+ watch,
+ handleSubmit,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(conformModalSchema),
+ });
+
+ const [ approveExit ] = useApproveExitMutation()
+
+
+ const onSubmit = async(data) => {
+ setIsBtnLoading(true)
+ try {
+ const res = await approveExit({data,id})
+ if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }else if(res?.data){
+ toast({
+ render: () => (
+
+ ),
+ });
+ onClose()
+ setIsBtnLoading(false)
+ }else{
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }
+ } catch (error) {
+
+ }
+ };
+
+ const handleFileChange = (event) => {
+ const selectedFile = event.target.files[0];
+ setFile(selectedFile);
+ };
+
+
+ const { data, isLoading } =
+ (id, {
+ skip: !id,
+ });
+
+ useEffect(() => {
+ if (data) {
+ reset({
+ investorAmount: data?.data?.investorAmount,
+ });
+ }
+ }, [data, reset]);
+
+ const heandleOnClose = () =>{
+ reset()
+ onClose()
+ }
+
+ return (
+
+
+
+ Approve Comment
+
+ {isLoading ? (
+
+ ) : (
+
+
+
+ Comment
+
+ {errors.checkerComment && (
+
+ {errors.checkerComment.message}
+
+ )}
+
+ Maximum length should be 200 characters. You have entered
+ {watch("checkerComment")?.length || 0} characters.
+
+
+
+
+
+ Cancel
+
+
+ Send
+
+
+
+ )}
+
+
+ );
+ };
+
+ export default RequestApproveModal;
+
\ No newline at end of file
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/RequestRejectModal.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/RequestRejectModal.jsx
new file mode 100644
index 0000000..d4631f4
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/RequestRejectModal.jsx
@@ -0,0 +1,169 @@
+import {
+ Box,
+ Button,
+ FormControl,
+ FormLabel,
+ Input,
+ Modal,
+ ModalBody,
+ ModalCloseButton,
+ ModalContent,
+ ModalFooter,
+ ModalHeader,
+ ModalOverlay,
+ Text,
+ Textarea,
+ useDisclosure,
+ useToast,
+} from "@chakra-ui/react";
+import React, { useEffect, useState } from "react";
+import * as yup from "yup";
+import { yupResolver } from "@hookform/resolvers/yup";
+import { useForm } from "react-hook-form";
+import ToastBox from "../../../../Components/ToastBox";
+import { useRejectIOCaseMutation } from "../../../../Services/io.service";
+
+export const conformModalSchema = yup.object().shape({
+ comments: yup.string().required("Comment is required"),
+});
+
+const RequestRejectModal = ({ isOpen, onClose, firstField ,id, onBigModalClose}) => {
+ const [isBtnLoading , setIsBtnLoading] = useState(false)
+
+ const toast = useToast()
+
+ const {
+ register,
+ reset,
+ handleSubmit,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(conformModalSchema),
+ });
+
+ const [ rejectIOCase ] = useRejectIOCaseMutation()
+
+
+ const handleFileChange = (event) => {
+ const selectedFile = event.target.files[0];
+ setFile(selectedFile);
+ };
+
+
+ const { data, isLoading } =
+ (id, {
+ skip: !id,
+ });
+
+ console.log("============data",data);
+
+
+ const onSubmit = async(data) => {
+ console.log(data, "tewxttttt");
+ setIsBtnLoading(true)
+ try {
+ const res = await rejectIOCase({data, id})
+ if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }else if(res?.data){
+ toast({
+ render: () => (
+
+ ),
+ });
+ onClose()
+ onBigModalClose()
+ setIsBtnLoading(false)
+ }else{
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsBtnLoading(false)
+ }
+ } catch (error) {
+
+ }
+ };
+
+
+ // useEffect(() => {
+ // if (data) {
+ // reset({
+ // investorAmount: data?.data?.investorAmount,
+ // });
+ // }
+ // }, [data, reset]);
+
+ const heandleOnClose = () =>{
+ reset()
+ onClose()
+ }
+
+ return (
+
+
+
+ Reject Comment
+
+ {isLoading ? (
+
+ ) : (
+
+
+
+ Comment
+
+ {errors.comments && (
+
+ {errors.comments.message}
+
+ )}
+
+
+
+
+ Cancel
+
+
+ Send
+
+
+
+ )}
+
+
+ );
+};
+
+export default RequestRejectModal;
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx
new file mode 100644
index 0000000..a297a60
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx
@@ -0,0 +1,292 @@
+import React, { useContext, useEffect, useState } from "react";
+import {
+ Box,
+ Button,
+ FormControl,
+ FormLabel,
+ Input,
+ Modal,
+ ModalBody,
+ ModalCloseButton,
+ ModalContent,
+ ModalFooter,
+ ModalHeader,
+ ModalOverlay,
+ Text,
+ useDisclosure,
+ useToast,
+} from "@chakra-ui/react";
+import { Controller, useForm } from "react-hook-form";
+import * as yup from "yup";
+import { yupResolver } from "@hookform/resolvers/yup";
+import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import { useParams } from "react-router-dom";
+import { useAmountIvestmentMutation } from "../../../../Services/io.service";
+import ToastBox from "../../../../Components/ToastBox";
+import CurrencyInput from "../../../../Components/CurrencyInput";
+import RequestRejectModal from "./RequestRejectModal";
+import ApproveInvestedModal from "./ApproveInvestedModal";
+import { formatDate } from "../../../Master/Sponser/Sponsers";
+
+// Validation schema
+const validationSchema = yup.object().shape({
+ transactionDate: yup.date().required("Date is required"),
+ Total_Amount: yup.number().required("Amount is required"),
+ amountInvested: yup.number().required("Amount to invest is required"),
+ IoCash: yup
+ .number()
+ .positive("IO Cash must be positive")
+ .required("IO Cash is required"),
+});
+
+// Function to format currency
+const formatCurrency = (value) => {
+ if (isNaN(value)) return "";
+ const formatted = parseFloat(value).toFixed(2).toString();
+ const [integer, decimal] = formatted.split(".");
+ const formattedInteger = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
+ return decimal ? `${formattedInteger}.${decimal}` : formattedInteger;
+};
+
+const ViewAmountInvested = ({ isOpen, onClose, id: investorId }) => {
+ const params = useParams();
+ const toast = useToast();
+ const id = params?.id;
+ const {
+ control,
+ register,
+ handleSubmit,
+ reset,
+ watch,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(validationSchema),
+ });
+ const [isLoading, setIsLoading] = useState(false);
+ const { IODetails } = useContext(GlobalStateContext);
+ const [amountInvested] = useAmountIvestmentMutation();
+ const [actionId, setActionId] = useState(false);
+
+ const {
+ isOpen: isConfirmOpen,
+ onOpen: onConfirmOpen,
+ onClose: onConfirmClose,
+ } = useDisclosure();
+ const {
+ isOpen: isRejectOpen,
+ onOpen: onRejectOpen,
+ onClose: onRejectClose,
+ } = useDisclosure();
+
+ useEffect(() => {
+ if (IODetails?.totalAmtInvestmentInUSD) {
+ const totalAmount = parseFloat(IODetails.totalAmtInvestmentInUSD);
+ const ioCashUpdate = parseFloat(IODetails.totalAmtInvestmentInUSD);
+ reset({
+ Total_Amount: totalAmount,
+ IoCash: ioCashUpdate,
+ });
+ }
+ }, [IODetails, reset]);
+
+ const onSubmit = async (data) => {
+ console.log(data);
+ setIsLoading(true);
+
+ try {
+ const res = await amountInvested({ data, id });
+ console.log(res);
+ if (res?.data?.statusCode === 200) {
+ toast({
+ render: () => ,
+ });
+ setIsLoading(false);
+ onClose();
+ } else if (res?.error?.status === 400) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsLoading(false);
+ }
+ } catch (error) {
+ setIsLoading(false);
+ }
+ };
+
+ // const formatDate = (date) => new Date(date).toLocaleDateString();
+
+ const handleAmountChange = (e) => {
+ // e might be an object or just a value, handle both cases
+ const amount =
+ typeof e === "object" && e.target
+ ? parseFloat(e.target.value) || 0
+ : parseFloat(e) || 0;
+ const totalAmount = parseFloat(IODetails?.totalAmtInvestmentInUSD) || 0;
+ const ioCash = (totalAmount - amount).toFixed(2);
+
+ reset({
+ amountInvested: parseFloat(amount),
+ IoCash: parseFloat(ioCash),
+ Total_Amount: IODetails?.totalAmtInvestmentInUSD,
+ });
+ };
+
+ console.log(
+ "=========hitttt",
+ IODetails?.ioTransactionRecords?.Pending?.[0]?.createdAt
+ );
+
+ return (
+
+
+
+ Amount Invested
+
+
+
+
+
+
+
+
+ );
+};
+
+export default ViewAmountInvested;
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewCancel.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewCancel.jsx
new file mode 100644
index 0000000..e388d02
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewCancel.jsx
@@ -0,0 +1,365 @@
+import {
+ Badge,
+ Box,
+ Button,
+ HStack,
+ Modal,
+ ModalBody,
+ ModalCloseButton,
+ ModalContent,
+ ModalFooter,
+ ModalHeader,
+ ModalOverlay,
+ Table,
+ Tbody,
+ Text,
+ Th,
+ Tr,
+ useDisclosure,
+ useToast,
+ } from "@chakra-ui/react";
+ import NormalData from "../../../../Components/DataTable/NormalTable";
+ import { useContext, useState } from "react";
+ import {
+ useExitIOTransactionMutation,
+ useGetDistributedToInvestorMutation,
+ useGetDistributionInvestorMutation,
+ useGetIOByIdQuery,
+ } from "../../../../Services/io.service";
+ import { useParams } from "react-router-dom";
+ import { useEffect } from "react";
+ import { useForm } from "react-hook-form";
+ import * as yup from "yup";
+ import { yupResolver } from "@hookform/resolvers/yup";
+ import ToastBox from "../../../../Components/ToastBox";
+ import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import ApprovedCancelTransaction from "./ApprovedCancelTransaction";
+import RequestRejectModal from "./RequestRejectModal";
+
+ const ViewCancel = ({ isOpen, onClose,id:cancleId }) => {
+ const params = useParams();
+ const toast = useToast();
+ const id = params?.id;
+ const [isCalculateLoading, setIsCalculateLoading] = useState(false);
+ const [isFinalCalculateLoading, setIsFinalCalculateLoading] = useState(false);
+ const [calcualtedData, setCalculatedDate] = useState(null);
+ const [isCalcualtedData, setIsCalcualtedData] = useState(false);
+ const { investors, setInvestors, slideFromRight, IODetails } =
+ useContext(GlobalStateContext);
+
+ const [actionId, setActionId] = useState(false);
+
+ const {
+ isOpen: isConfirmOpen,
+ onOpen: onConfirmOpen,
+ onClose: onConfirmClose,
+ } = useDisclosure();
+ const {
+ isOpen: isRejectOpen,
+ onOpen: onRejectOpen,
+ onClose: onRejectClose,
+ } = useDisclosure();
+
+ const investorExit = yup.object().shape({
+ amount: yup
+ .string()
+ .required("Amount is required")
+ .test(
+ "max",
+ `Distribution amount should not be greater than IO cash amount ${IODetails?.ioCash}`,
+ function (value) {
+ const { ioCash } = IODetails || {}; // Safely get ioCash
+ if (value && ioCash) {
+ return parseFloat(value) <= parseFloat(ioCash); // Ensure both are compared as numbers
+ }
+ return true; // If ioCash is not available, skip validation
+ }
+ ),
+ });
+
+ const {
+ control,
+ handleSubmit,
+ formState: { errors },
+ reset,
+ } = useForm({
+ resolver: yupResolver(investorExit),
+ });
+
+ // useEffect(() => {
+ // console.log("hiit useEffectc");
+ // handleCalculate(id, {
+ // amount: IODetails?.ioMVNAV,
+ // });
+ // reset({
+ // amount: IODetails?.ioMVNAV,
+ // });
+ // }, [IODetails, id]);
+
+ const handleCalculate = async (id, data) => {
+ try {
+ const res = await getDistributionInvestment({ id, data });
+ console.log(res?.data?.data);
+
+ if (res?.error?.status === 401) {
+ setIsCalculateLoading(false);
+ setIsCalcualtedData(false);
+ } else if (res?.data?.statusCode === 200) {
+ setCalculatedDate(res?.data?.data);
+ setIsCalculateLoading(false);
+ setIsCalcualtedData(true);
+ }
+ } catch (error) {}
+ };
+
+ const [getDistributionInvestment] = useGetDistributionInvestorMutation();
+
+ const investor = yup.object().shape({
+ amount: yup.string().required("Amount is required"),
+ });
+
+ // ====================================================[Table Setup]================================================================
+ const tableHeadRow = [
+ "Client ID",
+ "First name",
+ "Last name",
+ "Investment amount",
+ "Percentage",
+ "Market Value",
+ "Return on Investment",
+ "Distribution",
+ "Distribution Percent",
+ "Total Return",
+ "Total return on Investment",
+ ];
+
+ const extractedArray = IODetails?.investors?.map((item, index) => ({
+ id: item?.id,
+ "Client ID": (
+
+ {item?.clientReference_id}
+
+ ),
+ "First name": (
+
+ {item.firstName}
+
+ ),
+ "Last name": (
+
+ {item.lastName}
+
+ ),
+ "Investment amount": (
+
+
+ $
+
+ {/* {`$${formatCurrency(item.InvestedAmount_USD)}`} */}
+ {`${parseFloat(item.InvestedAmount_USD || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}`}
+
+ ),
+ Percentage: (
+
+ {item.Investor_Holidings} %
+
+ ),
+ "Market Value": (
+
+
+ $
+
+ {`${parseFloat(item.Market_Value || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}`}
+
+ ),
+ "Return on Investment": (
+
+ {item.Return_On_Investment || 0} %
+
+ ),
+ Distribution: (
+
+
+ $
+
+ {/* {`$${item.Distribution_Amt}`} */}
+ {`${parseFloat(item.Distribution_Amt || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}`}
+
+ ),
+ "Distribution Percent": (
+
+ {/* {`$${item.Distribution_Amt}`} */}
+ {`${parseFloat(item.Distribution_Per || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })} %`}
+
+ ),
+ "Total Return": (
+
+
+ $
+
+ {/* {`$${formatCurrency(item.Total_Return) || 0}`} */}
+ {`${parseFloat(item.Total_Return || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}`}
+
+ ),
+ "Total return on Investment": (
+
+ {item.Total_Return_On_Investment || 0} %
+
+ ),
+ }));
+
+ const handleClose = () => {
+ onClose();
+ setIsFinalCalculateLoading(false);
+ setIsCalcualtedData(false);
+ };
+
+ return (
+
+
+
+ Cancel Transaction
+
+
+
+
+ {localStorage?.getItem("role") !== "Maker" &&
+
+ {
+ setActionId(id); // Use the `id` variable from params
+ onConfirmOpen();
+ }}
+ colorScheme="forestGreen"
+ variant={"solid"}
+ cursor={"pointer"}
+ >
+ Approve
+
+ {
+ setActionId(id); // Use the `id` variable from params
+ onRejectOpen();
+ }}
+ >
+ Reject
+
+
+ }
+
+
+
+
+ );
+ };
+
+ export default ViewCancel;
+
\ No newline at end of file
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
new file mode 100644
index 0000000..6df053a
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
@@ -0,0 +1,268 @@
+import {
+ Box,
+ Button,
+ Modal,
+ ModalBody,
+ ModalCloseButton,
+ ModalContent,
+ ModalFooter,
+ ModalHeader,
+ ModalOverlay,
+ Text,
+ useDisclosure,
+ useToast,
+} from "@chakra-ui/react";
+import NormalData from "../../../../Components/DataTable/NormalTable";
+import { useContext, useState } from "react";
+import { useGetDistributionInvestorMutation } from "../../../../Services/io.service";
+import { useParams } from "react-router-dom";
+import { useEffect } from "react";
+import { useForm } from "react-hook-form";
+import * as yup from "yup";
+import { yupResolver } from "@hookform/resolvers/yup";
+import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import ApproveDistrubationModal from "./ApproveDistrubationModal";
+import RequestRejectModal from "./RequestRejectModal";
+
+const ViewDistributionInvestor = ({ isOpen, onClose,id:exitId }) => {
+ const params = useParams();
+ const toast = useToast();
+ const id = params?.id;
+ const [isCalculateLoading, setIsCalculateLoading] = useState(false);
+ const [isFinalCalculateLoading, setIsFinalCalculateLoading] = useState(false);
+ const [calcualtedData, setCalculatedDate] = useState(null);
+ const [isCalcualtedData, setIsCalcualtedData] = useState(false);
+ const { IODetails } = useContext(GlobalStateContext);
+ const [actionId, setActionId] = useState(false);
+
+ const investorExit = yup.object().shape({
+ amount: yup
+ .string()
+ .required("Amount is required")
+ .test(
+ "max",
+ `Distribution amount should not be greater than IO cash amount ${IODetails?.ioCash}`,
+ function (value) {
+ const { ioCash } = IODetails || {}; // Safely get ioCash
+ if (value && ioCash) {
+ return parseFloat(value) <= parseFloat(ioCash); // Ensure both are compared as numbers
+ }
+ return true; // If ioCash is not available, skip validation
+ }
+ ),
+ });
+
+ const {
+ isOpen: isConfirmOpen,
+ onOpen: onConfirmOpen,
+ onClose: onConfirmClose,
+ } = useDisclosure();
+ const {
+ isOpen: isRejectOpen,
+ onOpen: onRejectOpen,
+ onClose: onRejectClose,
+ } = useDisclosure();
+
+ const {
+ formState: { errors },
+ reset,
+ } = useForm({
+ resolver: yupResolver(investorExit),
+ });
+
+ useEffect(() => {
+ console.log("hiit useEffectc");
+ handleCalculate(id, {
+ amount: IODetails?.ioMVNAV,
+ });
+ reset({
+ amount: IODetails?.ioMVNAV,
+ });
+ }, [IODetails, id]);
+
+ const handleCalculate = async (id, data) => {
+ try {
+ const res = await getDistributionInvestment({ id, data });
+ console.log(res?.data?.data);
+
+ if (res?.error?.status === 401) {
+ setIsCalculateLoading(false);
+ setIsCalcualtedData(false);
+ } else if (res?.data?.statusCode === 200) {
+ setCalculatedDate(res?.data?.data);
+ setIsCalculateLoading(false);
+ setIsCalcualtedData(false);
+ }
+ } catch (error) {}
+ };
+
+ const [getDistributionInvestment] = useGetDistributionInvestorMutation();
+
+ // ====================================================[Table Setup]================================================================
+ const tableHeadRow = [
+ "Sr No.",
+ "Client Id",
+ "First name",
+ "Last Name",
+ "Amount",
+ "Holding (%)",
+ "Distriution Amt($)",
+ "Yeild (%)",
+ ];
+
+ const extractedArray = calcualtedData?.data?.map((item, index) => ({
+ id: item?.id,
+ "Sr No.": (
+
+
+ {index + 1}
+
+
+ ),
+ "Client Id": (
+
+
+ {item?.clientId}
+
+
+ ),
+ "First name": (
+
+
+ {item?.firstName}
+
+
+ ),
+ "Last Name": (
+
+
+ {item?.lastName}
+
+
+ ),
+ Amount: (
+
+
+ {item?.amount?.toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+
+ ),
+ "Holding (%)": (
+
+
+ {item?.investor_holidings?.toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+ %
+
+
+ ),
+ "Distriution Amt($)": (
+
+
+ {item?.distribution_amt?.toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+
+ ),
+ "Yeild (%)": (
+
+
+ {item?.distribution_per?.toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+ %
+
+
+ ),
+ }));
+
+ const handleClose = () => {
+ onClose();
+ setIsFinalCalculateLoading(false);
+ setIsCalcualtedData(false);
+ };
+
+
+ return (
+
+
+
+
+ Distribution To Investor Transaction
+
+
+
+
+
+ {/* ...(localStorage?.getItem("role") !== "Maker" ? ["Status"] : []), */}
+ {localStorage?.getItem("role") !== "Maker" &&
+
+ {
+ setActionId(id); // Use the `id` variable from params
+ onConfirmOpen();
+ }}
+ colorScheme="forestGreen"
+ variant={"solid"}
+ cursor={"pointer"}
+ >
+ Approve
+
+ {
+ setActionId(id); // Use the `id` variable from params
+ onRejectOpen();
+ }}
+ >
+ Reject
+
+
+ }
+
+
+
+
+ );
+};
+
+export default ViewDistributionInvestor;
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewExit.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewExit.jsx
new file mode 100644
index 0000000..1bb0b6a
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewExit.jsx
@@ -0,0 +1,326 @@
+import {
+ Alert,
+ AlertIcon,
+ Box,
+ Button,
+ FormControl,
+ FormErrorMessage,
+ FormLabel,
+ HStack,
+ Input,
+ Modal,
+ ModalBody,
+ ModalCloseButton,
+ ModalContent,
+ ModalFooter,
+ ModalHeader,
+ ModalOverlay,
+ Switch,
+ Table,
+ Tbody,
+ Text,
+ Textarea,
+ Th,
+ Tr,
+ useDisclosure,
+ useToast,
+ } from "@chakra-ui/react";
+ import NormalData from "../../../../Components/DataTable/NormalTable";
+ import { useContext, useState } from "react";
+ import { AddIcon } from "@chakra-ui/icons";
+ import {
+ useExitIOTransactionMutation,
+ useGetDistributedToInvestorMutation,
+ useGetDistributionInvestorMutation,
+ useUpdateExitToInvestorMutation,
+ } from "../../../../Services/io.service";
+ import { useParams } from "react-router-dom";
+ import { useEffect } from "react";
+ import { Controller, useForm } from "react-hook-form";
+ import * as yup from "yup";
+ import { yupResolver } from "@hookform/resolvers/yup";
+ import ToastBox from "../../../../Components/ToastBox";
+ import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import ApprovedExit from "./ApprovedExit";
+import RequestRejectModal from "./RequestRejectModal";
+
+ const ViewExit = ({ isOpen, onClose ,id:investerId}) => {
+ const params = useParams();
+ const toast = useToast();
+ const id = params?.id;
+ const [isCalculateLoading, setIsCalculateLoading] = useState(false);
+ const [isFinalCalculateLoading, setIsFinalCalculateLoading] = useState(false);
+ const [calcualtedData, setCalculatedDate] = useState(null);
+ const [isCalcualtedData, setIsCalcualtedData] = useState(false);
+ const { IODetails } = useContext(GlobalStateContext);
+ const [actionId, setActionId] = useState(false);
+
+ const {
+ isOpen: isConfirmOpen,
+ onOpen: onConfirmOpen,
+ onClose: onConfirmClose,
+ } = useDisclosure();
+ const {
+ isOpen: isRejectOpen,
+ onOpen: onRejectOpen,
+ onClose: onRejectClose,
+ } = useDisclosure();
+
+
+ const {
+ control,
+ handleSubmit,
+ formState: { errors },
+ reset,
+ } = useForm({
+ resolver: yupResolver(),
+ });
+
+ // useEffect(() => {
+ // console.log("hiit useEffectc");
+ // handleCalculate(id, {
+ // amount: IODetails?.ioMVNAV,
+ // });
+ // reset({
+ // amount: IODetails?.ioMVNAV,
+ // });
+ // }, [IODetails, id]);
+
+ const handleCalculate = async (id, data) => {
+ try {
+ const res = await getDistributionInvestment({ id, data });
+ console.log(res?.data?.data);
+
+ if (res?.error?.status === 401) {
+ setIsCalculateLoading(false);
+ setIsCalcualtedData(false);
+ } else if (res?.data?.statusCode === 200) {
+ setCalculatedDate(res?.data?.data);
+ setIsCalculateLoading(false);
+ setIsCalcualtedData(true);
+ }
+ } catch (error) {}
+ };
+
+ const [getDistributionInvestment] = useGetDistributionInvestorMutation();
+
+ const investor = yup.object().shape({
+ amount: yup.string().required("Amount is required"),
+ });
+
+ // ====================================================[Table Setup]================================================================
+ const tableHeadRow = [
+ "Sr No.",
+ "Client Id",
+ "First name",
+ "Last Name",
+ "Amount",
+ "Holding (%)",
+ "Exit Amt($)",
+ ];
+
+
+
+ const extractedArray = calcualtedData?.data?.map((item, index) => ({
+ id: item?.id,
+ "Sr No.": (
+
+
+ {index + 1}
+
+
+ ),
+ "Client Id": (
+
+
+ {item?.clientId}
+
+
+ ),
+ "First name": (
+
+
+ {item?.firstName}
+
+
+ ),
+ "Last Name": (
+
+
+ {item?.lastName}
+
+
+ ),
+ Amount: (
+
+
+ {item?.amount?.toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+
+ ),
+ "Holding (%)": (
+
+
+ {item?.investor_holidings?.toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}%
+
+
+ ),
+ "Exit Amt($)": (
+
+
+ {item?.distribution_amt?.toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+
+ ),
+ }));
+
+ const onSubmit = async (data) => {
+ setIsCalculateLoading(true);
+
+ try {
+ const res = await getDistributionInvestment({ id, data });
+ console.log(res?.data?.data);
+
+ if (res?.error?.status === 401) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsCalculateLoading(false);
+ setIsCalcualtedData(false);
+ } else if (res?.data?.statusCode === 200) {
+ setCalculatedDate(res?.data?.data);
+ toast({
+ render: () => ,
+ });
+ setIsCalculateLoading(false);
+ setIsCalcualtedData(true);
+ }
+ } catch (error) {}
+ };
+
+ const handleClose = () => {
+ onClose();
+ setIsFinalCalculateLoading(false);
+ setIsCalcualtedData(false);
+ };
+
+ console.log(id);
+
+
+ return (
+
+
+
+ Exit Transaction
+
+
+ {/*
+ Amount to Distribute
+ */}
+
+ {/* */}
+ {/* */}
+
+ Exit Amount :
+
+
+ ${" "}
+ {parseFloat(IODetails?.ioMVNAV || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+
+ {/* */}
+
+
+ {/* {calcualtedData && ( */}
+ }
+ // isLoading={isLoading}
+ />
+ {/* ) } */}
+
+ {localStorage?.getItem("role") !== "Maker" &&
+
+ {
+ setActionId(id); // Use the `id` variable from params
+ onConfirmOpen();
+ }}
+ colorScheme="forestGreen"
+ variant={"solid"}
+ cursor={"pointer"}
+ >
+ Approve
+
+ {
+ setActionId(id); // Use the `id` variable from params
+ onRejectOpen();
+ }}
+ >
+ Reject
+
+
+ }
+
+
+
+
+ );
+ };
+
+ export default ViewExit;
+
\ No newline at end of file
diff --git a/src/Pages/IO_Management/CreateIO/Investors.jsx b/src/Pages/IO_Management/CreateIO/Investors.jsx
index b30466a..36f0955 100644
--- a/src/Pages/IO_Management/CreateIO/Investors.jsx
+++ b/src/Pages/IO_Management/CreateIO/Investors.jsx
@@ -100,7 +100,7 @@ const Investors = ({ data }) => {
0
);
- // Table setup
+ // Table setup
const tableHeadRow = [
"Client ID",
"First name",
diff --git a/src/Pages/IO_Management/KeyMeritsEdit.jsx b/src/Pages/IO_Management/KeyMeritsEdit.jsx
index 8563529..e6dbe80 100644
--- a/src/Pages/IO_Management/KeyMeritsEdit.jsx
+++ b/src/Pages/IO_Management/KeyMeritsEdit.jsx
@@ -82,12 +82,16 @@ const KeyMeritsEdit = ({
meritsDescription: found?.meritsDescription,
meritsHeaderArabic: found?.meritsHeaderArabic,
meritsDescriptionArabic: found?.meritsDescriptionArabic,
- iconImage: null,
+ icon_xid: found?.icon_xid,
});
+ console.log("==============",found);
+
}
}, [found, reset]);
const onSubmit = async (data) => {
+ console.log(data);
+
setIsLoading(true);
try {
const id = actionId;
@@ -97,6 +101,9 @@ const KeyMeritsEdit = ({
render: () => ,
});
handleClose()
+ reset({
+ meritsHeader: "",
+ });
return;
}
if (res?.error?.data?.code === 400) {
@@ -106,6 +113,7 @@ const KeyMeritsEdit = ({
),
});
handleClose()
+ reset();
return;
}
} catch (error) {
@@ -288,7 +296,7 @@ const KeyMeritsEdit = ({
alt={selectedImageIcon}
boxSize="1rem"
mr="12px"
- />}{" "}
+ />}
{selectedIcon}
diff --git a/src/Pages/IO_Management/ViewIO/HeaderModal/AmountInvested.jsx b/src/Pages/IO_Management/ViewIO/HeaderModal/AmountInvested.jsx
index 7025d12..02d7af2 100644
--- a/src/Pages/IO_Management/ViewIO/HeaderModal/AmountInvested.jsx
+++ b/src/Pages/IO_Management/ViewIO/HeaderModal/AmountInvested.jsx
@@ -46,7 +46,7 @@ const AmountInvested = ({ isOpen, onClose }) => {
const toast = useToast();
const id = params?.id;
const {
- control,
+ control,
register,
handleSubmit,
reset,
@@ -114,7 +114,7 @@ const AmountInvested = ({ isOpen, onClose }) => {
return (
-
+
Amount Invested
diff --git a/src/Pages/IO_Management/ViewIO/HeaderModal/DistributionInvestor.jsx b/src/Pages/IO_Management/ViewIO/HeaderModal/DistributionInvestor.jsx
index ebf269c..167c686 100644
--- a/src/Pages/IO_Management/ViewIO/HeaderModal/DistributionInvestor.jsx
+++ b/src/Pages/IO_Management/ViewIO/HeaderModal/DistributionInvestor.jsx
@@ -28,8 +28,10 @@ import NormalData from "../../../../Components/DataTable/NormalTable";
import { useContext, useState } from "react";
import { AddIcon } from "@chakra-ui/icons";
import {
+ useAddIOTransactionMutation,
useGetDistributedToInvestorMutation,
useGetDistributionInvestorMutation,
+ useSaveIOTransactionMutation,
useUpdateExitToInvestorMutation,
} from "../../../../Services/io.service";
import { useParams } from "react-router-dom";
@@ -42,6 +44,7 @@ import CurrencyInput from "../../../../Components/CurrencyInput";
import { IoCalculator } from "react-icons/io5";
import { debounce } from "../../../Master/Sponser/AddSponser";
import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import { validate } from "uuid";
@@ -101,6 +104,8 @@ const DistributionInvestor = ({ isOpen, onClose }) => {
resolver: yupResolver(investorExit),
});
+
+ const [saveIOTransaction] = useSaveIOTransactionMutation();
// ====================================================[Table Setup]================================================================
@@ -314,45 +319,81 @@ const DistributionInvestor = ({ isOpen, onClose }) => {
} catch (error) {}
};
+ // const onFinalSubmit = async (data) => {
+ // setIsFinalCalculateLoading(true);
+ // if (!isCalcualtedData) {
+ // setIsFinalCalculateLoading(false);
+ // return toast({
+ // render: () => (
+ //
+ // ),
+ // });
+ // }
+
+
+ // const finalData = {
+ // transactionAmount: data?.amount,
+ // };
+
+ // try {
+ // const res = await getFinalDistributionInvestment({ id, data: finalData });
+ // console.log(finalData);
+
+ // if (res?.error?.status === 401) {
+ // toast({
+ // render: () => (
+ //
+ // ),
+ // });
+ // } else if (res?.data?.statusCode === 200) {
+ // toast({
+ // render: () => ,
+ // });
+ // handleClose();
+ // }
+ // } catch (error) {
+ // console.error("An error occurred:", error);
+ // } finally {
+ // handleClose();
+ // }
+ // };
+
const onFinalSubmit = async (data) => {
setIsFinalCalculateLoading(true);
- if (!isCalcualtedData) {
- setIsFinalCalculateLoading(false);
- return toast({
- render: () => (
-
- ),
- });
- }
-
- const finalData = {
+ const currentDate = new Date();
+ const dataToSend = {
+ transactionDate: currentDate,
transactionAmount: data?.amount,
- };
+ }
+
+ console.log("dataaaaaaa",dataToSend);
try {
- const res = await getFinalDistributionInvestment({ id, data: finalData });
- console.log(finalData);
-
- if (res?.error?.status === 401) {
+ const res = await saveIOTransaction({ id,data: dataToSend });
+ console.log(res?.data?.data);
+ onClose();
+ if (!isCalcualtedData) {
+ setIsFinalCalculateLoading(false);
+ return toast({
+ render: () => (
+
+ ),
+ });
+ } else if (res?.error) {
toast({
render: () => (
-
+
),
});
- } else if (res?.data?.statusCode === 200) {
- toast({
- render: () => ,
- });
- handleClose();
+ // setIsLoading(false);
}
- } catch (error) {
- console.error("An error occurred:", error);
- } finally {
- handleClose();
- }
+ } catch (error) {}
};
const handleClose = () => {
diff --git a/src/Pages/IO_Management/ViewIO/HeaderModal/Exit.jsx b/src/Pages/IO_Management/ViewIO/HeaderModal/Exit.jsx
index 93de936..203117c 100644
--- a/src/Pages/IO_Management/ViewIO/HeaderModal/Exit.jsx
+++ b/src/Pages/IO_Management/ViewIO/HeaderModal/Exit.jsx
@@ -28,6 +28,7 @@ import NormalData from "../../../../Components/DataTable/NormalTable";
import { useContext, useState } from "react";
import { AddIcon } from "@chakra-ui/icons";
import {
+ useExitIOTransactionMutation,
useGetDistributedToInvestorMutation,
useGetDistributionInvestorMutation,
useUpdateExitToInvestorMutation,
@@ -94,7 +95,7 @@ const Exit = ({ isOpen, onClose }) => {
const res = await getDistributionInvestment({ id, data });
console.log(res?.data?.data);
- if (res?.error?.status === 401) {
+ if (res?.error?.status === 401) {
// toast({
// render: () => (
//
@@ -122,7 +123,7 @@ const Exit = ({ isOpen, onClose }) => {
const [getDistributionInvestment] = useGetDistributionInvestorMutation();
const [getFinalDistributionInvestment] =
useGetDistributedToInvestorMutation();
- const [updateExitToInvestor] = useUpdateExitToInvestorMutation();
+ const [exitIOTransaction] = useExitIOTransactionMutation();
const investor = yup.object().shape({
amount: yup.string().required("Amount is required"),
@@ -340,46 +341,69 @@ const Exit = ({ isOpen, onClose }) => {
} catch (error) {}
};
- const onFinalSubmit = async (data) => {
- console.log("hit");
- setIsFinalCalculateLoading(true);
- // if (!isCalcualtedData) {
- // setIsFinalCalculateLoading(false);
- // return toast({
- // render: () => (
- //
- // ),
- // });
- // }
+ // const onFinalSubmit = async (data) => {
+ // console.log("hit");
+ // setIsFinalCalculateLoading(true);
+ // const finalData = {
+ // transactionAmount: IODetails?.ioMVNAV,
+ // };
- const finalData = {
+ // try {
+ // const res = await exitIOTransaction({ id, data: finalData });
+ // console.log(finalData);
+
+ // if (res?.error?.status === 401) {
+ // toast({
+ // render: () => (
+ //
+ // ),
+ // });
+ // } else if (res?.data?.statusCode === 200) {
+ // toast({
+ // render: () => ,
+ // });
+ // handleClose();
+ // }
+ // } catch (error) {
+ // console.error("An error occurred:", error);
+ // } finally {
+ // handleClose();
+ // }
+ // };
+
+ const onFinalSubmit = async () => {
+ setIsCalculateLoading(true);
+ const currentDate = new Date();
+ const dataToSend = {
+ transactionDate: currentDate,
transactionAmount: IODetails?.ioMVNAV,
- };
+ }
+
try {
- const res = await updateExitToInvestor({ id, data: finalData });
- console.log(finalData);
+ const res = await exitIOTransaction({ id,data: dataToSend });
+ console.log(res?.data?.data);
- if (res?.error?.status === 401) {
- toast({
+ onClose();
+ if (!isCalcualtedData) {
+ setIsFinalCalculateLoading(false);
+ return toast({
render: () => (
-
+
),
});
- } else if (res?.data?.statusCode === 200) {
+ } else if (res?.error) {
toast({
- render: () => ,
+ render: () => (
+
+ ),
});
- handleClose();
+ setIsLoading(false);
}
- } catch (error) {
- console.error("An error occurred:", error);
- } finally {
- handleClose();
- }
+ } catch (error) {}
};
const handleClose = () => {
@@ -389,7 +413,7 @@ const Exit = ({ isOpen, onClose }) => {
};
return (
-
+
Exit Transaction
@@ -435,7 +459,7 @@ const Exit = ({ isOpen, onClose }) => {
{/* ) } */}
- {isCalcualtedData ? (
+ {/* {isCalcualtedData ? ( */}
<>
{
Close
>
- ) : (
+ {/* ) : (
""
- )}
+ )} */}
diff --git a/src/Pages/IO_Management/ViewIO/HeaderModal/UpdateIONav.jsx b/src/Pages/IO_Management/ViewIO/HeaderModal/UpdateIONav.jsx
index 95643e2..fb94923 100644
--- a/src/Pages/IO_Management/ViewIO/HeaderModal/UpdateIONav.jsx
+++ b/src/Pages/IO_Management/ViewIO/HeaderModal/UpdateIONav.jsx
@@ -55,7 +55,7 @@ const UpdateIONav = ({ isOpen, onClose }) => {
const [createIoNav] = useCreateIoNavMutation()
-
+
const onSubmit = async (data) => {
setIsLoading(true);
try {
diff --git a/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx b/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx
index 53aeaf5..cb3a6d1 100644
--- a/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx
+++ b/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx
@@ -32,11 +32,14 @@ import KeyMerits from "../CreateIO/KeyMerits";
import Investors from "../CreateIO/Investors";
import EditIO from "../EditIO/EditIO";
import IOArtifacts from "../CreateIO/IOArtifacts";
-import IOCashDetails from "../CreateIO/IOCashDetails";
-import IONAVDetails from "../CreateIO/IONAVDetails";
+// import IOCashDetails from "../CreateIO/IOCashDetailsold";
+// import IONAVDetails from "../CreateIO/IONAVDetailsOld";
import { useGetIOprepopulateDataQuery } from "../../../Services/io.service";
import UnderConstruction from "../../UnderConstruction";
import Destribution from "../CreateIO/Destribution";
+import IOCashDetails from "../CreateIO/IOCashDetails/IOCashDetails";
+import IONAVDetails from "../CreateIO/IONAVDetails/IONAVDetails";
+import IOTransaction from "../CreateIO/IOTransaction/IOTransaction";
const ViewIOdata = () => {
const params = useParams();
@@ -51,7 +54,7 @@ const ViewIOdata = () => {
const tabs = [
{ label: "IO Details", content: },
{
- label: "Investment documents",
+ label: "Investment documents",
content: ,
},
{ label: "Key merits", content: },
@@ -64,6 +67,10 @@ const ViewIOdata = () => {
label: "Distribution to Investors",
content: ,
},
+ {
+ label: "IO Transaction",
+ content: ,
+ },
// { label: "Distribution to Investors", content: },
];
@@ -96,16 +103,28 @@ const ViewIOdata = () => {
index === 1 ||
index === 2 ||
index === 3 ||
- index === 4
+ index === 4 ||
+ index === 8
? false
: !IODetails?.isInvestedAmount
}
+
+ // isDisabled={
+ // index === 0 ||
+ // index === 1 ||
+ // index === 2 ||
+ // index === 3 ||
+ // index === 4
+ // ? false
+ // : !IODetails?.isInvestedAmount
+ // }
key={index}
- fontSize={"sm"}
+ fontSize={"xs"}
_selected={{
color: "#004118",
borderBottom: "2px solid #38a169",
}}
+ fontWeight={500}
>
{label}
diff --git a/src/Pages/IO_Management/ViewIO/ViewIOdataHeader.jsx b/src/Pages/IO_Management/ViewIO/ViewIOdataHeader.jsx
index e41b1f9..9772dd0 100644
--- a/src/Pages/IO_Management/ViewIO/ViewIOdataHeader.jsx
+++ b/src/Pages/IO_Management/ViewIO/ViewIOdataHeader.jsx
@@ -24,6 +24,7 @@ import {
Box,
Icon,
HStack,
+ useToast,
} from "@chakra-ui/react";
import header from "../../../assets/IOheader.png";
import { HiDotsVertical } from "react-icons/hi";
@@ -41,12 +42,15 @@ import Cancle from "./HeaderModal/Cancle";
import { AddIcon } from "@chakra-ui/icons";
import { GrGallery } from "react-icons/gr";
import Loader01 from "../../../Components/Loaders/Loader01";
+import { useUpdateTransactionMutation } from "../../../Services/io.service";
+import ToastBox from "../../../Components/ToastBox";
// import { formatCurrency } from "../../../Components/CurrencyInput";
// import { removeTrailingZeros } from "../../../Constants/Constants";
const ViewIOdataHeader = ({ data, isLoading }) => {
- const params = useParams();
- const id = params?.id;
+ const params = useParams()
+ const toast = useToast();
+ const id = params?.id
const { isOpen, onOpen, onClose } = useDisclosure();
const btnRef = useRef();
const { IODetails, isIOloading } = useContext(GlobalStateContext);
@@ -108,11 +112,95 @@ const ViewIOdataHeader = ({ data, isLoading }) => {
IODetails?.artifactsImage?.[0]?.artifactPathName
);
+ const [updateTransaction] = useUpdateTransactionMutation()
+
+ const handleDistributionInvestors = async () =>{
+
+ try {
+ const res = await updateTransaction(id)
+
+ if (res?.data) {
+ // toast({
+ // render: () => (
+ //
+ // ),
+ // });
+ // setIsLoading(false);
+ onDistInvestorOpen()
+
+ } else if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ // setIsLoading(false);
+ }
+ } catch (error) {
+
+ }
+ }
+
+ const handleExit = async () =>{
+
+ try {
+ const res = await updateTransaction(id)
+
+ if (res?.data) {
+ // toast({
+ // render: () => (
+ //
+ // ),
+ // });
+ // setIsLoading(false);
+ onExitOpen()
+
+ } else if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ // setIsLoading(false);
+ }
+ } catch (error) {
+
+ }
+ }
+
+ const handleInvestment = async () =>{
+
+ try {
+ const res = await updateTransaction(id)
+
+ if (res?.data) {
+ // toast({
+ // render: () => (
+ //
+ // ),
+ // });
+ // setIsLoading(false);
+ onInvestmentOpen()
+
+ } else if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ // setIsLoading(false);
+ }
+ } catch (error) {
+
+ }
+ }
+
+
const menu = [
{
id: 1,
title: "Amount Invested",
- onClickFunction: onInvestmentOpen,
+ onClickFunction: handleInvestment,
},
// {
// id:2,
@@ -127,8 +215,8 @@ const ViewIOdataHeader = ({ data, isLoading }) => {
{
id: 6,
title: "Distribution To Investors",
- onClickFunction: onDistInvestorOpen,
- },
+ onClickFunction: handleDistributionInvestors,
+ },
{
id: 5,
title: "Update IO NAV",
@@ -137,7 +225,7 @@ const ViewIOdataHeader = ({ data, isLoading }) => {
{
id: 8,
title: "Exit",
- onClickFunction: onExitOpen,
+ onClickFunction: handleExit,
},
{
id: 9,
@@ -444,8 +532,8 @@ const ViewIOdataHeader = ({ data, isLoading }) => {
alignItems={"start"}
height={"95px"}
>
-
+ }
{/* Modals */}
diff --git a/src/Pages/IO_Management/ViewIO/ViewIOdetails.jsx b/src/Pages/IO_Management/ViewIO/ViewIOdetails.jsx
index 1c3a9cf..bd2d3f8 100644
--- a/src/Pages/IO_Management/ViewIO/ViewIOdetails.jsx
+++ b/src/Pages/IO_Management/ViewIO/ViewIOdetails.jsx
@@ -361,7 +361,7 @@ const ViewIOdetails = () => {
colorScheme="forestGreen"
rounded={"sm"}
size={"xs"}
- >
+ >
Edit IO
diff --git a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
index 1f7f5a9..3e50cc9 100644
--- a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
+++ b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
@@ -6,8 +6,6 @@ import {
HStack,
Input,
Select,
- Switch,
- Tag,
Text,
Tooltip,
useDisclosure,
@@ -103,7 +101,6 @@ const InvestorDetails = () => {
// ====================================================[Table Setup]================================================================
const tableHeadRow = [
"Sr No",
-
"Client ID",
"First Name",
"Last Name",
diff --git a/src/Services/io.service.js b/src/Services/io.service.js
index 12b4c3e..77db31a 100644
--- a/src/Services/io.service.js
+++ b/src/Services/io.service.js
@@ -15,9 +15,9 @@ export const ioService = createApi({
"getArtifactsVideo",
"getInvestmentDocuments",
"getIOById",
- "getSponser",
- "getInvestmentType",
- "getInvestmentTypeID"
+ "getSponser",
+ "getInvestmentType",
+ "getInvestmentTypeID",
],
endpoints: (builder) => ({
// =====[get prepopulate data]
@@ -28,7 +28,8 @@ export const ioService = createApi({
// =====[get]
getIOs: builder.query({
- query: ({ page, size, ioStatus_xid, search }) => `/io/admin?page=${page}&size=${size}&ioStatus_xid=${ioStatus_xid}&search=${search}`,
+ query: ({ page, size, ioStatus_xid, search }) =>
+ `/io/admin?page=${page}&size=${size}&ioStatus_xid=${ioStatus_xid}&search=${search}`,
providesTags: ["getIO"],
}),
@@ -224,7 +225,7 @@ export const ioService = createApi({
invalidatesTags: ["getIOById"],
}),
- // ======== [ Distribution Transaction ] ========
+ // ======== [ Distribution Transaction ] ========
getDistributionInvestor: builder.mutation({
query: ({ id, data }) => ({
@@ -261,9 +262,7 @@ export const ioService = createApi({
invalidatesTags: ["getIOById"],
}),
-
-
-// ==============[ Displaye Orders ]===============
+ // ==============[ Displaye Orders ]===============
setDisplayOrder: builder.mutation({
query: ({ data }) => ({
@@ -309,7 +308,7 @@ export const ioService = createApi({
method: "POST",
body: data,
}),
- invalidatesTags: ["getSponser","prePopulate"],
+ invalidatesTags: ["getSponser", "prePopulate"],
}),
// ========[Update Sponser]========
@@ -320,12 +319,11 @@ export const ioService = createApi({
method: "PATCH",
body: data,
}),
- invalidatesTags: ["getSponser","prePopulate"],
+ invalidatesTags: ["getSponser", "prePopulate"],
}),
// ======[Get All]=====
-
getSponserMaster: builder.query({
query: ({ page, size, searchTerm }) => {
let baseURL = `/sponsor/admin/?search=${searchTerm || ""}`;
@@ -336,10 +334,10 @@ export const ioService = createApi({
},
providesTags: ["getSponser"],
}),
-
+
// ========[Delete Sponser]========
- deleteSponser: builder.mutation({
+ deleteSponser: builder.mutation({
query: (id) => ({
url: `/sponsor/admin/delete/${id}`,
method: "DELETE",
@@ -356,7 +354,7 @@ export const ioService = createApi({
getSponserMasterActive: builder.query({
query: () => "/sponsor/admin/active",
}),
-
+
// ======[Get ID]=====
getSponserById: builder.query({
@@ -369,12 +367,8 @@ export const ioService = createApi({
query: () => `/sponsor/admin/active`,
}),
+ // ===============================[ Investment Type ]===================================
-
-
-// ===============================[ Investment Type ]===================================
-
-
// ========[Get All]=========
getInvestmentTypes: builder.query({
@@ -405,11 +399,15 @@ export const ioService = createApi({
updateInvestmentType: builder.mutation({
query: ({ data, id }) => ({
- url: `/investmentType/admin/${id}`,
+ url: `/investmentType/admin/${id}`,
method: "PATCH",
body: data,
}),
- invalidatesTags: ["getInvestmentTypeID", "getInvestmentType", "prePopulate"],
+ invalidatesTags: [
+ "getInvestmentTypeID",
+ "getInvestmentType",
+ "prePopulate",
+ ],
}),
// ========[Delete Investment]=======
@@ -419,25 +417,181 @@ export const ioService = createApi({
url: `/investmentType/admin/delete/${id}`,
method: "DELETE",
}),
- invalidatesTags: ["getInvestmentType", 'prePopulate'],
+ invalidatesTags: ["getInvestmentType", "prePopulate"],
}),
-
-
-
-
profile: builder.query({
query: (id) => `/auth/admin/profile`,
}),
+ // ========Add Io Details========
+
+ updateIOCase: builder.mutation({
+ query: (id) => ({
+ url: `/io/admin/maker-transaction/${id}/verify-pending-transaction-for-cash-and-nav`,
+ method: "POST",
+ }),
+
+ invalidatesTags: ["getIOById"],
+ }),
+
+
+ updateTransaction: builder.mutation({
+ query: (id) => ({
+ // url: `/io/admin/maker-transaction/${id}/verify-pending-transaction-for-cash-and-nav`,
+ url: `/io/admin/maker-transaction/${id}/verify-pending-transaction`,
+ method: "POST",
+ }),
+
+ invalidatesTags: ["getIOById"],
+ }),
+ addNavDetails: builder.mutation({
+ query: ({id,data}) => ({
+ url: `/io/admin/maker-transaction/${id}/io-nav`,
+ method: "POST",
+ body:data,
+ }),
+
+ invalidatesTags: ["getIOById"],
+ }),
+
+ addIOTransaction: builder.mutation({
+ query: ({id,data}) => ({
+ url: `/io/admin/maker-transaction/${id}/io-nav`,
+ method: "POST",
+ body:data,
+ }),
+
+ invalidatesTags: ["getIOById"],
+ }),
+
+ saveIOTransaction: builder.mutation({
+ query: ({id,data}) => ({
+ url: `/io/admin/maker-transaction/${id}/io-yeild`,
+ method: "POST",
+ body:data,
+ }),
+
+ invalidatesTags: ["getIOById"],
+ }),
+
+ exitIOTransaction: builder.mutation({
+ query: ({id,data}) => ({
+ url: `/io/admin/maker-transaction/${id}/io-exit`,
+ method: "POST",
+ body:data,
+ }),
+
+ invalidatesTags: ["getIOById"],
+ }),
+
+
+ addIoCase: builder.mutation({
+ query: (id) => ({
+ url: `/io/admin/maker-transaction/${id}/verify-pending-transaction`,
+ method: "POST",
+ }),
+
+ invalidatesTags: ["getIOById"],
+ }),
+ approveIOCase: builder.mutation({
+ query: ({id,data}) => ({
+ url: `/io/admin/checker-transaction/approved/io-cash/${id}`,
+ method: "PATCH",
+ body:data,
+ }),
+
+ invalidatesTags: ["getIOById"],
+ }),
+ approveIONav: builder.mutation({
+ query: ({id,data}) => ({
+ url: `/io/admin/checker-transaction/approved/io-nav/${id}`,
+ method: "PATCH",
+ body:data,
+ }),
+
+ invalidatesTags: ["getIOById"],
+ }),
+
+ approveDistribution: builder.mutation({
+ query: ({id,data}) => ({
+ url: `/io/admin/checker-transaction/approved/distributed-to-investor/${id}`,
+ method: "PATCH",
+ body:data,
+ }),
+
+ invalidatesTags: ["getIOById"],
+ }),
+
+
+ approveExit: builder.mutation({
+ query: ({id,data}) => ({
+ url: `/io/admin/checker-transaction/approved/exit/${id}`,
+ method: "PATCH",
+ body:data,
+ }),
+
+ invalidatesTags: ["getIOById"],
+ }),
+
+ approveInvested: builder.mutation({
+ query: ({id,data}) => ({
+ url: `/io/admin/checker-transaction/approved/amount-invested/${id}`,
+ method: "PATCH",
+ body:data,
+ }),
+
+ invalidatesTags: ["getIOById"],
+ }),
+
+ approveDistributed: builder.mutation({
+ query: ({id,data}) => ({
+ url: `/io/admin/checker-transaction/approved/distributed-to-investor/${id}`,
+ method: "PATCH",
+ body:data,
+ }),
+
+ invalidatesTags: ["getIOById"],
+ }),
+
+ approveExitTransaction: builder.mutation({
+ query: ({id,data}) => ({
+ url: `/io/admin/checker-transaction/approved/exit/${id}`,
+ method: "PATCH",
+ body:data,
+ }),
+
+ invalidatesTags: ["getIOById"],
+ }),
+
+ approveCancleTransaction: builder.mutation({
+ query: ({id,data}) => ({
+ url: `/io/admin/checker-transaction/approved/cancel/${id}`,
+ method: "PATCH",
+ body:data,
+ }),
+
+ invalidatesTags: ["getIOById"],
+ }),
+ rejectIOCase: builder.mutation({
+ query: ({id,data}) => ({
+ url: `/io/admin/checker-transaction/reject/${id}`,
+ method: "PATCH",
+ body:data,
+ }),
+
+ invalidatesTags: ["getIOById"],
+ }),
+
+
}),
});
@@ -470,7 +624,6 @@ export const {
useDeleteVideoArtifactsMutation,
useDeleteImageArtifactsMutation,
-
useSetDisplayOrderMutation,
useSetDisplayOrderIODocumentsMutation,
useSetDisplayOrderIOArtifactsImageMutation,
@@ -488,11 +641,9 @@ export const {
useGetDistributedToInvestorMutation,
useUpdateExitToInvestorMutation,
-
useUpdateCancleStatusMutation,
-
-// ==============[ Sponser ]===============
+ // ==============[ Sponser ]===============
useGetSponserMasterQuery,
useGetSponserMasterActiveQuery,
useCreateSponserMutation,
@@ -501,7 +652,6 @@ export const {
useDeleteSponserMutation,
useGetActiveSponserMasterQuery,
-
// ============[ Investment Type ]========
useGetInvestmentTypesQuery,
@@ -509,6 +659,24 @@ export const {
useCreateInvestmentTypeMutation,
useUpdateInvestmentTypeMutation,
useDeleteInvestmentTypeMutation,
- useProfileQuery
+ useProfileQuery,
+
+ // ========[ Add Io Details ]========
+
+ useUpdateIOCaseMutation,
+ useUpdateTransactionMutation,
+ useApproveIOCaseMutation,
+ useRejectIOCaseMutation,
+ useAddNavDetailsMutation,
+ useApproveIONavMutation,
+ useAddIOTransactionMutation,
+ useSaveIOTransactionMutation,
+ useApproveDistributionMutation,
+ useExitIOTransactionMutation,
+ useApproveExitMutation,
+ useApproveInvestedMutation,
+ useApproveDistributedMutation,
+ useApproveExitTransactionMutation,
+ useApproveCancleTransactionMutation
} = ioService;
|