@djb25/digit-ui-module-ekyc 1.0.11 → 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 (39) 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/analytics/charts/ClusterHeatmap.js +88 -0
  16. package/src/components/analytics/charts/TaskStatusChart.js +92 -0
  17. package/src/components/analytics/components/AnalyticsTable.js +106 -0
  18. package/src/components/analytics/components/DashboardLayout.js +72 -0
  19. package/src/components/analytics/components/EmptyState.js +27 -0
  20. package/src/components/analytics/components/ErrorBoundary.js +27 -0
  21. package/src/components/analytics/components/FilterBar.js +73 -0
  22. package/src/components/analytics/components/NotificationPanel.js +77 -0
  23. package/src/components/analytics/components/SLAWidget.js +56 -0
  24. package/src/components/analytics/components/SkeletonLoader.js +53 -0
  25. package/src/components/analytics/components/SummaryCard.js +74 -0
  26. package/src/components/analytics/components/WorkflowTimeline.js +55 -0
  27. package/src/components/analytics/styles/Dashboard.css +54 -0
  28. package/src/components/analytics/utils/exportUtils.js +64 -0
  29. package/src/components/analytics/utils/filterSerializer.js +50 -0
  30. package/src/config/config.js +1 -1
  31. package/src/pages/citizen/index.js +74 -18
  32. package/src/pages/employee/ConsumerDetails.js +10 -281
  33. package/src/pages/employee/Inbox.js +6 -4
  34. package/src/pages/employee/index.js +44 -8
  35. package/src/pages/employee/AadhaarVerification.js +0 -512
  36. package/src/pages/employee/AddressDetails.js +0 -548
  37. package/src/pages/employee/MeterDetails.js +0 -496
  38. package/src/pages/employee/PropertyInfo.js +0 -489
  39. package/src/pages/employee/Review.js +0 -314
