@djb25/digit-ui-module-ekyc 1.0.46 → 1.0.48

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,11 +1,10 @@
1
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
- 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 } from '@djb25/digit-ui-react-components';
3
+ import { useHistory, Link, useParams, useLocation, 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, CardSubHeader, StatusTable, Row, GenericFileIcon, CheckBox, ActionBar, Menu, LinkButton, Toast, EditIcon, UploadFile, FormComposer, VerticalTimeline, Modal, Close, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, LayoutWrapper, CardHeader, CardText, 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 { FaUsers, FaCheckCircle, FaClock, FaExclamationTriangle, FaUserTie, FaChartLine, FaSearch, FaArrowRight, FaMapMarkedAlt } from 'react-icons/fa';
8
- import { ResponsiveContainer, LineChart, CartesianGrid, XAxis, YAxis, Tooltip, Legend, Line, BarChart, Bar, PieChart, Pie, Cell } from 'recharts';
7
+ import { FaUsers, FaCheckCircle, FaClock, FaChartLine } from 'react-icons/fa';
9
8
 
10
9
  const EKYCCard = () => {
11
10
  var _Digit$SessionStorage, _Digit$SessionStorage2;
@@ -70,9 +69,6 @@ const EKYCCard = () => {
70
69
  }
71
70
  } else {
72
71
  links = [{
73
- label: t("CEO_M.F_DOR_FINANCE_VIEW"),
74
- link: prefix + "/ceo-dashboard"
75
- }, {
76
72
  label: t("EKYC_ADMIN_DASHBOARD") || "Admin Dashboard",
77
73
  link: prefix + "/admin-dashboard"
78
74
  }, {
@@ -140,13 +136,14 @@ const StatusCards = _ref => {
140
136
  }
141
137
  const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
142
138
  const fullName = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.name) || "Admin";
139
+ const hasExternalData = countData && typeof countData.total === "number" && typeof countData.submittedCount === "number";
143
140
  const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycSurveyorDashboard({}, {
144
141
  tenantId,
145
142
  offset: 0,
146
143
  limit: 10,
147
144
  ekycStatus: "submitted"
148
145
  }, {
149
- enabled: !!tenantId
146
+ enabled: !!tenantId && !hasExternalData
150
147
  }),
151
148
  dashboardData = _Digit$Hooks$ekyc$use.data;
152
149
  const apiCountData = React.useMemo(() => {
@@ -243,12 +240,12 @@ const StatusCards = _ref => {
243
240
  };
244
241
  const chartRef1 = useRef(null);
245
242
  const chartInstance1 = useRef(null);
246
- 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;
247
- const pending = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.pending) || (countData === null || countData === void 0 ? void 0 : countData.pending) || 0;
248
- const active = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.active) || (countData === null || countData === void 0 ? void 0 : countData.active) || 0;
249
- const completed = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.completed) || (countData === null || countData === void 0 ? void 0 : countData.completed) || 0;
250
- const inprocess = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.inProgressCount) || (countData === null || countData === void 0 ? void 0 : countData.inProgressCount) || 0;
251
- const submitted = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.submittedCount) || (countData === null || countData === void 0 ? void 0 : countData.submittedCount) || 0;
243
+ const total = hasExternalData ? countData.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;
244
+ const pending = hasExternalData ? countData.pending : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.pending) || (countData === null || countData === void 0 ? void 0 : countData.pending) || 0;
245
+ const active = hasExternalData ? countData.active : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.active) || (countData === null || countData === void 0 ? void 0 : countData.active) || 0;
246
+ const completed = hasExternalData ? countData.completed : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.completed) || (countData === null || countData === void 0 ? void 0 : countData.completed) || 0;
247
+ const inprocess = hasExternalData ? countData.inProgressCount : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.inProgressCount) || (countData === null || countData === void 0 ? void 0 : countData.inProgressCount) || 0;
248
+ const submitted = hasExternalData ? countData.submittedCount : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.submittedCount) || (countData === null || countData === void 0 ? void 0 : countData.submittedCount) || 0;
252
249
  const actualCompleted = completed;
253
250
  const approved = actualCompleted;
254
251
  const efficiency = total > 0 ? Math.round((submitted + completed) / total * 100) : 0;
@@ -436,7 +433,9 @@ const Dashboard = () => {
436
433
  completed: info.completed || 0,
437
434
  pending: info.pending || 0,
438
435
  rejected: info.rejected || 0,
439
- active: info.active || 0
436
+ active: info.active || 0,
437
+ submittedCount: info.submittedCount || 0,
438
+ inProgressCount: info.inProgressCount || 0
440
439
  };
441
440
  }, [dashboardData]);
442
441
  return isLoading ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Card, {
@@ -1355,452 +1354,6 @@ const ekycMockData = {
1355
1354
  }]
1356
1355
  };
1357
1356
 
1358
- const ExecutiveLineChart = _ref => {
1359
- let _ref$data = _ref.data,
1360
- data = _ref$data === void 0 ? [] : _ref$data;
1361
- const formattedData = data.map(item => _extends({}, item, {
1362
- agencyKyc: item.completed || 0,
1363
- selfKyc: Math.round((item.completed || 0) * 0.42),
1364
- totalKyc: (item.completed || 0) + Math.round((item.completed || 0) * 0.42)
1365
- }));
1366
- return /*#__PURE__*/React.createElement("div", {
1367
- className: "chart-card executive-line-chart"
1368
- }, /*#__PURE__*/React.createElement(ResponsiveContainer, {
1369
- width: "100%",
1370
- height: 340
1371
- }, /*#__PURE__*/React.createElement(LineChart, {
1372
- data: formattedData,
1373
- margin: {
1374
- top: 20,
1375
- right: 12,
1376
- left: 0,
1377
- bottom: 0
1378
- }
1379
- }, /*#__PURE__*/React.createElement(CartesianGrid, {
1380
- stroke: "#e2e8f0",
1381
- strokeDasharray: "3 3",
1382
- vertical: false
1383
- }), /*#__PURE__*/React.createElement(XAxis, {
1384
- dataKey: "label",
1385
- axisLine: false,
1386
- tickLine: false,
1387
- tick: {
1388
- fill: "#64748b",
1389
- fontSize: 12,
1390
- fontWeight: 600
1391
- }
1392
- }), /*#__PURE__*/React.createElement(YAxis, {
1393
- axisLine: false,
1394
- tickLine: false,
1395
- tick: {
1396
- fill: "#64748b",
1397
- fontSize: 12
1398
- }
1399
- }), /*#__PURE__*/React.createElement(Tooltip, {
1400
- cursor: {
1401
- stroke: "#cbd5e1",
1402
- strokeWidth: 1
1403
- },
1404
- contentStyle: {
1405
- background: "#ffffff",
1406
- border: "1px solid #e2e8f0",
1407
- borderRadius: 18,
1408
- boxShadow: "0 10px 30px rgba(15,23,42,0.08)"
1409
- },
1410
- labelStyle: {
1411
- color: "#0f172a",
1412
- fontWeight: 700,
1413
- marginBottom: 10
1414
- }
1415
- }), /*#__PURE__*/React.createElement(Legend, {
1416
- verticalAlign: "top",
1417
- align: "right",
1418
- iconType: "circle",
1419
- wrapperStyle: {
1420
- paddingBottom: 18,
1421
- color: "#475569",
1422
- fontWeight: 600
1423
- }
1424
- }), /*#__PURE__*/React.createElement(Line, {
1425
- type: "monotone",
1426
- dataKey: "totalKyc",
1427
- name: "Total eKYC",
1428
- stroke: "#0f172a",
1429
- strokeWidth: 4,
1430
- dot: false,
1431
- activeDot: {
1432
- r: 6
1433
- }
1434
- }), /*#__PURE__*/React.createElement(Line, {
1435
- type: "monotone",
1436
- dataKey: "agencyKyc",
1437
- name: "Agency eKYC",
1438
- stroke: "#3b82f6",
1439
- strokeWidth: 3,
1440
- dot: {
1441
- r: 3
1442
- },
1443
- activeDot: {
1444
- r: 6
1445
- }
1446
- }), /*#__PURE__*/React.createElement(Line, {
1447
- type: "monotone",
1448
- dataKey: "selfKyc",
1449
- name: "Self eKYC",
1450
- stroke: "#10b981",
1451
- strokeWidth: 3,
1452
- dot: {
1453
- r: 3
1454
- },
1455
- activeDot: {
1456
- r: 6
1457
- }
1458
- }))));
1459
- };
1460
-
1461
- const ExecutiveBarChart = _ref => {
1462
- let _ref$data = _ref.data,
1463
- data = _ref$data === void 0 ? [] : _ref$data,
1464
- _ref$categories = _ref.categories,
1465
- categories = _ref$categories === void 0 ? [] : _ref$categories,
1466
- _ref$xKey = _ref.xKey,
1467
- xKey = _ref$xKey === void 0 ? "label" : _ref$xKey;
1468
- return /*#__PURE__*/React.createElement("div", {
1469
- className: "chart-card",
1470
- style: {
1471
- minHeight: 320
1472
- }
1473
- }, /*#__PURE__*/React.createElement(ResponsiveContainer, {
1474
- width: "100%",
1475
- height: 320
1476
- }, /*#__PURE__*/React.createElement(BarChart, {
1477
- data: data,
1478
- margin: {
1479
- top: 12,
1480
- right: 16,
1481
- left: 0,
1482
- bottom: 0
1483
- }
1484
- }, /*#__PURE__*/React.createElement(CartesianGrid, {
1485
- stroke: "rgba(148, 163, 184, 0.12)",
1486
- strokeDasharray: "4 4"
1487
- }), /*#__PURE__*/React.createElement(XAxis, {
1488
- dataKey: xKey,
1489
- axisLine: false,
1490
- tickLine: false,
1491
- tick: {
1492
- fill: "#cbd5e1"
1493
- }
1494
- }), /*#__PURE__*/React.createElement(YAxis, {
1495
- axisLine: false,
1496
- tickLine: false,
1497
- tick: {
1498
- fill: "#cbd5e1"
1499
- }
1500
- }), /*#__PURE__*/React.createElement(Tooltip, {
1501
- contentStyle: {
1502
- background: "#0f172a",
1503
- border: "none",
1504
- borderRadius: 14
1505
- },
1506
- itemStyle: {
1507
- color: "#f8fafc"
1508
- }
1509
- }), /*#__PURE__*/React.createElement(Legend, {
1510
- verticalAlign: "top",
1511
- align: "right",
1512
- iconType: "circle",
1513
- wrapperStyle: {
1514
- color: "#cbd5e1"
1515
- }
1516
- }), categories.map((series, index) => /*#__PURE__*/React.createElement(Bar, {
1517
- key: series.key,
1518
- dataKey: series.key,
1519
- name: series.name,
1520
- fill: index === 0 ? "#34d399" : "#60a5fa",
1521
- radius: [12, 12, 0, 0],
1522
- barSize: 24
1523
- })))));
1524
- };
1525
-
1526
- const colors = ["#22c55e", "#38bdf8", "#f97316", "#facc15", "#f43f5e"];
1527
- const ExecutivePieChart = _ref => {
1528
- let _ref$data = _ref.data,
1529
- data = _ref$data === void 0 ? [] : _ref$data,
1530
- _ref$dataKey = _ref.dataKey,
1531
- dataKey = _ref$dataKey === void 0 ? "value" : _ref$dataKey,
1532
- _ref$labelKey = _ref.labelKey,
1533
- labelKey = _ref$labelKey === void 0 ? "label" : _ref$labelKey;
1534
- return /*#__PURE__*/React.createElement("div", {
1535
- className: "chart-card",
1536
- style: {
1537
- minHeight: 320
1538
- }
1539
- }, /*#__PURE__*/React.createElement(ResponsiveContainer, {
1540
- width: "100%",
1541
- height: 320
1542
- }, /*#__PURE__*/React.createElement(PieChart, null, /*#__PURE__*/React.createElement(Pie, {
1543
- data: data,
1544
- dataKey: dataKey,
1545
- nameKey: labelKey,
1546
- cx: "50%",
1547
- cy: "50%",
1548
- outerRadius: 110,
1549
- innerRadius: 60,
1550
- paddingAngle: 3,
1551
- label: {
1552
- fill: "#f8fafc",
1553
- fontSize: 12
1554
- }
1555
- }, data.map((entry, index) => /*#__PURE__*/React.createElement(Cell, {
1556
- key: "cell-" + index,
1557
- fill: colors[index % colors.length]
1558
- }))), /*#__PURE__*/React.createElement(Tooltip, {
1559
- contentStyle: {
1560
- background: "#0f172a",
1561
- border: "none",
1562
- borderRadius: 14,
1563
- color: "#f8fafc"
1564
- }
1565
- }), /*#__PURE__*/React.createElement(Legend, {
1566
- verticalAlign: "bottom",
1567
- align: "center",
1568
- iconType: "circle",
1569
- wrapperStyle: {
1570
- color: "#cbd5e1",
1571
- marginTop: 10
1572
- }
1573
- }))));
1574
- };
1575
-
1576
- const CeoDashboard = () => {
1577
- var _topKpis$todayEkyc;
1578
- const history = useHistory();
1579
- const location = useLocation();
1580
- const _useState = useState(""),
1581
- query = _useState[0],
1582
- setQuery = _useState[1];
1583
- const _useState2 = useState("All"),
1584
- statusFilter = _useState2[0],
1585
- setStatusFilter = _useState2[1];
1586
- const basePath = location.pathname.replace(/\/ceo-dashboard$/, "");
1587
- const filters = ["All", "High Priority", "Stable", "Watchlist"];
1588
- const vendors = useMemo(() => ekycMockData.vendors || [], []);
1589
- const topKpis = useMemo(() => ekycMockData.topKpis || {}, []);
1590
- const dailyTrend = useMemo(() => ekycMockData.dailyTrend || [], []);
1591
- const selfVsAgency = useMemo(() => ekycMockData.selfVsAgency || [], []);
1592
- const pendingVsCompleted = useMemo(() => ekycMockData.pendingVsCompleted || [], []);
1593
- const filteredVendors = useMemo(() => {
1594
- return vendors.filter(vendor => {
1595
- if (statusFilter === "High Priority") return vendor.successRate < 70;
1596
- if (statusFilter === "Watchlist") return vendor.pending > 35000;
1597
- if (statusFilter === "Stable") return vendor.successRate >= 70;
1598
- return true;
1599
- }).filter(vendor => {
1600
- if (!query) return true;
1601
- const keyword = query.toLowerCase();
1602
- return vendor.name.toLowerCase().includes(keyword) || vendor.jurisdictions.some(zone => zone.toLowerCase().includes(keyword)) || vendor.zones.some(zone => {
1603
- var _zone$location;
1604
- return (_zone$location = zone.location) === null || _zone$location === void 0 ? void 0 : _zone$location.toLowerCase().includes(keyword);
1605
- });
1606
- });
1607
- }, [vendors, query, statusFilter]);
1608
- const zoneRows = useMemo(() => {
1609
- return vendors.flatMap(vendor => vendor.zones.map(zone => _extends({}, zone, {
1610
- agency: vendor.name
1611
- }))).filter(row => row.location).sort((a, b) => (b.activeDemand || 0) - (a.activeDemand || 0));
1612
- }, [vendors]);
1613
- const alerts = ["North East District has 22% more pending accounts than last week", "Agency 2 has a 12% improvement opportunity in Self eKYC adoption", "Urgent: 18 supervisor escalations raised for NWS Bhera Enclave", "Risk alert: Rejection trends are rising in Outer North clusters"];
1614
- const routeToVendor = vendorId => {
1615
- history.push(basePath + "/vendors/" + vendorId);
1616
- };
1617
- return /*#__PURE__*/React.createElement("div", {
1618
- className: "ekyc-dashboard-wrapper"
1619
- }, /*#__PURE__*/React.createElement("div", {
1620
- className: "dashboard-shell"
1621
- }, /*#__PURE__*/React.createElement("section", {
1622
- className: "kpi-grid"
1623
- }, [{
1624
- title: "Total Water Connections",
1625
- value: topKpis.totalWaterConnections,
1626
- icon: /*#__PURE__*/React.createElement(FaUsers, null),
1627
- variant: "primary"
1628
- }, {
1629
- title: "Total eKYC Completed",
1630
- value: topKpis.totalEkycCompleted,
1631
- icon: /*#__PURE__*/React.createElement(FaCheckCircle, null),
1632
- variant: "success"
1633
- }, {
1634
- title: "Total Pending",
1635
- value: topKpis.totalPending,
1636
- icon: /*#__PURE__*/React.createElement(FaClock, null),
1637
- variant: "warning"
1638
- }, {
1639
- title: "Total Rejected",
1640
- value: topKpis.totalRejected,
1641
- icon: /*#__PURE__*/React.createElement(FaExclamationTriangle, null),
1642
- variant: "danger"
1643
- }, {
1644
- title: "Agency eKYC Completed",
1645
- value: topKpis.agencyEkycCompleted,
1646
- icon: /*#__PURE__*/React.createElement(FaUserTie, null),
1647
- variant: "info"
1648
- }, {
1649
- title: "Citizen Self eKYC Completed",
1650
- value: topKpis.citizenSelfEkycCompleted,
1651
- icon: /*#__PURE__*/React.createElement(FaUsers, null),
1652
- variant: "secondary"
1653
- }, {
1654
- title: "Today's eKYC",
1655
- value: topKpis.todaysEkyc,
1656
- icon: /*#__PURE__*/React.createElement(FaChartLine, null),
1657
- variant: "muted"
1658
- }, {
1659
- title: "Success Rate",
1660
- value: topKpis.successRate + "%",
1661
- icon: /*#__PURE__*/React.createElement(FaCheckCircle, null),
1662
- variant: "success"
1663
- }, {
1664
- title: "Rejection Percentage",
1665
- value: topKpis.rejectionPercentage + "%",
1666
- icon: /*#__PURE__*/React.createElement(FaExclamationTriangle, null),
1667
- variant: "danger"
1668
- }].map(card => {
1669
- var _card$value$toLocaleS, _card$value, _card$value$toLocaleS2;
1670
- return /*#__PURE__*/React.createElement("article", {
1671
- key: card.title,
1672
- className: "kpi-card card-" + card.variant
1673
- }, /*#__PURE__*/React.createElement("div", {
1674
- className: "kpi-icon"
1675
- }, card.icon), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", {
1676
- className: "kpi-title"
1677
- }, card.title), /*#__PURE__*/React.createElement("h2", null, (_card$value$toLocaleS = (_card$value = card.value) === null || _card$value === void 0 ? void 0 : (_card$value$toLocaleS2 = _card$value.toLocaleString) === null || _card$value$toLocaleS2 === void 0 ? void 0 : _card$value$toLocaleS2.call(_card$value)) != null ? _card$value$toLocaleS : card.value)));
1678
- })), /*#__PURE__*/React.createElement("section", {
1679
- className: "vendor-section"
1680
- }, /*#__PURE__*/React.createElement("div", {
1681
- className: "section-top"
1682
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h2", null, "Agency Performance Snapshot"), /*#__PURE__*/React.createElement("p", null, "Search, filter, and navigate into detailed analytics for every assigned vendor.")), /*#__PURE__*/React.createElement("div", {
1683
- className: "vendor-filters"
1684
- }, /*#__PURE__*/React.createElement("div", {
1685
- className: "search-box"
1686
- }, /*#__PURE__*/React.createElement(FaSearch, null), /*#__PURE__*/React.createElement("input", {
1687
- type: "text",
1688
- placeholder: "Search agency, jurisdiction, location",
1689
- value: query,
1690
- onChange: e => setQuery(e.target.value)
1691
- })), /*#__PURE__*/React.createElement("div", {
1692
- className: "status-pill-group"
1693
- }, filters.map(status => /*#__PURE__*/React.createElement("button", {
1694
- key: status,
1695
- className: "status-pill " + (statusFilter === status ? "active" : ""),
1696
- onClick: () => setStatusFilter(status)
1697
- }, status))))), /*#__PURE__*/React.createElement("div", {
1698
- className: "vendor-grid"
1699
- }, filteredVendors.map(vendor => /*#__PURE__*/React.createElement("div", {
1700
- key: vendor.id,
1701
- className: "vendor-card glass-card",
1702
- onClick: () => routeToVendor(vendor.id)
1703
- }, /*#__PURE__*/React.createElement("div", {
1704
- className: "vendor-card-top"
1705
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", {
1706
- className: "vendor-chip"
1707
- }, vendor.name), /*#__PURE__*/React.createElement("h3", null, vendor.assignedConnections.toLocaleString()), /*#__PURE__*/React.createElement("p", {
1708
- className: "vendor-subtitle"
1709
- }, "Assigned connections across ", vendor.jurisdictions.length, " jurisdiction(s)")), /*#__PURE__*/React.createElement("div", {
1710
- className: "vendor-progress-value"
1711
- }, vendor.progress, "%")), /*#__PURE__*/React.createElement("div", {
1712
- className: "progress-bar"
1713
- }, /*#__PURE__*/React.createElement("div", {
1714
- className: "progress-fill",
1715
- style: {
1716
- width: vendor.progress + "%"
1717
- }
1718
- })), /*#__PURE__*/React.createElement("div", {
1719
- className: "vendor-stats-grid"
1720
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, vendor.completedEkyc.toLocaleString()), /*#__PURE__*/React.createElement("span", null, "Agency eKYC")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, vendor.selfEkyc.toLocaleString()), /*#__PURE__*/React.createElement("span", null, "Self eKYC")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, vendor.pending.toLocaleString()), /*#__PURE__*/React.createElement("span", null, "Pending")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, vendor.rejected.toLocaleString()), /*#__PURE__*/React.createElement("span", null, "Rejected"))), /*#__PURE__*/React.createElement("div", {
1721
- className: "vendor-card-footer"
1722
- }, /*#__PURE__*/React.createElement("span", null, vendor.activeSurveyors, " Surveyors"), /*#__PURE__*/React.createElement("span", null, vendor.supervisors, " Supervisors"), /*#__PURE__*/React.createElement("span", null, vendor.jurisdictions.join(", "))), /*#__PURE__*/React.createElement("div", {
1723
- className: "vendor-card-action"
1724
- }, /*#__PURE__*/React.createElement("span", null, "Explore analytics"), /*#__PURE__*/React.createElement(FaArrowRight, null)))))), /*#__PURE__*/React.createElement("section", {
1725
- className: "analytics-grid"
1726
- }, /*#__PURE__*/React.createElement("div", {
1727
- className: "analytics-panel glass-card"
1728
- }, /*#__PURE__*/React.createElement("div", {
1729
- className: "section-header"
1730
- }, /*#__PURE__*/React.createElement("h2", null, "Daily eKYC Trend"), /*#__PURE__*/React.createElement("span", {
1731
- className: "badge success"
1732
- }, "Live index")), /*#__PURE__*/React.createElement(ExecutiveLineChart, {
1733
- data: dailyTrend,
1734
- dataKey: "completed",
1735
- name: "Completed"
1736
- })), /*#__PURE__*/React.createElement("div", {
1737
- className: "analytics-panel glass-card"
1738
- }, /*#__PURE__*/React.createElement("div", {
1739
- className: "section-header"
1740
- }, /*#__PURE__*/React.createElement("h2", null, "Self vs Agency eKYC"), /*#__PURE__*/React.createElement("span", {
1741
- className: "badge info"
1742
- }, "Adoption")), /*#__PURE__*/React.createElement(ExecutiveBarChart, {
1743
- data: selfVsAgency,
1744
- categories: [{
1745
- key: "agency",
1746
- name: "Agency"
1747
- }, {
1748
- key: "citizen",
1749
- name: "Citizen"
1750
- }]
1751
- })), /*#__PURE__*/React.createElement("div", {
1752
- className: "analytics-panel glass-card"
1753
- }, /*#__PURE__*/React.createElement("div", {
1754
- className: "section-header"
1755
- }, /*#__PURE__*/React.createElement("h2", null, "Pending vs Completed"), /*#__PURE__*/React.createElement("span", {
1756
- className: "badge warning"
1757
- }, "Operational pulse")), /*#__PURE__*/React.createElement(ExecutivePieChart, {
1758
- data: pendingVsCompleted,
1759
- dataKey: "completed",
1760
- labelKey: "label"
1761
- }))), /*#__PURE__*/React.createElement("section", {
1762
- className: "zone-section"
1763
- }, /*#__PURE__*/React.createElement("div", {
1764
- className: "section-header"
1765
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h2", null, /*#__PURE__*/React.createElement(FaMapMarkedAlt, null), " Jurisdiction Performance"), /*#__PURE__*/React.createElement("p", null, "Top zones evaluated from the full agency dataset.")), /*#__PURE__*/React.createElement("button", {
1766
- className: "secondary-button"
1767
- }, "Export Zone Data")), /*#__PURE__*/React.createElement("div", {
1768
- className: "table-wrapper glass-card"
1769
- }, /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", null, "Agency"), /*#__PURE__*/React.createElement("th", null, "Location"), /*#__PURE__*/React.createElement("th", null, "District"), /*#__PURE__*/React.createElement("th", null, "Assigned"), /*#__PURE__*/React.createElement("th", null, "Agency eKYC"), /*#__PURE__*/React.createElement("th", null, "Pending"), /*#__PURE__*/React.createElement("th", null, "Progress"))), /*#__PURE__*/React.createElement("tbody", null, zoneRows.slice(0, 10).map((zone, index) => {
1770
- var _zone$activeDemand$to, _zone$activeDemand, _zone$pppZones$toLoca, _zone$pppZones, _zone$inactiveDemand$, _zone$inactiveDemand;
1771
- return /*#__PURE__*/React.createElement("tr", {
1772
- key: zone.agency + "-" + zone.location + "-" + index
1773
- }, /*#__PURE__*/React.createElement("td", null, zone.agency), /*#__PURE__*/React.createElement("td", null, zone.location), /*#__PURE__*/React.createElement("td", null, zone.district || zone.cluster), /*#__PURE__*/React.createElement("td", null, (_zone$activeDemand$to = (_zone$activeDemand = zone.activeDemand) === null || _zone$activeDemand === void 0 ? void 0 : _zone$activeDemand.toLocaleString()) != null ? _zone$activeDemand$to : "—"), /*#__PURE__*/React.createElement("td", null, (_zone$pppZones$toLoca = (_zone$pppZones = zone.pppZones) === null || _zone$pppZones === void 0 ? void 0 : _zone$pppZones.toLocaleString()) != null ? _zone$pppZones$toLoca : "—"), /*#__PURE__*/React.createElement("td", null, (_zone$inactiveDemand$ = (_zone$inactiveDemand = zone.inactiveDemand) === null || _zone$inactiveDemand === void 0 ? void 0 : _zone$inactiveDemand.toLocaleString()) != null ? _zone$inactiveDemand$ : "—"), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", {
1774
- className: "status-badge success"
1775
- }, Math.min(100, Math.round((zone.pppZones || 0) / Math.max(zone.activeDemand || 1, 1) * 100)), "%")));
1776
- }))))), /*#__PURE__*/React.createElement("section", {
1777
- className: "bottom-grid"
1778
- }, /*#__PURE__*/React.createElement("div", {
1779
- className: "alerts-panel glass-card"
1780
- }, /*#__PURE__*/React.createElement("div", {
1781
- className: "section-header"
1782
- }, /*#__PURE__*/React.createElement("h2", null, /*#__PURE__*/React.createElement(FaExclamationTriangle, null), " Critical Alerts")), /*#__PURE__*/React.createElement("div", {
1783
- className: "alerts-list"
1784
- }, alerts.map(alert => /*#__PURE__*/React.createElement("div", {
1785
- key: alert,
1786
- className: "alert-card"
1787
- }, /*#__PURE__*/React.createElement(FaExclamationTriangle, null), /*#__PURE__*/React.createElement("p", null, alert))))), /*#__PURE__*/React.createElement("div", {
1788
- className: "efficiency-panel glass-card"
1789
- }, /*#__PURE__*/React.createElement("div", {
1790
- className: "section-header"
1791
- }, /*#__PURE__*/React.createElement("h2", null, /*#__PURE__*/React.createElement(FaUserTie, null), " Workforce & Efficiency")), /*#__PURE__*/React.createElement("div", {
1792
- className: "efficiency-grid"
1793
- }, /*#__PURE__*/React.createElement("div", {
1794
- className: "efficiency-box"
1795
- }, /*#__PURE__*/React.createElement("h3", null, "48"), /*#__PURE__*/React.createElement("p", null, "Supervisors Online")), /*#__PURE__*/React.createElement("div", {
1796
- className: "efficiency-box"
1797
- }, /*#__PURE__*/React.createElement("h3", null, "168"), /*#__PURE__*/React.createElement("p", null, "Surveyors Active")), /*#__PURE__*/React.createElement("div", {
1798
- className: "efficiency-box"
1799
- }, /*#__PURE__*/React.createElement("h3", null, (_topKpis$todayEkyc = topKpis.todayEkyc) === null || _topKpis$todayEkyc === void 0 ? void 0 : _topKpis$todayEkyc.toLocaleString()), /*#__PURE__*/React.createElement("p", null, "eKYC Completed Today")), /*#__PURE__*/React.createElement("div", {
1800
- className: "efficiency-box"
1801
- }, /*#__PURE__*/React.createElement("h3", null, topKpis.successRate, "%"), /*#__PURE__*/React.createElement("p", null, "Operational Efficiency")))))));
1802
- };
1803
-
1804
1357
  const downloadSurveyorPDF = function (_ref) {
1805
1358
  let rows = _ref.rows,
1806
1359
  surveyorName = _ref.surveyorName,
@@ -2139,14 +1692,16 @@ const VendorDetailsCard = () => {
2139
1692
  const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
2140
1693
  status: "ACTIVE"
2141
1694
  }, {
2142
- enabled: !!tenantId
1695
+ enabled: !!tenantId,
1696
+ staleTime: 300000
2143
1697
  }),
