@djb25/digit-ui-module-ekyc 1.0.30 → 1.0.32

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 (63) hide show
  1. package/dist/index.js +8911 -1
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.modern.js +3295 -2039
  4. package/dist/index.modern.js.map +1 -1
  5. package/package.json +4 -1
  6. package/dist/index.css +0 -54
  7. package/src/Module.js +0 -78
  8. package/src/components/AadhaarVerification.js +0 -315
  9. package/src/components/AssignEkyc.js +0 -236
  10. package/src/components/AssignEkycModal.js +0 -446
  11. package/src/components/CeoDashboard.js +0 -264
  12. package/src/components/CeoDashboard.jsx +0 -334
  13. package/src/components/ConnectionDetailsView.js +0 -241
  14. package/src/components/Dashboard.js +0 -43
  15. package/src/components/DesktopInbox.js +0 -176
  16. package/src/components/EKYCCard.js +0 -53
  17. package/src/components/Filter.js +0 -55
  18. package/src/components/MeterDetails.js +0 -336
  19. package/src/components/MobileInbox.js +0 -73
  20. package/src/components/PropertyInfo.js +0 -264
  21. package/src/components/Review.js +0 -696
  22. package/src/components/SearchConsumer.js +0 -142
  23. package/src/components/SearchFormFieldsComponent.js +0 -67
  24. package/src/components/SelectEkycZones.js +0 -71
  25. package/src/components/StatusCards.js +0 -148
  26. package/src/components/SurveyorDetailsCard.js +0 -512
  27. package/src/components/VendorDetails.jsx +0 -230
  28. package/src/components/analytics/charts/ClusterHeatmap.js +0 -88
  29. package/src/components/analytics/charts/ExecutiveBarChart.jsx +0 -30
  30. package/src/components/analytics/charts/ExecutiveLineChart.jsx +0 -159
  31. package/src/components/analytics/charts/ExecutivePieChart.jsx +0 -24
  32. package/src/components/analytics/charts/TaskStatusChart.js +0 -90
  33. package/src/components/analytics/components/AnalyticsTable.js +0 -106
  34. package/src/components/analytics/components/DashboardLayout.js +0 -52
  35. package/src/components/analytics/components/EmptyState.js +0 -27
  36. package/src/components/analytics/components/ErrorBoundary.js +0 -27
  37. package/src/components/analytics/components/FilterBar.js +0 -73
  38. package/src/components/analytics/components/NotificationPanel.js +0 -77
  39. package/src/components/analytics/components/SLAWidget.js +0 -56
  40. package/src/components/analytics/components/SkeletonLoader.js +0 -53
  41. package/src/components/analytics/components/SummaryCard.js +0 -74
  42. package/src/components/analytics/components/WorkflowTimeline.js +0 -55
  43. package/src/components/analytics/utils/exportUtils.js +0 -64
  44. package/src/components/analytics/utils/filterSerializer.js +0 -50
  45. package/src/components/mockData.js +0 -772
  46. package/src/config/AadhaarVerificationConfig.js +0 -367
  47. package/src/config/MeterDetailsConfig.js +0 -297
  48. package/src/config/PropertyInfoConfig.js +0 -145
  49. package/src/config/config.js +0 -70
  50. package/src/hook/SupervisorInboxTableConfig.js +0 -80
  51. package/src/hook/useInboxTableConfig.js +0 -131
  52. package/src/pages/citizen/Home.js +0 -54
  53. package/src/pages/citizen/Inbox.js +0 -265
  54. package/src/pages/citizen/index.js +0 -199
  55. package/src/pages/employee/ConsumerDetails.js +0 -299
  56. package/src/pages/employee/Create.js +0 -94
  57. package/src/pages/employee/EKYCForm.js +0 -118
  58. package/src/pages/employee/Inbox.js +0 -266
  59. package/src/pages/employee/Mapping.js +0 -358
  60. package/src/pages/employee/Update.js +0 -9
  61. package/src/pages/employee/index.js +0 -184
  62. package/src/utils/index.js +0 -46
  63. package/src/utils/reportDownloader.js +0 -90
