@djb25/digit-ui-module-ekyc 1.0.43 → 1.0.45

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.
@@ -1,18 +1,20 @@
1
- import React, { useRef, useEffect, useMemo, useState, createContext, useContext, isValidElement, cloneElement, createElement, useCallback, useReducer, Fragment } from 'react';
1
+ import React, { useState, useRef, useEffect, useMemo, createContext, useContext, isValidElement, cloneElement, createElement, useCallback, useReducer, Fragment } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { useHistory, Link, useLocation, useParams, useRouteMatch, Switch, Route, Redirect } from 'react-router-dom';
4
- import { PersonIcon, EmployeeModuleCard, Loader, Card, InboxLinks, Table, HomeIcon, TextInput, Header, SubmitBar, DetailsCard, FilterForm, FilterFormField, Dropdown, Label, CustomTooltip, CardLabelError, SearchField, RadioButtons, InboxComposer, EditIcon, DeleteIcon, CardHeader, CardText, LabelFieldPair, CardLabel, ActionBar, Modal, Toast, CardSubHeader, StatusTable, Row, GenericFileIcon, CheckBox, Menu, LinkButton, UploadFile, FormComposer, VerticalTimeline, Close, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, LayoutWrapper, CitizenHomeCard, DocumentIcon, BackButton } from '@djb25/digit-ui-react-components';
4
+ import { PersonIcon, EmployeeModuleCard, Loader, Card, InboxLinks, Table, HomeIcon, TextInput, Header, SubmitBar, DetailsCard, FilterForm, FilterFormField, Dropdown, Label, CustomTooltip, CardLabelError, SearchField, RadioButtons, InboxComposer, EditIcon, DeleteIcon, CardHeader, CardText, LabelFieldPair, CardLabel, ActionBar, Modal, Toast, CardSubHeader, StatusTable, Row, GenericFileIcon, CheckBox, Menu, LinkButton, UploadFile, FormComposer, VerticalTimeline, Close, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, LayoutWrapper, CitizenHomeCard, DocumentIcon } from '@djb25/digit-ui-react-components';
5
5
  import * as Chartjs from 'chart.js/auto';
6
6
  import Chartjs__default, { Chart } from 'chart.js/auto';
7
+ import 'three/tsl';
7
8
  import { FaUsers, FaCheckCircle, FaClock, FaExclamationTriangle, FaUserTie, FaChartLine, FaSearch, FaArrowRight, FaMapMarkedAlt } from 'react-icons/fa';
8
9
  import { ResponsiveContainer, LineChart, CartesianGrid, XAxis, YAxis, Tooltip, Legend, Line, BarChart, Bar, PieChart, Pie, Cell } from 'recharts';
9
10
 
10
11
  const EKYCCard = () => {
11
- var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3;
12
+ var _Digit$SessionStorage, _Digit$SessionStorage2;
12
13
  const _useTranslation = useTranslation(),
13
14
  t = _useTranslation.t;
14
15
  const tenantId = Digit.ULBService.getCurrentTenantId();
15
- const roles = ((_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : (_Digit$SessionStorage2 = _Digit$SessionStorage.info) === null || _Digit$SessionStorage2 === void 0 ? void 0 : (_Digit$SessionStorage3 = _Digit$SessionStorage2.roles) === null || _Digit$SessionStorage3 === void 0 ? void 0 : _Digit$SessionStorage3.map(r => r.code)) || [];
16
+ const citizenInfo = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : (_Digit$SessionStorage2 = _Digit$SessionStorage.info) === null || _Digit$SessionStorage2 === void 0 ? void 0 : _Digit$SessionStorage2.roles;
17
+ const roles = Array.isArray(citizenInfo) ? citizenInfo.map(ele => ele.code || ele) : [];
16
18
  const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycApplicationList({}, {
17
19
  tenantId,
18
20
  offset: 0,
@@ -23,50 +25,235 @@ const EKYCCard = () => {
23
25
  listData = _Digit$Hooks$ekyc$use.data,
24
26
  isLoading = _Digit$Hooks$ekyc$use.isLoading;
25
27
  const totalCount = isLoading ? "-" : (listData === null || listData === void 0 ? void 0 : listData.totalCount) || 0;
26
- const propsForModuleCard = {
27
- Icon: /*#__PURE__*/React.createElement(PersonIcon, null),
28
- moduleName: t("ACTION_TEST_EKYC"),
29
- kpis: [{
30
- count: totalCount,
31
- label: t("TOTAL_EKYC"),
32
- link: "/digit-ui/employee/ekyc/admin-dashboard"
33
- }],
34
- links: [{
28
+ const isCitizen = window.location.pathname.includes("/citizen");
29
+ const prefix = isCitizen ? "/digit-ui/citizen/ekyc" : "/digit-ui/employee/ekyc";
30
+ let links = [];
31
+ if (isCitizen) {
32
+ if (roles.includes("EKYC_SURVEYOR")) {
33
+ links.push({
34
+ label: t("SURVEYOR_DASHBOARD"),
35
+ link: prefix + "/surveyor-dashboard"
36
+ });
37
+ }
38
+ if (roles.includes("EKYC_SUPERVISOR") || roles.includes("EKYC_VENDOR")) {
39
+ links.push({
40
+ count: totalCount,
41
+ label: t("EKYC_INBOX"),
42
+ link: prefix + "/inbox"
43
+ });
44
+ }
45
+ if (roles.includes("EKYC_SUPERVISOR")) {
46
+ links.push({
47
+ label: t("EKYC_SUPERVISOR_DASHBOARD"),
48
+ link: prefix + "/supervisor-dashboard"
49
+ }, {
50
+ label: t("EKYC_ASSIGN"),
51
+ link: prefix + "/assign"
52
+ });
53
+ }
54
+ if (roles.includes("EKYC_VENDOR")) {
55
+ links.push({
56
+ label: t("EKYC_VENDOR_DASHBOARD"),
57
+ link: prefix + "/vendor-dashboard"
58
+ });
59
+ }
60
+ if (roles.includes("EKYC_SUPERVISOR") || roles.includes("EKYC_VENDOR")) {
61
+ links.push({
62
+ label: t("TITLE_VENDOR_MANAGEMENT"),
63
+ link: "/digit-ui/citizen/vendor/search-vendor"
64
+ });
65
+ }
66
+ if (links.length === 0 || roles.length === 1 && roles.includes("CITIZEN")) {
67
+ links.push({
68
+ label: t("EKYC_STATUS"),
69
+ link: prefix + "/:id"
70
+ });
71
+ }
72
+ } else {
73
+ links = [{
35
74
  label: t("CEO_M.F_DOR_FINANCE_VIEW"),
36
- link: "/digit-ui/employee/ekyc/ceo-dashboard"
75
+ link: prefix + "/ceo-dashboard"
37
76
  }, {
38
77
  label: t("EKYC_ADMIN_DASHBOARD") || "Admin Dashboard",
39
- link: "/digit-ui/employee/ekyc/admin-dashboard"
78
+ link: prefix + "/admin-dashboard"
40
79
  }, {
41
80
  count: totalCount,
42
81
  label: t("EKYC_INBOX"),
43
- link: "/digit-ui/employee/ekyc/inbox"
82
+ link: prefix + "/inbox"
44
83
  }, ...(!roles.includes("EMPLOYEE") ? [{
45
84
  label: t("EKYC_ASSIGN"),
46
- link: "/digit-ui/employee/ekyc/assign"
47
- }] : [])]
85
+ link: prefix + "/assign"
86
+ }] : [])];
87
+ }
88
+ const propsForModuleCard = {
89
+ Icon: /*#__PURE__*/React.createElement(PersonIcon, null),
90
+ moduleName: t("ACTION_TEST_EKYC"),
91
+ kpis: isCitizen ? [] : [{
92
+ count: totalCount,
93
+ label: t("TOTAL_EKYC"),
94
+ link: prefix + "/admin-dashboard"
95
+ }],
96
+ links: links
48
97
  };
49
98
  return /*#__PURE__*/React.createElement(EmployeeModuleCard, propsForModuleCard);
50
99
  };
51
100
 
101
+ const _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator")) : "@@iterator";
102
+ const _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
103
+ function _catch(body, recover) {
104
+ try {
105
+ var result = body();
106
+ } catch (e) {
107
+ return recover(e);
108
+ }
109
+ if (result && result.then) {
110
+ return result.then(void 0, recover);
111
+ }
112
+ return result;
113
+ }
114
+ function _finallyRethrows(body, finalizer) {
115
+ try {
116
+ var result = body();
117
+ } catch (e) {
118
+ return finalizer(true, e);
119
+ }
120
+ if (result && result.then) {
121
+ return result.then(finalizer.bind(null, false), finalizer.bind(null, true));
122
+ }
123
+ return finalizer(false, result);
124
+ }
125
+
52
126
  const getChartConstructor = () => {
53
127
  const C = Chart || Chartjs__default || Chartjs;
54
128
  return C;
55
129
  };
56
130
  const StatusCards = _ref => {
131
+ var _Digit$SessionStorage;
57
132
  let countData = _ref.countData;
58
133
  const _useTranslation = useTranslation(),
59
134
  t = _useTranslation.t;
135
+ const _useState = useState(false),
136
+ ekycDownloadLoading = _useState[0],
137
+ setEkycDownloadLoading = _useState[1];
138
+ let tenantId = Digit.ULBService.getCurrentTenantId();
139
+ if (!tenantId || tenantId === "dl") {
140
+ tenantId = "dl.djb";
141
+ }
142
+ const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
143
+ const fullName = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.name) || "Admin";
144
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycSurveyorDashboard({}, {
145
+ tenantId,
146
+ offset: 0,
147
+ limit: 10,
148
+ ekycStatus: "submitted"
149
+ }, {
150
+ enabled: !!tenantId
151
+ }),
152
+ dashboardData = _Digit$Hooks$ekyc$use.data;
153
+ const apiCountData = React.useMemo(() => {
154
+ const info = (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo) || {};
155
+ return {
156
+ total: info.total || 0,
157
+ completed: info.completed || 0,
158
+ pending: info.pending || 0,
159
+ submittedCount: info.submittedCount || 0,
160
+ inProgressCount: info.inProgressCount || 0,
161
+ rejected: info.rejected || 0,
162
+ active: info.active || 0
163
+ };
164
+ }, [dashboardData]);
165
+ const handleDownloadEkycData = function () {
166
+ try {
167
+ setEkycDownloadLoading(true);
168
+ return Promise.resolve(_finallyRethrows(function () {
169
+ return _catch(function () {
170
+ return Promise.resolve(Digit.EkycService.application_list({
171
+ tenantId: tenantId,
172
+ offset: 0,
173
+ limit: 10000,
174
+ reportDownload: true
175
+ })).then(function (response) {
176
+ const consumerList = (response === null || response === void 0 ? void 0 : response.consumerList) || [];
177
+ if (consumerList.length === 0) {
178
+ alert(t("NO_DATA_FOUND") || "No data found for download.");
179
+ return;
180
+ }
181
+ const excludedKeys = ["status", "source", "submittedAt", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "assignedTime", "isSelfAssigned", "userType", "tenantName", "tenantMobile"];
182
+ const headerMapping = {
183
+ kno: t("KNO") || "KNO",
184
+ firstName: t("FIRST_NAME") || "First Name",
185
+ middleName: t("MIDDLE_NAME") || "Middle Name",
186
+ lastName: t("LAST_NAME") || "Last Name",
187
+ gender: t("GENDER") || "Gender",
188
+ mobileNumber: t("MOBILE_NUMBER") || "Mobile Number",
189
+ emailId: t("EMAIL_ID") || "Email ID",
190
+ fatherOrHusbandName: t("FATHER_HUSBUND_NAME") || "Father/Husband Name",
191
+ relationship: t("RELATIONSHIP") || "Relationship",
192
+ dob: t("DOB") || "Date of Birth",
193
+ ekycStatus: t("EKYC_STATUS") || "eKYC Status",
194
+ zoneName: t("ZONE") || "Zone",
195
+ assembly: t("ASSEMBLY") || "Assembly",
196
+ ward: t("WARD") || "Ward",
197
+ pincode: t("PINCODE") || "Pincode",
198
+ mrkey: t("MR_KEY") || "MR Key",
199
+ consumerType: t("CONSUMER_TYPE") || "Consumer Type",
200
+ createdTime: t("CREATED_TIME") || "Created Time",
201
+ lastModifiedTime: t("LAST_MODIFIED_TIME") || "Last Modified Time"
202
+ };
203
+ const toTitleCase = str => {
204
+ if (!str) return "";
205
+ const cleanStr = String(str).includes(".") ? String(str).split(".").pop() : String(str);
206
+ return cleanStr.toLowerCase().replace(/_/g, " ").replace(/\b\w/g, c => c.toUpperCase());
207
+ };
208
+ const skipTitleCase = ["kno", "mobileNumber", "emailId", "pincode", "mrkey", "dob", "createdTime", "lastModifiedTime"];
209
+ const excelData = consumerList.map(item => {
210
+ const cleanObj = {};
211
+ const name = [item.firstName, item.middleName, item.lastName].filter(Boolean).join(" ");
212
+ if (name) {
213
+ cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = toTitleCase(name);
214
+ }
215
+ Object.keys(item).forEach(key => {
216
+ if (excludedKeys.includes(key)) return;
217
+ const val = item[key];
218
+ if (typeof val === "object" && val !== null) {
219
+ return;
220
+ }
221
+ const friendlyHeader = headerMapping[key] || t(key.toUpperCase()) || key;
222
+ if (typeof val === "string" && !skipTitleCase.includes(key)) {
223
+ cleanObj[friendlyHeader] = toTitleCase(val);
224
+ } else {
225
+ cleanObj[friendlyHeader] = val;
226
+ }
227
+ });
228
+ return cleanObj;
229
+ });
230
+ const cleanFileName = "eKYC_All_Data_Admin_" + fullName.replace(/[^a-zA-Z0-9]/g, "_");
231
+ Digit.Download.Excel(excelData, cleanFileName);
232
+ });
233
+ }, function (error) {
234
+ console.error("Error downloading eKYC Excel:", error);
235
+ });
236
+ }, function (_wasThrown, _result) {
237
+ setEkycDownloadLoading(false);
238
+ if (_wasThrown) throw _result;
239
+ return _result;
240
+ }));
241
+ } catch (e) {
242
+ return Promise.reject(e);
243
+ }
244
+ };
60
245
  const chartRef1 = useRef(null);
61
246
  const chartInstance1 = useRef(null);
62
- const total = (countData === null || countData === void 0 ? void 0 : countData.total) || 0;
63
- const pending = (countData === null || countData === void 0 ? void 0 : countData.pending) || 0;
64
- const active = (countData === null || countData === void 0 ? void 0 : countData.completed) || 0;
65
- const completed = 0;
66
- const actualCompleted = (countData === null || countData === void 0 ? void 0 : countData.completed) || 0;
247
+ const total = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.total) || (countData === null || countData === void 0 ? void 0 : countData.total) || (countData === null || countData === void 0 ? void 0 : countData.totalCount) || 0;
248
+ const pending = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.pending) || (countData === null || countData === void 0 ? void 0 : countData.pending) || 0;
249
+ const active = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.active) || (countData === null || countData === void 0 ? void 0 : countData.active) || 0;
250
+ const completed = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.completed) || (countData === null || countData === void 0 ? void 0 : countData.completed) || 0;
251
+ const inprocess = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.inProgressCount) || (countData === null || countData === void 0 ? void 0 : countData.inProgressCount) || 0;
252
+ const submitted = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.submittedCount) || (countData === null || countData === void 0 ? void 0 : countData.submittedCount) || 0;
253
+ const actualCompleted = completed;
67
254
  const approved = actualCompleted;