2144
1698
  vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
2145
1699
  isVendorSearchLoading = _Digit$Hooks$fsm$useD.isLoading;
2146
1700
  const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
2147
1701
  status: "ACTIVE"
2148
1702
  }, {
2149
- enabled: !!tenantId
1703
+ enabled: !!tenantId,
1704
+ staleTime: 300000
2150
1705
  }),
2151
1706
  supervisorSearchResponse = _Digit$Hooks$fsm$useS.data,
2152
1707
  isSupervisorSearchLoading = _Digit$Hooks$fsm$useS.isLoading;
@@ -2234,7 +1789,7 @@ const VendorDetailsCard = () => {
2234
1789
  }, [vendor]);
2235
1790
  const zoneIds = useMemo(() => {
2236
1791
  var _vendor$zoneIds;
2237
- 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";
1792
+ return vendor !== null && vendor !== void 0 && (_vendor$zoneIds = vendor.zoneIds) !== null && _vendor$zoneIds !== void 0 && _vendor$zoneIds.length ? vendor.zoneIds.filter(Boolean).map(zone => String(zone).toUpperCase().replace("", " ")).join(", ") : "N/A";
2238
1793
  }, [vendor]);
2239
1794
  const cards = useMemo(() => {
2240
1795
  const hasRealData = vendorSupervisors.some(s => s.totalKnos > 0);
@@ -3236,9 +2791,29 @@ const useInboxMobileCardsData = _ref => {
3236
2791
  };
3237
2792
  };
3238
2793
 
3239
- const Inbox = _ref => {
2794
+ const StatCard = _ref => {
2795
+ let title = _ref.title,
2796
+ value = _ref.value,
2797
+ type = _ref.type,
2798
+ isLoading = _ref.isLoading,
2799
+ icon = _ref.icon;
2800
+ return /*#__PURE__*/React.createElement("div", {
2801
+ className: "stat-card " + type
2802
+ }, isLoading ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
2803
+ className: "stat-title skeleton skeleton-text"
2804
+ }), /*#__PURE__*/React.createElement("div", {
2805
+ className: "stat-value skeleton skeleton-number"
2806
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
2807
+ className: "stat-title"
2808
+ }, title), /*#__PURE__*/React.createElement("div", {
2809
+ className: "stat-value"
2810
+ }, value), icon && /*#__PURE__*/React.createElement("div", {
2811
+ className: "stat-icon"
2812
+ }, icon)));
2813
+ };
2814
+ const Inbox = _ref2 => {
3240
2815
  var _formState$tableForm3, _formState$tableForm4, _formState$searchForm3, _formState$searchForm4;
3241
- let parentRoute = _ref.parentRoute;
2816
+ let parentRoute = _ref2.parentRoute;
3242
2817
  const tenantId = Digit.ULBService.getCurrentTenantId();
3243
2818
  const location = useLocation();
3244
2819
  const formInitValue = {
@@ -3275,6 +2850,12 @@ const Inbox = _ref => {
3275
2850
  isListLoading = _Digit$Hooks$ekyc$use.isLoading,
3276
2851
  _Digit$Hooks$ekyc$use2 = _Digit$Hooks$ekyc$use.data,
3277
2852
  listData = _Digit$Hooks$ekyc$use2 === void 0 ? {} : _Digit$Hooks$ekyc$use2;
2853
+ const _Digit$Hooks$ekyc$use3 = Digit.Hooks.ekyc.useEkycAssignmentProgress({
2854
+ enabled: !!tenantId,
2855
+ keepPreviousData: true
2856
+ }),
2857
+ isProgressLoading = _Digit$Hooks$ekyc$use3.isLoading,
2858
+ progressData = _Digit$Hooks$ekyc$use3.data;
3278
2859
  const searchDetails = useMemo(() => {
3279
2860
  var _formState$searchForm, _formState$searchForm2;
3280
2861
  return {
@@ -3283,15 +2864,15 @@ const Inbox = _ref => {
3283
2864
  };
3284
2865
  }, [formState === null || formState === void 0 ? void 0 : (_formState$searchForm3 = formState.searchForm) === null || _formState$searchForm3 === void 0 ? void 0 : _formState$searchForm3.kNumber, formState === null || formState === void 0 ? void 0 : (_formState$searchForm4 = formState.searchForm) === null || _formState$searchForm4 === void 0 ? void 0 : _formState$searchForm4.kName]);
3285
2866
  const isSearchActive = !!(searchDetails.kno || searchDetails.name);
3286
- const _Digit$Hooks$ekyc$use3 = Digit.Hooks.ekyc.useSearchConnection({
2867
+ const _Digit$Hooks$ekyc$use4 = Digit.Hooks.ekyc.useSearchConnection({
3287
2868
  tenantId,
3288
2869
  details: searchDetails
3289
2870
  }, {
3290
2871
  enabled: !!tenantId && !!searchDetails.kno,
3291
2872
  keepPreviousData: true
3292
2873
  }),
3293
- isSearchLoading = _Digit$Hooks$ekyc$use3.isLoading,
3294
- searchData = _Digit$Hooks$ekyc$use3.data;
2874
+ isSearchLoading = _Digit$Hooks$ekyc$use4.isLoading,
2875
+ searchData = _Digit$Hooks$ekyc$use4.data;
3295
2876
  const sourceData = useMemo(() => {
3296
2877
  if (isSearchActive) {
3297
2878
  if (!searchData) return [];
@@ -3329,12 +2910,67 @@ const Inbox = _ref => {
3329
2910
  });
3330
2911
  });
3331
2912
  }, [sourceData]);
2913
+ const _useTranslation = useTranslation(),
2914
+ t = _useTranslation.t;
2915
+ const supervisor = useMemo(() => {
2916
+ var _Digit$SessionStorage, _loggedInUser$roles;
2917
+ const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
2918
+ const roles = (loggedInUser === null || loggedInUser === void 0 ? void 0 : (_loggedInUser$roles = loggedInUser.roles) === null || _loggedInUser$roles === void 0 ? void 0 : _loggedInUser$roles.map(ele => ele.code)) || [];
2919
+ if (roles.includes("EKYC_SUPERVISOR")) {
2920
+ const targetId = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid;
2921
+ if (progressData !== null && progressData !== void 0 && progressData.supervisorReport && targetId) {
2922
+ const report = progressData.supervisorReport.find(s => {
2923
+ var _s$supervisorId, _s$id;
2924
+ return ((_s$supervisorId = s.supervisorId) === null || _s$supervisorId === void 0 ? void 0 : _s$supervisorId.toLowerCase()) === (targetId === null || targetId === void 0 ? void 0 : targetId.toLowerCase()) || ((_s$id = s.id) === null || _s$id === void 0 ? void 0 : _s$id.toLowerCase()) === (targetId === null || targetId === void 0 ? void 0 : targetId.toLowerCase());
2925
+ });
2926
+ if (report) return report;
2927
+ }
2928
+ }
2929
+ if (progressData !== null && progressData !== void 0 && progressData.supervisorReport) {
2930
+ const totalKnos = progressData.supervisorReport.reduce((acc, r) => acc + (r.totalKnos || 0), 0);
2931
+ const submittedKnos = progressData.supervisorReport.reduce((acc, r) => acc + (r.submittedKnos || 0), 0);
2932
+ const pendingKnos = progressData.supervisorReport.reduce((acc, r) => acc + (r.pendingKnos || 0), 0);
2933
+ const progressPercent = totalKnos > 0 ? Math.round(submittedKnos / totalKnos * 100) : 0;
2934
+ return {
2935
+ totalKnos,
2936
+ submittedKnos,
2937
+ pendingKnos,
2938
+ progressPercent
2939
+ };
2940
+ }
2941
+ return null;
2942
+ }, [progressData]);
2943
+ const cards = useMemo(() => [{
2944
+ label: t("TOTAL_EKYC_APPLICATIONS"),
2945
+ count: (supervisor === null || supervisor === void 0 ? void 0 : supervisor.totalKnos) || 0,
2946
+ color: "#0B2559",
2947
+ type: "today",
2948
+ icon: /*#__PURE__*/React.createElement(FaUsers, null)
2949
+ }, {
2950
+ label: t("EKYC_COMPLETED"),
2951
+ count: (supervisor === null || supervisor === void 0 ? void 0 : supervisor.submittedKnos) || 0,
2952
+ color: "#10B981",
2953
+ type: "month",
2954
+ icon: /*#__PURE__*/React.createElement(FaCheckCircle, null)
2955
+ }, {
2956
+ label: t("PENDING_APPLICATIONS"),
2957
+ count: (supervisor === null || supervisor === void 0 ? void 0 : supervisor.pendingKnos) || 0,
2958
+ color: "#F59E0B",
2959
+ type: "pending",
2960
+ icon: /*#__PURE__*/React.createElement(FaClock, null)
2961
+ }, {
2962
+ label: t("OVERALL_PROGRESS"),
2963
+ count: ((supervisor === null || supervisor === void 0 ? void 0 : supervisor.progressPercent) || 0) + "%",
2964
+ color: "#A855F7",
2965
+ type: "progress",
2966
+ icon: /*#__PURE__*/React.createElement(FaChartLine, null)
2967
+ }], [supervisor]);
3332
2968
  const totalRecords = (listData === null || listData === void 0 ? void 0 : listData.totalCount) || 0;
3333
2969
  const checkPathName = location.pathname.includes("ekyc/inbox");
3334
- const SearchFormFields = useCallback(_ref2 => {
3335
- let registerRef = _ref2.registerRef,
3336
- searchFormState = _ref2.searchFormState,
3337
- controlSearchForm = _ref2.controlSearchForm;
2970
+ const SearchFormFields = useCallback(_ref3 => {
2971
+ let registerRef = _ref3.registerRef,
2972
+ searchFormState = _ref3.searchFormState,
2973
+ controlSearchForm = _ref3.controlSearchForm;
3338
2974
  return /*#__PURE__*/React.createElement(SearchFormFieldsComponents, {
3339
2975
  registerRef,
3340
2976
  searchFormState,
@@ -3487,7 +3123,27 @@ const Inbox = _ref => {
3487
3123
  const isInboxLoading = isListLoading || isSearchLoading;
3488
3124
  return /*#__PURE__*/React.createElement("div", {
3489
3125
  className: "app-container"
3490
- }, /*#__PURE__*/React.createElement(InboxComposer, _extends({
3126
+ }, /*#__PURE__*/React.createElement("div", {
3127
+ className: "surveyor-dashboard",
3128
+ style: {
3129
+ overflowY: "visible",
3130
+ marginBottom: "24px"
3131
+ }
3132
+ }, /*#__PURE__*/React.createElement("div", {
3133
+ className: "stats-wrapper",
3134
+ style: {
3135
+ display: "flex",
3136
+ gap: "16px",
3137
+ flexWrap: "wrap"
3138
+ }
3139
+ }, cards.map((card, idx) => /*#__PURE__*/React.createElement(StatCard, {
3140
+ key: idx,
3141
+ title: t(card.label),
3142
+ value: card.count,
3143
+ type: card.type,
3144
+ isLoading: isProgressLoading,
3145
+ icon: card.icon
3146
+ })))), /*#__PURE__*/React.createElement(InboxComposer, _extends({
3491
3147
  isInboxLoading
3492
3148
  }, propsForSearchForm, propsForMobileSortForm, {
3493
3149
  propsForInboxTable,
@@ -3499,939 +3155,206 @@ const Inbox = _ref => {
3499
3155
  })));
3500
3156
  };
3501
3157
 
3502
- const MOCK_SURVEYORS = [{
3503
- name: "Amit Kumar",
3504
- id: "SVR001",
3505
- role: "Surveyor"
3506
- }, {
3507
- name: "Sanjay Singh",
3508
- id: "SVR002",
3509
- role: "Surveyor"
3510
- }, {
3511
- name: "Rahul Sharma",
3512
- id: "SVR003",
3513
- role: "Surveyor"
3514
- }, {
3515
- name: "Priya Verma",
3516
- id: "SVR004",
3517
- role: "Surveyor"
3518
- }];
3519
- const MOCK_MRDS = [{
3520
- name: "MRD - 01 (Central Zone)",
3521
- code: "MRD01",
3522
- zone: "Central"
3523
- }, {
3524
- name: "MRD - 02 (North Zone)",
3525
- code: "MRD02",
3526
- zone: "North"
3527
- }, {
3528
- name: "MRD - 03 (South Zone)",
3529
- code: "MRD03",
3530
- zone: "South"
3531
- }, {
3532
- name: "MRD - 04 (West Zone)",
3533
- code: "MRD04",
3534
- zone: "West"
3535
- }, {
3536
- name: "MRD - 05 (East Zone)",
3537
- code: "MRD05",
3538
- zone: "East"
3539
- }, {
3540
- name: "MRD - 06 (Rohini)",
3541
- code: "MRD06",
3542
- zone: "Rohini"
3543
- }, {
3544
- name: "MRD - 07 (Dwarka)",
3545
- code: "MRD07",
3546
- zone: "Dwarka"
3547
- }];
3548
- const Mapping = () => {
3549
- const _useTranslation = useTranslation(),
3550
- t = _useTranslation.t;
3551
- const _useState = useState(null),
3552
- selectedSurveyor = _useState[0],
3553
- setSelectedSurveyor = _useState[1];
3554
- const _useState2 = useState(null),
3555
- selectedMRD = _useState2[0],
3556
- setSelectedMRD = _useState2[1];
3557
- const _useState3 = useState([]),
3558
- mappings = _useState3[0],
3559
- setMappings = _useState3[1];
3560
- const _useState4 = useState(null),
3561
- editingId = _useState4[0],
3562
- setEditingId = _useState4[1];
3563
- const _useState5 = useState(null),
3564
- editSurveyor = _useState5[0],
3565
- setEditSurveyor = _useState5[1];
3566
- const _useState6 = useState(null),
3567
- editMRD = _useState6[0],
3568
- setEditMRD = _useState6[1];
3569
- const _useState7 = useState(null),
3570
- deleteTarget = _useState7[0],
3571
- setDeleteTarget = _useState7[1];
3572
- const _useState8 = useState(null),
3573
- toast = _useState8[0],
3574
- setToast = _useState8[1];
3575
- const handleAddMapping = () => {
3576
- if (!selectedSurveyor || !selectedMRD) {
3577
- setToast({
3578
- type: "error",
3579
- message: t("EKYC_SELECT_BOTH_ERROR") || "Please select both Surveyor and MRD"
3580
- });
3581
- return;
3582
- }
3583
- const exists = mappings.some(m => m.surveyorId === selectedSurveyor.id && m.mrdCode === selectedMRD.code);
3584
- if (exists) {
3585
- setToast({
3586
- type: "warning",
3587
- message: t("EKYC_MAPPING_EXISTS") || "This mapping already exists"
3588
- });
3589
- return;
3590
- }
3591
- setMappings(prev => [...prev, {
3592
- id: Date.now(),
3593
- surveyorName: selectedSurveyor.name,
3594
- surveyorId: selectedSurveyor.id,
3595
- mrdName: selectedMRD.name,
3596
- mrdCode: selectedMRD.code,
3597
- zone: selectedMRD.zone
3598
- }]);
3599
- setSelectedMRD(null);
3600
- setSelectedSurveyor(null);
3601
- setToast({
3602
- type: "success",
3603
- message: t("EKYC_MAPPING_ADDED") || "Mapping added successfully"
3604
- });
3605
- };
3606
- const handleEditStart = row => {
3607
- setEditingId(row.id);
3608
- setEditSurveyor(MOCK_SURVEYORS.find(s => s.id === row.surveyorId) || null);
3609
- setEditMRD(MOCK_MRDS.find(m => m.code === row.mrdCode) || null);
3158
+ const ActionButton = _ref => {
3159
+ let jumpTo = _ref.jumpTo,
3160
+ state = _ref.state;
3161
+ const history = useHistory();
3162
+ function routeTo() {
3163
+ history.push(jumpTo, _extends({}, state, {
3164
+ isEditing: true
3165
+ }));
3166
+ }
3167
+ return /*#__PURE__*/React.createElement(LinkButton, {
3168
+ label: /*#__PURE__*/React.createElement(EditIcon, {
3169
+ style: {
3170
+ width: "20px",
3171
+ height: "20px",
3172
+ fill: "#F47738"
3173
+ }
3174
+ }),
3175
+ style: {
3176
+ margin: 0,
3177
+ padding: 0
3178
+ },
3179
+ onClick: routeTo
3180
+ });
3181
+ };
3182
+ const checkForNA = value => value !== null && value !== undefined && value !== "" ? value : "N/A";
3183
+ const boolToYesNo = (value, t) => {
3184
+ if (value === true || value === "true" || String(value).toLowerCase() === "yes") return t("CORE_COMMON_YES");
3185
+ if (value === false || value === "false" || String(value).toLowerCase() === "no") return t("CORE_COMMON_NO");
3186
+ if (value === "true") return t("CORE_COMMON_YES");
3187
+ if (value === "false") return t("CORE_COMMON_NO");
3188
+ };
3189
+ const extractReviewData = (searchData, flowState) => {
3190
+ const rawData = searchData && Object.keys(searchData).length > 0 ? searchData : (flowState === null || flowState === void 0 ? void 0 : flowState.reviewData) || {};
3191
+ const reviewWrapper = (rawData === null || rawData === void 0 ? void 0 : rawData.applicationReviewInfo) || (rawData === null || rawData === void 0 ? void 0 : rawData.applicationReview) || rawData;
3192
+ const applicationData = (Array.isArray(reviewWrapper) ? reviewWrapper[0] : reviewWrapper) || {};
3193
+ return {
3194
+ newData: (applicationData === null || applicationData === void 0 ? void 0 : applicationData.newData) || applicationData,
3195
+ oldData: (applicationData === null || applicationData === void 0 ? void 0 : applicationData.oldData) || null
3610
3196
  };
3611
- const handleEditSave = id => {
3612
- if (!editSurveyor || !editMRD) {
3613
- setToast({
3614
- type: "error",
3615
- message: t("EKYC_SELECT_BOTH_ERROR") || "Please select both Surveyor and MRD to save"
3616
- });
3617
- return;
3197
+ };
3198
+ const ReviewSection = _ref2 => {
3199
+ let title = _ref2.title,
3200
+ fields = _ref2.fields,
3201
+ newData = _ref2.newData,
3202
+ oldData = _ref2.oldData,
3203
+ t = _ref2.t,
3204
+ jumpTo = _ref2.jumpTo,
3205
+ state = _ref2.state,
3206
+ hideEditButton = _ref2.hideEditButton;
3207
+ return /*#__PURE__*/React.createElement("div", {
3208
+ className: "review-section-wrapper",
3209
+ style: {
3210
+ marginBottom: "48px",
3211
+ background: "#fff",
3212
+ borderRadius: "12px",
3213
+ border: "1px solid #EAECF0",
3214
+ overflow: "hidden"
3618
3215
  }
3619
- const duplicate = mappings.some(m => m.id !== id && m.surveyorId === editSurveyor.id && m.mrdCode === editMRD.code);
3620
- if (duplicate) {
3621
- setToast({
3622
- type: "warning",
3623
- message: t("EKYC_MAPPING_EXISTS") || "This mapping already exists"
3624
- });
3625
- return;
3216
+ }, /*#__PURE__*/React.createElement("div", {
3217
+ style: {
3218
+ padding: "20px 24px",
3219
+ background: "#F9FAFB",
3220
+ borderBottom: "1px solid #EAECF0",
3221
+ display: "flex",
3222
+ justifyContent: "space-between",
3223
+ alignItems: "center"
3626
3224
  }
3627
- setMappings(prev => prev.map(m => m.id !== id ? m : _extends({}, m, {
3628
- surveyorName: editSurveyor.name,
3629
- surveyorId: editSurveyor.id,
3630
- mrdName: editMRD.name,
3631
- mrdCode: editMRD.code,
3632
- zone: editMRD.zone
3633
- })));
3634
- setEditingId(null);
3635
- setToast({
3636
- type: "success",
3637
- message: t("EKYC_MAPPING_UPDATED") || "Mapping updated successfully"
3638
- });
3639
- };
3640
- const handleEditCancel = () => {
3641
- setEditingId(null);
3642
- setEditSurveyor(null);
3643
- setEditMRD(null);
3644
- };
3645
- const handleDeleteConfirm = () => {
3646
- setMappings(prev => prev.filter(m => m.id !== deleteTarget.id));
3647
- setDeleteTarget(null);
3648
- setToast({
3649
- type: "success",
3650
- message: t("EKYC_MAPPING_REMOVED") || "Mapping removed"
3651
- });
3652
- };
3653
- const handleSaveMappings = () => {
3654
- if (mappings.length === 0) {
3655
- setToast({
3656
- type: "error",
3657
- message: t("EKYC_NO_MAPPINGS_TO_SAVE") || "No mappings to save"
3658
- });
3659
- return;
3225
+ }, /*#__PURE__*/React.createElement(CardSubHeader, {
3226
+ style: {
3227
+ margin: 0,
3228
+ fontSize: "18px",
3229
+ color: "#101828",
3230
+ fontWeight: "700"
3660
3231
  }
3661
- setToast({
3662
- type: "success",
3663
- message: t("EKYC_MAPPINGS_SAVED_SUCCESS") || "Surveyor mappings saved successfully!"
3664
- });
3665
- };
3666
- const columns = useMemo(() => [{
3667
- Header: t("EKYC_SURVEYOR_NAME") || "Surveyor",
3668
- accessor: "surveyorName",
3669
- Cell: _ref => {
3670
- let row = _ref.row;
3671
- const isEditing = editingId === row.original.id;
3672
- if (isEditing) {
3673
- return /*#__PURE__*/React.createElement(Dropdown, {
3674
- selected: editSurveyor,
3675
- select: setEditSurveyor,
3676
- option: MOCK_SURVEYORS,
3677
- optionKey: "name",
3678
- t: t,
3679
- placeholder: t("EKYC_SELECT_SURVEYOR_PLACEHOLDER") || "Choose surveyor..."
3680
- });
3681
- }
3682
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
3683
- className: "link"
3684
- }, row.original.surveyorName), /*#__PURE__*/React.createElement("div", {
3685
- style: {
3686
- fontSize: "12px",
3687
- color: "#666"
3688
- }
3689
- }, row.original.surveyorId));
3232
+ }, title), jumpTo && !hideEditButton && /*#__PURE__*/React.createElement(ActionButton, {
3233
+ jumpTo: jumpTo,
3234
+ state: state
3235
+ })), /*#__PURE__*/React.createElement("div", {
3236
+ style: {
3237
+ padding: "0 24px"
3690
3238
  }
3691
- }, {
3692
- Header: t("EKYC_MRD_ASSIGNED") || "MRD Assigned",
3693
- accessor: "mrdName",
3694
- Cell: _ref2 => {
3695
- let row = _ref2.row;
3696
- const isEditing = editingId === row.original.id;
3697
- if (isEditing) {
3698
- return /*#__PURE__*/React.createElement(Dropdown, {
3699
- selected: editMRD,
3700
- select: setEditMRD,
3701
- option: MOCK_MRDS,
3702
- optionKey: "name",
3703
- t: t,
3704
- placeholder: t("EKYC_SELECT_MRD_PLACEHOLDER") || "Choose MRD..."
3705
- });
3706
- }
3707
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, row.original.mrdName), /*#__PURE__*/React.createElement("div", {
3708
- style: {
3709
- fontSize: "12px",
3710
- color: "#666"
3711
- }
3712
- }, row.original.zone));
3713
- }
3714
- }, {
3715
- Header: t("ES_COMMON_ACTION") || "Actions",
3716
- Cell: _ref3 => {
3717
- let row = _ref3.row;
3718
- const isEditing = editingId === row.original.id;
3719
- if (isEditing) {
3720
- return /*#__PURE__*/React.createElement("div", {
3721
- style: {
3722
- display: "flex",
3723
- gap: "10px"
3724
- }
3725
- }, /*#__PURE__*/React.createElement("span", {
3726
- style: {
3727
- cursor: "pointer",
3728
- color: "#f47738",
3729
- fontWeight: "bold"
3730
- },
3731
- onClick: () => handleEditSave(row.original.id)
3732
- }, t("ES_COMMON_SAVE")), /*#__PURE__*/React.createElement("span", {
3733
- style: {
3734
- cursor: "pointer",
3735
- color: "#505A5F",
3736
- fontWeight: "bold"
3737
- },
3738
- onClick: handleEditCancel
3739
- }, t("ES_COMMON_CANCEL")));
3740
- }
3741
- return /*#__PURE__*/React.createElement("div", {
3742
- style: {
3743
- display: "flex",
3744
- gap: "16px"
3745
- }
3746
- }, /*#__PURE__*/React.createElement("span", {
3747
- onClick: () => handleEditStart(row.original),
3748
- style: {
3749
- cursor: "pointer"
3750
- }
3751
- }, /*#__PURE__*/React.createElement(EditIcon, {
3752
- className: "icon",
3753
- fill: "#f47738"
3754
- })), /*#__PURE__*/React.createElement("span", {
3755
- onClick: () => setDeleteTarget(row.original),
3756
- style: {
3757
- cursor: "pointer"
3758
- }
3759
- }, /*#__PURE__*/React.createElement(DeleteIcon, {
3760
- className: "icon",
3761
- fill: "#f47738"
3762
- })));
3239
+ }, /*#__PURE__*/React.createElement("table", {
3240
+ style: {
3241
+ width: "100%",
3242
+ borderCollapse: "collapse",
3243
+ tableLayout: "fixed"
3763
3244
  }
3764
- }], [editingId, editSurveyor, editMRD, mappings, t]);
3765
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
3766
- className: "side-panel-item"
3767
- }, /*#__PURE__*/React.createElement(Card, {
3768
- className: "employeeCard filter inboxLinks",
3245
+ }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
3769
3246
  style: {
3770
- marginTop: "16px"
3247
+ padding: "16px 0",
3248
+ textAlign: "left",
3249
+ color: "#667085",
3250
+ fontSize: "12px",
3251
+ fontWeight: "600",
3252
+ textTransform: "uppercase",
3253
+ width: "30%"
3771
3254
  }
3772
- }, /*#__PURE__*/React.createElement("div", {
3773
- className: "complaint-links-container"
3774
- }, /*#__PURE__*/React.createElement("div", {
3775
- className: "header",
3255
+ }, t("EKYC_FIELD_NAME")), /*#__PURE__*/React.createElement("th", {
3776
3256
  style: {
3777
- marginBottom: "0px"
3257
+ padding: "16px 0",
3258
+ textAlign: "left",
3259
+ color: "#667085",
3260
+ fontSize: "12px",
3261
+ fontWeight: "600",
3262
+ textTransform: "uppercase",
3263
+ width: "35%"
3778
3264
  }
3779
- }, /*#__PURE__*/React.createElement("span", {
3780
- className: "logo"
3781
- }, /*#__PURE__*/React.createElement("svg", {
3782
- width: "24",
3783
- height: "24",
3784
- viewBox: "0 0 24 24",
3785
- fill: "none",
3786
- xmlns: "http://www.w3.org/2000/svg"
3787
- }, /*#__PURE__*/React.createElement("path", {
3788
- d: "M4 19.5A2.5 2.5 0 0 1 6.5 17H20",
3789
- stroke: "white",
3790
- strokeWidth: "2",
3791
- strokeLinecap: "round",
3792
- strokeLinejoin: "round"
3793
- }), /*#__PURE__*/React.createElement("path", {
3794
- d: "M6.5 2H20V22H6.5A2.5 2.5 0 0 1 4 19.5V4.5A2.5 2.5 0 0 1 6.5 2Z",
3795
- stroke: "white",
3796
- strokeWidth: "2",
3797
- strokeLinecap: "round",
3798
- strokeLinejoin: "round"
3799
- }))), /*#__PURE__*/React.createElement("span", {
3800
- className: "text"
3801
- }, t("EKYC_SURVEYOR_MAPPING") || "Surveyor Mapping"))))), /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(CardHeader, null, t("EKYC_NEW_MAPPING") || "New Mapping"), /*#__PURE__*/React.createElement(CardText, null, t("EKYC_MAPPING_SUBHEADER") || "Assign Meter Reading Dairies to surveyors to manage their data access."), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, t("EKYC_SELECT_SURVEYOR") || "Select Surveyor", " *"), /*#__PURE__*/React.createElement("div", {
3802
- className: ""
3803
- }, /*#__PURE__*/React.createElement(Dropdown, {
3804
- selected: selectedSurveyor,
3805
- select: setSelectedSurveyor,
3806
- option: MOCK_SURVEYORS,
3807
- optionKey: "name",
3808
- t: t,
3809
- placeholder: t("EKYC_SELECT_SURVEYOR_PLACEHOLDER") || "Choose a surveyor..."
3810
- }))), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, null, t("EKYC_SELECT_MRD") || "Select MRD", " *"), /*#__PURE__*/React.createElement("div", {
3811
- className: "field"
3812
- }, /*#__PURE__*/React.createElement(Dropdown, {
3813
- selected: selectedMRD,
3814
- select: setSelectedMRD,
3815
- option: MOCK_MRDS,
3816
- optionKey: "name",
3817
- t: t,
3818
- placeholder: t("EKYC_SELECT_MRD_PLACEHOLDER") || "Choose an MRD..."
3819
- }))), /*#__PURE__*/React.createElement("div", {
3265
+ }, t("EKYC_EXISTING_INFORMATION")), /*#__PURE__*/React.createElement("th", {
3820
3266
  style: {
3821
- display: "flex",
3822
- justifyContent: "flex-end",
3823
- marginTop: "24px"
3267
+ padding: "16px 0",
3268
+ textAlign: "left",
3269
+ color: "#667085",
3270
+ fontSize: "12px",
3271
+ fontWeight: "600",
3272
+ textTransform: "uppercase",
3273
+ width: "35%"
3824
3274
  }
3825
- }, /*#__PURE__*/React.createElement(SubmitBar, {
3826
- label: t("EKYC_ADD_TO_LIST") || "Add to Mapping List",
3827
- onSubmit: handleAddMapping,
3828
- disabled: !selectedSurveyor || !selectedMRD
3829
- }))), mappings.length > 0 && /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(CardHeader, null, t("EKYC_MAPPING_SUMMARY") || "Mapping Summary", " (", mappings.length, ")"), /*#__PURE__*/React.createElement(Table, {
3830
- t: t,
3831
- data: mappings,
3832
- columns: columns,
3833
- getCellProps: cellInfo => {
3834
- return {
3835
- style: {
3836
- padding: "10px",
3837
- fontSize: "16px"
3838
- }
3839
- };
3840
- },
3841
- tableClassName: "table digit-table"
3842
- })), mappings.length > 0 && /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
3843
- label: t("EKYC_SAVE_MAPPINGS") || "Save Mappings",
3844
- onSubmit: handleSaveMappings
3845
- })), deleteTarget && /*#__PURE__*/React.createElement(Modal, {
3846
- headerBarMain: t("EKYC_REMOVE_MAPPING") || "Remove Mapping",
3847
- headerBarEnd: /*#__PURE__*/React.createElement("span", {
3848
- onClick: () => setDeleteTarget(null),
3275
+ }, t("EKYC_PROPOSED_UPDATES")))), /*#__PURE__*/React.createElement("tbody", null, fields.map((field, idx) => {
3276
+ const valNew = newData === null || newData === void 0 ? void 0 : newData[field.key];
3277
+ const valOld = oldData === null || oldData === void 0 ? void 0 : oldData[field.key];
3278
+ const isChanged = oldData && String(valNew) !== String(valOld) && valOld !== undefined && valOld !== null;
3279
+ return /*#__PURE__*/React.createElement("tr", {
3280
+ key: idx,
3849
3281
  style: {
3850
- cursor: "pointer",
3851
- padding: "8px"
3282
+ borderTop: "1px solid #F2F4F7"
3852
3283
  }
3853
- }, "X"),
3854
- actionSaveLabel: t("ES_COMMON_REMOVE"),
3855
- actionSaveOnSubmit: handleDeleteConfirm,
3856
- actionCancelLabel: t("ES_COMMON_CANCEL"),
3857
- actionCancelOnSubmit: () => setDeleteTarget(null),
3858
- style: {
3859
- borderRadius: "12px"
3860
- }
3861
- }, /*#__PURE__*/React.createElement(CardText, {
3862
- style: {
3863
- marginTop: "16px",
3864
- marginBottom: "16px"
3865
- }
3866
- }, t("EKYC_REMOVE_MAPPING_CONFIRM_MSG") || "Are you sure you want to remove the mapping between ", /*#__PURE__*/React.createElement("strong", null, deleteTarget === null || deleteTarget === void 0 ? void 0 : deleteTarget.surveyorName), " and ", /*#__PURE__*/React.createElement("strong", null, deleteTarget === null || deleteTarget === void 0 ? void 0 : deleteTarget.mrdName), "?")), toast && /*#__PURE__*/React.createElement(Toast, {
3867
- label: toast.message,
3868
- error: toast.type === "error",
3869
- warning: toast.type === "warning",
3870
- info: toast.type === "info",
3871
- isDsc: true,
3872
- onClose: () => setToast(null)
3873
- }));
3284
+ }, /*#__PURE__*/React.createElement("td", {
3285
+ style: {
3286
+ padding: "16px 0",
3287
+ fontSize: "14px",
3288
+ color: "#344054",
3289
+ fontWeight: "500"
3290
+ }
3291
+ }, t(field.label)), /*#__PURE__*/React.createElement("td", {
3292
+ style: {
3293
+ padding: "16px 0",
3294
+ fontSize: "14px",
3295
+ color: "#667085"
3296
+ }
3297
+ }, field.isBool ? boolToYesNo(valOld, t) : checkForNA(valOld)), /*#__PURE__*/React.createElement("td", {
3298
+ style: {
3299
+ padding: "16px 0",
3300
+ fontSize: "14px",
3301
+ color: isChanged ? "#1B8B32" : "#101828",
3302
+ fontWeight: isChanged ? "700" : "400"
3303
+ }
3304
+ }, /*#__PURE__*/React.createElement("div", {
3305
+ style: {
3306
+ display: "flex",
3307
+ alignItems: "center",
3308
+ gap: "8px"
3309
+ }
3310
+ }, field.isBool ? boolToYesNo(valNew, t) : checkForNA(valNew), isChanged && /*#__PURE__*/React.createElement("span", {
3311
+ style: {
3312
+ background: "#ECFDF3",
3313
+ color: "#067647",
3314
+ padding: "2px 8px",
3315
+ borderRadius: "12px",
3316
+ fontSize: "10px",
3317
+ fontWeight: "600"
3318
+ }
3319
+ }, t("EKYC_CHANGED")))));
3320
+ })))));
3874
3321
  };
