Compare commits
14 Commits
sprint4
...
feature-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7012f2692 | ||
|
|
e07a92ba03 | ||
|
|
adb4bd5d27 | ||
| cfda3264fc | |||
|
|
1569afe4f0 | ||
|
|
4a3072b4d3 | ||
| 4516c70406 | |||
| 50f87869be | |||
| d69e4a203f | |||
| 6e4c794d2b | |||
| dfbc1ad338 | |||
| aa1c0c994a | |||
| 620b365437 | |||
| 2e5ecb967f |
2069
package-lock.json
generated
2069
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,11 @@
|
|||||||
/* font-family: "Lato", sans-serif !important; */
|
/* font-family: "Lato", sans-serif !important; */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::selection {
|
||||||
|
background-color: #004717; /* Change this to your desired color */
|
||||||
|
color: white; /* Optional: Change the text color */
|
||||||
|
}
|
||||||
|
|
||||||
.pointer {
|
.pointer {
|
||||||
cursor: pointer !important;
|
cursor: pointer !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,11 @@ import { Input } from "@chakra-ui/react";
|
|||||||
// };
|
// };
|
||||||
|
|
||||||
export const formatCurrency = (value) => {
|
export const formatCurrency = (value) => {
|
||||||
if (!value) return '';
|
if (value === undefined || value === null) return ''; // Handle undefined or null values
|
||||||
const [integer, decimal] = value?.split('.');
|
const [integer, decimal] = String(value).split('.'); // Convert value to string before splitting
|
||||||
const formattedInteger = integer?.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
const formattedInteger = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||||
return decimal ? `${formattedInteger}.${decimal}` : formattedInteger;
|
return decimal ? `${formattedInteger}.${decimal}` : formattedInteger;
|
||||||
};
|
};
|
||||||
|
|
||||||
const CurrencyInput = forwardRef(({ value, onChange, ...props }, ref) => {
|
const CurrencyInput = forwardRef(({ value, onChange, ...props }, ref) => {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ const FormField = ({
|
|||||||
w={6}
|
w={6}
|
||||||
h={6}
|
h={6}
|
||||||
src={
|
src={
|
||||||
" https://tanami.betadelivery.com/" +
|
import.meta.env.VITE_IMAGE_URL +
|
||||||
item?.logo
|
item?.logo
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const ImageViewer = ({ src, isOpen, onClose }) => {
|
|||||||
rounded={6}
|
rounded={6}
|
||||||
w={"100%"}
|
w={"100%"}
|
||||||
h={"100%"}
|
h={"100%"}
|
||||||
src={"https://tanami.betadelivery.com/" + src}
|
src={import.meta.env.VITE_IMAGE_URL + src}
|
||||||
/>
|
/>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
ModalHeader,
|
ModalHeader,
|
||||||
ModalOverlay,
|
ModalOverlay,
|
||||||
Progress,
|
Progress,
|
||||||
|
Spinner,
|
||||||
Stack,
|
Stack,
|
||||||
Text,
|
Text,
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
@@ -25,20 +26,26 @@ import { IoBatteryHalf } from "react-icons/io5";
|
|||||||
import { BiWifi } from "react-icons/bi";
|
import { BiWifi } from "react-icons/bi";
|
||||||
import { useGetIOByIdQuery } from "../Services/io.service";
|
import { useGetIOByIdQuery } from "../Services/io.service";
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
|
import FullscreenLoaders from "./Loaders/FullscreenLoaders";
|
||||||
|
import { formatDate } from "../Constants/Constants";
|
||||||
|
import { BsFileText } from "react-icons/bs";
|
||||||
|
|
||||||
const MobileView = ({ isOpen, onClose, finalRef }) => {
|
const MobileView = ({ isOpen, onClose, finalRef, actionId }) => {
|
||||||
const [time, setTime] = useState(new Date());
|
const [time, setTime] = useState(new Date());
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const id = params?.id;
|
const id = actionId;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data,
|
data: IObyID,
|
||||||
isLoading: IObyIDisLoading,
|
isLoading: IObyIDisLoading,
|
||||||
error: IObyIDerror,
|
error: IObyIDerror,
|
||||||
} = useGetIOByIdQuery(id, { skip: !id });
|
} = useGetIOByIdQuery(id, { skip: !id });
|
||||||
|
|
||||||
console.log(data);
|
console.log(IObyID);
|
||||||
|
|
||||||
|
const keyMerits = IObyID?.data?.keyMerits || [];
|
||||||
|
const artifactsImage = IObyID?.data?.artifactsImage || [];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timer = setInterval(() => {
|
const timer = setInterval(() => {
|
||||||
@@ -52,7 +59,7 @@ const MobileView = ({ isOpen, onClose, finalRef }) => {
|
|||||||
return date.toLocaleTimeString([], {
|
return date.toLocaleTimeString([], {
|
||||||
hour: "2-digit",
|
hour: "2-digit",
|
||||||
minute: "2-digit",
|
minute: "2-digit",
|
||||||
hour12: false,
|
hour12: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -79,7 +86,17 @@ const MobileView = ({ isOpen, onClose, finalRef }) => {
|
|||||||
display={"flex"}
|
display={"flex"}
|
||||||
justifyContent={"center"}
|
justifyContent={"center"}
|
||||||
h={"600px"}
|
h={"600px"}
|
||||||
w={"330px"}
|
w={"320px"}
|
||||||
|
sx={{
|
||||||
|
"@media (max-width: 2024px)": {
|
||||||
|
height:"695px",
|
||||||
|
width:"360px",
|
||||||
|
},
|
||||||
|
"@media (max-width: 1440px)": {
|
||||||
|
height:"600px",
|
||||||
|
width:"320px",
|
||||||
|
},
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Image
|
<Image
|
||||||
h={"100%"}
|
h={"100%"}
|
||||||
@@ -98,6 +115,21 @@ const MobileView = ({ isOpen, onClose, finalRef }) => {
|
|||||||
pt={"36px"}
|
pt={"36px"}
|
||||||
px={"15px"}
|
px={"15px"}
|
||||||
>
|
>
|
||||||
|
{IObyIDisLoading ? (
|
||||||
|
<Box
|
||||||
|
display={"flex"}
|
||||||
|
justifyContent={"center"}
|
||||||
|
alignItems={"center"}
|
||||||
|
h={"100%"}
|
||||||
|
>
|
||||||
|
<Spinner
|
||||||
|
thickness='3px'
|
||||||
|
color='purple.900'
|
||||||
|
size='lg'
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
<Box>
|
<Box>
|
||||||
<Box
|
<Box
|
||||||
display={"flex"}
|
display={"flex"}
|
||||||
@@ -140,6 +172,14 @@ const MobileView = ({ isOpen, onClose, finalRef }) => {
|
|||||||
position={"relative"}
|
position={"relative"}
|
||||||
borderBottomLeftRadius={"23px"}
|
borderBottomLeftRadius={"23px"}
|
||||||
borderBottomRightRadius={"23px"}
|
borderBottomRightRadius={"23px"}
|
||||||
|
sx={{
|
||||||
|
"@media (max-width: 2024px)": {
|
||||||
|
height:"575px",
|
||||||
|
},
|
||||||
|
"@media (max-width: 1440px)": {
|
||||||
|
height:"483px",
|
||||||
|
},
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
mb={4}
|
mb={4}
|
||||||
@@ -175,16 +215,21 @@ const MobileView = ({ isOpen, onClose, finalRef }) => {
|
|||||||
>
|
>
|
||||||
<LuClock color="#d8804e" />{" "}
|
<LuClock color="#d8804e" />{" "}
|
||||||
<Text mb={0} ml={1}>
|
<Text mb={0} ml={1}>
|
||||||
Closing Date Aug 23 2024
|
Closing Date {formatDate(IObyID?.data?.closingDate)}
|
||||||
</Text>
|
</Text>
|
||||||
</Text>
|
</Text>
|
||||||
|
{artifactsImage?.[0]?.artifactPathName && (
|
||||||
<Image
|
<Image
|
||||||
borderTopLeftRadius={"20px"}
|
borderTopLeftRadius={"20px"}
|
||||||
borderTopRightRadius={"20px"}
|
borderTopRightRadius={"20px"}
|
||||||
h={"130px"}
|
h={"130px"}
|
||||||
w={"100%"}
|
w={"100%"}
|
||||||
src={mobileBanner}
|
src={
|
||||||
|
"https://tanami.betadelivery.com/" +
|
||||||
|
artifactsImage[0]?.artifactPathName
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
<Stack mt="3" bg={"#fff"} py={4} px={4}>
|
<Stack mt="3" bg={"#fff"} py={4} px={4}>
|
||||||
<Text
|
<Text
|
||||||
@@ -193,10 +238,10 @@ const MobileView = ({ isOpen, onClose, finalRef }) => {
|
|||||||
color={"#000"}
|
color={"#000"}
|
||||||
mb={0}
|
mb={0}
|
||||||
>
|
>
|
||||||
Guinevere Gates
|
{IObyID?.data?.investmentType?.investmentTypeName}
|
||||||
</Text>
|
</Text>
|
||||||
<Heading fontSize="16px" color={"#004717"}>
|
<Heading fontSize="16px" color={"#004717"}>
|
||||||
BHD 46,258
|
BHD {IObyID?.data?.goalAmount}
|
||||||
</Heading>
|
</Heading>
|
||||||
<Progress
|
<Progress
|
||||||
colorScheme="green"
|
colorScheme="green"
|
||||||
@@ -218,60 +263,63 @@ const MobileView = ({ isOpen, onClose, finalRef }) => {
|
|||||||
mb={0}
|
mb={0}
|
||||||
color={"#9d9d9d"}
|
color={"#9d9d9d"}
|
||||||
>
|
>
|
||||||
fugit eligendi dolore dolore et
|
{IObyID?.data?.descriptionEnglish}
|
||||||
</Text>
|
</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Box py={4} px={4}>
|
<Box py={4} px={4}>
|
||||||
<Box display={"flex"} justifyContent={"space-between"}>
|
<Box display={"flex"} justifyContent={"space-between"}>
|
||||||
<Text
|
<Text
|
||||||
fontSize={"10px"}
|
fontSize={"xs"}
|
||||||
mb={1}
|
mb={1}
|
||||||
fontWeight={600}
|
fontWeight={500}
|
||||||
color={"#616161"}
|
color={"#616161"}
|
||||||
>
|
>
|
||||||
Sponsor name:
|
Sponsor name:
|
||||||
</Text>
|
</Text>
|
||||||
<Text fontSize={"10px"} mb={1} fontWeight={600}>
|
<Text fontSize={"xs"} mb={1} fontWeight={500}>
|
||||||
Scott Simon
|
{IObyID?.data?.sponsor?.sponsorName}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
<Box display={"flex"} justifyContent={"space-between"}>
|
<Box display={"flex"} justifyContent={"space-between"}>
|
||||||
<Text
|
<Text
|
||||||
fontSize={"10px"}
|
fontSize={"xs"}
|
||||||
mb={1}
|
mb={1}
|
||||||
fontWeight={600}
|
fontWeight={500}
|
||||||
color={"#616161"}
|
color={"#616161"}
|
||||||
>
|
>
|
||||||
Estimated return:
|
Estimated return:
|
||||||
</Text>
|
</Text>
|
||||||
<Text fontSize={"10px"} mb={1} fontWeight={600}>
|
<Text fontSize={"xs"} mb={1} fontWeight={500}>
|
||||||
A provident veniam
|
{IObyID?.data?.expectedReturn}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
<Box display={"flex"} justifyContent={"space-between"}>
|
<Box display={"flex"} justifyContent={"space-between"}>
|
||||||
<Text
|
<Text
|
||||||
fontSize={"10px"}
|
fontSize={"xs"}
|
||||||
mb={1}
|
mb={1}
|
||||||
fontWeight={600}
|
fontWeight={500}
|
||||||
color={"#616161"}
|
color={"#616161"}
|
||||||
>
|
>
|
||||||
Hoiding period:
|
Hoiding period:
|
||||||
</Text>
|
</Text>
|
||||||
<Text fontSize={"10px"} mb={1} fontWeight={600}>
|
<Text fontSize={"xs"} mb={1} fontWeight={500}>
|
||||||
Eius eiusmod exericit
|
{IObyID?.data?.holdingPeriod}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
<Box display={"flex"} justifyContent={"space-between"}>
|
<Box display={"flex"} justifyContent={"space-between"}>
|
||||||
<Text
|
<Text
|
||||||
fontSize={"10px"}
|
fontSize={"xs"}
|
||||||
mb={1}
|
mb={1}
|
||||||
fontWeight={600}
|
fontWeight={500}
|
||||||
color={"#616161"}
|
color={"#616161"}
|
||||||
>
|
>
|
||||||
Minimum investment:
|
Minimum investment:
|
||||||
</Text>
|
</Text>
|
||||||
<Text fontSize={"10px"} mb={1} fontWeight={600}>
|
<Text fontSize={"xs"} mb={1} fontWeight={500}>
|
||||||
BHD 1
|
{
|
||||||
|
IObyID?.data?.minInvestmentAmt?.[0]?.country
|
||||||
|
?.minInvestmentAmt
|
||||||
|
}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
@@ -287,13 +335,23 @@ const MobileView = ({ isOpen, onClose, finalRef }) => {
|
|||||||
Key Merits
|
Key Merits
|
||||||
</Heading>
|
</Heading>
|
||||||
<Box display={"flex"} alignItems={"center"}>
|
<Box display={"flex"} alignItems={"center"}>
|
||||||
|
{keyMerits?.[0]?.icon?.iconFilePath && (
|
||||||
<Image
|
<Image
|
||||||
width={"30px"}
|
rounded={"md"}
|
||||||
me={2}
|
display={"flex"}
|
||||||
src="https://tanami.betadelivery.com/public/icons/icon3.svg"
|
p={1}
|
||||||
|
justifyContent={"center"}
|
||||||
|
alignItems={"center"}
|
||||||
|
src={
|
||||||
|
"https://tanami.betadelivery.com/" +
|
||||||
|
keyMerits[0].icon.iconFilePath
|
||||||
|
}
|
||||||
|
w={8}
|
||||||
|
h={8}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
<Text fontSize={"xs"} mb={0}>
|
<Text fontSize={"xs"} mb={0}>
|
||||||
Sit sunt consequunt Dolores minim suscip
|
{IObyID?.data?.keyMerits[0]?.meritsDescription}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
@@ -306,14 +364,20 @@ const MobileView = ({ isOpen, onClose, finalRef }) => {
|
|||||||
<Heading fontSize="14px" fontWeight={600}>
|
<Heading fontSize="14px" fontWeight={600}>
|
||||||
Investment Documents
|
Investment Documents
|
||||||
</Heading>
|
</Heading>
|
||||||
<Box bg={"#f5f8f6"} w={"150px"} p={3} borderRadius={"10px"}>
|
<Box
|
||||||
|
bg={"#f5f8f6"}
|
||||||
|
w={"150px"}
|
||||||
|
p={3}
|
||||||
|
borderRadius={"10px"}
|
||||||
|
>
|
||||||
<Box display={"flex"} alignItems={"center"} mb={2}>
|
<Box display={"flex"} alignItems={"center"} mb={2}>
|
||||||
<Image
|
{/* <Image
|
||||||
me={1}
|
me={1}
|
||||||
src="https://tanami.betadelivery.com/public/icons/icon8.svg"
|
src="https://tanami.betadelivery.com/public/icons/icon8.svg"
|
||||||
/>
|
/> */}
|
||||||
<Text fontSize={"xs"} mb={0}>
|
<BsFileText color="forestGreen" fontSize="18px" />
|
||||||
Merrill Rocha
|
<Text fontSize={"xs"} mb={0} ml={2}>
|
||||||
|
{IObyID?.data?.documents?.[0]?.documentName}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
@@ -322,7 +386,7 @@ const MobileView = ({ isOpen, onClose, finalRef }) => {
|
|||||||
justifyContent={"space-between"}
|
justifyContent={"space-between"}
|
||||||
>
|
>
|
||||||
<Text mb={0} fontSize={"sm"}>
|
<Text mb={0} fontSize={"sm"}>
|
||||||
0.03 mb
|
{IObyID?.data?.documents?.[0]?.documentSize}
|
||||||
</Text>
|
</Text>
|
||||||
<GrDownload fontSize={"15px"} />
|
<GrDownload fontSize={"15px"} />
|
||||||
</Box>
|
</Box>
|
||||||
@@ -337,12 +401,25 @@ const MobileView = ({ isOpen, onClose, finalRef }) => {
|
|||||||
<Heading fontSize="14px" fontWeight={600}>
|
<Heading fontSize="14px" fontWeight={600}>
|
||||||
Videos
|
Videos
|
||||||
</Heading>
|
</Heading>
|
||||||
<video autoPlay style={{ borderRadius: "18px" }}>
|
<video
|
||||||
|
autoPlay
|
||||||
|
loop
|
||||||
|
controls
|
||||||
|
style={{
|
||||||
|
borderRadius: "18px",
|
||||||
|
width: "100%",
|
||||||
|
height: "auto",
|
||||||
|
}}
|
||||||
|
>
|
||||||
<source
|
<source
|
||||||
src="https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4"
|
src={
|
||||||
|
IObyID?.data?.artifactsVideo?.[0]
|
||||||
|
?.artifactStreamingURL
|
||||||
|
}
|
||||||
type="video/mp4"
|
type="video/mp4"
|
||||||
style={{ height: "200px" }}
|
style={{ height: "200px" }}
|
||||||
/>
|
/>
|
||||||
|
Your browser does not support the video tag.
|
||||||
</video>
|
</video>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
@@ -370,6 +447,8 @@ const MobileView = ({ isOpen, onClose, finalRef }) => {
|
|||||||
Invest
|
Invest
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</HStack>
|
</HStack>
|
||||||
|
|||||||
@@ -130,3 +130,10 @@ export function formatTimestampInGulfTimezone(timestamp) {
|
|||||||
};
|
};
|
||||||
return date.toLocaleDateString('en-GB', options);
|
return date.toLocaleDateString('en-GB', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function formatDate(dateString) {
|
||||||
|
const options = { year: 'numeric', month: 'short', day: 'numeric' };
|
||||||
|
const date = new Date(dateString);
|
||||||
|
return date.toLocaleDateString('en-US', options);
|
||||||
|
}
|
||||||
@@ -36,7 +36,6 @@ import { useGetDepositRequestQuery } from "../../../Services/deposit.request.ser
|
|||||||
import { current } from "@reduxjs/toolkit";
|
import { current } from "@reduxjs/toolkit";
|
||||||
import { TABLE_PAGINATION } from "../../../Constants/Paginations";
|
import { TABLE_PAGINATION } from "../../../Constants/Paginations";
|
||||||
import { removeTrailingZeros } from "../../../Constants/Constants";
|
import { removeTrailingZeros } from "../../../Constants/Constants";
|
||||||
import { formatCurrency } from "../../../Components/CurrencyInput";
|
|
||||||
|
|
||||||
const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter
|
const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter
|
||||||
|
|
||||||
@@ -179,7 +178,9 @@ const DepositRequest = () => {
|
|||||||
"Amount in Investor currency": (
|
"Amount in Investor currency": (
|
||||||
<Box display={'flex'} justifyContent={'end'} w={"100px"} isTruncated={true}>
|
<Box display={'flex'} justifyContent={'end'} w={"100px"} isTruncated={true}>
|
||||||
<Text as={"span"} color={"teal.900"}>
|
<Text as={"span"} color={"teal.900"}>
|
||||||
{formatCurrency(removeTrailingZeros(item?.investorAmount))} <Badge ms={1} colorScheme="green">{item?.currencyCode}</Badge>
|
{/* {formatCurrency(removeTrailingZeros(item?.investorAmount))} */}
|
||||||
|
{parseFloat(item?.investorAmount||0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
|
||||||
|
<Badge ms={1} colorScheme="green">{item?.currencyCode}</Badge>
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
Badge,
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
FormControl,
|
FormControl,
|
||||||
@@ -137,7 +138,7 @@ const DepositRequestApprove = ({ isOpen, onClose, firstField, id, data:requestDa
|
|||||||
<Box as="form" onSubmit={handleSubmit(onSubmit)}>
|
<Box as="form" onSubmit={handleSubmit(onSubmit)}>
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<FormControl mb={4} isRequired>
|
<FormControl mb={4} isRequired>
|
||||||
<FormLabel fontSize="sm">Deposit Amount (SAR)</FormLabel>
|
<FormLabel fontSize="sm">Deposit Amount <Badge colorScheme="green">{fileredData?.currencyCode}</Badge></FormLabel>
|
||||||
<Input
|
<Input
|
||||||
focusBorderColor="green.400"
|
focusBorderColor="green.400"
|
||||||
name="investorAmount"
|
name="investorAmount"
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ const filteredData = data?.data?.rows
|
|||||||
colorScheme={"forestGreen"}
|
colorScheme={"forestGreen"}
|
||||||
>
|
>
|
||||||
<Link
|
<Link
|
||||||
href={"https://tanami.betadelivery.com/" + item?.supporting_FileName}
|
href={import.meta.env.VITE_IMAGE_URL + item?.supporting_FileName}
|
||||||
isExternal
|
isExternal
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
|
|||||||
@@ -113,7 +113,9 @@ const AddCashDetails = ({ isOpen, onClose, firstField, actionId, setActionId, da
|
|||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
setAlert(false)
|
setAlert(false)
|
||||||
onClose()
|
onClose()
|
||||||
reset()
|
reset({
|
||||||
|
transactionAmount:""
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ const IOArtifacts = ({ enableNextTab, index, data }) => {
|
|||||||
colorScheme={"forestGreen"}
|
colorScheme={"forestGreen"}
|
||||||
>
|
>
|
||||||
<Link
|
<Link
|
||||||
href={"https://tanami.betadelivery.com/" + item?.artifactPathName}
|
href={import.meta.env.VITE_IMAGE_URL + item?.artifactPathName}
|
||||||
isExternal
|
isExternal
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ const IOCashDetails = () => {
|
|||||||
const searchLower = searchTerm.toLowerCase();
|
const searchLower = searchTerm.toLowerCase();
|
||||||
const nameMatches = name.toLowerCase().includes(searchLower);
|
const nameMatches = name.toLowerCase().includes(searchLower);
|
||||||
return nameMatches;
|
return nameMatches;
|
||||||
});
|
}).sort((b, a) => new Date(a.createdAt) - new Date(b.createdAt));
|
||||||
|
|
||||||
|
|
||||||
const extractedArray = filteredData?.map((item, index) => ({
|
const extractedArray = filteredData?.map((item, index) => ({
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ const IONAVDetails = () => {
|
|||||||
const searchLower = searchTerm.toLowerCase();
|
const searchLower = searchTerm.toLowerCase();
|
||||||
const nameMatches = name.toLowerCase().includes(searchLower);
|
const nameMatches = name.toLowerCase().includes(searchLower);
|
||||||
return nameMatches;
|
return nameMatches;
|
||||||
});
|
}).sort((b, a) => new Date(a.transactionDate) - new Date(b.transactionDate));
|
||||||
|
|
||||||
const extractedArray=filteredData?.map((item, index) => ({
|
const extractedArray=filteredData?.map((item, index) => ({
|
||||||
id: item?.id,
|
id: item?.id,
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import SetDisplayOrder from "./SetDisplayOrder";
|
|||||||
|
|
||||||
const downloadFile = (filePath, fileName) => {
|
const downloadFile = (filePath, fileName) => {
|
||||||
|
|
||||||
fetch("https://tanami.betadelivery.com/" + filePath)
|
fetch(import.meta.env.VITE_IMAGE_URL+filePath)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error("Network response was not ok");
|
throw new Error("Network response was not ok");
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ const KeyMerits = ({ enableNextTab, index, data: prepopData }) => {
|
|||||||
const [isBtnLoading, setIsBtnLoading] = useState(false);
|
const [isBtnLoading, setIsBtnLoading] = useState(false);
|
||||||
const [mouseEnteredId, setMouseEnteredId] = useState("");
|
const [mouseEnteredId, setMouseEnteredId] = useState("");
|
||||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isOpen: isEditOpen,
|
isOpen: isEditOpen,
|
||||||
onOpen: onEditOpen,
|
onOpen: onEditOpen,
|
||||||
@@ -135,7 +136,7 @@ const KeyMerits = ({ enableNextTab, index, data: prepopData }) => {
|
|||||||
p={1}
|
p={1}
|
||||||
justifyContent={"center"}
|
justifyContent={"center"}
|
||||||
alignItems={"center"}
|
alignItems={"center"}
|
||||||
src={" https://tanami.betadelivery.com/" + item?.icon?.iconFilePath}
|
src={import.meta.env.VITE_IMAGE_URL+ item?.icon?.iconFilePath}
|
||||||
w={8}
|
w={8}
|
||||||
h={8}
|
h={8}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ const SetDisplayOrder = ({ data }) => {
|
|||||||
p={1}
|
p={1}
|
||||||
justifyContent={"center"}
|
justifyContent={"center"}
|
||||||
alignItems={"center"}
|
alignItems={"center"}
|
||||||
src={"https://tanami.betadelivery.com/" + item?.icon?.iconFilePath}
|
src={import.meta.env.VITE_IMAGE_URL + item?.icon?.iconFilePath}
|
||||||
w={8}
|
w={8}
|
||||||
h={8}
|
h={8}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ const IOArtifactsAdd = ({
|
|||||||
<Image
|
<Image
|
||||||
rounded={"md"}
|
rounded={"md"}
|
||||||
src={
|
src={
|
||||||
"https://tanami.betadelivery.com/" +
|
import.meta.env.VITE_IMAGE_URL +
|
||||||
watch()?.artifactPathName
|
watch()?.artifactPathName
|
||||||
}
|
}
|
||||||
alt="Image Preview"
|
alt="Image Preview"
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
|
|||||||
>
|
>
|
||||||
<Box display="flex" alignItems="center">
|
<Box display="flex" alignItems="center">
|
||||||
{selectedImageIcon && <Image
|
{selectedImageIcon && <Image
|
||||||
src={`https://tanami.betadelivery.com/${selectedImageIcon}`}
|
src={`${import.meta.env.VITE_IMAGE_URL}${selectedImageIcon}`}
|
||||||
alt={selectedImageIcon}
|
alt={selectedImageIcon}
|
||||||
boxSize="1rem"
|
boxSize="1rem"
|
||||||
mr="12px"
|
mr="12px"
|
||||||
@@ -305,7 +305,7 @@ const KeyMeritsAdd = ({ isOpen, onClose, firstField, id, icons }) => {
|
|||||||
>
|
>
|
||||||
<Box display="flex" alignItems="center">
|
<Box display="flex" alignItems="center">
|
||||||
<Image
|
<Image
|
||||||
src={`https://tanami.betadelivery.com/${iconFilePath}`}
|
src={`${import.meta.env.VITE_IMAGE_URL}${iconFilePath}`}
|
||||||
alt={iconName}
|
alt={iconName}
|
||||||
boxSize="1rem"
|
boxSize="1rem"
|
||||||
mr="12px"
|
mr="12px"
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ const KeyMeritsEdit = ({
|
|||||||
>
|
>
|
||||||
<Box display="flex" alignItems="center">
|
<Box display="flex" alignItems="center">
|
||||||
{selectedImageIcon&&<Image
|
{selectedImageIcon&&<Image
|
||||||
src={`https://tanami.betadelivery.com/${selectedImageIcon}`}
|
src={`${import.meta.env.VITE_IMAGE_URL}${selectedImageIcon}`}
|
||||||
alt={selectedImageIcon}
|
alt={selectedImageIcon}
|
||||||
boxSize="1rem"
|
boxSize="1rem"
|
||||||
mr="12px"
|
mr="12px"
|
||||||
@@ -304,7 +304,7 @@ const KeyMeritsEdit = ({
|
|||||||
>
|
>
|
||||||
<Box display="flex" alignItems="center">
|
<Box display="flex" alignItems="center">
|
||||||
<Image
|
<Image
|
||||||
src={`https://tanami.betadelivery.com/${iconFilePath}`}
|
src={`${import.meta.env.VITE_IMAGE_URL}${iconFilePath}`}
|
||||||
alt={iconName}
|
alt={iconName}
|
||||||
boxSize="1rem"
|
boxSize="1rem"
|
||||||
mr="12px"
|
mr="12px"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import {
|
|||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
FormControl,
|
FormControl,
|
||||||
|
FormErrorMessage,
|
||||||
FormLabel,
|
FormLabel,
|
||||||
HStack,
|
HStack,
|
||||||
Input,
|
Input,
|
||||||
@@ -23,8 +24,61 @@ import {
|
|||||||
import DataTable from "../../../../Components/DataTable/DataTable";
|
import DataTable from "../../../../Components/DataTable/DataTable";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { AddIcon } from "@chakra-ui/icons";
|
import { AddIcon } from "@chakra-ui/icons";
|
||||||
|
import { useGetDistributionInvestorMutation } from "../../../../Services/io.service";
|
||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
import { Controller, useForm } from "react-hook-form";
|
||||||
|
import * as yup from "yup";
|
||||||
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
|
|
||||||
|
|
||||||
|
export const investor = yup.object().shape({
|
||||||
|
amount: yup.string().required("Amount is required"),
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const DistributionInvestor = ({ isOpen, onClose, }) => {
|
||||||
|
|
||||||
|
|
||||||
|
const params = useParams()
|
||||||
|
const id = params?.id
|
||||||
|
|
||||||
|
// const {
|
||||||
|
// data:IObyID,
|
||||||
|
// error,
|
||||||
|
// isLoading,
|
||||||
|
// } = useGetDistributionInvestorMutation(id);
|
||||||
|
|
||||||
|
const [ getDistributionInvestment ] = useGetDistributionInvestorMutation()
|
||||||
|
|
||||||
|
const {
|
||||||
|
control,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { errors },
|
||||||
|
reset,
|
||||||
|
} = useForm({
|
||||||
|
resolver: yupResolver(investor),
|
||||||
|
});
|
||||||
|
|
||||||
|
// useEffect(()=>{
|
||||||
|
// try {
|
||||||
|
// const res = getDistributionInvestment({id,data})
|
||||||
|
// console.log(res);
|
||||||
|
|
||||||
|
// } catch (error) {
|
||||||
|
|
||||||
|
// }
|
||||||
|
// },[])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// console.log(IObyID);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const DistributionInvestor = ({ isOpen, onClose }) => {
|
|
||||||
// ====================================================[Table Setup]================================================================
|
// ====================================================[Table Setup]================================================================
|
||||||
const tableHeadRow = [
|
const tableHeadRow = [
|
||||||
"Sr No.",
|
"Sr No.",
|
||||||
@@ -205,22 +259,48 @@ const DistributionInvestor = ({ isOpen, onClose }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const onSubmit = (data) =>{
|
||||||
|
console.log( data );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal size={"xl"} isOpen={isOpen} onClose={onClose}>
|
<Modal size={"xl"} isOpen={isOpen} onClose={onClose}>
|
||||||
<ModalOverlay />
|
<ModalOverlay />
|
||||||
<ModalContent maxW={1000}>
|
<ModalContent maxW={1000}>
|
||||||
<ModalHeader fontSize={"md"}>Distribution To Investor Transaction</ModalHeader>
|
<ModalHeader fontSize={"md"}>
|
||||||
|
Distribution To Investor Transaction
|
||||||
|
</ModalHeader>
|
||||||
<ModalCloseButton />
|
<ModalCloseButton />
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<Text as="label" mb='5px' fontSize='sm' fontWeight={500}>Amount to Distribute</Text>
|
{/* <Text as="label" mb="5px" fontSize="sm" fontWeight={500}>
|
||||||
<HStack mb={4}>
|
Amount to Distribute
|
||||||
<Input placeholder="$00.00" size={"sm"} className="col" />
|
</Text> */}
|
||||||
|
<HStack onSubmit={handleSubmit(onSubmit)} as={"form"} mb={4}>
|
||||||
{/* <Input placeholder="$00.00" size={"sm"} className="col" /> */}
|
{/* <Input placeholder="$00.00" size={"sm"} className="col" /> */}
|
||||||
|
<FormControl isInvalid={errors.amount}>
|
||||||
|
<FormLabel fontSize={"sm"}> Amount to Distribute</FormLabel>
|
||||||
|
<Controller
|
||||||
|
name="amount"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<Input {...field} fontSize={"sm"} type="number" size={"sm"} textAlign={"right"} />
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<FormErrorMessage fontSize={"xs"} fontWeight={500}>
|
||||||
|
{errors.amount?.message}
|
||||||
|
</FormErrorMessage>
|
||||||
|
</FormControl>
|
||||||
<Button
|
<Button
|
||||||
// leftIcon={<AddIcon />}
|
// leftIcon={<AddIcon />}
|
||||||
size={"sm"}
|
size={"sm"}
|
||||||
rounded={"sm"}
|
rounded={"sm"}
|
||||||
colorScheme="forestGreen"
|
colorScheme="forestGreen"
|
||||||
|
type="submit"
|
||||||
>
|
>
|
||||||
Calculate
|
Calculate
|
||||||
</Button>
|
</Button>
|
||||||
@@ -243,14 +323,12 @@ const DistributionInvestor = ({ isOpen, onClose }) => {
|
|||||||
_hover={{
|
_hover={{
|
||||||
bg: "hsl(139deg 98.99% 26.59%)",
|
bg: "hsl(139deg 98.99% 26.59%)",
|
||||||
}}
|
}}
|
||||||
size={'sm'}
|
size={"sm"}
|
||||||
rounded={"sm"}
|
rounded={"sm"}
|
||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button size={"sm"} rounded={"sm"} mr={3} onClick={onClose}>
|
||||||
size={'sm'}
|
|
||||||
rounded={"sm"} mr={3} onClick={onClose}>
|
|
||||||
Close
|
Close
|
||||||
</Button>
|
</Button>
|
||||||
</ModalFooter>
|
</ModalFooter>
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ const ViewIOTable = () => {
|
|||||||
"Goal Amount",
|
"Goal Amount",
|
||||||
"Holding Period",
|
"Holding Period",
|
||||||
"IO Status",
|
"IO Status",
|
||||||
// "Preview",
|
"Preview",
|
||||||
"Action",
|
"Action",
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -189,18 +189,22 @@ const ViewIOTable = () => {
|
|||||||
),
|
),
|
||||||
Preview: (
|
Preview: (
|
||||||
<Box display={"flex"} justifyContent={"start"}>
|
<Box display={"flex"} justifyContent={"start"}>
|
||||||
<Button
|
<Badge
|
||||||
// _hover={{ color: "green.500" }}
|
display={"flex"} px={2} py={1} alignItems={"center"}
|
||||||
|
color={"#000"}
|
||||||
|
fontWeight={500}
|
||||||
bg="purple.200"
|
bg="purple.200"
|
||||||
// transition={"0.5s all"}
|
onClick={() =>{
|
||||||
onClick={onOpen}
|
setActionId(item.id)
|
||||||
// color="green.300"
|
onOpen();
|
||||||
rounded={"md"}
|
}}
|
||||||
|
rounded={"sm"}
|
||||||
size={"xs"}
|
size={"xs"}
|
||||||
variant={"ghost"}
|
variant={"ghost"}
|
||||||
|
cursor={"pointer"}
|
||||||
>
|
>
|
||||||
<ImMobile className="me-1" /> View
|
<ImMobile className="me-1" /> View
|
||||||
</Button>
|
</Badge>
|
||||||
</Box>
|
</Box>
|
||||||
),
|
),
|
||||||
Action: (
|
Action: (
|
||||||
@@ -363,7 +367,7 @@ const ViewIOTable = () => {
|
|||||||
setMouseEntered={setMouseEntered}
|
setMouseEntered={setMouseEntered}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<MobileView isOpen={isOpen} onClose={onClose} />
|
<MobileView isOpen={isOpen} onClose={onClose} actionId={actionId} />
|
||||||
|
|
||||||
<CustomAlertDialog
|
<CustomAlertDialog
|
||||||
onClose={() => setDeleteAlert(false)}
|
onClose={() => setDeleteAlert(false)}
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ import Cancle from "./HeaderModal/Cancle";
|
|||||||
import { AddIcon } from "@chakra-ui/icons";
|
import { AddIcon } from "@chakra-ui/icons";
|
||||||
import { GrGallery } from "react-icons/gr";
|
import { GrGallery } from "react-icons/gr";
|
||||||
import Loader01 from "../../../Components/Loaders/Loader01";
|
import Loader01 from "../../../Components/Loaders/Loader01";
|
||||||
import { formatCurrency } from "../../../Components/CurrencyInput";
|
// import { formatCurrency } from "../../../Components/CurrencyInput";
|
||||||
import { removeTrailingZeros } from "../../../Constants/Constants";
|
// import { removeTrailingZeros } from "../../../Constants/Constants";
|
||||||
|
|
||||||
const ViewIOdataHeader = ({data, isLoading}) => {
|
const ViewIOdataHeader = ({data, isLoading}) => {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
@@ -51,6 +51,7 @@ const ViewIOdataHeader = ({data, isLoading}) => {
|
|||||||
const btnRef = useRef();
|
const btnRef = useRef();
|
||||||
const { IODetails, isIOloading } = useContext(GlobalStateContext);
|
const { IODetails, isIOloading } = useContext(GlobalStateContext);
|
||||||
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isOpen: isInvestmentOpen,
|
isOpen: isInvestmentOpen,
|
||||||
onOpen: onInvestmentOpen,
|
onOpen: onInvestmentOpen,
|
||||||
@@ -104,6 +105,10 @@ const ViewIOdataHeader = ({data, isLoading}) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
console.log(import.meta.env.VITE_IMAGE_URL +
|
||||||
|
IODetails?.artifactsImage?.[0]?.artifactPathName);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const menu = [
|
const menu = [
|
||||||
{
|
{
|
||||||
@@ -208,7 +213,7 @@ const filteredMenu = menu?.filter(item => apiTransactionTitles?.includes(item.id
|
|||||||
w={"100%"}
|
w={"100%"}
|
||||||
objectFit={"cover"}
|
objectFit={"cover"}
|
||||||
src={
|
src={
|
||||||
" https://tanami.betadelivery.com/" +
|
import.meta.env.VITE_IMAGE_URL +
|
||||||
IODetails?.artifactsImage?.[0]?.artifactPathName
|
IODetails?.artifactsImage?.[0]?.artifactPathName
|
||||||
}
|
}
|
||||||
alt={IODetails?.ioName}
|
alt={IODetails?.ioName}
|
||||||
@@ -294,7 +299,8 @@ const filteredMenu = menu?.filter(item => apiTransactionTitles?.includes(item.id
|
|||||||
IO MV
|
IO MV
|
||||||
</Text>
|
</Text>
|
||||||
<Text as={"span"} fontSize={"sm"} fontWeight={"500"}>
|
<Text as={"span"} fontSize={"sm"} fontWeight={"500"}>
|
||||||
{IODetails?.ioNAV ? formatCurrency(removeTrailingZeros(IODetails?.ioNAV)) : "00.00"}
|
{/* {IODetails?.ioNAV ? formatCurrency(removeTrailingZeros(IODetails?.ioNAV)) : "00.00"} */}
|
||||||
|
{parseFloat(IODetails?.ioNAV||0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
@@ -303,7 +309,8 @@ const filteredMenu = menu?.filter(item => apiTransactionTitles?.includes(item.id
|
|||||||
IO cash
|
IO cash
|
||||||
</Text>
|
</Text>
|
||||||
<Text as={"span"} fontSize={"sm"} fontWeight={"500"}>
|
<Text as={"span"} fontSize={"sm"} fontWeight={"500"}>
|
||||||
{IODetails?.ioCash ? formatCurrency(removeTrailingZeros(IODetails?.ioCash)) : "00.00"}
|
{/* {IODetails?.ioCash ? formatCurrency(removeTrailingZeros(IODetails?.ioCash)) : "00.00"} */}
|
||||||
|
{parseFloat(IODetails?.ioCash||0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
@@ -312,7 +319,8 @@ const filteredMenu = menu?.filter(item => apiTransactionTitles?.includes(item.id
|
|||||||
IO NAV
|
IO NAV
|
||||||
</Text>
|
</Text>
|
||||||
<Text as={"span"} fontSize={"sm"} fontWeight={"500"}>
|
<Text as={"span"} fontSize={"sm"} fontWeight={"500"}>
|
||||||
{IODetails?.ioMVNAV ? formatCurrency(removeTrailingZeros(IODetails?.ioMVNAV)) : "00.00"}
|
{/* {IODetails?.ioMVNAV ? formatCurrency(removeTrailingZeros(IODetails?.ioMVNAV)) : "00.00"} */}
|
||||||
|
{parseFloat(IODetails?.ioMVNAV||0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
|||||||
@@ -263,7 +263,8 @@ const ViewIOdetails = () => {
|
|||||||
{
|
{
|
||||||
label: "Goal Amount",
|
label: "Goal Amount",
|
||||||
placeHolder: "$00.00",
|
placeHolder: "$00.00",
|
||||||
value: IObyID?.data?.goalAmount ? formatCurrency(removeTrailingZeros(IObyID?.data?.goalAmount)) : "---",
|
value: IObyID?.data?.goalAmount?parseFloat(IObyID?.data?.goalAmount||0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) : "---",
|
||||||
|
|
||||||
name: "goalAmount",
|
name: "goalAmount",
|
||||||
type: "number",
|
type: "number",
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import axios from "axios";
|
|||||||
// Create an Axios instance for API calls
|
// Create an Axios instance for API calls
|
||||||
export const api = axios.create({
|
export const api = axios.create({
|
||||||
// baseURL: `https://tanami.betadelivery.com/api/v1`,
|
// baseURL: `https://tanami.betadelivery.com/api/v1`,
|
||||||
baseURL: `https://admin.tanami.betadelivery.com/api/v1`, // Replace with your API base URL
|
baseURL: import.meta.env.VITE_BAS_URL, // Replace with your API base URL
|
||||||
timeout: 10000, // Adjust timeout as needed
|
timeout: 10000, // Adjust timeout as needed
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
|||||||
101
src/Services/deposite.service.js
Normal file
101
src/Services/deposite.service.js
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
//sponser.service
|
||||||
|
// Need to use the React-specific entry point to import createApi
|
||||||
|
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
|
||||||
|
import { api } from "./api.service";
|
||||||
|
|
||||||
|
const baseUrl = api?.defaults.baseURL;
|
||||||
|
|
||||||
|
// const baseUrl = `${import.meta.env.VITE_API_BASE_URL}/${import.meta.env.VITE_API_VERSION}`
|
||||||
|
|
||||||
|
// Define a service using a base URL and expected endpoints
|
||||||
|
export const deposite = createApi({
|
||||||
|
reducerPath: "deposite",
|
||||||
|
baseQuery: fetchBaseQuery({ baseUrl: baseUrl }),
|
||||||
|
tagTypes: ["gtDeposite"],
|
||||||
|
endpoints: (builder) => ({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ======[Get All]=====
|
||||||
|
|
||||||
|
getSponserMaster: builder.query({
|
||||||
|
query: ({ page, size }) => `/sponsor/admin?page=${page}&size=${size}`,
|
||||||
|
providesTags: ["getSponser"],
|
||||||
|
}),
|
||||||
|
|
||||||
|
|
||||||
|
// ========[Get Active]========
|
||||||
|
|
||||||
|
getActiveSponserMaster: builder.query({
|
||||||
|
query: () => `/sponsor/admin/active`,
|
||||||
|
providesTags: ["getSponser"],
|
||||||
|
}),
|
||||||
|
|
||||||
|
getSponserMasterActive: builder.query({
|
||||||
|
query: () => "/sponsor/admin/active",
|
||||||
|
}),
|
||||||
|
|
||||||
|
|
||||||
|
// ======[Get ID]=====
|
||||||
|
|
||||||
|
getSponserById: builder.query({
|
||||||
|
query: (id) => `/sponsor/admin/${id}`,
|
||||||
|
providesTags: ["getSponser"],
|
||||||
|
}),
|
||||||
|
|
||||||
|
// ========[Toggle Status]========
|
||||||
|
|
||||||
|
toggleStatus: builder.mutation({
|
||||||
|
query: ({ id }) => ({
|
||||||
|
url: `/sponsor/admin/toggle-status/${id}`,
|
||||||
|
method: "PATCH",
|
||||||
|
}),
|
||||||
|
invalidatesTags: ["getSponser"],
|
||||||
|
}),
|
||||||
|
|
||||||
|
// ========[Create Sponser]========
|
||||||
|
|
||||||
|
createSponser: builder.mutation({
|
||||||
|
query: (data) => ({
|
||||||
|
url: `/sponsor/admin`,
|
||||||
|
method: "POST",
|
||||||
|
body: data,
|
||||||
|
}),
|
||||||
|
invalidatesTags: ["getSponser"],
|
||||||
|
}),
|
||||||
|
|
||||||
|
// ========[Update Sponser]========
|
||||||
|
|
||||||
|
updateSponser: builder.mutation({
|
||||||
|
query: ({ data, id }) => ({
|
||||||
|
url: `/sponsor/admin/${id}`,
|
||||||
|
method: "PATCH",
|
||||||
|
body: data,
|
||||||
|
}),
|
||||||
|
invalidatesTags: ["getSponser"],
|
||||||
|
}),
|
||||||
|
|
||||||
|
// ========[Delete Sponser]========
|
||||||
|
|
||||||
|
deleteSponser: builder.mutation({
|
||||||
|
query: (id) => ({
|
||||||
|
url: `/sponsor/admin/delete/${id}`,
|
||||||
|
method: "DELETE",
|
||||||
|
}),
|
||||||
|
invalidatesTags: ["getSponser"],
|
||||||
|
}),
|
||||||
|
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Export hooks for usage in functional components
|
||||||
|
export const {
|
||||||
|
useGetSponserMasterQuery,
|
||||||
|
useGetSponserMasterActiveQuery,
|
||||||
|
useToggleStatusMutation,
|
||||||
|
useCreateSponserMutation,
|
||||||
|
useUpdateSponserMutation,
|
||||||
|
useGetSponserByIdQuery,
|
||||||
|
useDeleteSponserMutation,
|
||||||
|
useGetActiveSponserMasterQuery
|
||||||
|
} = sponserMaster;
|
||||||
@@ -231,7 +231,7 @@ export const ioService = createApi({
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// =====[ Amount Investment ]
|
// =====[ Amount Investment ] ======
|
||||||
amountIvestment : builder.mutation({
|
amountIvestment : builder.mutation({
|
||||||
query: ({ data, id }) => ({
|
query: ({ data, id }) => ({
|
||||||
url: `/io/admin/amount-invested/${id}`,
|
url: `/io/admin/amount-invested/${id}`,
|
||||||
@@ -242,9 +242,17 @@ export const ioService = createApi({
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
|
|
||||||
|
// ======== [ Distribution Transaction ] ========
|
||||||
|
|
||||||
|
|
||||||
|
getDistributionInvestor : builder.mutation({
|
||||||
|
query: ({id,data}) => ({
|
||||||
|
url: `/io/admin/io-distribution/pre-populate/${id}`,
|
||||||
|
method: "POST",
|
||||||
|
body: data,
|
||||||
|
}),
|
||||||
|
invalidatesTags: ["getIOById"],
|
||||||
|
}),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -296,8 +304,8 @@ export const {
|
|||||||
useUpdateStatusIoMutation,
|
useUpdateStatusIoMutation,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
useAmountIvestmentMutation,
|
useAmountIvestmentMutation,
|
||||||
|
|
||||||
|
|
||||||
|
useGetDistributionInvestorMutation,
|
||||||
} = ioService;
|
} = ioService;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
|
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
|
||||||
|
|
||||||
// Define a base query function with RTK Query
|
// Define a base query function with RTK Query
|
||||||
// export const baseQuery = fetchBaseQuery({
|
// export const baseQuery = fetchBaseQuery({
|
||||||
// baseUrl: 'https://admin.tanami.betadelivery.com/api/v1',
|
// baseUrl: 'https://sprint4.tanami.betadelivery.com/api/v1',
|
||||||
// prepareHeaders: (headers) => {
|
// prepareHeaders: (headers) => {
|
||||||
// const token = localStorage.getItem('accessToken');
|
// const token = localStorage.getItem('accessToken');
|
||||||
// if (token) {
|
// if (token) {
|
||||||
@@ -12,17 +12,14 @@ import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
|
|||||||
// },
|
// },
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Define a base query function with token refresh logic
|
// Define a base query function with token refresh logic
|
||||||
export const baseQuery = async (args, api, extraOptions) => {
|
export const baseQuery = async (args, api, extraOptions) => {
|
||||||
let result = await fetchBaseQuery({
|
let result = await fetchBaseQuery({
|
||||||
baseUrl: 'https://admin.tanami.betadelivery.com/api/v1',
|
baseUrl: import.meta.env.VITE_BAS_URL,
|
||||||
prepareHeaders: (headers) => {
|
prepareHeaders: (headers) => {
|
||||||
const token = localStorage.getItem('accessToken');
|
const token = localStorage.getItem("accessToken");
|
||||||
if (token) {
|
if (token) {
|
||||||
headers.set('x-auth-token', token);
|
headers.set("x-auth-token", token);
|
||||||
}
|
}
|
||||||
return headers;
|
return headers;
|
||||||
},
|
},
|
||||||
@@ -30,38 +27,47 @@ export const baseQuery = async (args, api, extraOptions) => {
|
|||||||
|
|
||||||
if (result.error && result.error.status === 401) {
|
if (result.error && result.error.status === 401) {
|
||||||
// Handle token refresh
|
// Handle token refresh
|
||||||
const refreshToken = localStorage.getItem('refreshToken');
|
const refreshToken = localStorage.getItem("refreshToken");
|
||||||
if (refreshToken) {
|
if (refreshToken) {
|
||||||
try {
|
try {
|
||||||
const refreshResult = await fetchBaseQuery({
|
const refreshResult = await fetchBaseQuery({
|
||||||
baseUrl: 'https://admin.tanami.betadelivery.com/api/v1',
|
baseUrl: import.meta.env.VITE_BAS_URL,
|
||||||
})({
|
})(
|
||||||
url: '/auth/user/regenerate-token',
|
{
|
||||||
method: 'POST',
|
url: "/auth/user/regenerate-token",
|
||||||
|
method: "POST",
|
||||||
body: { refreshToken },
|
body: { refreshToken },
|
||||||
}, api, extraOptions);
|
},
|
||||||
|
api,
|
||||||
|
extraOptions
|
||||||
|
);
|
||||||
|
|
||||||
if (refreshResult.data) {
|
if (refreshResult.data) {
|
||||||
|
|
||||||
// Save new tokens
|
// Save new tokens
|
||||||
localStorage.setItem('accessToken', refreshResult.data.access.token);
|
localStorage.setItem("accessToken", refreshResult.data.access.token);
|
||||||
localStorage.setItem('refreshToken', refreshResult.data.refresh.token);
|
localStorage.setItem(
|
||||||
localStorage.setItem('refreshTokenExp', refreshResult.data.refresh.expires);
|
"refreshToken",
|
||||||
|
refreshResult.data.refresh.token
|
||||||
|
);
|
||||||
|
localStorage.setItem(
|
||||||
|
"refreshTokenExp",
|
||||||
|
refreshResult.data.refresh.expires
|
||||||
|
);
|
||||||
|
|
||||||
// Retry the original request with the new token
|
// Retry the original request with the new token
|
||||||
result = await fetchBaseQuery({
|
result = await fetchBaseQuery({
|
||||||
baseUrl: 'https://admin.tanami.betadelivery.com/api/v1',
|
baseUrl: import.meta.env.VITE_BAS_URL,
|
||||||
prepareHeaders: (headers) => {
|
prepareHeaders: (headers) => {
|
||||||
const token = localStorage.getItem('accessToken');
|
const token = localStorage.getItem("accessToken");
|
||||||
if (token) {
|
if (token) {
|
||||||
headers.set('x-auth-token', token);
|
headers.set("x-auth-token", token);
|
||||||
}
|
}
|
||||||
return headers;
|
return headers;
|
||||||
},
|
},
|
||||||
})(args, api, extraOptions);
|
})(args, api, extraOptions);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to refresh token:', err);
|
console.error("Failed to refresh token:", err);
|
||||||
// Handle refresh failure (e.g., redirect to login)
|
// Handle refresh failure (e.g., redirect to login)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,32 +78,32 @@ export const baseQuery = async (args, api, extraOptions) => {
|
|||||||
|
|
||||||
// Create an RTK Query API slice
|
// Create an RTK Query API slice
|
||||||
export const apiSlice = createApi({
|
export const apiSlice = createApi({
|
||||||
reducerPath: 'api',
|
reducerPath: "api",
|
||||||
baseQuery: baseQuery,
|
baseQuery: baseQuery,
|
||||||
endpoints: (builder) => ({
|
endpoints: (builder) => ({
|
||||||
login: builder.mutation({
|
login: builder.mutation({
|
||||||
query: (credentials) => ({
|
query: (credentials) => ({
|
||||||
url: '/auth/admin',
|
url: "/auth/admin",
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
body: credentials,
|
body: credentials,
|
||||||
}),
|
}),
|
||||||
async onQueryStarted(arg, { dispatch, queryFulfilled }) {
|
async onQueryStarted(arg, { dispatch, queryFulfilled }) {
|
||||||
try {
|
try {
|
||||||
const { data } = await queryFulfilled;
|
const { data } = await queryFulfilled;
|
||||||
// Store tokens in local storage
|
// Store tokens in local storage
|
||||||
localStorage.setItem('accessToken', data?.data?.access?.token) ;
|
localStorage.setItem("accessToken", data?.data?.access?.token);
|
||||||
localStorage.setItem('refreshToken', data?.data?.refresh?.token);
|
localStorage.setItem("refreshToken", data?.data?.refresh?.token);
|
||||||
// localStorage.setItem('refreshTokenExp', data?.data?.refresh?.expires);
|
// localStorage.setItem('refreshTokenExp', data?.data?.refresh?.expires);
|
||||||
localStorage.setItem('accessTokenExp', data?.data?.access?.expires);
|
localStorage.setItem("accessTokenExp", data?.data?.access?.expires);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Login failed:', error);
|
console.error("Login failed:", error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
refreshToken: builder.mutation({
|
refreshToken: builder.mutation({
|
||||||
query: (refreshToken) => ({
|
query: (refreshToken) => ({
|
||||||
url: '/auth/user/regenerate-token',
|
url: "/auth/user/regenerate-token",
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
body: { refreshToken },
|
body: { refreshToken },
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user