@djb25/digit-ui-module-ekyc 1.0.11 → 1.0.13

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.
Files changed (40) hide show
  1. package/dist/index.css +1 -0
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.modern.js +2884 -682
  5. package/dist/index.modern.js.map +1 -1
  6. package/package.json +1 -1
  7. package/src/Module.js +28 -7
  8. package/src/components/AadhaarVerification.js +415 -0
  9. package/src/components/AddressDetails.js +207 -0
  10. package/src/components/CeoDashboard.js +201 -0
  11. package/src/components/DesktopInbox.js +1 -1
  12. package/src/components/EKYCCard.js +4 -0
  13. package/src/components/MeterDetails.js +372 -0
  14. package/src/components/PropertyInfo.js +303 -0
  15. package/src/components/Review.js +572 -0
  16. package/src/components/analytics/charts/ClusterHeatmap.js +88 -0
  17. package/src/components/analytics/charts/TaskStatusChart.js +92 -0
  18. package/src/components/analytics/components/AnalyticsTable.js +106 -0
  19. package/src/components/analytics/components/DashboardLayout.js +72 -0
  20. package/src/components/analytics/components/EmptyState.js +27 -0
  21. package/src/components/analytics/components/ErrorBoundary.js +27 -0
  22. package/src/components/analytics/components/FilterBar.js +73 -0
  23. package/src/components/analytics/components/NotificationPanel.js +77 -0
  24. package/src/components/analytics/components/SLAWidget.js +56 -0
  25. package/src/components/analytics/components/SkeletonLoader.js +53 -0
  26. package/src/components/analytics/components/SummaryCard.js +74 -0
  27. package/src/components/analytics/components/WorkflowTimeline.js +55 -0
  28. package/src/components/analytics/styles/Dashboard.css +54 -0
  29. package/src/components/analytics/utils/exportUtils.js +64 -0
  30. package/src/components/analytics/utils/filterSerializer.js +50 -0
  31. package/src/config/config.js +1 -1
  32. package/src/pages/citizen/index.js +74 -18
  33. package/src/pages/employee/ConsumerDetails.js +10 -281
  34. package/src/pages/employee/Inbox.js +6 -4
  35. package/src/pages/employee/index.js +55 -8
  36. package/src/pages/employee/AadhaarVerification.js +0 -512
  37. package/src/pages/employee/AddressDetails.js +0 -548
  38. package/src/pages/employee/MeterDetails.js +0 -496
  39. package/src/pages/employee/PropertyInfo.js +0 -489
  40. package/src/pages/employee/Review.js +0 -314