3875
-
3876
- const ConnectionDetailsView = _ref => {
3877
- let kNumber = _ref.kNumber,
3878
- kName = _ref.kName,
3879
- connectionDetails = _ref.connectionDetails,
3880
- isLoading = _ref.isLoading;
3322
+ const Review = () => {
3323
+ var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _newDataRaw$connectio, _newDataRaw$connectio2, _newDataRaw$connectio3, _newDataRaw$address, _newDataRaw$address2, _newDataRaw$address3, _newDataRaw$address4, _newDataRaw$address5, _newDataRaw$address6, _newDataRaw$address7, _newDataRaw$address8, _newDataRaw$address9, _newDataRaw$address0, _newDataRaw$address1, _newDataRaw$address10, _newDataRaw$address11, _newDataRaw$address12, _newDataRaw$address13, _newDataRaw$address14, _newDataRaw$property, _newDataRaw$property2, _editedProperty$conne, _newDataRaw$property3, _editedProperty$conne2, _newDataRaw$property4, _editedProperty$userT, _newDataRaw$property5, _editedProperty$noOfF, _newDataRaw$property6, _newDataRaw$property7, _newDataRaw$meter, _editedMeter$meterSta, _newDataRaw$meter2, _newDataRaw$meter3, _newDataRaw$meter4, _newDataRaw$meter5, _editedMeter$workingS, _newDataRaw$meter6, _editedMeter$lastBill, _newDataRaw$meter7, _newDataRaw$meter8;
3881
3324
  const _useTranslation = useTranslation(),
3882
3325
  t = _useTranslation.t;
3883
3326
  const history = useHistory();
3884
- const _useRouteMatch = useRouteMatch(),
3885
- path = _useRouteMatch.path;
3327
+ const location = useLocation();
3328
+ let _useParams = useParams(),
3329
+ kno = _useParams.kno,
3330
+ applicationId = _useParams.applicationId;
3886
3331
  const _useState = useState(false),
3887
- showModal = _useState[0],
3888
- setShowModal = _useState[1];
3889
- const _useState2 = useState({
3890
- code: "SELF",
3891
- name: "EKYC_SELF"
3332
+ agree = _useState[0],
3333
+ setAgree = _useState[1];
3334
+ const _useState2 = useState(false),
3335
+ isSubmitting = _useState2[0];
3336
+ const _useState3 = useState(false),
3337
+ showPreview = _useState3[0],
3338
+ setShowPreview = _useState3[1];
3339
+ const _useState4 = useState(""),
3340
+ previewUrl = _useState4[0],
3341
+ setPreviewUrl = _useState4[1];
3342
+ const _useState5 = useState(false),
3343
+ showOptions = _useState5[0],
3344
+ setShowOptions = _useState5[1];
3345
+ const _useState6 = useState(false),
3346
+ showToast = _useState6[0],
3347
+ setShowToast = _useState6[1];
3348
+ const _useState7 = useState({
3349
+ error: false,
3350
+ label: ""
3892
3351
  }),
3893
- selectedOption = _useState2[0],
3894
- setSelectedOption = _useState2[1];
3352
+ toastData = _useState7[0],
3353
+ setToastData = _useState7[1];
3895
3354
  const options = [{
3896
- code: "SELF",
3897
- name: "EKYC_SELF"
3355
+ action: t("APPROVE")
3898
3356
  }, {
3899
- code: "OTHER",
3900
- name: "EKYC_OTHER"
3901
- }];
3902
- const handleStartVerification = () => setShowModal(true);
3903
- const onModalConfirm = () => {
3904
- const parentPath = path.includes("/create-kyc") ? path.replace("/create-kyc", "") : path.replace("/k-details", "");
3905
- history.push(parentPath + "/consumer-details", {
3906
- kNumber,
3907
- selectedOption,
3908
- connectionDetails
3909
- });
3910
- setShowModal(false);
3911
- };
3912
- if (isLoading) return /*#__PURE__*/React.createElement(Loader, null);
3913
- if (!connectionDetails) return null;
3914
- const details = (connectionDetails === null || connectionDetails === void 0 ? void 0 : connectionDetails.connectionDetails) || {};
3915
- const statusFlag = details.statusflag || "";
3916
- const isActive = (statusFlag === null || statusFlag === void 0 ? void 0 : statusFlag.toLowerCase()) === "active" || statusFlag === "A";
3917
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
3918
- className: "ekyc-employee-container"
3919
- }, /*#__PURE__*/React.createElement("div", {
3920
- className: "connection-details-card"
3921
- }, /*#__PURE__*/React.createElement("div", {
3922
- className: "details-card-header"
3923
- }, /*#__PURE__*/React.createElement("div", {
3924
- className: "header-title-wrapper"
3925
- }, /*#__PURE__*/React.createElement("div", {
3926
- className: "header-icon-bg"
3927
- }, /*#__PURE__*/React.createElement("svg", {
3928
- width: "16",
3929
- height: "16",
3930
- viewBox: "0 0 24 24",
3931
- fill: "none",
3932
- stroke: "#3A7BD5",
3933
- strokeWidth: "2",
3934
- strokeLinecap: "round",
3935
- strokeLinejoin: "round"
3936
- }, /*#__PURE__*/React.createElement("path", {
3937
- d: "M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"
3938
- }), /*#__PURE__*/React.createElement("circle", {
3939
- cx: "12",
3940
- cy: "7",
3941
- r: "4"
3942
- }))), /*#__PURE__*/React.createElement("span", {
3943
- className: "header-title-text"
3944
- }, t("EKYC_K_NUMBER_DETAILS") || "Consumer Identity Details")), /*#__PURE__*/React.createElement("span", {
3945
- className: "status-badge " + (isActive ? "active" : "inactive")
3946
- }, isActive ? t("EKYC_ACTIVE_CONNECTION") || "Active Connection" : statusFlag || t("CS_NA"))), /*#__PURE__*/React.createElement("div", {
3947
- className: "details-card-body"
3948
- }, /*#__PURE__*/React.createElement("div", {
3949
- className: "body-content-row"
3950
- }, /*#__PURE__*/React.createElement("div", {
3951
- className: "detail-section"
3952
- }, /*#__PURE__*/React.createElement("div", {
3953
- className: "section-title"
3954
- }, t("EKYC_VERIFICATION_PARAMETERS") || "Verification Parameters"), /*#__PURE__*/React.createElement("div", {
3955
- className: "data-grid"
3956
- }, /*#__PURE__*/React.createElement("div", {
3957
- className: "data-item"
3958
- }, /*#__PURE__*/React.createElement("div", {
3959
- className: "data-label"
3960
- }, t("EKYC_CONSUMER_NAME") || "Consumer Name"), /*#__PURE__*/React.createElement("div", {
3961
- className: "data-value"
3962
- }, details.consumerName || kName || t("CS_NA"))), /*#__PURE__*/React.createElement("div", {
3963
- className: "data-item"
3964
- }, /*#__PURE__*/React.createElement("div", {
3965
- className: "data-label"
3966
- }, t("EKYC_K_NUMBER") || "K Number"), /*#__PURE__*/React.createElement("div", {
3967
- className: "data-value blue"
3968
- }, kNumber || t("CS_NA"))), /*#__PURE__*/React.createElement("div", {
3969
- className: "data-item"
3970
- }, /*#__PURE__*/React.createElement("div", {
3971
- className: "data-label"
3972
- }, t("EKYC_METER_NO") || "Meter Serial No."), /*#__PURE__*/React.createElement("div", {
3973
- className: "data-value"
3974
- }, details.meterNumber || t("CS_NA"))), /*#__PURE__*/React.createElement("div", {
3975
- className: "data-item"
3976
- }, /*#__PURE__*/React.createElement("div", {
3977
- className: "data-label"
3978
- }, t("EKYC_CONNECTION_TYPE") || "Connection Type"), /*#__PURE__*/React.createElement("div", {
3979
- className: "data-value"
3980
- }, details.connectionType || t("CS_NA"))))), /*#__PURE__*/React.createElement("div", {
3981
- className: "vertical-divider"
3982
- }), /*#__PURE__*/React.createElement("div", {
3983
- className: "detail-section"
3984
- }, /*#__PURE__*/React.createElement("div", {
3985
- className: "section-title"
3986
- }, t("EKYC_ADDRESS_AND_CONTACT") || "Address & Contact"), /*#__PURE__*/React.createElement("div", {
3987
- className: "address-block"
3988
- }, /*#__PURE__*/React.createElement("div", {
3989
- className: "icon-wrapper-small"
3990
- }, /*#__PURE__*/React.createElement("svg", {
3991
- width: "16",
3992
- height: "16",
3993
- viewBox: "0 0 24 24",
3994
- fill: "none",
3995
- stroke: "#6B7B8E",
3996
- strokeWidth: "2",
3997
- strokeLinecap: "round",
3998
- strokeLinejoin: "round"
3999
- }, /*#__PURE__*/React.createElement("path", {
4000
- d: "M21 10c0 7-9 13-9 13S3 17 3 10a9 9 0 0 1 18 0z"
4001
- }), /*#__PURE__*/React.createElement("circle", {
4002
- cx: "12",
4003
- cy: "10",
4004
- r: "3"
4005
- }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
4006
- className: "data-label"
4007
- }, t("EKYC_ADDRESS") || "Service Address"), /*#__PURE__*/React.createElement("div", {
4008
- className: "address-text"
4009
- }, details.address || t("CS_NA")))), /*#__PURE__*/React.createElement("div", {
4010
- className: "contact-row"
4011
- }, /*#__PURE__*/React.createElement("div", {
4012
- className: "contact-item"
4013
- }, /*#__PURE__*/React.createElement("div", {
4014
- className: "icon-wrapper-small"
4015
- }, /*#__PURE__*/React.createElement("svg", {
4016
- width: "16",
4017
- height: "16",
4018
- viewBox: "0 0 24 24",
4019
- fill: "none",
4020
- stroke: "#6B7B8E",
4021
- strokeWidth: "2",
4022
- strokeLinecap: "round",
4023
- strokeLinejoin: "round"
4024
- }, /*#__PURE__*/React.createElement("rect", {
4025
- x: "5",
4026
- y: "2",
4027
- width: "14",
4028
- height: "20",
4029
- rx: "2",
4030
- ry: "2"
4031
- }), /*#__PURE__*/React.createElement("line", {
4032
- x1: "12",
4033
- y1: "18",
4034
- x2: "12.01",
4035
- y2: "18"
4036
- }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
4037
- className: "data-label"
4038
- }, t("EKYC_PHONE_NO") || "Contact"), /*#__PURE__*/React.createElement("div", {
4039
- className: "address-text"
4040
- }, details.phoneNumber || t("CS_NA")))), /*#__PURE__*/React.createElement("div", {
4041
- className: "contact-item"
4042
- }, /*#__PURE__*/React.createElement("div", {
4043
- className: "icon-wrapper-small"
4044
- }, /*#__PURE__*/React.createElement("svg", {
4045
- width: "16",
4046
- height: "16",
4047
- viewBox: "0 0 24 24",
4048
- fill: "none",
4049
- stroke: "#6B7B8E",
4050
- strokeWidth: "2",
4051
- strokeLinecap: "round",
4052
- strokeLinejoin: "round"
4053
- }, /*#__PURE__*/React.createElement("circle", {
4054
- cx: "12",
4055
- cy: "12",
4056
- r: "4"
4057
- }), /*#__PURE__*/React.createElement("path", {
4058
- d: "M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-3.92 7.94"
4059
- }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
4060
- className: "data-label"
4061
- }, t("EKYC_EMAIL") || "Email Address"), /*#__PURE__*/React.createElement("div", {
4062
- className: "address-text"
4063
- }, details.email || t("CS_NA")))))))), /*#__PURE__*/React.createElement("div", {
4064
- className: "details-card-footer"
4065
- }, /*#__PURE__*/React.createElement("div", {
4066
- className: "footer-meta-text"
4067
- }, connectionDetails !== null && connectionDetails !== void 0 && connectionDetails.lastVerified ? (t("EKYC_LAST_VERIFIED") || "Last verified:") + " " + connectionDetails.lastVerified : ""), /*#__PURE__*/React.createElement("div", {
4068
- className: "action-btns-container",
4069
- style: {
4070
- fontSize: "12px"
4071
- }
4072
- }, /*#__PURE__*/React.createElement("button", {
4073
- onClick: handleStartVerification,
4074
- className: "primary-action-btn",
4075
- style: {
4076
- fontSize: "12px"
4077
- }
4078
- }, t("EKYC_START_REVIEW") || "Start Review", /*#__PURE__*/React.createElement("svg", {
4079
- width: "16",
4080
- height: "16",
4081
- viewBox: "0 0 24 24",
4082
- fill: "none",
4083
- stroke: "currentColor",
4084
- strokeWidth: "2.5",
4085
- strokeLinecap: "round",
4086
- strokeLinejoin: "round"
4087
- }, /*#__PURE__*/React.createElement("line", {
4088
- x1: "5",
4089
- y1: "12",
4090
- x2: "19",
4091
- y2: "12"
4092
- }), /*#__PURE__*/React.createElement("polyline", {
4093
- points: "12 5 19 12 12 19"
4094
- }))))))), showModal && /*#__PURE__*/React.createElement(Modal, {
4095
- headerBarMain: t("EKYC_SELECT_VERIFICATION_TYPE"),
4096
- headerBarEnd: /*#__PURE__*/React.createElement("span", {
4097
- onClick: () => setShowModal(false),
4098
- style: {
4099
- cursor: "pointer",
4100
- padding: "8px"
4101
- }
4102
- }, "X"),
4103
- actionSaveLabel: t("ES_COMMON_CONFIRM"),
4104
- actionSaveOnSubmit: onModalConfirm,
4105
- actionCancelLabel: t("ES_COMMON_CANCEL"),
4106
- actionCancelOnSubmit: () => setShowModal(false),
4107
- style: {
4108
- borderRadius: "12px"
4109
- }
4110
- }, /*#__PURE__*/React.createElement("div", {
4111
- style: {
4112
- padding: "24px"
4113
- }
4114
- }, /*#__PURE__*/React.createElement(RadioButtons, {
4115
- name: "verificationType",
4116
- options: options,
4117
- optionsKey: "name",
4118
- selectedOption: selectedOption,
4119
- onSelect: setSelectedOption,
4120
- style: {
4121
- display: "flex",
4122
- flexDirection: "column",
4123
- gap: "12px",
4124
- buttonStyle: {
4125
- borderRadius: "5px"
4126
- }
4127
- },
4128
- t: t
4129
- }))));
4130
- };
4131
-
4132
- const Create = () => {
4133
- const _useTranslation = useTranslation(),
4134
- t = _useTranslation.t;
4135
- const _useState = useState(() => {
4136
- const saved = sessionStorage.getItem("EKYC_CREATE_SEARCH_PARAMS");
4137
- return saved ? JSON.parse(saved) : {
4138
- kNumber: "",
4139
- kName: ""
4140
- };
4141
- }),
4142
- searchParams = _useState[0],
4143
- setSearchParams = _useState[1];
4144
- const _useState2 = useState(() => {
4145
- return sessionStorage.getItem("EKYC_CREATE_SEARCH_PERFORMED") === "true";
4146
- }),
4147
- searchPerformed = _useState2[0],
4148
- setSearchPerformed = _useState2[1];
4149
- const _useState3 = useState(null),
4150
- showToast = _useState3[0],
4151
- setShowToast = _useState3[1];
4152
- const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("EKYC_CREATE", {}),
4153
- clearParams = _Digit$Hooks$useSessi[2];
4154
- const tenantId = Digit.ULBService.getCurrentTenantId();
4155
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useSearchConnection({
4156
- tenantId,
4157
- details: {
4158
- kno: searchParams.kNumber,
4159
- name: searchParams.kName
4160
- }
4161
- }, {
4162
- enabled: searchPerformed && !!searchParams.kNumber && !!searchParams.kName,
4163
- onError: error => {
4164
- var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
4165
- setShowToast({
4166
- error: true,
4167
- label: (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : (_error$response$data$ = _error$response$data.Errors) === null || _error$response$data$ === void 0 ? void 0 : (_error$response$data$2 = _error$response$data$[0]) === null || _error$response$data$2 === void 0 ? void 0 : _error$response$data$2.message) || t("EKYC_SEARCH_ERROR_PLEASE_ENTER_THE_CORRECT_CREDENTIALS")
4168
- });
4169
- setSearchPerformed(false);
4170
- sessionStorage.removeItem("EKYC_CREATE_SEARCH_PERFORMED");
4171
- }
4172
- }),
4173
- isSearching = _Digit$Hooks$ekyc$use.isLoading,
4174
- connectionDetails = _Digit$Hooks$ekyc$use.data;
4175
- const handleSearch = params => {
4176
- if (!params.kNumber && !params.kName) {
4177
- setSearchParams({
4178
- kNumber: "",
4179
- kName: ""
4180
- });
4181
- setSearchPerformed(false);
4182
- sessionStorage.removeItem("EKYC_CREATE_SEARCH_PARAMS");
4183
- sessionStorage.removeItem("EKYC_CREATE_SEARCH_PERFORMED");
4184
- clearParams();
4185
- return;
4186
- }
4187
- if (!params.kNumber || !params.kName) {
4188
- setShowToast({
4189
- error: true,
4190
- label: t("EKYC_FILL_ALL_FIELDS")
4191
- });
4192
- return;
4193
- }
4194
- setSearchParams(params);
4195
- setSearchPerformed(true);
4196
- const currentKno = sessionStorage.getItem("EKYC_K_NUMBER");
4197
- if (currentKno !== params.kNumber) {
4198
- clearParams();
4199
- Object.keys(sessionStorage).forEach(key => {
4200
- if (key.startsWith("EKYC_") && key !== "EKYC_CREATE") sessionStorage.removeItem(key);
4201
- });
4202
- }
4203
- sessionStorage.setItem("EKYC_CREATE_SEARCH_PARAMS", JSON.stringify(params));
4204
- sessionStorage.setItem("EKYC_CREATE_SEARCH_PERFORMED", "true");
4205
- sessionStorage.setItem("EKYC_K_NUMBER", params.kNumber);
4206
- };
4207
- const closeToast = () => {
4208
- setShowToast(null);
4209
- };
4210
- return /*#__PURE__*/React.createElement(SearchConsumer, {
4211
- onSearch: handleSearch,
4212
- searchParams: searchParams
4213
- }, searchPerformed && /*#__PURE__*/React.createElement(ConnectionDetailsView, {
4214
- kNumber: searchParams.kNumber,
4215
- kName: searchParams.kName,
4216
- connectionDetails: connectionDetails,
4217
- isLoading: isSearching
4218
- }), !searchPerformed && !isSearching && /*#__PURE__*/React.createElement(Card, {
4219
- style: {
4220
- textAlign: "center",
4221
- padding: "40px"
4222
- }
4223
- }, /*#__PURE__*/React.createElement("div", {
4224
- style: {
4225
- color: "#667085"
4226
- }
4227
- }, t("EKYC_SEARCH_TO_VIEW_DETAILS"))), showToast && /*#__PURE__*/React.createElement(Toast, {
4228
- error: showToast.error,
4229
- label: showToast.label,
4230
- onClose: closeToast,
4231
- isDsc: true
4232
- }));
4233
- };
4234
-
4235
- const ActionButton = _ref => {
4236
- let jumpTo = _ref.jumpTo,
4237
- state = _ref.state;
4238
- const history = useHistory();
4239
- function routeTo() {
4240
- history.push(jumpTo, _extends({}, state, {
4241
- isEditing: true
4242
- }));
4243
- }
4244
- return /*#__PURE__*/React.createElement(LinkButton, {
4245
- label: /*#__PURE__*/React.createElement(EditIcon, {
4246
- style: {
4247
- width: "20px",
4248
- height: "20px",
4249
- fill: "#F47738"
4250
- }
4251
- }),
4252
- style: {
4253
- margin: 0,
4254
- padding: 0
4255
- },
4256
- onClick: routeTo
4257
- });
4258
- };
4259
- const checkForNA = value => value !== null && value !== undefined && value !== "" ? value : "N/A";
4260
- const boolToYesNo = (value, t) => {
4261
- if (value === true || value === "true" || String(value).toLowerCase() === "yes") return t("CORE_COMMON_YES");
4262
- if (value === false || value === "false" || String(value).toLowerCase() === "no") return t("CORE_COMMON_NO");
4263
- if (value === "true") return t("CORE_COMMON_YES");
4264
- if (value === "false") return t("CORE_COMMON_NO");
4265
- };
4266
- const extractReviewData = (searchData, flowState) => {
4267
- const rawData = searchData && Object.keys(searchData).length > 0 ? searchData : (flowState === null || flowState === void 0 ? void 0 : flowState.reviewData) || {};
4268
- const reviewWrapper = (rawData === null || rawData === void 0 ? void 0 : rawData.applicationReviewInfo) || (rawData === null || rawData === void 0 ? void 0 : rawData.applicationReview) || rawData;
4269
- const applicationData = (Array.isArray(reviewWrapper) ? reviewWrapper[0] : reviewWrapper) || {};
4270
- return {
4271
- newData: (applicationData === null || applicationData === void 0 ? void 0 : applicationData.newData) || applicationData,
4272
- oldData: (applicationData === null || applicationData === void 0 ? void 0 : applicationData.oldData) || null
4273
- };
4274
- };
4275
- const ReviewSection = _ref2 => {
4276
- let title = _ref2.title,
4277
- fields = _ref2.fields,
4278
- newData = _ref2.newData,
4279
- oldData = _ref2.oldData,
4280
- t = _ref2.t,
4281
- jumpTo = _ref2.jumpTo,
4282
- state = _ref2.state,
4283
- hideEditButton = _ref2.hideEditButton;
4284
- return /*#__PURE__*/React.createElement("div", {
4285
- className: "review-section-wrapper",
4286
- style: {
4287
- marginBottom: "48px",
4288
- background: "#fff",
4289
- borderRadius: "12px",
4290
- border: "1px solid #EAECF0",
4291
- overflow: "hidden"
4292
- }
4293
- }, /*#__PURE__*/React.createElement("div", {
4294
- style: {
4295
- padding: "20px 24px",
4296
- background: "#F9FAFB",
4297
- borderBottom: "1px solid #EAECF0",
4298
- display: "flex",
4299
- justifyContent: "space-between",
4300
- alignItems: "center"
4301
- }
4302
- }, /*#__PURE__*/React.createElement(CardSubHeader, {
4303
- style: {
4304
- margin: 0,
4305
- fontSize: "18px",
4306
- color: "#101828",
4307
- fontWeight: "700"
4308
- }
4309
- }, title), jumpTo && !hideEditButton && /*#__PURE__*/React.createElement(ActionButton, {
4310
- jumpTo: jumpTo,
4311
- state: state
4312
- })), /*#__PURE__*/React.createElement("div", {
4313
- style: {
4314
- padding: "0 24px"
4315
- }
4316
- }, /*#__PURE__*/React.createElement("table", {
4317
- style: {
4318
- width: "100%",
4319
- borderCollapse: "collapse",
4320
- tableLayout: "fixed"
4321
- }
4322
- }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
4323
- style: {
4324
- padding: "16px 0",
4325
- textAlign: "left",
4326
- color: "#667085",
4327
- fontSize: "12px",
4328
- fontWeight: "600",
4329
- textTransform: "uppercase",
4330
- width: "30%"
4331
- }
4332
- }, t("EKYC_FIELD_NAME")), /*#__PURE__*/React.createElement("th", {
4333
- style: {
4334
- padding: "16px 0",
4335
- textAlign: "left",
4336
- color: "#667085",
4337
- fontSize: "12px",
4338
- fontWeight: "600",
4339
- textTransform: "uppercase",
4340
- width: "35%"
4341
- }
4342
- }, t("EKYC_EXISTING_INFORMATION")), /*#__PURE__*/React.createElement("th", {
4343
- style: {
4344
- padding: "16px 0",
4345
- textAlign: "left",
4346
- color: "#667085",
4347
- fontSize: "12px",
4348
- fontWeight: "600",
4349
- textTransform: "uppercase",
4350
- width: "35%"
4351
- }
4352
- }, t("EKYC_PROPOSED_UPDATES")))), /*#__PURE__*/React.createElement("tbody", null, fields.map((field, idx) => {
4353
- const valNew = newData === null || newData === void 0 ? void 0 : newData[field.key];
4354
- const valOld = oldData === null || oldData === void 0 ? void 0 : oldData[field.key];
4355
- const isChanged = oldData && String(valNew) !== String(valOld) && valOld !== undefined && valOld !== null;
4356
- return /*#__PURE__*/React.createElement("tr", {
4357
- key: idx,
4358
- style: {
4359
- borderTop: "1px solid #F2F4F7"
4360
- }
4361
- }, /*#__PURE__*/React.createElement("td", {
4362
- style: {
4363
- padding: "16px 0",
4364
- fontSize: "14px",
4365
- color: "#344054",
4366
- fontWeight: "500"
4367
- }
4368
- }, t(field.label)), /*#__PURE__*/React.createElement("td", {
4369
- style: {
4370
- padding: "16px 0",
4371
- fontSize: "14px",
4372
- color: "#667085"
4373
- }
4374
- }, field.isBool ? boolToYesNo(valOld, t) : checkForNA(valOld)), /*#__PURE__*/React.createElement("td", {
4375
- style: {
4376
- padding: "16px 0",
4377
- fontSize: "14px",
4378
- color: isChanged ? "#1B8B32" : "#101828",
4379
- fontWeight: isChanged ? "700" : "400"
4380
- }
4381
- }, /*#__PURE__*/React.createElement("div", {
4382
- style: {
4383
- display: "flex",
4384
- alignItems: "center",
4385
- gap: "8px"
4386
- }
4387
- }, field.isBool ? boolToYesNo(valNew, t) : checkForNA(valNew), isChanged && /*#__PURE__*/React.createElement("span", {
4388
- style: {
4389
- background: "#ECFDF3",
4390
- color: "#067647",
4391
- padding: "2px 8px",
4392
- borderRadius: "12px",
4393
- fontSize: "10px",
4394
- fontWeight: "600"
4395
- }
4396
- }, t("EKYC_CHANGED")))));
4397
- })))));
4398
- };
4399
- const Review = () => {
4400
- var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _newDataRaw$connectio, _newDataRaw$connectio2, _newDataRaw$connectio3, _newDataRaw$address, _newDataRaw$address2, _newDataRaw$address3, _newDataRaw$address4, _newDataRaw$address5, _newDataRaw$address6, _newDataRaw$address7, _newDataRaw$address8, _newDataRaw$address9, _newDataRaw$address0, _newDataRaw$address1, _newDataRaw$address10, _newDataRaw$address11, _newDataRaw$address12, _newDataRaw$address13, _newDataRaw$address14, _newDataRaw$property, _newDataRaw$property2, _editedProperty$conne, _newDataRaw$property3, _editedProperty$conne2, _newDataRaw$property4, _editedProperty$userT, _newDataRaw$property5, _editedProperty$noOfF, _newDataRaw$property6, _newDataRaw$property7, _newDataRaw$meter, _editedMeter$meterSta, _newDataRaw$meter2, _newDataRaw$meter3, _newDataRaw$meter4, _newDataRaw$meter5, _editedMeter$workingS, _newDataRaw$meter6, _editedMeter$lastBill, _newDataRaw$meter7, _newDataRaw$meter8;
4401
- const _useTranslation = useTranslation(),
4402
- t = _useTranslation.t;
4403
- const history = useHistory();
4404
- const location = useLocation();
4405
- let _useParams = useParams(),
4406
- kno = _useParams.kno,
4407
- applicationId = _useParams.applicationId;
4408
- const _useState = useState(false),
4409
- agree = _useState[0],
4410
- setAgree = _useState[1];
4411
- const _useState2 = useState(false),
4412
- isSubmitting = _useState2[0];
4413
- const _useState3 = useState(false),
4414
- showPreview = _useState3[0],
4415
- setShowPreview = _useState3[1];
4416
- const _useState4 = useState(""),
4417
- previewUrl = _useState4[0],
4418
- setPreviewUrl = _useState4[1];
4419
- const _useState5 = useState(false),
4420
- showOptions = _useState5[0],
4421
- setShowOptions = _useState5[1];
4422
- const _useState6 = useState(false),
4423
- showToast = _useState6[0],
4424
- setShowToast = _useState6[1];
4425
- const _useState7 = useState({
4426
- error: false,
4427
- label: ""
4428
- }),
4429
- toastData = _useState7[0],
4430
- setToastData = _useState7[1];
4431
- const options = [{
4432
- action: t("APPROVE")
4433
- }, {
4434
- action: t("REJECT")
3357
+ action: t("REJECT")
4435
3358
  }];
4436
3359
  const flowState = location.state || {};
4437
3360
  const _flowState$edits = flowState.edits,
@@ -5797,388 +4720,52 @@ const EKYCForm = _ref => {
5797
4720
  }
5798
4721
  ekycConfig.forEach(obj => {
5799
4722
  config = config.concat(obj.body);
5800
- });
5801
- config.indexRoute = "consumer-details";
5802
- const formStepRoutes = config.map(c => c.route);
5803
- const isFormStep = formStepRoutes.some(route => pathname.includes(route));
5804
- const sectionRefs = useRef({});
5805
- useEffect(() => {
5806
- if (isFormStep) {
5807
- const currentRoute = pathname.split("/").pop();
5808
- if (sectionRefs.current[currentRoute]) {
5809
- sectionRefs.current[currentRoute].scrollIntoView({
5810
- behavior: "smooth",
5811
- block: "start"
5812
- });
5813
- }
5814
- }
5815
- }, [pathname, isFormStep]);
5816
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
5817
- className: "employee-form-section-wrapper"
5818
- }, /*#__PURE__*/React.createElement(VerticalTimeline, {
5819
- config: config,
5820
- showFinalStep: true
5821
- }), /*#__PURE__*/React.createElement("div", {
5822
- className: "employee-form-section"
5823
- }, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(Route, {
5824
- path: formStepRoutes.map(route => (passedPath || match.path.split("/").slice(0, -1).join("/")) + "/" + route)
5825
- }, /*#__PURE__*/React.createElement("div", {
5826
- className: "single-page-form-container"
5827
- }, config.map((routeObj, index) => {
5828
- const component = routeObj.component;
5829
- const Component = typeof component === "string" ? Digit.ComponentRegistryService.getComponent(component) : component;
5830
- return /*#__PURE__*/React.createElement("div", {
5831
- key: index,
5832
- ref: el => sectionRefs.current[routeObj.route] = el,
5833
- className: "form-section-unit"
5834
- }, /*#__PURE__*/React.createElement(Component, {
5835
- config: _extends({}, routeObj, {
5836
- isCollapsible: true,
5837
- defaultOpen: true
5838
- }),
5839
- onSelect: handleSelect,
5840
- t: t,
5841
- formData: params
5842
- }));
5843
- }))), /*#__PURE__*/React.createElement(Route, null, /*#__PURE__*/React.createElement(Redirect, {
5844
- to: (passedPath || match.path.split("/").slice(0, -1).join("/")) + "/" + config.indexRoute
5845
- }))))));
5846
- };
5847
-
5848
- function formReducer(state, payload) {
5849
- const storageKey = "EKYC.SW.INBOX";
5850
- switch (payload.action) {
5851
- case "mutateSearchForm":
5852
- Digit.SessionStorage.set(storageKey, _extends({}, state, {
5853
- searchForm: payload.data
5854
- }));
5855
- return _extends({}, state, {
5856
- searchForm: payload.data
5857
- });
5858
- case "mutateFilterForm":
5859
- Digit.SessionStorage.set(storageKey, _extends({}, state, {
5860
- filterForm: payload.data
5861
- }));
5862
- return _extends({}, state, {
5863
- filterForm: payload.data
5864
- });
5865
- case "mutateTableForm":
5866
- Digit.SessionStorage.set(storageKey, _extends({}, state, {
5867
- tableForm: payload.data
5868
- }));
5869
- return _extends({}, state, {
5870
- tableForm: payload.data
5871
- });
5872
- default:
5873
- return state;
5874
- }
5875
- }
5876
- const formInitValue = {
5877
- filterForm: {},
5878
- searchForm: {},
5879
- tableForm: {
5880
- limit: 10,
5881
- offset: 0,
5882
- sortBy: "createdTime",
5883
- sortOrder: "DESC"
5884
- }
5885
- };
5886
- const tableColumnConfig = (t, handleReview) => [{
5887
- Header: t("SURVEYOR_NAME"),
5888
- accessor: "surveyorName",
5889
- Cell: _ref => {
5890
- var _row$original, _row$original2, _row$original3;
5891
- let row = _ref.row;
5892
- const id = (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.id;
5893
- return /*#__PURE__*/React.createElement("span", {
5894
- className: "link",
5895
- onClick: () => handleReview(id)
5896
- }, ((_row$original2 = row.original) === null || _row$original2 === void 0 ? void 0 : _row$original2.surveyorName) || ((_row$original3 = row.original) === null || _row$original3 === void 0 ? void 0 : _row$original3.name) || "NA");
5897
- }
5898
- }, {
5899
- Header: t("MOBILE_NUMBER"),
5900
- accessor: "mobileNo",
5901
- Cell: _ref2 => {
5902
- var _row$original4, _row$original5, _row$original5$owner;
5903
- let row = _ref2.row;
5904
- return /*#__PURE__*/React.createElement("span", null, ((_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : _row$original4.mobileNo) || ((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : (_row$original5$owner = _row$original5.owner) === null || _row$original5$owner === void 0 ? void 0 : _row$original5$owner.mobileNumber) || "NA");
5905
- }
5906
- }, {
5907
- Header: t("STATUS"),
5908
- accessor: "status",
5909
- Cell: _ref3 => {
5910
- var _row$original6;
5911
- let row = _ref3.row;
5912
- const status = ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.status) || "DEFAULT";
5913
- return /*#__PURE__*/React.createElement("span", {
5914
- className: "ekyc-status-tag " + status
5915
- }, t(status));
5916
- }
5917
- }, {
5918
- Header: t("SERVICE_TYPE"),
5919
- accessor: "serviceType",
5920
- Cell: _ref4 => {
5921
- var _row$original7;
5922
- let row = _ref4.row;
5923
- return /*#__PURE__*/React.createElement("span", null, ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.serviceType) || "NA");
5924
- }
5925
- }];
5926
-
5927
- const SupervisorInboxTableConfig = _ref => {
5928
- var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _formState$tableForm, _formState$tableForm2;
5929
- let onPageSizeChange = _ref.onPageSizeChange,
5930
- formState = _ref.formState,
5931
- totalCount = _ref.totalCount,
5932
- table = _ref.table,
5933
- dispatch = _ref.dispatch,
5934
- onSortingByData = _ref.onSortingByData,
5935
- _ref$inboxStyles = _ref.inboxStyles,
5936
- inboxStyles = _ref$inboxStyles === void 0 ? {} : _ref$inboxStyles,
5937
- _ref$tableStyle = _ref.tableStyle,
5938
- tableStyle = _ref$tableStyle === void 0 ? {} : _ref$tableStyle;
5939
- const _useTranslation = useTranslation(),
5940
- t = _useTranslation.t;
5941
- const history = useHistory();
5942
- const userType = ((_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.type) === null || _Digit$SessionStorage3 === void 0 ? void 0 : _Digit$SessionStorage3.toLowerCase()) || "citizen";
5943
- const handleReview = id => {
5944
- history.push("/digit-ui/" + userType + "/ekyc/assign/surveyor-details/" + id);
5945
- };
5946
- const limit = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10;
5947
- const offset = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0;
5948
- return {
5949
- disableSort: false,
5950
- autoSort: false,
5951
- manualPagination: true,
5952
- currentPage: Math.floor(offset / limit),
5953
- onPageSizeChange,
5954
- onNextPage: () => dispatch({
5955
- action: "mutateTableForm",
5956
- data: _extends({}, formState.tableForm, {
5957
- offset: Number(offset) + Number(limit)
5958
- })
5959
- }),
5960
- onPrevPage: () => dispatch({
5961
- action: "mutateTableForm",
5962
- data: _extends({}, formState.tableForm, {
5963
- offset: Number(offset) - Number(limit)
5964
- })
5965
- }),
5966
- onLastPage: () => dispatch({
5967
- action: "mutateTableForm",
5968
- data: _extends({}, formState.tableForm, {
5969
- offset: Math.ceil(totalCount / limit) * limit - Number(limit)
5970
- })
5971
- }),
5972
- onFirstPage: () => dispatch({
5973
- action: "mutateTableForm",
5974
- data: _extends({}, formState.tableForm, {
5975
- offset: 0
5976
- })
5977
- }),
5978
- totalRecords: totalCount,
5979
- onSort: onSortingByData,
5980
- data: table,
5981
- columns: tableColumnConfig(t, handleReview),
5982
- inboxStyles: _extends({}, inboxStyles),
5983
- tableStyle: _extends({}, tableStyle)
5984
- };
5985
- };
5986
-
5987
- const AssignEkyc = () => {
5988
- var _formState$tableForm, _formState$tableForm2, _formState$tableForm3, _formState$tableForm4, _formState$searchForm, _dashboardData$dashbo;
5989
- let tenantId = Digit.ULBService.getCurrentTenantId();
5990
- if (!tenantId || tenantId === "dl") {
5991
- tenantId = "dl.djb";
5992
- }
5993
- const _useReducer = useReducer(formReducer, formInitValue),
5994
- formState = _useReducer[0],
5995
- dispatch = _useReducer[1];
5996
- let paginationParms = {
5997
- limit: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10,
5998
- offset: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0,
5999
- sortBy: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm3 = formState.tableForm) === null || _formState$tableForm3 === void 0 ? void 0 : _formState$tableForm3.sortBy) || "createdTime",
6000
- sortOrder: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm4 = formState.tableForm) === null || _formState$tableForm4 === void 0 ? void 0 : _formState$tableForm4.sortOrder) || "DESC"
6001
- };
6002
- const mobileNumber = (formState === null || formState === void 0 ? void 0 : (_formState$searchForm = formState.searchForm) === null || _formState$searchForm === void 0 ? void 0 : _formState$searchForm.mobileNumber) || "";
6003
- const isSearchActive = !!mobileNumber;
6004
- const filters = _extends({}, paginationParms, {
6005
- status: "ACTIVE,DISABLED"
6006
- });
6007
- if (isSearchActive) {
6008
- filters.mobileNumber = mobileNumber;
6009
- }
6010
- const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSurveyorSearch(tenantId, filters, {
6011
- enabled: !!tenantId,
6012
- keepPreviousData: true
6013
- }),
6014
- dashboardData = _Digit$Hooks$fsm$useS.data,
6015
- isLoading = _Digit$Hooks$fsm$useS.isLoading;
6016
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycAssignmentProgress({
6017
- enabled: !!tenantId,
6018
- keepPreviousData: true
6019
- }),
6020
- isDataSearchLoading = _Digit$Hooks$ekyc$use.isLoading;
6021
- const sourceData = useMemo(() => {
6022
- return (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.surveyors) || [];
6023
- }, [dashboardData]);
6024
- const filteredData = useMemo(() => {
6025
- return (sourceData || []).map(item => {
6026
- var _owner$roles, _owner$roles$map, _item$additionalDetai, _item$auditDetails, _item$auditDetails2;
6027
- const owner = (item === null || item === void 0 ? void 0 : item.owner) || {};
6028
- const roleCodes = (owner === null || owner === void 0 ? void 0 : (_owner$roles = owner.roles) === null || _owner$roles === void 0 ? void 0 : (_owner$roles$map = _owner$roles.map(role => role.code)) === null || _owner$roles$map === void 0 ? void 0 : _owner$roles$map.join(", ")) || "";
6029
- return _extends({}, item, {
6030
- id: (item === null || item === void 0 ? void 0 : item.id) || "",
6031
- surveyorName: (item === null || item === void 0 ? void 0 : item.name) || (owner === null || owner === void 0 ? void 0 : owner.name) || "",
6032
- mobileNo: (item === null || item === void 0 ? void 0 : item.mobileNo) || (owner === null || owner === void 0 ? void 0 : owner.mobileNumber) || "",
6033
- email: (owner === null || owner === void 0 ? void 0 : owner.emailId) || "",
6034
- vendorId: (item === null || item === void 0 ? void 0 : item.vendorId) || "",
6035
- tenantId: (item === null || item === void 0 ? void 0 : item.tenantId) || "",
6036
- supervisorId: (item === null || item === void 0 ? void 0 : item.supervisorId) || "",
6037
- status: (item === null || item === void 0 ? void 0 : item.status) || "",
6038
- roleCodes,
6039
- userName: (owner === null || owner === void 0 ? void 0 : owner.userName) || "",
6040
- gender: (owner === null || owner === void 0 ? void 0 : owner.gender) || "",
6041
- serviceType: (item === null || item === void 0 ? void 0 : (_item$additionalDetai = item.additionalDetails) === null || _item$additionalDetai === void 0 ? void 0 : _item$additionalDetai.serviceType) || "",
6042
- createdTime: (item === null || item === void 0 ? void 0 : (_item$auditDetails = item.auditDetails) === null || _item$auditDetails === void 0 ? void 0 : _item$auditDetails.createdTime) || 0,
6043
- lastModifiedTime: (item === null || item === void 0 ? void 0 : (_item$auditDetails2 = item.auditDetails) === null || _item$auditDetails2 === void 0 ? void 0 : _item$auditDetails2.lastModifiedTime) || 0
6044
- });
6045
- });
6046
- }, [sourceData]);
6047
- const totalRecords = (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.totalRecords) || (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.totalCount) || 0;
6048
- const SearchFormFields = useCallback(_ref => {
6049
- let registerRef = _ref.registerRef,
6050
- searchFormState = _ref.searchFormState,
6051
- controlSearchForm = _ref.controlSearchForm;
6052
- return /*#__PURE__*/React.createElement(SearchFormFieldsComponents, {
6053
- registerRef,
6054
- searchFormState,
6055
- controlSearchForm,
6056
- searchType: "mobile",
6057
- className: "search"
6058
- });
6059
- }, []);
6060
- const tableOrderFormDefaultValues = {
6061
- sortBy: "createdTime",
6062
- limit: window.Digit.Utils.browser.isMobile() ? 50 : 10,
6063
- offset: 0,
6064
- sortOrder: "DESC"
6065
- };
6066
- const onSearchFormSubmit = data => {
6067
- data.hasOwnProperty("") && (data === null || data === void 0 ? true : delete data[""]);
6068
- dispatch({
6069
- action: "mutateTableForm",
6070
- data: _extends({}, tableOrderFormDefaultValues)
6071
- });
6072
- dispatch({
6073
- action: "mutateSearchForm",
6074
- data
6075
- });
6076
- };
6077
- const searchFormDefaultValues = {
6078
- mobileNumber: "",
6079
- applicationNumber: "",
6080
- consumerNo: ""
6081
- };
6082
- const onSearchFormReset = setSearchFormValue => {
6083
- setSearchFormValue("mobileNumber", null);
6084
- setSearchFormValue("applicationNumber", null);
6085
- setSearchFormValue("consumerNo", null);
6086
- dispatch({
6087
- action: "mutateSearchForm",
6088
- data: searchFormDefaultValues
6089
- });
6090
- };
6091
- const propsForSearchForm = {
6092
- SearchFormFields,
6093
- onSearchFormSubmit,
6094
- searchFormDefaultValues: formState === null || formState === void 0 ? void 0 : formState.searchForm,
6095
- resetSearchFormDefaultValues: searchFormDefaultValues,
6096
- onSearchFormReset,
6097
- className: "search-form-wns-inbox"
6098
- };
6099
- const onPageSizeChange = e => {
6100
- const newLimit = Number(e.target.value);
6101
- dispatch({
6102
- action: "mutateTableForm",
6103
- data: _extends({}, formState.tableForm, {
6104
- limit: newLimit,
6105
- offset: 0
6106
- })
6107
- });
6108
- };
6109
- const onSortingByData = e => {
6110
- if (e.length > 0) {
6111
- const _e$ = e[0],
6112
- id = _e$.id,
6113
- desc = _e$.desc;
6114
- const sortOrder = desc ? "DESC" : "ASC";
6115
- const sortBy = id;
6116
- if (!(formState.tableForm.sortBy === sortBy && formState.tableForm.sortOrder === sortOrder)) {
6117
- dispatch({
6118
- action: "mutateTableForm",
6119
- data: _extends({}, formState.tableForm, {
6120
- sortBy: id,
6121
- sortOrder: desc ? "DESC" : "ASC"
6122
- })
6123
- });
6124
- }
6125
- }
6126
- };
6127
- const propsForInboxTable = SupervisorInboxTableConfig(_extends({}, {
6128
- onPageSizeChange,
6129
- formState,
6130
- totalCount: totalRecords,
6131
- table: filteredData,
6132
- dispatch,
6133
- onSortingByData,
6134
- tenantId,
6135
- inboxStyles: {
6136
- overflowX: "scroll",
6137
- overflowY: "hidden"
6138
- },
6139
- tableStyle: {
6140
- width: "70%"
6141
- }
6142
- }));
6143
- const isInboxLoading = isLoading;
6144
- const onMobileSortOrderData = data => {
6145
- const sortOrder = data.sortOrder;
6146
- dispatch({
6147
- action: "mutateTableForm",
6148
- data: _extends({}, formState.tableForm, {
6149
- sortOrder
6150
- })
6151
- });
6152
- };
6153
- const onSortFormReset = setSortFormValue => {
6154
- setSortFormValue("sortOrder", "DESC");
6155
- dispatch({
6156
- action: "mutateTableForm",
6157
- data: tableOrderFormDefaultValues
6158
- });
6159
- };
6160
- const propsForMobileSortForm = {
6161
- onMobileSortOrderData,
6162
- sortFormDefaultValues: formState === null || formState === void 0 ? void 0 : formState.tableForm,
6163
- onSortFormReset
6164
- };
6165
- const propsForInboxMobileCards = useInboxMobileCardsData({
6166
- table: filteredData,
6167
- isSupervisor: true
6168
- });
6169
- return /*#__PURE__*/React.createElement("div", {
6170
- className: "app-container"
6171
- }, /*#__PURE__*/React.createElement(InboxComposer, _extends({
6172
- isInboxLoading
6173
- }, propsForSearchForm, propsForMobileSortForm, {
6174
- propsForInboxTable,
6175
- propsForInboxMobileCards,
6176
- formState,
6177
- countData: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
6178
- isCardLoading: isDataSearchLoading,
6179
- showSearchOnMobile: true,
6180
- forceTable: true
6181
- })));
4723
+ });
4724
+ config.indexRoute = "consumer-details";
4725
+ const formStepRoutes = config.map(c => c.route);
4726
+ const isFormStep = formStepRoutes.some(route => pathname.includes(route));
4727
+ const sectionRefs = useRef({});
4728
+ useEffect(() => {
4729
+ if (isFormStep) {
4730
+ const currentRoute = pathname.split("/").pop();
4731
+ if (sectionRefs.current[currentRoute]) {
4732
+ sectionRefs.current[currentRoute].scrollIntoView({
4733
+ behavior: "smooth",
4734
+ block: "start"
4735
+ });
4736
+ }
4737
+ }
4738
+ }, [pathname, isFormStep]);
4739
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
4740
+ className: "employee-form-section-wrapper"
4741
+ }, /*#__PURE__*/React.createElement(VerticalTimeline, {
4742
+ config: config,
4743
+ showFinalStep: true
4744
+ }), /*#__PURE__*/React.createElement("div", {
4745
+ className: "employee-form-section"
4746
+ }, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(Route, {
4747
+ path: formStepRoutes.map(route => (passedPath || match.path.split("/").slice(0, -1).join("/")) + "/" + route)
4748
+ }, /*#__PURE__*/React.createElement("div", {
4749
+ className: "single-page-form-container"
4750
+ }, config.map((routeObj, index) => {
4751
+ const component = routeObj.component;
4752
+ const Component = typeof component === "string" ? Digit.ComponentRegistryService.getComponent(component) : component;
4753
+ return /*#__PURE__*/React.createElement("div", {
4754
+ key: index,
4755
+ ref: el => sectionRefs.current[routeObj.route] = el,
4756
+ className: "form-section-unit"
4757
+ }, /*#__PURE__*/React.createElement(Component, {
4758
+ config: _extends({}, routeObj, {
4759
+ isCollapsible: true,
4760
+ defaultOpen: true
4761
+ }),
4762
+ onSelect: handleSelect,
4763
+ t: t,
4764
+ formData: params
4765
+ }));
4766
+ }))), /*#__PURE__*/React.createElement(Route, null, /*#__PURE__*/React.createElement(Redirect, {
4767
+ to: (passedPath || match.path.split("/").slice(0, -1).join("/")) + "/" + config.indexRoute
4768
+ }))))));
6182
4769
  };
