@@ -3,14 +3,17 @@ import DatePicker from "tailwind-datepicker-react"
33import { DatePickerOptions } from '../constants/Constants'
44import { Button } from "flowbite-react"
55import { useRouter } from 'next/router'
6+ import axios from 'axios'
67
7- const EmployeeVerificationForm = (
8- createAccountHandler ,
8+ const EmployeeVerificationForm = ( {
9+ onProceedHandler ,
910 stage,
1011 setStage,
11- ) => {
12+ } ) => {
1213 const router = useRouter ( )
1314 const [ show , setShow ] = useState ( false )
15+ const [ dob , setDob ] = useState ( )
16+
1417 const handleClose = ( state ) => {
1518 setShow ( state )
1619 }
@@ -26,15 +29,16 @@ const EmployeeVerificationForm = (
2629
2730 const ocr = async ( options ) => {
2831 console . log ( "Inside ocr" )
29- try {
30- const response = await axios . request ( options ) ;
31- console . log ( "Got response" , response ) ;
32- return response . data ;
33- } catch ( err ) {
34- console . error ( err ) ;
35- return { "result" :"1" , "subScans" :[ ] , "value" :"HRE FRE\nGovernment of India\nAmitabh Rajendra Shah\nDOB: 03/02/1990\nMale\n1234 5678 9012\n\u00c5RT TEIR, \u00c0" } ;
36- }
37- // return {"result":"1","subScans":[],"value":"HRE FRE\nGovernment of India\nAmitabh Rajendra Shah\nDOB: 03/02/1990\nMale\n1234 5678 9012\n\u00c5RT TEIR, \u00c0"};
32+ // try {
33+ // const response = await axios.request(options);
34+ // console.log("Got response", response);
35+ // return response.data;
36+ // } catch(err){
37+ // console.error(err);
38+ // return {"result":"1","subScans":[],"value":"HRE FRE\nGovernment of India\nAmitabh Rajendra Shah\nDOB: 03/02/1990\nMale\n1234 5678 9012\n\u00c5RT TEIR, \u00c0"};
39+ // }
40+ const data = { "result" :"1" , "subScans" :[ ] , "value" :"HRE FRE\nGovernment of India\nAmitabh Rajendra Shah\nDOB: 03/02/1990\nMale\n1234 5678 9012\n\u00c5RT TEIR, \u00c0" }
41+ return data ;
3842 }
3943
4044 const handleFileInputChange = ( event ) => {
@@ -65,11 +69,31 @@ const EmployeeVerificationForm = (
6569 console . log ( userName ) ;
6670 console . log ( DOB ) ;
6771 console . log ( aadhar ) ;
72+ document . getElementById ( 'cardNumber' ) . value = aadhar
6873 } ) ;
69- }
74+ }
75+
76+ const onLocalProceedClickHandler = ( event ) => {
77+ event . preventDefault ( ) ;
78+ const firstName = event . target . first_name . value
79+ const lastName = event . target . last_name . value
80+ const gender = event . target . gender . value
81+ const cardNumber = event . target . cardNumber . value
82+
83+ const formData = {
84+ firstName,
85+ lastName,
86+ dob,
87+ gender,
88+ cardNumber
89+ }
90+ onProceedHandler ( formData )
91+ }
92+
93+ console . log ( dob )
7094
7195 return (
72- < form className = "mt-[40px]" action = "" >
96+ < form className = "mt-[40px]" onSubmit = { onLocalProceedClickHandler } >
7397 < div className = "flex flex-col gap-y-[25px]" >
7498 < div className = "flex flex-row justify-between gap-x-[30px]" >
7599 < div className = "w-[45%]" >
@@ -87,7 +111,7 @@ const EmployeeVerificationForm = (
87111 < div className = "flex flex-col w-[45%]" >
88112 < label htmlFor = "" className = "block mb-2 text-sm font-medium text-gray-900 dark:text-white" > Date of Birth</ label >
89113 < div className = "relative cursor-pointer" >
90- < DatePicker id = "dob" options = { DatePickerOptions } show = { show } setShow = { handleClose } />
114+ < DatePicker id = "dob" options = { DatePickerOptions } show = { show } setShow = { handleClose } onChange = { setDob } />
91115 </ div >
92116 </ div >
93117
@@ -108,8 +132,8 @@ const EmployeeVerificationForm = (
108132
109133 < div className = "flex flex-row gap-x-[30px]" >
110134 < div className = "w-[45%]" >
111- < label htmlFor = "restuarant_address " className = "block mb-2 text-sm font-medium text-gray-900 dark:text-white" > Address</ label >
112- < input type = "address" id = "restuarantAddress " className = "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder = "L-12 Link Road, Andheri" required />
135+ < label htmlFor = "empolyee_address " className = "block mb-2 text-sm font-medium text-gray-900 dark:text-white" > Address</ label >
136+ < input type = "address" id = "employeeAddress " className = "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder = "L-12 Link Road, Andheri" required />
113137 </ div >
114138 </ div >
115139
@@ -126,9 +150,9 @@ const EmployeeVerificationForm = (
126150
127151 < div className = "flex flex-col w-[45%]" >
128152 < div className = "flex items-center justify-center w-full" >
129- < label for = "dropzone-file" className = "flex flex-col items-center justify-center w-full h-[70px] border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600" >
153+ < label htmlFor = "dropzone-file" className = "flex flex-col items-center justify-center w-full h-[70px] border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600" >
130154 < div className = "flex flex-col items-center justify-center" >
131- < svg aria-hidden = "true" className = "w-4 h-4 text-gray-400" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" xmlns = "http://www.w3.org/2000/svg" > < path stroke-linecap = "round" stroke-linejoin = "round" stroke-width = "2" d = "M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" > </ path > </ svg >
155+ < svg aria-hidden = "true" className = "w-4 h-4 text-gray-400" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" xmlns = "http://www.w3.org/2000/svg" > < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = "2" d = "M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" > </ path > </ svg >
132156 < p className = "mb-2 text-[10px] text-gray-500 dark:text-gray-400" > < span className = "font-semibold" > Click to upload</ span > or drag and drop</ p >
133157 < p className = "text-[8px] text-gray-500 dark:text-gray-400" > SVG, PNG, JPG or GIF (MAX. 800x400px)</ p >
134158 </ div >
@@ -249,7 +273,7 @@ const EmployeeVerificationForm = (
249273 </ div >
250274
251275 < div className = "flex flex-row gap-x-[20px] mt-[45px] items-center justify-center" >
252- < Button className = "sm:w-[200px] w-[45%]" type = "button" onClick = { verifyAadhaarPan } >
276+ < Button className = "sm:w-[200px] w-[45%]" type = "submit" >
253277 Proceed
254278 < svg xmlns = "http://www.w3.org/2000/svg" fill = "none" viewBox = "0 0 24 24" strokeWidth = { 1.5 } stroke = "currentColor" className = "w-5 h-5 ml-[10px]" >
255279 < path strokeLinecap = "round" strokeLinejoin = "round" d = "M4.5 12h15m0 0l-6.75-6.75M19.5 12l-6.75 6.75" />
0 commit comments