Merge branch 'dev' of http://git.wdipl.com/Siddhesh.More/tanami-admin-panel into feature-dev
This commit is contained in:
@@ -9,18 +9,14 @@ import { Input } from "@chakra-ui/react";
|
||||
// };
|
||||
|
||||
export const formatCurrency = (value) => {
|
||||
if (!value && value !== 0) return ''; // Handle null, undefined, and empty strings
|
||||
|
||||
// Ensure the value is a string
|
||||
value = value.toString();
|
||||
|
||||
const [integer, decimal] = value.split('.');
|
||||
const formattedInteger = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||
if (!value) return '';
|
||||
const [integer, decimal] = value?.split('.');
|
||||
const formattedInteger = integer?.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||
return decimal ? `${formattedInteger}.${decimal}` : formattedInteger;
|
||||
};
|
||||
|
||||
const CurrencyInput = forwardRef(({ value, onChange, ...props }, ref) => {
|
||||
console.log(props);
|
||||
|
||||
|
||||
|
||||
const handleChange = (event) => {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { AddIcon } from "@chakra-ui/icons";
|
||||
import { AddIcon, ArrowBackIcon } from "@chakra-ui/icons";
|
||||
import {
|
||||
Avatar,
|
||||
Box,
|
||||
Button,
|
||||
HStack,
|
||||
Popover,
|
||||
PopoverArrow,
|
||||
PopoverBody,
|
||||
@@ -14,13 +15,14 @@ import {
|
||||
useColorMode,
|
||||
} from "@chakra-ui/react";
|
||||
import React, { useContext } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
import { IoMdDownload } from "react-icons/io";
|
||||
import * as XLSX from "xlsx";
|
||||
import profile from "../assets/proavatar.webp";
|
||||
import GlobalStateContext from "../Contexts/GlobalStateContext";
|
||||
import { MdOutlineDarkMode, MdOutlineLightMode } from "react-icons/md";
|
||||
import logoMini from "../assets/propic.png"
|
||||
import { BsBack } from "react-icons/bs";
|
||||
|
||||
const HeaderMain = ({
|
||||
link,
|
||||
@@ -30,6 +32,7 @@ const HeaderMain = ({
|
||||
logOutHandler,
|
||||
slideDirecttion,
|
||||
}) => {
|
||||
const navigate = useNavigate()
|
||||
const { colorMode, toggleColorMode } = useContext(GlobalStateContext);
|
||||
|
||||
|
||||
@@ -42,6 +45,8 @@ const HeaderMain = ({
|
||||
|
||||
zIndex={999}
|
||||
>
|
||||
<HStack>
|
||||
{/* <ArrowBackIcon onClick={()=>navigate(-1)} /> */}
|
||||
<Text
|
||||
as={"span"}
|
||||
fontWeight={"500"}
|
||||
@@ -51,6 +56,7 @@ const HeaderMain = ({
|
||||
{/* <icon /> */}
|
||||
{title}
|
||||
</Text>
|
||||
</HStack>
|
||||
|
||||
|
||||
<Box me={4} gap={2} className="d-flex justify-content-center ">
|
||||
|
||||
@@ -2,6 +2,7 @@ import {
|
||||
Box,
|
||||
Button,
|
||||
Heading,
|
||||
HStack,
|
||||
Image,
|
||||
Modal,
|
||||
ModalContent,
|
||||
@@ -54,16 +55,25 @@ const MobileView = ({ isOpen, onClose, finalRef }) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Modal isCentered finalFocusRef={finalRef} isOpen={isOpen} onClose={onClose}>
|
||||
<ModalOverlay />
|
||||
<ModalContent
|
||||
h={"600px"}
|
||||
w={"330px"}
|
||||
backgroundColor={"transparent"}
|
||||
<Modal display={'flex'} size={'xl'} justifyContent={'center'} isCentered finalFocusRef={finalRef} isOpen={isOpen} onClose={onClose}>
|
||||
<ModalOverlay
|
||||
backdropFilter="blur(5px)" // Add this line for backdrop blur
|
||||
bg="rgba(0, 0, 0, 0.4)" // Optional: Adjust the overlay color and opacity
|
||||
/>
|
||||
<ModalContent
|
||||
|
||||
backgroundColor={"transparent"} shadow={'none'}>
|
||||
|
||||
<HStack w={'100'} display={'flex'} justify={'center'}>
|
||||
<Box
|
||||
as="span"
|
||||
boxShadow={"none"}
|
||||
position={"relative"}
|
||||
>
|
||||
display={'flex'}
|
||||
justifyContent={'center'}
|
||||
h={"600px"}
|
||||
w={"330px"}
|
||||
>
|
||||
<Image
|
||||
h={"100%"}
|
||||
w={"100%"}
|
||||
@@ -74,9 +84,10 @@ const MobileView = ({ isOpen, onClose, finalRef }) => {
|
||||
/>
|
||||
<Box
|
||||
backgroundColor={"#fff"}
|
||||
h={"100%"}
|
||||
m={2}
|
||||
borderRadius={"30px"}
|
||||
h={"98%"}
|
||||
w={'96%'}
|
||||
// m={2}
|
||||
borderRadius={"47px"}
|
||||
pt={"30px"}
|
||||
px={"15px"}
|
||||
>
|
||||
@@ -253,9 +264,10 @@ const MobileView = ({ isOpen, onClose, finalRef }) => {
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
</HStack>
|
||||
</ModalContent>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -2,6 +2,34 @@
|
||||
import dns from "node:dns"
|
||||
|
||||
|
||||
|
||||
|
||||
export function getTomorrowDate() {
|
||||
const today = new Date();
|
||||
const tomorrow = new Date(today);
|
||||
tomorrow.setDate(today.getDate() + 1);
|
||||
|
||||
// Format the date as YYYY-MM-DD (ISO 8601)
|
||||
return tomorrow.toISOString().split('T')[0];
|
||||
}
|
||||
|
||||
|
||||
export function removeTrailingZeros(value) {
|
||||
// Convert the value to a number and then to a string
|
||||
let number = parseFloat(value);
|
||||
let result = number.toString();
|
||||
|
||||
// Check if the result contains a decimal point
|
||||
if (result.includes('.')) {
|
||||
// Remove trailing zeros if the decimal part is 0 or 00
|
||||
result = result.replace(/(\.\d*?)0+$/, '$1'); // Remove trailing zeros
|
||||
result = result.replace(/\.$/, ''); // Remove the decimal point if it's the last character
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
export function getCountdownTimer(utcDateString) {
|
||||
// Parse the UTC datetime string into a Date object
|
||||
const targetDate = new Date(utcDateString);
|
||||
@@ -85,3 +113,20 @@ export async function checkEmailValidity(email) {
|
||||
return false; // Error occurred
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Function to convert timestamp to readable date format in Gulf timezone
|
||||
export function formatTimestampInGulfTimezone(timestamp) {
|
||||
const date = new Date(timestamp);
|
||||
const options = {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit',
|
||||
timeZone: 'Asia/Dubai', // Gulf Standard Time (GST) timezone
|
||||
timeZoneName: 'short'
|
||||
};
|
||||
return date.toLocaleDateString('en-GB', options);
|
||||
}
|
||||
|
||||
@@ -188,6 +188,30 @@ const DashboardLayout = ({ isOnline }) => {
|
||||
Investor Transactions
|
||||
</span>
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
case path.startsWith("/deposit-request"):
|
||||
return (
|
||||
<span className="d-flex align-items-end gap-2">
|
||||
<RiMoneyDollarBoxLine className="h4 m-0 fw-normal" />
|
||||
Deposite pending request
|
||||
</span>
|
||||
);
|
||||
case path.startsWith("/deposit-history"):
|
||||
return (
|
||||
<span className="d-flex align-items-end gap-2">
|
||||
<RiExchangeBoxLine className="h4 m-0 fw-normal" />
|
||||
Deposite withdrawal request
|
||||
</span>
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case path.startsWith("/withdraw-request"):
|
||||
return (
|
||||
<span className="d-flex align-items-end gap-2">
|
||||
|
||||
@@ -35,6 +35,8 @@ import NormalTable from "../../../Components/DataTable/NormalTable";
|
||||
import { useGetDepositRequestQuery } from "../../../Services/deposit.request.service";
|
||||
import { current } from "@reduxjs/toolkit";
|
||||
import { TABLE_PAGINATION } from "../../../Constants/Paginations";
|
||||
import { removeTrailingZeros } from "../../../Constants/Constants";
|
||||
import { formatCurrency } from "../../../Components/CurrencyInput";
|
||||
|
||||
const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter
|
||||
|
||||
@@ -100,7 +102,7 @@ const DepositRequest = () => {
|
||||
// ====================================================[Table Filter]================================================================
|
||||
const filteredData = data?.data?.rows.filter((item) => {
|
||||
// Filter by name (case insensitive)
|
||||
const name = [item.firstName, item.lastName, item.countryName].filter(Boolean).join(' ');
|
||||
const name = [item.firstName, item.lastName, item.countryName].filter(Boolean).join(' ');
|
||||
const searchLower = searchTerm.toLowerCase();
|
||||
const nameMatches = name.toLowerCase().includes(searchLower);
|
||||
|
||||
@@ -116,6 +118,9 @@ const DepositRequest = () => {
|
||||
return nameMatches;
|
||||
});
|
||||
|
||||
console.log(data?.data?.rows);
|
||||
|
||||
|
||||
const extractedArray = filteredData?.map((item, index) => ({
|
||||
// id: item?.id,
|
||||
"Sr.no": (
|
||||
@@ -171,9 +176,9 @@ const DepositRequest = () => {
|
||||
</Box>
|
||||
),
|
||||
"Amount in Investor currency": (
|
||||
<Box w={"70px"} isTruncated={true}>
|
||||
<Box display={'flex'} justifyContent={'end'} w={"100px"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item?.investorAmount}
|
||||
{formatCurrency(removeTrailingZeros(item?.investorAmount))} <Badge ms={1} colorScheme="green">{item?.currencyCode}</Badge>
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
@@ -240,7 +245,7 @@ const DepositRequest = () => {
|
||||
onRejectOpen();
|
||||
}}
|
||||
py={1}
|
||||
// variant={"solid"}
|
||||
// variant={"solid"}
|
||||
>
|
||||
<CloseIcon fontSize={"10px"} />
|
||||
</Button>
|
||||
@@ -323,7 +328,7 @@ const DepositRequest = () => {
|
||||
isOpen={isConfirmOpen}
|
||||
onClose={onConfirmClose}
|
||||
id={actionId}
|
||||
// firstField={firstField}
|
||||
// firstField={firstField}
|
||||
/>
|
||||
<DepositRequestReject
|
||||
isOpen={isRejectOpen}
|
||||
|
||||
@@ -156,7 +156,7 @@ const DepositRequestApprove = ({ isOpen, onClose, firstField, id, data:requestDa
|
||||
)}
|
||||
</FormControl>
|
||||
<FormControl mb={4} isRequired>
|
||||
<FormLabel fontSize="sm">Upload Supporting*</FormLabel>
|
||||
<FormLabel fontSize="sm">Upload Supporting</FormLabel>
|
||||
<Input
|
||||
focusBorderColor="green.400"
|
||||
name="supporting_FileName"
|
||||
|
||||
@@ -67,7 +67,7 @@ const DepositHistory = () => {
|
||||
|
||||
// ====================================================[Table Setup]================================================================
|
||||
const tableHeadRow = [
|
||||
"Sr.no",
|
||||
// "Sr.no",
|
||||
"Client ID",
|
||||
"First Name",
|
||||
"Last Name",
|
||||
@@ -162,10 +162,10 @@ const filteredData = data?.data?.rows.filter((item) => {
|
||||
</Box>
|
||||
),
|
||||
"Amount in Investor currency": (
|
||||
<Box w={"60px"} isTruncated={true}>
|
||||
<Box w={"100px"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{/* <Badge px={2} py={1}> */}
|
||||
{item?.investorAmount}
|
||||
{item?.investorAmount} <Badge ms={1} colorScheme="green">{item?.currencyCode}</Badge>
|
||||
{/* </Badge> */}
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
Text,
|
||||
Tooltip,
|
||||
useDisclosure,
|
||||
useToast,
|
||||
} from "@chakra-ui/react";
|
||||
import React, { useContext, useEffect, useRef, useState } from "react";
|
||||
import DataTable from "../../../Components/DataTable/DataTable";
|
||||
@@ -30,8 +31,10 @@ import {
|
||||
} from "../../../Services/io.service";
|
||||
import { getFileNameFromPath } from "../../../Constants/Constants";
|
||||
import ImageViewer from "../../../Components/ImageViewer";
|
||||
import ToastBox from "../../../Components/ToastBox";
|
||||
|
||||
const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
const toast = useToast()
|
||||
const params = useParams();
|
||||
const id = params?.id;
|
||||
|
||||
@@ -110,6 +113,9 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
if (res?.data?.statusCode === 200) {
|
||||
setDeleteAlertVideo(false);
|
||||
setIsLoadingBtn(false);
|
||||
toast({
|
||||
render: () => <ToastBox message={res?.data?.message} status="error" />,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
@@ -120,9 +126,15 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
||||
setIsLoadingBtn(true);
|
||||
try {
|
||||
const res = await deleteImageArtifacts(id);
|
||||
console.log(res);
|
||||
|
||||
if (res?.data?.statusCode === 200) {
|
||||
setDeleteAlertImage(false);
|
||||
setIsLoadingBtn(false);
|
||||
toast({
|
||||
render: () => <ToastBox message={res?.data?.message} status="error" />,
|
||||
});
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
||||
@@ -34,6 +34,7 @@ import qatar from "../../../assets/qatar_flag.png";
|
||||
import uae from "../../../assets/uae_flag.png";
|
||||
import saudi from "../../../assets/saudi_arabia_flag.png";
|
||||
import { formatDatee } from "../../../Components/FormField";
|
||||
import { removeTrailingZeros } from "../../../Constants/Constants";
|
||||
|
||||
const schema = yup.object().shape({
|
||||
investmentNameEnglish: yup
|
||||
@@ -153,22 +154,24 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
||||
});
|
||||
|
||||
const miniValue = data?.country?.map(
|
||||
({ countryName, flagIcon, minInvestmentAmt, countryCode, id }, index) => {
|
||||
({ countryName, flagIcon, minInvestmentAmt, countryCode, id, currency }, index) => {
|
||||
return {
|
||||
id:id,
|
||||
country: countryName,
|
||||
value: minInvestmentAmt,
|
||||
logo: flagIcon,
|
||||
curr: countryCode,
|
||||
curr: currency?.currencyCode,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
const minInvestmentById = IObyID?.data?.minInvestmentAmt?.map(({minInvestmentAmt, country, country_xid})=>{
|
||||
|
||||
|
||||
const minInvestmentById = IObyID?.data?.minInvestmentAmt?.map(({minInvestmentAmt, country, country_xid, })=>{
|
||||
return{
|
||||
id:country_xid,
|
||||
country: country?.countryName,
|
||||
value: minInvestmentAmt,
|
||||
value: removeTrailingZeros(minInvestmentAmt),
|
||||
logo: country?.flagIcon,
|
||||
curr: country?.countryCode,
|
||||
}
|
||||
@@ -206,7 +209,7 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
||||
investmentNameArabic: IObyID?.data?.investmentNameArabic,
|
||||
descriptionEnglish: IObyID?.data?.descriptionEnglish,
|
||||
descriptionArabic: IObyID?.data?.descriptionArabic,
|
||||
goalAmount: IObyID?.data?.goalAmount,
|
||||
goalAmount: removeTrailingZeros(IObyID?.data?.goalAmount),
|
||||
closingDate: formatDatee(IObyID?.data?.closingDate),
|
||||
holdingPeriod: IObyID?.data?.holdingPeriod,
|
||||
ISIN: IObyID?.data?.ISIN,
|
||||
@@ -220,10 +223,10 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}, [id, IObyID]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// const minInvestmentById =
|
||||
@@ -351,7 +354,7 @@ const IODetails = ({ enableNextTab, index, data }) => {
|
||||
{
|
||||
label: "Goal Amount",
|
||||
placeHolder: "$00.00",
|
||||
value: IObyID?.data?.goalAmount,
|
||||
value: removeTrailingZeros(IObyID?.data?.goalAmount),
|
||||
name: "goalAmount",
|
||||
type: "number",
|
||||
isRequired: true,
|
||||
|
||||
@@ -11,13 +11,15 @@ import {
|
||||
FormControl,
|
||||
FormErrorMessage,
|
||||
FormLabel,
|
||||
Icon,
|
||||
Image,
|
||||
Input,
|
||||
Stack,
|
||||
Text,
|
||||
useToast,
|
||||
} from "@chakra-ui/react";
|
||||
import * as yup from "yup";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import { useForm, Controller } from "react-hook-form";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import CustomAlertDialog from "../../Components/CustomAlertDialog";
|
||||
@@ -27,6 +29,9 @@ import {
|
||||
} from "../../Services/io.service";
|
||||
import { useParams } from "react-router-dom";
|
||||
import ToastBox from "../../Components/ToastBox";
|
||||
import { bytesToMB } from "./InvestmentDocuments";
|
||||
import { formatTimestampInGulfTimezone } from "../../Constants/Constants";
|
||||
import { IoMdRemoveCircleOutline } from "react-icons/io";
|
||||
|
||||
const investmentImageSchema = yup.object().shape({
|
||||
artifactName: yup.string().required("Artifact image name is required"),
|
||||
@@ -53,6 +58,7 @@ const IOArtifactsAdd = ({
|
||||
const [updateImageArtifacts] = useUpdateImageArtifactsMutation();
|
||||
|
||||
const found = data?.find((item) => item?.id === actionId);
|
||||
const fileInputRef = useRef(null);
|
||||
|
||||
|
||||
const {
|
||||
@@ -93,12 +99,15 @@ const IOArtifactsAdd = ({
|
||||
toast({
|
||||
render: () => <ToastBox message={res?.data?.message} />,
|
||||
});
|
||||
reset();
|
||||
setFile(null);
|
||||
setIsLoading(false);
|
||||
setAlert(false);
|
||||
setPreview(null);
|
||||
onClose();
|
||||
reset({
|
||||
artifactName: "",
|
||||
artifactPathName: "",
|
||||
});
|
||||
}
|
||||
|
||||
if (res?.error) {
|
||||
@@ -146,6 +155,8 @@ const IOArtifactsAdd = ({
|
||||
reader.readAsDataURL(file);
|
||||
};
|
||||
|
||||
|
||||
|
||||
const handleSave = () => {
|
||||
handleSubmit(onSubmit)();
|
||||
};
|
||||
@@ -162,6 +173,18 @@ const IOArtifactsAdd = ({
|
||||
setActionId(false);
|
||||
};
|
||||
|
||||
|
||||
const handleRemove = () => {
|
||||
|
||||
setFile(null)
|
||||
setPreview(null)
|
||||
// Reset the file input value
|
||||
if (fileInputRef.current) {
|
||||
fileInputRef.current.value = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Drawer
|
||||
@@ -207,6 +230,7 @@ const IOArtifactsAdd = ({
|
||||
fontSize={"sm"}
|
||||
size={"sm"}
|
||||
className="form-control"
|
||||
ref={fileInputRef} // Set the ref here
|
||||
/>
|
||||
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
|
||||
{!preview &&
|
||||
@@ -214,12 +238,23 @@ const IOArtifactsAdd = ({
|
||||
errors.artifactPathName?.message}
|
||||
</FormErrorMessage>
|
||||
{preview && (
|
||||
<Image
|
||||
rounded={"md"}
|
||||
src={preview}
|
||||
alt="Image Preview"
|
||||
mt={2}
|
||||
/>
|
||||
<>
|
||||
<Image
|
||||
rounded={"md"}
|
||||
src={preview}
|
||||
alt="Image Preview"
|
||||
mt={3}
|
||||
width={'100%'}
|
||||
height={300}
|
||||
objectFit={'cover'}
|
||||
/>
|
||||
<Box w={'100%'} position={'relative'} mt={2} fontSize={'xs'} display={'flex'} flexDirection={'column'} as="span">
|
||||
<Text as={'span'}>Name: {file?.name}</Text>
|
||||
<Text as={'span'} fontSize={'xs'}>File size: {bytesToMB(file?.size)}</Text>
|
||||
<Text as={'span'} fontSize={'xs'}>Last update: {formatTimestampInGulfTimezone(file?.lastModified)}</Text>
|
||||
<Icon onClick={() => handleRemove()} _hover={{ bg: "gray.100" }} transition={'all 0-5s'} cursor={'pointer'} position={'absolute'} right={0} p={1} bottom={0} rounded={'lg'} boxSize={7} as={IoMdRemoveCircleOutline} />
|
||||
</Box>
|
||||
</>
|
||||
)}
|
||||
{found && !preview && (
|
||||
<Image
|
||||
|
||||
@@ -30,14 +30,14 @@ const UpdateIOStatus = ({ isOpen, onClose, status }) => {
|
||||
const [selectedItem, setSelectedItem] = useState();
|
||||
const [isLoadingg, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
const [selectedStatusId, setSelectedStatusId] = useState(status?.[0]?.id);
|
||||
const [selectedStatusId, setSelectedStatusId] = useState('');
|
||||
|
||||
const { data } = useGetIOprepopulateDataQuery();
|
||||
const [updateStatusIo] = useUpdateStatusIoMutation();
|
||||
|
||||
useEffect(() => {
|
||||
setSelectedStatusId(status?.[0]?.id);
|
||||
}, [status]);
|
||||
// useEffect(() => {
|
||||
// setSelectedStatusId(status?.[0]?.id);
|
||||
// }, [status]);
|
||||
|
||||
const handleMenuItemClick = (item, id) => {
|
||||
setSelectedItem(item);
|
||||
@@ -46,7 +46,7 @@ const UpdateIOStatus = ({ isOpen, onClose, status }) => {
|
||||
|
||||
const handleSubmit = async () => {
|
||||
if (!selectedStatusId) {
|
||||
setError("Status is required.");
|
||||
setError("Please select status");
|
||||
return;
|
||||
}
|
||||
setError("");
|
||||
@@ -67,7 +67,8 @@ const UpdateIOStatus = ({ isOpen, onClose, status }) => {
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
setSelectedItem("")
|
||||
setSelectedItem(null)
|
||||
setSelectedStatusId(null)
|
||||
onClose()
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@ import { TABLE_PAGINATION } from "../../../Constants/Paginations";
|
||||
import { formatCurrency } from "../../../Components/CurrencyInput";
|
||||
import { IoIosPhonePortrait } from "react-icons/io";
|
||||
import MobileView from "../../../Components/MobileView";
|
||||
import { FaMobileAlt } from "react-icons/fa";
|
||||
import { ImMobile2 } from "react-icons/im";
|
||||
import { removeTrailingZeros } from "../../../Constants/Constants";
|
||||
// import { debounce } from "./AddIOCharges";
|
||||
|
||||
const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter
|
||||
@@ -75,7 +76,7 @@ const ViewIOTable = () => {
|
||||
page: currentPage,
|
||||
size: pageSize,
|
||||
});
|
||||
console.log(data);
|
||||
|
||||
|
||||
// ===============================[ Table Header ]
|
||||
const tableHeadRow = [
|
||||
@@ -86,7 +87,7 @@ const ViewIOTable = () => {
|
||||
"Goal Amount",
|
||||
"Holding Period",
|
||||
"IO Status",
|
||||
// "Priority",
|
||||
// "Preview",
|
||||
"Action",
|
||||
];
|
||||
|
||||
@@ -106,7 +107,6 @@ const ViewIOTable = () => {
|
||||
return nameMatches && statusMatches;
|
||||
});
|
||||
|
||||
console.log(filteredData);
|
||||
|
||||
const extractedArray = filteredData?.map((item, index) => ({
|
||||
"IO ID": (
|
||||
@@ -142,7 +142,7 @@ const ViewIOTable = () => {
|
||||
"Goal Amount": (
|
||||
<Box w={"100%"} display={'flex'} alignItems={'center'} >
|
||||
<Text w={'100%'} textAlign={'center'} as={"span"} color={"teal.900"} fontWeight={"500"}>
|
||||
{item.goalAmount ? formatCurrency(item.goalAmount) : "---"}
|
||||
{item.goalAmount ? formatCurrency(removeTrailingZeros(item.goalAmount)) : "---"}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
@@ -188,25 +188,36 @@ const ViewIOTable = () => {
|
||||
</Badge>
|
||||
</Box>
|
||||
),
|
||||
"Priority": (
|
||||
<Box w={"auto"} isTruncated={true}>
|
||||
<Text onClick={onOpen} as={"span"} color={"teal.900"} cursor={"pointer"}>
|
||||
<Badge color={"#000"} colorScheme="purple" textTransform={"lowercase"} fontWeight={"500"} display={"flex"} alignItems={"center"} justifyContent={"center"} p={"2px 2px"} borderRadius={"4px"} >
|
||||
<FaMobileAlt fontSize={"14px"} /><Text as={"span"} ml={1}>View</Text>
|
||||
</Badge>
|
||||
</Text>
|
||||
"Preview": (
|
||||
<Box display={"flex"} justifyContent={"start"} >
|
||||
<Button
|
||||
// _hover={{ color: "green.500" }}
|
||||
colorScheme="purple"
|
||||
// transition={"0.5s all"}
|
||||
onClick={onOpen}
|
||||
// color="green.300"
|
||||
rounded={"sm"}
|
||||
size={"xs"}
|
||||
variant={'ghost'}
|
||||
>
|
||||
<ImMobile2 className="me-2" /> View
|
||||
</Button>
|
||||
</Box>
|
||||
|
||||
|
||||
|
||||
|
||||
),
|
||||
Action: (
|
||||
<Box display={"flex"} justifyContent={"center"} gap={2}>
|
||||
<Tooltip
|
||||
{/* <Tooltip
|
||||
rounded={"sm"}
|
||||
fontSize={"xs"}
|
||||
label="View"
|
||||
bg="#fff"
|
||||
color={"green.500"}
|
||||
placement="top"
|
||||
>
|
||||
> */}
|
||||
<Button
|
||||
// _hover={{ color: "green.500" }}
|
||||
colorScheme="green"
|
||||
@@ -218,11 +229,11 @@ const ViewIOTable = () => {
|
||||
rounded={"sm"}
|
||||
size={"xs"}
|
||||
>
|
||||
<ViewIcon />
|
||||
<ViewIcon me={2} /> View
|
||||
</Button>
|
||||
</Tooltip>
|
||||
{/* </Tooltip> */}
|
||||
|
||||
<Tooltip
|
||||
{/* <Tooltip
|
||||
rounded={"sm"}
|
||||
fontSize={"xs"}
|
||||
label="Edit"
|
||||
@@ -243,7 +254,7 @@ const ViewIOTable = () => {
|
||||
>
|
||||
<EditIcon />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</Tooltip> */}
|
||||
|
||||
{/* <Tooltip
|
||||
rounded={"sm"}
|
||||
@@ -273,7 +284,6 @@ const ViewIOTable = () => {
|
||||
|
||||
const handleDelete = () => {};
|
||||
|
||||
console.log(extractedArray);
|
||||
|
||||
return (
|
||||
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"} pb={38}>
|
||||
|
||||
@@ -45,6 +45,9 @@ const ViewIOdata = () => {
|
||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||
const navigate = useNavigate();
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
const { IODetails, setIODetails } = useContext(GlobalStateContext);
|
||||
console.log(IODetails?.isInvestedAmount);
|
||||
|
||||
|
||||
|
||||
const tabs = [
|
||||
@@ -76,8 +79,14 @@ const ViewIOdata = () => {
|
||||
<TabList justifyContent={'space-between'} pe={4} alignItems={'center'}>
|
||||
<Box display={'flex'} >
|
||||
{tabs.map(({ label }, index) => (
|
||||
<Tab px={3}
|
||||
disabled={true}
|
||||
<Tab
|
||||
isDisabled={
|
||||
index === 0 ||
|
||||
index === 1 ||
|
||||
index === 2 ||
|
||||
index === 3 ?
|
||||
false :
|
||||
!IODetails?.isInvestedAmount}
|
||||
key={index}
|
||||
fontSize={"sm"}
|
||||
_selected={{
|
||||
@@ -92,7 +101,7 @@ const ViewIOdata = () => {
|
||||
</TabList>
|
||||
<TabPanels>
|
||||
{tabs.map(({ content }, index) => (
|
||||
<TabPanel key={index}>{content}</TabPanel>
|
||||
<TabPanel key={index}>{content}</TabPanel>
|
||||
))}
|
||||
</TabPanels>
|
||||
</Tabs>
|
||||
|
||||
@@ -42,6 +42,7 @@ import { AddIcon } from "@chakra-ui/icons";
|
||||
import { GrGallery } from "react-icons/gr";
|
||||
import Loader01 from "../../../Components/Loaders/Loader01";
|
||||
import { formatCurrency } from "../../../Components/CurrencyInput";
|
||||
import { removeTrailingZeros } from "../../../Constants/Constants";
|
||||
|
||||
const ViewIOdataHeader = ({data, isLoading}) => {
|
||||
const params = useParams();
|
||||
@@ -157,11 +158,6 @@ const filteredMenu = menu?.filter(item => apiTransactionTitles?.includes(item.id
|
||||
|
||||
|
||||
|
||||
|
||||
console.log(IODetails?.ioNAV);
|
||||
console.log(IODetails?.ioCash);
|
||||
console.log(IODetails?.ioMVNAV);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -298,7 +294,7 @@ console.log(IODetails?.ioMVNAV);
|
||||
IO NAV
|
||||
</Text>
|
||||
<Text as={"span"} fontSize={"sm"} fontWeight={"500"}>
|
||||
{IODetails?.ioNAV ? formatCurrency(IODetails?.ioNAV) : "00.00"}
|
||||
{IODetails?.ioNAV ? formatCurrency(removeTrailingZeros(IODetails?.ioNAV)) : "00.00"}
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
@@ -307,7 +303,7 @@ console.log(IODetails?.ioMVNAV);
|
||||
IO cash
|
||||
</Text>
|
||||
<Text as={"span"} fontSize={"sm"} fontWeight={"500"}>
|
||||
{IODetails?.ioCash ? IODetails?.ioCash : "00.00"}
|
||||
{IODetails?.ioCash ? formatCurrency(removeTrailingZeros(IODetails?.ioCash)) : "00.00"}
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
@@ -316,7 +312,7 @@ console.log(IODetails?.ioMVNAV);
|
||||
IO MV NAV
|
||||
</Text>
|
||||
<Text as={"span"} fontSize={"sm"} fontWeight={"500"}>
|
||||
{IODetails?.ioMVNAV ? formatCurrency(IODetails?.ioMVNAV) : "00.00"}
|
||||
{IODetails?.ioMVNAV ? formatCurrency(removeTrailingZeros(IODetails?.ioMVNAV)) : "00.00"}
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import * as yup from "yup";
|
||||
import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import { formatDate } from "../../Master/Sponser/Sponsers";
|
||||
import { formatCurrency } from "../../../Components/CurrencyInput";
|
||||
import { removeTrailingZeros } from "../../../Constants/Constants";
|
||||
|
||||
const schema = yup.object().shape({
|
||||
investmentNameEnglish: yup
|
||||
@@ -105,7 +106,7 @@ const ViewIOdetails = () => {
|
||||
investmentNameArabic: IObyID?.data?.investmentNameArabic,
|
||||
descriptionEnglish: IObyID?.data?.descriptionEnglish,
|
||||
descriptionArabic: IObyID?.data?.descriptionArabic,
|
||||
goalAmount: IObyID?.data?.goalAmount,
|
||||
goalAmount: removeTrailingZeros(IObyID?.data?.goalAmount),
|
||||
closingDate: IObyID?.data?.closingDate,
|
||||
holdingPeriod: IObyID?.data?.holdingPeriod,
|
||||
ISIN: IObyID?.data?.ISIN,
|
||||
@@ -118,16 +119,20 @@ const ViewIOdetails = () => {
|
||||
}
|
||||
}, [id, IObyID]);
|
||||
|
||||
const minInvestmentById = IObyID?.data?.minInvestmentAmt?.map(({minInvestmentAmt, country, id})=>{
|
||||
const minInvestmentById = IObyID?.data?.minInvestmentAmt?.map(({minInvestmentAmt, country, currencyCode, id})=>{
|
||||
return{
|
||||
id:id,
|
||||
country: country?.countryName,
|
||||
value: minInvestmentAmt,
|
||||
value: removeTrailingZeros(minInvestmentAmt),
|
||||
logo: country?.flagIcon,
|
||||
curr: country?.countryCode,
|
||||
curr: currencyCode,
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
console.log();
|
||||
|
||||
|
||||
//=======================[ Editor ]
|
||||
const formFields = [
|
||||
{
|
||||
@@ -258,7 +263,7 @@ const ViewIOdetails = () => {
|
||||
{
|
||||
label: "Goal Amount",
|
||||
placeHolder: "$00.00",
|
||||
value: IObyID?.data?.goalAmount ? formatCurrency(IObyID?.data?.goalAmount) : "---",
|
||||
value: IObyID?.data?.goalAmount ? formatCurrency(removeTrailingZeros(IObyID?.data?.goalAmount)) : "---",
|
||||
name: "goalAmount",
|
||||
type: "number",
|
||||
isRequired: true,
|
||||
|
||||
@@ -29,6 +29,9 @@ import {
|
||||
useUpdateExchangeRateMutation,
|
||||
} from "../../../Services/exchange.rate.service";
|
||||
import ToastBox from "../../../Components/ToastBox";
|
||||
import { getTomorrowDate } from "../../../Constants/Constants";
|
||||
|
||||
|
||||
|
||||
// Convert date to YYYY-MM-DD format
|
||||
const formatDateValue = (date) => {
|
||||
@@ -73,9 +76,7 @@ const EditExchangeRate = ({ id, setIsLoading }) => {
|
||||
rate: rate,
|
||||
};
|
||||
const res = await updateExchange({ data, id });
|
||||
console.log(res?.data?.statusCode);
|
||||
if (res?.data?.statusCode === 200) {
|
||||
console.log("hit");
|
||||
toast({
|
||||
render: () => <ToastBox message={res?.data?.message} />,
|
||||
});
|
||||
@@ -88,7 +89,6 @@ const EditExchangeRate = ({ id, setIsLoading }) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
{" "}
|
||||
<Tooltip
|
||||
rounded={"sm"}
|
||||
fontSize={"xs"}
|
||||
@@ -158,10 +158,16 @@ const EditExchangeRate = ({ id, setIsLoading }) => {
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<FormControl mb={4}>
|
||||
<FormLabel fontSize={"sm"}>Last effective date</FormLabel>
|
||||
<Text color={'gray.500'} fontSize={"sm"}>
|
||||
{formatDate(foundObject?.effectiveFrom)}
|
||||
</Text>
|
||||
</FormControl>
|
||||
<FormControl mb={4}>
|
||||
<FormLabel fontSize={"sm"}>Effective from</FormLabel>
|
||||
<Text fontSize={"sm"}>
|
||||
{formatDate(foundObject?.effectiveFrom)}
|
||||
{formatDate(getTomorrowDate())}
|
||||
</Text>
|
||||
</FormControl>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Box, Image, Text } from '@chakra-ui/react'
|
||||
import React from 'react'
|
||||
// import noInternet from "../assets/Error.svg"
|
||||
import robot from "../assets/under-construction.png"
|
||||
import robot from "../assets/robot.png"
|
||||
|
||||
const UnderConstruction = ({title, h}) => {
|
||||
return (
|
||||
@@ -13,7 +13,7 @@ const UnderConstruction = ({title, h}) => {
|
||||
flexDirection={'column'}
|
||||
gap={8}
|
||||
>
|
||||
<Image src={robot} w={700} />
|
||||
<Image src={robot} w={200} />
|
||||
<Text color={'green.800'} as={'span'} mt={4} fontSize={'small'}>🚧 Building Something Amazing Just for You! 🚧</Text>
|
||||
</Box>
|
||||
)
|
||||
|
||||
@@ -9,7 +9,7 @@ import { baseQuery } from "./token.serivce";
|
||||
export const depositRequest = createApi({
|
||||
reducerPath: "depositRequest",
|
||||
baseQuery: baseQuery,
|
||||
tagTypes: ["getDepositRequest"],
|
||||
tagTypes: ["getDepositRequest", "getDepositHistory"],
|
||||
endpoints: (builder) => ({
|
||||
getDepositRequest: builder.query({
|
||||
query: () => `/deposit/admin/pending-requests`,
|
||||
@@ -26,7 +26,7 @@ export const depositRequest = createApi({
|
||||
method: "PATCH",
|
||||
body: data,
|
||||
}),
|
||||
invalidatesTags: ["getDepositRequest"],
|
||||
invalidatesTags: ["getDepositRequest", "getDepositHistory"],
|
||||
}),
|
||||
|
||||
depositReject: builder.mutation({
|
||||
@@ -35,12 +35,12 @@ export const depositRequest = createApi({
|
||||
method: "PATCH",
|
||||
body: data,
|
||||
}),
|
||||
invalidatesTags: ["getDepositRequest"],
|
||||
invalidatesTags: ["getDepositRequest", "getDepositHistory"],
|
||||
}),
|
||||
|
||||
getDepositHistory: builder.query({
|
||||
query: () => `/deposit/admin/history`,
|
||||
// providesTags: ["getDepositHistory"],
|
||||
providesTags: ["getDepositHistory"],
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -50,7 +50,7 @@ export const ioService = createApi({
|
||||
method: "PATCH",
|
||||
body: data,
|
||||
}),
|
||||
invalidatesTags: ["getIOById", "getIO"],
|
||||
invalidatesTags: ["getIOById", "getIO","prePopulate"],
|
||||
}),
|
||||
|
||||
// =====[Key Merits]
|
||||
|
||||
BIN
src/assets/commingsoon.png
Normal file
BIN
src/assets/commingsoon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 88 KiB |
Reference in New Issue
Block a user