6183
4770
 
6184
4771
  const parseAdditionalDetails = additionalDetails => {
@@ -6330,98 +4917,142 @@ const SupervisorDetailsCard = () => {
6330
4917
  const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
6331
4918
  status: "ACTIVE"
6332
4919
  }, {
6333
- enabled: !!tenantId
4920
+ enabled: !!tenantId,
4921
+ staleTime: 300000
6334
4922
  }),
6335
4923
  supervisorSearchResponse = _Digit$Hooks$fsm$useS.data,
6336
4924
  isSupervisorSearchLoading = _Digit$Hooks$fsm$useS.isLoading;
6337
4925
  const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSurveyorSearch(tenantId, {
6338
4926
  status: "ACTIVE"
6339
4927
  }, {
6340
- enabled: !!tenantId
4928
+ enabled: !!tenantId,
4929
+ staleTime: 300000
6341
4930
  }),
6342
4931
  surveyorSearchResponse = _Digit$Hooks$fsm$useS2.data,
6343
4932
  isSurveyorSearchLoading = _Digit$Hooks$fsm$useS2.isLoading;
6344
4933
  const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
6345
4934
  status: "ACTIVE"
6346
4935
  }, {
6347
- enabled: !!tenantId
4936
+ enabled: !!tenantId,
4937
+ staleTime: 300000
6348
4938
  }),