@@ -1,512 +0,0 @@
1
- import React, { useMemo, useState, useRef, useEffect } from "react";
2
- import { ResponsiveContainer, BarChart, Bar, XAxis, YAxis, Tooltip, CartesianGrid, PieChart, Pie, Cell, Legend } from "recharts";
3
-
4
- import { Card, SubmitBar, ActionBar, Menu, Loader, Table } from "@djb25/digit-ui-react-components";
5
-
6
- import { useTranslation } from "react-i18next";
7
- import { useParams } from "react-router-dom";
8
-
9
- import AssignEkycModal from "./AssignEkycModal";
10
- import { downloadSurveyorPDF } from "../utils/reportDownloader";
11
-
12
- const SurveyorDetailsDashboard = () => {
13
- const tenantId = Digit.ULBService.getCurrentTenantId();
14
-
15
- const [showModal, setShowModal] = useState(false);
16
- const [showOptions, setShowOptions] = useState(false);
17
-
18
- const { id: surveyorId } = useParams();
19
- const ownerIds = Digit.SessionStorage.get("User")?.info?.uuid;
20
-
21
- const { t } = useTranslation();
22
-
23
- const searchParams = surveyorId ? { ids: surveyorId } : { ownerIds };
24
-
25
- const { data: surveyorSearchResponse, isLoading } = Digit.Hooks.fsm.useSurveyorSearch(tenantId, searchParams, { staleTime: Infinity });
26
-
27
- const roles = Digit.SessionStorage.get("User")?.info?.roles.map((ele) => ele.code);
28
-
29
- const surveyor = useMemo(() => {
30
- return surveyorSearchResponse?.surveyors?.[0] || null;
31
- }, [surveyorSearchResponse]);
32
-
33
- const { data: vendorData } = Digit.Hooks.fsm.useDsoSearch(tenantId, { status: "ACTIVE" }, { enabled: !!tenantId });
34
- const { data: supervisorSearchResponse } = Digit.Hooks.fsm.useSupervisorSearch(tenantId, { status: "ACTIVE" }, { enabled: !!tenantId });
35
-
36
- const vendorName = useMemo(() => {
37
- if (!vendorData || !surveyor?.vendorId) return "N/A";
38
- const mappedVendor = vendorData.find((v) => v.dsoDetails?.id === surveyor.vendorId || v.dsoDetails?.vendorId === surveyor.vendorId);
39
- return mappedVendor?.dsoDetails?.name || surveyor.vendorId || "N/A";
40
- }, [vendorData, surveyor?.vendorId]);
41
-
42
- const supervisorName = useMemo(() => {
43
- if (!supervisorSearchResponse?.supervisors || !surveyor?.supervisorId) return "N/A";
44
- const mappedSupervisor = supervisorSearchResponse.supervisors.find((s) => s.id === surveyor.supervisorId || s.owner?.uuid === surveyor.supervisorId);
45
- return mappedSupervisor?.name || mappedSupervisor?.owner?.name || surveyor.supervisorId || "N/A";
46
- }, [supervisorSearchResponse, surveyor?.supervisorId]);
47
-
48
- const fullName = surveyor?.owner?.name || surveyor?.name || "N/A";
49
- const employeeId = surveyor?.employeeId || surveyor?.owner?.uuid || surveyor?.id;
50
- const mobileNumber = surveyor?.owner?.mobileNumber || surveyor?.mobileNo || "N/A";
51
-
52
- const [currentPage, setCurrentPage] = useState(0);
53
- const [pageSize, setPageSize] = useState(20);
54
- const queryParams = {
55
- tenantId: "dl.djb",
56
- offset: currentPage * pageSize,
57
- limit: pageSize,
58
- surveyorId: surveyor?.owner?.uuid,
59
- };
60
-
61
- const { isFetching: isDashboardLoading, data: dashboardData = {}, refetch: refetchDashboard } = Digit.Hooks.ekyc.useEkycSurveyorDashboard(
62
- {},
63
- queryParams,
64
- {
65
- enabled: !!queryParams.tenantId && !!queryParams.surveyorId,
66
- keepPreviousData: true,
67
- }
68
- );
69
-
70
- const knoColumns = useMemo(
71
- () => [
72
- {
73
- Header: "KNO",
74
- accessor: "kno",
75
- },
76
- {
77
- Header: "Consumer Name",
78
- accessor: (row) => `${row.firstName || ""} ${row.middleName || ""} ${row.lastName || ""}`.trim(),
79
- id: "consumerName",
80
- },
81
- {
82
- Header: "Zone",
83
- accessor: "zoneName",
84
- },
85
- {
86
- Header: "Pincode",
87
- accessor: "pincode",
88
- },
89
- {
90
- Header: "Status",
91
- accessor: "status",
92
- Cell: ({ value }) => (
93
- <span className={`status-badge ${value === "ACTIVE" ? "verified" : value === "PENDING" ? "pending" : "assigned"}`}>{value}</span>
94
- ),
95
- },
96
- {
97
- Header: "eKYC Status",
98
- accessor: "ekycStatus",
99
- Cell: ({ value }) => value || "-",
100
- },
101
- ],
102
- []
103
- );
104
-
105
- // ─── Download Report hooks (must be before any early returns) ───────
106
-
107
- const [showReportMenu, setShowReportMenu] = useState(false);
108
- const [customDate, setCustomDate] = useState({ from: "", to: "" });
109
- const [showCustomPicker, setShowCustomPicker] = useState(false);
110
- const reportMenuRef = useRef(null);
111
-
112
- useEffect(() => {
113
- const handler = (e) => {
114
- if (reportMenuRef.current && !reportMenuRef.current.contains(e.target)) {
115
- setShowReportMenu(false);
116
- setShowCustomPicker(false);
117
- }
118
- };
119
- document.addEventListener("mousedown", handler);
120
- return () => document.removeEventListener("mousedown", handler);
121
- }, []);
122
-
123
- if (isLoading) {
124
- return <Loader />;
125
- }
126
-
127
- if (!surveyor) {
128
- return (
129
- <Card>
130
- <div style={{ padding: "24px" }}>{t("NO_SURVEYOR_FOUND")}</div>
131
- </Card>
132
- );
133
- }
134
-
135
- const weeklyData = [
136
- { day: "Mon", completed: 4 },
137
- { day: "Tue", completed: 6 },
138
- { day: "Wed", completed: 3 },
139
- { day: "Thu", completed: 8 },
140
- { day: "Fri", completed: 5 },
141
- { day: "Sat", completed: 7 },
142
- { day: "Sun", completed: 2 },
143
- ];
144
-
145
- const statusData = [
146
- {
147
- name: "Completed",
148
- value: surveyor?.completedCases || 0,
149
- color: "#10B981",
150
- },
151
- {
152
- name: "Pending",
153
- value: surveyor?.pendingCases || 0,
154
- color: "#F59E0B",
155
- },
156
- {
157
- name: "Rejected",
158
- value: surveyor?.rejectedCases || 0,
159
- color: "#EF4444",
160
- },
161
- ];
162
-
163
- const getDateRange = (filter) => {
164
- const now = new Date();
165
- const start = new Date(now);
166
- if (filter === "today") {
167
- start.setHours(0, 0, 0, 0);
168
- return { from: start, to: now };
169
- }
170
- if (filter === "week") {
171
- start.setDate(now.getDate() - now.getDay());
172
- start.setHours(0, 0, 0, 0);
173
- return { from: start, to: now };
174
- }
175
- if (filter === "month") {
176
- start.setDate(1);
177
- start.setHours(0, 0, 0, 0);
178
- return { from: start, to: now };
179
- }
180
- return null;
181
- };
182
-
183
- const handlePresetDownload = (filter) => {
184
- const allRows = dashboardData?.dashboardInfo?.consumerList || [];
185
-
186
- const range = getDateRange(filter);
187
-
188
- if (!range) return;
189
-
190
- const filtered = allRows.filter((r) => {
191
- const ts =
192
- r.submittedAt ||
193
- r.createdTime ||
194
- r.lastModifiedTime ||
195
- 0;
196
-
197
- return ts >= range.from.getTime() && ts <= range.to.getTime();
198
- });
199
-
200
- downloadSurveyorPDF({
201
- rows: filtered.length ? filtered : allRows,
202
- surveyorName: fullName,
203
- vendorName,
204
- supervisorName,
205
- employeeId,
206
- mobileNumber,
207
- dashboardInfo: dashboardData?.dashboardInfo,
208
- t,
209
- });
210
-
211
- setShowReportMenu(false);
212
- setShowCustomPicker(false);
213
- };
214
-
215
- const handleCustomDownload = () => {
216
- if (!customDate.from || !customDate.to) {
217
- alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
218
- return;
219
- }
220
- const from = new Date(customDate.from);
221
- const to = new Date(customDate.to);
222
- to.setHours(23, 59, 59, 999);
223
- const allRows = dashboardData?.dashboardInfo?.consumerList || [];
224
- const filtered = allRows.filter((r) => {
225
- const ts = r.createdTime || r.lastModifiedTime || 0;
226
- return ts >= from.getTime() && ts <= to.getTime();
227
- });
228
- downloadSurveyorPDF({
229
- rows: filtered.length ? filtered : allRows,
230
- surveyorName: fullName,
231
- vendorName,
232
- supervisorName,
233
- employeeId,
234
- mobileNumber,
235
- dashboardInfo: dashboardData?.dashboardInfo,
236
- t,
237
- });
238
- setShowReportMenu(false);
239
- setShowCustomPicker(false);
240
- };
241
-
242
- const StatCard = ({ title, value, type, isLoading }) => (
243
- <div className={`stat-card ${type}`}>
244
- {isLoading ? (
245
- <React.Fragment>
246
- <div className="stat-title skeleton skeleton-text"></div>
247
- <div className="stat-value skeleton skeleton-number"></div>
248
- </React.Fragment>
249
- ) : (
250
- <React.Fragment>
251
- <div className="stat-title">{title}</div>
252
- <div className="stat-value">{value}</div>
253
- </React.Fragment>
254
- )}
255
- </div>
256
- );
257
-
258
- const options = [{ action: "Assign" }];
259
-
260
- const handleMenuSelect = (option) => {
261
- setShowOptions(false); // close menu
262
- setShowModal(true);
263
- };
264
-
265
- const closeModal = async () => {
266
- setShowModal(false);
267
- };
268
-
269
- return (
270
- <Card className="surveyor-dashboard">
271
- {/* Header + Download Report */}
272
- <div className="ekyc-dashboard-section">
273
- <div className="ekyc-dashboard-header">
274
- <div className="avatar">{fullName?.charAt(0)?.toUpperCase()}</div>
275
-
276
- <div className="header-content">
277
- <h2 className="name">{fullName}</h2>
278
-
279
- <div className="designation">{surveyor?.description || t("FIELD_SURVEYOR")}</div>
280
-
281
- {/* <div className="employee-id">
282
- {t("EMPLOYEE_ID")}: {employeeId}
283
- </div> */}
284
-
285
- </div>
286
- </div>
287
-
288
- {/* Download Report — far right */}
289
- <div className="report-download" ref={reportMenuRef}>
290
- <button
291
- className="download-btn"
292
- onClick={() => {
293
- setShowReportMenu((p) => !p);
294
- setShowCustomPicker(false);
295
- }}
296
- >
297
- {t("DOWNLOAD_REPORT") || "Download Report"}
298
- </button>
299
-
300
- {showReportMenu && (
301
- <div className="report-menu">
302
- {[
303
- { label: t("TODAY") || "Today", key: "today" },
304
- { label: t("THIS_WEEK") || "This Week", key: "week" },
305
- { label: t("THIS_MONTH") || "This Month", key: "month" },
306
- ].map(({ label, key }) => (
307
- <div
308
- key={key}
309
- className="menu-item"
310
- onClick={() => handlePresetDownload(key)}
311
- >
312
- {label}
313
- </div>
314
- ))}
315
-
316
- <div
317
- className="custom-date-trigger"
318
- onClick={() => setShowCustomPicker((p) => !p)}
319
- >
320
- {t("CUSTOM_DATE") || "Custom Date"}
321
- </div>
322
-
323
- {showCustomPicker && (
324
- <div className="custom-picker">
325
- <div className="date-field">
326
- <label className="date-label">
327
- {t("FROM_DATE") || "From"}
328
- </label>
329
- <input
330
- type="date"
331
- className="date-input"
332
- value={customDate.from}
333
- onChange={(e) =>
334
- setCustomDate((d) => ({ ...d, from: e.target.value }))
335
- }
336
- />
337
- </div>
338
-
339
- <div className="date-field">
340
- <label className="date-label">
341
- {t("TO_DATE") || "To"}
342
- </label>
343
- <input
344
- type="date"
345
- className="date-input"
346
- value={customDate.to}
347
- onChange={(e) =>
348
- setCustomDate((d) => ({ ...d, to: e.target.value }))
349
- }
350
- />
351
- </div>
352
-
353
- <button
354
- className="download-action-btn"
355
- onClick={handleCustomDownload}
356
- >
357
- {t("DOWNLOAD") || "Download"}
358
- </button>
359
- </div>
360
- )}
361
- </div>
362
- )}
363
- </div>
364
- </div>
365
-
366
- {/* Stats */}
367
- <div className="stats-wrapper">
368
- <StatCard title={t("TOTAL_ASSIGNED")} value={dashboardData?.dashboardInfo?.total || 0} type="today" isLoading={isDashboardLoading} />
369
- <StatCard title={t("COMPLETED")} value={dashboardData?.dashboardInfo?.completed || 0} type="week" isLoading={isDashboardLoading} />
370
- <StatCard title={t("PENDING")} value={dashboardData?.dashboardInfo?.pending || 0} type="pending" isLoading={isDashboardLoading} />
371
- <StatCard title={t("SUBMITTED")} value={dashboardData?.dashboardInfo?.submittedCount || 0} type="month" isLoading={isDashboardLoading} />
372
- </div>
373
-
374
- {/* Charts */}
375
- <div className="charts-wrapper">
376
- {/* Weekly Chart */}
377
- {/* <div className="chart-card">
378
- <h3 className="chart-title">{t("WEEKLY_SURVEY_PROGRESS")}</h3>
379
-
380
- <ResponsiveContainer width="100%" height={300}>
381
- <BarChart data={weeklyData}>
382
- <CartesianGrid strokeDasharray="3 3" />
383
-
384
- <XAxis dataKey="day" />
385
-
386
- <YAxis />
387
-
388
- <Tooltip />
389
-
390
- <Bar dataKey="completed" fill="#0B2559" radius={[6, 6, 0, 0]} />
391
- </BarChart>
392
- </ResponsiveContainer>
393
- </div> */}
394
-
395
- {/* Pie Chart */}
396
- {/* <div className="chart-card">
397
- <h3 className="chart-title">{t("CASE_DISTRIBUTION")}</h3>
398
-
399
- <ResponsiveContainer width="100%" height={300}>
400
- <PieChart>
401
- <Pie data={statusData} dataKey="value" nameKey="name" outerRadius={90} label>
402
- {statusData.map((entry, index) => (
403
- <Cell key={index} fill={entry.color} />
404
- ))}
405
- </Pie>
406
-
407
- <Tooltip />
408
-
409
- <Legend />
410
- </PieChart>
411
- </ResponsiveContainer>
412
- </div> */}
413
- </div>
414
-
415
- {/* Details */}
416
- <div className="ekyc-dashboard-section">
417
- <div className="details-grid">
418
- <div className="detail-item">
419
- <span className="label">{t("MOBILE")}:</span>
420
- <span className="value">{surveyor?.owner?.mobileNumber || surveyor?.mobileNo || "N/A"}</span>
421
- </div>
422
-
423
- <div className="detail-item">
424
- <span className="label">{t("EMAIL")}:</span>
425
- <span className="value">{surveyor?.owner?.emailId || "N/A"}</span>
426
- </div>
427
-
428
- <div className="detail-item">
429
- <span className="label">{t("GENDER")}:</span>
430
- <span className="value">{surveyor?.owner?.gender || "N/A"}</span>
431
- </div>
432
-
433
- <div className="detail-item">
434
- <span className="label">{t("STATUS")}:</span>
435
- <span className="value">{surveyor?.status || "N/A"}</span>
436
- </div>
437
-
438
- <div className="detail-item">
439
- <span className="label">{t("SERVICE_TYPE")}:</span>
440
- <span className="value">{surveyor?.additionalDetails?.serviceType || "N/A"}</span>
441
- </div>
442
-
443
- <div className="detail-item">
444
- <span className="label">{t("VENDOR_NAME") || "Vendor Name"}:</span>
445
- <span className="value">{vendorName}</span>
446
- </div>
447
- </div>
448
- </div>
449
- <Card className="dashboard-card">
450
- <Table
451
- t={t}
452
- tableTitle={t("ASSIGNED_KNOS")}
453
- tableClass="ekycTable"
454
- data={dashboardData?.dashboardInfo?.consumerList || []}
455
- columns={knoColumns}
456
- isLoading={isDashboardLoading}
457
- totalRecords={dashboardData?.dashboardInfo?.total}
458
- currentPage={currentPage}
459
- pageSizeLimit={pageSize}
460
- isPaginationRequired={true}
461
- onNextPage={() => {
462
- if (currentPage < (dashboardData?.dashboardInfo?.totalPages || 1) - 1) {
463
- setCurrentPage((prev) => prev + 1);
464
- }
465
- }}
466
- onPrevPage={() => {
467
- if (currentPage > 0) {
468
- setCurrentPage((prev) => prev - 1);
469
- }
470
- }}
471
- onFirstPage={() => {
472
- setCurrentPage(0);
473
- }}
474
- onLastPage={() => {
475
- setCurrentPage(Math.max((dashboardData?.dashboardInfo?.totalPages || 1) - 1, 0));
476
- }}
477
- onPageSizeChange={(e) => {
478
- setPageSize(Number(e.target.value));
479
- setCurrentPage(0);
480
- }}
481
- />
482
- </Card>
483
- {/* Actions */}
484
- {
485
- (!roles.includes("EKYC_SURVEYOR") || roles.includes("EMPLOYEE")) && (
486
- <ActionBar>
487
- <SubmitBar label={t("EKYC_ASSIGN_KNOS")} onSubmit={() => setShowOptions((prev) => !prev)} />
488
-
489
- {showOptions && (
490
- <Menu
491
- options={options}
492
- optionKey={"action"}
493
- t={t}
494
- onSelect={handleMenuSelect}
495
- style={{
496
- color: "#FFFFFF",
497
- fontSize: "18px",
498
- }}
499
- />
500
- )}
501
- </ActionBar>
502
-
503
- )
504
- }
505
-
506
- {showModal && <AssignEkycModal surveyor={surveyor} closeModal={closeModal} refetchDashboard={refetchDashboard} />}
507
- </Card>
508
-
509
- );
510
- };
511
-
512
- export default SurveyorDetailsDashboard;