diff --git a/src/Pages/ChangePassword.jsx b/src/Pages/ChangePassword.jsx index 84624c2..69ac7dd 100644 --- a/src/Pages/ChangePassword.jsx +++ b/src/Pages/ChangePassword.jsx @@ -5,6 +5,8 @@ import { FormErrorMessage, FormLabel, Input, + InputGroup, + InputRightElement, Modal, ModalBody, ModalCloseButton, @@ -49,10 +51,9 @@ const ChangePassword = ({ const [isLoading, setIsLoading] = useState(false); const [alert, setAlert] = useState(false); const toast = useToast(); - - const [showPassword, setShowPassword] = useState(false); - const [subject, setSubject] = useState(""); - const togglePasswordVisibility = () => setShowPassword(!showPassword); + const [showCurrentPassword, setShowCurrentPassword] = useState(false); + const [showNewPassword, setShowNewPassword] = useState(false); + const [showConfirmPassword, setShowConfirmPassword] = useState(false); // ======================[ Cotext Api ] const { IODetails } = useContext(GlobalStateContext); const found = data?.find((item) => item?.id === actionId); @@ -72,29 +73,29 @@ const ChangePassword = ({ resolver: yupResolver(ioNav), }); -// const onSubmit = async (data) => { -// setIsLoading(true); + // const onSubmit = async (data) => { + // setIsLoading(true); -// try { -// const res = await addNavDetails({ data, id }); -// if (res?.data?.statusCode === 201) { -// setIsLoading(false); -// toast({ -// render: () => , -// }); -// handleClose(); -// } else if (res?.error?.status === 400) { -// toast({ -// render: () => ( -// -// ), -// }); -// handleClose(); -// } -// } catch (error) { -// console.log(error); -// } -// }; + // try { + // const res = await addNavDetails({ data, id }); + // if (res?.data?.statusCode === 201) { + // setIsLoading(false); + // toast({ + // render: () => , + // }); + // handleClose(); + // } else if (res?.error?.status === 400) { + // toast({ + // render: () => ( + // + // ), + // }); + // handleClose(); + // } + // } catch (error) { + // console.log(error); + // } + // }; const handleSave = () => { handleSubmit(onSubmit)(); @@ -105,7 +106,6 @@ const ChangePassword = ({ setAlert(false); onClose(); }; - return ( <> @@ -122,40 +122,93 @@ const ChangePassword = ({ - Current Password - + Current Password + + + setSubject(e.target.value)} focusBorderColor="forestGreen.300" rounded={4} - type={showPassword ? "text" : "password"} - /> + type={showCurrentPassword ? "text" : "password"} // Toggles between "text" and "password" based on the `show` state + /> + + + + {errors.ChangePassword?.message} + - New Password - + New Password + + + setSubject(e.target.value)} focusBorderColor="forestGreen.300" rounded={4} - type="text" - /> + type={showNewPassword ? "text" : "password"} // Toggles between "text" and "password" based on the `show` state + /> + + + + {errors.newPassword?.message} + - Re-Type New Password - + Re-Type New Password + + + setSubject(e.target.value)} focusBorderColor="forestGreen.300" rounded={4} - type="text" - /> + type={showConfirmPassword ? "text" : "password"} // Toggles between "text" and "password" based on the `show` state + /> + + + + {errors.conformPassword?.message} @@ -165,7 +218,7 @@ const ChangePassword = ({ ), diff --git a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx index 9af6d74..18aba78 100644 --- a/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx +++ b/src/Pages/IO_Management/CreateIO/IOTransaction/ViewAmountInvested.jsx @@ -236,7 +236,7 @@ const ViewAmountInvested = ({ isOpen, onClose, id: investorId }) => { /> - {localStorage?.getItem("role") !== "Maker" && + {localStorage?.getItem("role") !== import.meta.env.VITE_VITE_MAKER &&