6349
4939
  vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
6350
4940
  isVendorSearchLoading = _Digit$Hooks$fsm$useD.isLoading;
6351
4941
  const supervisor = useMemo(() => {
6352
- if (progressData !== null && progressData !== void 0 && progressData.supervisorReport) {
6353
- let found = null;
6354
- const targetId = supervisorId || (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid);
6355
- if (targetId) {
6356
- found = progressData.supervisorReport.find(s => {
6357
- var _s$supervisorId, _s$id;
6358
- return ((_s$supervisorId = s.supervisorId) === null || _s$supervisorId === void 0 ? void 0 : _s$supervisorId.toLowerCase()) === (targetId === null || targetId === void 0 ? void 0 : targetId.toLowerCase()) || ((_s$id = s.id) === null || _s$id === void 0 ? void 0 : _s$id.toLowerCase()) === (targetId === null || targetId === void 0 ? void 0 : targetId.toLowerCase());
6359
- });
6360
- }
6361
- if (found) return found;
4942
+ const targetOwnerOrId = supervisorId || (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid);
4943
+ if (!targetOwnerOrId) return null;
4944
+ let resolvedSupervisorId = supervisorId;
4945
+ if (!resolvedSupervisorId && supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors && targetOwnerOrId) {
4946
+ const selfSup = supervisorSearchResponse.supervisors.find(s => {
4947
+ var _s$owner, _s$owner$uuid, _s$id;
4948
+ return ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : (_s$owner$uuid = _s$owner.uuid) === null || _s$owner$uuid === void 0 ? void 0 : _s$owner$uuid.toLowerCase()) === (targetOwnerOrId === null || targetOwnerOrId === void 0 ? void 0 : targetOwnerOrId.toLowerCase()) || ((_s$id = s.id) === null || _s$id === void 0 ? void 0 : _s$id.toLowerCase()) === (targetOwnerOrId === null || targetOwnerOrId === void 0 ? void 0 : targetOwnerOrId.toLowerCase());
4949
+ });
4950
+ resolvedSupervisorId = selfSup === null || selfSup === void 0 ? void 0 : selfSup.id;
6362
4951
  }
4952
+ const targetId = resolvedSupervisorId || targetOwnerOrId;
4953
+ let matchedSup = null;
6363
4954
  if (supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors) {
6364
- let matchedSup = null;
6365
- const targetId = supervisorId || (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid);
6366
- if (targetId) {
6367
- matchedSup = supervisorSearchResponse.supervisors.find(s => {
6368
- var _s$id2, _s$owner, _s$owner$uuid;
6369
- return ((_s$id2 = s.id) === null || _s$id2 === void 0 ? void 0 : _s$id2.toLowerCase()) === (targetId === null || targetId === void 0 ? void 0 : targetId.toLowerCase()) || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : (_s$owner$uuid = _s$owner.uuid) === null || _s$owner$uuid === void 0 ? void 0 : _s$owner$uuid.toLowerCase()) === (targetId === null || targetId === void 0 ? void 0 : targetId.toLowerCase());
6370
- });
6371
- }
6372
- if (matchedSup) {
6373
- var _matchedSup$owner2, _matchedSup$owner3, _matchedSup$owner4;
6374
- const matchedSurveyors = surveyorSearchResponse !== null && surveyorSearchResponse !== void 0 && surveyorSearchResponse.surveyors ? surveyorSearchResponse.surveyors.filter(surv => {
6375
- var _matchedSup$owner;
6376
- return surv.supervisorId === (matchedSup.id || ((_matchedSup$owner = matchedSup.owner) === null || _matchedSup$owner === void 0 ? void 0 : _matchedSup$owner.uuid));
6377
- }).map(surv => {
6378
- var _surv$owner3, _surv$owner4, _surv$owner5, _realStats, _realStats2, _realStats3, _realStats4;
6379
- let realStats = null;
6380
- if (progressData !== null && progressData !== void 0 && progressData.supervisorReport) {
6381
- for (const report of progressData.supervisorReport) {
6382
- var _report$surveyors;
6383
- const matchedSurv = (_report$surveyors = report.surveyors) === null || _report$surveyors === void 0 ? void 0 : _report$surveyors.find(s => {
6384
- var _surv$owner, _surv$owner2;
6385
- return s.surveyorId && (s.surveyorId === surv.id || s.surveyorId === ((_surv$owner = surv.owner) === null || _surv$owner === void 0 ? void 0 : _surv$owner.uuid)) || s.id && (s.id === surv.id || s.id === ((_surv$owner2 = surv.owner) === null || _surv$owner2 === void 0 ? void 0 : _surv$owner2.uuid));
6386
- });
6387
- if (matchedSurv) {
6388
- realStats = matchedSurv;
6389
- break;
6390
- }
4955
+ matchedSup = supervisorSearchResponse.supervisors.find(s => {
4956
+ var _s$id2, _s$owner2, _s$owner2$uuid;
4957
+ return ((_s$id2 = s.id) === null || _s$id2 === void 0 ? void 0 : _s$id2.toLowerCase()) === (targetId === null || targetId === void 0 ? void 0 : targetId.toLowerCase()) || ((_s$owner2 = s.owner) === null || _s$owner2 === void 0 ? void 0 : (_s$owner2$uuid = _s$owner2.uuid) === null || _s$owner2$uuid === void 0 ? void 0 : _s$owner2$uuid.toLowerCase()) === (targetId === null || targetId === void 0 ? void 0 : targetId.toLowerCase());
4958
+ });
4959
+ }
4960
+ let progressReport = null;
4961
+ if (progressData !== null && progressData !== void 0 && progressData.supervisorReport && targetId) {
4962
+ progressReport = progressData.supervisorReport.find(s => {
4963
+ var _s$supervisorId, _s$id3;
4964
+ return ((_s$supervisorId = s.supervisorId) === null || _s$supervisorId === void 0 ? void 0 : _s$supervisorId.toLowerCase()) === (targetId === null || targetId === void 0 ? void 0 : targetId.toLowerCase()) || ((_s$id3 = s.id) === null || _s$id3 === void 0 ? void 0 : _s$id3.toLowerCase()) === (targetId === null || targetId === void 0 ? void 0 : targetId.toLowerCase());
4965
+ });
4966
+ }
4967
+ if (matchedSup) {
4968
+ var _progressReport, _progressReport2, _progressReport3, _matchedSup$owner2, _matchedSup$owner3, _matchedSup$owner4;
4969
+ const matchedSurveyors = surveyorSearchResponse !== null && surveyorSearchResponse !== void 0 && surveyorSearchResponse.surveyors ? surveyorSearchResponse.surveyors.filter(surv => {
4970
+ var _matchedSup$owner;
4971
+ return surv.supervisorId === (matchedSup.id || ((_matchedSup$owner = matchedSup.owner) === null || _matchedSup$owner === void 0 ? void 0 : _matchedSup$owner.uuid));
4972
+ }).map(surv => {
4973
+ var _surv$owner3, _surv$owner4, _surv$owner5, _realStats, _realStats2, _realStats3, _realStats4;
4974
+ let realStats = null;
4975
+ if (progressData !== null && progressData !== void 0 && progressData.supervisorReport) {
4976
+ for (const report of progressData.supervisorReport) {
4977
+ var _report$supervisorId, _matchedSup$id, _report$id, _matchedSup$id2, _report$surveyors;
4978
+ if (((_report$supervisorId = report.supervisorId) === null || _report$supervisorId === void 0 ? void 0 : _report$supervisorId.toLowerCase()) !== ((_matchedSup$id = matchedSup.id) === null || _matchedSup$id === void 0 ? void 0 : _matchedSup$id.toLowerCase()) && ((_report$id = report.id) === null || _report$id === void 0 ? void 0 : _report$id.toLowerCase()) !== ((_matchedSup$id2 = matchedSup.id) === null || _matchedSup$id2 === void 0 ? void 0 : _matchedSup$id2.toLowerCase())) continue;
4979
+ const matchedSurv = (_report$surveyors = report.surveyors) === null || _report$surveyors === void 0 ? void 0 : _report$surveyors.find(s => {
4980
+ var _s$surveyorId, _surv$id, _s$surveyorId2, _surv$owner, _surv$owner$uuid, _s$id4, _surv$id2, _s$id5, _surv$owner2, _surv$owner2$uuid;
4981
+ return s.surveyorId && (((_s$surveyorId = s.surveyorId) === null || _s$surveyorId === void 0 ? void 0 : _s$surveyorId.toLowerCase()) === ((_surv$id = surv.id) === null || _surv$id === void 0 ? void 0 : _surv$id.toLowerCase()) || ((_s$surveyorId2 = s.surveyorId) === null || _s$surveyorId2 === void 0 ? void 0 : _s$surveyorId2.toLowerCase()) === ((_surv$owner = surv.owner) === null || _surv$owner === void 0 ? void 0 : (_surv$owner$uuid = _surv$owner.uuid) === null || _surv$owner$uuid === void 0 ? void 0 : _surv$owner$uuid.toLowerCase())) || s.id && (((_s$id4 = s.id) === null || _s$id4 === void 0 ? void 0 : _s$id4.toLowerCase()) === ((_surv$id2 = surv.id) === null || _surv$id2 === void 0 ? void 0 : _surv$id2.toLowerCase()) || ((_s$id5 = s.id) === null || _s$id5 === void 0 ? void 0 : _s$id5.toLowerCase()) === ((_surv$owner2 = surv.owner) === null || _surv$owner2 === void 0 ? void 0 : (_surv$owner2$uuid = _surv$owner2.uuid) === null || _surv$owner2$uuid === void 0 ? void 0 : _surv$owner2$uuid.toLowerCase()));
4982
+ });
4983
+ if (matchedSurv) {
4984
+ realStats = matchedSurv;
4985
+ break;
6391
4986
  }
6392
4987
  }
6393
- return {
6394
- surveyorId: surv.id || ((_surv$owner3 = surv.owner) === null || _surv$owner3 === void 0 ? void 0 : _surv$owner3.uuid),
6395
- surveyorName: surv.name || ((_surv$owner4 = surv.owner) === null || _surv$owner4 === void 0 ? void 0 : _surv$owner4.name) || "N/A",
6396
- mobileNo: ((_surv$owner5 = surv.owner) === null || _surv$owner5 === void 0 ? void 0 : _surv$owner5.mobileNumber) || surv.mobileNo || "N/A",
6397
- status: surv.status || "ACTIVE",
6398
- totalKnos: ((_realStats = realStats) === null || _realStats === void 0 ? void 0 : _realStats.totalKnos) || 0,
6399
- submittedKnos: ((_realStats2 = realStats) === null || _realStats2 === void 0 ? void 0 : _realStats2.submittedKnos) || 0,
6400
- pendingKnos: ((_realStats3 = realStats) === null || _realStats3 === void 0 ? void 0 : _realStats3.pendingKnos) || 0,
6401
- progressPercent: ((_realStats4 = realStats) === null || _realStats4 === void 0 ? void 0 : _realStats4.progressPercent) || 0
6402
- };
6403
- }) : [];
6404
- const totalKnos = matchedSurveyors.reduce((acc, s) => acc + (s.totalKnos || 0), 0);
6405
- const submittedKnos = matchedSurveyors.reduce((acc, s) => acc + (s.submittedKnos || 0), 0);
6406
- const pendingKnos = matchedSurveyors.reduce((acc, s) => acc + (s.pendingKnos || 0), 0);
6407
- const progressPercent = totalKnos > 0 ? Math.round(submittedKnos / totalKnos * 100) : 0;
4988
+ }
6408
4989
  return {
6409
- supervisorId: matchedSup.id || ((_matchedSup$owner2 = matchedSup.owner) === null || _matchedSup$owner2 === void 0 ? void 0 : _matchedSup$owner2.uuid),
6410
- supervisorName: matchedSup.name || ((_matchedSup$owner3 = matchedSup.owner) === null || _matchedSup$owner3 === void 0 ? void 0 : _matchedSup$owner3.name) || "N/A",
6411
- mobileNo: ((_matchedSup$owner4 = matchedSup.owner) === null || _matchedSup$owner4 === void 0 ? void 0 : _matchedSup$owner4.mobileNumber) || matchedSup.mobileNo || "N/A",
6412
- status: matchedSup.status || "ACTIVE",
6413
- assignedZoneId: matchedSup.assignedZoneId || "N/A",
6414
- vendorId: matchedSup.vendorId,
6415
- surveyors: matchedSurveyors,
6416
- totalKnos,
6417
- submittedKnos,
6418
- pendingKnos,
6419
- progressPercent
4990
+ surveyorId: surv.id || ((_surv$owner3 = surv.owner) === null || _surv$owner3 === void 0 ? void 0 : _surv$owner3.uuid),
4991
+ surveyorName: surv.name || ((_surv$owner4 = surv.owner) === null || _surv$owner4 === void 0 ? void 0 : _surv$owner4.name) || "N/A",
4992
+ mobileNo: ((_surv$owner5 = surv.owner) === null || _surv$owner5 === void 0 ? void 0 : _surv$owner5.mobileNumber) || surv.mobileNo || "N/A",
4993
+ status: surv.status || "ACTIVE",
4994
+ totalKnos: ((_realStats = realStats) === null || _realStats === void 0 ? void 0 : _realStats.totalKnos) || 0,
4995
+ submittedKnos: ((_realStats2 = realStats) === null || _realStats2 === void 0 ? void 0 : _realStats2.submittedKnos) || 0,
4996
+ pendingKnos: ((_realStats3 = realStats) === null || _realStats3 === void 0 ? void 0 : _realStats3.pendingKnos) || 0,
4997
+ progressPercent: ((_realStats4 = realStats) === null || _realStats4 === void 0 ? void 0 : _realStats4.progressPercent) || 0
6420
4998
  };
6421
- }
4999
+ }) : [];
5000
+ const totalKnos = ((_progressReport = progressReport) === null || _progressReport === void 0 ? void 0 : _progressReport.totalKnos) || matchedSurveyors.reduce((acc, s) => acc + (s.totalKnos || 0), 0);
5001
+ const submittedKnos = ((_progressReport2 = progressReport) === null || _progressReport2 === void 0 ? void 0 : _progressReport2.submittedKnos) || matchedSurveyors.reduce((acc, s) => acc + (s.submittedKnos || 0), 0);
5002
+ const pendingKnos = ((_progressReport3 = progressReport) === null || _progressReport3 === void 0 ? void 0 : _progressReport3.pendingKnos) || matchedSurveyors.reduce((acc, s) => acc + (s.pendingKnos || 0), 0);
5003
+ const progressPercent = progressReport ? progressReport.progressPercent : totalKnos > 0 ? Math.round(submittedKnos / totalKnos * 100) : 0;
5004
+ return {
5005
+ supervisorId: matchedSup.id || ((_matchedSup$owner2 = matchedSup.owner) === null || _matchedSup$owner2 === void 0 ? void 0 : _matchedSup$owner2.uuid),
5006
+ supervisorName: matchedSup.name || ((_matchedSup$owner3 = matchedSup.owner) === null || _matchedSup$owner3 === void 0 ? void 0 : _matchedSup$owner3.name) || "N/A",
5007
+ mobileNo: ((_matchedSup$owner4 = matchedSup.owner) === null || _matchedSup$owner4 === void 0 ? void 0 : _matchedSup$owner4.mobileNumber) || matchedSup.mobileNo || "N/A",
5008
+ status: matchedSup.status || "ACTIVE",
5009
+ assignedZoneId: matchedSup.assignedZoneId || "N/A",
5010
+ vendorId: matchedSup.vendorId,
5011
+ surveyors: matchedSurveyors,
5012
+ totalKnos,
5013
+ submittedKnos,
5014
+ pendingKnos,
5015
+ progressPercent
5016
+ };
5017
+ }
5018
+ if (progressReport) {
5019
+ var _loggedInUser$uuid;
5020
+ const isSelf = (targetId === null || targetId === void 0 ? void 0 : targetId.toLowerCase()) === (loggedInUser === null || loggedInUser === void 0 ? void 0 : (_loggedInUser$uuid = loggedInUser.uuid) === null || _loggedInUser$uuid === void 0 ? void 0 : _loggedInUser$uuid.toLowerCase());
5021
+ const supervisorName = isSelf ? (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.name) || progressReport.supervisorName || "N/A" : progressReport.supervisorName || "N/A";
5022
+ const mobileNo = isSelf ? (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.mobileNumber) || progressReport.mobileNo || "N/A" : progressReport.mobileNo || "N/A";
5023
+ const surveyorsMapped = progressReport.surveyors ? progressReport.surveyors.map(surv => {
5024
+ var _surveyorSearchRespon, _matchedSurv$owner, _matchedSurv$owner2;
5025
+ const matchedSurv = surveyorSearchResponse === null || surveyorSearchResponse === void 0 ? void 0 : (_surveyorSearchRespon = surveyorSearchResponse.surveyors) === null || _surveyorSearchRespon === void 0 ? void 0 : _surveyorSearchRespon.find(s => {
5026
+ var _s$id6, _surv$surveyorId, _s$owner3, _s$owner3$uuid, _surv$surveyorId2;
5027
+ return ((_s$id6 = s.id) === null || _s$id6 === void 0 ? void 0 : _s$id6.toLowerCase()) === ((_surv$surveyorId = surv.surveyorId) === null || _surv$surveyorId === void 0 ? void 0 : _surv$surveyorId.toLowerCase()) || ((_s$owner3 = s.owner) === null || _s$owner3 === void 0 ? void 0 : (_s$owner3$uuid = _s$owner3.uuid) === null || _s$owner3$uuid === void 0 ? void 0 : _s$owner3$uuid.toLowerCase()) === ((_surv$surveyorId2 = surv.surveyorId) === null || _surv$surveyorId2 === void 0 ? void 0 : _surv$surveyorId2.toLowerCase());
5028
+ });
5029
+ return {
5030
+ surveyorId: surv.surveyorId || surv.id,
5031
+ surveyorName: (matchedSurv === null || matchedSurv === void 0 ? void 0 : matchedSurv.name) || (matchedSurv === null || matchedSurv === void 0 ? void 0 : (_matchedSurv$owner = matchedSurv.owner) === null || _matchedSurv$owner === void 0 ? void 0 : _matchedSurv$owner.name) || surv.surveyorName || "N/A",
5032
+ mobileNo: (matchedSurv === null || matchedSurv === void 0 ? void 0 : (_matchedSurv$owner2 = matchedSurv.owner) === null || _matchedSurv$owner2 === void 0 ? void 0 : _matchedSurv$owner2.mobileNumber) || (matchedSurv === null || matchedSurv === void 0 ? void 0 : matchedSurv.mobileNo) || surv.mobileNo || "N/A",
5033
+ status: (matchedSurv === null || matchedSurv === void 0 ? void 0 : matchedSurv.status) || surv.status || "ACTIVE",
5034
+ totalKnos: surv.totalKnos || 0,
5035
+ submittedKnos: surv.submittedKnos || 0,
5036
+ pendingKnos: surv.pendingKnos || 0,
5037
+ progressPercent: surv.progressPercent || 0
5038
+ };
5039
+ }) : [];
5040
+ return {
5041
+ supervisorId: progressReport.supervisorId || progressReport.id,
5042
+ supervisorName,
5043
+ mobileNo,
5044
+ status: progressReport.status || "ACTIVE",
5045
+ assignedZoneId: progressReport.assignedZoneId || "N/A",
5046
+ vendorId: progressReport.vendorId,
5047
+ surveyors: surveyorsMapped,
5048
+ totalKnos: progressReport.totalKnos || 0,
5049
+ submittedKnos: progressReport.submittedKnos || 0,
5050
+ pendingKnos: progressReport.pendingKnos || 0,
5051
+ progressPercent: progressReport.progressPercent || 0
5052
+ };
6422
5053
  }
6423
5054
  return null;
6424
- }, [progressData, supervisorSearchResponse, surveyorSearchResponse, supervisorId, loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid]);
5055
+ }, [progressData, supervisorSearchResponse, surveyorSearchResponse, supervisorId, loggedInUser]);
6425
5056
  const fullName = (supervisor === null || supervisor === void 0 ? void 0 : supervisor.supervisorName) || "N/A";
