Compare commits

...

2 Commits

Author SHA1 Message Date
YasinShaikh123
28f84b178a hot fix 2024-11-14 17:39:08 +05:30
YasinShaikh123
b518e5fb8b update add investor 2024-11-14 17:02:01 +05:30
5 changed files with 80 additions and 25 deletions

View File

@@ -90,9 +90,9 @@ const AddCashDetails = ({ isOpen, onClose, firstField, actionId, setActionId, da
toast({ toast({
render: () => <ToastBox message={res?.error?.data?.message } status={"error"} />, render: () => <ToastBox message={res?.error?.data?.message } status={"error"} />,
}); });
setAlert(false);
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);

View File

@@ -152,7 +152,7 @@ const IOArtifactsAdd = ({ isOpen, onClose, firstField, actionId, setActionId, da
<DrawerBody> <DrawerBody>
<Stack spacing={4}> <Stack spacing={4}>
<FormControl isInvalid={errors.artifactName}> <FormControl isInvalid={errors.artifactName} isRequired={true}>
<FormLabel fontSize={"sm"}>Artifact Name</FormLabel> <FormLabel fontSize={"sm"}>Artifact Name</FormLabel>
<Controller <Controller
name="artifactName" name="artifactName"
@@ -166,7 +166,7 @@ const IOArtifactsAdd = ({ isOpen, onClose, firstField, actionId, setActionId, da
</FormErrorMessage> </FormErrorMessage>
</FormControl> </FormControl>
<FormControl isInvalid={errors.artifactStreamingURL}> <FormControl isInvalid={errors.artifactStreamingURL} isRequired={true}>
<FormLabel fontSize={"sm"}>Artifact Streaming URL</FormLabel> <FormLabel fontSize={"sm"}>Artifact Streaming URL</FormLabel>
<Controller <Controller
name="artifactStreamingURL" name="artifactStreamingURL"

View File

@@ -74,6 +74,11 @@ const DistributionInvestor = ({ isOpen, onClose }) => {
amount: yup amount: yup
.string() .string()
.required("Amount is required") .required("Amount is required")
.test(
"is-positive",
"Amount should be greater than zero",
(value) => parseFloat(value) > 0 // Check if the amount is greater than zero
)
.test( .test(
"max", "max",
`Distribution amount should not be greater than IO cash amount ${IODetails?.ioCash}`, `Distribution amount should not be greater than IO cash amount ${IODetails?.ioCash}`,
@@ -87,6 +92,7 @@ const DistributionInvestor = ({ isOpen, onClose }) => {
), ),
}); });
const investor = yup.object().shape({ const investor = yup.object().shape({
amount: yup.string().required("Amount is required"), amount: yup.string().required("Amount is required"),
}); });

View File

@@ -223,7 +223,7 @@ const InvestorDetails = () => {
> >
{/* {item.KYCStatus ? "Completed" : "Not complete"} */} {/* {item.KYCStatus ? "Completed" : "Not complete"} */}
{item?.KYCStatus === true ? "Completed" : "NotCompleted"} {item?.KYCStatus === true ? "Completed" : "Not Completed"}
</Text> </Text>
</Box> </Box>
), ),

View File

@@ -107,23 +107,27 @@ const AddInvestmentType = () => {
isActive: isSwitchOn, isActive: isSwitchOn,
}; };
await updateInvestmentType({ data: formData, id }).then((response) => { await updateInvestmentType({ data: formData, id }).then((response) => {
if (response?.data?.statusCode === 200) { if (response?.data) {
toast({ toast({
render: () => <ToastBox message={response?.data?.message} />, render: () => (
<ToastBox
status={"success"}
message={response?.data?.message}
/>
),
}); });
setIsLoadingBtn(false); setIsLoadingBtn(false);
setAlert(false); setAlert(false);
navigate("/investment-type"); navigate("/investment-type");
} else { } else if (response?.error) {
toast({ toast({
render: () => ( render: () => (
<ToastBox message={"Something Went Wrong"} status={"error"} /> <ToastBox
status={"error"}
message={response?.error?.data?.message}
/>
), ),
}); });
setIsLoadingBtn(false);
navigate("/investment-type");
} }
}); });
} catch (error) { } catch (error) {
@@ -139,22 +143,50 @@ const AddInvestmentType = () => {
}; };
await createInvestmentType(formData).then((response) => { await createInvestmentType(formData).then((response) => {
if (response?.data?.statusCode === 201) { // if (response?.data?.statusCode === 201) {
toast({ // toast({
render: () => <ToastBox message={response?.data?.message} />, // render: () => <ToastBox message={response?.data?.message} />,
}); // });
setIsLoadingBtn(false); // setIsLoadingBtn(false);
navigate("/investment-type"); // navigate("/investment-type");
} else { // } else {
// toast({
// render: () => (
// <ToastBox message={"Something Went Wrong"} status={"error"} />
// ),
// });
// setIsLoadingBtn(false);
// navigate("/investment-type");
// }
if (response?.data) {
toast({ toast({
render: () => ( render: () => (
<ToastBox message={"Something Went Wrong"} status={"error"} /> <ToastBox
status={"success"}
message={response?.data?.message}
/>
), ),
}); });
setAlert(false);
setIsLoadingBtn(false); setIsLoadingBtn(false);
navigate("/investment-type"); navigate("/investment-type");
} else if (response?.error) {
toast({
render: () => (
<ToastBox
status={"error"}
message={response?.error.data.message}
/>
),
});
setAlert(false);
setIsLoadingBtn(false);
// navigate("/investment-type");
} }
}); });
} catch (error) { } catch (error) {
@@ -314,9 +346,22 @@ const AddInvestmentType = () => {
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"} pb={14}> <Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"} pb={14}>
{/* ===================== [Switch Button] ======================== */} {/* ===================== [Switch Button] ======================== */}
<Box display={"flex"} justifyContent={"space-between"} alignItems={"center"} mt={5} px={4} mb={5}> <Box
<Text fontSize={"sm"} mb={0} onClick={() => navigate(-1)} cursor={"pointer"}> display={"flex"}
<ArrowBackIcon fontSize={"xl"} me={2} />Add Details justifyContent={"space-between"}
alignItems={"center"}
mt={5}
px={4}
mb={5}
>
<Text
fontSize={"sm"}
mb={0}
onClick={() => navigate(-1)}
cursor={"pointer"}
>
<ArrowBackIcon fontSize={"xl"} me={2} />
Add Details
</Text> </Text>
<SwitchButton isSwitchOn={isSwitchOn} setIsSwitchOn={setIsSwitchOn} /> <SwitchButton isSwitchOn={isSwitchOn} setIsSwitchOn={setIsSwitchOn} />
</Box> </Box>
@@ -338,7 +383,11 @@ const AddInvestmentType = () => {
isOpen={alert} isOpen={alert}
onClose={() => setAlert(false)} onClose={() => setAlert(false)}
alertHandler={handleConfirm} alertHandler={handleConfirm}
message={id ? "Are you sure you want to update this document?" : " Are you sure you want to add this document?"} message={
id
? "Are you sure you want to update this document?"
: " Are you sure you want to add this document?"
}
isLoading={isLoadingBtn} isLoading={isLoadingBtn}
/> />
</Box> </Box>