@djb25/digit-ui-module-ekyc 1.0.25 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djb25/digit-ui-module-ekyc",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "description": "Digit UI Module for Ekyc",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.modern.js",
@@ -1,15 +1,28 @@
1
1
  import React, { useState, Fragment, useEffect } from "react";
2
2
  import { useLocation } from "react-router-dom";
3
- import { CardLabel, TextInput, Dropdown, UploadFile, RadioButtons, Toast, FormStep, Loader, CheckBox } 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
+
4
7
  const AadhaarVerification = ({ config, onSelect, formData }) => {
8
+ const { t } = useTranslation();
5
9
  const location = useLocation();
6
10
  const flowState = location.state || {};
7
11
 
8
12
  const tenantId = Digit.ULBService.getCurrentTenantId();
9
- 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
+ "";
10
23
 
11
24
  const { isLoading, data: searchData } = Digit.Hooks.ekyc.useSearchConnection(
12
- { tenantId, details: { kno: searchKno } },
25
+ { tenantId, details: { kno: searchKno, fetchType: "CONNECTION" } },
13
26
  { enabled: !!searchKno, cacheTime: 0 }
14
27
  );
15
28
 
@@ -18,195 +31,250 @@ const AadhaarVerification = ({ config, onSelect, formData }) => {
18
31
  const savedData = formData?.aadhaarVerification || {};
19
32
 
20
33
  // 🔹 STATES
21
- const [kno, setKno] = useState(savedData.kno || searchKno || "");
22
- const [consumerType, setConsumerType] = useState(savedData.consumerType ? { name: savedData.consumerType } : null);
23
- const [occupantType, setOccupantType] = useState(savedData.occupantType ? { name: savedData.occupantType } : null);
24
- const [categoryType, setCategoryType] = useState(savedData.categoryType ? { name: savedData.categoryType } : null);
25
-
26
- const [consumerName, setConsumerName] = useState(savedData.consumerName || "");
27
- const [firstName, setFirstName] = useState(savedData.firstName || "");
28
- const [middleName, setMiddleName] = useState(savedData.middleName || "");
29
- const [lastName, setLastName] = useState(savedData.lastName || "");
30
-
31
- const [gender, setGender] = useState(savedData.gender ? { name: savedData.gender } : null);
32
- const [parentSpouseName, setParentSpouseName] = useState(savedData.parentSpouseName || "");
33
- const [relation, setRelation] = useState(savedData.relation || "");
34
-
35
- const [mobile, setMobile] = useState(savedData.mobile || "");
36
- const [whatsapp, setWhatsapp] = useState(savedData.whatsapp || "");
37
- const [email, setEmail] = useState(savedData.email || "");
38
- const [residents, setResidents] = useState(savedData.residents || "");
39
-
40
- // Tenant
41
- const [documentProof, setDocumentProof] = useState(savedData.documentProof || null);
42
34
  const [documentId, setDocumentId] = useState(savedData.documentId || null);
43
- const [ownerMobile, setOwnerMobile] = useState(savedData.ownerMobile || "");
44
- const [tenantVerification, setTenantVerification] = useState(savedData.tenantVerification || "");
45
-
46
- // Govt
47
- const [designation, setDesignation] = useState(savedData.designation || "");
48
- const [department, setDepartment] = useState(savedData.department || "");
49
- const [employeeId, setEmployeeId] = useState(savedData.employeeId || "");
50
- const [landline, setLandline] = useState(savedData.landline || "");
51
-
52
- // Other Entity
53
- const [entityRelation, setEntityRelation] = useState(savedData.entityRelation || "");
54
- const [contactPerson, setContactPerson] = useState(savedData.contactPerson || "");
55
- const [entityName, setEntityName] = useState(savedData.entityName || "");
56
-
57
- // Identity
58
- const [idProof, setIdProof] = useState(savedData.idProof ? { name: savedData.idProof } : null);
59
- const [idNumber, setIdNumber] = useState(savedData.idNumber || "");
60
- const [documentNumber, setDocumentNumber] = useState(savedData.documentNumber || "");
61
- const [identityType, setIdentityType] = useState(savedData.identityType ? { name: savedData.identityType } : null);
62
- const [idFile, setIdFile] = useState(savedData.idFile || null);
63
-
64
- // Consent
65
- const [consent, setConsent] = useState(savedData.consent || false);
66
- const [informantIsConsumer, setInformantIsConsumer] = useState(savedData.informantIsConsumer ?? true);
67
- const [informantName, setInformantName] = useState(savedData.informantName || "");
68
- const [informantRelation, setInformantRelation] = useState(savedData.informantRelation || "");
69
-
35
+ const [documentProof, setDocumentProof] = useState(savedData.documentProof || null);
70
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
+ };
71
81
 
72
82
  useEffect(() => {
73
- const rawData = searchData || formData?.connectionDetails;
83
+ const appData = extractApplicationData(searchData);
84
+ const rawData = appData || formData?.connectionDetails;
74
85
  const details = rawData?.connectionDetails || rawData || {};
75
86
  const addrDetails = rawData?.addressDetails || {};
76
87
 
77
- if (details && Object.keys(details).length > 0 && !savedData.firstName) {
78
- if (!kno && searchKno) setKno(searchKno);
88
+ if (details && Object.keys(details).length > 0 && !isDataLoaded) {
89
+ let fName = "";
90
+ let mName = "";
91
+ let lName = "";
79
92
 
80
93
  if (details.firstName) {
81
- setFirstName(details.firstName);
82
- if (details.middleName) setMiddleName(details.middleName);
83
- if (details.lastName) setLastName(details.lastName);
94
+ fName = details.firstName;
95
+ mName = details.middleName || "";
96
+ lName = details.lastName || "";
84
97
  } else if (details.consumerName) {
85
- setConsumerName(details.consumerName);
86
98
  const parts = details.consumerName.trim().split(/\s+/);
87
- setFirstName(parts[0] || "");
88
- if (parts.length === 2) setLastName(parts[1]);
99
+ fName = parts[0] || "";
100
+ if (parts.length === 2) lName = parts[1];
89
101
  if (parts.length > 2) {
90
- setMiddleName(parts.slice(1, -1).join(" "));
91
- setLastName(parts[parts.length - 1]);
102
+ mName = parts.slice(1, -1).join(" ");
103
+ lName = parts[parts.length - 1];
92
104
  }
93
105
  }
94
106
 
95
- if (details.phoneNumber || addrDetails.mobileNo) setMobile(details.phoneNumber || addrDetails.mobileNo);
96
- if (details.email || addrDetails.email) setEmail(details.email || addrDetails.email);
97
- if (addrDetails.whatsappNo) setWhatsapp(addrDetails.whatsappNo);
98
- if (addrDetails.noOfPerson) setResidents(String(addrDetails.noOfPerson));
99
-
100
- if (details.consumerType) setConsumerType({ name: details.consumerType });
101
- if (details.occupantType) setOccupantType({ name: details.occupantType });
102
- if (details.gender) setGender({ name: details.gender });
103
- if (details.parentSpouse) setParentSpouseName(details.parentSpouse);
104
- if (details.documentNumber) {
105
- setDocumentId(details.documentNumber);
106
- 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);
107
155
  }
108
- if (details.informantName) setInformantName(details.informantName);
109
- if (details.informantRelation) setInformantRelation(details.informantRelation);
156
+ if (updatedDefaults.documentProof) {
157
+ setDocumentProof(updatedDefaults.documentProof);
158
+ }
159
+ setIsDataLoaded(true);
110
160
  }
111
- }, [searchData, formData?.connectionDetails, searchKno]);
112
-
113
- // 🔹 OPTIONS
114
- const consumerTypeOptions = [{ name: "Individual" }, { name: "Govt" }, { name: "Company_Society_Org" }];
115
-
116
- const occupantOptions = [{ name: "Self" }, { name: "Tenanted" }];
117
-
118
- const genderOptions = [{ name: "Male" }, { name: "Female" }, { name: "Others" }, { name: "Not prefer to say" }];
119
-
120
- const identityTypeOptions = [{ name: "Aadhaar Card" }, { name: "Driving License" }, { name: "Passport" }, { name: "Voter ID" }];
121
-
122
- const yesNo = [{ name: "Yes" }, { name: "No" }];
161
+ }, [searchData, formData?.connectionDetails, isDataLoaded]);
123
162
 