6426
5057
  const mobileNumber = (supervisor === null || supervisor === void 0 ? void 0 : supervisor.mobileNo) || "N/A";
6427
5058
  const email = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.emailId) || "N/A";
@@ -7380,7 +6011,7 @@ const AssignEkycModal = _ref => {
7380
6011
  };
7381
6012
 
7382
6013
  const SurveyorDetailsDashboard = () => {
7383
- 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;
6014
+ var _Digit$SessionStorage, _Digit$SessionStorage2, _surveyorSearchById$s, _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;
7384
6015
  const tenantId = Digit.ULBService.getCurrentTenantId();
7385
6016
  const _useState = useState(false),
7386
6017
  showModal = _useState[0],
@@ -7404,24 +6035,24 @@ const SurveyorDetailsDashboard = () => {
7404
6035
  }),
7405
6036
  surveyorSearchById = _Digit$Hooks$fsm$useS.data,
7406
6037
  isLoadingId = _Digit$Hooks$fsm$useS.isLoading;
6038
+ const hasFoundById = !!(surveyorSearchById !== null && surveyorSearchById !== void 0 && (_surveyorSearchById$s = surveyorSearchById.surveyors) !== null && _surveyorSearchById$s !== void 0 && _surveyorSearchById$s.length);
7407
6039
  const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSurveyorSearch(tenantId, surveyorId ? {
7408
6040
  ownerIds: surveyorId
7409
6041
  } : {
7410
6042
  ownerIds
7411
6043
  }, {
7412
- enabled: true,
6044
+ enabled: !surveyorId || !isLoadingId && !hasFoundById,
7413
6045
  staleTime: Infinity
7414
6046
  }),
