This commit is contained in:
2024-08-26 19:54:15 +05:30
7 changed files with 135 additions and 91 deletions

View File

@@ -20,11 +20,10 @@ const DataTable = ({
tableHeadRow,
emptyMessage,
centered,
total
total,
}) => {
console.log(data);
const columnWidth =
data && data[0]
? `${(100 / Object.keys(data[0]).length).toFixed(2)}%`
@@ -35,7 +34,9 @@ const DataTable = ({
<EmptySearchList message={emptyMessage} />
) : (
<Table size="sm">
<TableCaption p={total?0:null}>{total? total :"Tanami v1.0.0"}</TableCaption>
<TableCaption p={total ? 0 : null}>
{total ? total : "Tanami v1.0.0"}
</TableCaption>
<Thead backgroundColor="gray.100">
<Tr>
{tableHeadRow.map((heading, index) => (
@@ -52,8 +53,7 @@ const DataTable = ({
whiteSpace="normal" // Allow text to wrap
wordBreak="normal" // Ensure long words break properly
overflowWrap="normal" // Break long words if necessary
textTransform={'none'}
textTransform={"none"}
>
{isLoading ? <Skeleton height="20px" /> : heading}
{/* {heading} */}
@@ -63,24 +63,26 @@ const DataTable = ({
</Thead>
<Tbody className="web-text-small">
{isLoading
? Array.from({ length: TABLE_PAGINATION?.size }).map((_, index) => (
<Tr key={index}>
{tableHeadRow.map((_, i) => (
<Td
width={'fit-content'}
key={i}
style={{
whiteSpace: "nowrap",
textOverflow: "ellipsis",
}}
className="web-text-small"
w={columnWidth}
>
<Skeleton height="20px" mb={1} mt={1} />
</Td>
))}
</Tr>
))
? Array.from({ length: TABLE_PAGINATION?.size }).map(
(_, index) => (
<Tr key={index}>
{tableHeadRow.map((_, i) => (
<Td
width={"fit-content"}
key={i}
style={{
whiteSpace: "nowrap",
textOverflow: "ellipsis",
}}
className="web-text-small"
w={columnWidth}
>
<Skeleton height="20px" mb={1} mt={1} />
</Td>
))}
</Tr>
)
)
: data?.map((item, index) => (
<Tr bg={index % 2 === 0 ? "" : "gray.50"} key={index}>
{tableHeadRow.map((heading, i) => (

View File

@@ -191,7 +191,7 @@ const DepositRequest = () => {
"Deposit Date": (
<Text
w={"60px"}
justifyContent={slideFromRight ? "right" : "left"}
justifyContent={slideFromRight ? "right" : "left"}
as={"span"}
color={"teal.900"}
fontWeight={"500"}

View File

@@ -132,11 +132,35 @@ const ViewIOTable = () => {
</Box>
),
"IO Name": (
<Box w={"100px"} isTruncated={true}>
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
{item.investmentNameEnglish ? item.investmentNameEnglish : "---"}
</Text>
</Box>
// <Box w={"200px"} isTruncated={true}>
// <Text as={"span"} color={"teal.900"} fontWeight={"500"}>
// <Tooltip w={"100%"} label={item.investmentNameEnglish ? item.investmentNameEnglish : "---"} placement='top'>
// {item.investmentNameEnglish ? item.investmentNameEnglish : "---"}
// </Tooltip>
// </Text>
// </Box>
<Tooltip
hasArrow
bg={"#fff"}
fontSize={"xs"}
label={item.investmentNameEnglish ? item.investmentNameEnglish : "---"}
placement="top-start"
color={"blue.800"}
>
<Text
as={"span"}
color={"teal.900"}
fontWeight={"500"}
maxWidth="200px" // Adjust width as needed
display="block" // Ensure block display for proper truncation
overflow="hidden"
isTruncated
textOverflow="ellipsis"
cursor={"grab"}
>
{item.investmentNameEnglish ? item.investmentNameEnglish : "---"}
</Text>
</Tooltip>
),
Sponsor: (
<Box w={"auto"} isTruncated={true}>
@@ -163,9 +187,10 @@ const ViewIOTable = () => {
color={"teal.900"}
fontWeight={"500"}
>
{item.goalAmount
{/* {item.goalAmount
? formatCurrency(removeTrailingZeros(item.goalAmount))
: "---"}
: "---"} */}
{`$${parseFloat(item.goalAmount||0).toLocaleString()}`}
</Text>
</Box>
),
@@ -176,7 +201,7 @@ const ViewIOTable = () => {
{formatDate(item.closingDate ? item.closingDate : "---")}
</Text>
</Box>
),
),
"IO Status": (
<Box w={"auto"} isTruncated={true}>
<Badge

View File

@@ -52,6 +52,14 @@ import {
// Cleanup the timer on component unmount
return () => clearTimeout(timer);
}, []);
const formatDate = (date) => {
return new Date(date).toLocaleDateString('en-GB', {
day: '2-digit',
month: '2-digit',
year: 'numeric',
});
};
// ====================================================[Table Setup]================================================================
const tableHeadRow = [
@@ -96,7 +104,7 @@ console.log(transaction);
const extractedArray = filteredData?.map((item) => ({
id: item?.id,
"Sr N/O": (
<Text w={'50px'}
<Text w={'100px'}
justifyContent={slideFromRight ? "right" : "left"}
as={"span"}
color={"gray.600"}
@@ -106,14 +114,14 @@ console.log(transaction);
</Text>
),
"Date": (
<Box w={"auto"} isTruncated={true}>
<Box w={"80px"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{formatDate(item.transactionDate)}
</Text>
</Box>
),
"Transaction": (
<Box w={"auto"} isTruncated={true}>
<Box w={"100px"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item.investorTransaction?.transactionName}
</Text>
@@ -127,38 +135,40 @@ console.log(transaction);
</Box>
),
"Amount in investors currency": (
<Box w={"120px"} isTruncated={true}>
<Box w={"120px"} isTruncated={true} display={"flex"} justifyContent={"end"}>
<Text as={"span"} color={"teal.900"}>
{/* {item.investorAmount} */}
{parseFloat(item?.investorAmount || 0).toLocaleString(undefined, {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})}
<Badge ms={1} colorScheme="green">{item?.investorCurrency}</Badge>
</Text>
</Box>
),
"From USD": (
<Box w={"auto"} isTruncated={true}>
<Box w={"80px"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item.USDToInvCur_Rate}
</Text>
</Box>
),
"TO USD": (
<Box w={"auto"} isTruncated={true}>
<Box w={"80px"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item.invCurToUSD_Rate}
</Text>
</Box>
),
"USD amount": (
<Box w={"auto"} isTruncated={true}>
<Box w={"100px"} isTruncated={true} display={"flex"} justifyContent={"end"}>
<Text as={"span"} color={"teal.900"}>
{/* {item.USDAmount} */}
{parseFloat(item?.USDAmount || 0).toLocaleString(undefined, {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})}
<Badge ms={1} colorScheme="green">$</Badge>
</Text>
</Box>
),
@@ -193,13 +203,13 @@ console.log(transaction);
const Total = () => {
return (
<Table size="sm">
<Table size="sm" >
<Tbody backgroundColor="gray.50">
<Tr >
<Th
textAlign={"center"}
textAlign={"left"}
p={3}
width="60px"
width="100px"
color={"#004118"}
whiteSpace="normal"
wordBreak="normal"
@@ -210,7 +220,8 @@ console.log(transaction);
<Th
textAlign={"center"}
p={3}
width="60px"
width="120px"
maxW={"120px"}
color={"#004118"}
whiteSpace="normal"
wordBreak="normal"
@@ -219,20 +230,23 @@ console.log(transaction);
{" "}
</Th>
<Th
textAlign={"center"}
textAlign={"right"}
p={3}
width="60px"
width="100px"
color={"#004118"}
whiteSpace="normal"
wordBreak="normal"
overflowWrap="normal"
>
{" "}
<Box display={"flex"} justifyContent={"end"}>
{parseFloat(InvestorWallet?.WalletBalance_InInvCur).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
<Badge ms={1} colorScheme="green">{InvestorWallet?.currencyCode_InCur}</Badge>
</Box>
</Th>
<Th
textAlign={"center"}
p={3}
width="60px"
width="80px"
color={"#004118"}
whiteSpace="normal"
wordBreak="normal"
@@ -248,28 +262,6 @@ console.log(transaction);
whiteSpace="normal"
wordBreak="normal"
overflowWrap="normal"
>
{parseFloat(InvestorWallet?.WalletBalance_InUSD).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
</Th>
<Th
textAlign={"center"}
p={3}
width="50px"
color={"#004118"}
whiteSpace="normal"
wordBreak="normal"
overflowWrap="normal"
>
{" "}
</Th>
<Th
textAlign={"center"}
p={3}
width="50px"
color={"#004118"}
whiteSpace="normal"
wordBreak="normal"
overflowWrap="normal"
>
{" "}
</Th>
@@ -282,7 +274,10 @@ console.log(transaction);
wordBreak="normal"
overflowWrap="normal"
>
{parseFloat(InvestorWallet?.WalletBalance_InInvCur).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
<Box display={"flex"} justifyContent={"end"}>
{parseFloat(InvestorWallet?.WalletBalance_InUSD).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
<Badge ms={1} colorScheme="green">{InvestorWallet?.currencyCode_InCur}</Badge>
</Box>
</Th>
<Th
textAlign={"center"}

View File

@@ -118,24 +118,28 @@ const InvestmentType = () => {
</Text>
),
Description: (
<Tooltip hasArrow bg={"#fff"} fontSize={"xs"} label={item.note} placement="top-start" color={"blue.800"} >
<Text
as={"span"}
color={"teal.900"}
fontWeight={"500"}
maxWidth="600px" // Adjust width as needed
display="block" // Ensure block display for proper truncation
overflow="hidden"
isTruncated
textOverflow="ellipsis"
cursor={"grab"}
<Tooltip
hasArrow
bg={"#fff"}
fontSize={"xs"}
label={item.note}
placement="top-start"
color={"blue.800"}
>
<Text
as={"span"}
color={"teal.900"}
fontWeight={"500"}
maxWidth="600px" // Adjust width as needed
display="block" // Ensure block display for proper truncation
overflow="hidden"
isTruncated
textOverflow="ellipsis"
cursor={"grab"}
>
{item.note}
</Text>
</Tooltip>
</Text>
</Tooltip>
),
Status: (
<Box isTruncated={true}>

View File

@@ -16,13 +16,14 @@ import DataTable from "../../../Components/DataTable/DataTable";
import Pagination from "../../../Components/Pagination";
import GlobalStateContext from "../../../Contexts/GlobalStateContext";
import CustomAlertDialog from "../../../Components/CustomAlertDialog";
import { formatDate } from "../../../Components/Functions/UTCConvertor";
import { CheckIcon, CloseIcon } from "@chakra-ui/icons";
import DrawalRequestReject from "./DrawalRequestReject";
import { useGetDrawalRequestQuery } from "../../../Services/drawal.request.service";
import { TABLE_PAGINATION } from "../../../Constants/Paginations";
import NormalTable from "../../../Components/DataTable/NormalTable"
import DrawalRequestApprove from "./DrawalRequestApprove";
import { formatDate } from "../../../Components/Functions/UTCConvertor";
import { generateSerialNumber } from "../../../Constants/Constants";
const PendingRequest = () => {
const toast = useToast();
@@ -38,6 +39,14 @@ const PendingRequest = () => {
const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
const formatDate = (date) => {
return new Date(date).toLocaleDateString('en-GB', {
day: '2-digit',
month: '2-digit',
year: 'numeric',
});
};
const {
isOpen: isConfirmOpen,
onOpen: onConfirmOpen,
@@ -97,7 +106,7 @@ const PendingRequest = () => {
// ====================================================[Table Setup]================================================================
const tableHeadRow = [
// "Sr.no",
"Sr.no",
"Date",
"Client ID",
"First Name",
@@ -112,7 +121,7 @@ const PendingRequest = () => {
const extractedArray = filteredData?.map((item, index) => ({
const extractedArray = filteredData?.map((item, idx) => ({
// id: item?.id,
"Sr.no": (
<Text
@@ -123,7 +132,7 @@ const PendingRequest = () => {
fontWeight={"500"}
className="d-flex align-items-center web-text-small"
>
{index + 1}
{generateSerialNumber(idx,currentPage, pageSize )}
</Text>
),
"Date": (

View File

@@ -47,6 +47,15 @@ const ViewHistory = () => {
// onClose: onRejectClose,
// } = useDisclosure();
const formatDate = (date) => {
return new Date(date).toLocaleDateString('en-GB', {
day: '2-digit',
month: '2-digit',
year: 'numeric',
});
};
const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);