Skip to content

Commit 7fca935

Browse files
committed
partial done
1 parent 8371277 commit 7fca935

File tree

7 files changed

+183
-25
lines changed

7 files changed

+183
-25
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
NEXT_PUBLIC_REACT_APP_API_KEY = 08387dfc64msh94f0df087928182p1213afjsn3aa4359e369c
2-
NEXT_APP_SERVER_URL=http://localhost:5001
2+
NEXT_APP_SERVER_URL = http://localhost:5001

next.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
33
reactStrictMode: true,
4+
env: {
5+
NEXT_PUBLIC_REACT_APP_API_KEY: "08387dfc64msh94f0df087928182p1213afjsn3aa4359e369c",
6+
NEXT_APP_SERVER_URL: "http://localhost:5001",
7+
}
48
}
59

610
module.exports = nextConfig

server/constants/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const config = {
2-
PORT: process.env.PORT || 5000,
2+
PORT: process.env.PORT || 5001,
33
JWT_SECRET: process.env.JWT_SECRET || "mysecret",
44
MONGODB_SRV_STRING: process.env.MONGODB_SRV_STRING || "gg",
55
}

src/components/employeeVerificationForm.jsx

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ import DatePicker from "tailwind-datepicker-react"
33
import { DatePickerOptions } from '../constants/Constants'
44
import { Button } from "flowbite-react"
55
import { 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" />
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React, { useState } from 'react'
2+
import { Button } from 'flowbite-react'
3+
import OtpInput from 'react-otp-input';
4+
5+
const OTPVerificationSingleEmployee = ({otp, setOtp, verifyOTPHandler}) => {
6+
7+
return (
8+
<div className='flex flex-col mt-[40px]'>
9+
<div>
10+
<span className='text-[20px]'>We have sent you an OTP on</span><br/>
11+
<span className='text-gray-600 dark:text-gray-200 mt-[10px]'>+91 9137357003</span>
12+
</div>
13+
14+
<div className='flex flex-col justify-center items-center'>
15+
<OtpInput
16+
containerStyle={"flex flex-row gap-x-[15px] text-black mt-[100px] sm:mt-[40px] mb-[30px]"}
17+
inputStyle={"min-w-[50px] min-h-[50px] p-0 rounded-md dark:bg-dark3 text-black dark:text-white"}
18+
value={otp}
19+
onChange={setOtp}
20+
numInputs={4}
21+
// renderSeparator={<span>-</span>}
22+
renderInput={(props) => <input {...props} />}
23+
/>
24+
25+
<Button className="sm:w-[200px] w-[45%]" type="submit" onClick={verifyOTPHandler}>Verify OTP</Button>
26+
<div className="text-[12px] text-[#6A7280] mt-[15px]">
27+
By verifying OTP, your account will be successfully created!
28+
</div>
29+
</div>
30+
31+
</div>
32+
)
33+
}
34+
35+
export default OTPVerificationSingleEmployee

src/constants/config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
export const SERVER_URL = process.env.NEXT_APP_SERVER_URL || "http://localhost:5000";
1+
export const SERVER_URL = process.env.NEXT_APP_SERVER_URL || "http://localhost:5001";
2+
console.log(SERVER_URL, process.env)

src/pages/singleEmployee.jsx

Lines changed: 96 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,108 @@
11
import EmployeeVerificationForm from '@/components/employeeVerificationForm'
2-
import React from 'react'
2+
import OTPVerificationSingleEmployee from '@/components/otpVerificationSingleEmployee'
3+
import React, { useState } from 'react'
34

45
const SingleEmployee = () => {
6+
const [stage, setStage] = useState('details') //details || verifyOTP || verifyImage
7+
const [employeeData, setEmployeeData] = useState({})
8+
const [otp, setOtp] = useState('');
9+
10+
const onProceedHandler = (formData) => {
11+
setEmployeeData(formData)
12+
setStage('verifyOTP')
13+
}
14+
15+
const verifyOTPHandler = () => {
16+
console.log(otp)
17+
setStage('verifyImage')
18+
}
19+
520
return (
621
<div className='w-[70%] dark:text-white dark:bg-dark2 text-dark3'>
722
<div className='flex flex-row items-center text-[26px] font-medium h-[70px] pl-[40px] border-b-[1px] dark:border-[#232830] border-[#DCE3EE] bg-'>
823
Verify Employee
924
</div>
25+
26+
<div className="flex flex-row w-[55%] mt-[20px] mx-auto items-center justify-between text-[14px] font-[12px]">
27+
<div className="flex flex-row items-center text-blue-600 dark:text-blue-500">
28+
<svg
29+
aria-hidden="true"
30+
className="w-4 h-4 mr-2"
31+
fill="currentColor"
32+
viewBox="0 0 20 20"
33+
xmlns="http://www.w3.org/2000/svg"
34+
>
35+
<path
36+
fillRule="evenodd"
37+
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
38+
clipRule="evenodd"
39+
></path>
40+
</svg>
41+
Employee Details
42+
</div>
43+
<div
44+
className={`h-[1px] w-[30px] sm:w-[30px] ${
45+
stage == "verifyOTP" || stage == "verifyImage"
46+
? "bg-blue-600 dark:bg-blue-500"
47+
: "bg-gray-500 dark:bg-gray-200"
48+
}`}
49+
></div>
50+
<div
51+
className={`flex flex-row items-center ${
52+
stage == "verifyOTP" || stage == "verifyImage"
53+
? "text-blue-600 dark:text-blue-500"
54+
: "text-gray-500"
55+
}`}
56+
>
57+
<svg
58+
aria-hidden="true"
59+
className="w-4 h-4 mr-2"
60+
fill="currentColor"
61+
viewBox="0 0 20 20"
62+
xmlns="http://www.w3.org/2000/svg"
63+
>
64+
<path
65+
fillRule="evenodd"
66+
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
67+
clipRule="evenodd"
68+
></path>
69+
</svg>
70+
OTP Verification
71+
</div>
72+
<div
73+
className={`h-[1px] w-[30px] sm:w-[30px] ${
74+
stage == "verifyImage"
75+
? "bg-blue-600 dark:bg-blue-500"
76+
: "bg-gray-500 dark:bg-gray-200"
77+
}`}
78+
></div>
79+
<div
80+
className={`flex flex-row items-center ${
81+
stage == "verifyImage"
82+
? "text-blue-600 dark:text-blue-500"
83+
: "text-gray-500"
84+
}`}
85+
>
86+
<svg
87+
aria-hidden="true"
88+
className="w-4 h-4 mr-2"
89+
fill="currentColor"
90+
viewBox="0 0 20 20"
91+
xmlns="http://www.w3.org/2000/svg"
92+
>
93+
<path
94+
fillRule="evenodd"
95+
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
96+
clipRule="evenodd"
97+
></path>
98+
</svg>
99+
Image Verification
100+
</div>
101+
</div>
102+
10103
<div className='w-[60%] mx-auto'>
11-
<EmployeeVerificationForm/>
104+
{stage == 'details' && <EmployeeVerificationForm onProceedHandler={onProceedHandler}/>}
105+
{stage == 'verifyOTP' && <OTPVerificationSingleEmployee otp={otp} setOtp={setOtp} verifyOTPHandler={verifyOTPHandler}/>}
12106
</div>
13107
</div>
14108
)

0 commit comments

Comments
 (0)