7415
6047
  surveyorSearchByOwner = _Digit$Hooks$fsm$useS2.data,
7416
6048
  isLoadingOwner = _Digit$Hooks$fsm$useS2.isLoading;
7417
6049
  const surveyorSearchResponse = useMemo(() => {
7418
- if (surveyorId) {
7419
- var _surveyorSearchById$s;
7420
- return surveyorSearchById !== null && surveyorSearchById !== void 0 && (_surveyorSearchById$s = surveyorSearchById.surveyors) !== null && _surveyorSearchById$s !== void 0 && _surveyorSearchById$s.length ? surveyorSearchById : surveyorSearchByOwner;
6050
+ if (surveyorId && hasFoundById) {
6051
+ return surveyorSearchById;
7421
6052
  }
7422
6053
  return surveyorSearchByOwner;
7423
- }, [surveyorId, surveyorSearchById, surveyorSearchByOwner]);
7424
- const isLoading = surveyorId ? isLoadingId || isLoadingOwner : isLoadingOwner;
6054
+ }, [surveyorId, hasFoundById, surveyorSearchById, surveyorSearchByOwner]);
6055
+ const isLoading = surveyorId ? isLoadingId || isLoadingOwner && !hasFoundById : isLoadingOwner;
7425
6056
  const roles = (_Digit$SessionStorage3 = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage3 === void 0 ? void 0 : (_Digit$SessionStorage4 = _Digit$SessionStorage3.info) === null || _Digit$SessionStorage4 === void 0 ? void 0 : _Digit$SessionStorage4.roles.map(ele => ele.code);
7426
6057
  const surveyor = useMemo(() => {
7427
6058
  var _surveyorSearchRespon;
@@ -7430,14 +6061,16 @@ const SurveyorDetailsDashboard = () => {
7430
6061
  const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
7431
6062
  status: "ACTIVE"
7432
6063
  }, {
7433
- enabled: !!tenantId
6064
+ enabled: !!tenantId,
6065
+ staleTime: 300000
7434
6066
  }),
7435
6067
  vendorData = _Digit$Hooks$fsm$useD.data,
7436
6068
  isVendorLoading = _Digit$Hooks$fsm$useD.isLoading;
7437
6069
  const _Digit$Hooks$fsm$useS3 = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
7438
6070
  status: "ACTIVE"
7439
6071
  }, {
7440
- enabled: !!tenantId
6072
+ enabled: !!tenantId,
6073
+ staleTime: 300000
7441
6074
  }),
7442
6075
  supervisorSearchResponse = _Digit$Hooks$fsm$useS3.data,
7443
6076
  isSupervisorSearchLoading = _Digit$Hooks$fsm$useS3.isLoading;
