but update
This commit is contained in:
@@ -29,11 +29,6 @@ const App = () => {
|
||||
useEffect(() => {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const handleOnlineStatusChange = () => {
|
||||
setIsOnline(navigator.onLine);
|
||||
};
|
||||
|
||||
@@ -230,7 +230,7 @@ const DashboardLayout = ({ isOnline }) => {
|
||||
return (
|
||||
<span className="d-flex align-items-end gap-2">
|
||||
<RiExchangeBoxLine className="h4 m-0 fw-normal" />
|
||||
Deposite withdrawal request
|
||||
Deposite request
|
||||
</span>
|
||||
);
|
||||
|
||||
|
||||
@@ -30,11 +30,11 @@ import ToastBox from "../../Components/ToastBox";
|
||||
export const addSponser = yup.object().shape({
|
||||
phoneNumber: yup
|
||||
.string()
|
||||
.required("Phone Number is required")
|
||||
.matches(
|
||||
/^\+?[1-9]\d{1,14}$/,
|
||||
"Phone Number must include a valid ISD code and be in E.164 format"
|
||||
),
|
||||
.required("Phone Number is required"),
|
||||
// .matches(
|
||||
// /^\+?[1-9]\d{1,14}$/,
|
||||
// "Phone Number must include a valid ISD code and be in E.164 format"
|
||||
// ),
|
||||
emailAddress: yup
|
||||
.string()
|
||||
.required("E-mail ID is required")
|
||||
|
||||
@@ -79,7 +79,7 @@ const UnbanInvestor = () => {
|
||||
{
|
||||
page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
|
||||
size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
|
||||
search: debouncedSearchTerm,
|
||||
searchTerm: debouncedSearchTerm,
|
||||
KYCStatus: kyc,
|
||||
country_xid: country,
|
||||
},
|
||||
@@ -127,13 +127,13 @@ const UnbanInvestor = () => {
|
||||
const filteredData = data?.data?.rows?.filter((item) => {
|
||||
// Filter by name (case insensitive)
|
||||
const name = item?.clientReference_id;
|
||||
const searchLower = searchTerm.toLowerCase();
|
||||
const searchLower = searchTerm?.toLowerCase();
|
||||
const nameMatches = name?.toLowerCase().includes(searchLower);
|
||||
|
||||
return nameMatches;
|
||||
});
|
||||
|
||||
const extractedArray = filteredData?.map((item, index) => ({
|
||||
const extractedArray = data?.data?.rows?.map((item, index) => ({
|
||||
id: item?.id,
|
||||
"Sr N/O": (
|
||||
<Text
|
||||
|
||||
@@ -198,7 +198,7 @@ const InvestmentDocuments = ({
|
||||
>
|
||||
<DrawerOverlay />
|
||||
<DrawerContent>
|
||||
<DrawerCloseButton />
|
||||
<DrawerCloseButton onClick={handleClose} />
|
||||
<DrawerHeader fontSize="sm">Add Investment Documents</DrawerHeader>
|
||||
<Box as="form" onSubmit={handleSubmit(onSubmit)}>
|
||||
<DrawerBody>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useContext, useEffect, useState } from 'react';
|
||||
import React, { useContext, useEffect, useState } from "react";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
@@ -15,29 +15,29 @@ import {
|
||||
Text,
|
||||
useToast,
|
||||
} from "@chakra-ui/react";
|
||||
import { Controller, useForm } from 'react-hook-form';
|
||||
import * as yup from 'yup';
|
||||
import { yupResolver } from '@hookform/resolvers/yup';
|
||||
import GlobalStateContext from '../../../../Contexts/GlobalStateContext';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useAmountIvestmentMutation } from '../../../../Services/io.service';
|
||||
import ToastBox from '../../../../Components/ToastBox';
|
||||
import CurrencyInput from '../../../../Components/CurrencyInput';
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
import * as yup from "yup";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { useAmountIvestmentMutation } from "../../../../Services/io.service";
|
||||
import ToastBox from "../../../../Components/ToastBox";
|
||||
import CurrencyInput from "../../../../Components/CurrencyInput";
|
||||
|
||||
// Validation schema
|
||||
const validationSchema = yup.object().shape({
|
||||
transactionDate: yup.date().required('Date is required'),
|
||||
Total_Amount: yup.number().required('Amount is required'),
|
||||
amountInvested: yup.number().required('Amount to invest is required'),
|
||||
IoCash: yup.number().positive('IO Cash must be positive').required('IO Cash is required'),
|
||||
transactionDate: yup.date().required("Date is required"),
|
||||
Total_Amount: yup.number().required("Amount is required"),
|
||||
amountInvested: yup.number().required("Amount to invest is required"),
|
||||
IoCash: yup.number().positive("IO Cash must be positive").required("IO Cash is required"),
|
||||
});
|
||||
|
||||
// Function to format currency
|
||||
const formatCurrency = (value) => {
|
||||
if (isNaN(value)) return '';
|
||||
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, ',');
|
||||
const [integer, decimal] = formatted.split(".");
|
||||
const formattedInteger = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
return decimal ? `${formattedInteger}.${decimal}` : formattedInteger;
|
||||
};
|
||||
|
||||
@@ -45,18 +45,24 @@ const AmountInvested = ({ isOpen, onClose }) => {
|
||||
const params = useParams();
|
||||
const toast = useToast();
|
||||
const id = params?.id;
|
||||
const { control, register, handleSubmit, reset, watch, formState: { errors } } = useForm({
|
||||
const {
|
||||
control,
|
||||
register,
|
||||
handleSubmit,
|
||||
reset,
|
||||
watch,
|
||||
formState: { errors },
|
||||
} = useForm({
|
||||
resolver: yupResolver(validationSchema),
|
||||
});
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const { IODetails } = useContext(GlobalStateContext);
|
||||
const [amountInvested] = useAmountIvestmentMutation();
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (IODetails?.totalAmtInvestmentInUSD) {
|
||||
const totalAmount = parseFloat(IODetails.totalAmtInvestmentInUSD);
|
||||
const ioCashUpdate = parseFloat(IODetails.totalAmtInvestmentInUSD)
|
||||
const ioCashUpdate = parseFloat(IODetails.totalAmtInvestmentInUSD);
|
||||
reset({
|
||||
Total_Amount: totalAmount,
|
||||
IoCash: ioCashUpdate,
|
||||
@@ -92,58 +98,84 @@ const AmountInvested = ({ isOpen, onClose }) => {
|
||||
|
||||
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 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 (
|
||||
<Modal isOpen={isOpen} onClose={onClose}>
|
||||
<ModalOverlay />
|
||||
<ModalContent>
|
||||
<ModalHeader fontSize={'md'}>Amount Invested</ModalHeader>
|
||||
<ModalHeader fontSize={"md"}>Amount Invested</ModalHeader>
|
||||
<ModalCloseButton />
|
||||
<ModalBody>
|
||||
<form onSubmit={handleSubmit(onSubmit)}>
|
||||
<FormControl mb={"15px"} isInvalid={!!errors.transactionDate} isRequired>
|
||||
<FormControl
|
||||
mb={"15px"}
|
||||
isInvalid={!!errors.transactionDate}
|
||||
isRequired
|
||||
>
|
||||
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>
|
||||
Date
|
||||
</FormLabel>
|
||||
<Input
|
||||
type="date"
|
||||
{...register('transactionDate')}
|
||||
{...register("transactionDate")}
|
||||
size="sm"
|
||||
rounded={'sm'}
|
||||
rounded={"sm"}
|
||||
fontSize={"sm"}
|
||||
focusBorderColor="forestGreen.300"
|
||||
/>
|
||||
{errors.transactionDate && <Text fontSize={'xs'} fontWeight={600} color="red.500">{errors.transactionDate.message}</Text>}
|
||||
{errors.transactionDate && (
|
||||
<Text fontSize={"xs"} fontWeight={600} color="red.500">
|
||||
{errors.transactionDate.message}
|
||||
</Text>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
<FormControl mb={"15px"} isInvalid={!!errors.Total_Amount} isReadOnly>
|
||||
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>Amount</FormLabel>
|
||||
<FormControl
|
||||
mb={"15px"}
|
||||
isInvalid={!!errors.Total_Amount}
|
||||
isReadOnly
|
||||
>
|
||||
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>
|
||||
Amount
|
||||
</FormLabel>
|
||||
<Input
|
||||
type="text"
|
||||
value={formatCurrency(watch('Total_Amount'))}
|
||||
value={formatCurrency(watch("Total_Amount"))}
|
||||
size="sm"
|
||||
rounded={'sm'}
|
||||
textAlign={'end'}
|
||||
rounded={"sm"}
|
||||
textAlign={"end"}
|
||||
focusBorderColor="forestGreen.300"
|
||||
fontSize={"sm"}
|
||||
readOnly
|
||||
/>
|
||||
{errors.Total_Amount && <Text fontSize={'xs'} fontWeight={600} color="red.500">{errors.Total_Amount.message}</Text>}
|
||||
{errors.Total_Amount && (
|
||||
<Text fontSize={"xs"} fontWeight={600} color="red.500">
|
||||
{errors.Total_Amount.message}
|
||||
</Text>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
<FormControl mb={"15px"} isInvalid={!!errors.amountInvested} isRequired>
|
||||
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>Amount to invest</FormLabel>
|
||||
<FormControl
|
||||
mb={"15px"}
|
||||
isInvalid={!!errors.amountInvested}
|
||||
isRequired
|
||||
>
|
||||
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>
|
||||
Amount to invest
|
||||
</FormLabel>
|
||||
{/* <Input
|
||||
type="number"
|
||||
{...register('amountInvested')}
|
||||
@@ -155,23 +187,27 @@ const AmountInvested = ({ isOpen, onClose }) => {
|
||||
onChange={handleAmountChange}
|
||||
/> */}
|
||||
<Controller
|
||||
name="amountInvested"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<CurrencyInput
|
||||
{...field}
|
||||
textAlign={'right'}
|
||||
fontSize={"sm"}
|
||||
type="number"
|
||||
size={"sm"}
|
||||
onChange={(value) => {
|
||||
field.onChange(value); // This will keep the form's internal state updated
|
||||
handleAmountChange(value); // This will trigger your custom logic
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
{errors.amountInvested && <Text fontSize={'xs'} fontWeight={600} color="red.500">{errors.amountInvested.message}</Text>}
|
||||
name="amountInvested"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<CurrencyInput
|
||||
{...field}
|
||||
textAlign={"right"}
|
||||
fontSize={"sm"}
|
||||
type="number"
|
||||
size={"sm"}
|
||||
onChange={(value) => {
|
||||
field.onChange(value); // This will keep the form's internal state updated
|
||||
handleAmountChange(value); // This will trigger your custom logic
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
{errors.amountInvested && (
|
||||
<Text fontSize={"xs"} fontWeight={600} color="red.500">
|
||||
{errors.amountInvested.message}
|
||||
</Text>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
<FormControl mb={"15px"} isInvalid={!!errors.IoCash}>
|
||||
@@ -180,15 +216,19 @@ const AmountInvested = ({ isOpen, onClose }) => {
|
||||
</FormLabel>
|
||||
<Input
|
||||
type="text"
|
||||
value={formatCurrency(watch('IoCash'))}
|
||||
value={formatCurrency(watch("IoCash"))}
|
||||
size="sm"
|
||||
rounded={'sm'}
|
||||
rounded={"sm"}
|
||||
focusBorderColor="forestGreen.300"
|
||||
fontSize={"sm"}
|
||||
textAlign={'right'}
|
||||
textAlign={"right"}
|
||||
readOnly
|
||||
/>
|
||||
{errors.IoCash && <Text fontSize={'xs'} fontWeight={600} color="red.500">{errors.IoCash.message}</Text>}
|
||||
{errors.IoCash && (
|
||||
<Text fontSize={"xs"} fontWeight={600} color="red.500">
|
||||
{errors.IoCash.message}
|
||||
</Text>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
<ModalFooter>
|
||||
@@ -200,15 +240,13 @@ const AmountInvested = ({ isOpen, onClose }) => {
|
||||
_hover={{
|
||||
bg: "hsl(139deg 98.99% 26.59%)",
|
||||
}}
|
||||
size={'sm'}
|
||||
size={"sm"}
|
||||
rounded={"sm"}
|
||||
isLoading={isLoading}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
<Button
|
||||
size={'sm'}
|
||||
rounded={"sm"} mr={3} onClick={onClose}>
|
||||
<Button size={"sm"} rounded={"sm"} mr={3} onClick={onClose}>
|
||||
Close
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
FormControl,
|
||||
FormLabel,
|
||||
Heading,
|
||||
HStack,
|
||||
Input,
|
||||
Modal,
|
||||
ModalBody,
|
||||
@@ -22,10 +23,6 @@ import React, { useEffect, useState } from "react";
|
||||
import * as yup from "yup";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
import {
|
||||
useGetDepositRequestByIdQuery,
|
||||
useUpdateDepositRequestMutation,
|
||||
} from "../../../Services/deposit.request.service";
|
||||
import FullscreenLoaders from "../../../Components/Loaders/FullscreenLoaders";
|
||||
import ToastBox from "../../../Components/ToastBox";
|
||||
import {
|
||||
@@ -33,6 +30,7 @@ import {
|
||||
useUpdateDrawalRequestMutation,
|
||||
} from "../../../Services/drawal.request.service";
|
||||
import CurrencyInput from "../../../Components/CurrencyInput";
|
||||
import { GrClose } from "react-icons/gr";
|
||||
|
||||
const FILE_TYPES = ["image/jpeg", "image/png", "image/gif"];
|
||||
|
||||
@@ -131,8 +129,13 @@ const DrawalRequestApprove = ({
|
||||
<ModalOverlay />
|
||||
|
||||
<ModalContent pb={4}>
|
||||
<ModalHeader fontSize={"md"}>Confirm</ModalHeader>
|
||||
<ModalCloseButton />
|
||||
<HStack justifyContent={"space-between"}>
|
||||
<ModalHeader fontSize={"md"}>Confirm</ModalHeader>
|
||||
<Button onClick={onClose} bg={"transparent"} _hover={{backgroundColor:"transparent"}}>
|
||||
<GrClose />
|
||||
</Button>
|
||||
</HStack>
|
||||
{/* <ModalCloseButton /> */}
|
||||
{isLoading ? (
|
||||
<FullscreenLoaders height={"50vh"} />
|
||||
) : (
|
||||
|
||||
@@ -17,12 +17,12 @@ export const banInvestorDetails = createApi({
|
||||
query: () => `/investorDetails/admin`,
|
||||
providesTags: ["getBanInvestor"],
|
||||
}),
|
||||
|
||||
|
||||
|
||||
getUnbanInvestor: builder.query({
|
||||
query: ({ page, size, search, userStatus, KYCStatus, country_xid }) => {
|
||||
query: ({ page, size, searchTerm, userStatus, KYCStatus, country_xid }) => {
|
||||
// Start with the base URL, including searchTerm
|
||||
let baseURL = `/investorDetails/admin/getAllUnbanned?search=${search || ""}&userStatus=${userStatus ||""}&KYCStatus=${KYCStatus || ""}&country_xid=${country_xid||""}`;
|
||||
let baseURL = `/investorDetails/admin/getAllUnbanned?search=${searchTerm || ""}&userStatus=${userStatus ||""}&KYCStatus=${KYCStatus || ""}&country_xid=${country_xid||""}`;
|
||||
|
||||
// Conditionally append kycStatus if it's defined
|
||||
if (KYCStatus) {
|
||||
|
||||
Reference in New Issue
Block a user