@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.
@@ -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
- CardLabel,
6
- TextInput,
7
- Dropdown,
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 searchKno = flowState?.kNumber || flowState?.kno || formData?.kNumber || formData?.kno || sessionStorage.getItem("EKYC_K_NUMBER");
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 [ownerMobile, setOwnerMobile] = useState(savedData.ownerMobile || "");
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 rawData = searchData || formData?.connectionDetails;
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 && !savedData.firstName) {
89
- if (!kno && searchKno) setKno(searchKno);
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
- setFirstName(details.firstName);
93
- if (details.middleName) setMiddleName(details.middleName);
94
- if (details.lastName) setLastName(details.lastName);
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
- setFirstName(parts[0] || "");
99
- if (parts.length === 2) setLastName(parts[1]);
99
+ fName = parts[0] || "";
100
+ if (parts.length === 2) lName = parts[1];
100
101
  if (parts.length > 2) {
101
- setMiddleName(parts.slice(1, -1).join(" "));
102
- setLastName(parts[parts.length - 1]);
102
+ mName = parts.slice(1, -1).join(" ");
103
+ lName = parts[parts.length - 1];
103
104
  }
104
105
  }
105
106
 
106
- if (details.phoneNumber || addrDetails.mobileNo) setMobile(details.phoneNumber || addrDetails.mobileNo);
107
- if (details.email || addrDetails.email) setEmail(details.email || addrDetails.email);
108
- if (addrDetails.whatsappNo) setWhatsapp(addrDetails.whatsappNo);
109
- if (addrDetails.noOfPerson) setResidents(String(addrDetails.noOfPerson));
110
-
111
- if (details.consumerType) setConsumerType({ name: details.consumerType });
112
- if (details.occupantType) setOccupantType({ name: details.occupantType });
113
- if (details.gender) setGender({ name: details.gender });
114
- if (details.parentSpouse) setParentSpouseName(details.parentSpouse);
115
- if (details.documentNumber) {
116
- setDocumentId(details.documentNumber);
117
- setIdNumber(details.documentNumber);
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
- if (details.informantName) setInformantName(details.informantName);
120
- if (details.informantRelation) setInformantRelation(details.informantRelation);
159
+ setIsDataLoaded(true);
121
160
  }
122
- }, [searchData, formData?.connectionDetails, searchKno]);
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 uploadFile = async (e, setter, idSetter) => {
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 id = res?.data?.files?.[0]?.fileStoreId;
160
- if (id) {
161
- setter(file.name);
162
- idSetter(id);
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
- // 🔹 VALIDATION
170
- const isValid = () => {
171
- if (!kno) return false;
172
- if (!consumerType) return false;
173
- if (!occupantType) return false;
174
- if (!categoryType) return false;
175
- if (!firstName) return false;
176
- if (!mobile) return false;
177
- if (!residents || Number(residents) <= 0) return false;
178
-
179
- if (occupantType?.name === "Tenanted" && !documentId && !ownerMobile)
180
- return false;
181
-
182
- return consent; // consent must be true
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
- // 🔹 SUBMIT
186
- const onStepSelect = async () => {
187
- // If not valid, just show a warning (or uncomment below to enforce)
188
- /*
189
- if (!isValid()) {
190
- setToast({ type: "error", message: "Fill required fields" });
191
- return;
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
- const data = {
196
- kno,
197
- consumerType: consumerType?.name,
198
- occupantType: occupantType?.name,
199
- categoryType: categoryType?.name,
200
- consumerName,
201
- firstName,
202
- middleName,
203
- lastName,
204
- gender: gender?.name,
205
- parentSpouseName,
206
- relation,
207
- mobile,
208
- whatsapp,
209
- email,
210
- residents,
211
- documentId,
212
- ownerMobile,
213
- tenantVerification,
214
- designation,
215
- department,
216
- employeeId,
217
- landline,
218
- entityRelation,
219
- contactPerson,
220
- entityName,
221
- idProof: idProof?.name,
222
- idNumber,
223
- consent,
224
- informantIsConsumer,
225
- informantName,
226
- informantRelation,
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
- ...data
272
+ ...submitData,
234
273
  });
235
- setToast({ type: "success", message: "Data updated successfully!" });
236
- onSelect(config.key, data);
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
- <FormStep onSelect={onStepSelect} config={config} isDisabled={!isValid()}>
249
-
250
- <div>
251
- <CardLabel>Consumer Type *</CardLabel>
252
- <Dropdown option={consumerTypeOptions} selected={consumerType} select={setConsumerType} />
253
- </div>
254
-
255
- <div>
256
- <CardLabel>Occupant Type *</CardLabel>
257
- <Dropdown option={occupantOptions} selected={occupantType} select={setOccupantType} />
258
- </div>
259
-
260
- <div>
261
- <CardLabel>Category Type *</CardLabel>
262
- <Dropdown option={[]} selected={categoryType} select={setCategoryType} />
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;