drawal request ui
This commit is contained in:
@@ -3,7 +3,7 @@ import React, { useState } from "react";
|
||||
import GlobalStateContext from "./GlobalStateContext";
|
||||
import { effect, useColorMode } from "@chakra-ui/react";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { TbClock2 } from "react-icons/tb";
|
||||
import { TbClock2 } from "react-icons/tb";
|
||||
import { CiWallet } from "react-icons/ci";
|
||||
import { HiOutlineReceiptPercent } from "react-icons/hi2";
|
||||
import { IoMdQrScanner } from "react-icons/io";
|
||||
@@ -519,7 +519,7 @@ const GlobalStateProvider = ({ children }) => {
|
||||
rate: 2.66,
|
||||
},
|
||||
]);
|
||||
const [InvestorDetails, setInvestorDetails] = useState([
|
||||
const [InvestorDetails, setInvestorDetails] = useState([
|
||||
{
|
||||
id: 1,
|
||||
clientId: "SA00000001",
|
||||
@@ -530,7 +530,7 @@ const GlobalStateProvider = ({ children }) => {
|
||||
phoneNumber: "8940035906",
|
||||
address: "Saudi Arabia",
|
||||
emailID: "john@gmail.com",
|
||||
InvestorType:"Retail",
|
||||
InvestorType: "Retail",
|
||||
bankName: "Lorem Text",
|
||||
branchAddress: "Hohenzollernring 58, 95444",
|
||||
iban: "DE 1234 5678 9012 3456",
|
||||
@@ -549,7 +549,7 @@ const GlobalStateProvider = ({ children }) => {
|
||||
phoneNumber: "8940035906",
|
||||
address: "Saudi Arabia",
|
||||
emailID: "john@gmail.com",
|
||||
InvestorType:"Accredited Investors",
|
||||
InvestorType: "Accredited Investors",
|
||||
bankName: "Lorem Text",
|
||||
branchAddress: "Hohenzollernring 58, 95444",
|
||||
iban: "DE 1234 5678 9012 3456",
|
||||
@@ -568,7 +568,7 @@ const GlobalStateProvider = ({ children }) => {
|
||||
phoneNumber: "8940035906",
|
||||
address: "Saudi Arabia",
|
||||
emailID: "john@gmail.com",
|
||||
InvestorType:"Retail",
|
||||
InvestorType: "Retail",
|
||||
bankName: "Lorem Text",
|
||||
branchAddress: "Hohenzollernring 58, 95444",
|
||||
iban: "DE 1234 5678 9012 3456",
|
||||
@@ -587,7 +587,7 @@ const GlobalStateProvider = ({ children }) => {
|
||||
phoneNumber: "8940035906",
|
||||
address: "Saudi Arabia",
|
||||
emailID: "john@gmail.com",
|
||||
InvestorType:"Accredited Investors",
|
||||
InvestorType: "Accredited Investors",
|
||||
bankName: "Lorem Text",
|
||||
branchAddress: "Hohenzollernring 58, 95444",
|
||||
iban: "DE 1234 5678 9012 3456",
|
||||
@@ -606,7 +606,7 @@ const GlobalStateProvider = ({ children }) => {
|
||||
phoneNumber: "8940035906",
|
||||
address: "Saudi Arabia",
|
||||
emailID: "john@gmail.com",
|
||||
InvestorType:"Retail",
|
||||
InvestorType: "Retail",
|
||||
bankName: "Lorem Text",
|
||||
branchAddress: "Hohenzollernring 58, 95444",
|
||||
iban: "DE 1234 5678 9012 3456",
|
||||
@@ -625,7 +625,7 @@ const GlobalStateProvider = ({ children }) => {
|
||||
phoneNumber: "8940035906",
|
||||
address: "Saudi Arabia",
|
||||
emailID: "john@gmail.com",
|
||||
InvestorType:"Accredited Investors",
|
||||
InvestorType: "Accredited Investors",
|
||||
bankName: "Lorem Text",
|
||||
branchAddress: "Hohenzollernring 58, 95444",
|
||||
iban: "DE 1234 5678 9012 3456",
|
||||
@@ -644,7 +644,7 @@ const GlobalStateProvider = ({ children }) => {
|
||||
phoneNumber: "8940035906",
|
||||
address: "Saudi Arabia",
|
||||
emailID: "john@gmail.com",
|
||||
InvestorType:"Retail",
|
||||
InvestorType: "Retail",
|
||||
bankName: "Lorem Text",
|
||||
branchAddress: "Hohenzollernring 58, 95444",
|
||||
iban: "DE 1234 5678 9012 3456",
|
||||
@@ -663,7 +663,7 @@ const GlobalStateProvider = ({ children }) => {
|
||||
phoneNumber: "8940035906",
|
||||
address: "Saudi Arabia",
|
||||
emailID: "john@gmail.com",
|
||||
InvestorType:"Accredited Investors",
|
||||
InvestorType: "Accredited Investors",
|
||||
bankName: "Lorem Text",
|
||||
branchAddress: "Hohenzollernring 58, 95444",
|
||||
iban: "DE 1234 5678 9012 3456",
|
||||
@@ -682,7 +682,7 @@ const GlobalStateProvider = ({ children }) => {
|
||||
phoneNumber: "8940035906",
|
||||
address: "Saudi Arabia",
|
||||
emailID: "john@gmail.com",
|
||||
InvestorType:"Retail",
|
||||
InvestorType: "Retail",
|
||||
bankName: "Lorem Text",
|
||||
branchAddress: "Hohenzollernring 58, 95444",
|
||||
iban: "DE 1234 5678 9012 3456",
|
||||
@@ -701,7 +701,7 @@ const GlobalStateProvider = ({ children }) => {
|
||||
phoneNumber: "8940035906",
|
||||
address: "Saudi Arabia",
|
||||
emailID: "john@gmail.com",
|
||||
InvestorType:"Accredited Investors",
|
||||
InvestorType: "Accredited Investors",
|
||||
bankName: "Lorem Text",
|
||||
branchAddress: "Hohenzollernring 58, 95444",
|
||||
iban: "DE 1234 5678 9012 3456",
|
||||
@@ -712,107 +712,8 @@ const GlobalStateProvider = ({ children }) => {
|
||||
},
|
||||
]);
|
||||
|
||||
const [viewInvestor, setViewInvestor] = useState([
|
||||
|
||||
]);
|
||||
const [transaction, setTransaction] = useState([
|
||||
{
|
||||
id: 1,
|
||||
date: "2-Jan-24",
|
||||
transaction: "Deposit",
|
||||
currency: "BHD",
|
||||
amount: "12000.00",
|
||||
fromUSD: "",
|
||||
toUSD: "2.6376",
|
||||
USDamount: "31,651.20",
|
||||
IOName:"",
|
||||
paymentMethod:"Bank"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
date: "6-Jan-24",
|
||||
transaction: "Invested",
|
||||
currency: "BHD",
|
||||
amount: "-4000.00",
|
||||
fromUSD: "",
|
||||
toUSD: "2.6376",
|
||||
USDamount: "-10,550.40",
|
||||
IOName:"KKR Private Equity Fund",
|
||||
paymentMethod:"-"
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
date: "7-Jan-24",
|
||||
transaction: "Deposit",
|
||||
currency: "BHD",
|
||||
amount: "4000.00",
|
||||
fromUSD: "",
|
||||
toUSD: "2.6376",
|
||||
USDamount: "10,550.40",
|
||||
IOName:"-",
|
||||
paymentMethod:"Apple Pay"
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
date: "8-Jan-24",
|
||||
transaction: "Invested",
|
||||
currency: "BHD",
|
||||
amount: "-3000.00",
|
||||
fromUSD: "",
|
||||
toUSD: "2.6376",
|
||||
USDamount: "-7,912.80",
|
||||
IOName:"Black Stone Real Estate Income Trust",
|
||||
paymentMethod:"-"
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
date: "2-Jan-24",
|
||||
transaction: "Deposit",
|
||||
currency: "BHD",
|
||||
amount: "12000.00",
|
||||
fromUSD: "0.3747",
|
||||
toUSD: "",
|
||||
USDamount: "31,651.20",
|
||||
IOName:"KKR Private Equity Fund",
|
||||
paymentMethod:"-"
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
date: "2-Jan-24",
|
||||
transaction: "Deposit",
|
||||
currency: "BHD",
|
||||
amount: "12000.00",
|
||||
fromUSD: "0.3747",
|
||||
toUSD: "",
|
||||
USDamount: "31,651.20",
|
||||
IOName:"Black Stone Real Estate Income Trust",
|
||||
paymentMethod:"-"
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
date: "2-Jan-24",
|
||||
transaction: "Deposit",
|
||||
currency: "BHD",
|
||||
amount: "12000.00",
|
||||
fromUSD: "0.3747",
|
||||
toUSD: "",
|
||||
USDamount: "31,651.20",
|
||||
IOName:"KKR Private Equity Fund",
|
||||
paymentMethod:"-"
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
date: "2-Jan-24",
|
||||
transaction: "Deposit",
|
||||
currency: "BHD",
|
||||
amount: "12000.00",
|
||||
fromUSD: "",
|
||||
toUSD: "2.6376",
|
||||
USDamount: "31,651.20",
|
||||
IOName:"",
|
||||
paymentMethod:"Bank"
|
||||
},
|
||||
]);
|
||||
const [viewInvestor, setViewInvestor] = useState([]);
|
||||
const [transaction, setTransaction] = useState([]);
|
||||
|
||||
const [investorTransaction, setInvestorTransaction] = useState([
|
||||
{
|
||||
@@ -1420,7 +1321,6 @@ const GlobalStateProvider = ({ children }) => {
|
||||
},
|
||||
]);
|
||||
|
||||
|
||||
const [depositRequest, setDepositRequest] = useState([
|
||||
{
|
||||
id: 1,
|
||||
@@ -1693,16 +1593,11 @@ const GlobalStateProvider = ({ children }) => {
|
||||
},
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const [InvestorWallet, setInvestorWallet] = useState(null);
|
||||
|
||||
// ==============[ prod state ]===============================
|
||||
const [IODetails, setIODetails] = useState(null);
|
||||
const [ isIOloading, setIOloading ] = useState(false)
|
||||
const [isIOloading, setIOloading] = useState(false);
|
||||
|
||||
return (
|
||||
<GlobalStateContext.Provider
|
||||
@@ -1775,10 +1670,12 @@ const GlobalStateProvider = ({ children }) => {
|
||||
setAcademicDocuments,
|
||||
iOArtifactsTwo,
|
||||
setIOArtifactsTwo,
|
||||
|
||||
|
||||
isIOloading,
|
||||
setIOloading
|
||||
InvestorWallet,
|
||||
setInvestorWallet,
|
||||
|
||||
isIOloading,
|
||||
setIOloading,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -16,7 +16,7 @@ import { Link, Link as RouterLink, useNavigate } from "react-router-dom";
|
||||
import {
|
||||
AddIcon,
|
||||
CheckIcon,
|
||||
CloseIcon,
|
||||
CloseIcon,
|
||||
DeleteIcon,
|
||||
EditIcon,
|
||||
ViewIcon,
|
||||
@@ -81,7 +81,7 @@ const DepositRequest = () => {
|
||||
"Country",
|
||||
"Phone Number",
|
||||
"Amount in Investor currency",
|
||||
"Deposit Date",
|
||||
"Deposit Date",
|
||||
"Action",
|
||||
];
|
||||
|
||||
@@ -335,7 +335,7 @@ const DepositRequest = () => {
|
||||
<DepositRequestReject
|
||||
isOpen={isRejectOpen}
|
||||
onClose={onRejectClose}
|
||||
id={actionId}
|
||||
id={actionId}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -85,7 +85,7 @@ const InvestorDetails = () => {
|
||||
"Client ID",
|
||||
"First Name",
|
||||
"Last Name",
|
||||
"Country",
|
||||
"Country",
|
||||
"Phone Number",
|
||||
"E-mail ID",
|
||||
"Investor Type",
|
||||
@@ -152,7 +152,7 @@ const InvestorDetails = () => {
|
||||
</Box>
|
||||
),
|
||||
"Last Name": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Box w={"70px"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item?.principal?.lastName}
|
||||
</Text>
|
||||
|
||||
@@ -19,13 +19,19 @@ import FormInputView from "../../../Components/FormInputView";
|
||||
import ViewInvestorDetails from "./ViewInvestorDetails";
|
||||
import { LuWallet } from "react-icons/lu";
|
||||
import Transaction from "./Transaction";
|
||||
import FullscreenLoaders from '../../../Components/Loaders/FullscreenLoaders'
|
||||
import FullscreenLoaders from "../../../Components/Loaders/FullscreenLoaders";
|
||||
import { useGetInvestorsDetailsByIdQuery } from "../../../Services/investor.details.service";
|
||||
|
||||
const ProfileView = () => {
|
||||
const navigate = useNavigate();
|
||||
const params = useParams();
|
||||
const { InvestorDetails,setViewInvestor } = useContext(GlobalStateContext);
|
||||
const {
|
||||
InvestorDetails,
|
||||
setViewInvestor,
|
||||
setTransaction,
|
||||
InvestorWallet,
|
||||
setInvestorWallet,
|
||||
} = useContext(GlobalStateContext);
|
||||
const { reset } = useForm(); // assuming react-hook-form
|
||||
|
||||
const id = params?.id;
|
||||
@@ -34,22 +40,18 @@ const ProfileView = () => {
|
||||
skip: !id,
|
||||
});
|
||||
|
||||
|
||||
const foundObject = data?.data;
|
||||
|
||||
useEffect(()=>{
|
||||
setViewInvestor(data?.data?.protfolio)
|
||||
},[data])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
setViewInvestor(data?.data?.portfolio);
|
||||
setTransaction(data?.data?.transaction);
|
||||
setInvestorWallet(data?.data.wallet);
|
||||
}, [data]);
|
||||
|
||||
const formFields = [
|
||||
{
|
||||
label: "Client ID",
|
||||
value: foundObject?.id,
|
||||
value: foundObject?.clientReference_id,
|
||||
type: "text",
|
||||
isRequired: true,
|
||||
section: "Personal Details",
|
||||
@@ -57,7 +59,7 @@ const ProfileView = () => {
|
||||
},
|
||||
{
|
||||
label: "First Name",
|
||||
value: foundObject?.principal?.firstName,
|
||||
value: foundObject?.firstName,
|
||||
type: "text",
|
||||
isRequired: true,
|
||||
section: "Personal Details",
|
||||
@@ -66,7 +68,7 @@ const ProfileView = () => {
|
||||
|
||||
{
|
||||
label: "Last Name",
|
||||
value: foundObject?.principal?.lastName,
|
||||
value: foundObject?.lastName,
|
||||
type: "text",
|
||||
isRequired: true,
|
||||
section: "Personal Details",
|
||||
@@ -74,7 +76,7 @@ const ProfileView = () => {
|
||||
},
|
||||
{
|
||||
label: "E-mail ID",
|
||||
value: foundObject?.principal?.emailAddress,
|
||||
value: foundObject?.emailAddress,
|
||||
type: "text",
|
||||
isRequired: true,
|
||||
section: "Personal Details",
|
||||
@@ -82,7 +84,7 @@ const ProfileView = () => {
|
||||
},
|
||||
{
|
||||
label: "Phone Number",
|
||||
value: foundObject?.principal?.mobileNumber,
|
||||
value: foundObject?.mobileNumber,
|
||||
type: "tel",
|
||||
isRequired: true,
|
||||
section: "Personal Details",
|
||||
@@ -90,7 +92,7 @@ const ProfileView = () => {
|
||||
},
|
||||
{
|
||||
label: "Country",
|
||||
value: foundObject?.country?.countryName,
|
||||
value: foundObject?.country,
|
||||
type: "text",
|
||||
isRequired: true,
|
||||
section: "Personal Details",
|
||||
@@ -98,7 +100,7 @@ const ProfileView = () => {
|
||||
},
|
||||
{
|
||||
label: "Investment type",
|
||||
value: foundObject?.investor_type?.investorTypeName,
|
||||
value: foundObject?.investorTypeName,
|
||||
type: "text",
|
||||
isRequired: true,
|
||||
section: "Personal Details",
|
||||
@@ -114,7 +116,7 @@ const ProfileView = () => {
|
||||
},
|
||||
{
|
||||
label: "KYC Status",
|
||||
value: foundObject?.KYCStatus ? "Completed" : "Not complete",
|
||||
value: foundObject?.KYCStatus ? "Completed" : "Not complete",
|
||||
type: "text",
|
||||
isRequired: true,
|
||||
section: "Personal Details",
|
||||
@@ -130,7 +132,7 @@ const ProfileView = () => {
|
||||
},
|
||||
{
|
||||
label: "Default language",
|
||||
value: foundObject?.defaultLanguage_xid === 1 ? "English" : "Arabic" ,
|
||||
value: foundObject?.defaultLanguage_xid === 1 ? "English" : "Arabic",
|
||||
type: "text",
|
||||
isRequired: true,
|
||||
section: "Personal Details",
|
||||
@@ -138,7 +140,7 @@ const ProfileView = () => {
|
||||
},
|
||||
{
|
||||
label: "App Notification",
|
||||
value: foundObject?.IsAppNotificationEnabled === 1 ? "Yes" : "No" ,
|
||||
value: foundObject?.IsAppNotificationEnabled === 1 ? "Yes" : "No",
|
||||
type: "text",
|
||||
isRequired: true,
|
||||
section: "Personal Details",
|
||||
@@ -155,8 +157,9 @@ const ProfileView = () => {
|
||||
return groups;
|
||||
}, {});
|
||||
|
||||
return (
|
||||
isLoading? <FullscreenLoaders />:
|
||||
return isLoading ? (
|
||||
<FullscreenLoaders />
|
||||
) : (
|
||||
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"} pb={14}>
|
||||
<Box
|
||||
pt={2}
|
||||
@@ -181,7 +184,7 @@ const ProfileView = () => {
|
||||
as="span"
|
||||
boxShadow={"lg"}
|
||||
rounded={"md"}
|
||||
bg={"#EAF2EC"}
|
||||
bg={"#EAF2EC"}
|
||||
>
|
||||
<Icon color={"#004717"} boxSize={8} as={LuWallet} />
|
||||
|
||||
@@ -197,10 +200,10 @@ const ProfileView = () => {
|
||||
display={"flex"}
|
||||
>
|
||||
<Text fontWeight={500} as={"span"}>
|
||||
26,763.40
|
||||
{parseFloat(InvestorWallet?.WalletBalance_InUSD).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
|
||||
</Text>
|
||||
<Badge display={"flex"} alignItems={"center"}>
|
||||
USD
|
||||
{InvestorWallet?.currencyCode_USD}
|
||||
</Badge>
|
||||
</Box>
|
||||
</Box>
|
||||
@@ -217,10 +220,10 @@ const ProfileView = () => {
|
||||
display={"flex"}
|
||||
>
|
||||
<Text fontWeight={500} as={"span"}>
|
||||
10,075.01
|
||||
{parseFloat(InvestorWallet?.WalletBalance_InInvCur).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
|
||||
</Text>
|
||||
<Badge display={"flex"} alignItems={"center"}>
|
||||
BHD
|
||||
{InvestorWallet?.currencyCode_InCur}
|
||||
</Badge>
|
||||
</Box>
|
||||
</Box>
|
||||
@@ -244,7 +247,7 @@ const ProfileView = () => {
|
||||
View Details
|
||||
</Tab>
|
||||
<Tab
|
||||
// isDisabled={true}
|
||||
// isDisabled={true}
|
||||
fontSize={"sm"}
|
||||
_selected={{
|
||||
color: "#004118",
|
||||
@@ -254,7 +257,7 @@ const ProfileView = () => {
|
||||
Portfolio
|
||||
</Tab>
|
||||
<Tab
|
||||
// isDisabled={true}
|
||||
// isDisabled={true}
|
||||
fontSize={"sm"}
|
||||
_selected={{
|
||||
color: "#004118",
|
||||
@@ -264,7 +267,7 @@ const ProfileView = () => {
|
||||
Transaction
|
||||
</Tab>
|
||||
<Tab
|
||||
isDisabled={true}
|
||||
isDisabled={true}
|
||||
fontSize={"sm"}
|
||||
_selected={{
|
||||
color: "#004118",
|
||||
|
||||
@@ -24,15 +24,6 @@ import {
|
||||
import React, { useContext, useEffect, useState } from "react";
|
||||
import { OPACITY_ON_LOAD } from "../../../Layout/animations";
|
||||
import DataTable from "../../../Components/DataTable/DataTable";
|
||||
import { HiDotsVertical } from "react-icons/hi";
|
||||
import { Link, Navigate, Link as RouterLink } from "react-router-dom";
|
||||
import {
|
||||
AddIcon,
|
||||
DeleteIcon,
|
||||
EditIcon,
|
||||
EmailIcon,
|
||||
ViewIcon,
|
||||
} from "@chakra-ui/icons";
|
||||
import Pagination from "../../../Components/Pagination";
|
||||
import GlobalStateContext from "../../../Contexts/GlobalStateContext";
|
||||
import CustomAlertDialog from "../../../Components/CustomAlertDialog";
|
||||
@@ -43,7 +34,7 @@ import {
|
||||
|
||||
const Transaction = () => {
|
||||
const toast = useToast();
|
||||
const { transaction, setTransaction, slideFromRight } =
|
||||
const { transaction, setTransaction, slideFromRight, InvestorWallet, } =
|
||||
useContext(GlobalStateContext);
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
@@ -76,22 +67,15 @@ import {
|
||||
"Payment Method",
|
||||
];
|
||||
|
||||
const handleUpdateStatus = debounce((id) => {
|
||||
setViewInvestor((prevData) =>
|
||||
prevData.map((transaction) =>
|
||||
transaction.id === id ? { ...transaction } : transaction
|
||||
)
|
||||
);
|
||||
toast({
|
||||
render: () => <ToastBox message={"Status changed succesfully.!"} />,
|
||||
});
|
||||
}, 300);
|
||||
|
||||
console.log(transaction);
|
||||
|
||||
// ====================================================[Table Filter]================================================================
|
||||
const filteredData = transaction?.filter((item) => {
|
||||
// Filter by name (case insensitive)
|
||||
const name = item.date;
|
||||
const searchLower = searchTerm.toLowerCase();
|
||||
console.log(item?.investorTransaction?.transactionName);
|
||||
|
||||
const name = item?.investorTransaction?.transactionName;
|
||||
const searchLower = searchTerm?.toLowerCase();
|
||||
const nameMatches = name?.toLowerCase().includes(searchLower);
|
||||
|
||||
// Filter by status
|
||||
@@ -105,6 +89,9 @@ import {
|
||||
|
||||
return nameMatches;
|
||||
});
|
||||
|
||||
console.log(filteredData);
|
||||
|
||||
|
||||
const extractedArray = filteredData?.map((item) => ({
|
||||
id: item?.id,
|
||||
@@ -121,63 +108,63 @@ import {
|
||||
"Date": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item.date}
|
||||
{item.transactionDate}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Transaction": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item.transaction}
|
||||
{item.investorTransaction?.transactionName}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Currency": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item.currency}
|
||||
{item.investorCurrency}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Amount": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item.amount}
|
||||
{item.investorAmount}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"From USD": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item.fromUSD}
|
||||
{item.USDToInvCur_Rate}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"TO USD": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item.toUSD}
|
||||
{item.invCurToUSD_Rate}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"USD amount": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item.USDamount}
|
||||
{item.USDAmount}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"IO Name": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item.IOName}
|
||||
{item.io && item.io?.investmentNameEnglish}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Payment Method": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item.paymentMethod}
|
||||
{item.paymentMethod && item.paymentMethod?.paymentMethodName}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
@@ -254,12 +241,12 @@ import {
|
||||
wordBreak="normal"
|
||||
overflowWrap="normal"
|
||||
>
|
||||
10,075.01
|
||||
{parseFloat(InvestorWallet?.WalletBalance_InUSD).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
|
||||
</Th>
|
||||
<Th
|
||||
textAlign={"center"}
|
||||
p={3}
|
||||
width="60px"
|
||||
width="50px"
|
||||
color={"#004118"}
|
||||
whiteSpace="normal"
|
||||
wordBreak="normal"
|
||||
@@ -270,7 +257,7 @@ import {
|
||||
<Th
|
||||
textAlign={"center"}
|
||||
p={3}
|
||||
width="60px"
|
||||
width="50px"
|
||||
color={"#004118"}
|
||||
whiteSpace="normal"
|
||||
wordBreak="normal"
|
||||
@@ -287,12 +274,12 @@ import {
|
||||
wordBreak="normal"
|
||||
overflowWrap="normal"
|
||||
>
|
||||
26,763.40
|
||||
{parseFloat(InvestorWallet?.WalletBalance_InInvCur).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
|
||||
</Th>
|
||||
<Th
|
||||
textAlign={"center"}
|
||||
p={3}
|
||||
width="120px"
|
||||
width="130px"
|
||||
color={"#004118"}
|
||||
whiteSpace="normal"
|
||||
wordBreak="normal"
|
||||
@@ -303,7 +290,7 @@ import {
|
||||
<Th
|
||||
textAlign={"center"}
|
||||
p={3}
|
||||
width="120px"
|
||||
width="130px"
|
||||
color={"#004118"}
|
||||
whiteSpace="normal"
|
||||
wordBreak="normal"
|
||||
@@ -340,9 +327,9 @@ import {
|
||||
onChange={(e) => setSearchTerm(e.target.value)}
|
||||
/>
|
||||
|
||||
<HStack display={"flex"} alignItems={"center"}>
|
||||
{/* <HStack display={"flex"} alignItems={"center"}>
|
||||
<Pagination totalItems={10} />
|
||||
</HStack>
|
||||
</HStack> */}
|
||||
</HStack>
|
||||
</Box>
|
||||
|
||||
|
||||
@@ -73,8 +73,6 @@ const ViewInvestorDetails = () => {
|
||||
console.log(viewInvestor);
|
||||
|
||||
|
||||
|
||||
|
||||
// ====================================================[Table Filter]================================================================
|
||||
const filteredData = viewInvestor?.filter((item) => {
|
||||
// Filter by name (case insensitive)
|
||||
@@ -222,9 +220,9 @@ console.log(viewInvestor);
|
||||
onChange={(e) => setSearchTerm(e.target.value)}
|
||||
/>
|
||||
|
||||
<HStack display={"flex"} alignItems={"center"}>
|
||||
{/* <HStack display={"flex"} alignItems={"center"}>
|
||||
<Pagination totalItems={10} />
|
||||
</HStack>
|
||||
</HStack> */}
|
||||
</HStack>
|
||||
</Box>
|
||||
|
||||
|
||||
230
src/Pages/WithDrawal/DrawalRequest/DrawalRequestApprove.jsx
Normal file
230
src/Pages/WithDrawal/DrawalRequest/DrawalRequestApprove.jsx
Normal file
@@ -0,0 +1,230 @@
|
||||
import {
|
||||
Badge,
|
||||
Box,
|
||||
Button,
|
||||
FormControl,
|
||||
FormLabel,
|
||||
Heading,
|
||||
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 { useGetDepositRequestByIdQuery, useUpdateDepositRequestMutation } from "../../../Services/deposit.request.service";
|
||||
import FullscreenLoaders from "../../../Components/Loaders/FullscreenLoaders";
|
||||
import ToastBox from "../../../Components/ToastBox";
|
||||
|
||||
const FILE_TYPES = ["image/jpeg", "image/png", "image/gif"];
|
||||
|
||||
export const conformModalSchema = yup.object().shape({
|
||||
investorAmount: yup.string().required("Investor amount is required"),
|
||||
comment: yup.string().notRequired(),
|
||||
});
|
||||
|
||||
const DrawalRequestApprove = ({ isOpen, onClose, firstField, id, data:requestData }) => {
|
||||
const toast = useToast()
|
||||
const [file, setFile] = useState();
|
||||
const [isBtnLoading , setIsBtnLoading] = useState(false)
|
||||
|
||||
const fileredData = requestData?.find((item)=> item?.id === id)
|
||||
console.log(fileredData);
|
||||
|
||||
|
||||
|
||||
const [ updateDepositRequest ] = useUpdateDepositRequestMutation()
|
||||
|
||||
const {
|
||||
register,
|
||||
reset,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
} = useForm({
|
||||
resolver: yupResolver(conformModalSchema),
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
reset({
|
||||
investorAmount:fileredData?.investorAmount
|
||||
})
|
||||
|
||||
|
||||
}, [requestData, id])
|
||||
|
||||
const onSubmit = async(data) => {
|
||||
setIsBtnLoading(true)
|
||||
const formData = new FormData();
|
||||
|
||||
formData.append("investorAmount", data.investorAmount);
|
||||
formData.append("comment", data.comment);
|
||||
const file = data.supporting_FileName["0"];
|
||||
formData.append("supporting_FileName", file);
|
||||
|
||||
|
||||
try {
|
||||
const res = await updateDepositRequest({ id ,data: formData})
|
||||
|
||||
|
||||
if (res?.error) {
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox message={res?.error?.data?.message} status={"error"} />
|
||||
),
|
||||
});
|
||||
setIsBtnLoading(false)
|
||||
}else if(res?.data?.statusCode === 200) {
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox message={res?.data?.message} />
|
||||
),
|
||||
});
|
||||
setIsBtnLoading(false)
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
|
||||
heandleOnClose();
|
||||
};
|
||||
|
||||
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 (
|
||||
<Modal isOpen={isOpen} onClose={heandleOnClose} initialFocusRef={firstField}>
|
||||
<ModalOverlay />
|
||||
|
||||
<ModalContent pb={4}>
|
||||
<ModalHeader fontSize={"md"}>Confirm</ModalHeader>
|
||||
<ModalCloseButton />
|
||||
{isLoading ? (
|
||||
<FullscreenLoaders height={"50vh"} />
|
||||
) : (
|
||||
<Box as="form" onSubmit={handleSubmit(onSubmit)}>
|
||||
<ModalBody>
|
||||
<FormControl mb={5} isRequired>
|
||||
<FormLabel fontSize="sm">Withdrawal Amount (SAR)<Badge colorScheme="green">{fileredData?.currencyCode}</Badge></FormLabel>
|
||||
<Input
|
||||
focusBorderColor="green.400"
|
||||
name="investorAmount"
|
||||
{...register("investorAmount")}
|
||||
fontSize="sm"
|
||||
type="number"
|
||||
size="sm"
|
||||
placeholder={"100,000"}
|
||||
textAlign={"right"}
|
||||
// readOnly
|
||||
/>
|
||||
{errors.investorAmount && (
|
||||
<Text fontSize="xs" color="red">
|
||||
{errors.investorAmount.message}
|
||||
</Text>
|
||||
)}
|
||||
</FormControl>
|
||||
<Heading fontSize="sm" fontWeight={600} mb={4}>Investor Account Details</Heading>
|
||||
<Box display={"flex"} mb={3}>
|
||||
<Text fontSize="xs" mb={0} fontWeight={500} me={2}>Account Name:</Text>
|
||||
<Text fontSize="xs" mb={0}>John David</Text>
|
||||
</Box>
|
||||
<Box display={"flex"} mb={3}>
|
||||
<Text fontSize="xs" mb={0} fontWeight={500} me={2}>Account No:</Text>
|
||||
<Text fontSize="xs" mb={0}>100000345779</Text>
|
||||
</Box>
|
||||
<Box display={"flex"} mb={3}>
|
||||
<Text fontSize="xs" mb={0} fontWeight={500} me={2}>IBAN:</Text>
|
||||
<Text fontSize="xs" mb={0}>BH 23 BBKU 00200 00048 0779</Text>
|
||||
</Box>
|
||||
<Box display={"flex"} mb={3}>
|
||||
<Text fontSize="xs" mb={0} fontWeight={500} me={2}>SWIFT Code:</Text>
|
||||
<Text fontSize="xs" mb={0}>BBKUBHBM</Text>
|
||||
</Box>
|
||||
<Box display={"flex"} mb={3}>
|
||||
<Text fontSize="xs" mb={0} fontWeight={500} me={2}>Bank Name:</Text>
|
||||
<Text fontSize="xs" mb={0}>Bank of Bahrain and Kuwait B.S.C</Text>
|
||||
</Box>
|
||||
<Box display={"flex"} mb={5}>
|
||||
<Text fontSize="xs" mb={0} fontWeight={500} me={2}>Bank Address:</Text>
|
||||
<Text fontSize="xs" mb={0}>43 Government Avenue, Manama, Kingdom of Bahrain</Text>
|
||||
</Box>
|
||||
<FormControl mb={4}>
|
||||
<FormLabel fontSize="sm">Comments</FormLabel>
|
||||
<Textarea
|
||||
rows={5}
|
||||
focusBorderColor="green.400"
|
||||
name="comment"
|
||||
{...register("comment")}
|
||||
fontSize="sm"
|
||||
type="textarea"
|
||||
size="sm"
|
||||
placeholder={"Enter your comments...."}
|
||||
resize={"none"}
|
||||
/>
|
||||
{errors.comment && (
|
||||
<Text fontSize="xs" color="red">
|
||||
{errors.comment.message}
|
||||
</Text>
|
||||
)}
|
||||
</FormControl>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button
|
||||
colorScheme="gray"
|
||||
mr={3}
|
||||
onClick={onClose}
|
||||
size={"sm"}
|
||||
rounded={"sm"}
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
colorScheme="forestGreen"
|
||||
variant="solid"
|
||||
size={"sm"}
|
||||
rounded={"sm"}
|
||||
isLoading={isBtnLoading}
|
||||
type="submit"
|
||||
>
|
||||
Confirm
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</Box>
|
||||
)}
|
||||
</ModalContent>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default DrawalRequestApprove;
|
||||
|
||||
@@ -7,16 +7,18 @@ import {
|
||||
Input,
|
||||
Text,
|
||||
Tooltip,
|
||||
useDisclosure,
|
||||
useToast,
|
||||
} from "@chakra-ui/react";
|
||||
import React, { useContext, useEffect, useState } from "react";
|
||||
import { OPACITY_ON_LOAD } from "../../Layout/animations";
|
||||
import DataTable from "../../Components/DataTable/DataTable";
|
||||
import Pagination from "../../Components/Pagination";
|
||||
import GlobalStateContext from "../../Contexts/GlobalStateContext";
|
||||
import CustomAlertDialog from "../../Components/CustomAlertDialog";
|
||||
import { formatDate } from "../../Components/Functions/UTCConvertor";
|
||||
import { OPACITY_ON_LOAD } from "../../../Layout/animations";
|
||||
import DataTable from "../../../Components/DataTable/DataTable";
|
||||
import Pagination from "../../../Components/Pagination";
|
||||
import GlobalStateContext from "../../../Contexts/GlobalStateContext";
|
||||
import CustomAlertDialog from "../../../Components/CustomAlertDialog";
|
||||
import { formatDate } from "../../../Components/Functions/UTCConvertor";
|
||||
import { CheckIcon, CloseIcon } from "@chakra-ui/icons";
|
||||
import DrawalRequestApprove from "./DrawalRequestApprove";
|
||||
// import { formatDate } from "../../Components/Functions/UTCConvertor";
|
||||
|
||||
const PendingRequest = () => {
|
||||
@@ -30,6 +32,13 @@ const PendingRequest = () => {
|
||||
const [mouseEntered, setMouseEntered] = useState(false);
|
||||
const [mouseEnteredId, setMouseEnteredId] = useState("");
|
||||
|
||||
const {
|
||||
isOpen: isConfirmOpen,
|
||||
onOpen: onConfirmOpen,
|
||||
onClose: onConfirmClose,
|
||||
} = useDisclosure();
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
// Simulate loading
|
||||
const timer = setTimeout(() => {
|
||||
@@ -68,7 +77,7 @@ const PendingRequest = () => {
|
||||
"Last Name",
|
||||
"Country",
|
||||
"Phone Number",
|
||||
"Currency",
|
||||
"Currency",
|
||||
"Withdrawal Amount",
|
||||
"Amount in Investor currency",
|
||||
"Action",
|
||||
@@ -173,6 +182,10 @@ const PendingRequest = () => {
|
||||
placement="left-start"
|
||||
>
|
||||
<Badge
|
||||
onClick={() => {
|
||||
// setActionId(item.id);
|
||||
onConfirmOpen();
|
||||
}}
|
||||
colorScheme="forestGreen"
|
||||
color="green.500"
|
||||
rounded={"sm"}
|
||||
@@ -273,6 +286,13 @@ const PendingRequest = () => {
|
||||
alertHandler={handleDelete}
|
||||
isLoading={isLoading}
|
||||
/>
|
||||
<DrawalRequestApprove
|
||||
// data={data?.data?.rows}
|
||||
isOpen={isConfirmOpen}
|
||||
onClose={onConfirmClose}
|
||||
id={actionId}
|
||||
// firstField={firstField}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
Input,
|
||||
Modal,
|
||||
ModalBody,
|
||||
ModalCloseButton,
|
||||
ModalCloseButton,
|
||||
ModalContent,
|
||||
ModalFooter,
|
||||
ModalHeader,
|
||||
|
||||
@@ -177,16 +177,16 @@ const ViewHistory = () => {
|
||||
</Box>
|
||||
),
|
||||
Status: (
|
||||
<Box w={"70px"} isTruncated={true} cursor={'pointer'}>
|
||||
<Box w={"70px"} isTruncated={true}>
|
||||
<Text
|
||||
onClick={() => {
|
||||
setActionId(item.id);
|
||||
if (item.status === "Approved") {
|
||||
onConfirmOpen();
|
||||
} else {
|
||||
onRejectOpen();
|
||||
}
|
||||
}}
|
||||
// onClick={() => {
|
||||
// setActionId(item.id);
|
||||
// if (item.status === "Approved") {
|
||||
// onConfirmOpen();
|
||||
// } else {
|
||||
// onRejectOpen();
|
||||
// }
|
||||
// }}
|
||||
as={"span"}
|
||||
color={item.status === "Approved" ? "green" : "red"}
|
||||
>
|
||||
|
||||
@@ -23,7 +23,7 @@ import AddSponser from "../Pages/Master/Sponser/AddSponser";
|
||||
import EditSponser from "../Pages/Master/Sponser/EditSponser";
|
||||
import Sponser from "../Pages/Master/Sponser/Sponsers";
|
||||
import ViewSponser from "../Pages/Master/Sponser/ViewSponser";
|
||||
import PendingRequest from "../Pages/WithDrawal/PendingRequest";
|
||||
// import PendingRequest from "../Pages/WithDrawal/PendingRequest";
|
||||
import ViewHistory from "../Pages/WithDrawal/DrawalView/ViewHistory";
|
||||
import DepositHistory from "../Pages/Deposit/DepositViewHistory/DepositHistory";
|
||||
import Academy from "../Pages/Admin/ManageAcademy/Academy";
|
||||
@@ -34,6 +34,7 @@ import ExchangeHistory from "../Pages/Master/ExchangeRate/ExchangeHistroy";
|
||||
import Welcome from "../Pages/Welcome";
|
||||
import Dashbaord from "../Pages/Dashbaord";
|
||||
import UnderConstruction from "../Pages/UnderConstruction";
|
||||
import PendingRequest from "../Pages/WithDrawal/DrawalRequest/PendingRequest";
|
||||
|
||||
export const RouteLink = [
|
||||
// =============[ Tanami ]================
|
||||
@@ -73,9 +74,9 @@ export const RouteLink = [
|
||||
{ path: "/deposit-history", Component: DepositHistory },
|
||||
|
||||
// ===============[ Withdrawal]===============
|
||||
// { path: "/withdraw-request", Component: PendingRequest },
|
||||
{ path: "/withdraw-request", Component: PendingRequest },
|
||||
{ path: "/withdraw-request", Component: UnderConstruction },
|
||||
// { path: "/withdraw-history", Component: ViewHistory },
|
||||
{ path: "/withdraw-history", Component: ViewHistory },
|
||||
{ path: "/withdraw-history", Component: UnderConstruction },
|
||||
|
||||
// ===============[ Withdrawal]===============
|
||||
|
||||
52
src/Services/drawal.request.service.js
Normal file
52
src/Services/drawal.request.service.js
Normal file
@@ -0,0 +1,52 @@
|
||||
// investorDetails.service.js
|
||||
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
|
||||
// import { api } from "./api.service";
|
||||
import { baseQuery } from "./token.serivce";
|
||||
|
||||
// const baseUrl = api?.defaults.baseURL;
|
||||
|
||||
// Define a service using a base URL and expected endpoints
|
||||
export const drawalRequest = createApi({
|
||||
reducerPath: "drawalRequest",
|
||||
baseQuery: baseQuery,
|
||||
tagTypes: ["getDrawalRequest"],
|
||||
endpoints: (builder) => ({
|
||||
|
||||
getDrawalRequest: builder.query({
|
||||
query: () => `/deposit/admin/pending-requests`,
|
||||
providesTags: ["getDepositRequest"],
|
||||
}),
|
||||
|
||||
// getDepositRequestById: builder.query({
|
||||
// query: (id) => `/deposit/admin/getById/${id}`,
|
||||
// }),
|
||||
|
||||
// updateDepositRequest: builder.mutation({
|
||||
// query: ({ id, data }) => ({
|
||||
// url: `/deposit/admin/approved/${id}`,
|
||||
// method: "PATCH",
|
||||
// body: data,
|
||||
// }),
|
||||
// invalidatesTags: ["getDepositRequest", "getDepositHistory"],
|
||||
// }),
|
||||
|
||||
// depositReject: builder.mutation({
|
||||
// query: ({ id, data }) => ({
|
||||
// url: `/deposit/admin/rejected/${id}`,
|
||||
// method: "PATCH",
|
||||
// body: data,
|
||||
// }),
|
||||
// invalidatesTags: ["getDepositRequest", "getDepositHistory"],
|
||||
// }),
|
||||
|
||||
// getDepositHistory: builder.query({
|
||||
// query: () => `/deposit/admin/history`,
|
||||
// providesTags: ["getDepositHistory"],
|
||||
// }),
|
||||
}),
|
||||
});
|
||||
|
||||
// Export hooks for usage in functional components
|
||||
export const {
|
||||
useGetDepositRequestQuery,
|
||||
} = drawalRequest;
|
||||
@@ -12,6 +12,7 @@ import { bankDetails } from "../Services/bank.details.service";
|
||||
import { contact } from "../Services/contact.service";
|
||||
import { depositRequest } from "../Services/deposit.request.service";
|
||||
import { apiSlice, baseQuery } from "../Services/token.serivce";
|
||||
import { drawalRequest } from "../Services/drawal.request.service";
|
||||
|
||||
export const store = configureStore({
|
||||
reducer: {
|
||||
@@ -25,6 +26,7 @@ export const store = configureStore({
|
||||
[bankDetails.reducerPath]: bankDetails.reducer,
|
||||
[contact.reducerPath]: contact.reducer,
|
||||
[depositRequest.reducerPath]: depositRequest.reducer,
|
||||
[drawalRequest.reducerPath]: drawalRequest.reducer,
|
||||
// Add other reducers as needed
|
||||
},
|
||||
middleware: (getDefaultMiddleware) =>
|
||||
@@ -43,6 +45,7 @@ export const store = configureStore({
|
||||
bankDetails.middleware,
|
||||
contact.middleware,
|
||||
depositRequest.middleware,
|
||||
drawalRequest.middleware,
|
||||
),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user