From a49c7aefc99a1e0584cb0b3fb08d028b65dc35d9 Mon Sep 17 00:00:00 2001
From: rohan09-raj <rajrohan1914@gmail.com>
Date: Sun, 21 Aug 2022 11:55:25 +0530
Subject: Update fixes

---
 .../Update/DocumentScanner/DocumentScanner.jsx     | 39 +++++++++++++++++++---
 1 file changed, 35 insertions(+), 4 deletions(-)

(limited to 'client/src/pages/Update/DocumentScanner/DocumentScanner.jsx')

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 ? (
-- 
cgit 

