summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorrohan09-raj <rajrohan1914@gmail.com>2022-08-21 11:55:25 +0530
committerrohan09-raj <rajrohan1914@gmail.com>2022-08-21 11:55:25 +0530
commita49c7aefc99a1e0584cb0b3fb08d028b65dc35d9 (patch)
treef683612122aa478c531ed4082ed14dcd070813b1 /client
parent4480f2d62865a585f8bbf0cd7122a25d0413bf2b (diff)
Update fixes
Diffstat (limited to 'client')
-rw-r--r--client/src/components/Card/CardAgreement.jsx4
-rw-r--r--client/src/components/Card/CardBiometrics.jsx2
-rw-r--r--client/src/components/Card/CardScanner.jsx2
-rw-r--r--client/src/components/LanguageSelect/locales/en/translation.json6
-rw-r--r--client/src/components/LanguageSelect/locales/hi/translation.json4
-rw-r--r--client/src/pages/Enrollment/Agreement/Agreement.jsx4
-rw-r--r--client/src/pages/Update/Agreement/Agreement.jsx47
-rw-r--r--client/src/pages/Update/Biometric/Biometric.jsx8
-rw-r--r--client/src/pages/Update/Demographic/Demographic.jsx16
-rw-r--r--client/src/pages/Update/DocumentScanner/DocumentScanner.jsx39
-rw-r--r--client/src/pages/Update/FinalSlip/FinalSlip.jsx4
11 files changed, 103 insertions, 33 deletions
diff --git a/client/src/components/Card/CardAgreement.jsx b/client/src/components/Card/CardAgreement.jsx
index 77bb1a0..fe4edb1 100644
--- a/client/src/components/Card/CardAgreement.jsx
+++ b/client/src/components/Card/CardAgreement.jsx
@@ -1,6 +1,5 @@
import React from 'react'
import styles from './CardAgreement.module.css'
-import SubmitButton from '../SubmitButton/SubmitButton'
import { Typography } from '@mui/material'
import { useTranslation } from 'react-i18next'
@@ -10,11 +9,10 @@ const CardAgreement = ({ title, image }) => {
<>
<div className={styles.card}>
<img className={styles.card__image} src={image} alt="" />
- <Typography align='center'>
+ <Typography align="center">
{t('I_HEREBY_CONFIRM_THE_IDENTITY_AND_ADDRESS')}
</Typography>
</div>
- <SubmitButton />
</>
)
}
diff --git a/client/src/components/Card/CardBiometrics.jsx b/client/src/components/Card/CardBiometrics.jsx
index 49a913e..bff00a5 100644
--- a/client/src/components/Card/CardBiometrics.jsx
+++ b/client/src/components/Card/CardBiometrics.jsx
@@ -1,6 +1,5 @@
import React from 'react'
import styles from './CardBiometrics.module.css'
-import SubmitButton from '../SubmitButton/SubmitButton'
const CardBiometrics = ({ title, image }) => {
return (
@@ -8,7 +7,6 @@ const CardBiometrics = ({ title, image }) => {
<div className={styles.card}>
<img className={styles.card__image} src={image} alt="" />
</div>
- <SubmitButton />
</>
)
}
diff --git a/client/src/components/Card/CardScanner.jsx b/client/src/components/Card/CardScanner.jsx
index 29caf39..f946c5b 100644
--- a/client/src/components/Card/CardScanner.jsx
+++ b/client/src/components/Card/CardScanner.jsx
@@ -1,6 +1,5 @@
import React from 'react'
import styles from './CardScanner.module.css'
-import SubmitButton from '../SubmitButton/SubmitButton'
const CardScanner = ({ title, image }) => {
return (
@@ -8,7 +7,6 @@ const CardScanner = ({ title, image }) => {
<div className={styles.card}>
<img className={styles.card__image} src={image} alt="" />
</div>
- <SubmitButton />
</>
)
}
diff --git a/client/src/components/LanguageSelect/locales/en/translation.json b/client/src/components/LanguageSelect/locales/en/translation.json
index bf73d43..5f6da2c 100644
--- a/client/src/components/LanguageSelect/locales/en/translation.json
+++ b/client/src/components/LanguageSelect/locales/en/translation.json
@@ -86,7 +86,7 @@
"PLEASE_TAKE_THE_PICTURE_OF_THE_PROOF_OF_ADDRESS": "Please take the picture of the Proof of Identity",
"PLEASE_TAKE_THE_PICTURE_OF_THE_PROOF_OF_DATE_OF_BIRTH": "Please take the picture of the Proof of Date of Birth",
"PLEASE_CAPTURE_PHOTOGRAPH": "Please capture photograph",
- "SCAN_YOUR_DOCUMENT": "Scan your document",
+ "SCAN_YOUR_DOCUMENT": "Please scan your document",
"INCORRECT_OTP": "Incorrect OTP!",
"OTP_VERIFIED!": "OTP verified!",
"PROVIDE_YOUR_AADHAAR_NUMBER": "Provide your Aadhaar Number",
@@ -96,5 +96,7 @@
"ENTER_OTP": "Enter OTP",
"SENT_TO_YOUR_REGISTERED_MOBILE_NUMBER": "Sent to your registered mobile number",
"PLEASE_VERIFY_OTP": "Please verify OTP",
- "USER_ALREADY_EXISTS": "USER ALREADY EXISTS"
+ "USER_ALREADY_EXISTS": "USER ALREADY EXISTS",
+ "YOU_HAVEN'T_UPDATED_ANYTHING": "You haven't updated anything.",
+ "YOU_MAY_EITHER_UPDATE_OR_MOVE_TO_NEXT_STEP": "You may either update or move to the next step"
}
diff --git a/client/src/components/LanguageSelect/locales/hi/translation.json b/client/src/components/LanguageSelect/locales/hi/translation.json
index eedee10..99053c9 100644
--- a/client/src/components/LanguageSelect/locales/hi/translation.json
+++ b/client/src/components/LanguageSelect/locales/hi/translation.json
@@ -96,5 +96,7 @@
"ENTER_OTP": "ओटीपी दर्ज करें",
"SENT_TO_YOUR_REGISTERED_MOBILE_NUMBER": "आपके पंजीकृत मोबाइल नंबर पर भेजा गया",
"PLEASE_VERIFY_OTP": "कृपया ओटीपी सत्यापित करें",
- "USER_ALREADY_EXISTS": "उपयोगकर्ता पहले से मौजूद है"
+ "USER_ALREADY_EXISTS": "उपयोगकर्ता पहले से मौजूद है",
+ "YOU_HAVEN'T_UPDATED_ANYTHING": "आपने कोई भी अपडेट नहीं किया है",
+ "YOU_MAY_EITHER_UPDATE_OR_MOVE_TO_NEXT_STEP": "आप अपडेट कर सकते हैं या अगले चरण पर चले जाएँ"
}
diff --git a/client/src/pages/Enrollment/Agreement/Agreement.jsx b/client/src/pages/Enrollment/Agreement/Agreement.jsx
index 7b1b9c6..15bb639 100644
--- a/client/src/pages/Enrollment/Agreement/Agreement.jsx
+++ b/client/src/pages/Enrollment/Agreement/Agreement.jsx
@@ -18,13 +18,11 @@ const Agreement = ({ unverified, setUnverified }) => {
const [finalDisable, setFinalDisable] = useState(false)
const [show, setShow] = useState(false)
const { userData } = userContext()
- console.log(userData)
+
const { data, mutate } = useMutation(() =>
sendOTP({ mobile: `+91${userData?.mobile}` })
)
- console.log('Disabled: ', disabled, 'Final Disable: ', finalDisable)
-
const verifyOTP = () => {
if (data?.data?.otpCode === Number(otp)) {
console.log('Disabled: ', disabled, 'Final Disable: ', finalDisable)
diff --git a/client/src/pages/Update/Agreement/Agreement.jsx b/client/src/pages/Update/Agreement/Agreement.jsx
index 2d1361d..e49bbe6 100644
--- a/client/src/pages/Update/Agreement/Agreement.jsx
+++ b/client/src/pages/Update/Agreement/Agreement.jsx
@@ -3,32 +3,53 @@ import Header from '../../../components/Header/Header'
import CardAgreement from '../../../components/Card/CardAgreement'
import styles from './Agreement.module.css'
import Input from '../../../components/Input/Input'
-import { Link } from 'react-router-dom'
+import { useNavigate } from 'react-router-dom'
import SubmitButton from '../../../components/SubmitButton/SubmitButton'
import { Button, Typography } from '@mui/material'
import { useTranslation } from 'react-i18next'
-import { sendOTP, updateUser } from '../../../services/apiservice'
+import { sendOTP, updateUser, sendMessage } from '../../../services/apiservice'
import { userContext } from '../../../context/User'
import { useMutation } from 'react-query'
import { ToastContainer, toast } from 'react-toastify'
import 'react-toastify/dist/ReactToastify.css'
-const Agreement = ({ unverified, setUnverified }) => {
+const Agreement = () => {
const { t } = useTranslation()
+ const navigate = useNavigate()
const [otp, setOtp] = useState()
+ const [unverified, setUnverified] = useState(true)
const [disabled, setDisabled] = useState(false)
const [finalDisable, setFinalDisable] = useState(false)
const [show, setShow] = useState(false)
const { userData } = userContext()
- const updateUse = useMutation(() => updateUser(userData._id, { ...userData }))
+ const updateUse = useMutation(
+ () => updateUser(userData._id, { ...userData }),
+ {
+ onSuccess: () => {
+ setConfirm.mutate({
+ mobile: `+91${userData.mobile}`,
+ id: userData._id
+ })
+ }
+ }
+ )
+
+ const setConfirm = useMutation(
+ (payload) => {
+ sendMessage(payload)
+ },
+ {
+ onSuccess: () => {
+ navigate('/update/final-slip')
+ }
+ }
+ )
const { data, mutate } = useMutation(() =>
sendOTP({ mobile: `+91${userData?.mobile}` })
)
- console.log('Disabled: ', disabled, 'Final Disable: ', finalDisable)
-
const verifyOTP = () => {
if (data?.data?.otpCode === Number(otp)) {
console.log('Disabled: ', disabled, 'Final Disable: ', finalDisable)
@@ -38,7 +59,7 @@ const Agreement = ({ unverified, setUnverified }) => {
setUnverified(false)
toast.success(t('OTP_VERIFIED!'))
} else {
- toast.error(t('INCORRECT_OTP!'))
+ toast.error(t('INCORRECT_OTP'))
}
}
@@ -106,9 +127,15 @@ const Agreement = ({ unverified, setUnverified }) => {
</>
)}
</div>
- <Link to="/update/final-slip">
- <SubmitButton onClick={() => updateUse.mutate()} />
- </Link>
+ <SubmitButton
+ onClick={() => {
+ if (unverified) {
+ toast.error(t('PLEASE_VERIFY_OTP'))
+ } else {
+ updateUse.mutate()
+ }
+ }}
+ />
</>
)
}
diff --git a/client/src/pages/Update/Biometric/Biometric.jsx b/client/src/pages/Update/Biometric/Biometric.jsx
index 6737ed9..275df89 100644
--- a/client/src/pages/Update/Biometric/Biometric.jsx
+++ b/client/src/pages/Update/Biometric/Biometric.jsx
@@ -28,14 +28,14 @@ const Biometric = () => {
if (!userData.photo) {
setUserData({ ...userData, photo: oriUserData.photo })
}
- setPage(page - 1)
+ setPage(4) // DUMMY VALUE 4
}
const handleSubmit = () => {
if (!userData.photo) {
setUserData({ ...userData, photo: oriUserData.photo })
}
- setPage(page + 1)
+ setPage(4)
}
const conditionalButton = () => {
@@ -51,14 +51,14 @@ const Biometric = () => {
return (
<>
<SubmitButton onClick={() => setPage(4)} />
- <BackButton onClick={() => setPage(page - 1)} />
+ <BackButton onClick={() => setPage(4)} />
</>
)
case 2:
return (
<>
<SubmitButton onClick={() => setPage(4)} />
- <BackButton onClick={() => setPage(page - 1)} />
+ <BackButton onClick={() => setPage(4)} />
</>
)
}
diff --git a/client/src/pages/Update/Demographic/Demographic.jsx b/client/src/pages/Update/Demographic/Demographic.jsx
index 0f89fe2..03f107a 100644
--- a/client/src/pages/Update/Demographic/Demographic.jsx
+++ b/client/src/pages/Update/Demographic/Demographic.jsx
@@ -15,10 +15,15 @@ import { userContext } from '../../../context/User'
import { ToastContainer, toast } from 'react-toastify'
import BackButton from '../../../components/BackButton/BackButton'
import 'react-toastify/dist/ReactToastify.css'
+import { useNavigate } from 'react-router-dom'
+import { initialUserData } from '../../../constants/userData'
const Demographic = () => {
const { t } = useTranslation()
- const { userData } = userContext()
+ const { userData, setUserData, setOriUserData, setAadhaarNumber } =
+ userContext()
+
+ const navigate = useNavigate()
const [page, setPage] = useState(0)
@@ -91,7 +96,14 @@ const Demographic = () => {
return (
<>
<SubmitButton onClick={handleSubmit} />
- <BackButton onClick={() => setPage(page - 1)} />
+ <BackButton
+ onClick={() => {
+ setUserData(initialUserData)
+ setOriUserData(initialUserData)
+ setAadhaarNumber('')
+ navigate('/')
+ }}
+ />
</>
)
case 1:
diff --git a/client/src/pages/Update/DocumentScanner/DocumentScanner.jsx b/client/src/pages/Update/DocumentScanner/DocumentScanner.jsx
index 0fe8d42..89c9479 100644
--- a/client/src/pages/Update/DocumentScanner/DocumentScanner.jsx
+++ b/client/src/pages/Update/DocumentScanner/DocumentScanner.jsx
@@ -71,9 +71,29 @@ const DocumentScanner = () => {
})
const handleNext = () => {
- if (activeStep === steps.length - 1) {
+ if (
+ activeStep === steps.length - 1 &&
+ documents.POI !== '' &&
+ documents.POA !== '' &&
+ documents.DOB !== ''
+ ) {
setUserData({ ...userData, documents: documents })
+ } else if (documents.POI !== '' && documents.POA !== '') {
+ toast.error(t('SCAN_YOUR_DOCUMENT'))
+ } else if (documents.POI !== '' && documents.DOB !== '') {
+ toast.error(t('SCAN_YOUR_DOCUMENT'))
+ } else if (documents.POA !== '' && documents.DOB !== '') {
+ toast.error(t('SCAN_YOUR_DOCUMENT'))
+ } else if (documents.POI !== '') {
+ toast.error(t('SCAN_YOUR_DOCUMENT'))
+ } else if (documents.POA !== '') {
+ toast.error(t('SCAN_YOUR_DOCUMENT'))
+ } else if (documents.DOB !== '') {
+ toast.error(t('SCAN_YOUR_DOCUMENT'))
+ } else {
+ toast.error(t('SCAN_YOUR_DOCUMENT'))
}
+
if (
(!documents.POI && activeStep === 0) ||
(!documents.POA && activeStep === 1) ||
@@ -199,9 +219,20 @@ const DocumentScanner = () => {
})}
</Stepper>
{activeStep === steps.length ? (
- <Typography variant="h3" sx={{ mt: 8, mb: 1 }}>
- {t('ALL_STEPS_COMPLETED')}
- </Typography>
+ steps.length === 0 ? (
+ <>
+ <Typography variant="h4" sx={{ mt: 8, mb: 1 }}>
+ {t("YOU_HAVEN'T_UPDATED_ANYTHING")}
+ </Typography>
+ <Typography variant="h4" sx={{ mt: 8, mb: 1 }}>
+ {t('YOU_MAY_EITHER_UPDATE_OR_MOVE_TO_NEXT_STEP')}
+ </Typography>
+ </>
+ ) : (
+ <Typography variant="h3" sx={{ mt: 8, mb: 1 }}>
+ {t('ALL_STEPS_COMPLETED')}
+ </Typography>
+ )
) : (
<React.Fragment>
{activeStep === 0 ? (
diff --git a/client/src/pages/Update/FinalSlip/FinalSlip.jsx b/client/src/pages/Update/FinalSlip/FinalSlip.jsx
index ae1ea31..4212be4 100644
--- a/client/src/pages/Update/FinalSlip/FinalSlip.jsx
+++ b/client/src/pages/Update/FinalSlip/FinalSlip.jsx
@@ -4,9 +4,12 @@ import CardScanner from '../../../components/Card/CardScanner'
import styles from './FinalSlip.module.css'
import { Grid, Typography } from '@mui/material'
import { useTranslation } from 'react-i18next'
+import SubmitButton from '../../../components/SubmitButton/SubmitButton'
+import { useNavigate } from 'react-router-dom'
const FinalSlip = () => {
const { t } = useTranslation()
+ const navigate = useNavigate()
return (
<>
<Header subheading={t('UPDATE')} />
@@ -24,6 +27,7 @@ const FinalSlip = () => {
</Typography>
</Grid>
</div>
+ <SubmitButton onClick={() => navigate('/')} />
</>
)
}