diff --git a/src/Components/CurrencyInput.jsx b/src/Components/CurrencyInput.jsx
index facdca8..7aea90c 100644
--- a/src/Components/CurrencyInput.jsx
+++ b/src/Components/CurrencyInput.jsx
@@ -13,15 +13,15 @@ const CurrencyInput = forwardRef(({ value, onChange, ...props }, ref) => {
const handleChange = (event) => {
- let { value } = event.target;
+ let { value } = event?.target;
// Remove non-numeric characters except decimal point
- value = value.replace(/[^0-9.]/g, '');
+ value = value?.replace(/[^0-9.]/g, '');
// Ensure only one decimal point
- const parts = value.split('.');
+ const parts = value?.split('.');
if (parts.length > 2) {
- value = parts[0] + '.' + parts.slice(1).join('');
+ value = parts[0] + '.' + parts?.slice(1)?.join('');
}
onChange(value); // Pass the raw value to parent or use it directly
diff --git a/src/Pages/Deposit/DepositRequest/DepositRequest.jsx b/src/Pages/Deposit/DepositRequest/DepositRequest.jsx
index f17fae3..b84279c 100644
--- a/src/Pages/Deposit/DepositRequest/DepositRequest.jsx
+++ b/src/Pages/Deposit/DepositRequest/DepositRequest.jsx
@@ -109,7 +109,7 @@ const DepositRequest = () => {
// ====================================================[Table Filter]================================================================
const filteredData = data?.data?.rows.filter((item) => {
// Filter by name (case insensitive)
- const name = item?.createdAt;
+ const name = [item.firstName, item.lastName, item.countryName].filter(Boolean).join(' ');
const searchLower = searchTerm.toLowerCase();
const nameMatches = name.toLowerCase().includes(searchLower);
diff --git a/src/Pages/Deposit/DepositViewHistory/DepositHistory.jsx b/src/Pages/Deposit/DepositViewHistory/DepositHistory.jsx
index 058a068..e44b2e8 100644
--- a/src/Pages/Deposit/DepositViewHistory/DepositHistory.jsx
+++ b/src/Pages/Deposit/DepositViewHistory/DepositHistory.jsx
@@ -101,15 +101,15 @@ const DepositHistory = () => {
});
}, 300);
- // ====================================================[Table Filter]================================================================
- const filteredData = data?.data?.rows.filter((item) => {
- // Filter by name (case insensitive)
- const name = item.createdAt;
- const searchLower = searchTerm.toLowerCase();
- const nameMatches = name.toLowerCase().includes(searchLower);
+// ====================================================[Table Filter]================================================================
+const filteredData = data?.data?.rows.filter((item) => {
+ // Combine firstName, lastName, and countryName for filtering
+ const name = [item.firstName, item.lastName, item.countryName].filter(Boolean).join(' ');
+ const searchLower = searchTerm.toLowerCase();
+ const nameMatches = name.toLowerCase().includes(searchLower);
+ return nameMatches;
+});
- return nameMatches;
- });
// const handleView = (id) => {
// setActionId(id);
@@ -139,34 +139,34 @@ const DepositHistory = () => {
fontWeight={"500"}
className="d-flex align-items-center web-text-small"
>
- {item?.principal?.investor_details?.clientReference_id}
+ {item?.clientReference_id}
),
"First Name": (
- {item?.principal?.firstName}
+ {item?.firstName}
),
"Last Name": (
- {item?.principal?.lastName}
+ {item?.lastName}
),
Country: (
- {item?.principal?.investor_details?.country?.countryName}
+ {item?.countryName}
),
"Phone Number": (
- {item?.principal?.mobileNumber}
+ {item?.mobileNumber}
),
diff --git a/src/Pages/IO_Management/CreateIO/CreateIO.jsx b/src/Pages/IO_Management/CreateIO/CreateIO.jsx
index 9d0ca4c..942c9ec 100644
--- a/src/Pages/IO_Management/CreateIO/CreateIO.jsx
+++ b/src/Pages/IO_Management/CreateIO/CreateIO.jsx
@@ -15,6 +15,7 @@ import ViewIOdataHeader from "../ViewIO/ViewIOdataHeader";
import { useParams } from "react-router-dom";
import FullscreenLoaders from "../../../Components/Loaders/FullscreenLoaders";
import { useGetIOprepopulateDataQuery } from "../../../Services/io.service";
+import UnderConstruction from "../../UnderConstruction";
const CreateIO = () => {
const id = useParams()?.id;
@@ -57,7 +58,8 @@ const CreateIO = () => {
},
{
label: "Investors",
- Content: Investors,
+ // Content: Investors,
+ Content: UnderConstruction,
isDisabled: id ? false : true,
},
{
diff --git a/src/Pages/IO_Management/KeyMeritsAdd.jsx b/src/Pages/IO_Management/KeyMeritsAdd.jsx
index 54d9677..eb44428 100644
--- a/src/Pages/IO_Management/KeyMeritsAdd.jsx
+++ b/src/Pages/IO_Management/KeyMeritsAdd.jsx
@@ -86,10 +86,7 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
toast({
render: () => ,
});
- setAlert(false);
- onClose();
- setIsLoading(false);
- reset();
+ handleClose()
return;
}
@@ -115,12 +112,7 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
});
}
setIsLoading(false);
- onClose();
- setAlert(false);
- reset();
- setFile(null);
- setSelectedImageIcon(null);
- setSelectedIcon("Select Icon");
+ handleClose()
}
reset();
};
diff --git a/src/Pages/IO_Management/KeyMeritsEdit.jsx b/src/Pages/IO_Management/KeyMeritsEdit.jsx
index 557f8dc..473658b 100644
--- a/src/Pages/IO_Management/KeyMeritsEdit.jsx
+++ b/src/Pages/IO_Management/KeyMeritsEdit.jsx
@@ -59,6 +59,8 @@ const KeyMeritsEdit = ({
const [selectedImageIcon, setSelectedImageIcon] = useState(null);
const found = data?.find((item) => item?.id === actionId);
+ console.log(found);
+
const {
control,
@@ -71,6 +73,9 @@ const KeyMeritsEdit = ({
});
// useEffect to reset the form when `found` changes
useEffect(() => {
+ setValue("icon_xid", found?.icon?.id);
+ setSelectedIcon(found?.icon?.iconName); // Update selected icon name
+ setSelectedImageIcon(found?.icon?.iconFilePath);
if (found) {
reset({
meritsHeader: found?.meritsHeader,
@@ -91,10 +96,7 @@ const KeyMeritsEdit = ({
toast({
render: () => ,
});
- setAlert(false);
- onClose();
- setIsLoading(false);
- reset();
+ handleClose()
return;
}
if (res?.error?.data?.code === 400) {
@@ -103,10 +105,7 @@ const KeyMeritsEdit = ({
),
});
- setAlert(false);
- onClose();
- setIsLoading(false);
- reset();
+ handleClose()
return;
}
} catch (error) {
@@ -121,10 +120,7 @@ const KeyMeritsEdit = ({
),
});
}
- setIsLoading(false);
- setAlert(false);
- onClose();
- reset();
+ handleClose()
}
reset();
};
@@ -140,6 +136,14 @@ const KeyMeritsEdit = ({
setSelectedImageIcon(iconFilePath);
};
+ const handleClose = () => {
+ setIsLoading(false);
+ setAlert(false);
+ onClose();
+ reset();
+
+ }
+
return (
<>
{
+ 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 AmountInvested = ({ isOpen, onClose }) => {
- const params = useParams()
- const toast = useToast()
- const id = params?.id
- const { register, handleSubmit, reset, watch, formState: { errors } } = useForm({
+ 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 [isLoading, setIsLoading] = useState(false);
const { IODetails } = useContext(GlobalStateContext);
- const [ amountInvested ] = useAmountIvestmentMutation()
+ const [amountInvested] = useAmountIvestmentMutation();
useEffect(() => {
- reset({
- Total_Amount: IODetails?.goalAmount,
- IoCash: IODetails?.goalAmount
- })
- }, [IODetails])
-
+ if (IODetails?.goalAmount) {
+ const totalAmount = parseFloat(IODetails.goalAmount);
+ const ioCashUpdate = parseFloat(IODetails.goalAmount)
+ reset({
+ Total_Amount: totalAmount,
+ IoCash: ioCashUpdate,
+ });
+ }
+ }, [IODetails, reset]);
const onSubmit = async (data) => {
console.log(data);
- setIsLoading(true)
+ setIsLoading(true);
try {
- const res = await amountInvested({data, id})
+ const res = await amountInvested({ data, id });
console.log(res);
- if (res?.data?.statusCode === 200 ) {
+ if (res?.data?.statusCode === 200) {
toast({
render: () => ,
});
- setIsLoading(false)
- onClose()
-
- }else if(response?.error?.status === 400) {
+ setIsLoading(false);
+ onClose();
+ } else if (res?.error?.status === 400) {
toast({
render: () => (
-
+
),
});
- setIsLoading(false)
+ setIsLoading(false);
}
-
-
-
} catch (error) {
-
+ setIsLoading(false);
}
- // Handle form submission
};
const handleAmountChange = (e) => {
const amount = parseFloat(e.target.value) || 0;
const totalAmount = parseFloat(IODetails?.goalAmount) || 0;
- const ioCash = (totalAmount - amount).toFixed(2); // Ensure precision with toFixed
+ const ioCash = (totalAmount - amount).toFixed(2);
reset({
- amountInvested: amount,
- IoCash: parseFloat(ioCash), // Convert to number for consistent formatting
+ amountInvested: parseFloat(amount),
+ IoCash: parseFloat(ioCash),
+ Total_Amount: IODetails?.goalAmount
});
};
@@ -119,8 +126,8 @@ const AmountInvested = ({ isOpen, onClose }) => {
Amount
{
focusBorderColor="forestGreen.300"
fontSize={"sm"}
onChange={handleAmountChange}
-
/>
{errors.amountInvested && {errors.amountInvested.message}}
@@ -152,8 +158,8 @@ const AmountInvested = ({ isOpen, onClose }) => {
IO Cash
{
+const UpdateIOStatus = ({ isOpen, onClose, status }) => {
const params = useParams();
const id = params?.id;
- const [selectedItem, setSelectedItem] = useState(status?.[0]?.statusAdmin);
+ const [selectedItem, setSelectedItem] = useState();
const [isLoadingg, setIsLoading] = useState(false);
- const { data, error, isLoading } = useGetIOprepopulateDataQuery();
+ const [error, setError] = useState("");
const [selectedStatusId, setSelectedStatusId] = useState(status?.[0]?.id);
- useEffect(() => {
- setSelectedItem(status?.[0]?.statusAdmin)
- setSelectedStatusId(status?.[0]?.id)
- }, [status])
-
-
-
-
+ const { data } = useGetIOprepopulateDataQuery();
const [updateStatusIo] = useUpdateStatusIoMutation();
+ useEffect(() => {
+ setSelectedStatusId(status?.[0]?.id);
+ }, [status]);
+
const handleMenuItemClick = (item, id) => {
setSelectedItem(item);
setSelectedStatusId(id);
};
const handleSubmit = async () => {
- setIsLoading(true)
+ if (!selectedStatusId) {
+ setError("Status is required.");
+ return;
+ }
+ setError("");
+ setIsLoading(true);
try {
const res = await updateStatusIo({
data: {
@@ -57,109 +59,117 @@ const UpdateIOStatus = ({ isOpen, onClose , status}) => {
id,
});
console.log(res);
- setIsLoading(false)
- onClose()
- } catch (error) {}
+ setIsLoading(false);
+ handleClose();
+ } catch (error) {
+ setIsLoading(false);
+ }
};
+ const handleClose = () => {
+ setSelectedItem("")
+ onClose()
+ }
+
return (
-
+
Update IO Status Transaction
-
- Status
-
-
+ ) : "Select Item"}
+
+
+ {status?.length > 0 ?
+ {status?.map(({ id, statusAdmin }) => (
+
+ ))}
+ :""}
+
+ {error}
+
-
diff --git a/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx b/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx
index bb20909..88ac59f 100644
--- a/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx
+++ b/src/Pages/IO_Management/ViewIO/ViewIOdata.jsx
@@ -35,6 +35,7 @@ import IOArtifacts from "../CreateIO/IOArtifacts";
import IOCashDetails from "../CreateIO/IOCashDetails";
import IONAVDetails from "../CreateIO/IONAVDetails";
import { useGetIOprepopulateDataQuery } from "../../../Services/io.service";
+import UnderConstruction from "../../UnderConstruction";
const ViewIOdata = () => {
@@ -51,10 +52,12 @@ const ViewIOdata = () => {
{ label: "Investment documents", content: },
{ label: "Key merits", content: },
{ label: "IO artifacts", content: },
- { label: "Investors", content: },
+ // { label: "Investors", content: },
+ { label: "Investors", content: },
{ label: "IO Cash Details", content: },
{ label: "IO NAV Details", content: },
- { label: "Distribution to Investors", content: },
+ // { label: "Distribution to Investors", content: },
+ { label: "Distribution to Investors", content: },
];
return (
diff --git a/src/Pages/IO_Management/ViewIO/ViewIOdataHeader.jsx b/src/Pages/IO_Management/ViewIO/ViewIOdataHeader.jsx
index a1616ac..4399d1f 100644
--- a/src/Pages/IO_Management/ViewIO/ViewIOdataHeader.jsx
+++ b/src/Pages/IO_Management/ViewIO/ViewIOdataHeader.jsx
@@ -23,6 +23,7 @@ import {
Badge,
Box,
Icon,
+ HStack,
} from "@chakra-ui/react";
import header from "../../../assets/IOheader.png";
import { HiDotsVertical } from "react-icons/hi";
@@ -40,6 +41,7 @@ import Cancle from "./HeaderModal/Cancle";
import { AddIcon } from "@chakra-ui/icons";
import { GrGallery } from "react-icons/gr";
import Loader01 from "../../../Components/Loaders/Loader01";
+import { formatCurrency } from "../../../Components/CurrencyInput";
const ViewIOdataHeader = ({data, isLoading}) => {
const params = useParams();
@@ -166,7 +168,7 @@ console.log(isLoading);
{/* */}
{IODetails?.artifactsImage?.[0]?.artifactPathName ? (
@@ -249,6 +251,10 @@ console.log(isLoading);
: "---"}
+
+
+
+
@@ -290,7 +296,7 @@ console.log(isLoading);
IO NAV
- {IODetails?.ioNAV ? IODetails?.ioNAV : "00.00"}
+ {IODetails?.ioNAV ? formatCurrency(IODetails?.ioNAV) : "00.00"}
@@ -299,7 +305,7 @@ console.log(isLoading);
IO cash
- {IODetails?.ioCash ? IODetails?.ioCash : "00.00"}
+ {IODetails?.ioCash ? formatCurrency(IODetails?.ioCash) : "00.00"}
@@ -308,10 +314,12 @@ console.log(isLoading);
IO MV NAV
- {IODetails?.ioMVNAV ? IODetails?.ioMVNAV : "00.00"}
+ {IODetails?.ioMVNAV ? formatCurrency(IODetails?.ioMVNAV) : "00.00"}
+
+
{
// ====================================================[Table Filter]================================================================
const filteredData = investorDetails?.data?.rows?.filter((item) => {
// Filter by name (case insensitive)
- const name = item.clientReference_id;
+ const name = [item?.principal?.firstName, item?.principal?.lastName, item?.country?.countryName, item?.principal?.mobileNumber, item?.principal?.emailAddress].filter(Boolean).join(' ');
const searchLower = searchTerm.toLowerCase();
const nameMatches = name?.toLowerCase().includes(searchLower);
diff --git a/src/Pages/UnderConstruction.jsx b/src/Pages/UnderConstruction.jsx
index 834dc42..56bf614 100644
--- a/src/Pages/UnderConstruction.jsx
+++ b/src/Pages/UnderConstruction.jsx
@@ -3,10 +3,10 @@ import React from 'react'
// import noInternet from "../assets/Error.svg"
import robot from "../assets/under-construction.png"
-const UnderConstruction = ({title}) => {
+const UnderConstruction = ({title, h}) => {
return (