@@ -7991,174 +6624,371 @@ const SurveyorDetailsDashboard = () => {
7991
6624
  if (currentPage > 0) {
7992
6625
  setCurrentPage(prev => prev - 1);
7993
6626
  }
7994
- },
7995
- onFirstPage: () => {
7996
- setCurrentPage(0);
7997
- },
7998
- onLastPage: () => {
7999
- var _dashboardData$dashbo8;
8000
- setCurrentPage(Math.max(((dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo8 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo8 === void 0 ? void 0 : _dashboardData$dashbo8.totalPages) || 1) - 1, 0));
8001
- },
8002
- onPageSizeChange: e => {
8003
- setPageSize(Number(e.target.value));
8004
- setCurrentPage(0);
6627
+ },
6628
+ onFirstPage: () => {
6629
+ setCurrentPage(0);
6630
+ },
6631
+ onLastPage: () => {
6632
+ var _dashboardData$dashbo8;
6633
+ setCurrentPage(Math.max(((dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo8 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo8 === void 0 ? void 0 : _dashboardData$dashbo8.totalPages) || 1) - 1, 0));
6634
+ },
6635
+ onPageSizeChange: e => {
6636
+ setPageSize(Number(e.target.value));
6637
+ setCurrentPage(0);
6638
+ }
6639
+ })), roles.includes("EKYC_SUPERVISOR") && /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
6640
+ label: t("EKYC_ASSIGN_KNOS"),
6641
+ onSubmit: () => setShowOptions(prev => !prev)
6642
+ }), showOptions && /*#__PURE__*/React.createElement(Menu, {
6643
+ options: options,
6644
+ optionKey: "action",
6645
+ t: t,
6646
+ onSelect: handleMenuSelect,
6647
+ style: {
6648
+ color: "#FFFFFF",
6649
+ fontSize: "18px"
6650
+ }
6651
+ })), showModal && /*#__PURE__*/React.createElement(AssignEkycModal, {
6652
+ surveyor: surveyor,
6653
+ closeModal: closeModal,
6654
+ refetchDashboard: refetchDashboard
6655
+ }));
6656
+ };
6657
+
6658
+ function formReducer(state, payload) {
6659
+ const storageKey = "EKYC.SW.INBOX";
6660
+ switch (payload.action) {
6661
+ case "mutateSearchForm":
6662
+ Digit.SessionStorage.set(storageKey, _extends({}, state, {
6663
+ searchForm: payload.data
6664
+ }));
6665
+ return _extends({}, state, {
6666
+ searchForm: payload.data
6667
+ });
6668
+ case "mutateFilterForm":
6669
+ Digit.SessionStorage.set(storageKey, _extends({}, state, {
6670
+ filterForm: payload.data
6671
+ }));
6672
+ return _extends({}, state, {
6673
+ filterForm: payload.data
6674
+ });
6675
+ case "mutateTableForm":
6676
+ Digit.SessionStorage.set(storageKey, _extends({}, state, {
6677
+ tableForm: payload.data
6678
+ }));
6679
+ return _extends({}, state, {
6680
+ tableForm: payload.data
6681
+ });
6682
+ default:
6683
+ return state;
6684
+ }
6685
+ }
6686
+ const formInitValue = {
6687
+ filterForm: {},
6688
+ searchForm: {},
6689
+ tableForm: {
6690
+ limit: 10,
6691
+ offset: 0,
6692
+ sortBy: "createdTime",
6693
+ sortOrder: "DESC"
6694
+ }
6695
+ };
6696
+ const tableColumnConfig = (t, handleReview) => [{
6697
+ Header: t("SURVEYOR_NAME"),
6698
+ accessor: "surveyorName",
6699
+ Cell: _ref => {
6700
+ var _row$original, _row$original2, _row$original3;
6701
+ let row = _ref.row;
6702
+ const id = (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.id;
6703
+ return /*#__PURE__*/React.createElement("span", {
6704
+ className: "link",
6705
+ onClick: () => handleReview(id)
6706
+ }, ((_row$original2 = row.original) === null || _row$original2 === void 0 ? void 0 : _row$original2.surveyorName) || ((_row$original3 = row.original) === null || _row$original3 === void 0 ? void 0 : _row$original3.name) || "NA");
6707
+ }
6708
+ }, {
6709
+ Header: t("MOBILE_NUMBER"),
6710
+ accessor: "mobileNo",
6711
+ Cell: _ref2 => {
6712
+ var _row$original4, _row$original5, _row$original5$owner;
6713
+ let row = _ref2.row;
6714
+ return /*#__PURE__*/React.createElement("span", null, ((_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : _row$original4.mobileNo) || ((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : (_row$original5$owner = _row$original5.owner) === null || _row$original5$owner === void 0 ? void 0 : _row$original5$owner.mobileNumber) || "NA");
6715
+ }
6716
+ }, {
6717
+ Header: t("STATUS"),
6718
+ accessor: "status",
6719
+ Cell: _ref3 => {
6720
+ var _row$original6;
6721
+ let row = _ref3.row;
6722
+ const status = ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.status) || "DEFAULT";
6723
+ return /*#__PURE__*/React.createElement("span", {
6724
+ className: "ekyc-status-tag " + status
6725
+ }, t(status));
6726
+ }
6727
+ }, {
6728
+ Header: t("SERVICE_TYPE"),
6729
+ accessor: "serviceType",
6730
+ Cell: _ref4 => {
6731
+ var _row$original7;
6732
+ let row = _ref4.row;
6733
+ return /*#__PURE__*/React.createElement("span", null, ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.serviceType) || "NA");
6734
+ }
6735
+ }];
6736
+
6737
+ const SupervisorInboxTableConfig = _ref => {
6738
+ var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _formState$tableForm, _formState$tableForm2;
6739
+ let onPageSizeChange = _ref.onPageSizeChange,
6740
+ formState = _ref.formState,
6741
+ totalCount = _ref.totalCount,
6742
+ table = _ref.table,
6743
+ dispatch = _ref.dispatch,
6744
+ onSortingByData = _ref.onSortingByData,
6745
+ _ref$inboxStyles = _ref.inboxStyles,
6746
+ inboxStyles = _ref$inboxStyles === void 0 ? {} : _ref$inboxStyles,
6747
+ _ref$tableStyle = _ref.tableStyle,
6748
+ tableStyle = _ref$tableStyle === void 0 ? {} : _ref$tableStyle;
6749
+ const _useTranslation = useTranslation(),
6750
+ t = _useTranslation.t;
6751
+ const history = useHistory();
6752
+ const userType = ((_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.type) === null || _Digit$SessionStorage3 === void 0 ? void 0 : _Digit$SessionStorage3.toLowerCase()) || "citizen";
6753
+ const handleReview = id => {
6754
+ history.push("/digit-ui/" + userType + "/ekyc/assign/surveyor-details/" + id);
6755
+ };
6756
+ const limit = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10;
6757
+ const offset = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0;
6758
+ return {
6759
+ disableSort: false,
6760
+ autoSort: false,
6761
+ manualPagination: true,
6762
+ currentPage: Math.floor(offset / limit),
6763
+ onPageSizeChange,
6764
+ onNextPage: () => dispatch({
6765
+ action: "mutateTableForm",
6766
+ data: _extends({}, formState.tableForm, {
6767
+ offset: Number(offset) + Number(limit)
6768
+ })
6769
+ }),
6770
+ onPrevPage: () => dispatch({
6771
+ action: "mutateTableForm",
6772
+ data: _extends({}, formState.tableForm, {
6773
+ offset: Number(offset) - Number(limit)
6774
+ })
6775
+ }),
6776
+ onLastPage: () => dispatch({
6777
+ action: "mutateTableForm",
6778
+ data: _extends({}, formState.tableForm, {
6779
+ offset: Math.ceil(totalCount / limit) * limit - Number(limit)
6780
+ })
6781
+ }),
6782
+ onFirstPage: () => dispatch({
6783
+ action: "mutateTableForm",
6784
+ data: _extends({}, formState.tableForm, {
6785
+ offset: 0
6786
+ })
6787
+ }),
6788
+ totalRecords: totalCount,
6789
+ onSort: onSortingByData,
6790
+ data: table,
6791
+ columns: tableColumnConfig(t, handleReview),
6792
+ inboxStyles: _extends({}, inboxStyles),
6793
+ tableStyle: _extends({}, tableStyle)
6794
+ };
6795
+ };
6796
+
6797
+ const AssignEkyc = () => {
6798
+ var _formState$tableForm, _formState$tableForm2, _formState$tableForm3, _formState$tableForm4, _formState$searchForm, _dashboardData$dashbo;
6799
+ let tenantId = Digit.ULBService.getCurrentTenantId();
6800
+ if (!tenantId || tenantId === "dl") {
6801
+ tenantId = "dl.djb";
6802
+ }
6803
+ const _useReducer = useReducer(formReducer, formInitValue),
6804
+ formState = _useReducer[0],
6805
+ dispatch = _useReducer[1];
6806
+ let paginationParms = {
6807
+ limit: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10,
6808
+ offset: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0,
6809
+ sortBy: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm3 = formState.tableForm) === null || _formState$tableForm3 === void 0 ? void 0 : _formState$tableForm3.sortBy) || "createdTime",
6810
+ sortOrder: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm4 = formState.tableForm) === null || _formState$tableForm4 === void 0 ? void 0 : _formState$tableForm4.sortOrder) || "DESC"
6811
+ };
6812
+ const mobileNumber = (formState === null || formState === void 0 ? void 0 : (_formState$searchForm = formState.searchForm) === null || _formState$searchForm === void 0 ? void 0 : _formState$searchForm.mobileNumber) || "";
6813
+ const isSearchActive = !!mobileNumber;
6814
+ const filters = _extends({}, paginationParms, {
6815
+ status: "ACTIVE,DISABLED"
6816
+ });
6817
+ if (isSearchActive) {
6818
+ filters.mobileNumber = mobileNumber;
6819
+ }
6820
+ const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSurveyorSearch(tenantId, filters, {
6821
+ enabled: !!tenantId,
6822
+ keepPreviousData: true
6823
+ }),
6824
+ dashboardData = _Digit$Hooks$fsm$useS.data,
6825
+ isLoading = _Digit$Hooks$fsm$useS.isLoading;
6826
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycAssignmentProgress({
6827
+ enabled: !!tenantId,
6828
+ keepPreviousData: true
6829
+ }),
6830
+ isDataSearchLoading = _Digit$Hooks$ekyc$use.isLoading;
6831
+ const sourceData = useMemo(() => {
6832
+ return (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.surveyors) || [];
6833
+ }, [dashboardData]);
6834
+ const filteredData = useMemo(() => {
6835
+ return (sourceData || []).map(item => {
6836
+ var _owner$roles, _owner$roles$map, _item$additionalDetai, _item$auditDetails, _item$auditDetails2;
6837
+ const owner = (item === null || item === void 0 ? void 0 : item.owner) || {};
6838
+ const roleCodes = (owner === null || owner === void 0 ? void 0 : (_owner$roles = owner.roles) === null || _owner$roles === void 0 ? void 0 : (_owner$roles$map = _owner$roles.map(role => role.code)) === null || _owner$roles$map === void 0 ? void 0 : _owner$roles$map.join(", ")) || "";
6839
+ return _extends({}, item, {
6840
+ id: (item === null || item === void 0 ? void 0 : item.id) || "",
6841
+ surveyorName: (item === null || item === void 0 ? void 0 : item.name) || (owner === null || owner === void 0 ? void 0 : owner.name) || "",
6842
+ mobileNo: (item === null || item === void 0 ? void 0 : item.mobileNo) || (owner === null || owner === void 0 ? void 0 : owner.mobileNumber) || "",
6843
+ email: (owner === null || owner === void 0 ? void 0 : owner.emailId) || "",
6844
+ vendorId: (item === null || item === void 0 ? void 0 : item.vendorId) || "",
6845
+ tenantId: (item === null || item === void 0 ? void 0 : item.tenantId) || "",
6846
+ supervisorId: (item === null || item === void 0 ? void 0 : item.supervisorId) || "",
6847
+ status: (item === null || item === void 0 ? void 0 : item.status) || "",
6848
+ roleCodes,
6849
+ userName: (owner === null || owner === void 0 ? void 0 : owner.userName) || "",
6850
+ gender: (owner === null || owner === void 0 ? void 0 : owner.gender) || "",
6851
+ serviceType: (item === null || item === void 0 ? void 0 : (_item$additionalDetai = item.additionalDetails) === null || _item$additionalDetai === void 0 ? void 0 : _item$additionalDetai.serviceType) || "",
6852
+ createdTime: (item === null || item === void 0 ? void 0 : (_item$auditDetails = item.auditDetails) === null || _item$auditDetails === void 0 ? void 0 : _item$auditDetails.createdTime) || 0,
6853
+ lastModifiedTime: (item === null || item === void 0 ? void 0 : (_item$auditDetails2 = item.auditDetails) === null || _item$auditDetails2 === void 0 ? void 0 : _item$auditDetails2.lastModifiedTime) || 0
6854
+ });
6855
+ });
6856
+ }, [sourceData]);
6857
+ const totalRecords = (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.totalRecords) || (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.totalCount) || 0;
6858
+ const SearchFormFields = useCallback(_ref => {
6859
+ let registerRef = _ref.registerRef,
6860
+ searchFormState = _ref.searchFormState,
6861
+ controlSearchForm = _ref.controlSearchForm;
6862
+ return /*#__PURE__*/React.createElement(SearchFormFieldsComponents, {
6863
+ registerRef,
6864
+ searchFormState,
6865
+ controlSearchForm,
6866
+ searchType: "mobile",
6867
+ className: "search"
6868
+ });
6869
+ }, []);
6870
+ const tableOrderFormDefaultValues = {
6871
+ sortBy: "createdTime",
6872
+ limit: window.Digit.Utils.browser.isMobile() ? 50 : 10,
6873
+ offset: 0,
6874
+ sortOrder: "DESC"
6875
+ };
6876
+ const onSearchFormSubmit = data => {
6877
+ data.hasOwnProperty("") && (data === null || data === void 0 ? true : delete data[""]);
6878
+ dispatch({
6879
+ action: "mutateTableForm",
6880
+ data: _extends({}, tableOrderFormDefaultValues)
6881
+ });
6882
+ dispatch({
6883
+ action: "mutateSearchForm",
6884
+ data
6885
+ });
6886
+ };
6887
+ const searchFormDefaultValues = {
6888
+ mobileNumber: "",
6889
+ applicationNumber: "",
6890
+ consumerNo: ""
6891
+ };
6892
+ const onSearchFormReset = setSearchFormValue => {
6893
+ setSearchFormValue("mobileNumber", null);
6894
+ setSearchFormValue("applicationNumber", null);
6895
+ setSearchFormValue("consumerNo", null);
6896
+ dispatch({
6897
+ action: "mutateSearchForm",
6898
+ data: searchFormDefaultValues
6899
+ });
6900
+ };
6901
+ const propsForSearchForm = {
6902
+ SearchFormFields,
6903
+ onSearchFormSubmit,
6904
+ searchFormDefaultValues: formState === null || formState === void 0 ? void 0 : formState.searchForm,
6905
+ resetSearchFormDefaultValues: searchFormDefaultValues,
6906
+ onSearchFormReset,
6907
+ className: "search-form-wns-inbox"
6908
+ };
6909
+ const onPageSizeChange = e => {
6910
+ const newLimit = Number(e.target.value);
6911
+ dispatch({
6912
+ action: "mutateTableForm",
6913
+ data: _extends({}, formState.tableForm, {
6914
+ limit: newLimit,
6915
+ offset: 0
6916
+ })
6917
+ });
6918
+ };
6919
+ const onSortingByData = e => {
6920
+ if (e.length > 0) {
6921
+ const _e$ = e[0],
6922
+ id = _e$.id,
6923
+ desc = _e$.desc;
6924
+ const sortOrder = desc ? "DESC" : "ASC";
6925
+ const sortBy = id;
6926
+ if (!(formState.tableForm.sortBy === sortBy && formState.tableForm.sortOrder === sortOrder)) {
6927
+ dispatch({
6928
+ action: "mutateTableForm",
6929
+ data: _extends({}, formState.tableForm, {
6930
+ sortBy: id,
6931
+ sortOrder: desc ? "DESC" : "ASC"
6932
+ })
6933
+ });
6934
+ }
8005
6935
  }
8006
- })), roles.includes("EKYC_SUPERVISOR") && /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
8007
- label: t("EKYC_ASSIGN_KNOS"),
8008
- onSubmit: () => setShowOptions(prev => !prev)
8009
- }), showOptions && /*#__PURE__*/React.createElement(Menu, {
8010
- options: options,
8011
- optionKey: "action",
8012
- t: t,
8013
- onSelect: handleMenuSelect,
8014
- style: {
8015
- color: "#FFFFFF",
8016
- fontSize: "18px"
6936
+ };
6937
+ const propsForInboxTable = SupervisorInboxTableConfig(_extends({}, {
6938
+ onPageSizeChange,
6939
+ formState,
6940
+ totalCount: totalRecords,
6941
+ table: filteredData,
6942
+ dispatch,
6943
+ onSortingByData,
6944
+ tenantId,
6945
+ inboxStyles: {
6946
+ overflowX: "scroll",
6947
+ overflowY: "hidden"
6948
+ },
6949
+ tableStyle: {
6950
+ width: "70%"
8017
6951
  }
8018
- })), showModal && /*#__PURE__*/React.createElement(AssignEkycModal, {
8019
- surveyor: surveyor,
8020
- closeModal: closeModal,
8021
- refetchDashboard: refetchDashboard
8022
6952
  }));
8023
- };
8024
-
8025
- const vendors = [{
8026
- id: 1,
8027
- name: "Vendor Alpha",
8028
- progress: 78,
8029
- supervisors: 12,
8030
- surveyors: 148,
8031
- completed: 154200,
8032
- pending: 43200,
8033
- rejected: 3200
8034
- }, {
8035
- id: 2,
8036
- name: "Vendor Beta",
8037
- progress: 64,
8038
- supervisors: 10,
8039
- surveyors: 122,
8040
- completed: 121000,
8041
- pending: 68500,
8042
- rejected: 2800
8043
- }, {
8044
- id: 3,
8045
- name: "Vendor Gamma",
8046
- progress: 91,
8047
- supervisors: 15,
8048
- surveyors: 182,
8049
- completed: 201500,
8050
- pending: 19800,
8051
- rejected: 1800
8052
- }];
8053
- const zones = [{
8054
- zone: "North Delhi",
8055
- totalConnections: 220000,
8056
- ekycDone: 172000,
8057
- liveSurveyors: 58,
8058
- todayCompleted: 2800
8059
- }, {
8060
- zone: "South Delhi",
8061
- totalConnections: 198000,
8062
- ekycDone: 154500,
8063
- liveSurveyors: 42,
8064
- todayCompleted: 2100
8065
- }, {
8066
- zone: "East Delhi",
8067
- totalConnections: 175000,
8068
- ekycDone: 132800,
8069
- liveSurveyors: 37,
8070
- todayCompleted: 1740
8071
- }, {
8072
- zone: "West Delhi",
8073
- totalConnections: 212000,
8074
- ekycDone: 188300,
8075
- liveSurveyors: 48,
8076
- todayCompleted: 2560
8077
- }];
8078
- const alerts = ["15 Surveyors inactive for more than 2 hours", "Vendor Beta completion dropped by 12% this week", "North Delhi has highest pending backlog", "2,843 eKYC applications rejected today"];
8079
- const CeoDashboard$1 = () => {
6953
+ const isInboxLoading = isLoading;
6954
+ const onMobileSortOrderData = data => {
6955
+ const sortOrder = data.sortOrder;
6956
+ dispatch({
6957
+ action: "mutateTableForm",
6958
+ data: _extends({}, formState.tableForm, {
6959
+ sortOrder
6960
+ })
6961
+ });
6962
+ };
6963
+ const onSortFormReset = setSortFormValue => {
6964
+ setSortFormValue("sortOrder", "DESC");
6965
+ dispatch({
6966
+ action: "mutateTableForm",
6967
+ data: tableOrderFormDefaultValues
6968
+ });
6969
+ };
6970
+ const propsForMobileSortForm = {
6971
+ onMobileSortOrderData,
6972
+ sortFormDefaultValues: formState === null || formState === void 0 ? void 0 : formState.tableForm,
6973
+ onSortFormReset
6974
+ };
6975
+ const propsForInboxMobileCards = useInboxMobileCardsData({
6976
+ table: filteredData,
6977
+ isSupervisor: true
6978
+ });
8080
6979
  return /*#__PURE__*/React.createElement("div", {
8081
- className: "ekyc-dashboard-wrapper"
8082
- }, /*#__PURE__*/React.createElement("div", {
8083
- className: "ceo-dashboard"
8084
- }, /*#__PURE__*/React.createElement("main", {
8085
- className: "main-content"
8086
- }, /*#__PURE__*/React.createElement("div", {
8087
- className: "kpi-grid"
8088
- }, /*#__PURE__*/React.createElement("div", {
8089
- className: "kpi-card primary"
8090
- }, /*#__PURE__*/React.createElement("div", {
8091
- className: "icon-box"
8092
- }, /*#__PURE__*/React.createElement(FaUsers, null)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", null, "7,85,000"), /*#__PURE__*/React.createElement("p", null, "Total Water Connections"))), /*#__PURE__*/React.createElement("div", {
8093
- className: "kpi-card success"
8094
- }, /*#__PURE__*/React.createElement("div", {
8095
- className: "icon-box"
8096
- }, /*#__PURE__*/React.createElement(FaCheckCircle, null)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", null, "6,47,300"), /*#__PURE__*/React.createElement("p", null, "eKYC Completed"))), /*#__PURE__*/React.createElement("div", {
8097
- className: "kpi-card warning"
8098
- }, /*#__PURE__*/React.createElement("div", {
8099
- className: "icon-box"
8100
- }, /*#__PURE__*/React.createElement(FaClock, null)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", null, "1,31,500"), /*#__PURE__*/React.createElement("p", null, "Pending eKYC"))), /*#__PURE__*/React.createElement("div", {
8101
- className: "kpi-card danger"
8102
- }, /*#__PURE__*/React.createElement("div", {
8103
- className: "icon-box"
8104
- }, /*#__PURE__*/React.createElement(FaExclamationTriangle, null)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", null, "7,200"), /*#__PURE__*/React.createElement("p", null, "Rejected Applications")))), /*#__PURE__*/React.createElement("section", {
8105
- className: "dashboard-section"
8106
- }, /*#__PURE__*/React.createElement("div", {
8107
- className: "section-header"
8108
- }, /*#__PURE__*/React.createElement("h2", null, /*#__PURE__*/React.createElement(FaChartLine, null), " Vendor Performance Overview"), /*#__PURE__*/React.createElement("button", null, "View All")), /*#__PURE__*/React.createElement("div", {
8109
- className: "vendor-grid"
8110
- }, vendors.map(vendor => /*#__PURE__*/React.createElement("div", {
8111
- className: "vendor-card",
8112
- key: vendor.id
8113
- }, /*#__PURE__*/React.createElement("div", {
8114
- className: "vendor-top"
8115
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", null, vendor.name), /*#__PURE__*/React.createElement("p", null, "Jurisdiction Assigned Vendor")), /*#__PURE__*/React.createElement("span", null, vendor.progress, "%")), /*#__PURE__*/React.createElement("div", {
8116
- className: "progress-bar"
8117
- }, /*#__PURE__*/React.createElement("div", {
8118
- className: "progress-fill",
8119
- style: {
8120
- width: vendor.progress + "%"
8121
- }
8122
- })), /*#__PURE__*/React.createElement("div", {
8123
- className: "vendor-stats"
8124
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h4", null, vendor.supervisors), /*#__PURE__*/React.createElement("p", null, "Supervisors")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h4", null, vendor.surveyors), /*#__PURE__*/React.createElement("p", null, "Surveyors")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h4", null, vendor.completed), /*#__PURE__*/React.createElement("p", null, "Completed"))), /*#__PURE__*/React.createElement("div", {
8125
- className: "vendor-footer"
8126
- }, /*#__PURE__*/React.createElement("span", null, "Pending: ", vendor.pending), /*#__PURE__*/React.createElement("span", null, "Rejected: ", vendor.rejected)))))), /*#__PURE__*/React.createElement("section", {
8127
- className: "dashboard-section"
8128
- }, /*#__PURE__*/React.createElement("div", {
8129
- className: "section-header"
8130
- }, /*#__PURE__*/React.createElement("h2", null, /*#__PURE__*/React.createElement(FaMapMarkedAlt, null), " Jurisdiction Monitoring"), /*#__PURE__*/React.createElement("button", null, "Export Data")), /*#__PURE__*/React.createElement("div", {
8131
- className: "table-wrapper"
8132
- }, /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", null, "Zone"), /*#__PURE__*/React.createElement("th", null, "Total Connections"), /*#__PURE__*/React.createElement("th", null, "eKYC Done"), /*#__PURE__*/React.createElement("th", null, "Live Surveyors"), /*#__PURE__*/React.createElement("th", null, "Today's Completion"), /*#__PURE__*/React.createElement("th", null, "Status"))), /*#__PURE__*/React.createElement("tbody", null, zones.map((item, index) => /*#__PURE__*/React.createElement("tr", {
8133
- key: index
8134
- }, /*#__PURE__*/React.createElement("td", null, item.zone), /*#__PURE__*/React.createElement("td", null, item.totalConnections), /*#__PURE__*/React.createElement("td", null, item.ekycDone), /*#__PURE__*/React.createElement("td", null, item.liveSurveyors), /*#__PURE__*/React.createElement("td", null, item.todayCompleted), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", {
8135
- className: "status-badge success"
8136
- }, "Active")))))))), /*#__PURE__*/React.createElement("div", {
8137
- className: "bottom-grid"
8138
- }, /*#__PURE__*/React.createElement("section", {
8139
- className: "dashboard-section alerts-section"
8140
- }, /*#__PURE__*/React.createElement("div", {
8141
- className: "section-header"
8142
- }, /*#__PURE__*/React.createElement("h2", null, /*#__PURE__*/React.createElement(FaExclamationTriangle, null), " Critical Alerts")), /*#__PURE__*/React.createElement("div", {
8143
- className: "alerts-list"
8144
- }, alerts.map((alert, index) => /*#__PURE__*/React.createElement("div", {
8145
- className: "alert-card",
8146
- key: index
8147
- }, /*#__PURE__*/React.createElement(FaExclamationTriangle, null), /*#__PURE__*/React.createElement("p", null, alert))))), /*#__PURE__*/React.createElement("section", {
8148
- className: "dashboard-section team-section"
8149
- }, /*#__PURE__*/React.createElement("div", {
8150
- className: "section-header"
8151
- }, /*#__PURE__*/React.createElement("h2", null, /*#__PURE__*/React.createElement(FaUserTie, null), " Workforce Monitoring")), /*#__PURE__*/React.createElement("div", {
8152
- className: "team-stats-grid"
8153
- }, /*#__PURE__*/React.createElement("div", {
8154
- className: "team-box"
8155
- }, /*#__PURE__*/React.createElement("h3", null, "37"), /*#__PURE__*/React.createElement("p", null, "Total Supervisors Online")), /*#__PURE__*/React.createElement("div", {
8156
- className: "team-box"
8157
- }, /*#__PURE__*/React.createElement("h3", null, "154"), /*#__PURE__*/React.createElement("p", null, "Surveyors Active")), /*#__PURE__*/React.createElement("div", {
8158
- className: "team-box"
8159
- }, /*#__PURE__*/React.createElement("h3", null, "12,430"), /*#__PURE__*/React.createElement("p", null, "Today's eKYC Completed")), /*#__PURE__*/React.createElement("div", {
8160
- className: "team-box"
8161
- }, /*#__PURE__*/React.createElement("h3", null, "92%"), /*#__PURE__*/React.createElement("p", null, "Operational Efficiency"))))))));
6980
+ className: "app-container"
6981
+ }, /*#__PURE__*/React.createElement(InboxComposer, _extends({
6982
+ isInboxLoading
6983
+ }, propsForSearchForm, propsForMobileSortForm, {
6984
+ propsForInboxTable,
6985
+ propsForInboxMobileCards,
6986
+ formState,
6987
+ countData: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
6988
+ isCardLoading: isDataSearchLoading,
6989
+ showSearchOnMobile: true,
6990
+ forceTable: true
6991
+ })));
8162
6992
  };
8163
6993
 
8164
6994
  const breadcrumb = (userType, listLabel, listPath, detailLabel) => [{
@@ -8182,26 +7012,11 @@ const getEkycRoutes = userType => [{
8182
7012
  component: Review,
8183
7013
  layout: "normal",
8184
7014
  breadcrumb: "EKYC_REVIEW"
8185
- }, {
8186
- path: "/create-kyc",
8187
- component: Create,
8188
- layout: "normal",
8189
- breadcrumb: "EKYC_CREATE_KYC"
8190
- }, {
8191
- path: "/mapping",
8192
- component: Mapping,
8193
- layout: "normal",
8194
- breadcrumb: "EKYC_MAPPING"
8195
7015
  }, {
8196
7016
  path: "/admin-dashboard",
8197
7017
  component: AdminDashboard,
8198
7018
  layout: "normal",
8199
7019
  breadcrumb: "EKYC_ADMIN_DASHBOARD"
8200
- }, {
8201
- path: "/ceo-dashboard",
8202
- component: CeoDashboard$1,
8203
- layout: "normal",
8204
- breadcrumb: "CEO_M.F_DOR_FINANCE_VIEW"
8205
7020
  }, {
8206
7021
  path: "/consumer-details",
8207
7022
  component: EKYCForm,
@@ -8334,16 +7149,6 @@ const EmployeeApp = _ref => {
8334
7149
  moduleCode: "EKYC",
8335
7150
  isInbox: true
8336
7151
  }))
8337
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
8338
- path: path + "/create-kyc",
8339
- component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
8340
- layoutClass: "normal"
8341
- }, /*#__PURE__*/React.createElement(Create, null))
8342
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
8343
- path: path + "/mapping",
8344
- component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
8345
- layoutClass: "normal"
8346
- }, /*#__PURE__*/React.createElement(Mapping, null))
8347
7152
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
8348
7153
  path: path + "/assign/surveyor-details/:id",
8349
7154
  exact: true,
@@ -8362,11 +7167,6 @@ const EmployeeApp = _ref => {
8362
7167
  component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
8363
7168
  layoutClass: "action"
8364
7169
  }, /*#__PURE__*/React.createElement(Review, null))
8365
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
8366
- path: path + "/ceo-dashboard",
8367
- component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
8368
- layoutClass: "normal"
8369
- }, /*#__PURE__*/React.createElement(CeoDashboard, null))
8370
7170
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
8371
7171
  path: path + "/admin-dashboard",
8372
7172
  component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {