From 1a1910c58c6acca4df9becab5c3d50c38fefcc55 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Thu, 19 Sep 2024 16:45:05 +0530
Subject: [PATCH] changes admin
---
src/Pages/Admin/Contact.jsx | 58 +-
.../Investor/BankInvestor/BankInvestor.jsx | 4 +-
.../Investor/UnbanInvestor/UnbanInvestor.jsx | 572 +++++++++---------
.../InvestmentType/AddInvestmentType.jsx | 8 +-
src/Pages/Master/Sponser/AddSponser.jsx | 9 +-
.../DrawalRequest/PendingRequest.jsx | 6 +-
src/assets/favicons.png | Bin 0 -> 963 bytes
7 files changed, 339 insertions(+), 318 deletions(-)
create mode 100644 src/assets/favicons.png
diff --git a/src/Pages/Admin/Contact.jsx b/src/Pages/Admin/Contact.jsx
index e0d2fa0..bc7dfcc 100644
--- a/src/Pages/Admin/Contact.jsx
+++ b/src/Pages/Admin/Contact.jsx
@@ -20,14 +20,35 @@ import { v4 as uuidv4 } from "uuid";
import GlobalStateContext from "../../Contexts/GlobalStateContext";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
import FormInputMain from "../../Components/FormInputMain";
-import { useGetContactQuery, useUpdateContactMutation } from "../../Services/contact.service";
+import {
+ useGetContactQuery,
+ useUpdateContactMutation,
+} from "../../Services/contact.service";
import FullscreenLoaders from "../../Components/Loaders/FullscreenLoaders";
import ToastBox from "../../Components/ToastBox";
export const addSponser = yup.object().shape({
- phoneNumber: yup.string().required("Phone Number is required"),
- emailAddress: yup.string().required("E-mail ID is required"),
- websiteUrl: yup.string().required("Website URL is required"),
+ 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"
+ ),
+ emailAddress: yup
+ .string()
+ .required("E-mail ID is required")
+ .matches(
+ /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
+ "Invalid email address"
+ ),
+ websiteUrl: yup
+ .string()
+ .required("Website URL is required")
+ .matches(
+ /^(https?:\/\/)?([\w.-]+)+(:\d+)?(\/[\w.-]*)*\/?$/,
+ "Invalid URL format"
+ ),
});
export function debounce(func, delay) {
@@ -39,10 +60,10 @@ export function debounce(func, delay) {
}
const Contact = () => {
- const toast = useToast()
+ const toast = useToast();
const navigate = useNavigate();
const [form, setForm] = useState({});
- const [ isLoading, setIsLoading ] = useState(false)
+ const [isLoading, setIsLoading] = useState(false);
// const { sponser, setSponser } = useContext(GlobalStateContext);
const {
@@ -52,16 +73,17 @@ const Contact = () => {
formState: { errors },
} = useForm({
resolver: yupResolver(addSponser),
+ // mode: all
});
-
+ console.log(errors);
+
const {
data: contact,
isLoading: contactLoading,
error,
} = useGetContactQuery();
- const [ updateContact ] = useUpdateContactMutation()
-
+ const [updateContact] = useUpdateContactMutation();
useEffect(() => {
if (contact) {
@@ -84,7 +106,7 @@ const Contact = () => {
name: "phoneNumber",
type: "text",
isRequired: true,
- section: "Add Details",
+ section:"",
// value: contact?.phoneNumber || "",
},
{
@@ -93,7 +115,7 @@ const Contact = () => {
placeHolder: " ",
type: "text",
isRequired: true,
- section: "Add Details",
+ section:"",
// value: contact?.emailAddress || "",
},
{
@@ -102,7 +124,7 @@ const Contact = () => {
placeHolder: " ",
type: "text",
isRequired: true,
- section: "Add Details",
+ section:"",
// value: contact?.websiteUrl || "",
},
];
@@ -117,24 +139,20 @@ const Contact = () => {
}, {});
const onSubmit = async (data) => {
- setIsLoading(true)
+ setIsLoading(true);
try {
- const res = await updateContact(data)
+ const res = await updateContact(data);
if (res?.data?.statusCode === 200) {
toast({
render: () => ,
});
- setIsLoading(false)
+ setIsLoading(false);
}
-
} catch (error) {
console.log(error);
- setIsLoading(false)
-
-
+ setIsLoading(false);
}
-
};
return (
diff --git a/src/Pages/Admin/Investor/BankInvestor/BankInvestor.jsx b/src/Pages/Admin/Investor/BankInvestor/BankInvestor.jsx
index feec3fb..d315697 100644
--- a/src/Pages/Admin/Investor/BankInvestor/BankInvestor.jsx
+++ b/src/Pages/Admin/Investor/BankInvestor/BankInvestor.jsx
@@ -156,14 +156,14 @@ const BankInvestor = () => {
Country: (
- {item?.country_xid}
+ {item?.country}
),
"Phone Number": (
- {item?.principal?.mobileNumber}
+ {item?.phoneNumber}
),
diff --git a/src/Pages/Admin/Investor/UnbanInvestor/UnbanInvestor.jsx b/src/Pages/Admin/Investor/UnbanInvestor/UnbanInvestor.jsx
index 78fdf9c..b869d66 100644
--- a/src/Pages/Admin/Investor/UnbanInvestor/UnbanInvestor.jsx
+++ b/src/Pages/Admin/Investor/UnbanInvestor/UnbanInvestor.jsx
@@ -1,294 +1,290 @@
import {
- Avatar,
- Badge,
- Box,
- HStack,
- Input,
- Select,
- Switch,
- Text,
- useDisclosure,
- useToast,
- } from "@chakra-ui/react";
- import React, { useContext, useEffect, useState, useRef } from "react";
- import { Link, Link as RouterLink, useNavigate } from "react-router-dom";
- import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
- import { debounce } from "../../../Master/Sponser/AddSponser";
- import { OPACITY_ON_LOAD } from "../../../../Layout/animations";
- import DataTable from "../../../../Components/DataTable/DataTable";
- import CustomAlertDialog from "../../../../Components/CustomAlertDialog";
- import Pagination from "../../../../Components/Pagination";
- import ToastBox from "../../../../Components/ToastBox";
- import ReasonBanModal from "./ReasonBanModal";
-import { useGetInvestorQuery, useGetUnbanInvestorQuery } from "../../../../Services/ban.investor.service";
-
- const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter
-
- const UnbanInvestor = () => {
- const navigate = useNavigate();
- const toast = useToast();
- const thirdField = useRef();
- const { bankInvestor, setBankInvestor, slideFromRight } =
- 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: isOpen,
- onOpen: onOpen,
- onClose: onClose,
- } = useDisclosure();
+ Avatar,
+ Badge,
+ Box,
+ HStack,
+ Input,
+ Select,
+ Switch,
+ Text,
+ useDisclosure,
+ useToast,
+} from "@chakra-ui/react";
+import React, { useContext, useEffect, useState, useRef } from "react";
+import { Link, Link as RouterLink, useNavigate } from "react-router-dom";
+import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
+import { debounce } from "../../../Master/Sponser/AddSponser";
+import { OPACITY_ON_LOAD } from "../../../../Layout/animations";
+import DataTable from "../../../../Components/DataTable/DataTable";
+import CustomAlertDialog from "../../../../Components/CustomAlertDialog";
+import Pagination from "../../../../Components/Pagination";
+import ToastBox from "../../../../Components/ToastBox";
+import ReasonBanModal from "./ReasonBanModal";
+import {
+ useGetInvestorQuery,
+ useGetUnbanInvestorQuery,
+} from "../../../../Services/ban.investor.service";
- const formatDate = (date) => {
- return new Date(date).toLocaleDateString("en-GB", {
- day: "2-digit",
- month: "2-digit",
- year: "numeric",
- });
- };
+const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter
- const {
- data,isLoading: unbanLoading,error,refetch} = useGetUnbanInvestorQuery();
-
+const UnbanInvestor = () => {
+ const navigate = useNavigate();
+ const toast = useToast();
+ const thirdField = useRef();
+ const { bankInvestor, setBankInvestor, slideFromRight } =
+ 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: isOpen, onOpen: onOpen, onClose: onClose } = useDisclosure();
-
- useEffect(() => {
- // Simulate loading
- const timer = setTimeout(() => {
- setIsLoading(false);
- }, 1500);
-
- // Cleanup the timer on component unmount
- return () => clearTimeout(timer);
- }, []);
-
- // ====================================================[Table Setup]================================================================
- const tableHeadRow = [
- "Sr N/O",
- "Date",
- "Client ID",
- "First Name",
- "Last Name",
- "Country",
- "Phone Number",
- "E-mail ID",
- "KYC Status",
- "Action",
- ];
-
- const handleUpdateStatus = debounce((id) => {
- setBankInvestor((prevData) =>
- prevData.map((bankInvestor) =>
- bankInvestor.id === id ? { ...bankInvestor } : bankInvestor
- )
- );
- toast({
- render: () => ,
- });
- }, 300);
-
- // ====================================================[Table Filter]================================================================
- const filteredData = data?.data?.rows?.filter((item) => {
- // Filter by name (case insensitive)
- const name = item?.clientReference_id;
- const searchLower = searchTerm.toLowerCase();
- const nameMatches = name?.toLowerCase().includes(searchLower);
-
- return nameMatches;
+ const formatDate = (date) => {
+ return new Date(date).toLocaleDateString("en-GB", {
+ day: "2-digit",
+ month: "2-digit",
+ year: "numeric",
});
-
- const extractedArray = filteredData?.map((item) => ({
- id: item?.id,
- "Sr N/O": (
-
- {item.id}
-
- ),
- "Date": (
-
-
- {formatDate(item?.principal?.createdAt)}
-
-
- ),
- "Client ID": (
-
-
- {item?.clientReference_id}
-
-
- ),
- "First Name": (
-
-
- {item?.principal?.firstName}
-
-
- ),
- "Last Name": (
-
-
- {item?.principal?.lastName}
-
-
- ),
- Country: (
-
-
- {item?.country_xid}
-
-
- ),
- "Phone Number": (
-
-
- {item?.principal?.mobileNumber}
-
-
- ),
- "E-mail ID": (
-
-
- {item?.principal?.emailAddress}
-
-
- ),
- "KYC Status": (
-
-
- {item?.KYCStatus}
-
-
- ),
- Action: (
-
-
- Unban Investor
-
-
- ),
- }));
-
- const handleDelete = () => {
- const updatedInvestorDetails = InvestorDetails.filter(
- (sponsor) => sponsor.id !== actionId
- );
-
- setTimeout(() => {
- setInvestorDetails(updatedInvestorDetails);
- setDeleteAlert(false);
- setIsLoading(false);
- }, 100);
- setIsLoading(true);
- };
-
- const handleEdit = (id) => {
- setActionId(id);
- onEditOpen();
- };
-
- return (
-
-
-
- setSearchTerm(e.target.value)}
- />
-
-
-
-
-
-
-
-
-
- setDeleteAlert(false)}
- isOpen={deleteAlert}
- message={"Are you sure you want to delete sponers?"}
- alertHandler={handleDelete}
- isLoading={isLoading}
- />
-
-
- );
};
-
- export default UnbanInvestor;
-
\ No newline at end of file
+
+ const {
+ data,
+ isLoading: unbanLoading,
+ error,
+ refetch,
+ } = useGetUnbanInvestorQuery();
+
+ useEffect(() => {
+ // Simulate loading
+ const timer = setTimeout(() => {
+ setIsLoading(false);
+ }, 1500);
+
+ // Cleanup the timer on component unmount
+ return () => clearTimeout(timer);
+ }, []);
+
+ // ====================================================[Table Setup]================================================================
+ const tableHeadRow = [
+ "Sr N/O",
+ "Date",
+ "Client ID",
+ "First Name",
+ "Last Name",
+ "Country",
+ "Phone Number",
+ "E-mail ID",
+ "KYC Status",
+ "Action",
+ ];
+
+ const handleUpdateStatus = debounce((id) => {
+ setBankInvestor((prevData) =>
+ prevData.map((bankInvestor) =>
+ bankInvestor.id === id ? { ...bankInvestor } : bankInvestor
+ )
+ );
+ toast({
+ render: () => ,
+ });
+ }, 300);
+
+ // ====================================================[Table Filter]================================================================
+ const filteredData = data?.data?.rows?.filter((item) => {
+ // Filter by name (case insensitive)
+ const name = item?.clientReference_id;
+ const searchLower = searchTerm.toLowerCase();
+ const nameMatches = name?.toLowerCase().includes(searchLower);
+
+ return nameMatches;
+ });
+
+ const extractedArray = filteredData?.map((item) => ({
+ id: item?.id,
+ "Sr N/O": (
+
+ {item.id}
+
+ ),
+ Date: (
+
+
+ {formatDate(item?.date)}
+
+
+ ),
+ "Client ID": (
+
+
+ {item?.clientReference_id}
+
+
+ ),
+ "First Name": (
+
+
+ {item?.firstName}
+
+
+ ),
+ "Last Name": (
+
+
+ {item?.lastName}
+
+
+ ),
+ Country: (
+
+
+ {item?.country}
+
+
+ ),
+ "Phone Number": (
+
+
+ {item?.phoneNumber}
+
+
+ ),
+ "E-mail ID": (
+
+
+ {item?.emailAddress}
+
+
+ ),
+ "KYC Status": (
+
+
+ {item?.KYCStatus ? "True" : "False"}
+
+
+ ),
+ Action: (
+
+
+ Unban Investor
+
+
+ ),
+ }));
+
+ const handleDelete = () => {
+ const updatedInvestorDetails = InvestorDetails.filter(
+ (sponsor) => sponsor.id !== actionId
+ );
+
+ setTimeout(() => {
+ setInvestorDetails(updatedInvestorDetails);
+ setDeleteAlert(false);
+ setIsLoading(false);
+ }, 100);
+ setIsLoading(true);
+ };
+
+ const handleEdit = (id) => {
+ setActionId(id);
+ onEditOpen();
+ };
+
+ return (
+
+
+
+ setSearchTerm(e.target.value)}
+ />
+
+
+
+
+
+
+
+
+
+ setDeleteAlert(false)}
+ isOpen={deleteAlert}
+ message={"Are you sure you want to delete sponers?"}
+ alertHandler={handleDelete}
+ isLoading={isLoading}
+ />
+
+
+ );
+};
+
+export default UnbanInvestor;
diff --git a/src/Pages/Master/InvestmentType/AddInvestmentType.jsx b/src/Pages/Master/InvestmentType/AddInvestmentType.jsx
index 63928fe..4fc7b20 100644
--- a/src/Pages/Master/InvestmentType/AddInvestmentType.jsx
+++ b/src/Pages/Master/InvestmentType/AddInvestmentType.jsx
@@ -1,6 +1,6 @@
import React, { useContext, useEffect, useState } from "react";
import { OPACITY_ON_LOAD } from "../../../Layout/animations";
-import { Box, Button, useToast } from "@chakra-ui/react";
+import { Box, Button, Text, useToast } from "@chakra-ui/react";
import { useForm, Controller } from "react-hook-form";
import { yupResolver } from "@hookform/resolvers/yup";
import * as yup from "yup";
@@ -15,6 +15,7 @@ import {
import ToastBox from "../../../Components/ToastBox";
import CustomAlertDialog from "../../../Components/CustomAlertDialog";
import FullscreenLoaders from "../../../Components/Loaders/FullscreenLoaders";
+import { ArrowBackIcon } from "@chakra-ui/icons";
// ======================= [validation] =========================
@@ -313,7 +314,10 @@ const AddInvestmentType = () => {
{/* ===================== [Switch Button] ======================== */}
-
+
+ navigate(-1)} cursor={"pointer"}>
+ Add Details
+
diff --git a/src/Pages/Master/Sponser/AddSponser.jsx b/src/Pages/Master/Sponser/AddSponser.jsx
index be0777c..d06acb2 100644
--- a/src/Pages/Master/Sponser/AddSponser.jsx
+++ b/src/Pages/Master/Sponser/AddSponser.jsx
@@ -1,6 +1,6 @@
import React, { useContext, useEffect, useState } from "react";
import { OPACITY_ON_LOAD } from "../../../Layout/animations";
-import { Box, Button, useToast } from "@chakra-ui/react";
+import { Box, Button, Text, useToast } from "@chakra-ui/react";
import { useForm, Controller } from "react-hook-form";
import { yupResolver } from "@hookform/resolvers/yup";
import * as yup from "yup";
@@ -17,6 +17,7 @@ import {
useGetSponserByIdQuery,
useUpdateSponserMutation,
} from "../../../Services/io.service";
+import { ArrowBackIcon } from "@chakra-ui/icons";
// ======================= [validation] =========================
export const addSponser = yup.object().shape({
@@ -296,8 +297,10 @@ const AddSponser = () => {
) : (
{/* ===================== [Switch Button] ======================== */}
-
-
+
+ navigate(-1)} cursor={"pointer"}>
+ Add Details
+
diff --git a/src/Pages/WithDrawal/DrawalRequest/PendingRequest.jsx b/src/Pages/WithDrawal/DrawalRequest/PendingRequest.jsx
index b920a1d..9bb35bf 100644
--- a/src/Pages/WithDrawal/DrawalRequest/PendingRequest.jsx
+++ b/src/Pages/WithDrawal/DrawalRequest/PendingRequest.jsx
@@ -113,7 +113,7 @@ const PendingRequest = () => {
"Last Name",
"Country",
// "Phone Number",
- "Wallet Balance",
+ "Amount in Wallet Pre-Withdrawal",
"Withdrawal Amount",
// "Currency",
// "Withdrawal Amount",
@@ -206,7 +206,7 @@ const PendingRequest = () => {
//
//
// ),
- "Wallet Balance": (
+ "Amount in Wallet Pre-Withdrawal": (
{/* {item.investorAmount} */}
@@ -218,7 +218,7 @@ const PendingRequest = () => {
),
"Withdrawal Amount": (
-
+
{/* {item.investorAmount} */}
{parseFloat(item?.investorAmount || 0).toLocaleString(undefined, {
diff --git a/src/assets/favicons.png b/src/assets/favicons.png
new file mode 100644
index 0000000000000000000000000000000000000000..14699f1d2341aca85aa4081963f21ec15cb1c1b5
GIT binary patch
literal 963
zcmV;!13dhRP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf6951U69E94oEQKA16WB!K~z{r&6!P1
z6G0Tm+n$N;O-wWvMGt7gQmn|mVOp1EI8>{wS`7bl1U1niFrY*nZu`@4Q^6$)hZ{C2XTCFzKav$G>
z#o=Dnf9-U+pe{d`(%Lr|IGk}Y$1Ljad83LTYmAS!_mqi;1f^BQlVRs0&ih}
z#;a{{Sgqj51=VgQ+5vGVwC&X_i$lPN5|IK{%SzpH!=Zf#e&A_IT>ABl%q!rnAO+4A
z@!VD%;t8wev~D>?>^xb*(^MSK@?aOl9G+XmA)X*g$!^q|W{~;Ww!{U
zSxWIOeEr-*#x19IOM#Czc5cD9Hn!Pz2^>DYOolpo%%OZZ&C;Gg*Mbtgt4QKTmU++b
zcie-i)9-?H34wkNXD5y*;@c7QTceTqlpKktX~Cqp5m%cGKrbco<#^i4mSB};@1=*(
z2;#P66y}DWQ(X&WxXES_W?jvIzDk3`Q-vpUp<*g0#rm&g%tX1#dhuv|GJq{@dj8XV
z7(KjJ(S+E*)eLLv%z(I#>u1VjY767F5OBMF0i4N5E;6-+F&RMJ!S5E_Ey&Oo2pyv^
zz*U@60v+}Bjj}7mv62CB-d1OYoEC5+yCUXT@djGHtvK7w&i9s!3mjo518BLp+P2(C
z%f*?+8{jI=Zf}V9%`z2m6^B)@BQSYm`%Z|fI2=Q0smOF&!rlFObU0+ngnP_kn^HF?
z5@gB*t83{?pet#FCD(6ttp7QP@m>{I1J-AZ#&q&BqrmX}SZ?i~Ca~UR8P|S}1^)D3
lEG!002ovPDHLkV1iPI!9V~2
literal 0
HcmV?d00001