124
163
  // 🔹 FILE UPLOAD
125
- const uploadFile = async (e, setter, idSetter) => {
164
+ const handleUploadProof = async (e, onChange) => {
126
165
  const file = e.target.files[0];
127
166
  if (!file) return;
128
167
 
168
+ if (file.size > 2000000) {
169
+ setToast({ type: "error", message: t("Max size 2MB exceeded") });
170
+ return;
171
+ }
172
+
129
173
  try {
130
- const res = await Digit.UploadServices.Filestorage("EKYC", file);
131
- const id = res?.data?.files?.[0]?.fileStoreId;
132
- if (id) {
133
- setter(file.name);
134
- 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") });
135
181
  }
136
182
  } catch {
137
- setToast({ type: "error", message: "Upload failed" });
183
+ setToast({ type: "error", message: t("Upload failed") });
138
184
  }
139
185
  };
140
186
 
141
- // 🔹 VALIDATION
142
- const isValid = () => {
143
- if (!kno) return false;
144
- if (!consumerType) return false;
145
- if (!occupantType) return false;
146
- if (!categoryType) return false;
147
- if (!firstName) return false;
148
- if (!mobile) return false;
149
- if (!residents || Number(residents) <= 0) return false;
150
-
151
- if (occupantType?.name === "Tenanted" && !documentId && !ownerMobile) return false;
152
-
153
- return consent; // consent must be true
154
- };
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
+ }
155
203
 
