From 5b2efcd29208d3e5b0d27d0438b617aea50dbfde Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Thu, 14 Nov 2024 16:28:55 +0530
Subject: [PATCH 01/11] update color bugs
---
src/Pages/IO_Management/CreateIO/IODetails.jsx | 2 +-
.../Investor_Management/InvestorDetails/InvestorDetails.jsx | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/Pages/IO_Management/CreateIO/IODetails.jsx b/src/Pages/IO_Management/CreateIO/IODetails.jsx
index 18ff85c..de5ce86 100644
--- a/src/Pages/IO_Management/CreateIO/IODetails.jsx
+++ b/src/Pages/IO_Management/CreateIO/IODetails.jsx
@@ -70,7 +70,7 @@ const schema = yup.object().shape({
InvestmentDetails: yup.string().notRequired(),
comment: yup.string().notRequired()
- .min(10, "Comment must be at least 10 characters long")
+ // .min(10, "Comment must be at least 10 characters long")
.max(100, "Comment must be at most 100 characters long"),
expectedReturn: yup
diff --git a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
index 1f7f5a9..538ee23 100644
--- a/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
+++ b/src/Pages/Investor_Management/InvestorDetails/InvestorDetails.jsx
@@ -216,13 +216,14 @@ const InvestorDetails = () => {
as={'span'}
fontWeight={"700"}
textTransform={"none"}
- color={item.ioStatus ? "gray.500":item.kycStatus ? "blue.500" : "red.500"}
+ color={item?.KYCStatus === true ? "green" : "yellow.500"}
px={2}
py={0.5}
variant={'solid'}
>
- {item.KYCStatus ? "Completed" : "Not complete"}
+ {/* {item.KYCStatus ? "Completed" : "Not complete"} */}
+ {item?.KYCStatus === true ? "Completed" : "NotCompleted"}
),
From 85e3c3412068773154605d1a4908b7ecf4679e2a Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Tue, 19 Nov 2024 19:19:45 +0530
Subject: [PATCH 02/11] update transaction status modal
---
src/Pages/Fawateer/CreateRequest.jsx | 287 +++++++----
.../CreateIO/IOCashDetails/Approved.jsx | 26 +-
.../CreateIO/IOCashDetails/Pending.jsx | 2 +-
.../CreateIO/IOCashDetails/Rejected.jsx | 2 +-
.../CreateIO/IONAVDetails/Approved.jsx | 2 +-
.../CreateIO/IONAVDetails/Pending.jsx | 31 +-
.../CreateIO/IONAVDetails/Rejected.jsx | 2 +-
.../ApproveDistrubationModal.jsx | 178 +++++++
.../IOTransaction/ApproveInvestedModal.jsx | 176 +++++++
.../CreateIO/IOTransaction/Approved.jsx | 22 +-
.../ApprovedCancelTransaction.jsx | 160 ++++++
.../CreateIO/IOTransaction/ApprovedExit.jsx | 174 +++++++
.../CreateIO/IOTransaction/Pending.jsx | 476 +++++++++---------
.../CreateIO/IOTransaction/Rejected.jsx | 4 +-
.../IOTransaction/RequestRejectModal.jsx | 44 +-
.../IOTransaction/ViewAmountInvested.jsx | 304 +++++++++++
.../CreateIO/IOTransaction/ViewCancel.jsx | 363 +++++++++++++
.../ViewDistributionInvestor.jsx | 267 ++++++++++
.../CreateIO/IOTransaction/ViewExit.jsx | 324 ++++++++++++
.../IO_Management/CreateIO/Investors.jsx | 2 +-
.../ViewIO/HeaderModal/AmountInvested.jsx | 2 +-
src/Services/io.service.js | 45 +-
22 files changed, 2510 insertions(+), 383 deletions(-)
create mode 100644 src/Pages/IO_Management/CreateIO/IOTransaction/ApproveDistrubationModal.jsx
create mode 100644 src/Pages/IO_Management/CreateIO/IOTransaction/ApproveInvestedModal.jsx
create mode 100644 src/Pages/IO_Management/CreateIO/IOTransaction/ApprovedCancelTransaction.jsx
create mode 100644 src/Pages/IO_Management/CreateIO/IOTransaction/ApprovedExit.jsx
create mode 100644 src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx
create mode 100644 src/Pages/IO_Management/CreateIO/IOTransaction/ViewCancel.jsx
create mode 100644 src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
create mode 100644 src/Pages/IO_Management/CreateIO/IOTransaction/ViewExit.jsx
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/IO_Management/CreateIO/IOCashDetails/Approved.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx
index 8e474a7..b0f2014 100644
--- a/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx
@@ -86,7 +86,7 @@ const Approved = () => {
"Transaction Type",
"Amount",
"Comments",
- // "Update by",
+ "Update by",
"Update On",
];
@@ -184,7 +184,7 @@ const Approved = () => {
{
| {
wordBreak="normal"
overflowWrap="normal"
>
- {"48,000.00"}
+ {" "}
|
+
+ $
+
+ {IODetails?.ioCash}
+ |
+ {
Add
*/}
{IODetails?.isInvestedAmount ? (
- localStorage?.getItem('role') ==="Maker"&& }
colorScheme="forestGreen"
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx
index fd89eea..30047b3 100644
--- a/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx
@@ -102,7 +102,7 @@ const Pending = () => {
"Transaction Type",
"Amount",
"Comments",
- // "Update by",
+ "Update by",
"Update On",
...(localStorage?.getItem('role')!=="Maker" ? ["Status"] : []),
];
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx
index 88c7ec1..7f18cc6 100644
--- a/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx
@@ -81,7 +81,7 @@ import AddCaseDetails from "./AddCaseDetails";
"Transaction Type",
"Amount",
"Comments",
- // "Update by",
+ "Update by",
"Update On",
];
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx
index b3b1a2e..354da90 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx
@@ -84,7 +84,7 @@ import AddNavDetails from "./AddNavDetails";
"Last Nav Update",
"Investment Closed",
"Comments",
- // "Updated By",
+ "Updated By",
];
const extractedArray = filteredData?.map((item, index) => ({
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx
index c4bfe4d..39a0218 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx
@@ -53,7 +53,6 @@ const Pending = () => {
onClose: onRejectClose,
} = useDisclosure();
-
useEffect(() => {
// Simulate loading
const timer = setTimeout(() => {
@@ -90,8 +89,8 @@ const Pending = () => {
"Last Nav Update",
"Investment Closed",
"Comments",
- // "Updated By",
- ...(localStorage?.getItem('role')!=="Maker" ? ["Status"] : []),
+ "Updated By",
+ ...(localStorage?.getItem("role") !== "Maker" ? ["Status"] : []),
];
const extractedArray = filteredData?.map((item, index) => ({
@@ -273,18 +272,20 @@ const Pending = () => {
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
/>
- {IODetails?.isInvestedAmount ? (
- localStorage?.getItem('role') ==="Maker"&& }
- colorScheme="forestGreen"
- size={"sm"}
- rounded={"sm"}
- fontSize={"xs"}
- >
- Add
-
- ) : null}
+ {IODetails?.isInvestedAmount
+ ? localStorage?.getItem("role") === "Maker" && (
+ }
+ colorScheme="forestGreen"
+ size={"sm"}
+ rounded={"sm"}
+ fontSize={"xs"}
+ >
+ Add
+
+ )
+ : null}
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx
index 351e5dc..8b69230 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx
@@ -82,7 +82,7 @@ import AddNavDetails from "./AddNavDetails";
"Last Nav Update",
"Investment Closed",
"Comments",
- // "Updated By",
+ "Updated By",
];
const extractedArray = filteredData?.map((item, index) => ({
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..c54738d
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ApproveDistrubationModal.jsx
@@ -0,0 +1,178 @@
+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}) => {
+ 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()
+ 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..a165034
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ApproveInvestedModal.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 { 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}) => {
+ 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()
+ 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
index b27c5ef..86b65d6 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/Approved.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/Approved.jsx
@@ -75,7 +75,7 @@ import {
"Amount",
"Created By",
"Created On",
- // "Approved By",
+ "Approved By",
"Approved On",
];
@@ -132,14 +132,32 @@ import {
),
"Approved By": (
+ <>
- {item?.modifier ? item?.modifier : "---" }
+ {item?.modifier ? formatDate(item?.updatedAt) : "---" }
+ {/*
+
+ {item?.creator?.firstName}
+ */}
+ >
),
"Approved On": (
{
+ 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()
+ 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..0c9a50d
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ApprovedExit.jsx
@@ -0,0 +1,174 @@
+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}) => {
+ 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()
+ 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/Pending.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx
index 66af682..cd9a771 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx
@@ -1,122 +1,137 @@
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 } from "@chakra-ui/icons";
+ 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";
-
- 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("");
+import ViewAmountInvested from "./ViewAmountInvested";
+import ViewDistributionInvestor from "./ViewDistributionInvestor";
+import ViewExit from "./ViewExit";
+import ViewCancel from "./ViewCancel";
- 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",
- });
- };
-
- 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 Name",
- "Amount",
- "Created By",
- "Created On",
- // "Approved By",
- "Approved On",
- "Status"
- ];
-
- const extractedArray = IODetails?.ioTransactionRecords?.Pending?.map((item, index) => ({
+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 Name",
+ "Amount",
+ "Created By",
+ "Created On",
+ "Approved By",
+ "Approved On",
+ "Status",
+ ];
+
+ const extractedArray = IODetails?.ioTransactionRecords?.Pending?.map(
+ (item, index) => ({
id: item?.id,
"Sr No.": (
-
+
{index + 1}.
),
"Transaction Name": (
-
+
{item?.transactionType}
),
- "Amount": (
-
+ Amount: (
+
$
@@ -124,160 +139,128 @@ import RequestRejectModal from "./RequestRejectModal";
),
"Created By": (
-
+
{item?.createdBy}
),
"Created On": (
-
+
{formatDate(item?.createdAt)}
),
"Approved By": (
-
- {item?.modifier ? item?.modifier : "---" }
+
+ {item?.modifier ? item?.modifier : "---"}
),
"Approved On": (
-
- {item?.modifier ? formatDate(item?.updatedAt) : "---" }
- {}
+
+ {item?.modifier ? formatDate(item?.updatedAt) : "---"}
),
- "Status": (
+ Status: (
- {
+ 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();
+ }
+ }}
>
- {
- setActionId(item.id);
- onConfirmOpen();
- }}
- colorScheme="green"
- variant={"solid"}
- cursor={"pointer"}
- >
-
-
-
-
- {
- setActionId(item.id);
- onRejectOpen();
- }}
- py={1}
- // variant={"solid"}
- >
-
-
-
+ View
+
),
- }));
-
- 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}
- />
+ })
+ );
+ 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;
-
\ No newline at end of file
+
+ );
+};
+
+export default Pending;
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx
index 21f09ab..ef5420d 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx
@@ -75,7 +75,7 @@ import {
"Amount",
"Created By",
"Created On",
- // "Approved By",
+ "Approved By",
"Approved On",
];
@@ -138,7 +138,7 @@ import {
color={"gray.800"}
fontWeight={"500"}
>
- {item?.modifier ? item?.modifier : "---" }
+ {item?.modifier ? formatDate(item?.updatedAt) : "---" }
),
"Approved On": (
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/RequestRejectModal.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/RequestRejectModal.jsx
index 3a44d26..561150e 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/RequestRejectModal.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/RequestRejectModal.jsx
@@ -44,11 +44,25 @@ const RequestRejectModal = ({ isOpen, onClose, firstField ,id}) => {
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})
+ const res = await rejectIOCase({data, id})
if (res?.error) {
toast({
render: () => (
@@ -77,24 +91,14 @@ const RequestRejectModal = ({ isOpen, onClose, firstField ,id}) => {
}
};
- 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]);
+ // useEffect(() => {
+ // if (data) {
+ // reset({
+ // investorAmount: data?.data?.investorAmount,
+ // });
+ // }
+ // }, [data, reset]);
const heandleOnClose = () =>{
reset()
@@ -138,7 +142,7 @@ const RequestRejectModal = ({ isOpen, onClose, firstField ,id}) => {
colorScheme="gray"
mr={3}
onClick={onClose}
- size={"sm"}
+ size={"xs"}
rounded={"sm"}
>
Cancel
@@ -146,7 +150,7 @@ const RequestRejectModal = ({ isOpen, onClose, firstField ,id}) => {
{
+ 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 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,
+ });
+ };
+
+ 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..1b89458
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewCancel.jsx
@@ -0,0 +1,363 @@
+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
+
+
+
+
+
+
+ {
+ 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..591ace7
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
@@ -0,0 +1,267 @@
+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(true);
+ }
+ } 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);
+ };
+
+ console.log(exitId);
+
+
+ return (
+
+
+
+
+ Distribution To Investor Transaction
+
+
+
+
+
+
+
+ {
+ 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..262adcf
--- /dev/null
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewExit.jsx
@@ -0,0 +1,324 @@
+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}
+ />
+ {/* ) } */}
+
+
+
+ {
+ 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/ViewIO/HeaderModal/AmountInvested.jsx b/src/Pages/IO_Management/ViewIO/HeaderModal/AmountInvested.jsx
index 7025d12..ecbff24 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,
diff --git a/src/Services/io.service.js b/src/Services/io.service.js
index 79d765d..efb5a21 100644
--- a/src/Services/io.service.js
+++ b/src/Services/io.service.js
@@ -540,6 +540,45 @@ export const ioService = createApi({
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({
@@ -634,6 +673,10 @@ export const {
useSaveIOTransactionMutation,
useApproveDistributionMutation,
useExitIOTransactionMutation,
- useApproveExitMutation
+ useApproveExitMutation,
+ useApproveInvestedMutation,
+ useApproveDistributedMutation,
+ useApproveExitTransactionMutation,
+ useApproveCancleTransactionMutation
} = ioService;
From 9f54bfbc653753b88f9b423858e67b6f8fcf805b Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Thu, 21 Nov 2024 15:46:10 +0530
Subject: [PATCH 03/11] update invest amount
---
.../CreateIO/IOTransaction/Pending.jsx | 2 +-
.../IOTransaction/ViewAmountInvested.jsx | 150 +++++++-----------
.../ViewDistributionInvestor.jsx | 2 -
3 files changed, 62 insertions(+), 92 deletions(-)
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx
index cd9a771..1cc5281 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx
@@ -172,7 +172,7 @@ const Pending = () => {
if (item?.transactionType === "Amount Invested") {
onInvestmentOpen();
} else if (item?.transactionType === "Distribution To Investor") {
- onDistInvestorOpen();
+ onInvestmentOpen();
} else if (item?.transactionType === "Exit") {
onExitOpen();
} else if (item?.transactionType === "Cancel") {
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx
index a34685c..d7a7607 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx
@@ -114,6 +114,8 @@ const ViewAmountInvested = ({ isOpen, onClose, id:investorId }) => {
}
};
+ const formatDate = (date) => new Date(date).toLocaleDateString();
+
const handleAmountChange = (e) => {
// e might be an object or just a value, handle both cases
const amount =
@@ -129,6 +131,7 @@ const ViewAmountInvested = ({ isOpen, onClose, id:investorId }) => {
Total_Amount: IODetails?.totalAmtInvestmentInUSD,
});
};
+
return (
@@ -146,32 +149,9 @@ const ViewAmountInvested = ({ isOpen, onClose, id:investorId }) => {
Date
-
- {errors.transactionDate && (
-
- {errors.transactionDate.message}
-
- )}
-
-
-
-
- Amount
-
{
fontSize={"sm"}
readOnly
/>
- {errors.Total_Amount && (
-
- {errors.Total_Amount.message}
-
- )}
-
- Amount to invest
-
- {/* */}
- (
- {
- field.onChange(value); // This will keep the form's internal state updated
- handleAmountChange(value); // This will trigger your custom logic
- }}
- />
- )}
- />
- {errors.amountInvested && (
-
- {errors.amountInvested.message}
-
- )}
-
+ mb={"15px"}
+ isInvalid={!!errors.Total_Amount}
+ isReadOnly
+>
+
+ Amount
+
+
+
+
+
+
+ Amount to invest
+
+
+
+
+
+
+ IO Cash
+
+
+
-
-
- IO Cash
-
-
- {errors.IoCash && (
-
- {errors.IoCash.message}
-
- )}
-
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
index 591ace7..87b9a25 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
@@ -195,8 +195,6 @@ const ViewDistributionInvestor = ({ isOpen, onClose,id:exitId }) => {
setIsFinalCalculateLoading(false);
setIsCalcualtedData(false);
};
-
- console.log(exitId);
return (
From 7ba524d2e465188c5c4e72c85d3161ad1f81d7ed Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Thu, 21 Nov 2024 15:51:01 +0530
Subject: [PATCH 04/11] transaction panding
---
src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx
index 1cc5281..cd9a771 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx
@@ -172,7 +172,7 @@ const Pending = () => {
if (item?.transactionType === "Amount Invested") {
onInvestmentOpen();
} else if (item?.transactionType === "Distribution To Investor") {
- onInvestmentOpen();
+ onDistInvestorOpen();
} else if (item?.transactionType === "Exit") {
onExitOpen();
} else if (item?.transactionType === "Cancel") {
From 470ba49c0038465b7ad0ab8914482c16bc276eb2 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Thu, 21 Nov 2024 16:05:51 +0530
Subject: [PATCH 05/11] UPDATE invest modal
---
.../IOTransaction/ViewAmountInvested.jsx | 127 ++++++++++--------
src/Pages/IO_Management/ViewIO/ViewIOdata.jsx | 30 +++--
2 files changed, 88 insertions(+), 69 deletions(-)
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx
index d7a7607..3983f72 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx
@@ -47,7 +47,7 @@ const formatCurrency = (value) => {
return decimal ? `${formattedInteger}.${decimal}` : formattedInteger;
};
-const ViewAmountInvested = ({ isOpen, onClose, id:investorId }) => {
+const ViewAmountInvested = ({ isOpen, onClose, id: investorId }) => {
const params = useParams();
const toast = useToast();
const id = params?.id;
@@ -131,7 +131,11 @@ const ViewAmountInvested = ({ isOpen, onClose, id:investorId }) => {
Total_Amount: IODetails?.totalAmtInvestmentInUSD,
});
};
-
+
+ console.log(
+ "=========hitttt",
+ IODetails?.ioTransactionRecords?.Approved?.[0]?.transactionAmount
+ );
return (
@@ -151,7 +155,9 @@ const ViewAmountInvested = ({ isOpen, onClose, id:investorId }) => {
{
-
- Amount
-
-
-
+ mb={"15px"}
+ isInvalid={!!errors.Total_Amount}
+ isReadOnly
+ >
+
+ Amount
+
+
+
-
-
- Amount to invest
-
-
-
-
-
-
- IO Cash
-
-
-
+
+
+ Amount to invest
+
+
+
+
+
+ IO Cash
+
+
+
diff --git a/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx b/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx
index c2f5e49..dd99522 100644
--- a/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx
+++ b/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx
@@ -54,7 +54,7 @@ const ViewIOdata = () => {
const tabs = [
{ label: "IO Details", content: },
{
- label: "Investment documents",
+ label: "Investment documents",
content: ,
},
{ label: "Key merits", content: },
@@ -98,15 +98,25 @@ const ViewIOdata = () => {
{tabs.map(({ label }, index) => (
Date: Thu, 21 Nov 2024 17:42:27 +0530
Subject: [PATCH 06/11] update tabs
---
.../CreateIO/IOTransaction/ViewCancel.jsx | 18 +++++++++---------
.../ViewDistributionInvestor.jsx | 18 +++++++++---------
.../CreateIO/IOTransaction/ViewExit.jsx | 18 +++++++++---------
src/Pages/IO_Management/ViewIO/ViewIOdata.jsx | 19 ++++++++++---------
src/Services/io.service.js | 2 +-
5 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewCancel.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewCancel.jsx
index 1b89458..5dc7406 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewCancel.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewCancel.jsx
@@ -86,15 +86,15 @@ import RequestRejectModal from "./RequestRejectModal";
resolver: yupResolver(investorExit),
});
- useEffect(() => {
- console.log("hiit useEffectc");
- handleCalculate(id, {
- amount: IODetails?.ioMVNAV,
- });
- reset({
- amount: IODetails?.ioMVNAV,
- });
- }, [IODetails, id]);
+ // useEffect(() => {
+ // console.log("hiit useEffectc");
+ // handleCalculate(id, {
+ // amount: IODetails?.ioMVNAV,
+ // });
+ // reset({
+ // amount: IODetails?.ioMVNAV,
+ // });
+ // }, [IODetails, id]);
const handleCalculate = async (id, data) => {
try {
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
index 87b9a25..3f3c059 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewDistributionInvestor.jsx
@@ -70,15 +70,15 @@ const ViewDistributionInvestor = ({ isOpen, onClose,id:exitId }) => {
resolver: yupResolver(investorExit),
});
- useEffect(() => {
- console.log("hiit useEffectc");
- handleCalculate(id, {
- amount: IODetails?.ioMVNAV,
- });
- reset({
- amount: IODetails?.ioMVNAV,
- });
- }, [IODetails, id]);
+ // useEffect(() => {
+ // console.log("hiit useEffectc");
+ // handleCalculate(id, {
+ // amount: IODetails?.ioMVNAV,
+ // });
+ // reset({
+ // amount: IODetails?.ioMVNAV,
+ // });
+ // }, [IODetails, id]);
const handleCalculate = async (id, data) => {
try {
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewExit.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewExit.jsx
index 262adcf..9a5ed80 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewExit.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewExit.jsx
@@ -76,15 +76,15 @@ import RequestRejectModal from "./RequestRejectModal";
resolver: yupResolver(),
});
- useEffect(() => {
- console.log("hiit useEffectc");
- handleCalculate(id, {
- amount: IODetails?.ioMVNAV,
- });
- reset({
- amount: IODetails?.ioMVNAV,
- });
- }, [IODetails, id]);
+ // useEffect(() => {
+ // console.log("hiit useEffectc");
+ // handleCalculate(id, {
+ // amount: IODetails?.ioMVNAV,
+ // });
+ // reset({
+ // amount: IODetails?.ioMVNAV,
+ // });
+ // }, [IODetails, id]);
const handleCalculate = async (id, data) => {
try {
diff --git a/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx b/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx
index dd99522..cb3a6d1 100644
--- a/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx
+++ b/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx
@@ -98,15 +98,16 @@ const ViewIOdata = () => {
{tabs.map(({ label }, index) => (
({
From 1c4f9757819fcc63a5e40d8c171019c360bd6162 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Fri, 22 Nov 2024 12:48:02 +0530
Subject: [PATCH 07/11] update bugs
---
.../CreateIO/IOCashDetails/Approved.jsx | 15 +-
.../CreateIO/IOCashDetails/Pending.jsx | 15 +-
.../CreateIO/IOCashDetails/Rejected.jsx | 11 +-
.../CreateIO/IONAVDetails/Approved.jsx | 474 +++++++++---------
.../CreateIO/IONAVDetails/Pending.jsx | 5 +-
.../CreateIO/IONAVDetails/Rejected.jsx | 5 +-
.../CreateIO/IOTransaction/Approved.jsx | 18 +-
.../CreateIO/IOTransaction/Pending.jsx | 17 +-
.../CreateIO/IOTransaction/Rejected.jsx | 7 +-
.../IOTransaction/ViewAmountInvested.jsx | 4 +-
.../CreateIO/IOTransaction/ViewCancel.jsx | 8 +-
.../ViewDistributionInvestor.jsx | 23 +-
.../CreateIO/IOTransaction/ViewExit.jsx | 8 +-
.../IO_Management/ViewIO/ViewIOdataHeader.jsx | 6 +-
14 files changed, 328 insertions(+), 288 deletions(-)
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx
index b0f2014..34f727a 100644
--- a/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx
@@ -112,7 +112,10 @@ const Approved = () => {
$
- {item?.transactionAmount}
+ {parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
),
Comments: (
@@ -224,9 +227,13 @@ const Approved = () => {
overflowWrap="normal"
>
- $
-
- {IODetails?.ioCash}
+ $
+
+ {/* {IODetails?.ioCash} */}
+ {parseFloat(IODetails?.ioCash || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
|
{
$
- {item?.transactionAmount}
+ {parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
),
Comments: (
@@ -289,7 +292,13 @@ const Pending = () => {
wordBreak="normal"
overflowWrap="normal"
>
- {"48,000.00"}
+
+ $
+
+ {parseFloat(IODetails?.ioCash || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
|
{
isLoading={isLoading}
viewActionId={actionId}
setViewActionId={setActionId}
- total={}
+ // total={}
setMouseEnteredId={setMouseEnteredId}
setMouseEntered={setMouseEntered}
/>
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx
index 7f18cc6..243e624 100644
--- a/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx
@@ -117,9 +117,12 @@ import AddCaseDetails from "./AddCaseDetails";
fontWeight={"500"}
>
- $
-
- {item?.transactionAmount}
+ $
+
+ {parseFloat(IODetails?.ioCash || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
),
"Comments": (
@@ -328,7 +331,7 @@ import AddCaseDetails from "./AddCaseDetails";
isLoading={isLoading}
viewActionId={actionId}
setViewActionId={setActionId}
- total={}
+ // total={}
setMouseEnteredId={setMouseEnteredId}
setMouseEntered={setMouseEntered}
/>
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx
index 354da90..f6ed889 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx
@@ -1,136 +1,128 @@
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";
+ 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) => {
+
+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": (
-
-
- $
-
- {item?.transactionAmount}
-
- ),
- "Last Nav Update": (
-
- {item.previousNAVvalue && `${item.previousNAVvalue}`}
-
- ),
- "Investment Closed": (
+ }
+ );
+
+ 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}
-
- ),
- }));
+ {item?.creator?.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);
+ const handleAdd = async () => {
+ try {
+ const res = await updateIOCase(id);
+ if (res?.data) {
+ toast({
+ render: () => (
+
+ ),
+ });
setIsLoading(false);
- }, 100);
- setIsLoading(true);
- };
+ onOpen();
+ } else if (res?.error) {
+ toast({
+ render: () => (
+
+ ),
+ });
+ setIsLoading(false);
+ }
+ } catch (error) {}
+ };
- 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 handleDelete = () => {
+ const updatedSponsors = sponser.filter(
+ (sponsor) => sponsor.id !== actionId
+ );
- const ioNavExport = IODetails?.ioNAVStatusHistory?.Approved?.map((item, index) => ({
- "ID": item?.id, // Keep as integer if it's already a number
+ 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
+ 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
+ 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 (
-
-
-
+
+
-
- exportToExcelNew(ioNavExport, "Io Nav details")
- }
+ exportToExcelNew(ioNavExport, "Io Nav details")}
leftIcon={}
colorScheme="forestGreen"
size={"sm"}
@@ -266,49 +249,50 @@ import AddNavDetails from "./AddNavDetails";
>
Export xls
- {IODetails?.isInvestedAmount ? (
- localStorage?.getItem('role') ==="Maker"&& }
- colorScheme="forestGreen"
- size={"sm"}
- rounded={"sm"}
- fontSize={"xs"}
- >
- Add
-
- ) : null}
+ {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}
- />
+
+
+
+
+
+ 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
+
+ );
+};
+
+export default Approved;
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx
index 39a0218..d68239e 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx
@@ -110,7 +110,10 @@ const Pending = () => {
$
- {item?.transactionAmount}
+ {parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
),
"Last Nav Update": (
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx
index 8b69230..3f0aa17 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx
@@ -114,7 +114,10 @@ import AddNavDetails from "./AddNavDetails";
$
- {item?.transactionAmount}
+ {parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
),
"Last Nav Update": (
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/Approved.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/Approved.jsx
index 86b65d6..b027b7d 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/Approved.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/Approved.jsx
@@ -71,6 +71,7 @@ import {
const tableHeadRow = [
"Sr No.",
+ "Transaction Date",
"Transaction Name",
"Amount",
"Created By",
@@ -90,6 +91,15 @@ import {
{index + 1}.
),
+ "Transaction Date": (
+
+ {formatDate(item?.transactionDate)}
+
+ ),
"Transaction Name": (
$
- {item?.transactionAmount}
+ {/* {item?.transactionAmount} */}
+ {parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
),
"Created By": (
@@ -118,7 +132,7 @@ import {
color={"gray.800"}
fontWeight={"500"}
>
- {item?.createdBy}
+ {item?.creator?.firstName}
),
"Created On": (
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx
index cd9a771..18138fc 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/Pending.jsx
@@ -108,6 +108,7 @@ const Pending = () => {
const tableHeadRow = [
"Sr No.",
+ "Transaction Date",
"Transaction Name",
"Amount",
"Created By",
@@ -125,6 +126,15 @@ const Pending = () => {
{index + 1}.
),
+ "Transaction Date": (
+
+ {formatDate(item?.transactionDate)}
+
+ ),
"Transaction Name": (
{item?.transactionType}
@@ -135,12 +145,15 @@ const Pending = () => {
$
- {item?.transactionAmount}
+ {parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
),
"Created By": (
- {item?.createdBy}
+ {item?.creator?.firstName}
),
"Created On": (
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx
index ef5420d..388ce77 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx
@@ -108,7 +108,10 @@ import {
$
- {item?.transactionAmount}
+ {parseFloat(item?.transactionAmount || 0).toLocaleString(undefined, {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
),
"Created By": (
@@ -118,7 +121,7 @@ import {
color={"gray.800"}
fontWeight={"500"}
>
- {item?.createdBy}
+ {item?.creator?.firstName}
),
"Created On": (
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx
index 3983f72..9d43fd8 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx
@@ -230,7 +230,7 @@ const ViewAmountInvested = ({ isOpen, onClose, id: investorId }) => {
/>
-
+ {localStorage?.getItem("role") !== "Maker" &&
{
Reject
-
+ }
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewCancel.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewCancel.jsx
index 5dc7406..c5a2864 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewCancel.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewCancel.jsx
@@ -309,8 +309,8 @@ import RequestRejectModal from "./RequestRejectModal";
data={extractedArray}
/>
-
-
+ {localStorage?.getItem("role") !== "Maker" &&
+
Reject
-
-
+
+ }
{
resolver: yupResolver(investorExit),
});
- // useEffect(() => {
- // console.log("hiit useEffectc");
- // handleCalculate(id, {
- // amount: IODetails?.ioMVNAV,
- // });
- // reset({
- // amount: IODetails?.ioMVNAV,
- // });
- // }, [IODetails, id]);
+ useEffect(() => {
+ console.log("hiit useEffectc");
+ handleCalculate(id, {
+ amount: IODetails?.ioMVNAV,
+ });
+ reset({
+ amount: IODetails?.ioMVNAV,
+ });
+ }, [IODetails, id]);
const handleCalculate = async (id, data) => {
try {
@@ -212,7 +212,8 @@ const ViewDistributionInvestor = ({ isOpen, onClose,id:exitId }) => {
data={extractedArray}
/>
-
+ {/* ...(localStorage?.getItem("role") !== "Maker" ? ["Status"] : []), */}
+ {localStorage?.getItem("role") !== "Maker" &&
{
Reject
-
+ }
{/* ) } */}
-
-
+ {localStorage?.getItem("role") !== "Maker" &&
+
Reject
-
-
+
+ }
{
alignItems={"start"}
height={"95px"}
>
-
+ }
{/* Modals */}
From f3a8a80f4df172ff414b02c2d69ace498e23adf0 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Fri, 22 Nov 2024 13:32:28 +0530
Subject: [PATCH 08/11] update action
---
.../CreateIO/IOCashDetails/Approved.jsx | 4 +--
.../CreateIO/IOCashDetails/Pending.jsx | 25 ++++++++++++++++---
.../CreateIO/IOCashDetails/Rejected.jsx | 4 +--
.../IOCashDetails/RequestApproveModal.jsx | 4 +--
.../CreateIO/IONAVDetails/Approved.jsx | 4 +--
.../CreateIO/IONAVDetails/Pending.jsx | 22 +++++++++++++---
.../CreateIO/IONAVDetails/Rejected.jsx | 4 +--
.../IONAVDetails/RequestApproveModal.jsx | 2 +-
.../CreateIO/IOTransaction/Approved.jsx | 2 +-
.../CreateIO/IOTransaction/Pending.jsx | 4 +--
.../CreateIO/IOTransaction/Rejected.jsx | 2 +-
.../IOTransaction/RequestApproveModal.jsx | 2 +-
.../IOTransaction/RequestExitApproveModal.jsx | 2 +-
13 files changed, 57 insertions(+), 24 deletions(-)
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx
index 34f727a..4b78d65 100644
--- a/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx
@@ -132,12 +132,12 @@ const Approved = () => {
display={"flex"}
alignItems={"center"}
>
-
+ /> */}
{item?.creator?.firstName}
),
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx
index dc44a53..a7be1f9 100644
--- a/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx
@@ -104,7 +104,8 @@ const Pending = () => {
"Comments",
"Update by",
"Update On",
- ...(localStorage?.getItem('role')!=="Maker" ? ["Status"] : []),
+ // ...(localStorage?.getItem('role')!=="Maker" ? ["Status"] : []),
+ "Status"
];
const extractedArray = filteredData?.map((item, index) => ({
@@ -149,12 +150,12 @@ const Pending = () => {
display={"flex"}
alignItems={"center"}
>
-
+ /> */}
{item?.creator?.firstName}
),
@@ -164,7 +165,9 @@ const Pending = () => {
),
Status: (
-
+
+ {localStorage?.getItem("role") !== "Maker" ?
+
{
+
+ : {
+ setActionId(item.id);
+ }}
+ >
+ View
+ }
),
}));
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx
index 243e624..5a6af37 100644
--- a/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx
@@ -144,12 +144,12 @@ import AddCaseDetails from "./AddCaseDetails";
display={"flex"}
alignItems={"center"}
>
-
+ /> */}
{item?.creator?.firstName}
),
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/RequestApproveModal.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/RequestApproveModal.jsx
index 6ffbfa9..c771b46 100644
--- a/src/Pages/IO_Management/CreateIO/IOCashDetails/RequestApproveModal.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/RequestApproveModal.jsx
@@ -140,8 +140,8 @@ const RequestApproveModal = ({ isOpen, onClose, firstField ,id}) => {
)}
- Maximum length should be 200 characters. You have entered
- {watch("checkerComment")?.length || 0} characters.
+ Maximum length should be 200 characters. You have entered
+ {watch("checkerComment")?.length || 0} characters.
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx
index f6ed889..d9d777f 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx
@@ -147,12 +147,12 @@ const Approved = () => {
display={"flex"}
alignItems={"center"}
>
-
+ /> */}
{item?.creator?.firstName}
),
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx
index d68239e..133d758 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx
@@ -152,17 +152,19 @@ const Pending = () => {
display={"flex"}
alignItems={"center"}
>
-
+ /> */}
{item?.creator?.firstName}
),
Status: (
-
+
+ {localStorage?.getItem("role") !== "Maker" ?
+
{
+
+ : {
+ setActionId(item.id);
+ }}
+ >
+ View
+ }
),
}));
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx
index 3f0aa17..e94f61c 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx
@@ -161,12 +161,12 @@ import AddNavDetails from "./AddNavDetails";
display={"flex"}
alignItems={"center"}
>
-
+ /> */}
{item?.creator?.firstName}
),
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/RequestApproveModal.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/RequestApproveModal.jsx
index 861d3ed..edad9d3 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails/RequestApproveModal.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/RequestApproveModal.jsx
@@ -140,7 +140,7 @@ const RequestApproveModal = ({ isOpen, onClose, firstField ,id}) => {
)}
- Maximum length should be 200 characters. You have entered
+ Maximum length should be 200 characters. You have entered
{watch("checkerComment")?.length || 0} characters.
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/Approved.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/Approved.jsx
index b027b7d..4202924 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/Approved.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/Approved.jsx
@@ -153,7 +153,7 @@ import {
color={"gray.800"}
fontWeight={"500"}
>
- {item?.modifier ? formatDate(item?.updatedAt) : "---" }
+ {item?.modifier?.firstName}
{/* {
),
"Approved By": (
- {item?.modifier ? item?.modifier : "---"}
+ {item?.modifier?.firstName}
),
"Approved On": (
@@ -193,7 +193,7 @@ const Pending = () => {
}
}}
>
- View
+ {localStorage?.getItem("role") === "Maker" ? : null} {localStorage?.getItem("role") === "Maker" ? "View" : "Approve / reject"}
),
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx
index 388ce77..6203687 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/Rejected.jsx
@@ -141,7 +141,7 @@ import {
color={"gray.800"}
fontWeight={"500"}
>
- {item?.modifier ? formatDate(item?.updatedAt) : "---" }
+ {item?.modifier?.firstName}
),
"Approved On": (
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/RequestApproveModal.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/RequestApproveModal.jsx
index 527dbb8..507aeb2 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/RequestApproveModal.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/RequestApproveModal.jsx
@@ -139,7 +139,7 @@ const RequestApproveModal = ({ isOpen, onClose, firstField ,id}) => {
)}
- Maximum length should be 200 characters. You have entered
+ Maximum length should be 200 characters. You have entered
{watch("checkerComment")?.length || 0} characters.
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/RequestExitApproveModal.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/RequestExitApproveModal.jsx
index 04ee265..5bc15c7 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/RequestExitApproveModal.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/RequestExitApproveModal.jsx
@@ -139,7 +139,7 @@ import {
)}
- Maximum length should be 200 characters. You have entered
+ Maximum length should be 200 characters. You have entered
{watch("checkerComment")?.length || 0} characters.
From 0ab898a3dae4d3f1f8d70a9b424e1ab496a57c6c Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Fri, 22 Nov 2024 16:19:59 +0530
Subject: [PATCH 09/11] update new bugs
---
.../CreateIO/IOCashDetails/AddCaseDetails.jsx | 3 +
.../CreateIO/IOCashDetails/Approved.jsx | 16 +-
.../CreateIO/IOCashDetails/IOCashDetails.jsx | 138 +++--
.../CreateIO/IOCashDetails/Pending.jsx | 20 +-
.../CreateIO/IOCashDetails/Rejected.jsx | 14 +-
.../CreateIO/IONAVDetails/AddNavDetails.jsx | 1 -
.../CreateIO/IONAVDetails/Approved.jsx | 14 +-
.../CreateIO/IONAVDetails/IONAVDetails.jsx | 216 ++++++--
.../CreateIO/IONAVDetails/Pending.jsx | 32 +-
.../CreateIO/IONAVDetails/Rejected.jsx | 471 +++++++++---------
.../ApproveDistrubationModal.jsx | 3 +-
.../CreateIO/IOTransaction/Approved.jsx | 2 +
.../CreateIO/IOTransaction/Pending.jsx | 14 +-
.../CreateIO/IOTransaction/Rejected.jsx | 2 +
.../IOTransaction/RequestRejectModal.jsx | 3 +-
.../IOTransaction/ViewAmountInvested.jsx | 11 +-
.../ViewDistributionInvestor.jsx | 4 +-
.../ViewIO/HeaderModal/AmountInvested.jsx | 2 +-
.../IO_Management/ViewIO/ViewIOdataHeader.jsx | 39 +-
src/Services/io.service.js | 2 +-
20 files changed, 612 insertions(+), 395 deletions(-)
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)}
/>
-
+
@@ -349,7 +349,7 @@ const Approved = () => {
>
Add
*/}
- {IODetails?.isInvestedAmount ? (
+ {/* {IODetails?.isInvestedAmount ? (
localStorage?.getItem('role') ==="Maker" && }
@@ -360,7 +360,7 @@ const Approved = () => {
>
Add
- ) : 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" &&
+ }
+ colorScheme="forestGreen"
+ size={"sm"}
+ rounded={"sm"}
+ fontSize={"xs"}
>
- Approved
-
-
- Pending
-
-
- Rejected
-
-
+ Add
+
+ ) : 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"&& {
Add
) : 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"&&
) : null}
-
+ */}
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/AddNavDetails.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/AddNavDetails.jsx
index bc42ce1..0427829 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails/AddNavDetails.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/AddNavDetails.jsx
@@ -195,7 +195,6 @@ console.log(calculatePercentage(1092500, 976070));
-
Live return %
{calculatePercentage(watch()?.transactionAmount||IODetails?.ioNAV,IODetails?.ioNAV)}
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx
index d9d777f..a7a58d1 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx
@@ -162,11 +162,11 @@ const Approved = () => {
try {
const res = await updateIOCase(id);
if (res?.data) {
- toast({
- render: () => (
-
- ),
- });
+ // toast({
+ // render: () => (
+ //
+ // ),
+ // });
setIsLoading(false);
onOpen();
} else if (res?.error) {
@@ -249,7 +249,7 @@ const Approved = () => {
>
Export xls
- {IODetails?.isInvestedAmount
+ {/* {IODetails?.isInvestedAmount
? localStorage?.getItem("role") === "Maker" && (
{
Add
)
- : 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" && (
+ }
+ colorScheme="forestGreen"
+ size={"sm"}
+ rounded={"sm"}
+ fontSize={"xs"}
+ >
+ Add
+
+ )
+ : 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" ?
+
{
- : {
- setActionId(item.id);
- }}
- >
- View
- }
+
),
}));
@@ -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" && (
{
Add
)
- : 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"&& }
- 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}
- />
+ {/* {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;
-
\ 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: (
{
}
}}
>
- {localStorage?.getItem("role") === "Maker" ? : null} {localStorage?.getItem("role") === "Maker" ? "View" : "Approve / reject"}
+ {localStorage?.getItem("role") === "Maker" ? : null} {localStorage?.getItem("role") === "Maker" ? "View" : "Approve / Reject"}
),
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`,
From 23c3997d06efedaef3cdef1423ab19864a9b0178 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Fri, 22 Nov 2024 16:56:31 +0530
Subject: [PATCH 10/11] updated
---
src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx | 2 +-
src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx | 2 +-
src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx | 2 +-
src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx | 2 +-
src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx | 2 +-
src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx
index e6c66d1..749498b 100644
--- a/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Approved.jsx
@@ -138,7 +138,7 @@ const Approved = () => {
name={item.creator?.firstName}
src={item.creator?.profilePhoto}
/> */}
- {item?.creator?.firstName}
+ {item?.modifier?.firstName}
),
"Update On": (
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx
index 636359e..dd6716f 100644
--- a/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx
@@ -156,7 +156,7 @@ const Pending = () => {
name={item?.creator?.firstName}
src={item?.creator?.profilePhoto}
/> */}
- {item?.creator?.firstName}
+ {item?.modifier?.firstName}
),
"Update On": (
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx
index 70be463..470fdc8 100644
--- a/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Rejected.jsx
@@ -150,7 +150,7 @@ import AddCaseDetails from "./AddCaseDetails";
name={item.creator?.firstName}
src={item.creator?.profilePhoto}
/> */}
- {item?.creator?.firstName}
+ {item?.modifier?.firstName}
),
"Update On": (
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx
index a7a58d1..3b1a0a8 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Approved.jsx
@@ -153,7 +153,7 @@ const Approved = () => {
name={item.creator?.firstName}
src={item.creator?.profilePhoto}
/> */}
- {item?.creator?.firstName}
+ {item?.modifier?.firstName}
),
}));
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx
index 456096b..928532a 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Pending.jsx
@@ -158,7 +158,7 @@ const Pending = () => {
name={item.creator?.firstName}
src={item.creator?.profilePhoto}
/> */}
- {item?.creator?.firstName}
+ {item?.modifier?.firstName}
),
Status: (
diff --git a/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx b/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx
index e1040d8..2603e3f 100644
--- a/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx
+++ b/src/Pages/IO_Management/CreateIO/IONAVDetails/Rejected.jsx
@@ -149,7 +149,7 @@ const Rejected = () => {
name={item.creator?.firstName}
src={item.creator?.profilePhoto}
/> */}
- {item?.creator?.firstName}
+ {item?.modifier?.firstName}
),
}));
From 29a49150b7bba489ca4c8fa7754c7bb69f40a624 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Fri, 22 Nov 2024 18:51:05 +0530
Subject: [PATCH 11/11] update modal close
---
.../CreateIO/IOCashDetails/Pending.jsx | 8 ++++----
.../ApproveDistrubationModal.jsx | 2 +-
.../IOTransaction/ApproveInvestedModal.jsx | 5 +++--
.../ApprovedCancelTransaction.jsx | 5 +++--
.../CreateIO/IOTransaction/ApprovedExit.jsx | 5 +++--
.../IOTransaction/ViewAmountInvested.jsx | 2 ++
.../CreateIO/IOTransaction/ViewCancel.jsx | 2 ++
.../CreateIO/IOTransaction/ViewExit.jsx | 2 ++
.../IO_Management/ViewIO/ViewIOdataHeader.jsx | 20 +++++++++----------
9 files changed, 30 insertions(+), 21 deletions(-)
diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx
index dd6716f..fa7e9db 100644
--- a/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/Pending.jsx
@@ -166,8 +166,8 @@ const Pending = () => {
),
Actions: (
- {localStorage?.getItem("role") !== "Maker" ?
-
+ {localStorage?.getItem("role") !== "Maker" ?
+ {index===0&&
{
>
-
-
+ }
+
:
)}
- Maximum length should be 200 characters. You have entered
+ Maximum length should be 200 characters. You have entered
{watch("checkerComment")?.length || 0} characters.
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ApproveInvestedModal.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ApproveInvestedModal.jsx
index a165034..8ea065e 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/ApproveInvestedModal.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ApproveInvestedModal.jsx
@@ -33,7 +33,7 @@ import {
.max(200, "Approve Comment cannot be more than 200 characters"),
});
- const ApproveInvestedModal = ({ isOpen, onClose, firstField ,id}) => {
+ const ApproveInvestedModal = ({ isOpen, onClose, firstField ,id,onBigModalClose}) => {
const [isBtnLoading , setIsBtnLoading] = useState(false)
const toast = useToast()
@@ -69,6 +69,7 @@ import {
),
});
onClose()
+ onBigModalClose()
setIsBtnLoading(false)
}else{
toast({
@@ -139,7 +140,7 @@ import {
)}
- Maximum length should be 200 characters. You have entered
+ Maximum length should be 200 characters. You have entered
{watch("checkerComment")?.length || 0} characters.
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ApprovedCancelTransaction.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ApprovedCancelTransaction.jsx
index 327e5b1..1233c75 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/ApprovedCancelTransaction.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ApprovedCancelTransaction.jsx
@@ -22,7 +22,7 @@ import {
import {useApproveCancleTransactionMutation, useApproveExitTransactionMutation} from "../../../../Services/io.service";
- const ApprovedCancelTransaction = ({ isOpen, onClose, firstField ,id}) => {
+ const ApprovedCancelTransaction = ({ isOpen, onClose, firstField ,id,onBigModalClose}) => {
const [isBtnLoading , setIsBtnLoading] = useState(false)
const toast = useToast()
@@ -58,6 +58,7 @@ import {
),
});
onClose()
+ onBigModalClose()
setIsBtnLoading(false)
}else{
toast({
@@ -123,7 +124,7 @@ import {
)}
- Maximum length should be 200 characters. You have entered
+ Maximum length should be 200 characters. You have entered
{watch("checkerComment")?.length || 0} characters.
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ApprovedExit.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ApprovedExit.jsx
index 0c9a50d..2b3f4fa 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/ApprovedExit.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ApprovedExit.jsx
@@ -30,7 +30,7 @@ import {
.max(200, "Approve Comment cannot be more than 200 characters"),
});
- const ApprovedExit = ({ isOpen, onClose, firstField ,id}) => {
+ const ApprovedExit = ({ isOpen, onClose, firstField ,id,onBigModalClose}) => {
const [isBtnLoading , setIsBtnLoading] = useState(false)
const toast = useToast()
@@ -66,6 +66,7 @@ import {
),
});
onClose()
+ onBigModalClose()
setIsBtnLoading(false)
}else{
toast({
@@ -137,7 +138,7 @@ import {
)}
- Maximum length should be 200 characters. You have entered
+ Maximum length should be 200 characters. You have entered
{watch("checkerComment")?.length || 0} characters.
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx
index 25eef94..a297a60 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx
@@ -276,11 +276,13 @@ const ViewAmountInvested = ({ isOpen, onClose, id: investorId }) => {
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewCancel.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewCancel.jsx
index c5a2864..e388d02 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewCancel.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewCancel.jsx
@@ -348,11 +348,13 @@ import RequestRejectModal from "./RequestRejectModal";
diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewExit.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewExit.jsx
index 1b30b56..1bb0b6a 100644
--- a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewExit.jsx
+++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewExit.jsx
@@ -309,11 +309,13 @@ import RequestRejectModal from "./RequestRejectModal";
diff --git a/src/Pages/IO_Management/ViewIO/ViewIOdataHeader.jsx b/src/Pages/IO_Management/ViewIO/ViewIOdataHeader.jsx
index 2d4eb78..9772dd0 100644
--- a/src/Pages/IO_Management/ViewIO/ViewIOdataHeader.jsx
+++ b/src/Pages/IO_Management/ViewIO/ViewIOdataHeader.jsx
@@ -147,11 +147,11 @@ const ViewIOdataHeader = ({ data, isLoading }) => {
const res = await updateTransaction(id)
if (res?.data) {
- toast({
- render: () => (
-
- ),
- });
+ // toast({
+ // render: () => (
+ //
+ // ),
+ // });
// setIsLoading(false);
onExitOpen()
@@ -174,11 +174,11 @@ const ViewIOdataHeader = ({ data, isLoading }) => {
const res = await updateTransaction(id)
if (res?.data) {
- toast({
- render: () => (
-
- ),
- });
+ // toast({
+ // render: () => (
+ //
+ // ),
+ // });
// setIsLoading(false);
onInvestmentOpen()
|