@@ -1,512 +0,0 @@
1
- // import React, { useState, Fragment, useEffect, useRef } from "react";
2
- // import {
3
- // Card,
4
- // CardLabel,
5
- // TextInput,
6
- // SubmitBar,
7
- // CardHeader,
8
- // RadioButtons,
9
- // ActionBar,
10
- // Loader,
11
- // FormStep,
12
- // } from "@djb25/digit-ui-react-components";
13
- // import { useTranslation } from "react-i18next";
14
- // import { useLocation, useHistory } from "react-router-dom";
15
- // import { getSavedData } from "../../utils";
16
- // import AddressDetails from "./AddressDetails";
17
-
18
- // const AadhaarVerification = ({ config, onSelect, formData, t: tProps }) => {
19
- // const { t } = useTranslation();
20
- // const location = useLocation();
21
- // const history = useHistory();
22
- // const addressSectionRef = useRef(null);
23
-
24
- // const flowState = location.state || {};
25
- // const { isEditing, kNumber } = flowState;
26
-
27
- // // Robust data extraction from formData
28
- // const activeEdits = formData || {};
29
- // const rawReviewData = formData?.reviewData || formData?.connectionDetails || {};
30
- // const reviewWrapper = rawReviewData?.applicationReview || rawReviewData;
31
- // const applicationData = (Array.isArray(reviewWrapper) ? reviewWrapper[0] : reviewWrapper) || {};
32
- // const apiData = applicationData?.newData || applicationData;
33
- // const apiConn = apiData?.connectionDetails || apiData || {};
34
-
35
- // const initialData = {
36
- // userName: apiConn.consumerName || "",
37
- // mobileNumber: apiConn.phoneNumber || apiConn.mobileNo || "",
38
- // whatsappNumber: apiConn.phoneNumber || apiConn.mobileNo || "",
39
- // email: apiConn.email || "",
40
- // noOfPersons: apiConn.noOfPerson || apiConn.noOfPersons || "",
41
- // };
42
-
43
- // const aadhaarData = activeEdits?.aadhaarData || {};
44
-
45
- // const [aadhaarNumber, setAadhaarNumber] = useState(aadhaarData.aadhaarNumber || "");
46
- // const [isAadhaarVerified, setIsAadhaarVerified] = useState(aadhaarData.isAadhaarVerified === true || isEditing); // Auto-verify if editing
47
- // const [showOtpField, setShowOtpField] = useState(false);
48
- // const [otp, setOtp] = useState("");
49
- // const [otpError, setOtpError] = useState(false);
50
- // const [nameCorrect, setNameCorrect] = useState(aadhaarData.nameCorrect || { code: "YES", name: "CORE_COMMON_YES" });
51
- // const [userName, setUserName] = useState(aadhaarData.name || initialData.userName);
52
- // const [mobileChange, setMobileChange] = useState(aadhaarData.mobileChange || { code: "YES", name: "CORE_COMMON_YES" });
53
- // const [mobileNumber, setMobileNumber] = useState(aadhaarData.mobileNumber || initialData.mobileNumber);
54
- // const [whatsappNumber, setWhatsappNumber] = useState(aadhaarData.whatsappNumber || initialData.whatsappNumber);
55
- // const [email, setEmail] = useState(aadhaarData.email || initialData.email);
56
- // const [noOfPersons, setNoOfPersons] = useState(aadhaarData.noOfPersons || initialData.noOfPersons);
57
- // const [showAddressSection, setShowAddressSection] = useState(false);
58
-
59
- // const getUpdatedData = () => ({
60
- // aadhaarNumber,
61
- // isAadhaarVerified,
62
- // name: userName,
63
- // nameCorrect,
64
- // mobileChange,
65
- // mobileNumber,
66
- // whatsappNumber,
67
- // email,
68
- // noOfPersons,
69
- // gender: "Male",
70
- // dob: "01/01/1990",
71
- // });
72
-
73
- // const handleVerifyAadhaar = () => {
74
- // if (aadhaarNumber.length === 12) setShowOtpField(true);
75
- // };
76
-
77
- // const handleVerifyOtp = () => {
78
- // if (otp === "123456") {
79
- // setIsAadhaarVerified(true);
80
- // setShowOtpField(false);
81
- // setShowAddressSection(true);
82
- // if (onSelect) {
83
- // onSelect(config.key, { ...getUpdatedData(), isAadhaarVerified: true });
84
- // }
85
- // } else {
86
- // setOtpError(true);
87
- // }
88
- // };
89
-
90
- // const onStepSelect = () => {
91
- // const updatedData = getUpdatedData();
92
- // if (onSelect) {
93
- // onSelect(config.key, updatedData);
94
- // } else {
95
- // if (isEditing) {
96
- // history.push("/digit-ui/employee/ekyc/review", { ...location.state, edits: { ...edits, aadhaarData: updatedData } });
97
- // } else {
98
- // history.push("/digit-ui/employee/ekyc/address-details", {
99
- // ...location.state,
100
- // edits: { ...edits, aadhaarData: updatedData }
101
- // });
102
- // }
103
- // }
104
- // };
105
-
106
- // const handleUpdateAndReturn = () => {
107
- // history.push("/digit-ui/employee/ekyc/review", { ...location.state, edits: { ...edits, aadhaarData: getUpdatedData() } });
108
- // };
109
-
110
- // const yesNoOptions = [
111
- // { code: "YES", name: "CORE_COMMON_YES" },
112
- // { code: "NO", name: "CORE_COMMON_NO" },
113
- // ];
114
-
115
- // return (
116
- // <Fragment>
117
- // <FormStep
118
- // t={t}
119
- // config={config || {}}
120
- // onSelect={onStepSelect}
121
- // isDisabled={!isAadhaarVerified || !userName || !mobileNumber}
122
- // label={t(config?.texts?.submitBarLabel) || (isEditing ? t("EKYC_UPDATE_AND_RETURN") : t("ES_COMMON_CONTINUE"))}
123
- // >
124
- // <CardLabel>{t("EKYC_AADHAAR_NUMBER")} <span className="astericColor">*</span></CardLabel>
125
- // <TextInput
126
- // id="aadhaarNumber"
127
- // name="aadhaarNumber"
128
- // value={aadhaarNumber}
129
- // onChange={(e) => setAadhaarNumber(e.target.value)}
130
- // placeholder={t("EKYC_ENTER_AADHAAR_NUMBER")}
131
- // maxLength={12}
132
- // disabled={isAadhaarVerified}
133
- // />
134
- // {!isAadhaarVerified && !showOtpField && (
135
- // <SubmitBar label={t("EKYC_VERIFY")} onSubmit={handleVerifyAadhaar} disabled={aadhaarNumber.length !== 12} />
136
- // )}
137
-
138
- // {showOtpField && (
139
- // <Fragment>
140
- // <CardLabel>{t("EKYC_ENTER_OTP")} <span className="astericColor">*</span></CardLabel>
141
- // <TextInput
142
- // id="otp"
143
- // name="otp"
144
- // value={otp}
145
- // onChange={(e) => setOtp(e.target.value)}
146
- // placeholder="123456"
147
- // maxLength={6}
148
- // />
149
- // {otpError && <div style={{ color: "red", fontSize: "12px" }}>{t("EKYC_INVALID_OTP")}</div>}
150
- // <SubmitBar label={t("EKYC_VERIFY_OTP")} onSubmit={handleVerifyOtp} disabled={otp.length !== 6} />
151
- // </Fragment>
152
- // )}
153
-
154
- // {isAadhaarVerified && (
155
- // <Fragment>
156
- // <CardLabel>{t("EKYC_IS_NAME_CORRECT")}</CardLabel>
157
- // <RadioButtons
158
- // options={yesNoOptions}
159
- // optionsKey="name"
160
- // selectedOption={nameCorrect}
161
- // onSelect={setNameCorrect}
162
- // />
163
- // <CardLabel>{t("EKYC_USER_NAME")} <span className="astericColor">*</span></CardLabel>
164
- // <TextInput
165
- // id="userName"
166
- // name="userName"
167
- // value={userName}
168
- // onChange={(e) => setUserName(e.target.value)}
169
- // disabled={nameCorrect.code === "NO"}
170
- // />
171
-
172
- // <CardLabel>{t("EKYC_CHANGE_MOBILE")}</CardLabel>
173
- // <RadioButtons
174
- // options={yesNoOptions}
175
- // optionsKey="name"
176
- // selectedOption={mobileChange}
177
- // onSelect={setMobileChange}
178
- // />
179
- // <CardLabel>{t("EKYC_MOBILE_NUMBER")} <span className="astericColor">*</span></CardLabel>
180
- // <TextInput
181
- // id="mobileNumber"
182
- // name="mobileNumber"
183
- // value={mobileNumber}
184
- // onChange={(e) => setMobileNumber(e.target.value)}
185
- // disabled={mobileChange.code === "NO"}
186
- // />
187
-
188
- // <CardLabel>{t("EKYC_WHATSAPP_NUMBER")}</CardLabel>
189
- // <TextInput
190
- // id="whatsappNumber"
191
- // name="whatsappNumber"
192
- // value={whatsappNumber}
193
- // onChange={(e) => setWhatsappNumber(e.target.value)}
194
- // />
195
-
196
- // <CardLabel>{t("EKYC_EMAIL_ID")}</CardLabel>
197
- // <TextInput
198
- // id="email"
199
- // name="email"
200
- // value={email}
201
- // onChange={(e) => setEmail(e.target.value)}
202
- // />
203
-
204
- // <CardLabel>{t("EKYC_NO_OF_PERSONS")}</CardLabel>
205
- // <TextInput
206
- // id="noOfPersons"
207
- // name="noOfPersons"
208
- // value={noOfPersons}
209
- // onChange={(e) => setNoOfPersons(e.target.value)}
210
- // />
211
- // </Fragment>
212
- // )}
213
- // </FormStep>
214
- // {isEditing && !onSelect && (
215
- // <ActionBar style={{ position: "static", marginTop: "20px" }}>
216
- // <SubmitBar label={t("EKYC_UPDATE_AND_RETURN")} onSubmit={handleUpdateAndReturn} />
217
- // </ActionBar>
218
- // )}
219
- // </Fragment>
220
- // );
221
- // };
222
-
223
- // export default AadhaarVerification;
224
-
225
-
226
-
227
- import React, { useState, Fragment } from "react";
228
- import {
229
- CardLabel,
230
- TextInput,
231
- Dropdown,
232
- UploadFile,
233
- RadioButtons,
234
- Toast,
235
- FormStep,
236
- } from "@djb25/digit-ui-react-components";
237
-
238
- const AadhaarVerification = ({ config, onSelect }) => {
239
-
240
- // 🔹 STATES
241
- const [kno, setKno] = useState("");
242
- const [consumerType, setConsumerType] = useState(null);
243
- const [occupantType, setOccupantType] = useState(null);
244
- const [categoryType, setCategoryType] = useState(null);
245
-
246
- const [consumerName, setConsumerName] = useState("");
247
- const [firstName, setFirstName] = useState("");
248
- const [middleName, setMiddleName] = useState("");
249
- const [lastName, setLastName] = useState("");
250
-
251
- const [gender, setGender] = useState(null);
252
- const [relation, setRelation] = useState("");
253
-
254
- const [mobile, setMobile] = useState("");
255
- const [whatsapp, setWhatsapp] = useState("");
256
- const [email, setEmail] = useState("");
257
- const [residents, setResidents] = useState("");
258
-
259
- // Tenant
260
- const [documentProof, setDocumentProof] = useState(null);
261
- const [documentId, setDocumentId] = useState(null);
262
- const [ownerMobile, setOwnerMobile] = useState("");
263
- const [tenantVerification, setTenantVerification] = useState("");
264
-
265
- // Govt
266
- const [designation, setDesignation] = useState("");
267
- const [department, setDepartment] = useState("");
268
- const [employeeId, setEmployeeId] = useState("");
269
- const [landline, setLandline] = useState("");
270
-
271
- // Other Entity
272
- const [entityRelation, setEntityRelation] = useState("");
273
- const [contactPerson, setContactPerson] = useState("");
274
- const [entityName, setEntityName] = useState("");
275
-
276
- // Identity
277
- const [idProof, setIdProof] = useState(null);
278
- const [idNumber, setIdNumber] = useState("");
279
- const [idFile, setIdFile] = useState(null);
280
-
281
- // Consent
282
- const [consent, setConsent] = useState(false);
283
- const [informantIsConsumer, setInformantIsConsumer] = useState(true);
284
- const [informantName, setInformantName] = useState("");
285
- const [informantRelation, setInformantRelation] = useState("");
286
-
287
- const [toast, setToast] = useState(null);
288
-
289
- // 🔹 OPTIONS
290
- const consumerTypeOptions = [
291
- { name: "Individual" },
292
- { name: "Govt" },
293
- { name: "Company_Society_Org" },
294
- ];
295
-
296
- const occupantOptions = [
297
- { name: "Self" },
298
- { name: "Tenanted" },
299
- ];
300
-
301
- const genderOptions = [
302
- { name: "Male" },
303
- { name: "Female" },
304
- { name: "Others" },
305
- { name: "Not prefer to say" },
306
- ];
307
-
308
- const yesNo = [{ name: "Yes" }, { name: "No" }];
309
-
310
- // 🔹 FILE UPLOAD
311
- const uploadFile = async (e, setter, idSetter) => {
312
- const file = e.target.files[0];
313
- if (!file) return;
314
-
315
- try {
316
- const res = await Digit.UploadServices.Filestorage("EKYC", file);
317
- const id = res?.data?.files?.[0]?.fileStoreId;
318
- if (id) {
319
- setter(file.name);
320
- idSetter(id);
321
- }
322
- } catch {
323
- setToast({ type: "error", message: "Upload failed" });
324
- }
325
- };
326
-
327
- // 🔹 VALIDATION
328
- const isValid = () => {
329
- if (!kno) return false;
330
- if (!consumerType) return false;
331
- if (!occupantType) return false;
332
- if (!categoryType) return false;
333
- if (!firstName) return false;
334
- if (!mobile) return false;
335
- if (!residents || Number(residents) <= 0) return false;
336
-
337
- if (occupantType?.name === "Tenanted" && !documentId && !ownerMobile)
338
- return false;
339
-
340
- return consent;
341
- };
342
-
343
- // 🔹 SUBMIT
344
- const onStepSelect = () => {
345
- if (!isValid()) {
346
- setToast({ type: "error", message: "Fill required fields" });
347
- return;
348
- }
349
-
350
- const data = {
351
- kno,
352
- consumerType: consumerType?.name,
353
- occupantType: occupantType?.name,
354
- categoryType: categoryType?.name,
355
- consumerName,
356
- firstName,
357
- middleName,
358
- lastName,
359
- gender: gender?.name,
360
- relation,
361
- mobile,
362
- whatsapp,
363
- email,
364
- residents,
365
- documentId,
366
- ownerMobile,
367
- tenantVerification,
368
- designation,
369
- department,
370
- employeeId,
371
- landline,
372
- entityRelation,
373
- contactPerson,
374
- entityName,
375
- idProof: idProof?.name,
376
- idNumber,
377
- consent,
378
- informantIsConsumer,
379
- informantName,
380
- informantRelation,
381
- };
382
-
383
- onSelect(config.key, data);
384
- };
385
-
386
- return (
387
- <Fragment>
388
- <FormStep onSelect={onStepSelect} config={config}>
389
- <div>
390
- <CardLabel>K Number *</CardLabel>
391
- <TextInput value={kno} onChange={(e) => setKno(e.target.value)} />
392
- </div>
393
-
394
- <div>
395
- <CardLabel>Consumer Type *</CardLabel>
396
- <Dropdown option={consumerTypeOptions} selected={consumerType} select={setConsumerType} />
397
- </div>
398
-
399
- <div>
400
- <CardLabel>Occupant Type *</CardLabel>
401
- <Dropdown option={occupantOptions} selected={occupantType} select={setOccupantType} />
402
- </div>
403
-
404
- <div>
405
- <CardLabel>Category Type *</CardLabel>
406
- <Dropdown option={[]} selected={categoryType} select={setCategoryType} />
407
- </div>
408
-
409
- <div>
410
- <CardLabel>First Name *</CardLabel>
411
- <TextInput value={firstName} onChange={(e) => setFirstName(e.target.value)} />
412
- </div>
413
-
414
- <div>
415
- <CardLabel>Middle Name</CardLabel>
416
- <TextInput value={middleName} onChange={(e) => setMiddleName(e.target.value)} />
417
- </div>
418
-
419
- <div>
420
- <CardLabel>Last Name</CardLabel>
421
- <TextInput value={lastName} onChange={(e) => setLastName(e.target.value)} />
422
- </div>
423
-
424
- <div>
425
- <CardLabel>Gender</CardLabel>
426
- <Dropdown option={genderOptions} selected={gender} select={setGender} />
427
- </div>
428
-
429
- <div>
430
- <CardLabel>Mobile *</CardLabel>
431
- <TextInput value={mobile} onChange={(e) => setMobile(e.target.value)} />
432
- </div>
433
-
434
- <div>
435
- <CardLabel>WhatsApp</CardLabel>
436
- <TextInput value={whatsapp} onChange={(e) => setWhatsapp(e.target.value)} />
437
- </div>
438
-
439
- <div>
440
- <CardLabel>Email</CardLabel>
441
- <TextInput value={email} onChange={(e) => setEmail(e.target.value)} />
442
- </div>
443
-
444
- <div>
445
- <CardLabel>No. of Residents *</CardLabel>
446
- <TextInput value={residents} onChange={(e) => setResidents(e.target.value)} />
447
- </div>
448
-
449
- {/* TENANT LOGIC */}
450
- {occupantType?.name === "Tenanted" && (
451
- <Fragment>
452
- <div>
453
- <CardLabel>Document Proof</CardLabel>
454
- <UploadFile onUpload={(e) => uploadFile(e, setDocumentProof, setDocumentId)} />
455
- </div>
456
-
457
- {!documentId && (
458
- <Fragment>
459
- <div>
460
- <CardLabel>Owner Mobile *</CardLabel>
461
- <TextInput value={ownerMobile} onChange={(e) => setOwnerMobile(e.target.value)} />
462
- </div>
463
-
464
- <div>
465
- <CardLabel>Tenant Verification</CardLabel>
466
- <TextInput value={tenantVerification} onChange={(e) => setTenantVerification(e.target.value)} />
467
- </div>
468
- </Fragment>
469
- )}
470
- </Fragment>
471
- )}
472
-
473
- {/* GOVT */}
474
- {consumerType?.name === "Govt" && (
475
- <Fragment>
476
- <div>
477
- <CardLabel>Designation</CardLabel>
478
- <TextInput value={designation} onChange={(e) => setDesignation(e.target.value)} />
479
- </div>
480
-
481
- <div>
482
- <CardLabel>Department</CardLabel>
483
- <TextInput value={department} onChange={(e) => setDepartment(e.target.value)} />
484
- </div>
485
-
486
- <div>
487
- <CardLabel>Employee ID</CardLabel>
488
- <TextInput value={employeeId} onChange={(e) => setEmployeeId(e.target.value)} />
489
- </div>
490
- </Fragment>
491
- )}
492
-
493
- {/* OTHER ENTITY */}
494
- {consumerType?.name === "Company_Society_Org" && (
495
- <Fragment>
496
- <div>
497
- <CardLabel>Entity Name</CardLabel>
498
- <TextInput value={entityName} onChange={(e) => setEntityName(e.target.value)} />
499
- </div>
500
-
501
- <div>
502
- <CardLabel>Contact Person</CardLabel>
503
- <TextInput value={contactPerson} onChange={(e) => setContactPerson(e.target.value)} />
504
- </div>
505
- </Fragment>
506
- )}
507
- </FormStep>
508
- </Fragment>
509
- );
510
- };
511
-
512
- export default AadhaarVerification;