68
- const efficiency = total > 0 ? Math.round(actualCompleted / total * 100) : 0;
69
- const healthPct = total > 0 ? Math.round(approved / total * 100) : 0;
255
+ const efficiency = total > 0 ? Math.round((submitted + completed) / total * 100) : 0;
256
+ const healthPct = submitted > 0 ? Math.round(approved / submitted * 100) : 0;
70
257
  const formatNumber = num => new Intl.NumberFormat("en-IN").format(num || 0);
71
258
  useEffect(() => {
72
259
  if (chartRef1.current) {
@@ -76,11 +263,11 @@ const StatusCards = _ref => {
76
263
  chartInstance1.current = new ChartConstructor(ctx1, {
77
264
  type: "doughnut",
78
265
  data: {
79
- labels: [t("EKYC_ACTIVE"), t("EKYC_PENDING"), t("EKYC_COMPLETED")],
266
+ labels: [t("EKYC_PENDING"), t("EKYC_COMPLETED"), t("EKYC_SUBMITTED"), t("EKYC_INPROCESS")],
80
267
  datasets: [{
81
- data: [active, pending, completed],
82
- backgroundColor: ["#0c2a52", "#77B6EA", "#c8ddf5"],
83
- borderColor: ["#ffffff", "#ffffff", "#ffffff"],
268
+ data: [pending, completed, submitted, inprocess],
269
+ backgroundColor: ["#0c2a52", "#77B6EA", "#c8ddf5", "#49a3fb"],
270
+ borderColor: ["#ffffff", "#ffffff", "#ffffff", "#ffffff"],
84
271
  borderWidth: 2,
85
272
  hoverOffset: 4
86
273
  }]
@@ -102,17 +289,21 @@ const StatusCards = _ref => {
102
289
  };
103
290
  }, [pending, completed, active, t]);
104
291
  const legendItems = [{
105
- color: "#0c2a52",
106
- label: t("EKYC_ACTIVE"),
107
- value: active
108
- }, {
109
292
  color: "#77B6EA",
293
+ label: t("EKYC_COMPLETED"),
294
+ value: completed
295
+ }, {
296
+ color: "#0c2a52",
110
297
  label: t("EKYC_PENDING"),
111
298
  value: pending
112
299
  }, {
113
300
  color: "#c8ddf5",
114
- label: t("EKYC_COMPLETED"),
115
- value: completed
301
+ label: t("EKYC_SUBMITTED"),
302
+ value: submitted
303
+ }, {
304
+ color: "#49a3fb",
305
+ label: t("EKYC_INPROCESS"),
306
+ value: inprocess
116
307
  }];
117
308
  return /*#__PURE__*/React.createElement("div", {
118
309
  className: "ekyc-employee-container"
@@ -134,9 +325,29 @@ const StatusCards = _ref => {
134
325
  className: "total-label"
135
326
  }, t("EKYC_TOTAL_APPLICATIONS") || "Total Applications Processed"), /*#__PURE__*/React.createElement("div", {
136
327
  className: "total-number"
137
- }, formatNumber(total)), /*#__PURE__*/React.createElement("div", {
138
- className: "total-badge"
139
- }, "\u2197 +12.4% ", t("EKYC_FROM_LAST_QUARTER") || "from last quarter"))), /*#__PURE__*/React.createElement("div", {
328
+ }, formatNumber(total)), /*#__PURE__*/React.createElement("button", {
329
+ className: "download-excel-btn",
330
+ disabled: ekycDownloadLoading,
331
+ onClick: handleDownloadEkycData
332
+ }, /*#__PURE__*/React.createElement("svg", {
333
+ width: "16",
334
+ height: "16",
335
+ viewBox: "0 0 24 24",
336
+ fill: "none",
337
+ stroke: "currentColor",
338
+ strokeWidth: "2.5",
339
+ strokeLinecap: "round",
340
+ strokeLinejoin: "round"
341
+ }, /*#__PURE__*/React.createElement("path", {
342
+ d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
343
+ }), /*#__PURE__*/React.createElement("polyline", {
344
+ points: "7 10 12 15 17 10"
345
+ }), /*#__PURE__*/React.createElement("line", {
346
+ x1: "12",
347
+ y1: "15",
348
+ x2: "12",
349
+ y2: "3"
350
+ })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel"))), /*#__PURE__*/React.createElement("div", {
140
351
  className: "status-panels-grid"
141
352
  }, /*#__PURE__*/React.createElement("div", {
142
353
  className: "status-panel"
@@ -178,17 +389,13 @@ const StatusCards = _ref => {
178
389
  className: "status-panel"
179
390
  }, /*#__PURE__*/React.createElement("div", {
180
391
  className: "panel-title"
181
- }, t("EKYC_SUBMISSION_HEALTH") || "Submission Health", /*#__PURE__*/React.createElement("span", {
182
- className: "optimal-badge"
183
- }, t("EKYC_OPTIMAL") || "Optimal")), /*#__PURE__*/React.createElement("div", {
392
+ }, t("EKYC_SUBMISSION_HEALTH") || "Submission Health"), /*#__PURE__*/React.createElement("div", {
184
393
  className: "panel-subtitle"
185
394
  }, t("EKYC_PLATFORM_EFFICIENCY") || "Platform operational efficiency"), /*#__PURE__*/React.createElement("div", {
186
395
  className: "health-metrics-row"
187
396
  }, /*#__PURE__*/React.createElement("div", {
188
397
  className: "health-percentage"
189
- }, healthPct, "%"), /*#__PURE__*/React.createElement("div", {
190
- className: "health-trend"
191
- }, "\u2197 +2.1%")), /*#__PURE__*/React.createElement("div", {
398
+ }, healthPct, "%")), /*#__PURE__*/React.createElement("div", {
192
399
  className: "status-progress-bar"
193
400
  }, /*#__PURE__*/React.createElement("div", {
194
401
  className: "progress-fill",
@@ -203,13 +410,13 @@ const StatusCards = _ref => {
203
410
  className: "metric-label"
204
411
  }, t("EKYC_AVG_LATENCY") || "Avg Latency"), /*#__PURE__*/React.createElement("div", {
205
412
  className: "metric-value"
206
- }, "1.2s")), /*#__PURE__*/React.createElement("div", {
413
+ }, "0s")), /*#__PURE__*/React.createElement("div", {
207
414
  className: "metric-box"
208
415
  }, /*#__PURE__*/React.createElement("div", {
209
416
  className: "metric-label"
210
417
  }, t("EKYC_ERROR_RATE") || "Error Rate"), /*#__PURE__*/React.createElement("div", {
211
418
  className: "metric-value"
212
- }, "0.04%")))))));
419
+ }, "0.0%")))))));
213
420
  };
214
421
 
215
422
  const Dashboard = () => {
@@ -279,6 +486,10 @@ const DesktopInbox = _ref => {
279
486
  countData = props.countData;
280
487
  const _useTranslation = useTranslation(),
281
488
  t = _useTranslation.t;
489
+ const toTitleCase = str => {
490
+ if (!str) return "";
491
+ return String(str).toLowerCase().replace(/_/g, " ").replace(/\b\w/g, c => c.toUpperCase());
492
+ };
282
493
  const history = useHistory();
283
494
  const tenantId = Digit.ULBService.getCurrentTenantId();
284
495
  const FilterComponent = (_Digit$ComponentRegis = Digit.ComponentRegistryService) === null || _Digit$ComponentRegis === void 0 ? void 0 : _Digit$ComponentRegis.getComponent(filterComponent);
@@ -321,37 +532,38 @@ const DesktopInbox = _ref => {
321
532
  Cell: _ref3 => {
322
533
  var _row$original3;
323
534
  let row = _ref3.row;
324
- return /*#__PURE__*/React.createElement("span", null, ((_row$original3 = row.original) === null || _row$original3 === void 0 ? void 0 : _row$original3.citizenName) || "NA");
535
+ return /*#__PURE__*/React.createElement("span", null, toTitleCase((_row$original3 = row.original) === null || _row$original3 === void 0 ? void 0 : _row$original3.citizenName) || "NA");
325
536
  }
326
537
  }, {
327
538
  Header: t("EKYC_STATUS"),
328
539
  accessor: "actionStatus",
329
540
  Cell: _ref4 => {
330
- var _row$original4;
541
+ var _row$original4, _row$original5;
331
542
  let row = _ref4.row;
332
543
  const status = (((_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : _row$original4.status) || "DEFAULT").toUpperCase();
333
544
  return /*#__PURE__*/React.createElement("span", {
334
545
  className: "ekyc-status-tag " + status
335
- }, t("" + status));
546
+ }, toTitleCase(((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : _row$original5.status) || "DEFAULT"));
336
547
  }
337
548
  }, {
338
549
  Header: t("EKYC_EKYC_STATUS"),
339
550
  accessor: "ekycStatus",
340
551
  Cell: _ref5 => {
341
- var _row$original5, _row$original6;
552
+ var _row$original6, _row$original7;
342
553
  let row = _ref5.row;
343
- const ekycStatus = (((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : _row$original5.ekycStatus) || ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.ekycstatus) || "NA").toUpperCase();
554
+ const raw = ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.ekycStatus) || ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.ekycstatus) || "NA";
555
+ const ekycStatus = raw.toUpperCase();
344
556
  return /*#__PURE__*/React.createElement("span", {
345
557
  className: "ekyc-status-tag " + ekycStatus
346
- }, t("" + ekycStatus));
558
+ }, toTitleCase(raw));
347
559
  }
348
560
  }, {
349
561
  Header: t("EKYC_ACTION"),
350
562
  accessor: "status",
351
563
  Cell: _ref6 => {
352
- var _row$original7, _row$original8;
564
+ var _row$original8, _row$original9;
353
565
  let row = _ref6.row;
354
- const kno = ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.kno) || ((_row$original8 = row.original) === null || _row$original8 === void 0 ? void 0 : _row$original8.applicationNumber) || "NA";
566
+ const kno = ((_row$original8 = row.original) === null || _row$original8 === void 0 ? void 0 : _row$original8.kno) || ((_row$original9 = row.original) === null || _row$original9 === void 0 ? void 0 : _row$original9.applicationNumber) || "NA";
355
567
  return /*#__PURE__*/React.createElement("span", {
356
568
  className: "link",
357
569
  onClick: () => handleReview(kno)
@@ -1590,31 +1802,6 @@ const CeoDashboard = () => {
1590
1802
  }, /*#__PURE__*/React.createElement("h3", null, topKpis.successRate, "%"), /*#__PURE__*/React.createElement("p", null, "Operational Efficiency")))))));
1591
1803
  };
1592
1804
 
1593
- const _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator")) : "@@iterator";
1594
- const _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
1595
- function _catch(body, recover) {
1596
- try {
1597
- var result = body();
1598
- } catch (e) {
1599
- return recover(e);
1600
- }
1601
- if (result && result.then) {
1602
- return result.then(void 0, recover);
1603
- }
1604
- return result;
1605
- }
1606
- function _finallyRethrows(body, finalizer) {
1607
- try {
1608
- var result = body();
1609
- } catch (e) {
1610
- return finalizer(true, e);
1611
- }
1612
- if (result && result.then) {
1613
- return result.then(finalizer.bind(null, false), finalizer.bind(null, true));
1614
- }
1615
- return finalizer(false, result);
1616
- }
1617
-
1618
1805
  const downloadSurveyorPDF = function (_ref) {
1619
1806
  let rows = _ref.rows,
1620
1807
  surveyorName = _ref.surveyorName,
@@ -1704,6 +1891,123 @@ const downloadSurveyorPDF = function (_ref) {
1704
1891
  return Promise.reject(e);
1705
1892
  }
1706
1893
  };
1894
+ const downloadSupervisorPDF = function (_ref2) {
1895
+ let rows = _ref2.rows,
1896
+ supervisorName = _ref2.supervisorName,
1897
+ mobileNumber = _ref2.mobileNumber,
1898
+ vendorName = _ref2.vendorName,
1899
+ dashboardInfo = _ref2.dashboardInfo,
1900
+ t = _ref2.t;
1901
+ try {
1902
+ const tenantId = Digit.ULBService.getCurrentTenantId();
1903
+ const name = "Delhi Jal Board";
1904
+ const email = "contact@delhijalboard.nic.in";
1905
+ const phoneNumber = "+91-11-23538416";
1906
+ const currentDate = new Date();
1907
+ const formattedDate = currentDate.toLocaleDateString("en-IN", {
1908
+ day: "2-digit",
1909
+ month: "2-digit",
1910
+ year: "numeric"
1911
+ });
1912
+ const formattedTime = currentDate.toLocaleTimeString("en-IN", {
1913
+ hour: "2-digit",
1914
+ minute: "2-digit",
1915
+ second: "2-digit",
1916
+ hour12: false
1917
+ });
1918
+ const downloadDateTime = formattedDate + " " + formattedTime;
1919
+ const isValDefined = val => val !== undefined && val !== null && val !== "";
1920
+ const details = [{
1921
+ title: t("SUPERVISOR_DETAILS") || "Supervisor Details",
1922
+ asSectionHeader: true,
1923
+ values: [{
1924
+ title: t("SUPERVISOR_NAME") || "Supervisor Name",
1925
+ value: supervisorName
1926
+ }, {
1927
+ title: t("MOBILE_NUMBER") || "Mobile Number",
1928
+ value: mobileNumber
1929
+ }, {
1930
+ title: t("VENDOR_NAME") || "Vendor Name",
1931
+ value: vendorName
1932
+ }].filter(item => isValDefined(item.value))
1933
+ }, {
1934
+ title: t("SUMMARY_STATISTICS") || "Summary Statistics",
1935
+ asSectionHeader: true,
1936
+ values: [{
1937
+ title: t("TOTAL_ASSIGNED") || "Total Assigned",
1938
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.total) || 0
1939
+ }, {
1940
+ title: t("COMPLETED") || "Completed",
1941
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.completed) || 0
1942
+ }, {
1943
+ title: t("PENDING") || "Pending",
1944
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.pending) || 0
1945
+ }, {
1946
+ title: t("SUBMITTED") || "Submitted",
1947
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.submittedCount) || 0
1948
+ }].filter(item => isValDefined(item.value))
1949
+ }];
1950
+ const mappedRows = rows.map(row => {
1951
+ var _row$owner, _row$owner2;
1952
+ return {
1953
+ kno: row.name || ((_row$owner = row.owner) === null || _row$owner === void 0 ? void 0 : _row$owner.name) || "N/A",
1954
+ firstName: ((_row$owner2 = row.owner) === null || _row$owner2 === void 0 ? void 0 : _row$owner2.mobileNumber) || row.mobileNo || "N/A",
1955
+ lastName: "",
1956
+ mobileNo: row.status || "N/A",
1957
+ zoneName: String(row.total || 0),
1958
+ ekycStatus: (row.completed || 0) + " / " + (row.pending || 0),
1959
+ submittedAt: 1717171717171,
1960
+ progress: row.progress || "0%"
1961
+ };
1962
+ });
1963
+ const originalToLocaleDateString = Date.prototype.toLocaleDateString;
1964
+ let progressIndex = 0;
1965
+ Date.prototype.toLocaleDateString = function () {
1966
+ if (progressIndex < mappedRows.length) {
1967
+ return mappedRows[progressIndex++].progress || "0%";
1968
+ }
1969
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1970
+ args[_key] = arguments[_key];
1971
+ }
1972
+ return originalToLocaleDateString.apply(this, args);
1973
+ };
1974
+ const customT = key => {
1975
+ if (key === "KNO") return t("SURVEYOR_NAME") || "Surveyor Name";
1976
+ if (key === "CONSUMER") return t("MOBILE_NUMBER") || "Mobile Number";
1977
+ if (key === "MOBILE") return t("STATUS") || "Status";
1978
+ if (key === "ZONE") return t("TOTAL_EKYC_APPLICATIONS") || "Total eKYC Applications";
1979
+ if (key === "EKYC_STATUS") return t("COMPLETED_PENDING") || "Completed / Pending";
1980
+ if (key === "SUBMITTED_DATE") return t("OVERALL_PROGRESS") || "Overall Progress";
1981
+ if (key === "CONSUMER_LIST") return t("CONNECTED_SURVEYORS") || "Connected Surveyors";
1982
+ return t(key);
1983
+ };
1984
+ try {
1985
+ if (window.Digit && window.Digit.Utils && window.Digit.Utils.pdf && window.Digit.Utils.pdf.generateSurveyorReport) {
1986
+ window.Digit.Utils.pdf.generateSurveyorReport({
1987
+ tenantId,
1988
+ logo: null,
1989
+ name,
1990
+ email,
1991
+ phoneNumber,
1992
+ heading: t("EKYC_SUPERVISOR_REPORT") || "eKYC Supervisor Report",
1993
+ details,
1994
+ applicationNumber: mobileNumber,
1995
+ rows: mappedRows,
1996
+ t: customT,
1997
+ hideApplicationNumber: true,
1998
+ downloadTime: downloadDateTime
1999
+ });
2000
+ } else {
2001
+ console.error("Digit.Utils.pdf.generateSurveyorReport is not available");
2002
+ }
2003
+ } finally {
2004
+ Date.prototype.toLocaleDateString = originalToLocaleDateString;
2005
+ }
2006
+ return Promise.resolve();
2007
+ } catch (e) {
2008
+ return Promise.reject(e);
2009
+ }
2010
+ };
1707
2011
  const downloadVendorPDF = function (_ref3) {
1708
2012
  let rows = _ref3.rows,
1709
2013
  vendorName = _ref3.vendorName,
@@ -1929,6 +2233,10 @@ const VendorDetailsCard = () => {
1929
2233
  }
1930
2234
  return "N/A";
1931
2235
  }, [vendor]);
2236
+ const zoneIds = useMemo(() => {
2237
+ var _vendor$zoneIds;
2238
+ return vendor !== null && vendor !== void 0 && (_vendor$zoneIds = vendor.zoneIds) !== null && _vendor$zoneIds !== void 0 && _vendor$zoneIds.length ? vendor.zoneIds.map(zone => zone.toUpperCase().replace("", " ")).join(", ") : "N/A";
2239
+ }, [vendor]);
1932
2240
  const cards = useMemo(() => {
1933
2241
  const hasRealData = vendorSupervisors.some(s => s.totalKnos > 0);
1934
2242
  const totalKnos = hasRealData ? vendorSupervisors.reduce((acc, s) => acc + (s.totalKnos || 0), 0) : (progressData === null || progressData === void 0 ? void 0 : progressData.totalKnos) || (vendor === null || vendor === void 0 ? void 0 : vendor.assignedConnections) || 0;
@@ -1986,7 +2294,7 @@ const VendorDetailsCard = () => {
1986
2294
  alert(t("NO_EKYC_DATA_FOUND") || "No eKYC data found to download.");
1987
2295
  return;
1988
2296
  }
1989
- const excludedKeys = ["status", "source", "submittedAt", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "assignedTime", "isSelfAssigned", "userType", "tenantName", "tenantMobile"];
2297
+ const excludedKeys = ["status", "source", "submittedAt", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "isSelfAssigned", "userType", "tenantName", "tenantMobile"];
1990
2298
  const headerMapping = {
1991
2299
  kno: t("KNO") || "KNO",
1992
2300
  firstName: t("FIRST_NAME") || "First Name",
@@ -2311,9 +2619,9 @@ const VendorDetailsCard = () => {
2311
2619
  className: "detail-item"
2312
2620
  }, /*#__PURE__*/React.createElement("span", {
2313
2621
  className: "label"
2314
- }, t("JURISDICTIONS") || "Jurisdictions"), /*#__PURE__*/React.createElement("span", {
2622
+ }, t("ASSIGNED_ZONES") || "Assigned Zones"), /*#__PURE__*/React.createElement("span", {
2315
2623
  className: "value"
2316
- }, jurisdictions)))), /*#__PURE__*/React.createElement("div", {
2624
+ }, zoneIds)))), /*#__PURE__*/React.createElement("div", {
2317
2625
  className: "details-right"
2318
2626
  }, /*#__PURE__*/React.createElement("div", {
2319
2627
  className: "download-card"
@@ -2391,6 +2699,10 @@ const useInboxTableConfig = _ref => {
2391
2699
  tableStyle = _ref$tableStyle === void 0 ? {} : _ref$tableStyle;
2392
2700
  const _useTranslation = useTranslation(),
2393
2701
  t = _useTranslation.t;
2702
+ const toTitleCase = str => {
2703
+ if (!str) return "";
2704
+ return String(str).toLowerCase().replace(/_/g, " ").replace(/\b\w/g, c => c.toUpperCase());
2705
+ };
2394
2706
  const history = useHistory();
2395
2707
  const _useState = useState(""),
2396
2708
  selectedKno = _useState[0],
@@ -2434,18 +2746,18 @@ const useInboxTableConfig = _ref => {
2434
2746
  Cell: _ref3 => {
2435
2747
  var _row$original3;
2436
2748
  let row = _ref3.row;
2437
- return /*#__PURE__*/React.createElement("span", null, ((_row$original3 = row.original) === null || _row$original3 === void 0 ? void 0 : _row$original3.citizenName) || "NA");
2749
+ return /*#__PURE__*/React.createElement("span", null, toTitleCase((_row$original3 = row.original) === null || _row$original3 === void 0 ? void 0 : _row$original3.citizenName) || "NA");
2438
2750
  }
2439
2751
  }, {
2440
2752
  Header: t("EKYC_STATUS"),
2441
2753
  accessor: "actionStatus",
2442
2754
  Cell: _ref4 => {
2443
- var _row$original4;
2755
+ var _row$original4, _row$original5;
2444
2756
  let row = _ref4.row;
2445
2757
  const status = (((_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : _row$original4.status) || "DEFAULT").toUpperCase();
2446
2758
  return /*#__PURE__*/React.createElement("span", {
2447
2759
  className: "ekyc-status-tag " + status
2448
- }, t("" + status));
2760
+ }, toTitleCase(((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : _row$original5.status) || "DEFAULT"));
2449
2761
  }
2450
2762
  }, {
2451
2763
  Header: t("SUBMITTED_AT") || "Submitted At",
@@ -2465,12 +2777,13 @@ const useInboxTableConfig = _ref => {
2465
2777
  Header: t("EKYC_EKYC_STATUS"),
2466
2778
  accessor: "ekycStatus",
2467
2779
  Cell: _ref7 => {
2468
- var _row$original5, _row$original6;
2780
+ var _row$original6, _row$original7;
2469
2781
  let row = _ref7.row;
2470
- const ekycStatus = (((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : _row$original5.ekycStatus) || ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.ekycstatus) || "NA").toUpperCase();
2782
+ const raw = ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.ekycStatus) || ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.ekycstatus) || "NA";
2783
+ const ekycStatus = raw.toUpperCase();
2471
2784
  return /*#__PURE__*/React.createElement("span", {
2472
2785
  className: "ekyc-status-tag " + ekycStatus
2473
- }, t("" + ekycStatus));
2786
+ }, toTitleCase(raw));
2474
2787
  }
2475
2788
  }];
2476
2789
  return {
@@ -3181,7 +3494,9 @@ const Inbox = _ref => {
3181
3494
  propsForInboxTable,
3182
3495
  propsForInboxMobileCards,
3183
3496
  formState,
3184
- countData: listData
3497
+ countData: listData,
3498
+ forceTable: true,
3499
+ showSearchOnMobile: true
3185
3500
  })));
3186
3501
  };
3187
3502
 
@@ -5861,12 +6176,24 @@ const AssignEkyc = () => {
5861
6176
  propsForInboxMobileCards,
5862
6177
  formState,
5863
6178
  countData: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
5864
- isCardLoading: isDataSearchLoading
6179
+ isCardLoading: isDataSearchLoading,
6180
+ showSearchOnMobile: true,
6181
+ forceTable: true
5865
6182
  })));
5866
6183
  };
5867
6184
 
6185
+ const parseAdditionalDetails = additionalDetails => {
6186
+ if (!additionalDetails) return {};
6187
+ if (typeof additionalDetails === "object") return additionalDetails;
6188
+ if (typeof additionalDetails !== "string") return {};
6189
+ try {
6190
+ return JSON.parse(additionalDetails);
6191
+ } catch (error) {
6192
+ return {};
6193
+ }
6194
+ };
5868
6195
  const AdminDashboard = () => {
5869
- var _Digit$SessionStorage, _loggedInUser$roles, _fullName$charAt;
6196
+ var _Digit$SessionStorage;
5870
6197
  const _useTranslation = useTranslation(),
5871
6198
  t = _useTranslation.t;
5872
6199
  const history = useHistory();
@@ -5890,162 +6217,46 @@ const AdminDashboard = () => {
5890
6217
  isProgressLoading = _Digit$Hooks$ekyc$use.isLoading;
5891
6218
  const vendorsList = useMemo(() => {
5892
6219
  if (vendorSearchResponse && vendorSearchResponse.length > 0) {
5893
- return vendorSearchResponse.map(v => {
6220
+ const filteredVendors = vendorSearchResponse.filter(v => {
6221
+ var _additionalDetails$se;
6222
+ const dso = v.dsoDetails || v;
6223
+ const additionalDetails = parseAdditionalDetails(dso.additionalDetails || v.additionalDetails);
6224
+ return (additionalDetails === null || additionalDetails === void 0 ? void 0 : (_additionalDetails$se = additionalDetails.serviceType) === null || _additionalDetails$se === void 0 ? void 0 : _additionalDetails$se.toLowerCase()) === "ekyc";
6225
+ });
6226
+ return filteredVendors.map(v => {
5894
6227
  var _progressData$supervi, _dso$owner, _v$owner, _dso$owner2;
5895
6228
  const dso = v.dsoDetails || v;
5896
6229
  const supervisorsList = dso.supervisors || [];
5897
6230
  const surveyorsList = dso.surveyors || [];
5898
6231
  const supervisorIds = supervisorsList.map(s => {
5899
6232
  var _s$owner;
5900
- return s.id || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : _s$owner.uuid);
5901
- }).filter(Boolean);
5902
- const matchedReports = (progressData === null || progressData === void 0 ? void 0 : (_progressData$supervi = progressData.supervisorReport) === null || _progressData$supervi === void 0 ? void 0 : _progressData$supervi.filter(r => supervisorIds.includes(r.supervisorId))) || [];
5903
- const completed = matchedReports.reduce((acc, r) => acc + (r.submittedKnos || 0), 0);
5904
- const pending = matchedReports.reduce((acc, r) => acc + (r.pendingKnos || 0), 0);
5905
- const total = matchedReports.reduce((acc, r) => acc + (r.totalKnos || 0), 0);
5906
- const progress = total > 0 ? Math.round(completed / total * 100) : 0;
5907
- const rejected = 0;
5908
- return {
5909
- id: dso.id || dso.vendorId || v.id || v.vendorId,
5910
- name: dso.name || dso.displayName || v.name || "N/A",
5911
- ownerName: ((_dso$owner = dso.owner) === null || _dso$owner === void 0 ? void 0 : _dso$owner.name) || ((_v$owner = v.owner) === null || _v$owner === void 0 ? void 0 : _v$owner.name) || "N/A",
5912
- mobileNumber: dso.mobileNumber || ((_dso$owner2 = dso.owner) === null || _dso$owner2 === void 0 ? void 0 : _dso$owner2.mobileNumber) || v.mobileNumber || "N/A",
5913
- supervisors: supervisorsList.length,
5914
- surveyors: surveyorsList.length,
5915
- completed: completed,
5916
- progress: progress,
5917
- pending: pending,
5918
- rejected: rejected
5919
- };
5920
- });
5921
- }
5922
- return [];
5923
- }, [vendorSearchResponse, progressData]);
5924
- const _useState = useState(false),
5925
- ekycDownloadLoading = _useState[0],
5926
- setEkycDownloadLoading = _useState[1];
5927
- const _useState2 = useState(0),
5928
- currentPage = _useState2[0];
5929
- const _useState3 = useState(20),
5930
- pageSize = _useState3[0];
5931
- const _Digit$Hooks$ekyc$use2 = Digit.Hooks.ekyc.useEkycApplicationList({}, {
5932
- tenantId,
5933
- offset: currentPage * pageSize,
5934
- limit: pageSize
5935
- }, {
5936
- keepPreviousData: true
5937
- });
5938
- const fullName = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.name) || "Admin";
5939
- const mobileNumber = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.mobileNumber) || "N/A";
5940
- const roleText = (loggedInUser === null || loggedInUser === void 0 ? void 0 : (_loggedInUser$roles = loggedInUser.roles) === null || _loggedInUser$roles === void 0 ? void 0 : _loggedInUser$roles.map(r => r.name).join(", ")) || "EKYC Admin";
5941
- const handleDownloadEkycData = function () {
5942
- try {
5943
- setEkycDownloadLoading(true);
5944
- return Promise.resolve(_finallyRethrows(function () {
5945
- return _catch(function () {
5946
- return Promise.resolve(Digit.EkycService.application_list({
5947
- tenantId: tenantId,
5948
- offset: 0,
5949
- limit: 10000,
5950
- reportDownload: true
5951
- })).then(function (response) {
5952
- const consumerList = (response === null || response === void 0 ? void 0 : response.consumerList) || [];
5953
- if (consumerList.length === 0) {
5954
- alert(t("NO_DATA_FOUND") || "No data found for download.");
5955
- return;
5956
- }
5957
- const excludedKeys = ["status", "source", "submittedAt", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "assignedTime", "isSelfAssigned", "userType", "tenantName", "tenantMobile"];
5958
- const headerMapping = {
5959
- kno: t("KNO") || "KNO",
5960
- firstName: t("FIRST_NAME") || "First Name",
5961
- middleName: t("MIDDLE_NAME") || "Middle Name",
5962
- lastName: t("LAST_NAME") || "Last Name",
5963
- gender: t("GENDER") || "Gender",
5964
- mobileNumber: t("MOBILE_NUMBER") || "Mobile Number",
5965
- emailId: t("EMAIL_ID") || "Email ID",
5966
- fatherOrHusbandName: t("FATHER_HUSBUND_NAME") || "Father/Husband Name",
5967
- relationship: t("RELATIONSHIP") || "Relationship",
5968
- dob: t("DOB") || "Date of Birth",
5969
- ekycStatus: t("EKYC_STATUS") || "eKYC Status",
5970
- zoneName: t("ZONE") || "Zone",
5971
- assembly: t("ASSEMBLY") || "Assembly",
5972
- ward: t("WARD") || "Ward",
5973
- pincode: t("PINCODE") || "Pincode",
5974
- mrkey: t("MR_KEY") || "MR Key",
5975
- createdTime: t("CREATED_TIME") || "Created Time",
5976
- lastModifiedTime: t("LAST_MODIFIED_TIME") || "Last Modified Time"
5977
- };
5978
- const excelData = consumerList.map(item => {
5979
- const cleanObj = {};
5980
- const name = [item.firstName, item.middleName, item.lastName].filter(Boolean).join(" ");
5981
- if (name) {
5982
- cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = name;
5983
- }
5984
- Object.keys(item).forEach(key => {
5985
- if (excludedKeys.includes(key)) return;
5986
- const val = item[key];
5987
- if (typeof val === "object" && val !== null) {
5988
- return;
5989
- }
5990
- const friendlyHeader = headerMapping[key] || t(key.toUpperCase()) || key;
5991
- cleanObj[friendlyHeader] = val;
5992
- });
5993
- return cleanObj;
5994
- });
5995
- const cleanFileName = "eKYC_All_Data_Admin_" + fullName.replace(/[^a-zA-Z0-9]/g, "_");
5996
- Digit.Download.Excel(excelData, cleanFileName);
5997
- });
5998
- }, function (error) {
5999
- console.error("Error downloading eKYC Excel:", error);
6000
- });
6001
- }, function (_wasThrown, _result) {
6002
- setEkycDownloadLoading(false);
6003
- if (_wasThrown) throw _result;
6004
- return _result;
6005
- }));
6006
- } catch (e) {
6007
- return Promise.reject(e);
6233
+ return s.id || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : _s$owner.uuid);
6234
+ }).filter(Boolean);
6235
+ const matchedReports = (progressData === null || progressData === void 0 ? void 0 : (_progressData$supervi = progressData.supervisorReport) === null || _progressData$supervi === void 0 ? void 0 : _progressData$supervi.filter(r => supervisorIds.includes(r.supervisorId))) || [];
6236
+ const completed = matchedReports.reduce((acc, r) => acc + (r.submittedKnos || 0), 0);
6237
+ const pending = matchedReports.reduce((acc, r) => acc + (r.pendingKnos || 0), 0);
6238
+ const total = matchedReports.reduce((acc, r) => acc + (r.totalKnos || 0), 0);
6239
+ const progress = total > 0 ? Math.round(completed / total * 100) : 0;
6240
+ const rejected = 0;
6241
+ return {
6242
+ id: dso.id || dso.vendorId || v.id || v.vendorId,
6243
+ name: dso.name || dso.displayName || v.name || "N/A",
6244
+ ownerName: ((_dso$owner = dso.owner) === null || _dso$owner === void 0 ? void 0 : _dso$owner.name) || ((_v$owner = v.owner) === null || _v$owner === void 0 ? void 0 : _v$owner.name) || "N/A",
6245
+ mobileNumber: dso.mobileNumber || ((_dso$owner2 = dso.owner) === null || _dso$owner2 === void 0 ? void 0 : _dso$owner2.mobileNumber) || v.mobileNumber || "N/A",
6246
+ supervisors: supervisorsList.length,
6247
+ surveyors: surveyorsList.length,
6248
+ completed: completed,
6249
+ progress: progress,
6250
+ pending: pending,
6251
+ rejected: rejected
6252
+ };
6253
+ });
6008
6254
  }
6009
- };
6255
+ return [];
6256
+ }, [vendorSearchResponse, progressData]);
6010
6257
  return /*#__PURE__*/React.createElement(Card, {
6011
6258
  className: "surveyor-dashboard"
6012
- }, /*#__PURE__*/React.createElement("div", {
6013
- className: "ekyc-dashboard-section"
6014
- }, /*#__PURE__*/React.createElement("div", {
6015
- className: "ekyc-dashboard-header"
6016
- }, /*#__PURE__*/React.createElement("div", {
6017
- className: "avatar"
6018
- }, fullName === null || fullName === void 0 ? void 0 : (_fullName$charAt = fullName.charAt(0)) === null || _fullName$charAt === void 0 ? void 0 : _fullName$charAt.toUpperCase()), /*#__PURE__*/React.createElement("div", {
6019
- className: "header-content"
6020
- }, /*#__PURE__*/React.createElement("h2", {
6021
- className: "name"
6022
- }, fullName), /*#__PURE__*/React.createElement("div", {
6023
- className: "designation"
6024
- }, t("EKYC_ADMIN") || "eKYC Admin / Manager"), /*#__PURE__*/React.createElement("div", {
6025
- className: "mobile-number"
6026
- }, mobileNumber))), /*#__PURE__*/React.createElement("button", {
6027
- className: "download-excel-btn",
6028
- disabled: ekycDownloadLoading,
6029
- onClick: handleDownloadEkycData
6030
- }, /*#__PURE__*/React.createElement("svg", {
6031
- width: "16",
6032
- height: "16",
6033
- viewBox: "0 0 24 24",
6034
- fill: "none",
6035
- stroke: "currentColor",
6036
- strokeWidth: "2.5",
6037
- strokeLinecap: "round",
6038
- strokeLinejoin: "round"
6039
- }, /*#__PURE__*/React.createElement("path", {
6040
- d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
6041
- }), /*#__PURE__*/React.createElement("polyline", {
6042
- points: "7 10 12 15 17 10"
6043
- }), /*#__PURE__*/React.createElement("line", {
6044
- x1: "12",
6045
- y1: "15",
6046
- x2: "12",
6047
- y2: "3"
6048
- })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel")), /*#__PURE__*/React.createElement(Dashboard, null), /*#__PURE__*/React.createElement("div", {
6259
+ }, /*#__PURE__*/React.createElement(Dashboard, null), /*#__PURE__*/React.createElement("div", {
6049
6260
  className: "admin-performance-section"
6050
6261
  }, /*#__PURE__*/React.createElement("h3", {
6051
6262
  className: "section-title"
@@ -6333,7 +6544,8 @@ const SupervisorDetailsCard = () => {
6333
6544
  showCustomPicker = _useState6[0],
6334
6545
  setShowCustomPicker = _useState6[1];
6335
6546
  const _useState7 = useState(false),
6336
- reportLoading = _useState7[0];
6547
+ reportLoading = _useState7[0],
6548
+ setReportLoading = _useState7[1];
6337
6549
  const reportMenuRef = useRef(null);
6338
6550
  useEffect(() => {
6339
6551
  const handler = e => {
@@ -6345,6 +6557,42 @@ const SupervisorDetailsCard = () => {
6345
6557
  document.addEventListener("mousedown", handler);
6346
6558
  return () => document.removeEventListener("mousedown", handler);
6347
6559
  }, []);
6560
+ const handleDownload = () => {
6561
+ setReportLoading(true);
6562
+ try {
6563
+ const rowsWithStats = surveyors.map(s => ({
6564
+ name: s.surveyorName,
6565
+ mobileNo: s.mobileNo,
6566
+ status: s.status,
6567
+ total: s.totalKnos,
6568
+ completed: s.submittedKnos,
6569
+ pending: s.pendingKnos,
6570
+ progress: s.progressPercent + "%"
6571
+ }));
6572
+ const totalKnos = (supervisor === null || supervisor === void 0 ? void 0 : supervisor.totalKnos) || 0;
6573
+ const completedKnos = (supervisor === null || supervisor === void 0 ? void 0 : supervisor.submittedKnos) || 0;
6574
+ downloadSupervisorPDF({
6575
+ rows: rowsWithStats,
6576
+ supervisorName: fullName,
6577
+ vendorName,
6578
+ mobileNumber,
6579
+ email,
6580
+ dashboardInfo: {
6581
+ total: totalKnos,
6582
+ completed: completedKnos,
6583
+ pending: totalKnos - completedKnos,
6584
+ submittedCount: completedKnos
6585
+ },
6586
+ t
6587
+ });
6588
+ } catch (err) {
6589
+ console.error("Failed to generate supervisor report:", err);
6590
+ } finally {
6591
+ setReportLoading(false);
6592
+ setShowReportMenu(false);
6593
+ setShowCustomPicker(false);
6594
+ }
6595
+ };
6348
6596
  const handlePresetDownload = filter => {
6349
6597
  handleDownload();
6350
6598
  };
@@ -6364,20 +6612,13 @@ const SupervisorDetailsCard = () => {
6364
6612
  setEkycDownloadLoading(true);
6365
6613
  return Promise.resolve(_finallyRethrows(function () {
6366
6614
  return _catch(function () {
6367
- const fetchPromises = surveyors.map(s => Digit.EkycService.application_list({
6615
+ return Promise.resolve(Digit.EkycService.application_list({
6368
6616
  tenantId: tenantId || "dl.djb",
6369
6617
  offset: 0,
6370
- limit: 5000,
6371
- surveyorId: s.surveyorId || s.id,
6618
+ limit: 10000,
6372
6619
  reportDownload: true
6373
- }).catch(err => {
6374
- console.error("Error fetching applications for surveyor " + s.surveyorName + ":", err);
6375
- return {
6376
- consumerList: []
6377
- };
6378
- }));
6379
- return Promise.resolve(Promise.all(fetchPromises)).then(function (results) {
6380
- const consumerList = results.flatMap(res => (res === null || res === void 0 ? void 0 : res.consumerList) || []);
6620
+ })).then(function (response) {
6621
+ const consumerList = (response === null || response === void 0 ? void 0 : response.consumerList) || [];
6381
6622
  if (consumerList.length === 0) {
6382
6623
  alert(t("NO_DATA_FOUND") || "No data found for download.");
6383
6624
  return;
@@ -6400,14 +6641,21 @@ const SupervisorDetailsCard = () => {
6400
6641
  ward: t("WARD") || "Ward",
6401
6642
  pincode: t("PINCODE") || "Pincode",
6402
6643
  mrkey: t("MR_KEY") || "MR Key",
6644
+ consumerType: t("CONSUMER_TYPE") || "Consumer Type",
6403
6645
  createdTime: t("CREATED_TIME") || "Created Time",
6404
6646
  lastModifiedTime: t("LAST_MODIFIED_TIME") || "Last Modified Time"
6405
6647
  };
6648
+ const toTitleCase = str => {
6649
+ if (!str) return "";
6650
+ const cleanStr = String(str).includes(".") ? String(str).split(".").pop() : String(str);
6651
+ return cleanStr.toLowerCase().replace(/_/g, " ").replace(/\b\w/g, c => c.toUpperCase());
6652
+ };
6653
+ const titleCaseFields = ["ekycStatus", "zoneName", "gender", "relationship", "assembly", "ward", "consumerType"];
6406
6654
  const excelData = consumerList.map(item => {
6407
6655
  const cleanObj = {};
6408
6656
  const fullName = [item.firstName, item.middleName, item.lastName].filter(Boolean).join(" ");
6409
6657
  if (fullName) {
6410
- cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = fullName;
6658
+ cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = toTitleCase(fullName);
6411
6659
  }
6412
6660
  Object.keys(item).forEach(key => {
6413
6661
  if (excludedKeys.includes(key)) return;
@@ -6416,7 +6664,11 @@ const SupervisorDetailsCard = () => {
6416
6664
  return;
6417
6665
  }
6418
6666
  const friendlyHeader = headerMapping[key] || t(key.toUpperCase()) || key;
6419
- cleanObj[friendlyHeader] = val;
6667
+ if (typeof val === "string" && titleCaseFields.includes(key)) {
6668
+ cleanObj[friendlyHeader] = toTitleCase(val);
6669
+ } else {
6670
+ cleanObj[friendlyHeader] = val;
6671
+ }
6420
6672
  });
6421
6673
  return cleanObj;
6422
6674
  });
@@ -6657,9 +6909,11 @@ const SupervisorDetailsCard = () => {
6657
6909
  const AssignEkycModal = _ref => {
6658
6910
  let surveyor = _ref.surveyor,
6659
6911
  closeModal = _ref.closeModal,
6660
- refetchDashboard = _ref.refetchDashboard;
6912
+ refetchDashboard = _ref.refetchDashboard,
6913
+ propsTenantId = _ref.tenantId;
6661
6914
  const _useTranslation = useTranslation(),
6662
6915
  t = _useTranslation.t;
6916
+ const tenantId = propsTenantId || Digit.ULBService.getCurrentTenantId();
6663
6917
  const _useState = useState([]),
6664
6918
  selectedKnos = _useState[0],
6665
6919
  setSelectedKnos = _useState[1];
@@ -6696,16 +6950,15 @@ const AssignEkycModal = _ref => {
6696
6950
  const _useState8 = useState(filters),
6697
6951
  debouncedFilters = _useState8[0],
6698
6952
  setDebouncedFilters = _useState8[1];
6699
- const _Digit$Hooks$ws$useWS = Digit.Hooks.ws.useWSConfigMDMS.ZROLocation("dl.djb"),
6700
- zroLocationsData = _Digit$Hooks$ws$useWS.data,
6701
- isZroLoading = _Digit$Hooks$ws$useWS.isLoading;
6953
+ const _Digit$Hooks$ws$useWS = Digit.Hooks.ws.useWSConfigMDMS.ZROLocation(tenantId),
6954
+ zroLocationsData = _Digit$Hooks$ws$useWS.data;
6702
6955
  const mappedZROLocation = useMemo(() => {
6703
6956
  return (zroLocationsData || []).map(item => ({
6704
6957
  code: item.code,
6705
6958
  name: item.name
6706
6959
  }));
6707
6960
  }, [zroLocationsData]);
6708
- const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS("dl.djb", "egov-location", ["TenantBoundary"]),
6961
+ const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
6709
6962
  egovLocationData = _Digit$Hooks$useCommo.data;
6710
6963
  const boundaryData = useMemo(() => {
6711
6964
  var _egovLocationData$ego;
@@ -6783,6 +7036,27 @@ const AssignEkycModal = _ref => {
6783
7036
  });
6784
7037
  return Array.from(pinSet).sort();
6785
7038
  }, [structuredLocalityData]);
7039
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycApplicationList({
7040
+ unassignedOnly: true,
7041
+ fetchFilterOptions: true
7042
+ }, {
7043
+ tenantId: tenantId,
7044
+ offset: 0,
7045
+ limit: 1000
7046
+ }, {
7047
+ staleTime: Infinity
7048
+ }),
7049
+ filterOptionsData = _Digit$Hooks$ekyc$use.data;
7050
+ const pincodeOptions = useMemo(() => {
7051
+ if (!filterOptionsData) return fetchedPincodes || [];
7052
+ const pins = filterOptionsData.pincodeOptions || [];
7053
+ return Array.isArray(pins) ? pins.filter(Boolean).map(String).sort() : [];
7054
+ }, [filterOptionsData, fetchedPincodes]);
7055
+ const mrkeyOptions = useMemo(() => {
7056
+ if (!filterOptionsData) return [];
7057
+ const keys = filterOptionsData.mrkeyOptions || [];
7058
+ return Array.isArray(keys) ? keys.filter(Boolean).map(String).sort() : [];
7059
+ }, [filterOptionsData]);
6786
7060
  useEffect(() => {
6787
7061
  const timer = setTimeout(() => {
6788
7062
  setDebouncedFilters(filters);
@@ -6792,7 +7066,7 @@ const AssignEkycModal = _ref => {
6792
7066
  useEffect(() => {
6793
7067
  setCurrentPage(0);
6794
7068
  }, [debouncedFilters, filters.kno]);
6795
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycApplicationList(_extends({
7069
+ const _Digit$Hooks$ekyc$use2 = Digit.Hooks.ekyc.useEkycApplicationList(_extends({
6796
7070
  unassignedOnly: true
6797
7071
  }, filters.kno && {
6798
7072
  kno: filters.kno
@@ -6809,14 +7083,15 @@ const AssignEkycModal = _ref => {
6809
7083
  }, debouncedFilters.pincode && {
6810
7084
  pincode: debouncedFilters.pincode
6811
7085
  }), {
6812
- tenantId: "dl.djb",
7086
+ tenantId: tenantId,
6813
7087
  offset: currentPage * pageSize,
6814
7088
  limit: pageSize
6815
7089
  }, {
6816
7090
  keepPreviousData: true
6817
7091
  }),
6818
- applicationData = _Digit$Hooks$ekyc$use.data,
6819
- isLoading = _Digit$Hooks$ekyc$use.isFetching;
7092
+ applicationData = _Digit$Hooks$ekyc$use2.data,
7093
+ isLoading = _Digit$Hooks$ekyc$use2.isFetching,
7094
+ refetchApplicationList = _Digit$Hooks$ekyc$use2.refetch;
6820
7095
  const handleAssignmentError = (errMsg, variables) => {
6821
7096
  const isAlreadyAssigned = errMsg.toLowerCase().includes("already assigned") || errMsg.toLowerCase().includes("already assign") || errMsg.toLowerCase().includes("active assignment") || errMsg.toLowerCase().includes("mrkey") || errMsg.toLowerCase().includes("mr key") || errMsg.toLowerCase().includes("kno") || errMsg.toLowerCase().includes("already exists");
6822
7097
  if (isAlreadyAssigned) {
@@ -6861,9 +7136,23 @@ const AssignEkycModal = _ref => {
6861
7136
  setShowToast(true);
6862
7137
  setTimeout(function () {
6863
7138
  try {
6864
- return Promise.resolve(refetchDashboard()).then(function () {
6865
- closeModal();
6866
- });
7139
+ function _temp4() {
7140
+ function _temp2() {
7141
+ closeModal();
7142
+ }
7143
+ const _temp = function () {
7144
+ if (refetchApplicationList) {
7145
+ return Promise.resolve(refetchApplicationList()).then(function () {});
7146
+ }
7147
+ }();
7148
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
7149
+ }
7150
+ const _temp3 = function () {
7151
+ if (refetchDashboard) {
7152
+ return Promise.resolve(refetchDashboard()).then(function () {});
7153
+ }
7154
+ }();
7155
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
6867
7156
  } catch (e) {
6868
7157
  return Promise.reject(e);
6869
7158
  }
@@ -6919,7 +7208,7 @@ const AssignEkycModal = _ref => {
6919
7208
  assignmentType = _getAssignmentPayload.assignmentType,
6920
7209
  assignmentValue = _getAssignmentPayload.assignmentValue;
6921
7210
  assignmentMutation.mutate({
6922
- tenantId: "dl.djb",
7211
+ tenantId: tenantId,
6923
7212
  surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner = surveyor.owner) === null || _surveyor$owner === void 0 ? void 0 : _surveyor$owner.uuid,
6924
7213
  assignmentType,
6925
7214
  assignmentValue
@@ -6995,7 +7284,7 @@ const AssignEkycModal = _ref => {
6995
7284
  }),
6996
7285
  actionCancelLabel: "Cancel",
6997
7286
  actionCancelOnSubmit: closeModal,
6998
- actionSaveLabel: "Assign " + selectedKnos.length + " KNOs",
7287
+ actionSaveLabel: t("EKYC_ASSIGN_KNOS") || "Assign KNOs",
6999
7288
  actionSaveOnSubmit: handleAssign,
7000
7289
  isDisabled: !(selectedKnos !== null && selectedKnos !== void 0 && selectedKnos.length)
7001
7290
  }, /*#__PURE__*/React.createElement("div", {
@@ -7013,35 +7302,25 @@ const AssignEkycModal = _ref => {
7013
7302
  onChange: e => handleFilterChange("pincode", e.target.value)
7014
7303
  }, /*#__PURE__*/React.createElement("option", {
7015
7304
  value: ""
7016
- }, "Select Pincode"), fetchedPincodes.map(pin => /*#__PURE__*/React.createElement("option", {
7305
+ }, "Select Pincode"), pincodeOptions.map(pin => /*#__PURE__*/React.createElement("option", {
7017
7306
  key: pin,
7018
7307
  value: pin
7019
7308
  }, pin))), /*#__PURE__*/React.createElement("select", {
7020
- className: "form-control",
7021
- value: filters.zoneName,
7022
- onChange: e => {
7023
- const val = e.target.value;
7024
- setFilters(prev => _extends({}, prev, {
7025
- zoneCode: val,
7026
- zoneName: val
7027
- }));
7028
- },
7029
- disabled: isZroLoading
7030
- }, /*#__PURE__*/React.createElement("option", {
7031
- value: ""
7032
- }, isZroLoading ? "Loading ZRO Locations..." : "Select ZRO Location"), mappedZROLocation.map(loc => /*#__PURE__*/React.createElement("option", {
7033
- key: loc.code,
7034
- value: loc.name
7035
- }, loc.name))), /*#__PURE__*/React.createElement("select", {
7036
7309
  className: "form-control",
7037
7310
  value: filters.ward,
7038
7311
  onChange: e => handleFilterChange("ward", e.target.value)
7039
7312
  }, /*#__PURE__*/React.createElement("option", {
7040
7313
  value: ""
7041
- }, "Select Ward"), wardOptions.map(ward => /*#__PURE__*/React.createElement("option", {
7042
- key: ward.code,
7043
- value: ward.name
7044
- }, ward.name))), /*#__PURE__*/React.createElement("select", {
7314
+ }, "Select Ward"), wardOptions.filter(ward => {
7315
+ const stripped = ward.name.replace(/[0-9]/g, "").replace(/^[-\s]+|[-\s]+$/g, "");
7316
+ return stripped.trim().length > 0;
7317
+ }).map(ward => {
7318
+ const displayName = ward.name.replace(/[0-9]/g, "").replace(/^[-\s]+|[-\s]+$/g, "");
7319
+ return /*#__PURE__*/React.createElement("option", {
7320
+ key: ward.code,
7321
+ value: ward.name
7322
+ }, displayName);
7323
+ })), /*#__PURE__*/React.createElement("select", {
7045
7324
  className: "form-control",
7046
7325
  value: filters.assembly,
7047
7326
  onChange: e => handleFilterChange("assembly", e.target.value)
@@ -7050,16 +7329,20 @@ const AssignEkycModal = _ref => {
7050
7329
  }, "Select Assembly"), assemblyOptions.map(assembly => /*#__PURE__*/React.createElement("option", {
7051
7330
  key: assembly.code,
7052
7331
  value: assembly.name
7053
- }, assembly.name))), /*#__PURE__*/React.createElement("input", {
7332
+ }, assembly.name))), /*#__PURE__*/React.createElement("select", {
7054
7333
  className: "form-control",
7055
- placeholder: "MR Key",
7056
7334
  value: filters.mrkey,
7057
7335
  onChange: e => handleFilterChange("mrkey", e.target.value)
7058
- }), selectedKnos.length > 0 && /*#__PURE__*/React.createElement("button", {
7336
+ }, /*#__PURE__*/React.createElement("option", {
7337
+ value: ""
7338
+ }, "Select MR Key"), mrkeyOptions.map(key => /*#__PURE__*/React.createElement("option", {
7339
+ key: key,
7340
+ value: key
7341
+ }, key))), selectedKnos.length > 0 && /*#__PURE__*/React.createElement("button", {
7059
7342
  className: "clear-selected-btn",
7060
7343
  type: "button",
7061
7344
  onClick: () => setSelectedKnos([])
7062
- }, t("EKYC_CLEAR_SELECTION") || "Clear Selected (" + selectedKnos.length + ")")), /*#__PURE__*/React.createElement(Table, {
7345
+ }, t("EKYC_CLEAR_SELECTION") || "Clear Selected")), /*#__PURE__*/React.createElement(Table, {
7063
7346
  tableTitle: "eKYC Applications",
7064
7347
  tableClass: "ekycTable",
7065
7348
  data: tableData,
@@ -7098,7 +7381,7 @@ const AssignEkycModal = _ref => {
7098
7381
  };
7099
7382
 
7100
7383
  const SurveyorDetailsDashboard = () => {
7101
- var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _Digit$SessionStorage4, _surveyor$owner, _surveyor$owner2, _surveyor$owner3, _surveyor$owner4, _fullName$charAt, _dashboardData$dashbo, _dashboardData$dashbo2, _dashboardData$dashbo3, _dashboardData$dashbo4, _surveyor$owner8, _surveyor$owner9, _surveyor$owner0, _surveyor$additionalD, _dashboardData$dashbo5, _dashboardData$dashbo6;
7384
+ var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _Digit$SessionStorage4, _surveyor$owner, _surveyor$owner2, _surveyor$owner3, _surveyor$owner4, _fullName$charAt, _dashboardData$dashbo, _dashboardData$dashbo2, _dashboardData$dashbo3, _dashboardData$dashbo4, _surveyor$owner8, _surveyor$owner9, _surveyor$owner0, _dashboardData$dashbo5, _dashboardData$dashbo6;
7102
7385
  const tenantId = Digit.ULBService.getCurrentTenantId();
7103
7386
  const _useState = useState(false),
7104
7387
  showModal = _useState[0],
@@ -7202,16 +7485,22 @@ const SurveyorDetailsDashboard = () => {
7202
7485
  _Digit$Hooks$ekyc$use2 = _Digit$Hooks$ekyc$use.data,
7203
7486
  dashboardData = _Digit$Hooks$ekyc$use2 === void 0 ? {} : _Digit$Hooks$ekyc$use2,
7204
7487
  refetchDashboard = _Digit$Hooks$ekyc$use.refetch;
7488
+ const toTitleCase = str => {
7489
+ if (!str) return "";
7490
+ const cleanStr = String(str).includes(".") ? String(str).split(".").pop() : String(str);
7491
+ return cleanStr.toLowerCase().replace(/_/g, " ").replace(/\b\w/g, c => c.toUpperCase());
7492
+ };
7205
7493
  const knoColumns = useMemo(() => [{
7206
7494
  Header: t("KNO") || "KNO",
7207
7495
  accessor: "kno"
7208
7496
  }, {
7209
7497
  Header: t("CONSUMER_NAME") || "Consumer Name",
7210
- accessor: row => ((row.firstName || "") + " " + (row.middleName || "") + " " + (row.lastName || "")).trim(),
7498
+ accessor: row => toTitleCase(((row.firstName || "") + " " + (row.middleName || "") + " " + (row.lastName || "")).trim()),
7211
7499
  id: "consumerName"
7212
7500
  }, {
7213
7501
  Header: t("ZONE") || "Zone",
7214
- accessor: "zoneName"
7502
+ accessor: row => toTitleCase(row.zoneName),
7503
+ id: "zoneName"
7215
7504
  }, {
7216
7505
  Header: t("EKYC_STATUS") || "eKYC Status",
7217
7506
  accessor: "ekycStatus",
@@ -7220,7 +7509,7 @@ const SurveyorDetailsDashboard = () => {
7220
7509
  const status = (value || "NA").toUpperCase();
7221
7510
  return value ? /*#__PURE__*/React.createElement("span", {
7222
7511
  className: "ekyc-status-tag " + status
7223
- }, t(status)) : "-";
7512
+ }, toTitleCase(value)) : "-";
7224
7513
  }
7225
7514
  }, {
7226
7515
  Header: t("SUBMITTED_AT") || "Submitted At",
@@ -7459,6 +7748,7 @@ const SurveyorDetailsDashboard = () => {
7459
7748
  ward: t("WARD") || "Ward",
7460
7749
  pincode: t("PINCODE") || "Pincode",
7461
7750
  mrkey: t("MR_KEY") || "MR Key",
7751
+ consumerType: t("CONSUMER_TYPE") || "Consumer Type",
7462
7752
  createdTime: t("CREATED_TIME") || "Created Time",
7463
7753
  lastModifiedTime: t("LAST_MODIFIED_TIME") || "Last Modified Time"
7464
7754
  };
@@ -7466,8 +7756,9 @@ const SurveyorDetailsDashboard = () => {
7466
7756
  const cleanObj = {};
7467
7757
  const fullName = [item.firstName, item.middleName, item.lastName].filter(Boolean).join(" ");
7468
7758
  if (fullName) {
7469
- cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = fullName;
7759
+ cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = toTitleCase(fullName);
7470
7760
  }
7761
+ const titleCaseFields = ["ekycStatus", "zoneName", "gender", "relationship", "assembly", "ward", "consumerType"];
7471
7762
  Object.keys(item).forEach(key => {
7472
7763
  if (excludedKeys.includes(key)) return;
7473
7764
  const val = item[key];
@@ -7475,7 +7766,11 @@ const SurveyorDetailsDashboard = () => {
7475
7766
  return;
7476
7767
  }
7477
7768
  const friendlyHeader = headerMapping[key] || t(key.toUpperCase()) || key;
7478
- cleanObj[friendlyHeader] = val;
7769
+ if (typeof val === "string" && titleCaseFields.includes(key)) {
7770
+ cleanObj[friendlyHeader] = toTitleCase(val);
7771
+ } else {
7772
+ cleanObj[friendlyHeader] = val;
7773
+ }
7479
7774
  });
7480
7775
  return cleanObj;
7481
7776
  });
@@ -7639,12 +7934,6 @@ const SurveyorDetailsDashboard = () => {
7639
7934
  className: "detail-item"
7640
7935
  }, /*#__PURE__*/React.createElement("span", {
7641
7936
  className: "label"
7642
- }, t("SERVICE_TYPE")), /*#__PURE__*/React.createElement("span", {
7643
- className: "value"
7644
- }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$additionalD = surveyor.additionalDetails) === null || _surveyor$additionalD === void 0 ? void 0 : _surveyor$additionalD.serviceType) || "N/A")), /*#__PURE__*/React.createElement("div", {
7645
- className: "detail-item"
7646
- }, /*#__PURE__*/React.createElement("span", {
7647
- className: "label"
7648
7937
  }, t("VENDOR_NAME") || "Vendor Name"), /*#__PURE__*/React.createElement("span", {
7649
7938
  className: "value"
7650
7939
  }, vendorName)), /*#__PURE__*/React.createElement("div", {
@@ -9120,74 +9409,6 @@ const MeterDetails = _ref => {
9120
9409
  }));
9121
9410
  };
9122
9411
 
9123
- const Home = () => {
9124
- var _Digit$SessionStorage, _Digit$SessionStorage2;
9125
- const _useTranslation = useTranslation(),
9126
- t = _useTranslation.t;
9127
- const propsForModuleCard = {
9128
- moduleName: t("ACTION_TEST_EKYC"),
9129
- kpis: [{
9130
- count: "-",
9131
- label: t("TOTAL_EKYC"),
9132
- link: "/digit-ui/citizen/ekyc/dashboard"
9133
- }],
9134
- links: []
9135
- };
9136
- const citizenInfo = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : (_Digit$SessionStorage2 = _Digit$SessionStorage.info) === null || _Digit$SessionStorage2 === void 0 ? void 0 : _Digit$SessionStorage2.roles;
9137
- const roles = Array.isArray(citizenInfo) ? citizenInfo.map(ele => ele.code) : [];
9138
- if (roles.includes("EKYC_SURVEYOR")) {
9139
- propsForModuleCard.links.push({
9140
- label: t("SURVEYOR_DASHBOARD"),
9141
- link: "/digit-ui/citizen/ekyc/surveyor-dashboard"
9142
- });
9143
- }
9144
- if (roles.includes("EKYC_SUPERVISOR") || roles.includes("EKYC_VENDOR")) {
9145
- propsForModuleCard.links.push({
9146
- label: t("EKYC_INBOX"),
9147
- link: "/digit-ui/citizen/ekyc/inbox"
9148
- });
9149
- }
9150
- if (roles.includes("EKYC_SUPERVISOR")) {
9151
- propsForModuleCard.links.push({
9152
- label: t("EKYC_SUPERVISOR_DASHBOARD"),
9153
- link: "/digit-ui/citizen/ekyc/supervisor-dashboard"
9154
- }, {
9155
- label: t("EKYC_ASSIGN"),
9156
- link: "/digit-ui/citizen/ekyc/assign"
9157
- });
9158
- }
9159
- if (roles.includes("EKYC_VENDOR")) {
9160
- propsForModuleCard.links.push({
9161
- label: t("EKYC_VENDOR_DASHBOARD"),
9162
- link: "/digit-ui/citizen/ekyc/vendor-dashboard"
9163
- });
9164
- }
9165
- if (roles.includes("EKYC_SUPERVISOR") || roles.includes("EKYC_VENDOR")) {
9166
- propsForModuleCard.links.push({
9167
- label: t("TITLE_VENDOR_MANAGEMENT"),
9168
- link: "/digit-ui/citizen/vendor/search-vendor"
9169
- });
9170
- }
9171
- if (roles.length === 1 && roles.includes("CITIZEN")) {
9172
- propsForModuleCard.links.push({
9173
- label: t("EKYC_STATUS"),
9174
- link: "/digit-ui/citizen/ekyc/:id"
9175
- });
9176
- }
9177
- const formattedLinks = propsForModuleCard.links.map(l => ({
9178
- i18nKey: l.label,
9179
- link: l.link,
9180
- count: l.count
9181
- }));
9182
- return /*#__PURE__*/React.createElement(CitizenHomeCard, {
9183
- header: t("EKYC_MODULE_NAME"),
9184
- links: formattedLinks,
9185
- Icon: () => /*#__PURE__*/React.createElement(DocumentIcon, {
9186
- className: "fill-path-primary-main"
9187
- })
9188
- });
9189
- };
9190
-
9191
9412
  const Inbox$1 = _ref => {
9192
9413
  var _formState$tableForm3, _formState$tableForm4, _formState$searchForm3, _formState$searchForm4, _dashboardData$dashbo;
9193
9414
  let parentRoute = _ref.parentRoute;
@@ -9448,7 +9669,9 @@ const Inbox$1 = _ref => {
9448
9669
  }, propsForSearchForm, propsForMobileSortForm, {
9449
9670
  propsForInboxTable,
9450
9671
  propsForInboxMobileCards,
9451
- formState
9672
+ formState,
9673
+ forceTable: true,
9674
+ showSearchOnMobile: true
9452
9675
  })));
9453
9676
  };
9454
9677
 
@@ -9661,7 +9884,8 @@ const EkycStatus = () => {
9661
9884
  }, propsForSearchForm, {
9662
9885
  propsForInboxTable,
9663
9886
  propsForInboxMobileCards,
9664
- formState
9887
+ formState,
9888
+ showSearchOnMobile: true
9665
9889
  })))), errorMsg && /*#__PURE__*/React.createElement("div", {
9666
9890
  className: "ekyc-status-error-msg"
9667
9891
  }, errorMsg), isLoading && /*#__PURE__*/React.createElement(Loader, null), !isLoading && details && /*#__PURE__*/React.createElement(Card, {
@@ -9709,10 +9933,7 @@ const CitizenApp = () => {
9709
9933
  const location = useLocation();
9710
9934
  const _useRouteMatch = useRouteMatch(),
9711
9935
  path = _useRouteMatch.path;
9712
- const _Digit$Hooks$useStore = Digit.Hooks.useStore.getInitData(),
9713
- _Digit$Hooks$useStore2 = _Digit$Hooks$useStore.data,
9714
- _Digit$Hooks$useStore3 = _Digit$Hooks$useStore2 === void 0 ? {} : _Digit$Hooks$useStore2,
9715
- stateInfo = _Digit$Hooks$useStore3.stateInfo;
9936
+ const _Digit$Hooks$useStore = Digit.Hooks.useStore.getInitData();
9716
9937
  sessionStorage.removeItem("revalidateddone");
9717
9938
  const getDynamicBreadcrumbs = () => {
9718
9939
  const pathname = location.pathname;
@@ -9791,44 +10012,23 @@ const CitizenApp = () => {
9791
10012
  }
9792
10013
  return crumbs;
9793
10014
  };
9794
- const isEkycHome = location.pathname === "/digit-ui/citizen/ekyc" || location.pathname === "/digit-ui/citizen/ekyc/";
9795
- if (isEkycHome) {
9796
- const isMobile = window.Digit.Utils.browser.isMobile();
9797
- return (
9798
- /*#__PURE__*/
9799
- React.createElement("div", {
9800
- className: "moduleLinkHomePage"
9801
- }, /*#__PURE__*/React.createElement("div", {
9802
- style: {
9803
- position: "relative"
9804
- }
9805
- }, /*#__PURE__*/React.createElement("img", {
9806
- src: stateInfo === null || stateInfo === void 0 ? void 0 : stateInfo.bannerUrl,
9807
- alt: "noimagefound"
9808
- }), /*#__PURE__*/React.createElement(BackButton, {
9809
- className: "moduleLinkHomePageBackButton"
9810
- }), /*#__PURE__*/React.createElement("div", {
9811
- className: "moduleTitle"
9812
- }, isMobile ? /*#__PURE__*/React.createElement("h4", null, t("MODULE_EKYC")) : /*#__PURE__*/React.createElement("h1", null, t("MODULE_EKYC")))), /*#__PURE__*/React.createElement("div", {
9813
- className: "moduleLinkHomePageModuleLinks"
9814
- }, /*#__PURE__*/React.createElement(Home, null)))
9815
- );
9816
- }
9817
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
9818
- className: "ground-container form-container"
10015
+ return /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement("div", {
10016
+ className: "ground-container form-container",
10017
+ style: {
10018
+ flex: 1
10019
+ }
9819
10020
  }, /*#__PURE__*/React.createElement(ModuleHeader, {
9820
10021
  leftContent: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ArrowLeft, {
9821
10022
  className: "icon"
9822
10023
  }), t("CS_COMMON_BACK")),
9823
10024
  onLeftClick: () => window.history.back(),
9824
10025
  breadcrumbs: getDynamicBreadcrumbs()
9825
- }), /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(PrivateRoute, {
10026
+ }), /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(Route, {
9826
10027
  exact: true,
9827
- path: "" + path,
9828
- component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
9829
- layoutClass: "normal"
9830
- }, /*#__PURE__*/React.createElement(Home, null))
9831
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
10028
+ path: "" + path
10029
+ }, /*#__PURE__*/React.createElement(Redirect, {
10030
+ to: "/digit-ui/citizen/ekyc-home"
10031
+ })), /*#__PURE__*/React.createElement(PrivateRoute, {
9832
10032
  path: [path + "/vendor-dashboard/:vendorId", path + "/vendor-dashboard"],
9833
10033
  component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
9834
10034
  layoutClass: "normal"
@@ -9934,19 +10134,61 @@ const EkycModule = _ref => {
9934
10134
  } else return /*#__PURE__*/React.createElement(CitizenApp, null);
9935
10135
  };
9936
10136
  const EkycLinks = _ref2 => {
9937
- let matchPath = _ref2.matchPath;
10137
+ var _Digit$SessionStorage, _Digit$SessionStorage2;
9938
10138
  const _useTranslation = useTranslation(),
9939
10139
  t = _useTranslation.t;
9940
- const links = [{
9941
- link: matchPath + "/create-kyc",
9942
- i18nKey: t("EKYC_CREATE_KYC")
9943
- }, {
9944
- link: matchPath + "/update-kyc",
9945
- i18nKey: t("EKYC_UPDATE_KYC")
9946
- }];
10140
+ const propsForModuleCard = {
10141
+ links: []
10142
+ };
10143
+ const citizenInfo = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : (_Digit$SessionStorage2 = _Digit$SessionStorage.info) === null || _Digit$SessionStorage2 === void 0 ? void 0 : _Digit$SessionStorage2.roles;
10144
+ const roles = Array.isArray(citizenInfo) ? citizenInfo.map(ele => ele.code) : [];
10145
+ if (roles.includes("EKYC_SURVEYOR")) {
10146
+ propsForModuleCard.links.push({
10147
+ label: t("SURVEYOR_DASHBOARD"),
10148
+ link: "/digit-ui/citizen/ekyc/surveyor-dashboard"
10149
+ });
10150
+ }
10151
+ if (roles.includes("EKYC_SUPERVISOR") || roles.includes("EKYC_VENDOR")) {
10152
+ propsForModuleCard.links.push({
10153
+ label: t("EKYC_INBOX"),
10154
+ link: "/digit-ui/citizen/ekyc/inbox"
10155
+ });
10156
+ }
10157
+ if (roles.includes("EKYC_SUPERVISOR")) {
10158
+ propsForModuleCard.links.push({
10159
+ label: t("EKYC_SUPERVISOR_DASHBOARD"),
10160
+ link: "/digit-ui/citizen/ekyc/supervisor-dashboard"
10161
+ }, {
10162
+ label: t("EKYC_ASSIGN"),
10163
+ link: "/digit-ui/citizen/ekyc/assign"
10164
+ });
10165
+ }
10166
+ if (roles.includes("EKYC_VENDOR")) {
10167
+ propsForModuleCard.links.push({
10168
+ label: t("EKYC_VENDOR_DASHBOARD"),
10169
+ link: "/digit-ui/citizen/ekyc/vendor-dashboard"
10170
+ });
10171
+ }
10172
+ if (roles.includes("EKYC_SUPERVISOR") || roles.includes("EKYC_VENDOR")) {
10173
+ propsForModuleCard.links.push({
10174
+ label: t("TITLE_VENDOR_MANAGEMENT"),
10175
+ link: "/digit-ui/citizen/vendor/search-vendor"
10176
+ });
10177
+ }
10178
+ if (roles.length === 1 && roles.includes("CITIZEN")) {
10179
+ propsForModuleCard.links.push({
10180
+ label: t("EKYC_STATUS"),
10181
+ link: "/digit-ui/citizen/ekyc/:id"
10182
+ });
10183
+ }
10184
+ const formattedLinks = propsForModuleCard.links.map(l => ({
10185
+ i18nKey: l.label,
10186
+ link: l.link,
10187
+ count: l.count
10188
+ }));
9947
10189
  return /*#__PURE__*/React.createElement(CitizenHomeCard, {
9948
10190
  header: t("EKYC_MODULE_NAME"),
9949
- links: links,
10191
+ links: formattedLinks,
9950
10192
  Icon: () => /*#__PURE__*/React.createElement(DocumentIcon, {
9951
10193
  className: "fill-path-primary-main"
9952
10194
  })