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