@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.
@@ -0,0 +1,367 @@
1
+ import React from "react";
2
+ import { UploadFile, CheckBox, Dropdown } from "@djb25/digit-ui-react-components";
3
+
4
+ const AadhaarVerificationConfig = (t, formData = {}, uploadFile, setDocumentId, documentId) => {
5
+ const consumerType = formData?.consumerType?.name || formData?.consumerType;
6
+ const occupantType = formData?.occupantType?.name || formData?.occupantType;
7
+ const informantIsConsumer = formData?.informantIsConsumer ?? true;
8
+
9
+ const fields = [
10
+ {
11
+ label: t("Consumer Type"),
12
+ isMandatory: true,
13
+ type: "custom",
14
+ key: "consumerType",
15
+ populators: {
16
+ name: "consumerType",
17
+ component: (props) => (
18
+ <Dropdown
19
+ option={[{ name: "Individual" }, { name: "Govt" }, { name: "Company_Society_Org" }]}
20
+ optionKey="name"
21
+ selected={props.value}
22
+ select={props.onChange}
23
+ />
24
+ ),
25
+ },
26
+ },
27
+ {
28
+ label: t("Occupant Type"),
29
+ isMandatory: true,
30
+ type: "custom",
31
+ key: "occupantType",
32
+ populators: {
33
+ name: "occupantType",
34
+ component: (props) => (
35
+ <Dropdown
36
+ option={[{ name: "Self" }, { name: "Tenanted" }]}
37
+ optionKey="name"
38
+ selected={props.value}
39
+ select={props.onChange}
40
+ />
41
+ ),
42
+ },
43
+ },
44
+ {
45
+ label: t("Category Type"),
46
+ isMandatory: true,
47
+ type: "custom",
48
+ key: "categoryType",
49
+ populators: {
50
+ name: "categoryType",
51
+ component: (props) => (
52
+ <Dropdown
53
+ option={[{ name: "Bulk" }, { name: "Non-Bulk" }]}
54
+ optionKey="name"
55
+ selected={props.value}
56
+ select={props.onChange}
57
+ />
58
+ ),
59
+ },
60
+ },
61
+ {
62
+ label: t("First Name"),
63
+ isMandatory: true,
64
+ type: "text",
65
+ populators: {
66
+ name: "firstName",
67
+ validation: { required: true },
68
+ },
69
+ },
70
+ {
71
+ label: t("Middle Name"),
72
+ isMandatory: false,
73
+ type: "text",
74
+ populators: {
75
+ name: "middleName",
76
+ },
77
+ },
78
+ {
79
+ label: t("Last Name"),
80
+ isMandatory: false,
81
+ type: "text",
82
+ populators: {
83
+ name: "lastName",
84
+ },
85
+ },
86
+ {
87
+ label: t("Gender"),
88
+ isMandatory: false,
89
+ type: "custom",
90
+ key: "gender",
91
+ populators: {
92
+ name: "gender",
93
+ component: (props) => (
94
+ <Dropdown
95
+ option={[{ name: "Male" }, { name: "Female" }, { name: "Others" }, { name: "Not prefer to say" }]}
96
+ optionKey="name"
97
+ selected={props.value}
98
+ select={props.onChange}
99
+ />
100
+ ),
101
+ },
102
+ },
103
+ {
104
+ label: t("Parent/Spouse Name"),
105
+ isMandatory: false,
106
+ type: "text",
107
+ populators: {
108
+ name: "parentSpouseName",
109
+ },
110
+ },
111
+ {
112
+ label: t("Mobile"),
113
+ isMandatory: true,
114
+ type: "text",
115
+ populators: {
116
+ name: "mobile",
117
+ validation: {
118
+ required: true,
119
+ pattern: /^[6-9]\d{9}$/,
120
+ },
121
+ error: t("Invalid mobile number"),
122
+ },
123
+ },
124
+ {
125
+ label: t("WhatsApp"),
126
+ isMandatory: false,
127
+ type: "text",
128
+ populators: {
129
+ name: "whatsapp",
130
+ },
131
+ },
132
+ {
133
+ label: t("Email"),
134
+ isMandatory: false,
135
+ type: "text",
136
+ populators: {
137
+ name: "email",
138
+ validation: {
139
+ pattern: /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/,
140
+ },
141
+ error: t("Invalid email address"),
142
+ },
143
+ },
144
+ {
145
+ label: t("No. of Residents"),
146
+ isMandatory: true,
147
+ type: "text",
148
+ populators: {
149
+ name: "residents",
150
+ validation: {
151
+ required: true,
152
+ min: 1,
153
+ },
154
+ },
155
+ },
156
+ {
157
+ label: t("Type of Identity"),
158
+ isMandatory: true,
159
+ type: "custom",
160
+ key: "identityType",
161
+ populators: {
162
+ name: "identityType",
163
+ component: (props) => (
164
+ <Dropdown
165
+ option={[{ name: "Aadhaar Card" }, { name: "Driving License" }, { name: "Passport" }, { name: "Voter ID" }]}
166
+ optionKey="name"
167
+ selected={props.value}
168
+ select={props.onChange}
169
+ />
170
+ ),
171
+ },
172
+ },
173
+ {
174
+ label: t("Proof of Identity"),
175
+ isMandatory: false,
176
+ type: "custom",
177
+ key: "idFile",
178
+ populators: {
179
+ name: "idFile",
180
+ component: (props) => (
181
+ <UploadFile
182
+ onUpload={(e) => uploadFile(e, props.onChange)}
183
+ onDelete={() => {
184
+ props.onChange(null);
185
+ setDocumentId(null);
186
+ }}
187
+ message={props.value ? t("Uploaded") : t("No file selected")}
188
+ />
189
+ ),
190
+ },
191
+ },
192
+ {
193
+ label: t("Document Number"),
194
+ isMandatory: false,
195
+ type: "text",
196
+ populators: {
197
+ name: "documentNumber",
198
+ },
199
+ },
200
+ {
201
+ label: t("Informant Is Consumer"),
202
+ isMandatory: false,
203
+ type: "custom",
204
+ key: "informantIsConsumer",
205
+ populators: {
206
+ name: "informantIsConsumer",
207
+ component: (props) => (
208
+ <CheckBox
209
+ label={t("Yes, the informant is the consumer")}
210
+ checked={props.value ?? true}
211
+ onChange={(e) => props.onChange(e.target.checked)}
212
+ />
213
+ ),
214
+ },
215
+ },
216
+ ];
217
+
218
+ // Informant conditional fields
219
+ if (!informantIsConsumer) {
220
+ fields.push(
221
+ {
222
+ label: t("Informant Name"),
223
+ isMandatory: false,
224
+ type: "text",
225
+ populators: {
226
+ name: "informantName",
227
+ },
228
+ },
229
+ {
230
+ label: t("Informant Relation"),
231
+ isMandatory: false,
232
+ type: "text",
233
+ populators: {
234
+ name: "informantRelation",
235
+ },
236
+ }
237
+ );
238
+ }
239
+
240
+ // Tenant conditional fields
241
+ if (occupantType === "Tenanted") {
242
+ fields.push({
243
+ label: t("Document Proof"),
244
+ isMandatory: false,
245
+ type: "custom",
246
+ key: "documentProof",
247
+ populators: {
248
+ name: "documentProof",
249
+ component: (props) => (
250
+ <UploadFile
251
+ onUpload={(e) => uploadFile(e, props.onChange)}
252
+ onDelete={() => {
253
+ props.onChange(null);
254
+ setDocumentId(null);
255
+ }}
256
+ message={props.value ? t("Uploaded") : t("No file selected")}
257
+ />
258
+ ),
259
+ },
260
+ });
261
+
262
+ if (!documentId) {
263
+ fields.push(
264
+ {
265
+ label: t("Owner Mobile"),
266
+ isMandatory: true,
267
+ type: "text",
268
+ populators: {
269
+ name: "ownerMobile",
270
+ validation: {
271
+ required: true,
272
+ pattern: /^[6-9]\d{9}$/,
273
+ },
274
+ },
275
+ },
276
+ {
277
+ label: t("Tenant Verification"),
278
+ isMandatory: false,
279
+ type: "text",
280
+ populators: {
281
+ name: "tenantVerification",
282
+ },
283
+ }
284
+ );
285
+ }
286
+ }
287
+
288
+ // Govt conditional fields
289
+ if (consumerType === "Govt") {
290
+ fields.push(
291
+ {
292
+ label: t("Designation"),
293
+ isMandatory: false,
294
+ type: "text",
295
+ populators: {
296
+ name: "designation",
297
+ },
298
+ },
299
+ {
300
+ label: t("Department"),
301
+ isMandatory: false,
302
+ type: "text",
303
+ populators: {
304
+ name: "department",
305
+ },
306
+ },
307
+ {
308
+ label: t("Employee ID"),
309
+ isMandatory: false,
310
+ type: "text",
311
+ populators: {
312
+ name: "employeeId",
313
+ },
314
+ }
315
+ );
316
+ }
317
+
318
+ // Company / Society / Org conditional fields
319
+ if (consumerType === "Company_Society_Org") {
320
+ fields.push(
321
+ {
322
+ label: t("Entity Name"),
323
+ isMandatory: false,
324
+ type: "text",
325
+ populators: {
326
+ name: "entityName",
327
+ },
328
+ },
329
+ {
330
+ label: t("Contact Person"),
331
+ isMandatory: false,
332
+ type: "text",
333
+ populators: {
334
+ name: "contactPerson",
335
+ },
336
+ }
337
+ );
338
+ }
339
+
340
+ // Consent checkbox field
341
+ fields.push({
342
+ label: t("Consent"),
343
+ isMandatory: true,
344
+ type: "custom",
345
+ key: "consent",
346
+ populators: {
347
+ name: "consent",
348
+ validation: { required: true },
349
+ component: (props) => (
350
+ <CheckBox
351
+ label={t("I hereby consent to verify my Aadhaar details.")}
352
+ checked={props.value ?? false}
353
+ onChange={(e) => props.onChange(e.target.checked)}
354
+ />
355
+ ),
356
+ },
357
+ });
358
+
359
+ return [
360
+ {
361
+ head: t("EKYC_CONSUMER_CONNECTION"),
362
+ body: fields,
363
+ },
364
+ ];
365
+ };
366
+
367
+ export default AadhaarVerificationConfig;
@@ -0,0 +1,297 @@
1
+ import React from "react";
2
+ import { UploadFile, Dropdown } from "@djb25/digit-ui-react-components";
3
+
4
+ const MeterDetailsConfig = (t, formData = {}, uploadPhoto, meterPhoto, meterPhotoId, setMeterPhoto, setMeterPhotoId) => {
5
+ const meterStatus = formData?.meterStatus?.name || formData?.meterStatus;
6
+ const lastBillReceived = formData?.lastBillReceived?.name || formData?.lastBillReceived;
7
+ const sewerConnection = formData?.sewerConnection?.name || formData?.sewerConnection;
8
+
9
+ const isFrozen = meterStatus === "Can not be identified";
10
+
11
+ // Generate Month-Year Options (1998–2026)
12
+ const monthYearOptions = [];
13
+ for (let y = 1998; y <= 2026; y++) {
14
+ for (let m = 1; m <= 12; m++) {
15
+ monthYearOptions.push({ name: `${m}/${y}` });
16
+ }
17
+ }
18
+
19
+ const yesNo = [{ name: "Yes" }, { name: "No" }];
20
+
21
+ const fields = [
22
+ {
23
+ label: t("Connection Category"),
24
+ isMandatory: true,
25
+ type: "text",
26
+ populators: {
27
+ name: "connectionCategory",
28
+ validation: { required: true },
29
+ },
30
+ },
31
+ {
32
+ label: t("SA Type"),
33
+ isMandatory: false,
34
+ type: "text",
35
+ populators: {
36
+ name: "saType",
37
+ },
38
+ },
39
+ {
40
+ label: t("Status"),
41
+ isMandatory: false,
42
+ type: "text",
43
+ populators: {
44
+ name: "status",
45
+ },
46
+ },
47
+ {
48
+ label: t("MR Code"),
49
+ isMandatory: false,
50
+ type: "text",
51
+ populators: {
52
+ name: "mrCode",
53
+ },
54
+ },
55
+ {
56
+ label: t("Area Code"),
57
+ isMandatory: false,
58
+ type: "text",
59
+ populators: {
60
+ name: "areaCode",
61
+ },
62
+ },
63
+ {
64
+ label: t("MR Key"),
65
+ isMandatory: false,
66
+ type: "text",
67
+ populators: {
68
+ name: "mrKey",
69
+ },
70
+ },
71
+ ];
72
+
73
+ // 🔹 Non-frozen fields
74
+ if (!isFrozen) {
75
+ fields.push(
76
+ {
77
+ label: t("Meter Number"),
78
+ isMandatory: false,
79
+ type: "text",
80
+ populators: {
81
+ name: "meterNumber",
82
+ },
83
+ },
84
+ {
85
+ label: t("Meter Maker"),
86
+ isMandatory: false,
87
+ type: "text",
88
+ populators: {
89
+ name: "meterMaker",
90
+ },
91
+ },
92
+ {
93
+ label: t("Meter Condition"),
94
+ isMandatory: false,
95
+ type: "custom",
96
+ key: "meterCondition",
97
+ populators: {
98
+ name: "meterCondition",
99
+ component: (props) => (
100
+ <Dropdown
101
+ option={[{ name: "Damaged" }, { name: "Not-Damaged" }]}
102
+ optionKey="name"
103
+ selected={props.value}
104
+ select={props.onChange}
105
+ />
106
+ ),
107
+ },
108
+ }
109
+ );
110
+
111
+ if (meterStatus === "Metered") {
112
+ fields.push({
113
+ label: t("Meter Photo *"),
114
+ isMandatory: true,
115
+ type: "custom",
116
+ key: "meterPhoto",
117
+ populators: {
118
+ name: "meterPhoto",
119
+ component: (props) => (
120
+ <div>
121
+ <UploadFile
122
+ onUpload={(e) => uploadPhoto(e, props.onChange)}
123
+ onDelete={() => {
124
+ props.onChange(null);
125
+ setMeterPhoto(null);
126
+ setMeterPhotoId(null);
127
+ }}
128
+ message={meterPhotoId ? t("Uploaded") : t("No file selected")}
129
+ />
130
+ {meterPhoto && (
131
+ <div style={{ marginTop: "10px" }}>
132
+ <img
133
+ src={meterPhoto}
134
+ alt="preview"
135
+ style={{ maxWidth: "100%", maxHeight: "200px", objectFit: "contain" }}
136
+ />
137
+ </div>
138
+ )}
139
+ </div>
140
+ ),
141
+ },
142
+ });
143
+ }
144
+ }
145
+
146
+ // 🔹 Standard fields after the conditional section
147
+ fields.push(
148
+ {
149
+ label: t("Meter Status"),
150
+ isMandatory: true,
151
+ type: "custom",
152
+ key: "meterStatus",
153
+ populators: {
154
+ name: "meterStatus",
155
+ component: (props) => (
156
+ <Dropdown
157
+ option={[{ name: "Metered" }, { name: "Unmetered" }, { name: "Can not be identified" }]}
158
+ optionKey="name"
159
+ selected={props.value}
160
+ select={props.onChange}
161
+ />
162
+ ),
163
+ },
164
+ },
165
+ {
166
+ label: t("Meter Location"),
167
+ isMandatory: true,
168
+ type: "custom",
169
+ key: "meterLocation",
170
+ populators: {
171
+ name: "meterLocation",
172
+ component: (props) => (
173
+ <Dropdown
174
+ option={[{ name: "Inside" }, { name: "Outside" }]}
175
+ optionKey="name"
176
+ selected={props.value}
177
+ select={props.onChange}
178
+ />
179
+ ),
180
+ },
181
+ },
182
+ {
183
+ label: t("Last Bill Received"),
184
+ isMandatory: true,
185
+ type: "custom",
186
+ key: "lastBillReceived",
187
+ populators: {
188
+ name: "lastBillReceived",
189
+ component: (props) => (
190
+ <Dropdown
191
+ option={yesNo}
192
+ optionKey="name"
193
+ selected={props.value}
194
+ select={props.onChange}
195
+ />
196
+ ),
197
+ },
198
+ }
199
+ );
200
+
201
+ // 🔹 Bill-received fields
202
+ if (lastBillReceived === "Yes") {
203
+ fields.push({
204
+ label: t("When was the last bill received *"),
205
+ isMandatory: true,
206
+ type: "custom",
207
+ key: "billMonthYear",
208
+ populators: {
209
+ name: "billMonthYear",
210
+ component: (props) => (
211
+ <Dropdown
212
+ option={monthYearOptions}
213
+ optionKey="name"
214
+ selected={props.value}
215
+ select={props.onChange}
216
+ />
217
+ ),
218
+ },
219
+ });
220
+ } else if (lastBillReceived === "No") {
221
+ fields.push({
222
+ label: t("Reason *"),
223
+ isMandatory: true,
224
+ type: "text",
225
+ populators: {
226
+ name: "reason",
227
+ validation: { required: true },
228
+ },
229
+ });
230
+ }
231
+
232
+ fields.push(
233
+ {
234
+ label: t("Access to Meter"),
235
+ isMandatory: false,
236
+ type: "custom",
237
+ key: "accessToMeter",
238
+ populators: {
239
+ name: "accessToMeter",
240
+ component: (props) => (
241
+ <Dropdown
242
+ option={yesNo}
243
+ optionKey="name"
244
+ selected={props.value}
245
+ select={props.onChange}
246
+ />
247
+ ),
248
+ },
249
+ },
250
+ {
251
+ label: t("Sewer Connection"),
252
+ isMandatory: true,
253
+ type: "custom",
254
+ key: "sewerConnection",
255
+ populators: {
256
+ name: "sewerConnection",
257
+ component: (props) => (
258
+ <Dropdown
259
+ option={yesNo}
260
+ optionKey="name"
261
+ selected={props.value}
262
+ select={props.onChange}
263
+ />
264
+ ),
265
+ },
266
+ }
267
+ );
268
+
269
+ if (sewerConnection === "No") {
270
+ fields.push({
271
+ label: t("Septic Tank"),
272
+ isMandatory: true,
273
+ type: "custom",
274
+ key: "septicTank",
275
+ populators: {
276
+ name: "septicTank",
277
+ component: (props) => (
278
+ <Dropdown
279
+ option={yesNo}
280
+ optionKey="name"
281
+ selected={props.value}
282
+ select={props.onChange}
283
+ />
284
+ ),
285
+ },
286
+ });
287
+ }
288
+
289
+ return [
290
+ {
291
+ head: t("EKYC_METER_DETAILS"),
292
+ body: fields,
293
+ },
294
+ ];
295
+ };
296
+
297
+ export default MeterDetailsConfig;