@djb25/digit-ui-module-ekyc 1.0.24 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +2011 -1164
- package/dist/index.modern.js.map +1 -1
- package/package.json +3 -1
- package/src/Module.js +0 -2
- package/src/components/AadhaarVerification.js +239 -339
- package/src/components/AssignEkyc.js +10 -67
- package/src/components/AssignEkycModal.js +21 -4
- package/src/components/DesktopInbox.js +1 -1
- package/src/components/EKYCCard.js +6 -8
- package/src/components/MeterDetails.js +227 -263
- package/src/components/PropertyInfo.js +176 -215
- package/src/components/Review.js +70 -13
- package/src/components/SearchFormFieldsComponent.js +4 -4
- package/src/components/SurveyorDetailsCard.js +220 -27
- package/src/config/AadhaarVerificationConfig.js +367 -0
- package/src/config/MeterDetailsConfig.js +297 -0
- package/src/config/PropertyInfoConfig.js +145 -0
- package/src/config/config.js +1 -0
- package/src/hook/SupervisorInboxTableConfig.js +2 -53
- package/src/hook/useInboxTableConfig.js +5 -5
- package/src/pages/citizen/Inbox.js +19 -9
- package/src/pages/citizen/index.js +44 -17
- package/src/pages/employee/ConsumerDetails.js +82 -24
- package/src/pages/employee/EKYCForm.js +21 -20
- package/src/pages/employee/Inbox.js +13 -7
- package/src/pages/employee/index.js +42 -13
- package/src/utils/reportDownloader.js +75 -0
- package/src/components/AddressDetails.js +0 -207
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
|
|
2
1
|
import React, { useState, Fragment, useEffect } from "react";
|
|
3
2
|
import { useLocation } from "react-router-dom";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
UploadFile,
|
|
9
|
-
RadioButtons,
|
|
10
|
-
Toast,
|
|
11
|
-
FormStep,
|
|
12
|
-
Loader,
|
|
13
|
-
CheckBox
|
|
14
|
-
} from "@djb25/digit-ui-react-components";
|
|
3
|
+
import { Toast, Loader, FormComposer } from "@djb25/digit-ui-react-components";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import AadhaarVerificationConfig from "../config/AadhaarVerificationConfig";
|
|
6
|
+
|
|
15
7
|
const AadhaarVerification = ({ config, onSelect, formData }) => {
|
|
8
|
+
const { t } = useTranslation();
|
|
16
9
|
const location = useLocation();
|
|
17
10
|
const flowState = location.state || {};
|
|
18
11
|
|
|
19
12
|
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
20
|
-
const
|
|
13
|
+
const queryParams = new URLSearchParams(location.search);
|
|
14
|
+
const urlKno = queryParams.get("kno");
|
|
15
|
+
const searchKno =
|
|
16
|
+
urlKno ||
|
|
17
|
+
flowState?.kNumber ||
|
|
18
|
+
flowState?.kno ||
|
|
19
|
+
formData?.kNumber ||
|
|
20
|
+
formData?.kno ||
|
|
21
|
+
sessionStorage.getItem("EKYC_K_NUMBER") ||
|
|
22
|
+
"";
|
|
21
23
|
|
|
22
24
|
const { isLoading, data: searchData } = Digit.Hooks.ekyc.useSearchConnection(
|
|
23
|
-
{ tenantId, details: { kno: searchKno } },
|
|
25
|
+
{ tenantId, details: { kno: searchKno, fetchType: "CONNECTION" } },
|
|
24
26
|
{ enabled: !!searchKno, cacheTime: 0 }
|
|
25
27
|
);
|
|
26
28
|
|
|
@@ -29,213 +31,250 @@ const AadhaarVerification = ({ config, onSelect, formData }) => {
|
|
|
29
31
|
const savedData = formData?.aadhaarVerification || {};
|
|
30
32
|
|
|
31
33
|
// 🔹 STATES
|
|
32
|
-
const [kno, setKno] = useState(savedData.kno || searchKno || "");
|
|
33
|
-
const [consumerType, setConsumerType] = useState(savedData.consumerType ? { name: savedData.consumerType } : null);
|
|
34
|
-
const [occupantType, setOccupantType] = useState(savedData.occupantType ? { name: savedData.occupantType } : null);
|
|
35
|
-
const [categoryType, setCategoryType] = useState(savedData.categoryType ? { name: savedData.categoryType } : null);
|
|
36
|
-
|
|
37
|
-
const [consumerName, setConsumerName] = useState(savedData.consumerName || "");
|
|
38
|
-
const [firstName, setFirstName] = useState(savedData.firstName || "");
|
|
39
|
-
const [middleName, setMiddleName] = useState(savedData.middleName || "");
|
|
40
|
-
const [lastName, setLastName] = useState(savedData.lastName || "");
|
|
41
|
-
|
|
42
|
-
const [gender, setGender] = useState(savedData.gender ? { name: savedData.gender } : null);
|
|
43
|
-
const [parentSpouseName, setParentSpouseName] = useState(savedData.parentSpouseName || "");
|
|
44
|
-
const [relation, setRelation] = useState(savedData.relation || "");
|
|
45
|
-
|
|
46
|
-
const [mobile, setMobile] = useState(savedData.mobile || "");
|
|
47
|
-
const [whatsapp, setWhatsapp] = useState(savedData.whatsapp || "");
|
|
48
|
-
const [email, setEmail] = useState(savedData.email || "");
|
|
49
|
-
const [residents, setResidents] = useState(savedData.residents || "");
|
|
50
|
-
|
|
51
|
-
// Tenant
|
|
52
|
-
const [documentProof, setDocumentProof] = useState(savedData.documentProof || null);
|
|
53
34
|
const [documentId, setDocumentId] = useState(savedData.documentId || null);
|
|
54
|
-
const [
|
|
55
|
-
const [tenantVerification, setTenantVerification] = useState(savedData.tenantVerification || "");
|
|
56
|
-
|
|
57
|
-
// Govt
|
|
58
|
-
const [designation, setDesignation] = useState(savedData.designation || "");
|
|
59
|
-
const [department, setDepartment] = useState(savedData.department || "");
|
|
60
|
-
const [employeeId, setEmployeeId] = useState(savedData.employeeId || "");
|
|
61
|
-
const [landline, setLandline] = useState(savedData.landline || "");
|
|
62
|
-
|
|
63
|
-
// Other Entity
|
|
64
|
-
const [entityRelation, setEntityRelation] = useState(savedData.entityRelation || "");
|
|
65
|
-
const [contactPerson, setContactPerson] = useState(savedData.contactPerson || "");
|
|
66
|
-
const [entityName, setEntityName] = useState(savedData.entityName || "");
|
|
67
|
-
|
|
68
|
-
// Identity
|
|
69
|
-
const [idProof, setIdProof] = useState(savedData.idProof ? { name: savedData.idProof } : null);
|
|
70
|
-
const [idNumber, setIdNumber] = useState(savedData.idNumber || "");
|
|
71
|
-
const [documentNumber, setDocumentNumber] = useState(savedData.documentNumber || "");
|
|
72
|
-
const [identityType, setIdentityType] = useState(savedData.identityType ? { name: savedData.identityType } : null);
|
|
73
|
-
const [idFile, setIdFile] = useState(savedData.idFile || null);
|
|
74
|
-
|
|
75
|
-
// Consent
|
|
76
|
-
const [consent, setConsent] = useState(savedData.consent || false);
|
|
77
|
-
const [informantIsConsumer, setInformantIsConsumer] = useState(savedData.informantIsConsumer ?? true);
|
|
78
|
-
const [informantName, setInformantName] = useState(savedData.informantName || "");
|
|
79
|
-
const [informantRelation, setInformantRelation] = useState(savedData.informantRelation || "");
|
|
80
|
-
|
|
35
|
+
const [documentProof, setDocumentProof] = useState(savedData.documentProof || null);
|
|
81
36
|
const [toast, setToast] = useState(null);
|
|
37
|
+
const [isDataLoaded, setIsDataLoaded] = useState(false);
|
|
38
|
+
const [canSubmit, setCanSubmit] = useState(false);
|
|
39
|
+
|
|
40
|
+
const [defaultValues, setDefaultValues] = useState(() => ({
|
|
41
|
+
kno: savedData.kno || searchKno || "",
|
|
42
|
+
consumerType: savedData.consumerType ? { name: savedData.consumerType } : null,
|
|
43
|
+
occupantType: savedData.occupantType ? { name: savedData.occupantType } : null,
|
|
44
|
+
categoryType: savedData.categoryType ? { name: savedData.categoryType } : null,
|
|
45
|
+
firstName: savedData.firstName || "",
|
|
46
|
+
middleName: savedData.middleName || "",
|
|
47
|
+
lastName: savedData.lastName || "",
|
|
48
|
+
gender: savedData.gender ? { name: savedData.gender } : null,
|
|
49
|
+
parentSpouseName: savedData.parentSpouseName || "",
|
|
50
|
+
mobile: savedData.mobile || "",
|
|
51
|
+
whatsapp: savedData.whatsapp || "",
|
|
52
|
+
email: savedData.email || "",
|
|
53
|
+
residents: savedData.residents || "",
|
|
54
|
+
identityType: savedData.identityType ? { name: savedData.identityType } : null,
|
|
55
|
+
documentNumber: savedData.documentNumber || "",
|
|
56
|
+
informantIsConsumer: savedData.informantIsConsumer ?? true,
|
|
57
|
+
informantName: savedData.informantName || "",
|
|
58
|
+
informantRelation: savedData.informantRelation || "",
|
|
59
|
+
documentId: savedData.documentId || null,
|
|
60
|
+
documentProof: savedData.documentProof || null,
|
|
61
|
+
idFile: savedData.idFile || null,
|
|
62
|
+
ownerMobile: savedData.ownerMobile || "",
|
|
63
|
+
tenantVerification: savedData.tenantVerification || "",
|
|
64
|
+
designation: savedData.designation || "",
|
|
65
|
+
department: savedData.department || "",
|
|
66
|
+
employeeId: savedData.employeeId || "",
|
|
67
|
+
entityName: savedData.entityName || "",
|
|
68
|
+
contactPerson: savedData.contactPerson || "",
|
|
69
|
+
consent: savedData.consent || false,
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
const [localFormData, setLocalFormData] = useState(defaultValues);
|
|
73
|
+
|
|
74
|
+
const extractApplicationData = (searchData) => {
|
|
75
|
+
if (!searchData) return null;
|
|
76
|
+
const reviewWrapper =
|
|
77
|
+
searchData?.applicationReviewInfo || searchData?.applicationReview || searchData;
|
|
78
|
+
const applicationData = (Array.isArray(reviewWrapper) ? reviewWrapper[0] : reviewWrapper) || {};
|
|
79
|
+
return applicationData?.newData || applicationData;
|
|
80
|
+
};
|
|
82
81
|
|
|
83
82
|
useEffect(() => {
|
|
84
|
-
const
|
|
83
|
+
const appData = extractApplicationData(searchData);
|
|
84
|
+
const rawData = appData || formData?.connectionDetails;
|
|
85
85
|
const details = rawData?.connectionDetails || rawData || {};
|
|
86
86
|
const addrDetails = rawData?.addressDetails || {};
|
|
87
87
|
|
|
88
|
-
if (details && Object.keys(details).length > 0 && !
|
|
89
|
-
|
|
88
|
+
if (details && Object.keys(details).length > 0 && !isDataLoaded) {
|
|
89
|
+
let fName = "";
|
|
90
|
+
let mName = "";
|
|
91
|
+
let lName = "";
|
|
90
92
|
|
|
91
93
|
if (details.firstName) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
fName = details.firstName;
|
|
95
|
+
mName = details.middleName || "";
|
|
96
|
+
lName = details.lastName || "";
|
|
95
97
|
} else if (details.consumerName) {
|
|
96
|
-
setConsumerName(details.consumerName);
|
|
97
98
|
const parts = details.consumerName.trim().split(/\s+/);
|
|
98
|
-
|
|
99
|
-
if (parts.length === 2)
|
|
99
|
+
fName = parts[0] || "";
|
|
100
|
+
if (parts.length === 2) lName = parts[1];
|
|
100
101
|
if (parts.length > 2) {
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
mName = parts.slice(1, -1).join(" ");
|
|
103
|
+
lName = parts[parts.length - 1];
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
107
|
+
const updatedDefaults = {
|
|
108
|
+
kno: savedData.kno || searchKno || "",
|
|
109
|
+
consumerType: savedData.consumerType
|
|
110
|
+
? { name: savedData.consumerType }
|
|
111
|
+
: details.consumerType
|
|
112
|
+
? { name: details.consumerType }
|
|
113
|
+
: null,
|
|
114
|
+
occupantType: savedData.occupantType
|
|
115
|
+
? { name: savedData.occupantType }
|
|
116
|
+
: details.occupantType
|
|
117
|
+
? { name: details.occupantType }
|
|
118
|
+
: null,
|
|
119
|
+
categoryType: savedData.categoryType ? { name: savedData.categoryType } : null,
|
|
120
|
+
firstName: savedData.firstName || fName,
|
|
121
|
+
middleName: savedData.middleName || mName,
|
|
122
|
+
lastName: savedData.lastName || lName,
|
|
123
|
+
gender: savedData.gender
|
|
124
|
+
? { name: savedData.gender }
|
|
125
|
+
: details.gender
|
|
126
|
+
? { name: details.gender }
|
|
127
|
+
: null,
|
|
128
|
+
parentSpouseName: savedData.parentSpouseName || details.parentSpouse || "",
|
|
129
|
+
mobile: savedData.mobile || details.phoneNumber || addrDetails.mobileNo || "",
|
|
130
|
+
whatsapp: savedData.whatsapp || addrDetails.whatsappNo || "",
|
|
131
|
+
email: savedData.email || details.email || addrDetails.email || "",
|
|
132
|
+
residents: savedData.residents || (addrDetails.noOfPerson ? String(addrDetails.noOfPerson) : ""),
|
|
133
|
+
identityType: savedData.identityType ? { name: savedData.identityType } : null,
|
|
134
|
+
documentNumber: savedData.documentNumber || "",
|
|
135
|
+
informantIsConsumer: savedData.informantIsConsumer ?? true,
|
|
136
|
+
informantName: savedData.informantName || details.informantName || "",
|
|
137
|
+
informantRelation: savedData.informantRelation || details.informantRelation || "",
|
|
138
|
+
documentId: savedData.documentId || details.documentNumber || null,
|
|
139
|
+
documentProof: savedData.documentProof || null,
|
|
140
|
+
idFile: savedData.idFile || null,
|
|
141
|
+
ownerMobile: savedData.ownerMobile || "",
|
|
142
|
+
tenantVerification: savedData.tenantVerification || "",
|
|
143
|
+
designation: savedData.designation || "",
|
|
144
|
+
department: savedData.department || "",
|
|
145
|
+
employeeId: savedData.employeeId || "",
|
|
146
|
+
entityName: savedData.entityName || "",
|
|
147
|
+
contactPerson: savedData.contactPerson || "",
|
|
148
|
+
consent: savedData.consent || false,
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
setDefaultValues(updatedDefaults);
|
|
152
|
+
setLocalFormData(updatedDefaults);
|
|
153
|
+
if (updatedDefaults.documentId) {
|
|
154
|
+
setDocumentId(updatedDefaults.documentId);
|
|
155
|
+
}
|
|
156
|
+
if (updatedDefaults.documentProof) {
|
|
157
|
+
setDocumentProof(updatedDefaults.documentProof);
|
|
118
158
|
}
|
|
119
|
-
|
|
120
|
-
if (details.informantRelation) setInformantRelation(details.informantRelation);
|
|
159
|
+
setIsDataLoaded(true);
|
|
121
160
|
}
|
|
122
|
-
}, [searchData, formData?.connectionDetails,
|
|
123
|
-
|
|
124
|
-
// 🔹 OPTIONS
|
|
125
|
-
const consumerTypeOptions = [
|
|
126
|
-
{ name: "Individual" },
|
|
127
|
-
{ name: "Govt" },
|
|
128
|
-
{ name: "Company_Society_Org" },
|
|
129
|
-
];
|
|
130
|
-
|
|
131
|
-
const occupantOptions = [
|
|
132
|
-
{ name: "Self" },
|
|
133
|
-
{ name: "Tenanted" },
|
|
134
|
-
];
|
|
135
|
-
|
|
136
|
-
const genderOptions = [
|
|
137
|
-
{ name: "Male" },
|
|
138
|
-
{ name: "Female" },
|
|
139
|
-
{ name: "Others" },
|
|
140
|
-
{ name: "Not prefer to say" },
|
|
141
|
-
];
|
|
142
|
-
|
|
143
|
-
const identityTypeOptions = [
|
|
144
|
-
{ name: "Aadhaar Card" },
|
|
145
|
-
{ name: "Driving License" },
|
|
146
|
-
{ name: "Passport" },
|
|
147
|
-
{ name: "Voter ID" },
|
|
148
|
-
];
|
|
149
|
-
|
|
150
|
-
const yesNo = [{ name: "Yes" }, { name: "No" }];
|
|
161
|
+
}, [searchData, formData?.connectionDetails, isDataLoaded]);
|
|
151
162
|
|
|
152
163
|
// 🔹 FILE UPLOAD
|
|
153
|
-
const
|
|
164
|
+
const handleUploadProof = async (e, onChange) => {
|
|
154
165
|
const file = e.target.files[0];
|
|
155
166
|
if (!file) return;
|
|
156
167
|
|
|
168
|
+
if (file.size > 2000000) {
|
|
169
|
+
setToast({ type: "error", message: t("Max size 2MB exceeded") });
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
157
173
|
try {
|
|
158
|
-
const res = await Digit.UploadServices.Filestorage("EKYC", file);
|
|
159
|
-
const
|
|
160
|
-
if (
|
|
161
|
-
|
|
162
|
-
|
|
174
|
+
const res = await Digit.UploadServices.Filestorage("EKYC", file, tenantId);
|
|
175
|
+
const fileStoreId = res?.data?.files?.[0]?.fileStoreId;
|
|
176
|
+
if (fileStoreId) {
|
|
177
|
+
onChange(file.name);
|
|
178
|
+
setDocumentProof(file.name);
|
|
179
|
+
setDocumentId(fileStoreId);
|
|
180
|
+
setToast({ type: "success", message: t("Upload successful") });
|
|
163
181
|
}
|
|
164
182
|
} catch {
|
|
165
|
-
setToast({ type: "error", message: "Upload failed" });
|
|
183
|
+
setToast({ type: "error", message: t("Upload failed") });
|
|
166
184
|
}
|
|
167
185
|
};
|
|
168
186
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
if (
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
187
|
+
const onFormValueChange = (setValue, data) => {
|
|
188
|
+
// Avoid updating states on every keypress unless they affect conditional visibility
|
|
189
|
+
const consumerTypeChanged =
|
|
190
|
+
(data?.consumerType?.name || data?.consumerType) !==
|
|
191
|
+
(localFormData?.consumerType?.name || localFormData?.consumerType);
|
|
192
|
+
const occupantTypeChanged =
|
|
193
|
+
(data?.occupantType?.name || data?.occupantType) !==
|
|
194
|
+
(localFormData?.occupantType?.name || localFormData?.occupantType);
|
|
195
|
+
const informantIsConsumerChanged = data?.informantIsConsumer !== localFormData?.informantIsConsumer;
|
|
196
|
+
|
|
197
|
+
if (consumerTypeChanged || occupantTypeChanged || informantIsConsumerChanged) {
|
|
198
|
+
setLocalFormData((prev) => ({
|
|
199
|
+
...prev,
|
|
200
|
+
...data,
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
184
203
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
204
|
+
// Determine validation
|
|
205
|
+
const knoVal = data?.kno || searchKno;
|
|
206
|
+
const consumerTypeVal = data?.consumerType;
|
|
207
|
+
const occupantTypeVal = data?.occupantType;
|
|
208
|
+
const categoryTypeVal = data?.categoryType;
|
|
209
|
+
const firstNameVal = data?.firstName;
|
|
210
|
+
const mobileVal = data?.mobile;
|
|
211
|
+
const residentsVal = data?.residents;
|
|
212
|
+
const consentVal = data?.consent;
|
|
213
|
+
const docId = data?.documentId || documentId;
|
|
214
|
+
const ownerMobileVal = data?.ownerMobile;
|
|
215
|
+
|
|
216
|
+
let valid = true;
|
|
217
|
+
if (!knoVal) valid = false;
|
|
218
|
+
if (!consumerTypeVal) valid = false;
|
|
219
|
+
if (!occupantTypeVal) valid = false;
|
|
220
|
+
if (!categoryTypeVal) valid = false;
|
|
221
|
+
if (!firstNameVal) valid = false;
|
|
222
|
+
if (!mobileVal || !/^[6-9]\d{9}$/.test(mobileVal)) valid = false;
|
|
223
|
+
if (!residentsVal || Number(residentsVal) <= 0) valid = false;
|
|
224
|
+
if (occupantTypeVal?.name === "Tenanted" && !docId && !ownerMobileVal) valid = false;
|
|
225
|
+
if (!consentVal) valid = false;
|
|
226
|
+
|
|
227
|
+
if (valid !== canSubmit) {
|
|
228
|
+
setCanSubmit(valid);
|
|
192
229
|
}
|
|
193
|
-
|
|
230
|
+
};
|
|
194
231
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
firstName,
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
232
|
+
const onSubmit = async (data) => {
|
|
233
|
+
const submitData = {
|
|
234
|
+
kno: data.kno || searchKno,
|
|
235
|
+
consumerType: data.consumerType?.name || data.consumerType,
|
|
236
|
+
occupantType: data.occupantType?.name || data.occupantType,
|
|
237
|
+
categoryType: data.categoryType?.name || data.categoryType,
|
|
238
|
+
consumerName: data.consumerName || `${data.firstName || ""} ${data.middleName || ""} ${data.lastName || ""}`.trim(),
|
|
239
|
+
firstName: data.firstName,
|
|
240
|
+
middleName: data.middleName,
|
|
241
|
+
lastName: data.lastName,
|
|
242
|
+
gender: data.gender?.name || data.gender,
|
|
243
|
+
parentSpouseName: data.parentSpouseName,
|
|
244
|
+
relation: data.relation || savedData.relation || "",
|
|
245
|
+
mobile: data.mobile,
|
|
246
|
+
whatsapp: data.whatsapp,
|
|
247
|
+
email: data.email,
|
|
248
|
+
residents: data.residents,
|
|
249
|
+
documentId: documentId,
|
|
250
|
+
documentProof: documentProof,
|
|
251
|
+
ownerMobile: data.ownerMobile,
|
|
252
|
+
tenantVerification: data.tenantVerification,
|
|
253
|
+
designation: data.designation,
|
|
254
|
+
department: data.department,
|
|
255
|
+
employeeId: data.employeeId,
|
|
256
|
+
landline: data.landline || savedData.landline || "",
|
|
257
|
+
entityRelation: data.entityRelation || savedData.entityRelation || "",
|
|
258
|
+
contactPerson: data.contactPerson,
|
|
259
|
+
entityName: data.entityName,
|
|
260
|
+
idProof: data.identityType?.name || data.identityType,
|
|
261
|
+
idNumber: data.documentNumber,
|
|
262
|
+
consent: data.consent,
|
|
263
|
+
informantIsConsumer: data.informantIsConsumer ?? true,
|
|
264
|
+
informantName: data.informantName,
|
|
265
|
+
informantRelation: data.informantRelation,
|
|
227
266
|
};
|
|
228
267
|
|
|
229
268
|
try {
|
|
230
269
|
await updateMutation.mutateAsync({
|
|
231
270
|
RequestInfo: {},
|
|
232
271
|
updateType: "CONSUMER",
|
|
233
|
-
...
|
|
272
|
+
...submitData,
|
|
234
273
|
});
|
|
235
|
-
setToast({ type: "success", message: "Data updated successfully!" });
|
|
236
|
-
onSelect(config.key,
|
|
274
|
+
setToast({ type: "success", message: t("Data updated successfully!") });
|
|
275
|
+
onSelect(config.key, submitData);
|
|
237
276
|
} catch (error) {
|
|
238
|
-
setToast({ type: "error", message: "Failed to update consumer details" });
|
|
277
|
+
setToast({ type: "error", message: t("Failed to update consumer details") });
|
|
239
278
|
}
|
|
240
279
|
};
|
|
241
280
|
|
|
@@ -243,164 +282,25 @@ const AadhaarVerification = ({ config, onSelect, formData }) => {
|
|
|
243
282
|
return <Loader />;
|
|
244
283
|
}
|
|
245
284
|
|
|
285
|
+
const Config = AadhaarVerificationConfig(t, localFormData, handleUploadProof, setDocumentId, documentId);
|
|
286
|
+
|
|
246
287
|
return (
|
|
247
288
|
<Fragment>
|
|
248
|
-
<
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
</div>
|
|
264
|
-
|
|
265
|
-
<div>
|
|
266
|
-
<CardLabel>First Name *</CardLabel>
|
|
267
|
-
<TextInput value={firstName} onChange={(e) => setFirstName(e.target.value)} />
|
|
268
|
-
</div>
|
|
269
|
-
|
|
270
|
-
<div>
|
|
271
|
-
<CardLabel>Middle Name</CardLabel>
|
|
272
|
-
<TextInput value={middleName} onChange={(e) => setMiddleName(e.target.value)} />
|
|
273
|
-
</div>
|
|
274
|
-
|
|
275
|
-
<div>
|
|
276
|
-
<CardLabel>Last Name</CardLabel>
|
|
277
|
-
<TextInput value={lastName} onChange={(e) => setLastName(e.target.value)} />
|
|
278
|
-
</div>
|
|
279
|
-
|
|
280
|
-
<div>
|
|
281
|
-
<CardLabel>Gender</CardLabel>
|
|
282
|
-
<Dropdown option={genderOptions} selected={gender} select={setGender} />
|
|
283
|
-
</div>
|
|
284
|
-
|
|
285
|
-
<div>
|
|
286
|
-
<CardLabel>Parent/Spouse Name </CardLabel>
|
|
287
|
-
<TextInput value={parentSpouseName} onChange={(e) => setParentSpouseName(e.target.value)} />
|
|
288
|
-
</div>
|
|
289
|
-
|
|
290
|
-
<div>
|
|
291
|
-
<CardLabel>Mobile *</CardLabel>
|
|
292
|
-
<TextInput value={mobile} onChange={(e) => setMobile(e.target.value)} />
|
|
293
|
-
</div>
|
|
294
|
-
|
|
295
|
-
<div>
|
|
296
|
-
<CardLabel>WhatsApp</CardLabel>
|
|
297
|
-
<TextInput value={whatsapp} onChange={(e) => setWhatsapp(e.target.value)} />
|
|
298
|
-
</div>
|
|
299
|
-
|
|
300
|
-
<div>
|
|
301
|
-
<CardLabel>Email</CardLabel>
|
|
302
|
-
<TextInput value={email} onChange={(e) => setEmail(e.target.value)} />
|
|
303
|
-
</div>
|
|
304
|
-
|
|
305
|
-
<div>
|
|
306
|
-
<CardLabel>No. of Residents *</CardLabel>
|
|
307
|
-
<TextInput value={residents} onChange={(e) => setResidents(e.target.value)} />
|
|
308
|
-
</div>
|
|
309
|
-
<div>
|
|
310
|
-
{console.log("identityType",identityType)}
|
|
311
|
-
<CardLabel>Type of Identity *</CardLabel>
|
|
312
|
-
<Dropdown option={identityTypeOptions} selected={identityType} select={setIdentityType} />
|
|
313
|
-
</div>
|
|
314
|
-
<div>
|
|
315
|
-
<CardLabel>Proof of Identity</CardLabel>
|
|
316
|
-
<UploadFile onUpload={(e) => uploadFile(e, setDocumentProof, setDocumentId)} />
|
|
317
|
-
</div>
|
|
318
|
-
<div>
|
|
319
|
-
<CardLabel>Document Number</CardLabel>
|
|
320
|
-
<TextInput value={documentNumber} onChange={(e) => setDocumentNumber(e.target.value)} />
|
|
321
|
-
</div>
|
|
322
|
-
|
|
323
|
-
<div>
|
|
324
|
-
<CardLabel>Informant Is Consumer</CardLabel>
|
|
325
|
-
<CheckBox
|
|
326
|
-
label="Yes, the informant is the consumer"
|
|
327
|
-
checked={informantIsConsumer}
|
|
328
|
-
onChange={(e) => setInformantIsConsumer(e.target.checked)}
|
|
329
|
-
/>
|
|
330
|
-
</div>
|
|
331
|
-
|
|
332
|
-
{!informantIsConsumer && (
|
|
333
|
-
<Fragment>
|
|
334
|
-
<div>
|
|
335
|
-
<CardLabel>Informant Name</CardLabel>
|
|
336
|
-
<TextInput value={informantName} onChange={(e) => setInformantName(e.target.value)} />
|
|
337
|
-
</div>
|
|
338
|
-
<div>
|
|
339
|
-
<CardLabel>Informant Relation</CardLabel>
|
|
340
|
-
<TextInput value={informantRelation} onChange={(e) => setInformantRelation(e.target.value)} />
|
|
341
|
-
</div>
|
|
342
|
-
</Fragment>
|
|
343
|
-
)}
|
|
344
|
-
|
|
345
|
-
{/* TENANT LOGIC */}
|
|
346
|
-
{occupantType?.name === "Tenanted" && (
|
|
347
|
-
<Fragment>
|
|
348
|
-
<div>
|
|
349
|
-
<CardLabel>Document Proof</CardLabel>
|
|
350
|
-
<UploadFile onUpload={(e) => uploadFile(e, setDocumentProof, setDocumentId)} />
|
|
351
|
-
</div>
|
|
352
|
-
|
|
353
|
-
{!documentId && (
|
|
354
|
-
<Fragment>
|
|
355
|
-
<div>
|
|
356
|
-
<CardLabel>Owner Mobile *</CardLabel>
|
|
357
|
-
<TextInput value={ownerMobile} onChange={(e) => setOwnerMobile(e.target.value)} />
|
|
358
|
-
</div>
|
|
359
|
-
|
|
360
|
-
<div>
|
|
361
|
-
<CardLabel>Tenant Verification</CardLabel>
|
|
362
|
-
<TextInput value={tenantVerification} onChange={(e) => setTenantVerification(e.target.value)} />
|
|
363
|
-
</div>
|
|
364
|
-
</Fragment>
|
|
365
|
-
)}
|
|
366
|
-
</Fragment>
|
|
367
|
-
)}
|
|
368
|
-
|
|
369
|
-
{/* GOVT */}
|
|
370
|
-
{consumerType?.name === "Govt" && (
|
|
371
|
-
<Fragment>
|
|
372
|
-
<div>
|
|
373
|
-
<CardLabel>Designation</CardLabel>
|
|
374
|
-
<TextInput value={designation} onChange={(e) => setDesignation(e.target.value)} />
|
|
375
|
-
</div>
|
|
376
|
-
|
|
377
|
-
<div>
|
|
378
|
-
<CardLabel>Department</CardLabel>
|
|
379
|
-
<TextInput value={department} onChange={(e) => setDepartment(e.target.value)} />
|
|
380
|
-
</div>
|
|
381
|
-
|
|
382
|
-
<div>
|
|
383
|
-
<CardLabel>Employee ID</CardLabel>
|
|
384
|
-
<TextInput value={employeeId} onChange={(e) => setEmployeeId(e.target.value)} />
|
|
385
|
-
</div>
|
|
386
|
-
</Fragment>
|
|
387
|
-
)}
|
|
388
|
-
|
|
389
|
-
{/* OTHER ENTITY */}
|
|
390
|
-
{consumerType?.name === "Company_Society_Org" && (
|
|
391
|
-
<Fragment>
|
|
392
|
-
<div>
|
|
393
|
-
<CardLabel>Entity Name</CardLabel>
|
|
394
|
-
<TextInput value={entityName} onChange={(e) => setEntityName(e.target.value)} />
|
|
395
|
-
</div>
|
|
396
|
-
|
|
397
|
-
<div>
|
|
398
|
-
<CardLabel>Contact Person</CardLabel>
|
|
399
|
-
<TextInput value={contactPerson} onChange={(e) => setContactPerson(e.target.value)} />
|
|
400
|
-
</div>
|
|
401
|
-
</Fragment>
|
|
402
|
-
)}
|
|
403
|
-
</FormStep>
|
|
289
|
+
<FormComposer
|
|
290
|
+
key={isDataLoaded ? "loaded" : "loading"}
|
|
291
|
+
isDisabled={!canSubmit}
|
|
292
|
+
label={t("ES_COMMON_CONTINUE")}
|
|
293
|
+
config={Config.map((item) => ({
|
|
294
|
+
...item,
|
|
295
|
+
isCollapsible: true,
|
|
296
|
+
isDefaultOpen: true,
|
|
297
|
+
}))}
|
|
298
|
+
onSubmit={onSubmit}
|
|
299
|
+
defaultValues={defaultValues}
|
|
300
|
+
onFormValueChange={onFormValueChange}
|
|
301
|
+
noCard={false}
|
|
302
|
+
submitInForm={true}
|
|
303
|
+
/>
|
|
404
304
|
{toast && (
|
|
405
305
|
<Toast
|
|
406
306
|
error={toast.type === "error"}
|
|
@@ -412,4 +312,4 @@ const AadhaarVerification = ({ config, onSelect, formData }) => {
|
|
|
412
312
|
);
|
|
413
313
|
};
|
|
414
314
|
|
|
415
|
-
export default AadhaarVerification;
|
|
315
|
+
export default AadhaarVerification;
|