@djb25/digit-ui-module-ekyc 1.0.10 → 1.0.12

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.js +1 -1
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.modern.js +1338 -591
  4. package/dist/index.modern.js.map +1 -1
  5. package/package.json +1 -1
  6. package/src/Module.js +25 -7
  7. package/src/components/AadhaarVerification.js +415 -0
  8. package/src/components/AddressDetails.js +207 -0
  9. package/src/components/CeoDashboard.js +205 -0
  10. package/src/components/DesktopInbox.js +1 -1
  11. package/src/components/EKYCCard.js +4 -0
  12. package/src/components/MeterDetails.js +372 -0
  13. package/src/components/PropertyInfo.js +303 -0
  14. package/src/components/Review.js +572 -0
  15. package/src/components/SearchFormFieldsComponent.js +3 -3
  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 +44 -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,496 +0,0 @@
1
- // import React, { useState, Fragment, useEffect } from "react";
2
- // import {
3
- // Card,
4
- // CardLabel,
5
- // TextInput,
6
- // SubmitBar,
7
- // CardHeader,
8
- // ActionBar,
9
- // Dropdown,
10
- // UploadFile,
11
- // Toast,
12
- // FormStep,
13
- // } from "@djb25/digit-ui-react-components";
14
- // import { useTranslation } from "react-i18next";
15
- // import { useHistory, useLocation } from "react-router-dom";
16
- // import { getSavedData } from "../../utils";
17
-
18
- // const MeterDetails = ({ config, onSelect, formData, t: tProps }) => {
19
- // const { t } = useTranslation();
20
- // const history = useHistory();
21
- // const location = useLocation();
22
-
23
- // const flowState = location.state || {};
24
- // const { isEditing, kNumber } = flowState;
25
-
26
- // // Robust data extraction from formData
27
- // const activeEdits = formData || {};
28
- // const rawReviewData = formData?.reviewData || formData?.connectionDetails || {};
29
- // const reviewWrapper = rawReviewData?.applicationReview || rawReviewData;
30
- // const applicationData = (Array.isArray(reviewWrapper) ? reviewWrapper[0] : reviewWrapper) || {};
31
- // const apiData = applicationData?.newData || applicationData;
32
- // const apiMeter = apiData?.meterDetails || apiData || {};
33
-
34
- // const tenantId = Digit.ULBService.getCurrentTenantId();
35
-
36
- // const { data: dataV0 } = Digit.Hooks.ekyc.useGetPropertyType(tenantId);
37
- // const { data: dataConn } = Digit.Hooks.ekyc.useGetConnectionTypeV2(tenantId);
38
-
39
- // const mtrData = activeEdits?.meterDetails || {};
40
-
41
- // const [meterStatus, setMeterStatus] = useState(mtrData.meterStatusData || (apiMeter.metered !== undefined ? { label: apiMeter.metered ? t("EKYC_METER_METERED") : t("EKYC_METER_UNMETERED"), value: apiMeter.metered ? "Metered" : "Unmetered" } : (apiMeter.meterStatus ? { label: t(`EKYC_METER_${apiMeter.meterStatus}`), value: apiMeter.meterStatus } : null)));
42
- // const [meterPhoto, setMeterStatusPhoto] = useState(mtrData.meterPhoto || null);
43
- // const [meterPhotoFileStoreId, setMeterStatusPhotoFileStoreId] = useState(mtrData.meterPhotoFileStoreId || apiMeter.meterPhotoFileStoreId || null);
44
- // const [workingStatus, setWorkingStatus] = useState(mtrData.workingStatusData || (apiMeter.workingStatus !== undefined ? { label: apiMeter.workingStatus ? t("EKYC_METER_WORKING") : t("EKYC_METER_NOT_WORKING"), value: apiMeter.workingStatus ? "Working" : "Not Working" } : (apiMeter.workingStatus ? { label: t(`EKYC_METER_${apiMeter.workingStatus}`), value: apiMeter.workingStatus } : null)));
45
- // const [meterLocation, setMeterLocation] = useState(mtrData.meterLocation || apiMeter.meterLocationAddress || apiMeter.meterLocation || "");
46
- // const [lastBillRaised, setLastBillRaised] = useState(mtrData.lastBillRaisedData || (apiMeter.lastBillRaised !== undefined ? { label: apiMeter.lastBillRaised ? t("CORE_COMMON_YES") : t("CORE_COMMON_NO"), value: apiMeter.lastBillRaised ? "Yes" : "No" } : (apiMeter.lastBillRaised ? { label: t(`EKYC_${apiMeter.lastBillRaised}`), value: apiMeter.lastBillRaised } : null)));
47
- // const [sewerConnection, setSewerConnection] = useState(mtrData.sewerConnectionData || (apiMeter.sewerConnection ? { label: t(`EKYC_${apiMeter.sewerConnection}`), value: apiMeter.sewerConnection } : null));
48
- // const [connectionCategory, setConnectionCategory] = useState(mtrData.connectionCategoryData || (apiMeter.connectionCategory ? { label: t(apiMeter.connectionCategory), value: apiMeter.connectionCategory } : (apiMeter.typeOfConnection ? { label: t(apiMeter.typeOfConnection), value: apiMeter.typeOfConnection } : null)));
49
- // const [connectionType, setConnectionType] = useState(mtrData.connectionTypeData || (apiMeter.connectionType ? { label: t(apiMeter.connectionType), value: apiMeter.connectionType } : (apiMeter.connectionCategory ? { label: t(apiMeter.connectionCategory), value: apiMeter.connectionCategory } : null)));
50
-
51
- // const [toast, setToast] = useState(null);
52
-
53
- // const getUpdatedData = () => ({
54
- // meterStatusData: meterStatus,
55
- // meterPhoto,
56
- // meterPhotoFileStoreId,
57
- // workingStatusData: workingStatus,
58
- // meterLocation,
59
- // lastBillRaisedData: lastBillRaised,
60
- // sewerConnectionData: sewerConnection,
61
- // connectionCategoryData: connectionCategory,
62
- // connectionTypeData: connectionType,
63
- // });
64
-
65
- // const selectphoto = async (e) => {
66
- // const file = e.target.files[0];
67
- // if (file) {
68
- // if (file.size >= 2000000) {
69
- // setToast({ type: "error", message: t("EKYC_MAXIMUM_UPLOAD_SIZE_EXCEEDED") });
70
- // return;
71
- // }
72
- // try {
73
- // const res = await Digit.UploadServices.Filestorage("EKYC", file, tenantId);
74
- // if (res?.data?.files?.[0]?.fileStoreId) {
75
- // const fileStoreId = res.data.files[0].fileStoreId;
76
- // setMeterStatusPhotoFileStoreId(fileStoreId);
77
- // const reader = new FileReader();
78
- // reader.onloadend = () => {
79
- // setMeterStatusPhoto(reader.result);
80
- // if (onSelect) {
81
- // onSelect(config.key, { ...getUpdatedData(), meterPhoto: reader.result, meterPhotoFileStoreId: fileStoreId });
82
- // }
83
- // };
84
- // reader.readAsDataURL(file);
85
- // setToast({ type: "success", message: t("EKYC_UPLOAD_SUCCESS") });
86
- // }
87
- // } catch (err) {
88
- // setToast({ type: "error", message: t("EKYC_FILE_UPLOAD_ERROR") });
89
- // }
90
- // }
91
- // };
92
-
93
- // const onStepSelect = () => {
94
- // const updatedData = getUpdatedData();
95
- // if (onSelect) {
96
- // onSelect(config.key, updatedData);
97
- // } else {
98
- // if (isEditing) {
99
- // history.push("/digit-ui/employee/ekyc/review", { ...location.state, edits: { ...edits, meterDetails: updatedData } });
100
- // } else {
101
- // history.push("/digit-ui/employee/ekyc/review", {
102
- // ...location.state,
103
- // edits: { ...edits, meterDetails: updatedData }
104
- // });
105
- // }
106
- // }
107
- // };
108
-
109
- // const handleUpdateAndReturn = () => {
110
- // history.push("/digit-ui/employee/ekyc/review", { ...location.state, edits: { ...edits, meterDetails: getUpdatedData() } });
111
- // };
112
-
113
- // const meterStatusOptions = [
114
- // { label: t("EKYC_METER_METERED"), value: "Metered" },
115
- // { label: t("EKYC_METER_UNMETERED"), value: "Unmetered" },
116
- // ];
117
-
118
- // const workingStatusOptions = [
119
- // { label: t("EKYC_METER_WORKING"), value: "Working" },
120
- // { label: t("EKYC_METER_NOT_WORKING"), value: "Not Working" },
121
- // ];
122
-
123
- // const yesNoOptions = [
124
- // { label: t("CORE_COMMON_YES"), value: "Yes" },
125
- // { label: t("CORE_COMMON_NO"), value: "No" },
126
- // ];
127
-
128
- // const connectionCategoryOptions = dataV0?.["ws-services-calculation"]?.propertyTypeV2?.map((item) => ({
129
- // label: t(item.code), value: item.code,
130
- // })) || [];
131
-
132
- // const connectionTypeOptions = dataConn?.["ws-services-calculation"]?.connectionTypeV2?.map((item) => ({
133
- // label: t(item.code), value: item.code,
134
- // })) || [];
135
-
136
- // return (
137
- // <Fragment>
138
- // <FormStep t={t} onSelect={onStepSelect} config={config || {}} label={t(config?.texts?.submitBarLabel) || (isEditing ? t("EKYC_UPDATE_AND_RETURN") : t("ES_COMMON_CONTINUE"))}>
139
- // <CardLabel>{t("EKYC_METER_STATUS")}</CardLabel>
140
- // <Dropdown
141
- // option={meterStatusOptions}
142
- // optionKey="label"
143
- // selected={meterStatus}
144
- // select={setMeterStatus}
145
- // t={t}
146
- // />
147
-
148
- // {meterStatus?.value === "Metered" && (
149
- // <Fragment>
150
- // <CardLabel>{t("EKYC_METER_WORKING_STATUS")}</CardLabel>
151
- // <Dropdown
152
- // option={workingStatusOptions}
153
- // optionKey="label"
154
- // selected={workingStatus}
155
- // select={setWorkingStatus}
156
- // t={t}
157
- // />
158
-
159
- // <CardLabel>{t("EKYC_CAPTURE_METER_IMAGE")}</CardLabel>
160
- // <UploadFile
161
- // onUpload={selectphoto}
162
- // onDelete={() => {
163
- // setMeterStatusPhoto(null);
164
- // setMeterStatusPhotoFileStoreId(null);
165
- // if (onSelect) {
166
- // onSelect(config.key, { ...getUpdatedData(), meterPhoto: null, meterPhotoFileStoreId: null });
167
- // }
168
- // }}
169
- // message={meterPhotoFileStoreId ? t("EKYC_FILE_UPLOADED") : t("EKYC_NO_FILE_SELECTED")}
170
- // />
171
- // {meterPhoto && <img src={meterPhoto} style={{ width: "100%", marginTop: "10px", borderRadius: "8px" }} />}
172
-
173
- // <CardLabel>{t("EKYC_METER_LOCATION")}</CardLabel>
174
- // <TextInput
175
- // id="meterLocation"
176
- // name="meterLocation"
177
- // value={meterLocation}
178
- // onChange={(e) => setMeterLocation(e.target.value)}
179
- // placeholder={t("EKYC_ENTER_METER_LOCATION")}
180
- // />
181
-
182
- // <CardLabel>{t("EKYC_LAST_BILL_RAISED")}</CardLabel>
183
- // <Dropdown
184
- // option={yesNoOptions}
185
- // optionKey="label"
186
- // selected={lastBillRaised}
187
- // select={setLastBillRaised}
188
- // t={t}
189
- // />
190
- // </Fragment>
191
- // )}
192
-
193
- // <CardLabel>{t("EKYC_SEWER_CONNECTION")}</CardLabel>
194
- // <Dropdown
195
- // option={yesNoOptions}
196
- // optionKey="label"
197
- // selected={sewerConnection}
198
- // select={setSewerConnection}
199
- // t={t}
200
- // />
201
-
202
- // <CardLabel>{t("EKYC_TYPE_OF_CONNECTION")}</CardLabel>
203
- // <Dropdown
204
- // option={connectionCategoryOptions}
205
- // optionKey="label"
206
- // selected={connectionCategory}
207
- // select={setConnectionCategory}
208
- // t={t}
209
- // />
210
-
211
- // <CardLabel>{t("EKYC_CONNECTION_CATEGORY")}</CardLabel>
212
- // <Dropdown
213
- // option={connectionTypeOptions}
214
- // optionKey="label"
215
- // selected={connectionType}
216
- // select={setConnectionType}
217
- // t={t}
218
- // />
219
-
220
- // {toast && <Toast label={toast.message} error={toast.type === "error"} onClose={() => setToast(null)} />}
221
- // </FormStep>
222
- // {isEditing && !onSelect && (
223
- // <ActionBar style={{ position: "static", marginTop: "20px" }}>
224
- // <SubmitBar label={t("EKYC_UPDATE_AND_RETURN")} onSubmit={handleUpdateAndReturn} />
225
- // </ActionBar>
226
- // )}
227
- // </Fragment>
228
- // );
229
- // };
230
-
231
- // export default MeterDetails;
232
-
233
-
234
-
235
-
236
- import React, { useState, Fragment } from "react";
237
- import {
238
- CardLabel,
239
- TextInput,
240
- Dropdown,
241
- UploadFile,
242
- Toast,
243
- FormStep,
244
- } from "@djb25/digit-ui-react-components";
245
-
246
- const MeterDetails = ({ config, onSelect }) => {
247
- const tenantId = Digit.ULBService.getCurrentTenantId();
248
-
249
- // 🔹 STATES
250
- const [connectionCategory, setConnectionCategory] = useState("");
251
- const [saType, setSaType] = useState("");
252
- const [status, setStatus] = useState("");
253
-
254
- const [mrCode, setMrCode] = useState("");
255
- const [areaCode, setAreaCode] = useState("");
256
- const [mrKey, setMrKey] = useState("");
257
-
258
- const [meterNumber, setMeterNumber] = useState("");
259
- const [meterMaker, setMeterMaker] = useState("");
260
-
261
- const [meterStatus, setMeterStatus] = useState(null);
262
- const [meterCondition, setMeterCondition] = useState(null);
263
- const [meterLocation, setMeterLocation] = useState(null);
264
-
265
- const [lastBillReceived, setLastBillReceived] = useState(null);
266
- const [billMonthYear, setBillMonthYear] = useState(null);
267
- const [reason, setReason] = useState("");
268
-
269
- const [accessToMeter, setAccessToMeter] = useState(null);
270
- const [sewerConnection, setSewerConnection] = useState(null);
271
- const [septicTank, setSepticTank] = useState(null);
272
-
273
- const [meterPhoto, setMeterPhoto] = useState(null);
274
- const [meterPhotoId, setMeterPhotoId] = useState(null);
275
-
276
- const [toast, setToast] = useState(null);
277
-
278
- // 🔹 OPTIONS
279
- const yesNo = [{ name: "Yes" }, { name: "No" }];
280
-
281
- const meterStatusOptions = [
282
- { name: "Metered" },
283
- { name: "Unmetered" },
284
- { name: "Can not be identified" },
285
- ];
286
-
287
- const meterConditionOptions = [
288
- { name: "Damaged" },
289
- { name: "Not-Damaged" },
290
- ];
291
-
292
- const meterLocationOptions = [
293
- { name: "Inside" },
294
- { name: "Outside" },
295
- ];
296
-
297
- // 🔹 MONTH-YEAR OPTIONS (1998–2026)
298
- const monthYearOptions = [];
299
- for (let y = 1998; y <= 2026; y++) {
300
- for (let m = 1; m <= 12; m++) {
301
- monthYearOptions.push({ name: `${m}/${y}` });
302
- }
303
- }
304
-
305
- // 🔹 FREEZE LOGIC
306
- const isFrozen = meterStatus?.name === "Can not be identified";
307
-
308
- // 🔹 FILE UPLOAD
309
- const uploadPhoto = async (e) => {
310
- const file = e.target.files[0];
311
- if (!file) return;
312
-
313
- try {
314
- const res = await Digit.UploadServices.Filestorage("EKYC", file, tenantId);
315
- const id = res?.data?.files?.[0]?.fileStoreId;
316
-
317
- if (id) {
318
- setMeterPhotoId(id);
319
-
320
- const reader = new FileReader();
321
- reader.onloadend = () => setMeterPhoto(reader.result);
322
- reader.readAsDataURL(file);
323
- }
324
- } catch {
325
- setToast({ type: "error", message: "Upload failed" });
326
- }
327
- };
328
-
329
- // 🔹 VALIDATION
330
- const isValid = () => {
331
- if (!connectionCategory) return false;
332
- if (!meterStatus) return false;
333
- if (!meterLocation) return false;
334
- if (!lastBillReceived) return false;
335
- if (!sewerConnection) return false;
336
-
337
- if (meterStatus?.name === "Metered" && !meterPhotoId) return false;
338
-
339
- if (lastBillReceived?.name === "No" && !reason) return false;
340
-
341
- if (sewerConnection?.name === "No" && !septicTank) return false;
342
-
343
- return true;
344
- };
345
-
346
- // 🔹 SUBMIT
347
- const onStepSelect = () => {
348
- if (!isValid()) {
349
- setToast({ type: "error", message: "Fill all mandatory fields" });
350
- return;
351
- }
352
-
353
- const data = {
354
- connectionCategory,
355
- saType,
356
- status,
357
- mrCode,
358
- areaCode,
359
- mrKey,
360
- meterNumber,
361
- meterMaker,
362
- meterStatus: meterStatus?.name,
363
- meterCondition: meterCondition?.name,
364
- meterLocation: meterLocation?.name,
365
- lastBillReceived: lastBillReceived?.name,
366
- billMonthYear: billMonthYear?.name,
367
- reason,
368
- accessToMeter: accessToMeter?.name,
369
- sewerConnection: sewerConnection?.name,
370
- septicTank: septicTank?.name,
371
- meterPhotoId,
372
- };
373
-
374
- onSelect(config.key, data);
375
- };
376
-
377
- return (
378
- <Fragment>
379
- <FormStep onSelect={onStepSelect} config={config}>
380
- <div>
381
- <CardLabel>Connection Category *</CardLabel>
382
- <TextInput value={connectionCategory} onChange={(e) => setConnectionCategory(e.target.value)} />
383
- </div>
384
-
385
- <div>
386
- <CardLabel>SA Type</CardLabel>
387
- <TextInput value={saType} onChange={(e) => setSaType(e.target.value)} />
388
- </div>
389
-
390
- <div>
391
- <CardLabel>Status</CardLabel>
392
- <TextInput value={status} onChange={(e) => setStatus(e.target.value)} />
393
- </div>
394
-
395
- <div>
396
- <CardLabel>MR Code</CardLabel>
397
- <TextInput value={mrCode} onChange={(e) => setMrCode(e.target.value)} />
398
- </div>
399
-
400
- <div>
401
- <CardLabel>Area Code</CardLabel>
402
- <TextInput value={areaCode} onChange={(e) => setAreaCode(e.target.value)} />
403
- </div>
404
-
405
- <div>
406
- <CardLabel>MR Key</CardLabel>
407
- <TextInput value={mrKey} onChange={(e) => setMrKey(e.target.value)} />
408
- </div>
409
-
410
- {!isFrozen && (
411
- <Fragment>
412
- <div>
413
- <CardLabel>Meter Number</CardLabel>
414
- <TextInput value={meterNumber} onChange={(e) => setMeterNumber(e.target.value)} />
415
- </div>
416
-
417
- <div>
418
- <CardLabel>Meter Maker</CardLabel>
419
- <TextInput value={meterMaker} onChange={(e) => setMeterMaker(e.target.value)} />
420
- </div>
421
-
422
- <div>
423
- <CardLabel>Meter Condition</CardLabel>
424
- <Dropdown option={meterConditionOptions} selected={meterCondition} select={setMeterCondition} />
425
- </div>
426
-
427
- {meterStatus?.name === "Metered" && (
428
- <Fragment>
429
- <div>
430
- <CardLabel>Meter Photo *</CardLabel>
431
- <UploadFile onUpload={uploadPhoto} message={meterPhotoId ? "Uploaded" : "No file"} />
432
- </div>
433
- {meterPhoto && (
434
- <div style={{ gridColumn: "span 2" }}>
435
- <img src={meterPhoto} style={{ width: "100%" }} />
436
- </div>
437
- )}
438
- </Fragment>
439
- )}
440
- </Fragment>
441
- )}
442
-
443
- <div>
444
- <CardLabel>Meter Status *</CardLabel>
445
- <Dropdown option={meterStatusOptions} selected={meterStatus} select={setMeterStatus} />
446
- </div>
447
-
448
- <div>
449
- <CardLabel>Meter Location *</CardLabel>
450
- <Dropdown option={meterLocationOptions} selected={meterLocation} select={setMeterLocation} />
451
- </div>
452
-
453
- <div>
454
- <CardLabel>Last Bill Received *</CardLabel>
455
- <Dropdown option={yesNo} selected={lastBillReceived} select={setLastBillReceived} />
456
- </div>
457
-
458
- {lastBillReceived?.name === "Yes" && (
459
- <div>
460
- <CardLabel>When was the last bill received *</CardLabel>
461
- <Dropdown option={monthYearOptions} selected={billMonthYear} select={setBillMonthYear} />
462
- </div>
463
- )}
464
-
465
- {lastBillReceived?.name === "No" && (
466
- <div>
467
- <CardLabel>Reason *</CardLabel>
468
- <TextInput value={reason} onChange={(e) => setReason(e.target.value)} />
469
- </div>
470
- )}
471
-
472
- <div>
473
- <CardLabel>Access to Meter</CardLabel>
474
- <Dropdown option={yesNo} selected={accessToMeter} select={setAccessToMeter} />
475
- </div>
476
-
477
- <div>
478
- <CardLabel>Sewer Connection *</CardLabel>
479
- <Dropdown option={yesNo} selected={sewerConnection} select={setSewerConnection} />
480
- </div>
481
-
482
- {sewerConnection?.name === "No" && (
483
- <div>
484
- <CardLabel>Septic Tank *</CardLabel>
485
- <Dropdown option={yesNo} selected={septicTank} select={setSepticTank} />
486
- </div>
487
- )}
488
-
489
- {toast && <Toast label={toast.message} error={toast.type === "error"} onClose={() => setToast(null)} />}
490
-
491
- </FormStep>
492
- </Fragment>
493
- );
494
- };
495
-
496
- export default MeterDetails;