From bf6f667743007df8cef61d4825f360739546bd2a Mon Sep 17 00:00:00 2001
From: rohan09-raj <rajrohan1914@gmail.com>
Date: Fri, 26 Aug 2022 15:32:00 +0530
Subject: updated address component

---
 client/src/pages/Enrollment/Enrollment.jsx | 194 +++++++++++++++++++++--------
 1 file changed, 145 insertions(+), 49 deletions(-)

(limited to 'client/src/pages/Enrollment/Enrollment.jsx')

diff --git a/client/src/pages/Enrollment/Enrollment.jsx b/client/src/pages/Enrollment/Enrollment.jsx
index f3b4c88..c2a895a 100644
--- a/client/src/pages/Enrollment/Enrollment.jsx
+++ b/client/src/pages/Enrollment/Enrollment.jsx
@@ -76,7 +76,7 @@ const Enrollment = () => {
       setPage(page + 1)
     },
     onLoading: () => {
-      return <Spinner heading='ENROLLMENT' />
+      return <Spinner heading="ENROLLMENT" />
     },
     onError: (error) => {
       console.log(error)
@@ -100,41 +100,61 @@ const Enrollment = () => {
       if (userData.indianResident === '') {
         toast.error(t('PLEASE_SELECT_YOUR_RESIDENCY'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/select-residency-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/select-residency-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/select-residency-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/select-residency-hindi.mp3`
+          )
         }
         audio.play()
       } else if (userData.name === '' || userData.name.length < 1) {
         toast.error(t('PLEASE_ENTER_YOUR_NAME'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-name-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-name-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-name-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-name-hindi.mp3`
+          )
         }
         audio.play()
       } else if (!validString.test(userData.name)) {
         toast.error(t('PLEASE_ENTER_VALID_NAME'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-valid-name-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-valid-name-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-valid-name-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-valid-name-hindi.mp3`
+          )
         }
         audio.play()
       } else if (userData.gender === '') {
         toast.error(t('PLEASE_SELECT_YOUR_GENDER'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-select-your-gender-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-select-your-gender-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-select-your-gender-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-select-your-gender-hindi.mp3`
+          )
         }
         audio.play()
       } else if (userData.dob === '') {
         toast.error(t('PLEASE_SELECT_YOUR_DOB'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-select-dob-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-select-dob-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-select-dob-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-select-dob-hindi.mp3`
+          )
         }
         audio.play()
       } else {
@@ -144,33 +164,49 @@ const Enrollment = () => {
       if (userData.mobile === '') {
         toast.error(t('PLEASE_ENTER_YOUR_MOBILE_NUMBER'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-select-mobile-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-select-mobile-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-select-mobile-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-select-mobile-hindi.mp3`
+          )
         }
         audio.play()
       } else if (!validMobileNumber.test(userData.mobile)) {
         toast.error(t('PLEASE_ENTER_VALID_MOBILE_NUMBER'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-select-valid-mobile-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-select-valid-mobile-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-select-valid-mobile-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-select-valid-mobile-hindi.mp3`
+          )
         }
         audio.play()
       } else if (userData.email === '') {
         toast.error(t('PLEASE_ENTER_YOUR_EMAIL'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-email-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-email-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-email-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-email-hindi.mp3`
+          )
         }
         audio.play()
       } else if (!validEmail.test(userData.email)) {
         toast.error(t('PLEASE_ENTER_VALID_EMAIL'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-valid-email-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-valid-email-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-valid-email-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-valid-email-hindi.mp3`
+          )
         }
         audio.play()
       } else {
@@ -180,81 +216,121 @@ const Enrollment = () => {
       if (userData.address.houseNo === '') {
         toast.error(t('PLEASE_ENTER_YOUR_HOUSE_NUMBER'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-house-no-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-house-no-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-house-no-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-house-no-hindi.mp3`
+          )
         }
         audio.play()
       } else if (userData.address.street === '') {
         toast.error(t('PLEASE_ENTER_YOUR_STREET'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-street-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-street-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-street-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-street-hindi.mp3`
+          )
         }
         audio.play()
       } else if (userData.address.locality === '') {
         toast.error(t('PLEASE_ENTER_YOUR_LOCALITY'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-locality-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-locality-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-locality-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-locality-hindi.mp3`
+          )
         }
         audio.play()
       } else if (userData.address.village === '') {
         toast.error(t('PLEASE_ENTER_YOUR_VILLAGE'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-village-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-village-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-village-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-village-hindi.mp3`
+          )
         }
         audio.play()
       } else if (userData.address.postOffice === '') {
         toast.error(t('PLEASE_ENTER_YOUR_AREA_POST_OFFICE'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-post-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-post-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-post-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-post-hindi.mp3`
+          )
         }
         audio.play()
       } else if (userData.address.pincode === '') {
         toast.error(t('PLEASE_ENTER_YOUR_AREA_PINCODE'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-pin-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-pin-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-pin-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-pin-hindi.mp3`
+          )
         }
         audio.play()
       } else if (!validPincode.test(userData.address.pincode)) {
         toast.error(t('PLEASE_ENTER_VALID_PINCODE'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-valid-pin-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-valid-pin-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-enter-valid-pin-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-enter-valid-pin-hindi.mp3`
+          )
         }
         audio.play()
       } else if (!userData.address.state.name) {
         toast.error(t('PLEASE_SELECT_YOUR_STATE'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-select-state-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-select-state-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-select-state-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-select-state-hindi.mp3`
+          )
         }
         audio.play()
       } else if (!userData.address.district.name) {
         toast.error(t('PLEASE_SELECT_YOUR_DISTRICT'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-select-district-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-select-district-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-select-district-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-select-district-hindi.mp3`
+          )
         }
         audio.play()
       } else if (userData.address.landmark === '') {
         toast.error(t('PLEASE_ENTER_NEAREST_LANDMARK'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-select-landmark-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-select-landmark-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-select-landmark-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-select-landmark-hindi.mp3`
+          )
         }
         audio.play()
       } else {
@@ -272,9 +348,13 @@ const Enrollment = () => {
           if (!userData.photo) {
             toast.error(t('PLEASE_CAPTURE_PHOTOGRAPH'))
             if (language === 'en') {
-              audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-capture-photo-english.mp3`)
+              audio = new Audio(
+                `${process.env.PUBLIC_URL}/assets/audios/please-capture-photo-english.mp3`
+              )
             } else if (language === 'hi') {
-              audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-capture-photo-hindi.mp3`)
+              audio = new Audio(
+                `${process.env.PUBLIC_URL}/assets/audios/please-capture-photo-hindi.mp3`
+              )
             }
             audio.play()
           } else if (
@@ -285,18 +365,26 @@ const Enrollment = () => {
           } else {
             toast.error(t('PLEASE_CAPTURE_CLEAR_PHOTOGRAPH'))
             if (language === 'en') {
-              audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-capture-clear-photo-english.mp3`)
+              audio = new Audio(
+                `${process.env.PUBLIC_URL}/assets/audios/please-capture-clear-photo-english.mp3`
+              )
             } else if (language === 'hi') {
-              audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-capture-clear-photo-hindi.mp3`)
+              audio = new Audio(
+                `${process.env.PUBLIC_URL}/assets/audios/please-capture-clear-photo-hindi.mp3`
+              )
             }
             audio.play()
           }
         } else {
           toast.error(t('PLEASE_CAPTURE_CLEAR_PHOTOGRAPH'))
           if (language === 'en') {
-            audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-capture-clear-photo-english.mp3`)
+            audio = new Audio(
+              `${process.env.PUBLIC_URL}/assets/audios/please-capture-clear-photo-english.mp3`
+            )
           } else if (language === 'hi') {
-            audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-capture-clear-photo-hindi.mp3`)
+            audio = new Audio(
+              `${process.env.PUBLIC_URL}/assets/audios/please-capture-clear-photo-hindi.mp3`
+            )
           }
           audio.play()
         }
@@ -305,9 +393,13 @@ const Enrollment = () => {
       if (!userData.documents.POI) {
         toast.error(t('SCAN_YOUR_DOCUMENT'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/scan-documents-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/scan-documents-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/scan-documents-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/scan-documents-hindi.mp3`
+          )
         }
         audio.play()
       } else {
@@ -321,9 +413,13 @@ const Enrollment = () => {
       if (unverified) {
         toast.error(t('PLEASE_VERIFY_OTP'))
         if (language === 'en') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-verify-otp-english.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-verify-otp-english.mp3`
+          )
         } else if (language === 'hi') {
-          audio = new Audio(`${process.env.PUBLIC_URL}/assets/audios/please-verify-otp-hindi.mp3`)
+          audio = new Audio(
+            `${process.env.PUBLIC_URL}/assets/audios/please-verify-otp-hindi.mp3`
+          )
         }
         audio.play()
       } else {
-- 
cgit 