@@ -1,489 +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
- // RadioButtons,
14
- // } from "@djb25/digit-ui-react-components";
15
- // import { useTranslation } from "react-i18next";
16
- // import { useHistory, useLocation } from "react-router-dom";
17
- // import { getSavedData } from "../../utils";
18
-
19
- // const PropertyInfo = ({ config, onSelect, formData, t: tProps }) => {
20
- // const { t } = useTranslation();
21
- // const history = useHistory();
22
- // const location = useLocation();
23
-
24
- // const flowState = location.state || {};
25
- // const { isEditing } = 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 apiProp = apiData?.propertyInfo || apiData || {};
34
-
35
- // const tenantId = Digit.ULBService.getCurrentTenantId();
36
-
37
- // const { data: dataV1 } = Digit.Hooks.ekyc.useGetUserType(tenantId);
38
- // const { data: dataV2 } = Digit.Hooks.ekyc.useGetFloorCount(tenantId);
39
- // const { data: dataV3 } = Digit.Hooks.ekyc.useGetPropertyType(tenantId);
40
- // const { data: dataConn } = Digit.Hooks.ekyc.useGetConnectionTypeV2(tenantId);
41
-
42
- // const userTypeOptions = dataV1?.["ws-services-calculation"]?.userTypeV2?.map((item) => ({
43
- // label: t(item.code), value: item.code,
44
- // })) || [];
45
-
46
- // const floorOptions = dataV2?.["ws-services-calculation"]?.floorCount?.map((item) => ({
47
- // label: t(item.code), value: item.code,
48
- // })) || [];
49
-
50
- // const connectionCategoryOptions = dataV3?.["ws-services-calculation"]?.propertyTypeV2?.map((item) => ({
51
- // label: t(item.code), value: item.code,
52
- // })) || [];
53
-
54
- // const connectionTypeOptions = dataConn?.["ws-services-calculation"]?.connectionTypeV2?.map((item) => ({
55
- // label: t(item.code), value: item.code,
56
- // })) || [];
57
-
58
- // const propData = activeEdits?.propertyDetails || {};
59
-
60
- // const [ownerType, setOwnerType] = useState(propData.ownerType || (apiProp.tenantName ? "TENANT" : "OWNER"));
61
- // const [pidNumber, setPidNumber] = useState(propData.pidNumber || apiProp.pidNumber || "");
62
- // const [userType, setUserType] = useState(propData.userTypeData || null);
63
- // const [noOfFloors, setNoOfFloors] = useState(propData.noOfFloorsData || null);
64
- // const [connectionCategory, setConnectionCategory] = useState(propData.connectionCategoryData || null);
65
- // const [typeOfConnection, setTypeOfConnection] = useState(propData.typeOfConnectionData || null);
66
-
67
- // const [propertyDocument, setPropertyDocument] = useState(propData.propertyDocument || null);
68
- // const [propertyDocumentFileStoreId, setPropertyDocumentFileStoreId] = useState(propData.propertyDocumentFileStoreId || apiProp.propertyDocumentFileStoreId || null);
69
-
70
- // const [toast, setToast] = useState(null);
71
-
72
- // // Pre-fill dropdowns from API
73
- // useEffect(() => {
74
- // if (!userType && userTypeOptions.length > 0) {
75
- // const val = apiProp.userType;
76
- // const found = userTypeOptions.find(o => o.value === val || o.label === val);
77
- // if (found) setUserType(found);
78
- // }
79
- // }, [userTypeOptions, apiProp.userType]);
80
-
81
- // useEffect(() => {
82
- // if (!noOfFloors && floorOptions.length > 0) {
83
- // const val = apiProp.numberOfFloors || apiProp.noOfFloor;
84
- // const found = floorOptions.find(o => o.value === String(val) || o.label === String(val));
85
- // if (found) setNoOfFloors(found);
86
- // }
87
- // }, [floorOptions, apiProp.numberOfFloors]);
88
-
89
- // useEffect(() => {
90
- // if (!connectionCategory && connectionCategoryOptions.length > 0) {
91
- // const val = apiProp.connectionCategory;
92
- // const found = connectionCategoryOptions.find(o => o.value === val || o.label === val);
93
- // if (found) setConnectionCategory(found);
94
- // }
95
- // }, [connectionCategoryOptions, apiProp.connectionCategory]);
96
-
97
- // useEffect(() => {
98
- // if (!typeOfConnection && connectionTypeOptions.length > 0) {
99
- // const val = apiProp.typeOfConnection;
100
- // const found = connectionTypeOptions.find(o => o.value === val || o.label === val);
101
- // if (found) setTypeOfConnection(found);
102
- // }
103
- // }, [connectionTypeOptions, apiProp.typeOfConnection]);
104
-
105
- // const getUpdatedData = () => ({
106
- // ownerType,
107
- // pidNumber,
108
- // userTypeData: userType,
109
- // noOfFloorsData: noOfFloors,
110
- // connectionCategoryData: connectionCategory,
111
- // typeOfConnectionData: typeOfConnection,
112
- // propertyDocument,
113
- // propertyDocumentFileStoreId,
114
- // kno: apiProp.kno || flowState.kno
115
- // });
116
-
117
- // const selectpdf = async (e) => {
118
- // const file = e.target.files[0];
119
- // if (file) {
120
- // if (file.size >= 5000000) {
121
- // setToast({ type: "error", message: t("EKYC_MAXIMUM_UPLOAD_SIZE_EXCEEDED") });
122
- // return;
123
- // }
124
- // try {
125
- // const res = await Digit.UploadServices.Filestorage("EKYC", file, tenantId);
126
- // if (res?.data?.files?.[0]?.fileStoreId) {
127
- // const fileStoreId = res.data.files[0].fileStoreId;
128
- // setPropertyDocumentFileStoreId(fileStoreId);
129
- // setPropertyDocument(file.name);
130
- // if (onSelect) {
131
- // onSelect(config.key, { ...getUpdatedData(), propertyDocument: file.name, propertyDocumentFileStoreId: fileStoreId });
132
- // }
133
- // setToast({ type: "success", message: t("EKYC_UPLOAD_SUCCESS") });
134
- // }
135
- // } catch (err) {
136
- // setToast({ type: "error", message: t("EKYC_FILE_UPLOAD_ERROR") });
137
- // }
138
- // }
139
- // };
140
-
141
- // const onStepSelect = () => {
142
- // const updatedData = getUpdatedData();
143
- // if (onSelect) {
144
- // onSelect(config.key, updatedData);
145
- // } else {
146
- // if (isEditing) {
147
- // history.push("/digit-ui/employee/ekyc/review", { ...location.state, edits: { ...edits, propertyDetails: updatedData } });
148
- // } else {
149
- // history.push("/digit-ui/employee/ekyc/meter-details", {
150
- // ...location.state,
151
- // edits: { ...edits, propertyDetails: updatedData }
152
- // });
153
- // }
154
- // }
155
- // };
156
-
157
- // const handleUpdateAndReturn = () => {
158
- // history.push("/digit-ui/employee/ekyc/review", { ...location.state, edits: { ...edits, propertyDetails: getUpdatedData() } });
159
- // };
160
-
161
- // const ownerOptions = [
162
- // { code: "OWNER", name: "EKYC_OWNER" },
163
- // { code: "TENANT", name: "EKYC_TENANT" },
164
- // ];
165
-
166
- // return (
167
- // <Fragment>
168
- // <FormStep t={t} onSelect={onStepSelect} config={config || {}} label={t(config?.texts?.submitBarLabel) || (isEditing ? t("EKYC_UPDATE_AND_RETURN") : t("ES_COMMON_CONTINUE"))}>
169
- // <CardLabel>{t("EKYC_OWNER_TENANT")}</CardLabel>
170
- // <RadioButtons
171
- // options={ownerOptions}
172
- // optionsKey="name"
173
- // selectedOption={ownerOptions.find(o => o.code === ownerType)}
174
- // onSelect={(val) => setOwnerType(val.code)}
175
- // />
176
-
177
- // <CardLabel>{t("EKYC_PID_NUMBER")}</CardLabel>
178
- // <TextInput
179
- // id="pidNumber"
180
- // name="pidNumber"
181
- // value={pidNumber}
182
- // onChange={(e) => setPidNumber(e.target.value)}
183
- // placeholder={t("EKYC_ENTER_PID_NUMBER")}
184
- // />
185
-
186
- // <CardLabel>{t("EKYC_USER_TYPE")}</CardLabel>
187
- // <Dropdown
188
- // option={userTypeOptions}
189
- // optionKey="label"
190
- // selected={userType}
191
- // select={setUserType}
192
- // t={t}
193
- // />
194
-
195
- // <CardLabel>{t("EKYC_NO_OF_FLOORS")}</CardLabel>
196
- // <Dropdown
197
- // option={floorOptions}
198
- // optionKey="label"
199
- // selected={noOfFloors}
200
- // select={setNoOfFloors}
201
- // t={t}
202
- // />
203
-
204
- // <CardLabel>{t("EKYC_TYPE_OF_CONNECTION")}</CardLabel>
205
- // <Dropdown
206
- // option={connectionTypeOptions}
207
- // optionKey="label"
208
- // selected={typeOfConnection}
209
- // select={setTypeOfConnection}
210
- // t={t}
211
- // />
212
-
213
- // <CardLabel>{t("EKYC_CONNECTION_CATEGORY")}</CardLabel>
214
- // <Dropdown
215
- // option={connectionCategoryOptions}
216
- // optionKey="label"
217
- // selected={connectionCategory}
218
- // select={setConnectionCategory}
219
- // t={t}
220
- // />
221
-
222
- // <CardLabel>{t("EKYC_UPLOAD_PROPERTY_DOC")}</CardLabel>
223
- // <UploadFile
224
- // onUpload={selectpdf}
225
- // onDelete={() => {
226
- // setPropertyDocument(null);
227
- // setPropertyDocumentFileStoreId(null);
228
- // if (onSelect) {
229
- // onSelect(config.key, { ...getUpdatedData(), propertyDocument: null, propertyDocumentFileStoreId: null });
230
- // }
231
- // }}
232
- // message={propertyDocumentFileStoreId ? t("EKYC_FILE_UPLOADED") : t("EKYC_NO_FILE_SELECTED")}
233
- // />
234
-
235
- // {toast && <Toast label={toast.message} error={toast.type === "error"} onClose={() => setToast(null)} />}
236
- // </FormStep>
237
- // {isEditing && !onSelect && (
238
- // <ActionBar style={{ position: "static", marginTop: "20px" }}>
239
- // <SubmitBar label={t("EKYC_UPDATE_AND_RETURN")} onSubmit={handleUpdateAndReturn} />
240
- // </ActionBar>
241
- // )}
242
- // </Fragment>
243
- // );
244
- // };
245
-
246
- // export default PropertyInfo;
247
-
248
-
249
-
250
- import React, { useState, Fragment } from "react";
251
- import {
252
- CardLabel,
253
- TextInput,
254
- Dropdown,
255
- UploadFile,
256
- Toast,
257
- FormStep,
258
- } from "@djb25/digit-ui-react-components";
259
- import { useTranslation } from "react-i18next";
260
-
261
- const PropertyInfo = ({ config, onSelect }) => {
262
- const { t } = useTranslation();
263
- const tenantId = Digit.ULBService.getCurrentTenantId();
264
-
265
- // 🔹 STATES
266
- const [pidNumber, setPidNumber] = useState("");
267
- const [propertyType, setPropertyType] = useState(null);
268
- const [subPropertyCategory, setSubPropertyCategory] = useState(null);
269
-
270
- const [noOfFloors, setNoOfFloors] = useState("");
271
- const [floorNo, setFloorNo] = useState("");
272
-
273
- const [noOfRooms, setNoOfRooms] = useState("");
274
- const [noOfBeds, setNoOfBeds] = useState("");
275
- const [dwellingUnits, setDwellingUnits] = useState("");
276
-
277
- const [buildingImage, setBuildingImage] = useState(null);
278
- const [buildingImageId, setBuildingImageId] = useState(null);
279
-
280
- const [toast, setToast] = useState(null);
281
-
282
- // 🔹 PROPERTY TYPE OPTIONS (you can replace with MDMS)
283
- const propertyTypeOptions = [
284
- { name: "Residential" },
285
- { name: "Commercial" },
286
- { name: "Hotel" },
287
- { name: "Hospital" },
288
- { name: "Nursing Home" },
289
- ];
290
-
291
- // 🔹 FILE UPLOAD
292
- const handleUpload = async (e) => {
293
- const file = e.target.files[0];
294
- if (!file) return;
295
-
296
- if (file.size > 2000000) {
297
- setToast({ type: "error", message: "Max size 2MB exceeded" });
298
- return;
299
- }
300
-
301
- try {
302
- const res = await Digit.UploadServices.Filestorage(
303
- "EKYC",
304
- file,
305
- tenantId
306
- );
307
-
308
- const fileStoreId = res?.data?.files?.[0]?.fileStoreId;
309
-
310
- if (fileStoreId) {
311
- setBuildingImageId(fileStoreId);
312
-
313
- const reader = new FileReader();
314
- reader.onloadend = () => setBuildingImage(reader.result);
315
- reader.readAsDataURL(file);
316
-
317
- setToast({ type: "success", message: "Upload successful" });
318
- }
319
- } catch {
320
- setToast({ type: "error", message: "Upload failed" });
321
- }
322
- };
323
-
324
- // 🔹 VALIDATION
325
- const isValid = () => {
326
- if (!noOfFloors || Number(noOfFloors) < 1) return false;
327
- if (!buildingImageId) return false;
328
-
329
- if (propertyType?.name === "Hotel" && !noOfRooms) return false;
330
- if (
331
- (propertyType?.name === "Hospital" ||
332
- propertyType?.name === "Nursing Home") &&
333
- !noOfBeds
334
- )
335
- return false;
336
-
337
- return true;
338
- };
339
-
340
- // 🔹 SUBMIT
341
- const onStepSelect = () => {
342
- if (!isValid()) {
343
- setToast({ type: "error", message: "Fill all required fields" });
344
- return;
345
- }
346
-
347
- const data = {
348
- pidNumber,
349
- propertyType: propertyType?.name,
350
- subPropertyCategory: subPropertyCategory?.name,
351
- noOfFloors,
352
- floorNo,
353
- noOfRooms,
354
- noOfBeds,
355
- dwellingUnits,
356
- buildingImageId,
357
- };
358
-
359
- onSelect(config.key, data);
360
- };
361
-
362
- return (
363
- <Fragment>
364
- <FormStep
365
- t={t}
366
- onSelect={onStepSelect}
367
- config={config}
368
- label={t("ES_COMMON_CONTINUE")}
369
- >
370
- <div>
371
- <CardLabel>PID Number</CardLabel>
372
- <TextInput value={pidNumber} onChange={(e) => setPidNumber(e.target.value)} />
373
- </div>
374
-
375
- <div>
376
- <CardLabel>Property Type</CardLabel>
377
- <Dropdown
378
- option={propertyTypeOptions}
379
- selected={propertyType}
380
- select={setPropertyType}
381
- />
382
- </div>
383
-
384
- <div>
385
- <CardLabel>Sub Property Category</CardLabel>
386
- <Dropdown option={[]} selected={subPropertyCategory} select={setSubPropertyCategory} />
387
- </div>
388
-
389
- <div>
390
- <CardLabel>No. of Floors *</CardLabel>
391
- <TextInput
392
- type="number"
393
- value={noOfFloors}
394
- onChange={(e) => setNoOfFloors(e.target.value)}
395
- />
396
- </div>
397
-
398
- <div>
399
- <CardLabel>Floor No. of this KNO</CardLabel>
400
- <TextInput value={floorNo} onChange={(e) => setFloorNo(e.target.value)} />
401
- </div>
402
-
403
- <div>
404
- <CardLabel>No of Beds</CardLabel>
405
- <TextInput
406
- type="number"
407
- value={noOfBeds}
408
- onChange={(e) => setNoOfBeds(e.target.value)}
409
- />
410
- </div>
411
-
412
- <div>
413
- <CardLabel>No. of Rooms</CardLabel>
414
- <TextInput
415
- type="number"
416
- value={noOfRooms}
417
- onChange={(e) => setNoOfRooms(e.target.value)}
418
- />
419
- </div>
420
-
421
- {/* HOTEL CONDITION */}
422
- {propertyType?.name === "Hotel" && (
423
- <div>
424
- <CardLabel>No. of Rooms *</CardLabel>
425
- <TextInput
426
- type="number"
427
- value={noOfRooms}
428
- onChange={(e) => setNoOfRooms(e.target.value)}
429
- />
430
- </div>
431
- )}
432
-
433
- {/* HOSPITAL CONDITION */}
434
- {(propertyType?.name === "Hospital" ||
435
- propertyType?.name === "Nursing Home") && (
436
- <div>
437
- <CardLabel>No. of Beds *</CardLabel>
438
- <TextInput
439
- type="number"
440
- value={noOfBeds}
441
- onChange={(e) => setNoOfBeds(e.target.value)}
442
- />
443
- </div>
444
- )}
445
-
446
- <div>
447
- <CardLabel>Number of Dwelling Units</CardLabel>
448
- <TextInput
449
- type="number"
450
- value={dwellingUnits}
451
- onChange={(e) => setDwellingUnits(e.target.value)}
452
- />
453
- </div>
454
-
455
- <div>
456
- <CardLabel>Building Image *</CardLabel>
457
- <UploadFile
458
- onUpload={handleUpload}
459
- onDelete={() => {
460
- setBuildingImage(null);
461
- setBuildingImageId(null);
462
- }}
463
- message={buildingImageId ? "Uploaded" : "No file selected"}
464
- />
465
- </div>
466
-
467
- {buildingImage && (
468
- <div style={{ gridColumn: "span 2" }}>
469
- <img
470
- src={buildingImage}
471
- alt="preview"
472
- style={{ width: "100%", marginTop: "10px" }}
473
- />
474
- </div>
475
- )}
476
-
477
- {toast && (
478
- <Toast
479
- label={toast.message}
480
- error={toast.type === "error"}
481
- onClose={() => setToast(null)}
482
- />
483
- )}
484
- </FormStep>
485
- </Fragment>
486
- );
487
- };
488
-
489
- export default PropertyInfo;