This commit is contained in:
YasinShaikh123
2024-08-26 12:40:59 +05:30
9 changed files with 68 additions and 63 deletions

View File

@@ -97,7 +97,7 @@ const DataTable = ({
bg: "blue.50",
cursor: "grab",
}}
bg={snapshot.isDragging ? "blue.100" : "white"}
bg={snapshot.isDragging ? "blue.100" : index % 2 ? "white" : "gray.50"}
boxShadow={snapshot.isDragging ? "0 0 1em rgba(0, 0, 0, 0.2)" : "none"}
>
@@ -121,7 +121,7 @@ const DataTable = ({
)}
</Draggable>
) : (
<Tr key={index}>
<Tr bg={index % 2 ? "gray.50" : "white"} key={index}>
{tableHeadRow.map((heading, i) => (
<Td
textAlign={tableHeadRow.length - 1 === i || centered ? "center" : "left"}

View File

@@ -36,7 +36,7 @@ const DataTable = ({
) : (
<Table size="sm">
<TableCaption p={total?0:null}>{total? total :"Tanami v1.0.0"}</TableCaption>
<Thead backgroundColor="gray.50">
<Thead backgroundColor="gray.100">
<Tr>
{tableHeadRow.map((heading, index) => (
<Th
@@ -82,7 +82,7 @@ const DataTable = ({
</Tr>
))
: data?.map((item, index) => (
<Tr key={index}>
<Tr bg={index % 2 === 0 ? "" : "gray.50"} key={index}>
{tableHeadRow.map((heading, i) => (
<Td
textAlign={

View File

@@ -37,7 +37,7 @@ import { current } from "@reduxjs/toolkit";
import { TABLE_PAGINATION } from "../../../Constants/Paginations";
import { removeTrailingZeros } from "../../../Constants/Constants";
const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter
export const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter
const DepositRequest = () => {
const navigate = useNavigate();

View File

@@ -24,6 +24,7 @@ import { useForm } from "react-hook-form";
import { useGetDepositRequestByIdQuery, useGetDepositRequestQuery, useUpdateDepositRequestMutation } from "../../../Services/deposit.request.service";
import FullscreenLoaders from "../../../Components/Loaders/FullscreenLoaders";
import ToastBox from "../../../Components/ToastBox";
import { formatCurrency } from "../../../Components/CurrencyInput";
const FILE_TYPES = ["image/jpeg", "image/png", "image/gif"];
@@ -41,8 +42,7 @@ const DepositRequestApprove = ({ isOpen, onClose, firstField, id, data:requestDa
const [file, setFile] = useState();
const [isBtnLoading , setIsBtnLoading] = useState(false)
const fileredData = requestData?.find((item)=> item?.id === id)
console.log(fileredData);
@@ -51,25 +51,30 @@ const DepositRequestApprove = ({ isOpen, onClose, firstField, id, data:requestDa
skip: !id,
});
console.log(data?.data?.investorAmount);
const {
register,
reset,
watch,
handleSubmit,
formState: { errors },
} = useForm({
resolver: yupResolver(conformModalSchema),
});
useEffect(() => {
reset({
investorAmount:fileredData?.investorAmount
})
}, [requestData, id])
useEffect(() => {
if (data) {
const investorAmount = parseFloat(data?.data?.investorAmount);
reset({
investorAmount: investorAmount,
accountName: data?.data?.accountName,
});
}
}, [id, data, reset]);
const onSubmit = async(data) => {
setIsBtnLoading(true)
@@ -108,20 +113,6 @@ const DepositRequestApprove = ({ isOpen, onClose, firstField, id, data:requestDa
heandleOnClose();
};
const handleFileChange = (event) => {
const selectedFile = event.target.files[0];
setFile(selectedFile);
};
useEffect(() => {
if (data) {
reset({
investorAmount: data?.data?.investorAmount,
accountName:data?.data?.accountName
});
}
}, [data, reset]);
const heandleOnClose = () =>{
reset()
@@ -141,11 +132,13 @@ const DepositRequestApprove = ({ isOpen, onClose, firstField, id, data:requestDa
<Box as="form" onSubmit={handleSubmit(onSubmit)}>
<ModalBody>
<FormControl mb={4} isRequired>
<FormLabel fontSize="sm">Deposit Amount <Badge colorScheme="green">{fileredData?.currencyCode}</Badge></FormLabel>
<FormLabel fontSize="sm">Deposit Amount <Badge colorScheme="green">{data?.data?.currencyCode}</Badge></FormLabel>
<Input
focusBorderColor="green.400"
name="investorAmount"
{...register("investorAmount")}
// value={formatCurrency(watch('investorAmount'))}
fontSize="sm"
type="number"
size="sm"

View File

@@ -84,6 +84,7 @@ const IOArtifactsAdd = ({
const onSubmit = async (data) => {
console.log("hit");
setIsLoading(true);
const formData = new FormData();
formData.append("artifactName", data.artifactName);
@@ -95,6 +96,7 @@ const IOArtifactsAdd = ({
data: formData,
id: found?.id,
});
if (res?.data?.statusCode === 200) {
toast({
render: () => <ToastBox message={res?.data?.message} />,
@@ -108,6 +110,20 @@ const IOArtifactsAdd = ({
artifactName: "",
artifactPathName: "",
});
} else{
toast({
render: () => <ToastBox message={"Something went wronng"} error="error" />,
});
setFile(null);
setIsLoading(false);
setAlert(false);
setPreview(null);
onClose();
reset({
artifactName: "",
artifactPathName: "",
});
}
if (res?.error) {
@@ -184,6 +200,11 @@ const IOArtifactsAdd = ({
}
}
const handleAlertClose = () =>{
setAlert(false)
setIsLoading(false)
}
return (
<>
@@ -225,7 +246,7 @@ const IOArtifactsAdd = ({
<FormLabel fontSize={"sm"}>Artifact Image</FormLabel>
<Input
type="file"
accept="image/*"
accept=".jpg,.jpeg,.png"
onChange={handleFileChange}
fontSize={"sm"}
size={"sm"}
@@ -296,7 +317,7 @@ const IOArtifactsAdd = ({
</Drawer>
<CustomAlertDialog
isOpen={alert}
onClose={() => setAlert(false)}
onClose={handleAlertClose}
alertHandler={handleSave}
message={"Are you sure you want to add this artifact?"}
isLoading={loading}

View File

@@ -55,13 +55,13 @@ import {
// ====================================================[Table Setup]================================================================
const tableHeadRow = [
"Sr N/O",
// "Sr N/O",
"Date",
"Transaction",
"Currency",
"Amount",
"From USD",
"Amount in investors currency",
// "Currency",
"TO USD",
"From USD",
"USD amount",
"IO Name",
"Payment Method",
@@ -108,7 +108,7 @@ console.log(transaction);
"Date": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item.transactionDate}
{formatDate(item.transactionDate)}
</Text>
</Box>
),
@@ -126,8 +126,8 @@ console.log(transaction);
</Text>
</Box>
),
"Amount": (
<Box w={"auto"} isTruncated={true}>
"Amount in investors currency": (
<Box w={"120px"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{/* {item.investorAmount} */}
{parseFloat(item?.investorAmount || 0).toLocaleString(undefined, {

View File

@@ -60,7 +60,7 @@ const ViewInvestorDetails = () => {
// ====================================================[Table Setup]================================================================
const tableHeadRow = [
"Sr N/O",
// "Sr N/O",
"Deal Name",
"Sponsor Name",
"Investment Amount",

View File

@@ -97,7 +97,7 @@ const PendingRequest = () => {
// ====================================================[Table Setup]================================================================
const tableHeadRow = [
"Sr.no",
// "Sr.no",
"Date",
"Client ID",
"First Name",
@@ -181,7 +181,6 @@ const PendingRequest = () => {
Currency: (
<Box w={"60px"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{/* {parseFloat(item?.investorAmount||0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} */}
<Badge ms={1} colorScheme="green">{item?.currencyCode}</Badge>
</Text>
</Box>

View File

@@ -65,15 +65,7 @@ const ViewHistory = () => {
// console.log(data?.data?.rows);
useEffect(() => {
// Simulate loading
const timer = setTimeout(() => {
setIsLoading(false);
}, 1500);
// Cleanup the timer on component unmount
return () => clearTimeout(timer);
}, []);
// ====================================================[Table Filter]================================================================
const filteredData = data?.data?.rows.filter((item) => {
@@ -96,16 +88,16 @@ const ViewHistory = () => {
// ====================================================[Table Setup]================================================================
const tableHeadRow = [
"Sr.no",
// "Sr.no",
"Date",
"Client ID",
"First Name",
"Last Name",
"Country",
"Phone Number",
"Currency",
"Withdrawal Amount",
// "Currency",
"Amount in Investor currency",
"Withdrawal Amount",
"Status",
];
@@ -148,35 +140,35 @@ const ViewHistory = () => {
</Text>
),
"First Name": (
<Box isTruncated={true} w={"50px"}>
<Box isTruncated={true} >
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
{item.firstName}
</Text>
</Box>
),
"Last Name": (
<Box w={"50px"} isTruncated={true}>
<Box w={"70px"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item.lastName}
</Text>
</Box>
),
Country: (
<Box w={"70px"} isTruncated={true}>
<Box isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item.countryName}
</Text>
</Box>
),
"Phone Number": (
<Box w={"70px"} isTruncated={true}>
<Box isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item.mobileNumber}
</Text>
</Box>
),
Currency: (
<Box w={"50px"} isTruncated={true}>
<Box isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
<Badge ms={1} colorScheme="green">
{item.currencyCode}
@@ -185,16 +177,16 @@ const ViewHistory = () => {
</Box>
),
"Withdrawal Amount": (
<Box w={"50px"} isTruncated={true}>
<Box isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item.USDAmount}
${parseFloat(item?.USDAmount||0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
</Text>
</Box>
),
"Amount in Investor currency": (
<Box w={"70px"} isTruncated={true}>
<Box w={"100px"} isTruncated={true}>
<Text as={"span"} color={"teal.900"}>
{item.investorAmount}
{parseFloat(item?.investorAmount||0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}<Badge ms={1} colorScheme="green">{item?.currencyCode}</Badge>
</Text>
</Box>
),
@@ -279,7 +271,7 @@ const ViewHistory = () => {
emptyMessage={`We don't have any Sponers `}
tableHeadRow={tableHeadRow}
data={extractedArray}
isLoading={isLoading}
isLoading={drawalHistoryLoading}
viewActionId={actionId}
setViewActionId={setActionId}
// totalPages={10}