156
- // 🔹 SUBMIT
157
- const onStepSelect = async () => {
158
- // If not valid, just show a warning (or uncomment below to enforce)
159
- /*
160
- if (!isValid()) {
161
- setToast({ type: "error", message: "Fill required fields" });
162
- 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);
163
229
  }
164
- */
230
+ };
165
231
 
166
- const data = {
167
- kno,
168
- consumerType: consumerType?.name,
169
- occupantType: occupantType?.name,
170
- categoryType: categoryType?.name,
171
- consumerName,
172
- firstName,
173
- middleName,
174
- lastName,
175
- gender: gender?.name,
176
- parentSpouseName,
177
- relation,
178
- mobile,
179
- whatsapp,
180
- email,
181
- residents,
182
- documentId,
183
- ownerMobile,
184
- tenantVerification,
185
- designation,
186
- department,
187
- employeeId,
188
- landline,
189
- entityRelation,
190
- contactPerson,
191
- entityName,
192
- idProof: idProof?.name,
193
- idNumber,
194
- consent,
195
- informantIsConsumer,
196
- informantName,
197
- 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,
198
266
  };
199
267
 
200
268
  try {
201
269
  await updateMutation.mutateAsync({
202
270
  RequestInfo: {},
203
271
  updateType: "CONSUMER",
204
- ...data,
272
+ ...submitData,
205
273
  });
206
- setToast({ type: "success", message: "Data updated successfully!" });
207
- onSelect(config.key, data);
274
+ setToast({ type: "success", message: t("Data updated successfully!") });
275
+ onSelect(config.key, submitData);
208
276
  } catch (error) {
209
- setToast({ type: "error", message: "Failed to update consumer details" });
277
+ setToast({ type: "error", message: t("Failed to update consumer details") });
210
278
  }
211
279
  };
212
280
 
@@ -214,163 +282,32 @@ const AadhaarVerification = ({ config, onSelect, formData }) => {
214
282
  return <Loader />;
215
283
  }
216
284
 
