UPDATE invest modal

This commit is contained in:
YasinShaikh123
2024-11-21 16:05:51 +05:30
parent 7ba524d2e4
commit 470ba49c00
2 changed files with 88 additions and 69 deletions

View File

@@ -47,7 +47,7 @@ const formatCurrency = (value) => {
return decimal ? `${formattedInteger}.${decimal}` : formattedInteger;
};
const ViewAmountInvested = ({ isOpen, onClose, id:investorId }) => {
const ViewAmountInvested = ({ isOpen, onClose, id: investorId }) => {
const params = useParams();
const toast = useToast();
const id = params?.id;
@@ -131,7 +131,11 @@ const ViewAmountInvested = ({ isOpen, onClose, id:investorId }) => {
Total_Amount: IODetails?.totalAmtInvestmentInUSD,
});
};
console.log(
"=========hitttt",
IODetails?.ioTransactionRecords?.Approved?.[0]?.transactionAmount
);
return (
<Modal isOpen={isOpen} onClose={onClose}>
@@ -151,7 +155,9 @@ const ViewAmountInvested = ({ isOpen, onClose, id:investorId }) => {
</FormLabel>
<Input
type="text"
value={formatDate(IODetails?.ioTransactionRecords?.Approved?.[0]?.createdAt)}
value={formatDate(
IODetails?.ioTransactionRecords?.Approved?.[0]?.createdAt
)}
size="sm"
rounded={"sm"}
textAlign={"end"}
@@ -162,64 +168,67 @@ const ViewAmountInvested = ({ isOpen, onClose, id:investorId }) => {
</FormControl>
<FormControl
mb={"15px"}
isInvalid={!!errors.Total_Amount}
isReadOnly
>
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>
Amount
</FormLabel>
<Input
type="text"
value={formatCurrency(watch("Total_Amount"))}
size="sm"
rounded={"sm"}
textAlign={"end"}
focusBorderColor="forestGreen.300"
fontSize={"sm"}
readOnly
/>
</FormControl>
mb={"15px"}
isInvalid={!!errors.Total_Amount}
isReadOnly
>
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>
Amount
</FormLabel>
<Input
type="text"
value={formatCurrency(watch("Total_Amount") || 0)}
size="sm"
rounded={"sm"}
textAlign={"end"}
focusBorderColor="forestGreen.300"
fontSize={"sm"}
readOnly
/>
</FormControl>
<FormControl
mb={"15px"}
isInvalid={!!errors.amountInvested}
isRequired
>
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>
Amount to invest
</FormLabel>
<Input
type="text"
value={formatCurrency(IODetails?.ioTransactionRecords?.Approved?.[0]?.transactionAmount || 0)}
size="sm"
rounded={"sm"}
textAlign={"end"}
focusBorderColor="forestGreen.300"
fontSize={"sm"}
readOnly
/>
</FormControl>
<FormControl mb={"15px"} isInvalid={!!errors.IoCash}>
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>
IO Cash
</FormLabel>
<Input
type="text"
value={formatCurrency(
(watch("Total_Amount") || 0) -
(IODetails?.ioTransactionRecords?.Approved?.[0]?.transactionAmount || 0)
)}
size="sm"
rounded={"sm"}
focusBorderColor="forestGreen.300"
fontSize={"sm"}
textAlign={"right"}
readOnly
/>
</FormControl>
<FormControl
mb={"15px"}
isInvalid={!!errors.amountInvested}
isRequired
>
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>
Amount to invest
</FormLabel>
<Input
type="text"
value={formatCurrency(
IODetails?.ioTransactionRecords?.Pending?.[0]
?.transactionAmount || 0
)}
size="sm"
rounded={"sm"}
textAlign={"end"}
focusBorderColor="forestGreen.300"
fontSize={"sm"}
readOnly
/>
</FormControl>
<FormControl mb={"15px"} isInvalid={!!errors.IoCash}>
<FormLabel as={"label"} fontSize={"sm"} fontWeight={500}>
IO Cash
</FormLabel>
<Input
type="text"
value={formatCurrency(
(watch("Total_Amount") || 0) -
(IODetails?.ioTransactionRecords?.Pending?.[0]
?.transactionAmount || 0)
)}
size="sm"
rounded={"sm"}
focusBorderColor="forestGreen.300"
fontSize={"sm"}
textAlign={"right"}
readOnly
/>
</FormControl>
<ModalFooter>
<Box display={"flex"} justifyContent={"center"} gap={2}>

View File

@@ -54,7 +54,7 @@ const ViewIOdata = () => {
const tabs = [
{ label: "IO Details", content: <ViewIOdetails data={data?.data} /> },
{
label: "Investment documents",
label: "Investment documents",
content: <InvestmentDocument data={data?.data} />,
},
{ label: "Key merits", content: <KeyMerits data={data?.data} /> },
@@ -98,15 +98,25 @@ const ViewIOdata = () => {
{tabs.map(({ label }, index) => (
<Tab
px={3}
isDisabled={
index === 0 ||
index === 1 ||
index === 2 ||
index === 3 ||
index === 4
? false
: !IODetails?.isInvestedAmount
}
// isDisabled={
// index === 0 ||
// index === 1 ||
// index === 2 ||
// index === 3 ||
// index === 4
// ? false
// : !IODetails?.isInvestedAmount
// }
// isDisabled={
// index === 0 ||
// index === 1 ||
// index === 2 ||
// index === 3 ||
// index === 4
// ? false
// : !IODetails?.isInvestedAmount
// }
key={index}
fontSize={"xs"}
_selected={{