diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/AddCaseDetails.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/AddCaseDetails.jsx index 4f65cda..3bc016d 100644 --- a/src/Pages/IO_Management/CreateIO/IOCashDetails/AddCaseDetails.jsx +++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/AddCaseDetails.jsx @@ -45,6 +45,9 @@ const AddCaseDetails = ({ isOpen, onClose, firstField, actionId, setActionId, da const [alert, setAlert] = useState(false); const toast = useToast(); + console.log(isOpen); + + // ======================[ Cotext Api ] diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx index 4b78d65..e6c66d1 100644 --- a/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx +++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx @@ -285,11 +285,11 @@ const Approved = () => { try { const res = await updateIOCase(id); if (res?.data) { - toast({ - render: () => ( - - ), - }); + // toast({ + // render: () => ( + // + // ), + // }); setIsLoading(false); onOpen(); } else if (res?.error) { @@ -322,7 +322,7 @@ const Approved = () => { value={searchTerm} onChange={(e) => setSearchTerm(e.target.value)} /> - + */} - {IODetails?.isInvestedAmount ? ( + {/* {IODetails?.isInvestedAmount ? ( localStorage?.getItem('role') ==="Maker" && - ) : null} + ) : null} */} diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/IOCashDetails.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/IOCashDetails.jsx index 4c9e6c7..3055a43 100644 --- a/src/Pages/IO_Management/CreateIO/IOCashDetails/IOCashDetails.jsx +++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/IOCashDetails.jsx @@ -1,41 +1,111 @@ -import { Tab, TabList, TabPanel, TabPanels, Tabs } from "@chakra-ui/react"; -import React from "react"; +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" && + + ) : null} + @@ -48,6 +118,12 @@ const IOCashDetails = () => { + + ); }; diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx index a7be1f9..636359e 100644 --- a/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx +++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx @@ -104,8 +104,8 @@ const Pending = () => { "Comments", "Update by", "Update On", - // ...(localStorage?.getItem('role')!=="Maker" ? ["Status"] : []), - "Status" + ...(localStorage?.getItem('role')!=="Maker" ? ["Actions"] : []), + ]; const extractedArray = filteredData?.map((item, index) => ({ @@ -164,7 +164,7 @@ const Pending = () => { {formatDate(item.updatedAt)} ), - Status: ( + Actions: ( {localStorage?.getItem("role") !== "Maker" ? @@ -365,11 +365,11 @@ const Pending = () => { try { const res = await updateIOCase(id); if (res?.data) { - toast({ - render: () => ( - - ), - }); + // toast({ + // render: () => ( + // + // ), + // }); setIsLoading(false); onOpen(); } else if (res?.error) { @@ -403,7 +403,7 @@ const Pending = () => { onChange={(e) => setSearchTerm(e.target.value)} /> - + {/* {IODetails?.isInvestedAmount ? ( localStorage?.getItem('role') ==="Maker"&& ) : null} - + */} diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx index 5a6af37..70be463 100644 --- a/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx +++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx @@ -267,11 +267,11 @@ import AddCaseDetails from "./AddCaseDetails"; try { const res = await updateIOCase(id) if (res?.data) { - toast({ - render: () => ( - - ), - }); + // toast({ + // render: () => ( + // + // ), + // }); setIsLoading(false); onOpen() @@ -307,7 +307,7 @@ import AddCaseDetails from "./AddCaseDetails"; onChange={(e) => setSearchTerm(e.target.value)} /> - + {/* {IODetails?.isInvestedAmount ? ( localStorage?.getItem('role') ==="Maker"&& - {IODetails?.isInvestedAmount + {/* {IODetails?.isInvestedAmount ? localStorage?.getItem("role") === "Maker" && ( ) - : null} + : null} */} diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/IONAVDetails.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/IONAVDetails.jsx index bad63f8..03cf067 100644 --- a/src/Pages/IO_Management/CreateIO/IONAVDetails/IONAVDetails.jsx +++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/IONAVDetails.jsx @@ -1,53 +1,183 @@ -import { Tab, TabList, TabPanel, TabPanels, Tabs } from "@chakra-ui/react"; -import React from "react"; +// 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 - - - - - - - - - - - - - - + + + Approved + + + Pending + + + Rejected + + + {IODetails?.isInvestedAmount + ? localStorage?.getItem("role") === "Maker" && ( + + ) + : null} + + + + + + + + + + + + + + + ); }; diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx index 133d758..456096b 100644 --- a/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx +++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx @@ -15,7 +15,7 @@ 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 } from "@chakra-ui/icons"; +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"; @@ -163,7 +163,7 @@ const Pending = () => { ), Status: ( - {localStorage?.getItem("role") !== "Maker" ? + { - : } + ), })); @@ -254,11 +242,11 @@ const Pending = () => { try { const res = await updateIOCase(id); if (res?.data) { - toast({ - render: () => ( - - ), - }); + // toast({ + // render: () => ( + // + // ), + // }); setIsLoading(false); onOpen(); } else if (res?.error) { @@ -291,7 +279,7 @@ const Pending = () => { value={searchTerm} onChange={(e) => setSearchTerm(e.target.value)} /> - {IODetails?.isInvestedAmount + {/* {IODetails?.isInvestedAmount ? localStorage?.getItem("role") === "Maker" && ( ) - : null} + : null} */} diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx index e94f61c..e1040d8 100644 --- a/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx +++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx @@ -1,137 +1,124 @@ 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"; + 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 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", }); - - 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": ( + }; + + // 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": ( ), - "Comments": ( - - {item?.comments ? item?.comments : "---" } - - ), - "Updated By": ( - + {item?.comments ? item?.comments : "---"} + + ), + "Updated By": ( + - {/* + {/* */} - {item?.creator?.firstName} - - ), - })); - - const handleDelete = () => { - const updatedSponsors = sponser.filter( - (sponsor) => sponsor.id !== actionId - ); - - setTimeout(() => { - setCaseDetails(updatedSponsors); - setDeleteAlert(false); + {item?.creator?.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); - }, 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) { - } - } + } catch (error) {} + }; - return ( - - - - setSearchTerm(e.target.value)} - /> + return ( + + + + setSearchTerm(e.target.value)} + /> -{IODetails?.isInvestedAmount ? ( - localStorage?.getItem('role') ==="Maker"&& - ) : null} - - - - - - setDeleteAlert(false)} - isOpen={deleteAlert} - message={"Are you sure you want to delete sponers?"} - alertHandler={handleDelete} - isLoading={isLoading} - /> + {/* {IODetails?.isInvestedAmount + ? localStorage?.getItem("role") === "Maker" && ( + + ) + : null} */} + + + + + + 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 +export default Rejected; diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ApproveDistrubationModal.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ApproveDistrubationModal.jsx index c54738d..667db8a 100644 --- a/src/Pages/IO_Management/CreateIO/IOTransaction/ApproveDistrubationModal.jsx +++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ApproveDistrubationModal.jsx @@ -33,7 +33,7 @@ import { .max(200, "Approve Comment cannot be more than 200 characters"), }); - const ApproveDistrubationModal = ({ isOpen, onClose, firstField ,id}) => { + const ApproveDistrubationModal = ({ isOpen, onClose, firstField ,id, onBigModalClose}) => { const [isBtnLoading , setIsBtnLoading] = useState(false) const toast = useToast() @@ -71,6 +71,7 @@ import { ), }); onClose() + onBigModalClose() setIsBtnLoading(false) }else{ toast({ diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/Approved.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/Approved.jsx index 4202924..e0f9160 100644 --- a/src/Pages/IO_Management/CreateIO/IOTransaction/Approved.jsx +++ b/src/Pages/IO_Management/CreateIO/IOTransaction/Approved.jsx @@ -131,6 +131,7 @@ import { as={"span"} color={"gray.800"} fontWeight={"500"} + textTransform={'capitalize'} > {item?.creator?.firstName} @@ -152,6 +153,7 @@ import { as={"span"} color={"gray.800"} fontWeight={"500"} + textTransform={'capitalize'} > {item?.modifier?.firstName} diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx index 3a795bc..a8db39d 100644 --- a/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx +++ b/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx @@ -115,7 +115,7 @@ const Pending = () => { "Created On", "Approved By", "Approved On", - "Status", + "Actions", ]; const extractedArray = IODetails?.ioTransactionRecords?.Pending?.map( @@ -152,7 +152,8 @@ const Pending = () => { ), "Created By": ( - + {item?.creator?.firstName} ), @@ -162,7 +163,8 @@ const Pending = () => { ), "Approved By": ( - + {item?.modifier?.firstName} ), @@ -171,10 +173,10 @@ const Pending = () => { {item?.modifier ? formatDate(item?.updatedAt) : "---"} ), - Status: ( + Actions: ( ), diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx index 6203687..942b450 100644 --- a/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx +++ b/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx @@ -120,6 +120,7 @@ import { as={"span"} color={"gray.800"} fontWeight={"500"} + textTransform={'capitalize'} > {item?.creator?.firstName} @@ -140,6 +141,7 @@ import { as={"span"} color={"gray.800"} fontWeight={"500"} + textTransform={'capitalize'} > {item?.modifier?.firstName} diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/RequestRejectModal.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/RequestRejectModal.jsx index 561150e..d4631f4 100644 --- a/src/Pages/IO_Management/CreateIO/IOTransaction/RequestRejectModal.jsx +++ b/src/Pages/IO_Management/CreateIO/IOTransaction/RequestRejectModal.jsx @@ -27,7 +27,7 @@ export const conformModalSchema = yup.object().shape({ comments: yup.string().required("Comment is required"), }); -const RequestRejectModal = ({ isOpen, onClose, firstField ,id}) => { +const RequestRejectModal = ({ isOpen, onClose, firstField ,id, onBigModalClose}) => { const [isBtnLoading , setIsBtnLoading] = useState(false) const toast = useToast() @@ -77,6 +77,7 @@ const RequestRejectModal = ({ isOpen, onClose, firstField ,id}) => { ), }); onClose() + onBigModalClose() setIsBtnLoading(false) }else{ toast({ diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx index 9d43fd8..25eef94 100644 --- a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx +++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx @@ -26,6 +26,7 @@ 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({ @@ -114,7 +115,7 @@ const ViewAmountInvested = ({ isOpen, onClose, id: investorId }) => { } }; - const formatDate = (date) => new Date(date).toLocaleDateString(); + // const formatDate = (date) => new Date(date).toLocaleDateString(); const handleAmountChange = (e) => { // e might be an object or just a value, handle both cases @@ -134,7 +135,7 @@ const ViewAmountInvested = ({ isOpen, onClose, id: investorId }) => { console.log( "=========hitttt", - IODetails?.ioTransactionRecords?.Approved?.[0]?.transactionAmount + IODetails?.ioTransactionRecords?.Pending?.[0]?.createdAt ); return ( @@ -156,8 +157,9 @@ const ViewAmountInvested = ({ isOpen, onClose, id: investorId }) => { { fontSize={"sm"} readOnly /> + {/* + {IODetails?.ioTransactionRecords?.Approved?.[0]?.createdAt} dccd + */} { } else if (res?.data?.statusCode === 200) { setCalculatedDate(res?.data?.data); setIsCalculateLoading(false); - setIsCalcualtedData(true); + setIsCalcualtedData(false); } } catch (error) {} }; @@ -252,11 +252,13 @@ const ViewDistributionInvestor = ({ isOpen, onClose,id:exitId }) => { diff --git a/src/Pages/IO_Management/ViewIO/HeaderModal/AmountInvested.jsx b/src/Pages/IO_Management/ViewIO/HeaderModal/AmountInvested.jsx index ecbff24..02d7af2 100644 --- a/src/Pages/IO_Management/ViewIO/HeaderModal/AmountInvested.jsx +++ b/src/Pages/IO_Management/ViewIO/HeaderModal/AmountInvested.jsx @@ -114,7 +114,7 @@ const AmountInvested = ({ isOpen, onClose }) => { return ( - + Amount Invested diff --git a/src/Pages/IO_Management/ViewIO/ViewIOdataHeader.jsx b/src/Pages/IO_Management/ViewIO/ViewIOdataHeader.jsx index b9ff454..2d4eb78 100644 --- a/src/Pages/IO_Management/ViewIO/ViewIOdataHeader.jsx +++ b/src/Pages/IO_Management/ViewIO/ViewIOdataHeader.jsx @@ -120,11 +120,11 @@ const ViewIOdataHeader = ({ data, isLoading }) => { const res = await updateTransaction(id) if (res?.data) { - toast({ - render: () => ( - - ), - }); + // toast({ + // render: () => ( + // + // ), + // }); // setIsLoading(false); onDistInvestorOpen() @@ -167,13 +167,40 @@ const ViewIOdataHeader = ({ data, isLoading }) => { } } + + 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, diff --git a/src/Services/io.service.js b/src/Services/io.service.js index f937183..77db31a 100644 --- a/src/Services/io.service.js +++ b/src/Services/io.service.js @@ -435,7 +435,7 @@ export const ioService = createApi({ invalidatesTags: ["getIOById"], }), - + updateTransaction: builder.mutation({ query: (id) => ({ // url: `/io/admin/maker-transaction/${id}/verify-pending-transaction-for-cash-and-nav`,