285
+ const Config = AadhaarVerificationConfig(t, localFormData, handleUploadProof, setDocumentId, documentId);
286
+
217
287
  return (
218
288
  <Fragment>
219
- <FormStep onSelect={onStepSelect} config={config} isDisabled={!isValid()}>
220
- <div>
221
- <CardLabel>Consumer Type *</CardLabel>
222
- <Dropdown option={consumerTypeOptions} selected={consumerType} select={setConsumerType} />
223
- </div>
224
-
225
- <div>
226
- <CardLabel>Occupant Type *</CardLabel>
227
- <Dropdown option={occupantOptions} selected={occupantType} select={setOccupantType} />
228
- </div>
229
-
230
- <div>
231
- <CardLabel>Category Type *</CardLabel>
232
- <Dropdown option={[]} selected={categoryType} select={setCategoryType} />
233
- </div>
234
-
235
- <div>
236
- <CardLabel>First Name *</CardLabel>
237
- <TextInput value={firstName} onChange={(e) => setFirstName(e.target.value)} />
238
- </div>
239
-
240
- <div>
241
- <CardLabel>Middle Name</CardLabel>
242
- <TextInput value={middleName} onChange={(e) => setMiddleName(e.target.value)} />
243
- </div>
244
-
245
- <div>
246
- <CardLabel>Last Name</CardLabel>
247
- <TextInput value={lastName} onChange={(e) => setLastName(e.target.value)} />
248
- </div>
249
-
250
- <div>
251
- <CardLabel>Gender</CardLabel>
252
- <Dropdown option={genderOptions} selected={gender} select={setGender} />
253
- </div>
254
-
255
- <div>
256
- <CardLabel>Parent/Spouse Name </CardLabel>
257
- <TextInput value={parentSpouseName} onChange={(e) => setParentSpouseName(e.target.value)} />
258
- </div>
259
-
260
- <div>
261
- <CardLabel>Mobile *</CardLabel>
262
- <TextInput value={mobile} onChange={(e) => setMobile(e.target.value)} />
263
- </div>
264
-
265
- <div>
266
- <CardLabel>WhatsApp</CardLabel>
267
- <TextInput value={whatsapp} onChange={(e) => setWhatsapp(e.target.value)} />
268
- </div>
269
-
270
- <div>
271
- <CardLabel>Email</CardLabel>
272
- <TextInput value={email} onChange={(e) => setEmail(e.target.value)} />
273
- </div>
274
-
275
- <div>
276
- <CardLabel>No. of Residents *</CardLabel>
277
- <TextInput value={residents} onChange={(e) => setResidents(e.target.value)} />
278
- </div>
279
- <div>
280
- <CardLabel>Type of Identity *</CardLabel>
281
- <Dropdown option={identityTypeOptions} selected={identityType} select={setIdentityType} />
282
- </div>
283
- <div>
284
- <CardLabel>Proof of Identity</CardLabel>
285
- <UploadFile onUpload={(e) => uploadFile(e, setDocumentProof, setDocumentId)} />
286
- </div>
287
- <div>
288
- <CardLabel>Document Number</CardLabel>
289
- <TextInput value={documentNumber} onChange={(e) => setDocumentNumber(e.target.value)} />
290
- </div>
291
-
292
- <div>
293
- <CardLabel>Informant Is Consumer</CardLabel>
294
- <CheckBox
295
- label="Yes, the informant is the consumer"
296
- checked={informantIsConsumer}
297
- onChange={(e) => setInformantIsConsumer(e.target.checked)}
298
- />
299
- </div>
300
-
301
- {!informantIsConsumer && (
302
- <Fragment>
303
- <div>
304
- <CardLabel>Informant Name</CardLabel>
305
- <TextInput value={informantName} onChange={(e) => setInformantName(e.target.value)} />
306
- </div>
307
- <div>
308
- <CardLabel>Informant Relation</CardLabel>
309
- <TextInput value={informantRelation} onChange={(e) => setInformantRelation(e.target.value)} />
310
- </div>
311
- </Fragment>
312
- )}
313
-
314
- {/* TENANT LOGIC */}
315
- {occupantType?.name === "Tenanted" && (
316
- <Fragment>
317
- <div>
318
- <CardLabel>Document Proof</CardLabel>
319
- <UploadFile onUpload={(e) => uploadFile(e, setDocumentProof, setDocumentId)} />
320
- </div>
321
-
322
- {!documentId && (
323
- <Fragment>
324
- <div>
325
- <CardLabel>Owner Mobile *</CardLabel>
326
- <TextInput value={ownerMobile} onChange={(e) => setOwnerMobile(e.target.value)} />
327
- </div>
328
-
329
- <div>
330
- <CardLabel>Tenant Verification</CardLabel>
331
- <TextInput value={tenantVerification} onChange={(e) => setTenantVerification(e.target.value)} />
332
- </div>
333
- </Fragment>
334
- )}
335
- </Fragment>
336
- )}
337
-
338
- {/* GOVT */}
339
- {consumerType?.name === "Govt" && (
340
- <Fragment>
341
- <div>
342
- <CardLabel>Designation</CardLabel>
343
- <TextInput value={designation} onChange={(e) => setDesignation(e.target.value)} />
344
- </div>
345
-
346
- <div>
347
- <CardLabel>Department</CardLabel>
348
- <TextInput value={department} onChange={(e) => setDepartment(e.target.value)} />
349
- </div>
350
-
351
- <div>
352
- <CardLabel>Employee ID</CardLabel>
353
- <TextInput value={employeeId} onChange={(e) => setEmployeeId(e.target.value)} />
354
- </div>
355
- </Fragment>
356
- )}
357
-
358
- {/* OTHER ENTITY */}
359
- {consumerType?.name === "Company_Society_Org" && (
360
- <Fragment>
361
- <div>
362
- <CardLabel>Entity Name</CardLabel>
363
- <TextInput value={entityName} onChange={(e) => setEntityName(e.target.value)} />
364
- </div>
365
-
366
- <div>
367
- <CardLabel>Contact Person</CardLabel>
368
- <TextInput value={contactPerson} onChange={(e) => setContactPerson(e.target.value)} />
369
- </div>
370
- </Fragment>
371
- )}
372
- </FormStep>
373
- {toast && <Toast error={toast.type === "error"} label={toast.message} onClose={() => setToast(null)} />}
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
+ />
304
+ {toast && (
305
+ <Toast
306
+ error={toast.type === "error"}
307
+ label={toast.message}
308
+ onClose={() => setToast(null)}
309
+ />
310
+ )}
374
311
  </Fragment>
375
312
  );
376
313
  };
@@ -80,7 +80,7 @@ const DesktopInbox = ({ tableConfig, filterComponent, ...props }) => {
80
80
  Header: t("EKYC_EKYC_STATUS"),
81
81
  accessor: "ekycStatus",
82
82
  Cell: ({ row }) => {
83
- const ekycStatus = row.original?.ekycstatus || "NA";
83
+ const ekycStatus = row.original?.ekycStatus || row.original?.ekycstatus || "NA";
84
84
  return <span className={`ekyc-status-tag ${ekycStatus}`}>{t(`${ekycStatus}`)}</span>
85
85
  }
86
86
  },