@djb25/digit-ui-module-ekyc 1.0.44 → 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.
@@ -4,6 +4,7 @@ import { useHistory, Link, useLocation, useParams, useRouteMatch, Switch, Route,
4
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
 
@@ -155,6 +156,8 @@ const StatusCards = _ref => {
155
156
  total: info.total || 0,
156
157
  completed: info.completed || 0,
157
158
  pending: info.pending || 0,
159
+ submittedCount: info.submittedCount || 0,
160
+ inProgressCount: info.inProgressCount || 0,
158
161
  rejected: info.rejected || 0,
159
162
  active: info.active || 0
160
163
  };
@@ -245,10 +248,12 @@ const StatusCards = _ref => {
245
248
  const pending = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.pending) || (countData === null || countData === void 0 ? void 0 : countData.pending) || 0;
246
249
  const active = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.active) || (countData === null || countData === void 0 ? void 0 : countData.active) || 0;
247
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;
248
253
  const actualCompleted = completed;
249
254
  const approved = actualCompleted;
250
- const efficiency = total > 0 ? Math.round(actualCompleted / total * 100) : 0;
251
- 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;
252
257
  const formatNumber = num => new Intl.NumberFormat("en-IN").format(num || 0);
253
258
  useEffect(() => {
254
259
  if (chartRef1.current) {
@@ -258,11 +263,11 @@ const StatusCards = _ref => {
258
263
  chartInstance1.current = new ChartConstructor(ctx1, {
259
264
  type: "doughnut",
260
265
  data: {
261
- labels: [t("EKYC_ACTIVE"), t("EKYC_PENDING"), t("EKYC_COMPLETED")],
266
+ labels: [t("EKYC_PENDING"), t("EKYC_COMPLETED"), t("EKYC_SUBMITTED"), t("EKYC_INPROCESS")],
262
267
  datasets: [{
263
- data: [active, pending, completed],
264
- backgroundColor: ["#0c2a52", "#77B6EA", "#c8ddf5"],
265
- borderColor: ["#ffffff", "#ffffff", "#ffffff"],
268
+ data: [pending, completed, submitted, inprocess],
269
+ backgroundColor: ["#0c2a52", "#77B6EA", "#c8ddf5", "#49a3fb"],
270
+ borderColor: ["#ffffff", "#ffffff", "#ffffff", "#ffffff"],
266
271
  borderWidth: 2,
267
272
  hoverOffset: 4
268
273
  }]
@@ -284,17 +289,21 @@ const StatusCards = _ref => {
284
289
  };
285
290
  }, [pending, completed, active, t]);
286
291
  const legendItems = [{
287
- color: "#0c2a52",
288
- label: t("EKYC_ACTIVE"),
289
- value: active
290
- }, {
291
292
  color: "#77B6EA",
293
+ label: t("EKYC_COMPLETED"),
294
+ value: completed
295
+ }, {
296
+ color: "#0c2a52",
292
297
  label: t("EKYC_PENDING"),
293
298
  value: pending
294
299
  }, {
295
300
  color: "#c8ddf5",
296
- label: t("EKYC_COMPLETED"),
297
- value: completed
301
+ label: t("EKYC_SUBMITTED"),
302
+ value: submitted
303
+ }, {
304
+ color: "#49a3fb",
305
+ label: t("EKYC_INPROCESS"),
306
+ value: inprocess
298
307
  }];
299
308
  return /*#__PURE__*/React.createElement("div", {
300
309
  className: "ekyc-employee-container"
@@ -316,9 +325,7 @@ const StatusCards = _ref => {
316
325
  className: "total-label"
317
326
  }, t("EKYC_TOTAL_APPLICATIONS") || "Total Applications Processed"), /*#__PURE__*/React.createElement("div", {
318
327
  className: "total-number"
319
- }, formatNumber(total)), /*#__PURE__*/React.createElement("div", {
320
- className: "total-badge"
321
- }, "\u2197 +12.4% ", t("EKYC_FROM_LAST_QUARTER") || "from last quarter"), /*#__PURE__*/React.createElement("button", {
328
+ }, formatNumber(total)), /*#__PURE__*/React.createElement("button", {
322
329
  className: "download-excel-btn",
323
330
  disabled: ekycDownloadLoading,
324
331
  onClick: handleDownloadEkycData
@@ -382,17 +389,13 @@ const StatusCards = _ref => {
382
389
  className: "status-panel"
383
390
  }, /*#__PURE__*/React.createElement("div", {
384
391
  className: "panel-title"
385
- }, t("EKYC_SUBMISSION_HEALTH") || "Submission Health", /*#__PURE__*/React.createElement("span", {
386
- className: "optimal-badge"
387
- }, t("EKYC_OPTIMAL") || "Optimal")), /*#__PURE__*/React.createElement("div", {
392
+ }, t("EKYC_SUBMISSION_HEALTH") || "Submission Health"), /*#__PURE__*/React.createElement("div", {
388
393
  className: "panel-subtitle"
389
394
  }, t("EKYC_PLATFORM_EFFICIENCY") || "Platform operational efficiency"), /*#__PURE__*/React.createElement("div", {
390
395
  className: "health-metrics-row"
391
396
  }, /*#__PURE__*/React.createElement("div", {
392
397
  className: "health-percentage"
393
- }, healthPct, "%"), /*#__PURE__*/React.createElement("div", {
394
- className: "health-trend"
395
- }, "\u2197 +2.1%")), /*#__PURE__*/React.createElement("div", {
398
+ }, healthPct, "%")), /*#__PURE__*/React.createElement("div", {
396
399
  className: "status-progress-bar"
397
400
  }, /*#__PURE__*/React.createElement("div", {
398
401
  className: "progress-fill",
@@ -407,13 +410,13 @@ const StatusCards = _ref => {
407
410
  className: "metric-label"
408
411
  }, t("EKYC_AVG_LATENCY") || "Avg Latency"), /*#__PURE__*/React.createElement("div", {
409
412
  className: "metric-value"
410
- }, "1.2s")), /*#__PURE__*/React.createElement("div", {
413
+ }, "0s")), /*#__PURE__*/React.createElement("div", {
411
414
  className: "metric-box"
412
415
  }, /*#__PURE__*/React.createElement("div", {
413
416
  className: "metric-label"
414
417
  }, t("EKYC_ERROR_RATE") || "Error Rate"), /*#__PURE__*/React.createElement("div", {
415
418
  className: "metric-value"
416
- }, "0.04%")))))));
419
+ }, "0.0%")))))));
417
420
  };
418
421
 
419
422
  const Dashboard = () => {
@@ -6179,6 +6182,16 @@ const AssignEkyc = () => {
6179
6182
  })));
6180
6183
  };
6181
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
+ };
6182
6195
  const AdminDashboard = () => {
6183
6196
  var _Digit$SessionStorage;
6184
6197
  const _useTranslation = useTranslation(),
@@ -6204,7 +6217,13 @@ const AdminDashboard = () => {
6204
6217
  isProgressLoading = _Digit$Hooks$ekyc$use.isLoading;
6205
6218
  const vendorsList = useMemo(() => {
6206
6219
  if (vendorSearchResponse && vendorSearchResponse.length > 0) {
6207
- 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 => {
6208
6227
  var _progressData$supervi, _dso$owner, _v$owner, _dso$owner2;
6209
6228
  const dso = v.dsoDetails || v;
6210
6229
  const supervisorsList = dso.supervisors || [];
@@ -6593,20 +6612,13 @@ const SupervisorDetailsCard = () => {
6593
6612
  setEkycDownloadLoading(true);
6594
6613
  return Promise.resolve(_finallyRethrows(function () {
6595
6614
  return _catch(function () {
6596
- const fetchPromises = surveyors.map(s => Digit.EkycService.application_list({
6615
+ return Promise.resolve(Digit.EkycService.application_list({
6597
6616
  tenantId: tenantId || "dl.djb",
6598
6617
  offset: 0,
6599
- limit: 5000,
6600
- surveyorId: s.surveyorId || s.id,
6618
+ limit: 10000,
6601
6619
  reportDownload: true
6602
- }).catch(err => {
6603
- console.error("Error fetching applications for surveyor " + s.surveyorName + ":", err);
6604
- return {
6605
- consumerList: []
6606
- };
6607
- }));
6608
- return Promise.resolve(Promise.all(fetchPromises)).then(function (results) {
6609
- 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) || [];
6610
6622
  if (consumerList.length === 0) {
6611
6623
  alert(t("NO_DATA_FOUND") || "No data found for download.");
6612
6624
  return;
@@ -6897,9 +6909,11 @@ const SupervisorDetailsCard = () => {
6897
6909
  const AssignEkycModal = _ref => {
6898
6910
  let surveyor = _ref.surveyor,
6899
6911
  closeModal = _ref.closeModal,
6900
- refetchDashboard = _ref.refetchDashboard;
6912
+ refetchDashboard = _ref.refetchDashboard,
6913
+ propsTenantId = _ref.tenantId;
6901
6914
  const _useTranslation = useTranslation(),
6902
6915
  t = _useTranslation.t;
6916
+ const tenantId = propsTenantId || Digit.ULBService.getCurrentTenantId();
6903
6917
  const _useState = useState([]),
6904
6918
  selectedKnos = _useState[0],
6905
6919
  setSelectedKnos = _useState[1];
@@ -6936,16 +6950,15 @@ const AssignEkycModal = _ref => {
6936
6950
  const _useState8 = useState(filters),
6937
6951
  debouncedFilters = _useState8[0],
6938
6952
  setDebouncedFilters = _useState8[1];
6939
- const _Digit$Hooks$ws$useWS = Digit.Hooks.ws.useWSConfigMDMS.ZROLocation("dl.djb"),
6940
- zroLocationsData = _Digit$Hooks$ws$useWS.data,
6941
- 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;
6942
6955
  const mappedZROLocation = useMemo(() => {
6943
6956
  return (zroLocationsData || []).map(item => ({
6944
6957
  code: item.code,
6945
6958
  name: item.name
6946
6959
  }));
6947
6960
  }, [zroLocationsData]);
6948
- const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS("dl.djb", "egov-location", ["TenantBoundary"]),
6961
+ const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
6949
6962
  egovLocationData = _Digit$Hooks$useCommo.data;
6950
6963
  const boundaryData = useMemo(() => {
6951
6964
  var _egovLocationData$ego;
@@ -7023,6 +7036,27 @@ const AssignEkycModal = _ref => {
7023
7036
  });
7024
7037
  return Array.from(pinSet).sort();
7025
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]);
7026
7060
  useEffect(() => {
7027
7061
  const timer = setTimeout(() => {
7028
7062
  setDebouncedFilters(filters);
@@ -7032,7 +7066,7 @@ const AssignEkycModal = _ref => {
7032
7066
  useEffect(() => {
7033
7067
  setCurrentPage(0);
7034
7068
  }, [debouncedFilters, filters.kno]);
7035
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycApplicationList(_extends({
7069
+ const _Digit$Hooks$ekyc$use2 = Digit.Hooks.ekyc.useEkycApplicationList(_extends({
7036
7070
  unassignedOnly: true
7037
7071
  }, filters.kno && {
7038
7072
  kno: filters.kno
@@ -7049,14 +7083,15 @@ const AssignEkycModal = _ref => {
7049
7083
  }, debouncedFilters.pincode && {
7050
7084
  pincode: debouncedFilters.pincode
7051
7085
  }), {
7052
- tenantId: "dl.djb",
7086
+ tenantId: tenantId,
7053
7087
  offset: currentPage * pageSize,
7054
7088
  limit: pageSize
7055
7089
  }, {
7056
7090
  keepPreviousData: true
7057
7091
  }),
7058
- applicationData = _Digit$Hooks$ekyc$use.data,
7059
- 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;
7060
7095
  const handleAssignmentError = (errMsg, variables) => {
7061
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");
7062
7097
  if (isAlreadyAssigned) {
@@ -7101,9 +7136,23 @@ const AssignEkycModal = _ref => {
7101
7136
  setShowToast(true);
7102
7137
  setTimeout(function () {
7103
7138
  try {
7104
- return Promise.resolve(refetchDashboard()).then(function () {
7105
- closeModal();
7106
- });
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));
7107
7156
  } catch (e) {
7108
7157
  return Promise.reject(e);
7109
7158
  }
@@ -7159,7 +7208,7 @@ const AssignEkycModal = _ref => {
7159
7208
  assignmentType = _getAssignmentPayload.assignmentType,
7160
7209
  assignmentValue = _getAssignmentPayload.assignmentValue;
7161
7210
  assignmentMutation.mutate({
7162
- tenantId: "dl.djb",
7211
+ tenantId: tenantId,
7163
7212
  surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner = surveyor.owner) === null || _surveyor$owner === void 0 ? void 0 : _surveyor$owner.uuid,
7164
7213
  assignmentType,
7165
7214
  assignmentValue
@@ -7235,7 +7284,7 @@ const AssignEkycModal = _ref => {
7235
7284
  }),
7236
7285
  actionCancelLabel: "Cancel",
7237
7286
  actionCancelOnSubmit: closeModal,
7238
- actionSaveLabel: "Assign " + selectedKnos.length + " KNOs",
7287
+ actionSaveLabel: t("EKYC_ASSIGN_KNOS") || "Assign KNOs",
7239
7288
  actionSaveOnSubmit: handleAssign,
7240
7289
  isDisabled: !(selectedKnos !== null && selectedKnos !== void 0 && selectedKnos.length)
7241
7290
  }, /*#__PURE__*/React.createElement("div", {
@@ -7253,26 +7302,10 @@ const AssignEkycModal = _ref => {
7253
7302
  onChange: e => handleFilterChange("pincode", e.target.value)
7254
7303
  }, /*#__PURE__*/React.createElement("option", {
7255
7304
  value: ""
7256
- }, "Select Pincode"), fetchedPincodes.map(pin => /*#__PURE__*/React.createElement("option", {
7305
+ }, "Select Pincode"), pincodeOptions.map(pin => /*#__PURE__*/React.createElement("option", {
7257
7306
  key: pin,
7258
7307
  value: pin
7259
7308
  }, pin))), /*#__PURE__*/React.createElement("select", {
7260
- className: "form-control",
7261
- value: filters.zoneName,
7262
- onChange: e => {
7263
- const val = e.target.value;
7264
- setFilters(prev => _extends({}, prev, {
7265
- zoneCode: val,
7266
- zoneName: val
7267
- }));
7268
- },
7269
- disabled: isZroLoading
7270
- }, /*#__PURE__*/React.createElement("option", {
7271
- value: ""
7272
- }, isZroLoading ? "Loading ZRO Locations..." : "Select ZRO Location"), mappedZROLocation.map(loc => /*#__PURE__*/React.createElement("option", {
7273
- key: loc.code,
7274
- value: loc.name
7275
- }, loc.name))), /*#__PURE__*/React.createElement("select", {
7276
7309
  className: "form-control",
7277
7310
  value: filters.ward,
7278
7311
  onChange: e => handleFilterChange("ward", e.target.value)
@@ -7296,16 +7329,20 @@ const AssignEkycModal = _ref => {
7296
7329
  }, "Select Assembly"), assemblyOptions.map(assembly => /*#__PURE__*/React.createElement("option", {
7297
7330
  key: assembly.code,
7298
7331
  value: assembly.name
7299
- }, assembly.name))), /*#__PURE__*/React.createElement("input", {
7332
+ }, assembly.name))), /*#__PURE__*/React.createElement("select", {
7300
7333
  className: "form-control",
7301
- placeholder: "MR Key",
7302
7334
  value: filters.mrkey,
7303
7335
  onChange: e => handleFilterChange("mrkey", e.target.value)
7304
- }), 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", {
7305
7342
  className: "clear-selected-btn",
7306
7343
  type: "button",
7307
7344
  onClick: () => setSelectedKnos([])
7308
- }, t("EKYC_CLEAR_SELECTION") || "Clear Selected (" + selectedKnos.length + ")")), /*#__PURE__*/React.createElement(Table, {
7345
+ }, t("EKYC_CLEAR_SELECTION") || "Clear Selected")), /*#__PURE__*/React.createElement(Table, {
7309
7346
  tableTitle: "eKYC Applications",
7310
7347
  tableClass: "ekycTable",
7311
7348
  data: tableData,