changes admin

This commit is contained in:
YasinShaikh123
2024-09-19 16:45:05 +05:30
parent fdb9ccefa9
commit 1a1910c58c
7 changed files with 339 additions and 318 deletions

View File

@@ -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: () => <ToastBox message={res?.data?.message} />,
});
setIsLoading(false)
setIsLoading(false);
}
} catch (error) {
console.log(error);
setIsLoading(false)
setIsLoading(false);
}
};
return (

View File

@@ -156,14 +156,14 @@ const BankInvestor = () => {
Country: (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.country_xid}
{item?.country}
</Text>
</Box>
),
"Phone Number": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.principal?.mobileNumber}
{item?.phoneNumber}
</Text>
</Box>
),

View File

@@ -20,7 +20,10 @@ import {
import Pagination from "../../../../Components/Pagination";
import ToastBox from "../../../../Components/ToastBox";
import ReasonBanModal from "./ReasonBanModal";
import { useGetInvestorQuery, useGetUnbanInvestorQuery } from "../../../../Services/ban.investor.service";
import {
useGetInvestorQuery,
useGetUnbanInvestorQuery,
} from "../../../../Services/ban.investor.service";
const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter
@@ -36,11 +39,7 @@ import { useGetInvestorQuery, useGetUnbanInvestorQuery } from "../../../../Servi
const [actionId, setActionId] = useState(false);
const [mouseEntered, setMouseEntered] = useState(false);
const [mouseEnteredId, setMouseEnteredId] = useState("");
const {
isOpen: isOpen,
onOpen: onOpen,
onClose: onClose,
} = useDisclosure();
const { isOpen: isOpen, onOpen: onOpen, onClose: onClose } = useDisclosure();
const formatDate = (date) => {
return new Date(date).toLocaleDateString("en-GB", {
@@ -51,9 +50,11 @@ import { useGetInvestorQuery, useGetUnbanInvestorQuery } from "../../../../Servi
};
const {
data,isLoading: unbanLoading,error,refetch} = useGetUnbanInvestorQuery();
data,
isLoading: unbanLoading,
error,
refetch,
} = useGetUnbanInvestorQuery();
useEffect(() => {
// Simulate loading
@@ -112,10 +113,10 @@ import { useGetInvestorQuery, useGetUnbanInvestorQuery } from "../../../../Servi
{item.id}
</Text>
),
"Date": (
Date: (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{formatDate(item?.principal?.createdAt)}
{formatDate(item?.date)}
</Text>
</Box>
),
@@ -129,35 +130,35 @@ import { useGetInvestorQuery, useGetUnbanInvestorQuery } from "../../../../Servi
"First Name": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.principal?.firstName}
{item?.firstName}
</Text>
</Box>
),
"Last Name": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.principal?.lastName}
{item?.lastName}
</Text>
</Box>
),
Country: (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.country_xid}
{item?.country}
</Text>
</Box>
),
"Phone Number": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.principal?.mobileNumber}
{item?.phoneNumber}
</Text>
</Box>
),
"E-mail ID": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item?.principal?.emailAddress}
{item?.emailAddress}
</Text>
</Box>
),
@@ -166,11 +167,11 @@ import { useGetInvestorQuery, useGetUnbanInvestorQuery } from "../../../../Servi
<Badge
fontWeight={"500"}
textTransform={"none"}
color={item?.KYCStatus === "Completed" ? "blue" : "red"}
color={item?.KYCStatus === "False" ? "blue" : "red"}
px={2}
py={0.5}
>
{item?.KYCStatus}
{item?.KYCStatus ? "True" : "False"}
</Badge>
</Box>
),
@@ -238,7 +239,7 @@ import { useGetInvestorQuery, useGetUnbanInvestorQuery } from "../../../../Servi
size={"sm"}
fontSize={"xs"}
cursor={"pointer"}
placeholder='KYC Status'
placeholder="KYC Status"
w={180}
rounded={"md"}
>
@@ -251,7 +252,7 @@ import { useGetInvestorQuery, useGetUnbanInvestorQuery } from "../../../../Servi
size={"sm"}
fontSize={"xs"}
cursor={"pointer"}
placeholder='Country'
placeholder="Country"
w={180}
rounded={"md"}
>
@@ -281,14 +282,9 @@ import { useGetInvestorQuery, useGetUnbanInvestorQuery } from "../../../../Servi
alertHandler={handleDelete}
isLoading={isLoading}
/>
<ReasonBanModal
isOpen={isOpen}
onClose={onClose}
id={actionId}
/>
<ReasonBanModal isOpen={isOpen} onClose={onClose} id={actionId} />
</Box>
);
};
export default UnbanInvestor;

View File

@@ -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 = () => {
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"} pb={14}>
{/* ===================== [Switch Button] ======================== */}
<Box mt={5} display={"flex"} justifyContent={"right"} mr={5}>
<Box display={"flex"} justifyContent={"space-between"} alignItems={"center"} mt={5} px={4} mb={5}>
<Text fontSize={"sm"} mb={0} onClick={() => navigate(-1)} cursor={"pointer"}>
<ArrowBackIcon fontSize={"xl"} me={2} />Add Details
</Text>
<SwitchButton isSwitchOn={isSwitchOn} setIsSwitchOn={setIsSwitchOn} />
</Box>

View File

@@ -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 = () => {
) : (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"} pb={14}>
{/* ===================== [Switch Button] ======================== */}
<Box mt={5} display={"flex"} justifyContent={"right"} mr={5}>
<Box display={"flex"} justifyContent={"space-between"} alignItems={"center"} mt={5} px={4}>
<Text fontSize={"sm"} mb={0} onClick={() => navigate(-1)} cursor={"pointer"}>
<ArrowBackIcon fontSize={"xl"} me={2} />Add Details
</Text>
<SwitchButton isSwitchOn={isSwitchOn} setIsSwitchOn={setIsSwitchOn} />
</Box>

View File

@@ -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 = () => {
// </Text>
// </Box>
// ),
"Wallet Balance": (
"Amount in Wallet Pre-Withdrawal": (
<Box w={"100px"} isTruncated={true} display={'flex'} justifyContent={'end'}>
<Text as={"span"} color={"teal.900"}>
{/* {item.investorAmount} */}
@@ -218,7 +218,7 @@ const PendingRequest = () => {
</Box>
),
"Withdrawal Amount": (
<Box w={"100px"} isTruncated={true} display={'flex'} justifyContent={'end'}>
<Box w={"130px"} isTruncated={true} display={'flex'} justifyContent={'end'}>
<Text as={"span"} color={"teal.900"}>
{/* {item.investorAmount} */}
{parseFloat(item?.investorAmount || 0).toLocaleString(undefined, {

BIN
src/assets/favicons.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 963 B