blob: 1732d21863aee37136c2a008c02bf88aaca3c336 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
/* eslint-disable multiline-ternary */
import React from 'react'
import Header from '../../components/Header/Header'
import { Grid, Button } from '@mui/material'
import Input from '../../components/Input/Input'
import { useTranslation } from 'react-i18next'
import { validAadhaar } from '../../constants/RegEx'
import { ToastContainer, toast } from 'react-toastify'
import { userContext } from '../../context/User'
import styles from './CheckStatus.module.css'
import { useNavigate } from 'react-router-dom'
const CheckStatus = () => {
const { t } = useTranslation()
const [status, setStatus] = React.useState('enrollment')
const { aadhaarNumber, setAadhaarNumber, eidNumber, setEidNumber } =
userContext()
const navigate = useNavigate()
console.log(eidNumber, aadhaarNumber)
return (
<>
<ToastContainer
autoClose={1000}
hideProgressBar={true}
theme={'colored'}
/>
<Header subheading={t('STATUS')} />
<div className={styles.status}>
<div className={styles.formone__radio}>
<span className={styles.formone__status}>
<input
type="radio"
id="enrollment"
name="status"
value={status}
onChange={() => {
setStatus('enrollment')
}}
required
/>
<label htmlFor="enrollment">{t('ENROLLMENT_STATUS')}</label>
</span>
<span className={styles.formone__status}>
<input
type="radio"
id="update"
name="status"
value={status}
onChange={() => {
setStatus('update')
}}
required
/>
<label htmlFor="update">{t('UPDATE_STATUS')}</label>
</span>
</div>
</div>
<div>
{status === 'enrollment' ? (
<div className={styles.subheading__container}>
<h3 className={styles.subheading}>
{t('PROVIDE_YOUR_EID_NUMBER')}
</h3>
<Input
type="text"
id="eidNumber"
value={eidNumber}
onChange={(e) => setEidNumber(e.target.value)}
placeholder={`${t('ENTER_YOUR_EID_NUMBER')}`}
required
/>
<Grid container columnSpacing={10} justifyContent="center">
<Grid item>
<Button
color="primary"
size="large"
type="submit"
variant="contained"
onClick={() => {
navigate('/status/otp')
}}
>
{t('SUBMIT')}
</Button>
</Grid>
</Grid>
</div>
) : (
<div className={styles.subheading__container}>
<h3 className={styles.subheading}>
{t('PROVIDE_YOUR_AADHAAR_NUMBER')}
</h3>
<Input
type="number"
id="aadhaarNumber"
value={aadhaarNumber}
onChange={(e) => setAadhaarNumber(e.target.value)}
placeholder={`${t('ENTER_YOUR_AADHAAR_NUMBER')}`}
required
/>
<Grid container columnSpacing={10} justifyContent="center">
<Grid item>
<Button
color="primary"
size="large"
type="submit"
variant="contained"
onClick={() => {
if (!validAadhaar.test(aadhaarNumber)) {
toast.error(t('PLEASE_ENTER_VALID_AADHAAR'))
} else {
navigate('/status/otp')
}
}}
>
{t('SUBMIT')}
</Button>
</Grid>
</Grid>
</div>
)}
</div>
</>
)
}
export default CheckStatus
|