@djb25/digit-ui-module-ekyc 1.0.47 → 1.0.49

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,15 +72,15 @@ 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
  }, {
82
78
  count: totalCount,
83
79
  label: t("EKYC_INBOX"),
84
80
  link: prefix + "/inbox"
81
+ }, {
82
+ label: t("EKYC_WORK_ORDER"),
83
+ link: prefix + "/work-order"
85
84
  }, ...(!roles.includes("EMPLOYEE") ? [{
86
85
  label: t("EKYC_ASSIGN"),
87
86
  link: prefix + "/assign"
@@ -1361,452 +1360,6 @@ const ekycMockData = {
1361
1360
  }]
1362
1361
  };
1363
1362
 
1364
- const ExecutiveLineChart = _ref => {
1365
- let _ref$data = _ref.data,
1366
- data = _ref$data === void 0 ? [] : _ref$data;
1367
- const formattedData = data.map(item => _extends({}, item, {
1368
- agencyKyc: item.completed || 0,
1369
- selfKyc: Math.round((item.completed || 0) * 0.42),
1370
- totalKyc: (item.completed || 0) + Math.round((item.completed || 0) * 0.42)
1371
- }));
1372
- return /*#__PURE__*/React__default.createElement("div", {
1373
- className: "chart-card executive-line-chart"
1374
- }, /*#__PURE__*/React__default.createElement(recharts.ResponsiveContainer, {
1375
- width: "100%",
1376
- height: 340
1377
- }, /*#__PURE__*/React__default.createElement(recharts.LineChart, {
1378
- data: formattedData,
1379
- margin: {
1380
- top: 20,
1381
- right: 12,
1382
- left: 0,
1383
- bottom: 0
1384
- }
1385
- }, /*#__PURE__*/React__default.createElement(recharts.CartesianGrid, {
1386
- stroke: "#e2e8f0",
1387
- strokeDasharray: "3 3",
1388
- vertical: false
1389
- }), /*#__PURE__*/React__default.createElement(recharts.XAxis, {
1390
- dataKey: "label",
1391
- axisLine: false,
1392
- tickLine: false,
1393
- tick: {
1394
- fill: "#64748b",
1395
- fontSize: 12,
1396
- fontWeight: 600
1397
- }
1398
- }), /*#__PURE__*/React__default.createElement(recharts.YAxis, {
1399
- axisLine: false,
1400
- tickLine: false,
1401
- tick: {
1402
- fill: "#64748b",
1403
- fontSize: 12
1404
- }
1405
- }), /*#__PURE__*/React__default.createElement(recharts.Tooltip, {
1406
- cursor: {
1407
- stroke: "#cbd5e1",
1408
- strokeWidth: 1
1409
- },
1410
- contentStyle: {
1411
- background: "#ffffff",
1412
- border: "1px solid #e2e8f0",
1413
- borderRadius: 18,
1414
- boxShadow: "0 10px 30px rgba(15,23,42,0.08)"
1415
- },
1416
- labelStyle: {
1417
- color: "#0f172a",
1418
- fontWeight: 700,
1419
- marginBottom: 10
1420
- }
1421
- }), /*#__PURE__*/React__default.createElement(recharts.Legend, {
1422
- verticalAlign: "top",
1423
- align: "right",
1424
- iconType: "circle",
1425
- wrapperStyle: {
1426
- paddingBottom: 18,
1427
- color: "#475569",
1428
- fontWeight: 600
1429
- }
1430
- }), /*#__PURE__*/React__default.createElement(recharts.Line, {
1431
- type: "monotone",
1432
- dataKey: "totalKyc",
1433
- name: "Total eKYC",
1434
- stroke: "#0f172a",
1435
- strokeWidth: 4,
1436
- dot: false,
1437
- activeDot: {
1438
- r: 6
1439
- }
1440
- }), /*#__PURE__*/React__default.createElement(recharts.Line, {
1441
- type: "monotone",
1442
- dataKey: "agencyKyc",
1443
- name: "Agency eKYC",
1444
- stroke: "#3b82f6",
1445
- strokeWidth: 3,
1446
- dot: {
1447
- r: 3
1448
- },
1449
- activeDot: {
1450
- r: 6
1451
- }
1452
- }), /*#__PURE__*/React__default.createElement(recharts.Line, {
1453
- type: "monotone",
1454
- dataKey: "selfKyc",
1455
- name: "Self eKYC",
1456
- stroke: "#10b981",
1457
- strokeWidth: 3,
1458
- dot: {
1459
- r: 3
1460
- },
1461
- activeDot: {
1462
- r: 6
1463
- }
1464
- }))));
1465
- };
1466
-
1467
- const ExecutiveBarChart = _ref => {
1468
- let _ref$data = _ref.data,
1469
- data = _ref$data === void 0 ? [] : _ref$data,
1470
- _ref$categories = _ref.categories,
1471
- categories = _ref$categories === void 0 ? [] : _ref$categories,
1472
- _ref$xKey = _ref.xKey,
1473
- xKey = _ref$xKey === void 0 ? "label" : _ref$xKey;
1474
- return /*#__PURE__*/React__default.createElement("div", {
1475
- className: "chart-card",
1476
- style: {
1477
- minHeight: 320
1478
- }
1479
- }, /*#__PURE__*/React__default.createElement(recharts.ResponsiveContainer, {
1480
- width: "100%",
1481
- height: 320
1482
- }, /*#__PURE__*/React__default.createElement(recharts.BarChart, {
1483
- data: data,
1484
- margin: {
1485
- top: 12,
1486
- right: 16,
1487
- left: 0,
1488
- bottom: 0
1489
- }
1490
- }, /*#__PURE__*/React__default.createElement(recharts.CartesianGrid, {
1491
- stroke: "rgba(148, 163, 184, 0.12)",
1492
- strokeDasharray: "4 4"
1493
- }), /*#__PURE__*/React__default.createElement(recharts.XAxis, {
1494
- dataKey: xKey,
1495
- axisLine: false,
1496
- tickLine: false,
1497
- tick: {
1498
- fill: "#cbd5e1"
1499
- }
1500
- }), /*#__PURE__*/React__default.createElement(recharts.YAxis, {
1501
- axisLine: false,
1502
- tickLine: false,
1503
- tick: {
1504
- fill: "#cbd5e1"
1505
- }
1506
- }), /*#__PURE__*/React__default.createElement(recharts.Tooltip, {
1507
- contentStyle: {
1508
- background: "#0f172a",
1509
- border: "none",
1510
- borderRadius: 14
1511
- },
1512
- itemStyle: {
1513
- color: "#f8fafc"
1514
- }
1515
- }), /*#__PURE__*/React__default.createElement(recharts.Legend, {
1516
- verticalAlign: "top",
1517
- align: "right",
1518
- iconType: "circle",
1519
- wrapperStyle: {
1520
- color: "#cbd5e1"
1521
- }
1522
- }), categories.map((series, index) => /*#__PURE__*/React__default.createElement(recharts.Bar, {
1523
- key: series.key,
1524
- dataKey: series.key,
1525
- name: series.name,
1526
- fill: index === 0 ? "#34d399" : "#60a5fa",
1527
- radius: [12, 12, 0, 0],
1528
- barSize: 24
1529
- })))));
1530
- };
1531
-
1532
- const colors = ["#22c55e", "#38bdf8", "#f97316", "#facc15", "#f43f5e"];
1533
- const ExecutivePieChart = _ref => {
1534
- let _ref$data = _ref.data,
1535
- data = _ref$data === void 0 ? [] : _ref$data,
1536
- _ref$dataKey = _ref.dataKey,
1537
- dataKey = _ref$dataKey === void 0 ? "value" : _ref$dataKey,
1538
- _ref$labelKey = _ref.labelKey,
1539
- labelKey = _ref$labelKey === void 0 ? "label" : _ref$labelKey;
1540
- return /*#__PURE__*/React__default.createElement("div", {
1541
- className: "chart-card",
1542
- style: {
1543
- minHeight: 320
1544
- }
1545
- }, /*#__PURE__*/React__default.createElement(recharts.ResponsiveContainer, {
1546
- width: "100%",
1547
- height: 320
1548
- }, /*#__PURE__*/React__default.createElement(recharts.PieChart, null, /*#__PURE__*/React__default.createElement(recharts.Pie, {
1549
- data: data,
1550
- dataKey: dataKey,
1551
- nameKey: labelKey,
1552
- cx: "50%",
1553
- cy: "50%",
1554
- outerRadius: 110,
1555
- innerRadius: 60,
1556
- paddingAngle: 3,
1557
- label: {
1558
- fill: "#f8fafc",
1559
- fontSize: 12
1560
- }
1561
- }, data.map((entry, index) => /*#__PURE__*/React__default.createElement(recharts.Cell, {
1562
- key: "cell-" + index,
1563
- fill: colors[index % colors.length]
1564
- }))), /*#__PURE__*/React__default.createElement(recharts.Tooltip, {
1565
- contentStyle: {
1566
- background: "#0f172a",
1567
- border: "none",
1568
- borderRadius: 14,
1569
- color: "#f8fafc"
1570
- }
1571
- }), /*#__PURE__*/React__default.createElement(recharts.Legend, {
1572
- verticalAlign: "bottom",
1573
- align: "center",
1574
- iconType: "circle",
1575
- wrapperStyle: {
1576
- color: "#cbd5e1",
1577
- marginTop: 10
1578
- }
1579
- }))));
1580
- };
1581
-
1582
- const CeoDashboard = () => {
1583
- var _topKpis$todayEkyc;
1584
- const history = reactRouterDom.useHistory();
1585
- const location = reactRouterDom.useLocation();
1586
- const _useState = React.useState(""),
1587
- query = _useState[0],
1588
- setQuery = _useState[1];
1589
- const _useState2 = React.useState("All"),
1590
- statusFilter = _useState2[0],
1591
- setStatusFilter = _useState2[1];
1592
- const basePath = location.pathname.replace(/\/ceo-dashboard$/, "");
1593
- const filters = ["All", "High Priority", "Stable", "Watchlist"];
1594
- const vendors = React.useMemo(() => ekycMockData.vendors || [], []);
1595
- const topKpis = React.useMemo(() => ekycMockData.topKpis || {}, []);
1596
- const dailyTrend = React.useMemo(() => ekycMockData.dailyTrend || [], []);
1597
- const selfVsAgency = React.useMemo(() => ekycMockData.selfVsAgency || [], []);
1598
- const pendingVsCompleted = React.useMemo(() => ekycMockData.pendingVsCompleted || [], []);
1599
- const filteredVendors = React.useMemo(() => {
1600
- return vendors.filter(vendor => {
1601
- if (statusFilter === "High Priority") return vendor.successRate < 70;
1602
- if (statusFilter === "Watchlist") return vendor.pending > 35000;
1603
- if (statusFilter === "Stable") return vendor.successRate >= 70;
1604
- return true;
1605
- }).filter(vendor => {
1606
- if (!query) return true;
1607
- const keyword = query.toLowerCase();
1608
- return vendor.name.toLowerCase().includes(keyword) || vendor.jurisdictions.some(zone => zone.toLowerCase().includes(keyword)) || vendor.zones.some(zone => {
1609
- var _zone$location;
1610
- return (_zone$location = zone.location) === null || _zone$location === void 0 ? void 0 : _zone$location.toLowerCase().includes(keyword);
1611
- });
1612
- });
1613
- }, [vendors, query, statusFilter]);
1614
- const zoneRows = React.useMemo(() => {
1615
- return vendors.flatMap(vendor => vendor.zones.map(zone => _extends({}, zone, {
1616
- agency: vendor.name
1617
- }))).filter(row => row.location).sort((a, b) => (b.activeDemand || 0) - (a.activeDemand || 0));
1618
- }, [vendors]);
1619
- 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"];
1620
- const routeToVendor = vendorId => {
1621
- history.push(basePath + "/vendors/" + vendorId);
1622
- };
1623
- return /*#__PURE__*/React__default.createElement("div", {
1624
- className: "ekyc-dashboard-wrapper"
1625
- }, /*#__PURE__*/React__default.createElement("div", {
1626
- className: "dashboard-shell"
1627
- }, /*#__PURE__*/React__default.createElement("section", {
1628
- className: "kpi-grid"
1629
- }, [{
1630
- title: "Total Water Connections",
1631
- value: topKpis.totalWaterConnections,
1632
- icon: /*#__PURE__*/React__default.createElement(fa.FaUsers, null),
1633
- variant: "primary"
1634
- }, {
1635
- title: "Total eKYC Completed",
1636
- value: topKpis.totalEkycCompleted,
1637
- icon: /*#__PURE__*/React__default.createElement(fa.FaCheckCircle, null),
1638
- variant: "success"
1639
- }, {
1640
- title: "Total Pending",
1641
- value: topKpis.totalPending,
1642
- icon: /*#__PURE__*/React__default.createElement(fa.FaClock, null),
1643
- variant: "warning"
1644
- }, {
1645
- title: "Total Rejected",
1646
- value: topKpis.totalRejected,
1647
- icon: /*#__PURE__*/React__default.createElement(fa.FaExclamationTriangle, null),
1648
- variant: "danger"
1649
- }, {
1650
- title: "Agency eKYC Completed",
1651
- value: topKpis.agencyEkycCompleted,
1652
- icon: /*#__PURE__*/React__default.createElement(fa.FaUserTie, null),
1653
- variant: "info"
1654
- }, {
1655
- title: "Citizen Self eKYC Completed",
1656
- value: topKpis.citizenSelfEkycCompleted,
1657
- icon: /*#__PURE__*/React__default.createElement(fa.FaUsers, null),
1658
- variant: "secondary"
1659
- }, {
1660
- title: "Today's eKYC",
1661
- value: topKpis.todaysEkyc,
1662
- icon: /*#__PURE__*/React__default.createElement(fa.FaChartLine, null),
1663
- variant: "muted"
1664
- }, {
1665
- title: "Success Rate",
1666
- value: topKpis.successRate + "%",
1667
- icon: /*#__PURE__*/React__default.createElement(fa.FaCheckCircle, null),
1668
- variant: "success"
1669
- }, {
1670
- title: "Rejection Percentage",
1671
- value: topKpis.rejectionPercentage + "%",
1672
- icon: /*#__PURE__*/React__default.createElement(fa.FaExclamationTriangle, null),
1673
- variant: "danger"
1674
- }].map(card => {
1675
- var _card$value$toLocaleS, _card$value, _card$value$toLocaleS2;
1676
- return /*#__PURE__*/React__default.createElement("article", {
1677
- key: card.title,
1678
- className: "kpi-card card-" + card.variant
1679
- }, /*#__PURE__*/React__default.createElement("div", {
1680
- className: "kpi-icon"
1681
- }, card.icon), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("p", {
1682
- className: "kpi-title"
1683
- }, 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)));
1684
- })), /*#__PURE__*/React__default.createElement("section", {
1685
- className: "vendor-section"
1686
- }, /*#__PURE__*/React__default.createElement("div", {
1687
- className: "section-top"
1688
- }, /*#__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", {
1689
- className: "vendor-filters"
1690
- }, /*#__PURE__*/React__default.createElement("div", {
1691
- className: "search-box"
1692
- }, /*#__PURE__*/React__default.createElement(fa.FaSearch, null), /*#__PURE__*/React__default.createElement("input", {
1693
- type: "text",
1694
- placeholder: "Search agency, jurisdiction, location",
1695
- value: query,
1696
- onChange: e => setQuery(e.target.value)
1697
- })), /*#__PURE__*/React__default.createElement("div", {
1698
- className: "status-pill-group"
1699
- }, filters.map(status => /*#__PURE__*/React__default.createElement("button", {
1700
- key: status,
1701
- className: "status-pill " + (statusFilter === status ? "active" : ""),
1702
- onClick: () => setStatusFilter(status)
1703
- }, status))))), /*#__PURE__*/React__default.createElement("div", {
1704
- className: "vendor-grid"
1705
- }, filteredVendors.map(vendor => /*#__PURE__*/React__default.createElement("div", {
1706
- key: vendor.id,
1707
- className: "vendor-card glass-card",
1708
- onClick: () => routeToVendor(vendor.id)
1709
- }, /*#__PURE__*/React__default.createElement("div", {
1710
- className: "vendor-card-top"
1711
- }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("p", {
1712
- className: "vendor-chip"
1713
- }, vendor.name), /*#__PURE__*/React__default.createElement("h3", null, vendor.assignedConnections.toLocaleString()), /*#__PURE__*/React__default.createElement("p", {
1714
- className: "vendor-subtitle"
1715
- }, "Assigned connections across ", vendor.jurisdictions.length, " jurisdiction(s)")), /*#__PURE__*/React__default.createElement("div", {
1716
- className: "vendor-progress-value"
1717
- }, vendor.progress, "%")), /*#__PURE__*/React__default.createElement("div", {
1718
- className: "progress-bar"
1719
- }, /*#__PURE__*/React__default.createElement("div", {
1720
- className: "progress-fill",
1721
- style: {
1722
- width: vendor.progress + "%"
1723
- }
1724
- })), /*#__PURE__*/React__default.createElement("div", {
1725
- className: "vendor-stats-grid"
1726
- }, /*#__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", {
1727
- className: "vendor-card-footer"
1728
- }, /*#__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", {
1729
- className: "vendor-card-action"
1730
- }, /*#__PURE__*/React__default.createElement("span", null, "Explore analytics"), /*#__PURE__*/React__default.createElement(fa.FaArrowRight, null)))))), /*#__PURE__*/React__default.createElement("section", {
1731
- className: "analytics-grid"
1732
- }, /*#__PURE__*/React__default.createElement("div", {
1733
- className: "analytics-panel glass-card"
1734
- }, /*#__PURE__*/React__default.createElement("div", {
1735
- className: "section-header"
1736
- }, /*#__PURE__*/React__default.createElement("h2", null, "Daily eKYC Trend"), /*#__PURE__*/React__default.createElement("span", {
1737
- className: "badge success"
1738
- }, "Live index")), /*#__PURE__*/React__default.createElement(ExecutiveLineChart, {
1739
- data: dailyTrend,
1740
- dataKey: "completed",
1741
- name: "Completed"
1742
- })), /*#__PURE__*/React__default.createElement("div", {
1743
- className: "analytics-panel glass-card"
1744
- }, /*#__PURE__*/React__default.createElement("div", {
1745
- className: "section-header"
1746
- }, /*#__PURE__*/React__default.createElement("h2", null, "Self vs Agency eKYC"), /*#__PURE__*/React__default.createElement("span", {
1747
- className: "badge info"
1748
- }, "Adoption")), /*#__PURE__*/React__default.createElement(ExecutiveBarChart, {
1749
- data: selfVsAgency,
1750
- categories: [{
1751
- key: "agency",
1752
- name: "Agency"
1753
- }, {
1754
- key: "citizen",
1755
- name: "Citizen"
1756
- }]
1757
- })), /*#__PURE__*/React__default.createElement("div", {
1758
- className: "analytics-panel glass-card"
1759
- }, /*#__PURE__*/React__default.createElement("div", {
1760
- className: "section-header"
1761
- }, /*#__PURE__*/React__default.createElement("h2", null, "Pending vs Completed"), /*#__PURE__*/React__default.createElement("span", {
1762
- className: "badge warning"
1763
- }, "Operational pulse")), /*#__PURE__*/React__default.createElement(ExecutivePieChart, {
1764
- data: pendingVsCompleted,
1765
- dataKey: "completed",
1766
- labelKey: "label"
1767
- }))), /*#__PURE__*/React__default.createElement("section", {
1768
- className: "zone-section"
1769
- }, /*#__PURE__*/React__default.createElement("div", {
1770
- className: "section-header"
1771
- }, /*#__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", {
1772
- className: "secondary-button"
1773
- }, "Export Zone Data")), /*#__PURE__*/React__default.createElement("div", {
1774
- className: "table-wrapper glass-card"
1775
- }, /*#__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) => {
1776
- var _zone$activeDemand$to, _zone$activeDemand, _zone$pppZones$toLoca, _zone$pppZones, _zone$inactiveDemand$, _zone$inactiveDemand;
1777
- return /*#__PURE__*/React__default.createElement("tr", {
1778
- key: zone.agency + "-" + zone.location + "-" + index
1779
- }, /*#__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", {
1780
- className: "status-badge success"
1781
- }, Math.min(100, Math.round((zone.pppZones || 0) / Math.max(zone.activeDemand || 1, 1) * 100)), "%")));
1782
- }))))), /*#__PURE__*/React__default.createElement("section", {
1783
- className: "bottom-grid"
1784
- }, /*#__PURE__*/React__default.createElement("div", {
1785
- className: "alerts-panel glass-card"
1786
- }, /*#__PURE__*/React__default.createElement("div", {
1787
- className: "section-header"
1788
- }, /*#__PURE__*/React__default.createElement("h2", null, /*#__PURE__*/React__default.createElement(fa.FaExclamationTriangle, null), " Critical Alerts")), /*#__PURE__*/React__default.createElement("div", {
1789
- className: "alerts-list"
1790
- }, alerts.map(alert => /*#__PURE__*/React__default.createElement("div", {
1791
- key: alert,
1792
- className: "alert-card"
1793
- }, /*#__PURE__*/React__default.createElement(fa.FaExclamationTriangle, null), /*#__PURE__*/React__default.createElement("p", null, alert))))), /*#__PURE__*/React__default.createElement("div", {
1794
- className: "efficiency-panel glass-card"
1795
- }, /*#__PURE__*/React__default.createElement("div", {
1796
- className: "section-header"
1797
- }, /*#__PURE__*/React__default.createElement("h2", null, /*#__PURE__*/React__default.createElement(fa.FaUserTie, null), " Workforce & Efficiency")), /*#__PURE__*/React__default.createElement("div", {
1798
- className: "efficiency-grid"
1799
- }, /*#__PURE__*/React__default.createElement("div", {
1800
- className: "efficiency-box"
1801
- }, /*#__PURE__*/React__default.createElement("h3", null, "48"), /*#__PURE__*/React__default.createElement("p", null, "Supervisors Online")), /*#__PURE__*/React__default.createElement("div", {
1802
- className: "efficiency-box"
1803
- }, /*#__PURE__*/React__default.createElement("h3", null, "168"), /*#__PURE__*/React__default.createElement("p", null, "Surveyors Active")), /*#__PURE__*/React__default.createElement("div", {
1804
- className: "efficiency-box"
1805
- }, /*#__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", {
1806
- className: "efficiency-box"
1807
- }, /*#__PURE__*/React__default.createElement("h3", null, topKpis.successRate, "%"), /*#__PURE__*/React__default.createElement("p", null, "Operational Efficiency")))))));
1808
- };
1809
-
1810
1363
  const downloadSurveyorPDF = function (_ref) {
1811
1364
  let rows = _ref.rows,
1812
1365
  surveyorName = _ref.surveyorName,
@@ -3244,9 +2797,29 @@ const useInboxMobileCardsData = _ref => {
3244
2797
  };
3245
2798
  };
3246
2799
 
3247
- const Inbox = _ref => {
2800
+ const StatCard = _ref => {
2801
+ let title = _ref.title,
2802
+ value = _ref.value,
2803
+ type = _ref.type,
2804
+ isLoading = _ref.isLoading,
2805
+ icon = _ref.icon;
2806
+ return /*#__PURE__*/React__default.createElement("div", {
2807
+ className: "stat-card " + type
2808
+ }, isLoading ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
2809
+ className: "stat-title skeleton skeleton-text"
2810
+ }), /*#__PURE__*/React__default.createElement("div", {
2811
+ className: "stat-value skeleton skeleton-number"
2812
+ })) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
2813
+ className: "stat-title"
2814
+ }, title), /*#__PURE__*/React__default.createElement("div", {
2815
+ className: "stat-value"
2816
+ }, value), icon && /*#__PURE__*/React__default.createElement("div", {
2817
+ className: "stat-icon"
2818
+ }, icon)));
2819
+ };
2820
+ const Inbox = _ref2 => {
3248
2821
  var _formState$tableForm3, _formState$tableForm4, _formState$searchForm3, _formState$searchForm4;
3249
- let parentRoute = _ref.parentRoute;
2822
+ let parentRoute = _ref2.parentRoute;
3250
2823
  const tenantId = Digit.ULBService.getCurrentTenantId();
3251
2824
  const location = reactRouterDom.useLocation();
3252
2825
  const formInitValue = {
@@ -3283,6 +2856,12 @@ const Inbox = _ref => {
3283
2856
  isListLoading = _Digit$Hooks$ekyc$use.isLoading,
3284
2857
  _Digit$Hooks$ekyc$use2 = _Digit$Hooks$ekyc$use.data,
3285
2858
  listData = _Digit$Hooks$ekyc$use2 === void 0 ? {} : _Digit$Hooks$ekyc$use2;
2859
+ const _Digit$Hooks$ekyc$use3 = Digit.Hooks.ekyc.useEkycAssignmentProgress({
2860
+ enabled: !!tenantId,
2861
+ keepPreviousData: true
2862
+ }),
2863
+ isProgressLoading = _Digit$Hooks$ekyc$use3.isLoading,
2864
+ progressData = _Digit$Hooks$ekyc$use3.data;
3286
2865
  const searchDetails = React.useMemo(() => {
3287
2866
  var _formState$searchForm, _formState$searchForm2;
3288
2867
  return {
@@ -3291,15 +2870,15 @@ const Inbox = _ref => {
3291
2870
  };
3292
2871
  }, [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]);
3293
2872
  const isSearchActive = !!(searchDetails.kno || searchDetails.name);
3294
- const _Digit$Hooks$ekyc$use3 = Digit.Hooks.ekyc.useSearchConnection({
2873
+ const _Digit$Hooks$ekyc$use4 = Digit.Hooks.ekyc.useSearchConnection({
3295
2874
  tenantId,
3296
2875
  details: searchDetails
3297
2876
  }, {
3298
2877
  enabled: !!tenantId && !!searchDetails.kno,
3299
2878
  keepPreviousData: true
3300
2879
  }),
3301
- isSearchLoading = _Digit$Hooks$ekyc$use3.isLoading,
3302
- searchData = _Digit$Hooks$ekyc$use3.data;
2880
+ isSearchLoading = _Digit$Hooks$ekyc$use4.isLoading,
2881
+ searchData = _Digit$Hooks$ekyc$use4.data;
3303
2882
  const sourceData = React.useMemo(() => {
3304
2883
  if (isSearchActive) {
3305
2884
  if (!searchData) return [];
@@ -3337,12 +2916,67 @@ const Inbox = _ref => {
3337
2916
  });
3338
2917
  });
3339
2918
  }, [sourceData]);
2919
+ const _useTranslation = reactI18next.useTranslation(),
2920
+ t = _useTranslation.t;
2921
+ const supervisor = React.useMemo(() => {
2922
+ var _Digit$SessionStorage, _loggedInUser$roles;
2923
+ const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
2924
+ 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)) || [];
2925
+ if (roles.includes("EKYC_SUPERVISOR")) {
2926
+ const targetId = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid;
2927
+ if (progressData !== null && progressData !== void 0 && progressData.supervisorReport && targetId) {
2928
+ const report = progressData.supervisorReport.find(s => {
2929
+ var _s$supervisorId, _s$id;
2930
+ 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());
2931
+ });
2932
+ if (report) return report;
2933
+ }
2934
+ }
2935
+ if (progressData !== null && progressData !== void 0 && progressData.supervisorReport) {
2936
+ const totalKnos = progressData.supervisorReport.reduce((acc, r) => acc + (r.totalKnos || 0), 0);
2937
+ const submittedKnos = progressData.supervisorReport.reduce((acc, r) => acc + (r.submittedKnos || 0), 0);
2938
+ const pendingKnos = progressData.supervisorReport.reduce((acc, r) => acc + (r.pendingKnos || 0), 0);
2939
+ const progressPercent = totalKnos > 0 ? Math.round(submittedKnos / totalKnos * 100) : 0;
2940
+ return {
2941
+ totalKnos,
2942
+ submittedKnos,
2943
+ pendingKnos,
2944
+ progressPercent
2945
+ };
2946
+ }
2947
+ return null;
2948
+ }, [progressData]);
2949
+ const cards = React.useMemo(() => [{
2950
+ label: t("TOTAL_EKYC_APPLICATIONS"),
2951
+ count: (supervisor === null || supervisor === void 0 ? void 0 : supervisor.totalKnos) || 0,
2952
+ color: "#0B2559",
2953
+ type: "today",
2954
+ icon: /*#__PURE__*/React__default.createElement(fa.FaUsers, null)
2955
+ }, {
2956
+ label: t("EKYC_COMPLETED"),
2957
+ count: (supervisor === null || supervisor === void 0 ? void 0 : supervisor.submittedKnos) || 0,
2958
+ color: "#10B981",
2959
+ type: "month",
2960
+ icon: /*#__PURE__*/React__default.createElement(fa.FaCheckCircle, null)
2961
+ }, {
2962
+ label: t("PENDING_APPLICATIONS"),
2963
+ count: (supervisor === null || supervisor === void 0 ? void 0 : supervisor.pendingKnos) || 0,
2964
+ color: "#F59E0B",
2965
+ type: "pending",
2966
+ icon: /*#__PURE__*/React__default.createElement(fa.FaClock, null)
2967
+ }, {
2968
+ label: t("OVERALL_PROGRESS"),
2969
+ count: ((supervisor === null || supervisor === void 0 ? void 0 : supervisor.progressPercent) || 0) + "%",
2970
+ color: "#A855F7",
2971
+ type: "progress",
2972
+ icon: /*#__PURE__*/React__default.createElement(fa.FaChartLine, null)
2973
+ }], [supervisor]);
3340
2974
  const totalRecords = (listData === null || listData === void 0 ? void 0 : listData.totalCount) || 0;
3341
2975
  const checkPathName = location.pathname.includes("ekyc/inbox");
3342
- const SearchFormFields = React.useCallback(_ref2 => {
3343
- let registerRef = _ref2.registerRef,
3344
- searchFormState = _ref2.searchFormState,
3345
- controlSearchForm = _ref2.controlSearchForm;
2976
+ const SearchFormFields = React.useCallback(_ref3 => {
2977
+ let registerRef = _ref3.registerRef,
2978
+ searchFormState = _ref3.searchFormState,
2979
+ controlSearchForm = _ref3.controlSearchForm;
3346
2980
  return /*#__PURE__*/React__default.createElement(SearchFormFieldsComponents, {
3347
2981
  registerRef,
3348
2982
  searchFormState,
@@ -3495,7 +3129,27 @@ const Inbox = _ref => {
3495
3129
  const isInboxLoading = isListLoading || isSearchLoading;
3496
3130
  return /*#__PURE__*/React__default.createElement("div", {
3497
3131
  className: "app-container"
3498
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.InboxComposer, _extends({
3132
+ }, /*#__PURE__*/React__default.createElement("div", {
3133
+ className: "surveyor-dashboard",
3134
+ style: {
3135
+ overflowY: "visible",
3136
+ marginBottom: "24px"
3137
+ }
3138
+ }, /*#__PURE__*/React__default.createElement("div", {
3139
+ className: "stats-wrapper",
3140
+ style: {
3141
+ display: "flex",
3142
+ gap: "16px",
3143
+ flexWrap: "wrap"
3144
+ }
3145
+ }, cards.map((card, idx) => /*#__PURE__*/React__default.createElement(StatCard, {
3146
+ key: idx,
3147
+ title: t(card.label),
3148
+ value: card.count,
3149
+ type: card.type,
3150
+ isLoading: isProgressLoading,
3151
+ icon: card.icon
3152
+ })))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.InboxComposer, _extends({
3499
3153
  isInboxLoading
3500
3154
  }, propsForSearchForm, propsForMobileSortForm, {
3501
3155
  propsForInboxTable,
@@ -3507,1034 +3161,301 @@ const Inbox = _ref => {
3507
3161
  })));
3508
3162
  };
3509
3163
 
3510
- const MOCK_SURVEYORS = [{
3511
- name: "Amit Kumar",
3512
- id: "SVR001",
3513
- role: "Surveyor"
3514
- }, {
3515
- name: "Sanjay Singh",
3516
- id: "SVR002",
3517
- role: "Surveyor"
3518
- }, {
3519
- name: "Rahul Sharma",
3520
- id: "SVR003",
3521
- role: "Surveyor"
3522
- }, {
3523
- name: "Priya Verma",
3524
- id: "SVR004",
3525
- role: "Surveyor"
3526
- }];
3527
- const MOCK_MRDS = [{
3528
- name: "MRD - 01 (Central Zone)",
3529
- code: "MRD01",
3530
- zone: "Central"
3531
- }, {
3532
- name: "MRD - 02 (North Zone)",
3533
- code: "MRD02",
3534
- zone: "North"
3535
- }, {
3536
- name: "MRD - 03 (South Zone)",
3537
- code: "MRD03",
3538
- zone: "South"
3539
- }, {
3540
- name: "MRD - 04 (West Zone)",
3541
- code: "MRD04",
3542
- zone: "West"
3543
- }, {
3544
- name: "MRD - 05 (East Zone)",
3545
- code: "MRD05",
3546
- zone: "East"
3547
- }, {
3548
- name: "MRD - 06 (Rohini)",
3549
- code: "MRD06",
3550
- zone: "Rohini"
3551
- }, {
3552
- name: "MRD - 07 (Dwarka)",
3553
- code: "MRD07",
3554
- zone: "Dwarka"
3555
- }];
3556
- const Mapping = () => {
3557
- const _useTranslation = reactI18next.useTranslation(),
3558
- t = _useTranslation.t;
3559
- const _useState = React.useState(null),
3560
- selectedSurveyor = _useState[0],
3561
- setSelectedSurveyor = _useState[1];
3562
- const _useState2 = React.useState(null),
3563
- selectedMRD = _useState2[0],
3564
- setSelectedMRD = _useState2[1];
3565
- const _useState3 = React.useState([]),
3566
- mappings = _useState3[0],
3567
- setMappings = _useState3[1];
3568
- const _useState4 = React.useState(null),
3569
- editingId = _useState4[0],
3570
- setEditingId = _useState4[1];
3571
- const _useState5 = React.useState(null),
3572
- editSurveyor = _useState5[0],
3573
- setEditSurveyor = _useState5[1];
3574
- const _useState6 = React.useState(null),
3575
- editMRD = _useState6[0],
3576
- setEditMRD = _useState6[1];
3577
- const _useState7 = React.useState(null),
3578
- deleteTarget = _useState7[0],
3579
- setDeleteTarget = _useState7[1];
3580
- const _useState8 = React.useState(null),
3581
- toast = _useState8[0],
3582
- setToast = _useState8[1];
3583
- const handleAddMapping = () => {
3584
- if (!selectedSurveyor || !selectedMRD) {
3585
- setToast({
3586
- type: "error",
3587
- message: t("EKYC_SELECT_BOTH_ERROR") || "Please select both Surveyor and MRD"
3588
- });
3589
- return;
3590
- }
3591
- const exists = mappings.some(m => m.surveyorId === selectedSurveyor.id && m.mrdCode === selectedMRD.code);
3592
- if (exists) {
3593
- setToast({
3594
- type: "warning",
3595
- message: t("EKYC_MAPPING_EXISTS") || "This mapping already exists"
3596
- });
3597
- return;
3598
- }
3599
- setMappings(prev => [...prev, {
3600
- id: Date.now(),
3601
- surveyorName: selectedSurveyor.name,
3602
- surveyorId: selectedSurveyor.id,
3603
- mrdName: selectedMRD.name,
3604
- mrdCode: selectedMRD.code,
3605
- zone: selectedMRD.zone
3606
- }]);
3607
- setSelectedMRD(null);
3608
- setSelectedSurveyor(null);
3609
- setToast({
3610
- type: "success",
3611
- message: t("EKYC_MAPPING_ADDED") || "Mapping added successfully"
3612
- });
3613
- };
3614
- const handleEditStart = row => {
3615
- setEditingId(row.id);
3616
- setEditSurveyor(MOCK_SURVEYORS.find(s => s.id === row.surveyorId) || null);
3617
- setEditMRD(MOCK_MRDS.find(m => m.code === row.mrdCode) || null);
3164
+ const ActionButton = _ref => {
3165
+ let jumpTo = _ref.jumpTo,
3166
+ state = _ref.state;
3167
+ const history = reactRouterDom.useHistory();
3168
+ function routeTo() {
3169
+ history.push(jumpTo, _extends({}, state, {
3170
+ isEditing: true
3171
+ }));
3172
+ }
3173
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.LinkButton, {
3174
+ label: /*#__PURE__*/React__default.createElement(digitUiReactComponents.EditIcon, {
3175
+ style: {
3176
+ width: "20px",
3177
+ height: "20px",
3178
+ fill: "#F47738"
3179
+ }
3180
+ }),
3181
+ style: {
3182
+ margin: 0,
3183
+ padding: 0
3184
+ },
3185
+ onClick: routeTo
3186
+ });
3187
+ };
3188
+ const checkForNA = value => value !== null && value !== undefined && value !== "" ? value : "N/A";
3189
+ const boolToYesNo = (value, t) => {
3190
+ if (value === true || value === "true" || String(value).toLowerCase() === "yes") return t("CORE_COMMON_YES");
3191
+ if (value === false || value === "false" || String(value).toLowerCase() === "no") return t("CORE_COMMON_NO");
3192
+ if (value === "true") return t("CORE_COMMON_YES");
3193
+ if (value === "false") return t("CORE_COMMON_NO");
3194
+ };
3195
+ const extractReviewData = (searchData, flowState) => {
3196
+ const rawData = searchData && Object.keys(searchData).length > 0 ? searchData : (flowState === null || flowState === void 0 ? void 0 : flowState.reviewData) || {};
3197
+ const reviewWrapper = (rawData === null || rawData === void 0 ? void 0 : rawData.applicationReviewInfo) || (rawData === null || rawData === void 0 ? void 0 : rawData.applicationReview) || rawData;
3198
+ const applicationData = (Array.isArray(reviewWrapper) ? reviewWrapper[0] : reviewWrapper) || {};
3199
+ return {
3200
+ newData: (applicationData === null || applicationData === void 0 ? void 0 : applicationData.newData) || applicationData,
3201
+ oldData: (applicationData === null || applicationData === void 0 ? void 0 : applicationData.oldData) || null
3618
3202
  };
3619
- const handleEditSave = id => {
3620
- if (!editSurveyor || !editMRD) {
3621
- setToast({
3622
- type: "error",
3623
- message: t("EKYC_SELECT_BOTH_ERROR") || "Please select both Surveyor and MRD to save"
3624
- });
3625
- return;
3203
+ };
3204
+ const ReviewSection = _ref2 => {
3205
+ let title = _ref2.title,
3206
+ fields = _ref2.fields,
3207
+ newData = _ref2.newData,
3208
+ oldData = _ref2.oldData,
3209
+ t = _ref2.t,
3210
+ jumpTo = _ref2.jumpTo,
3211
+ state = _ref2.state,
3212
+ hideEditButton = _ref2.hideEditButton;
3213
+ return /*#__PURE__*/React__default.createElement("div", {
3214
+ className: "review-section-wrapper",
3215
+ style: {
3216
+ marginBottom: "48px",
3217
+ background: "#fff",
3218
+ borderRadius: "12px",
3219
+ border: "1px solid #EAECF0",
3220
+ overflow: "hidden"
3626
3221
  }
3627
- const duplicate = mappings.some(m => m.id !== id && m.surveyorId === editSurveyor.id && m.mrdCode === editMRD.code);
3628
- if (duplicate) {
3629
- setToast({
3630
- type: "warning",
3631
- message: t("EKYC_MAPPING_EXISTS") || "This mapping already exists"
3632
- });
3633
- return;
3222
+ }, /*#__PURE__*/React__default.createElement("div", {
3223
+ style: {
3224
+ padding: "20px 24px",
3225
+ background: "#F9FAFB",
3226
+ borderBottom: "1px solid #EAECF0",
3227
+ display: "flex",
3228
+ justifyContent: "space-between",
3229
+ alignItems: "center"
3634
3230
  }
3635
- setMappings(prev => prev.map(m => m.id !== id ? m : _extends({}, m, {
3636
- surveyorName: editSurveyor.name,
3637
- surveyorId: editSurveyor.id,
3638
- mrdName: editMRD.name,
3639
- mrdCode: editMRD.code,
3640
- zone: editMRD.zone
3641
- })));
3642
- setEditingId(null);
3643
- setToast({
3644
- type: "success",
3645
- message: t("EKYC_MAPPING_UPDATED") || "Mapping updated successfully"
3646
- });
3647
- };
3648
- const handleEditCancel = () => {
3649
- setEditingId(null);
3650
- setEditSurveyor(null);
3651
- setEditMRD(null);
3652
- };
3653
- const handleDeleteConfirm = () => {
3654
- setMappings(prev => prev.filter(m => m.id !== deleteTarget.id));
3655
- setDeleteTarget(null);
3656
- setToast({
3657
- type: "success",
3658
- message: t("EKYC_MAPPING_REMOVED") || "Mapping removed"
3659
- });
3660
- };
3661
- const handleSaveMappings = () => {
3662
- if (mappings.length === 0) {
3663
- setToast({
3664
- type: "error",
3665
- message: t("EKYC_NO_MAPPINGS_TO_SAVE") || "No mappings to save"
3666
- });
3667
- return;
3231
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardSubHeader, {
3232
+ style: {
3233
+ margin: 0,
3234
+ fontSize: "18px",
3235
+ color: "#101828",
3236
+ fontWeight: "700"
3668
3237
  }
3669
- setToast({
3670
- type: "success",
3671
- message: t("EKYC_MAPPINGS_SAVED_SUCCESS") || "Surveyor mappings saved successfully!"
3672
- });
3673
- };
3674
- const columns = React.useMemo(() => [{
3675
- Header: t("EKYC_SURVEYOR_NAME") || "Surveyor",
3676
- accessor: "surveyorName",
3677
- Cell: _ref => {
3678
- let row = _ref.row;
3679
- const isEditing = editingId === row.original.id;
3680
- if (isEditing) {
3681
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
3682
- selected: editSurveyor,
3683
- select: setEditSurveyor,
3684
- option: MOCK_SURVEYORS,
3685
- optionKey: "name",
3686
- t: t,
3687
- placeholder: t("EKYC_SELECT_SURVEYOR_PLACEHOLDER") || "Choose surveyor..."
3688
- });
3689
- }
3690
- return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("span", {
3691
- className: "link"
3692
- }, row.original.surveyorName), /*#__PURE__*/React__default.createElement("div", {
3693
- style: {
3694
- fontSize: "12px",
3695
- color: "#666"
3696
- }
3697
- }, row.original.surveyorId));
3238
+ }, title), jumpTo && !hideEditButton && /*#__PURE__*/React__default.createElement(ActionButton, {
3239
+ jumpTo: jumpTo,
3240
+ state: state
3241
+ })), /*#__PURE__*/React__default.createElement("div", {
3242
+ style: {
3243
+ padding: "0 24px"
3698
3244
  }
3699
- }, {
3700
- Header: t("EKYC_MRD_ASSIGNED") || "MRD Assigned",
3701
- accessor: "mrdName",
3702
- Cell: _ref2 => {
3703
- let row = _ref2.row;
3704
- const isEditing = editingId === row.original.id;
3705
- if (isEditing) {
3706
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
3707
- selected: editMRD,
3708
- select: setEditMRD,
3709
- option: MOCK_MRDS,
3710
- optionKey: "name",
3711
- t: t,
3712
- placeholder: t("EKYC_SELECT_MRD_PLACEHOLDER") || "Choose MRD..."
3713
- });
3714
- }
3715
- return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("span", null, row.original.mrdName), /*#__PURE__*/React__default.createElement("div", {
3716
- style: {
3717
- fontSize: "12px",
3718
- color: "#666"
3719
- }
3720
- }, row.original.zone));
3721
- }
3722
- }, {
3723
- Header: t("ES_COMMON_ACTION") || "Actions",
3724
- Cell: _ref3 => {
3725
- let row = _ref3.row;
3726
- const isEditing = editingId === row.original.id;
3727
- if (isEditing) {
3728
- return /*#__PURE__*/React__default.createElement("div", {
3729
- style: {
3730
- display: "flex",
3731
- gap: "10px"
3732
- }
3733
- }, /*#__PURE__*/React__default.createElement("span", {
3734
- style: {
3735
- cursor: "pointer",
3736
- color: "#f47738",
3737
- fontWeight: "bold"
3738
- },
3739
- onClick: () => handleEditSave(row.original.id)
3740
- }, t("ES_COMMON_SAVE")), /*#__PURE__*/React__default.createElement("span", {
3741
- style: {
3742
- cursor: "pointer",
3743
- color: "#505A5F",
3744
- fontWeight: "bold"
3745
- },
3746
- onClick: handleEditCancel
3747
- }, t("ES_COMMON_CANCEL")));
3748
- }
3749
- return /*#__PURE__*/React__default.createElement("div", {
3750
- style: {
3751
- display: "flex",
3752
- gap: "16px"
3753
- }
3754
- }, /*#__PURE__*/React__default.createElement("span", {
3755
- onClick: () => handleEditStart(row.original),
3756
- style: {
3757
- cursor: "pointer"
3758
- }
3759
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.EditIcon, {
3760
- className: "icon",
3761
- fill: "#f47738"
3762
- })), /*#__PURE__*/React__default.createElement("span", {
3763
- onClick: () => setDeleteTarget(row.original),
3764
- style: {
3765
- cursor: "pointer"
3766
- }
3767
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.DeleteIcon, {
3768
- className: "icon",
3769
- fill: "#f47738"
3770
- })));
3245
+ }, /*#__PURE__*/React__default.createElement("table", {
3246
+ style: {
3247
+ width: "100%",
3248
+ borderCollapse: "collapse",
3249
+ tableLayout: "fixed"
3771
3250
  }
3772
- }], [editingId, editSurveyor, editMRD, mappings, t]);
3773
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
3774
- className: "side-panel-item"
3775
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
3776
- className: "employeeCard filter inboxLinks",
3251
+ }, /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
3777
3252
  style: {
3778
- marginTop: "16px"
3253
+ padding: "16px 0",
3254
+ textAlign: "left",
3255
+ color: "#667085",
3256
+ fontSize: "12px",
3257
+ fontWeight: "600",
3258
+ textTransform: "uppercase",
3259
+ width: "30%"
3779
3260
  }
3780
- }, /*#__PURE__*/React__default.createElement("div", {
3781
- className: "complaint-links-container"
3782
- }, /*#__PURE__*/React__default.createElement("div", {
3783
- className: "header",
3261
+ }, t("EKYC_FIELD_NAME")), /*#__PURE__*/React__default.createElement("th", {
3784
3262
  style: {
3785
- marginBottom: "0px"
3263
+ padding: "16px 0",
3264
+ textAlign: "left",
3265
+ color: "#667085",
3266
+ fontSize: "12px",
3267
+ fontWeight: "600",
3268
+ textTransform: "uppercase",
3269
+ width: "35%"
3786
3270
  }
3787
- }, /*#__PURE__*/React__default.createElement("span", {
3788
- className: "logo"
3789
- }, /*#__PURE__*/React__default.createElement("svg", {
3790
- width: "24",
3791
- height: "24",
3792
- viewBox: "0 0 24 24",
3793
- fill: "none",
3794
- xmlns: "http://www.w3.org/2000/svg"
3795
- }, /*#__PURE__*/React__default.createElement("path", {
3796
- d: "M4 19.5A2.5 2.5 0 0 1 6.5 17H20",
3797
- stroke: "white",
3798
- strokeWidth: "2",
3799
- strokeLinecap: "round",
3800
- strokeLinejoin: "round"
3801
- }), /*#__PURE__*/React__default.createElement("path", {
3802
- d: "M6.5 2H20V22H6.5A2.5 2.5 0 0 1 4 19.5V4.5A2.5 2.5 0 0 1 6.5 2Z",
3803
- stroke: "white",
3804
- strokeWidth: "2",
3805
- strokeLinecap: "round",
3806
- strokeLinejoin: "round"
3807
- }))), /*#__PURE__*/React__default.createElement("span", {
3808
- className: "text"
3809
- }, 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", {
3810
- className: ""
3811
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
3812
- selected: selectedSurveyor,
3813
- select: setSelectedSurveyor,
3814
- option: MOCK_SURVEYORS,
3815
- optionKey: "name",
3816
- t: t,
3817
- placeholder: t("EKYC_SELECT_SURVEYOR_PLACEHOLDER") || "Choose a surveyor..."
3818
- }))), /*#__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", {
3819
- className: "field"
3820
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
3821
- selected: selectedMRD,
3822
- select: setSelectedMRD,
3823
- option: MOCK_MRDS,
3824
- optionKey: "name",
3825
- t: t,
3826
- placeholder: t("EKYC_SELECT_MRD_PLACEHOLDER") || "Choose an MRD..."
3827
- }))), /*#__PURE__*/React__default.createElement("div", {
3271
+ }, t("EKYC_EXISTING_INFORMATION")), /*#__PURE__*/React__default.createElement("th", {
3828
3272
  style: {
3829
- display: "flex",
3830
- justifyContent: "flex-end",
3831
- marginTop: "24px"
3273
+ padding: "16px 0",
3274
+ textAlign: "left",
3275
+ color: "#667085",
3276
+ fontSize: "12px",
3277
+ fontWeight: "600",
3278
+ textTransform: "uppercase",
3279
+ width: "35%"
3832
3280
  }
3833
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
3834
- label: t("EKYC_ADD_TO_LIST") || "Add to Mapping List",
3835
- onSubmit: handleAddMapping,
3836
- disabled: !selectedSurveyor || !selectedMRD
3837
- }))), 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, {
3838
- t: t,
3839
- data: mappings,
3840
- columns: columns,
3841
- getCellProps: cellInfo => {
3842
- return {
3843
- style: {
3844
- padding: "10px",
3845
- fontSize: "16px"
3846
- }
3847
- };
3848
- },
3849
- tableClassName: "table digit-table"
3850
- })), mappings.length > 0 && /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
3851
- label: t("EKYC_SAVE_MAPPINGS") || "Save Mappings",
3852
- onSubmit: handleSaveMappings
3853
- })), deleteTarget && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Modal, {
3854
- headerBarMain: t("EKYC_REMOVE_MAPPING") || "Remove Mapping",
3855
- headerBarEnd: /*#__PURE__*/React__default.createElement("span", {
3856
- onClick: () => setDeleteTarget(null),
3281
+ }, t("EKYC_PROPOSED_UPDATES")))), /*#__PURE__*/React__default.createElement("tbody", null, fields.map((field, idx) => {
3282
+ const valNew = newData === null || newData === void 0 ? void 0 : newData[field.key];
3283
+ const valOld = oldData === null || oldData === void 0 ? void 0 : oldData[field.key];
3284
+ const isChanged = oldData && String(valNew) !== String(valOld) && valOld !== undefined && valOld !== null;
3285
+ return /*#__PURE__*/React__default.createElement("tr", {
3286
+ key: idx,
3857
3287
  style: {
3858
- cursor: "pointer",
3859
- padding: "8px"
3288
+ borderTop: "1px solid #F2F4F7"
3860
3289
  }
3861
- }, "X"),
3862
- actionSaveLabel: t("ES_COMMON_REMOVE"),
3863
- actionSaveOnSubmit: handleDeleteConfirm,
3864
- actionCancelLabel: t("ES_COMMON_CANCEL"),
3865
- actionCancelOnSubmit: () => setDeleteTarget(null),
3866
- style: {
3867
- borderRadius: "12px"
3868
- }
3869
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardText, {
3870
- style: {
3871
- marginTop: "16px",
3872
- marginBottom: "16px"
3873
- }
3874
- }, 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, {
3875
- label: toast.message,
3876
- error: toast.type === "error",
3877
- warning: toast.type === "warning",
3878
- info: toast.type === "info",
3879
- isDsc: true,
3880
- onClose: () => setToast(null)
3881
- }));
3290
+ }, /*#__PURE__*/React__default.createElement("td", {
3291
+ style: {
3292
+ padding: "16px 0",
3293
+ fontSize: "14px",
3294
+ color: "#344054",
3295
+ fontWeight: "500"
3296
+ }
3297
+ }, t(field.label)), /*#__PURE__*/React__default.createElement("td", {
3298
+ style: {
3299
+ padding: "16px 0",
3300
+ fontSize: "14px",
3301
+ color: "#667085"
3302
+ }
3303
+ }, field.isBool ? boolToYesNo(valOld, t) : checkForNA(valOld)), /*#__PURE__*/React__default.createElement("td", {
3304
+ style: {
3305
+ padding: "16px 0",
3306
+ fontSize: "14px",
3307
+ color: isChanged ? "#1B8B32" : "#101828",
3308
+ fontWeight: isChanged ? "700" : "400"
3309
+ }
3310
+ }, /*#__PURE__*/React__default.createElement("div", {
3311
+ style: {
3312
+ display: "flex",
3313
+ alignItems: "center",
3314
+ gap: "8px"
3315
+ }
3316
+ }, field.isBool ? boolToYesNo(valNew, t) : checkForNA(valNew), isChanged && /*#__PURE__*/React__default.createElement("span", {
3317
+ style: {
3318
+ background: "#ECFDF3",
3319
+ color: "#067647",
3320
+ padding: "2px 8px",
3321
+ borderRadius: "12px",
3322
+ fontSize: "10px",
3323
+ fontWeight: "600"
3324
+ }
3325
+ }, t("EKYC_CHANGED")))));
3326
+ })))));
3882
3327
  };
3883
-
3884
- const ConnectionDetailsView = _ref => {
3885
- let kNumber = _ref.kNumber,
3886
- kName = _ref.kName,
3887
- connectionDetails = _ref.connectionDetails,
3888
- isLoading = _ref.isLoading;
3328
+ const Review = () => {
3329
+ 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;
3889
3330
  const _useTranslation = reactI18next.useTranslation(),
3890
3331
  t = _useTranslation.t;
3891
3332
  const history = reactRouterDom.useHistory();
3892
- const _useRouteMatch = reactRouterDom.useRouteMatch(),
3893
- path = _useRouteMatch.path;
3333
+ const location = reactRouterDom.useLocation();
3334
+ let _useParams = reactRouterDom.useParams(),
3335
+ kno = _useParams.kno,
3336
+ applicationId = _useParams.applicationId;
3894
3337
  const _useState = React.useState(false),
3895
- showModal = _useState[0],
3896
- setShowModal = _useState[1];
3897
- const _useState2 = React.useState({
3898
- code: "SELF",
3899
- name: "EKYC_SELF"
3338
+ agree = _useState[0],
3339
+ setAgree = _useState[1];
3340
+ const _useState2 = React.useState(false),
3341
+ isSubmitting = _useState2[0];
3342
+ const _useState3 = React.useState(false),
3343
+ showPreview = _useState3[0],
3344
+ setShowPreview = _useState3[1];
3345
+ const _useState4 = React.useState(""),
3346
+ previewUrl = _useState4[0],
3347
+ setPreviewUrl = _useState4[1];
3348
+ const _useState5 = React.useState(false),
3349
+ showOptions = _useState5[0],
3350
+ setShowOptions = _useState5[1];
3351
+ const _useState6 = React.useState(false),
3352
+ showToast = _useState6[0],
3353
+ setShowToast = _useState6[1];
3354
+ const _useState7 = React.useState({
3355
+ error: false,
3356
+ label: ""
3900
3357
  }),
3901
- selectedOption = _useState2[0],
3902
- setSelectedOption = _useState2[1];
3358
+ toastData = _useState7[0],
3359
+ setToastData = _useState7[1];
3903
3360
  const options = [{
3904
- code: "SELF",
3905
- name: "EKYC_SELF"
3361
+ action: t("APPROVE")
3906
3362
  }, {
3907
- code: "OTHER",
3908
- name: "EKYC_OTHER"
3363
+ action: t("REJECT")
3909
3364
  }];
3910
- const handleStartVerification = () => setShowModal(true);
3911
- const onModalConfirm = () => {
3912
- const parentPath = path.includes("/create-kyc") ? path.replace("/create-kyc", "") : path.replace("/k-details", "");
3913
- history.push(parentPath + "/consumer-details", {
3914
- kNumber,
3915
- selectedOption,
3916
- connectionDetails
3917
- });
3918
- setShowModal(false);
3919
- };
3920
- if (isLoading) return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
3921
- if (!connectionDetails) return null;
3922
- const details = (connectionDetails === null || connectionDetails === void 0 ? void 0 : connectionDetails.connectionDetails) || {};
3923
- const statusFlag = details.statusflag || "";
3924
- const isActive = (statusFlag === null || statusFlag === void 0 ? void 0 : statusFlag.toLowerCase()) === "active" || statusFlag === "A";
3925
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
3926
- className: "ekyc-employee-container"
3927
- }, /*#__PURE__*/React__default.createElement("div", {
3928
- className: "connection-details-card"
3929
- }, /*#__PURE__*/React__default.createElement("div", {
3930
- className: "details-card-header"
3931
- }, /*#__PURE__*/React__default.createElement("div", {
3932
- className: "header-title-wrapper"
3933
- }, /*#__PURE__*/React__default.createElement("div", {
3934
- className: "header-icon-bg"
3935
- }, /*#__PURE__*/React__default.createElement("svg", {
3936
- width: "16",
3937
- height: "16",
3938
- viewBox: "0 0 24 24",
3939
- fill: "none",
3940
- stroke: "#3A7BD5",
3941
- strokeWidth: "2",
3942
- strokeLinecap: "round",
3943
- strokeLinejoin: "round"
3944
- }, /*#__PURE__*/React__default.createElement("path", {
3945
- d: "M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"
3946
- }), /*#__PURE__*/React__default.createElement("circle", {
3947
- cx: "12",
3948
- cy: "7",
3949
- r: "4"
3950
- }))), /*#__PURE__*/React__default.createElement("span", {
3951
- className: "header-title-text"
3952
- }, t("EKYC_K_NUMBER_DETAILS") || "Consumer Identity Details")), /*#__PURE__*/React__default.createElement("span", {
3953
- className: "status-badge " + (isActive ? "active" : "inactive")
3954
- }, isActive ? t("EKYC_ACTIVE_CONNECTION") || "Active Connection" : statusFlag || t("CS_NA"))), /*#__PURE__*/React__default.createElement("div", {
3955
- className: "details-card-body"
3956
- }, /*#__PURE__*/React__default.createElement("div", {
3957
- className: "body-content-row"
3958
- }, /*#__PURE__*/React__default.createElement("div", {
3959
- className: "detail-section"
3960
- }, /*#__PURE__*/React__default.createElement("div", {
3961
- className: "section-title"
3962
- }, t("EKYC_VERIFICATION_PARAMETERS") || "Verification Parameters"), /*#__PURE__*/React__default.createElement("div", {
3963
- className: "data-grid"
3964
- }, /*#__PURE__*/React__default.createElement("div", {
3965
- className: "data-item"
3966
- }, /*#__PURE__*/React__default.createElement("div", {
3967
- className: "data-label"
3968
- }, t("EKYC_CONSUMER_NAME") || "Consumer Name"), /*#__PURE__*/React__default.createElement("div", {
3969
- className: "data-value"
3970
- }, details.consumerName || kName || t("CS_NA"))), /*#__PURE__*/React__default.createElement("div", {
3971
- className: "data-item"
3972
- }, /*#__PURE__*/React__default.createElement("div", {
3973
- className: "data-label"
3974
- }, t("EKYC_K_NUMBER") || "K Number"), /*#__PURE__*/React__default.createElement("div", {
3975
- className: "data-value blue"
3976
- }, kNumber || t("CS_NA"))), /*#__PURE__*/React__default.createElement("div", {
3977
- className: "data-item"
3978
- }, /*#__PURE__*/React__default.createElement("div", {
3979
- className: "data-label"
3980
- }, t("EKYC_METER_NO") || "Meter Serial No."), /*#__PURE__*/React__default.createElement("div", {
3981
- className: "data-value"
3982
- }, details.meterNumber || t("CS_NA"))), /*#__PURE__*/React__default.createElement("div", {
3983
- className: "data-item"
3984
- }, /*#__PURE__*/React__default.createElement("div", {
3985
- className: "data-label"
3986
- }, t("EKYC_CONNECTION_TYPE") || "Connection Type"), /*#__PURE__*/React__default.createElement("div", {
3987
- className: "data-value"
3988
- }, details.connectionType || t("CS_NA"))))), /*#__PURE__*/React__default.createElement("div", {
3989
- className: "vertical-divider"
3990
- }), /*#__PURE__*/React__default.createElement("div", {
3991
- className: "detail-section"
3992
- }, /*#__PURE__*/React__default.createElement("div", {
3993
- className: "section-title"
3994
- }, t("EKYC_ADDRESS_AND_CONTACT") || "Address & Contact"), /*#__PURE__*/React__default.createElement("div", {
3995
- className: "address-block"
3996
- }, /*#__PURE__*/React__default.createElement("div", {
3997
- className: "icon-wrapper-small"
3998
- }, /*#__PURE__*/React__default.createElement("svg", {
3999
- width: "16",
4000
- height: "16",
4001
- viewBox: "0 0 24 24",
4002
- fill: "none",
4003
- stroke: "#6B7B8E",
4004
- strokeWidth: "2",
4005
- strokeLinecap: "round",
4006
- strokeLinejoin: "round"
4007
- }, /*#__PURE__*/React__default.createElement("path", {
4008
- d: "M21 10c0 7-9 13-9 13S3 17 3 10a9 9 0 0 1 18 0z"
4009
- }), /*#__PURE__*/React__default.createElement("circle", {
4010
- cx: "12",
4011
- cy: "10",
4012
- r: "3"
4013
- }))), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
4014
- className: "data-label"
4015
- }, t("EKYC_ADDRESS") || "Service Address"), /*#__PURE__*/React__default.createElement("div", {
4016
- className: "address-text"
4017
- }, details.address || t("CS_NA")))), /*#__PURE__*/React__default.createElement("div", {
4018
- className: "contact-row"
4019
- }, /*#__PURE__*/React__default.createElement("div", {
4020
- className: "contact-item"
4021
- }, /*#__PURE__*/React__default.createElement("div", {
4022
- className: "icon-wrapper-small"
4023
- }, /*#__PURE__*/React__default.createElement("svg", {
4024
- width: "16",
4025
- height: "16",
4026
- viewBox: "0 0 24 24",
4027
- fill: "none",
4028
- stroke: "#6B7B8E",
4029
- strokeWidth: "2",
4030
- strokeLinecap: "round",
4031
- strokeLinejoin: "round"
4032
- }, /*#__PURE__*/React__default.createElement("rect", {
4033
- x: "5",
4034
- y: "2",
4035
- width: "14",
4036
- height: "20",
4037
- rx: "2",
4038
- ry: "2"
4039
- }), /*#__PURE__*/React__default.createElement("line", {
4040
- x1: "12",
4041
- y1: "18",
4042
- x2: "12.01",
4043
- y2: "18"
4044
- }))), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
4045
- className: "data-label"
4046
- }, t("EKYC_PHONE_NO") || "Contact"), /*#__PURE__*/React__default.createElement("div", {
4047
- className: "address-text"
4048
- }, details.phoneNumber || t("CS_NA")))), /*#__PURE__*/React__default.createElement("div", {
4049
- className: "contact-item"
4050
- }, /*#__PURE__*/React__default.createElement("div", {
4051
- className: "icon-wrapper-small"
4052
- }, /*#__PURE__*/React__default.createElement("svg", {
4053
- width: "16",
4054
- height: "16",
4055
- viewBox: "0 0 24 24",
4056
- fill: "none",
4057
- stroke: "#6B7B8E",
4058
- strokeWidth: "2",
4059
- strokeLinecap: "round",
4060
- strokeLinejoin: "round"
4061
- }, /*#__PURE__*/React__default.createElement("circle", {
4062
- cx: "12",
4063
- cy: "12",
4064
- r: "4"
4065
- }), /*#__PURE__*/React__default.createElement("path", {
4066
- d: "M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-3.92 7.94"
4067
- }))), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
4068
- className: "data-label"
4069
- }, t("EKYC_EMAIL") || "Email Address"), /*#__PURE__*/React__default.createElement("div", {
4070
- className: "address-text"
4071
- }, details.email || t("CS_NA")))))))), /*#__PURE__*/React__default.createElement("div", {
4072
- className: "details-card-footer"
4073
- }, /*#__PURE__*/React__default.createElement("div", {
4074
- className: "footer-meta-text"
4075
- }, connectionDetails !== null && connectionDetails !== void 0 && connectionDetails.lastVerified ? (t("EKYC_LAST_VERIFIED") || "Last verified:") + " " + connectionDetails.lastVerified : ""), /*#__PURE__*/React__default.createElement("div", {
4076
- className: "action-btns-container",
4077
- style: {
4078
- fontSize: "12px"
4079
- }
4080
- }, /*#__PURE__*/React__default.createElement("button", {
4081
- onClick: handleStartVerification,
4082
- className: "primary-action-btn",
4083
- style: {
4084
- fontSize: "12px"
4085
- }
4086
- }, t("EKYC_START_REVIEW") || "Start Review", /*#__PURE__*/React__default.createElement("svg", {
4087
- width: "16",
4088
- height: "16",
4089
- viewBox: "0 0 24 24",
4090
- fill: "none",
4091
- stroke: "currentColor",
4092
- strokeWidth: "2.5",
4093
- strokeLinecap: "round",
4094
- strokeLinejoin: "round"
4095
- }, /*#__PURE__*/React__default.createElement("line", {
4096
- x1: "5",
4097
- y1: "12",
4098
- x2: "19",
4099
- y2: "12"
4100
- }), /*#__PURE__*/React__default.createElement("polyline", {
4101
- points: "12 5 19 12 12 19"
4102
- }))))))), showModal && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Modal, {
4103
- headerBarMain: t("EKYC_SELECT_VERIFICATION_TYPE"),
4104
- headerBarEnd: /*#__PURE__*/React__default.createElement("span", {
4105
- onClick: () => setShowModal(false),
4106
- style: {
4107
- cursor: "pointer",
4108
- padding: "8px"
4109
- }
4110
- }, "X"),
4111
- actionSaveLabel: t("ES_COMMON_CONFIRM"),
4112
- actionSaveOnSubmit: onModalConfirm,
4113
- actionCancelLabel: t("ES_COMMON_CANCEL"),
4114
- actionCancelOnSubmit: () => setShowModal(false),
4115
- style: {
4116
- borderRadius: "12px"
4117
- }
4118
- }, /*#__PURE__*/React__default.createElement("div", {
4119
- style: {
4120
- padding: "24px"
4121
- }
4122
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.RadioButtons, {
4123
- name: "verificationType",
4124
- options: options,
4125
- optionsKey: "name",
4126
- selectedOption: selectedOption,
4127
- onSelect: setSelectedOption,
4128
- style: {
4129
- display: "flex",
4130
- flexDirection: "column",
4131
- gap: "12px",
4132
- buttonStyle: {
4133
- borderRadius: "5px"
4134
- }
4135
- },
4136
- t: t
4137
- }))));
4138
- };
4139
-
4140
- const Create = () => {
4141
- const _useTranslation = reactI18next.useTranslation(),
4142
- t = _useTranslation.t;
4143
- const _useState = React.useState(() => {
4144
- const saved = sessionStorage.getItem("EKYC_CREATE_SEARCH_PARAMS");
4145
- return saved ? JSON.parse(saved) : {
4146
- kNumber: "",
4147
- kName: ""
4148
- };
4149
- }),
4150
- searchParams = _useState[0],
4151
- setSearchParams = _useState[1];
4152
- const _useState2 = React.useState(() => {
4153
- return sessionStorage.getItem("EKYC_CREATE_SEARCH_PERFORMED") === "true";
4154
- }),
4155
- searchPerformed = _useState2[0],
4156
- setSearchPerformed = _useState2[1];
4157
- const _useState3 = React.useState(null),
4158
- showToast = _useState3[0],
4159
- setShowToast = _useState3[1];
4160
- const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("EKYC_CREATE", {}),
4161
- clearParams = _Digit$Hooks$useSessi[2];
3365
+ const flowState = location.state || {};
3366
+ const _flowState$edits = flowState.edits,
3367
+ edits = _flowState$edits === void 0 ? {} : _flowState$edits;
3368
+ const activeKno = kno || applicationId;
3369
+ const _edits$aadhaarData = edits.aadhaarData,
3370
+ aadhaarData = _edits$aadhaarData === void 0 ? {} : _edits$aadhaarData,
3371
+ _edits$addressDetails = edits.addressDetails,
3372
+ editedAddress = _edits$addressDetails === void 0 ? {} : _edits$addressDetails,
3373
+ _edits$propertyDetail = edits.propertyDetails,
3374
+ editedProperty = _edits$propertyDetail === void 0 ? {} : _edits$propertyDetail,
3375
+ _edits$meterDetails = edits.meterDetails,
3376
+ editedMeter = _edits$meterDetails === void 0 ? {} : _edits$meterDetails;
4162
3377
  const tenantId = Digit.ULBService.getCurrentTenantId();
4163
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useSearchConnection({
4164
- tenantId,
4165
- details: {
4166
- kno: searchParams.kNumber,
4167
- name: searchParams.kName
4168
- }
4169
- }, {
4170
- enabled: searchPerformed && !!searchParams.kNumber && !!searchParams.kName,
4171
- onError: error => {
4172
- var _error$response, _error$response$data, _error$response$data$, _error$response$data$2;
4173
- setShowToast({
4174
- error: true,
4175
- 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")
4176
- });
4177
- setSearchPerformed(false);
4178
- sessionStorage.removeItem("EKYC_CREATE_SEARCH_PERFORMED");
4179
- }
3378
+ const workflowMutation = Digit.Hooks.ekyc.useEkycWorkflow(tenantId);
3379
+ const updateMutation = Digit.Hooks.ekyc.useEkycUpdate(tenantId);
3380
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycSearchReview({
3381
+ kno: activeKno,
3382
+ fetchType: "REVIEW"
3383
+ }, tenantId, {
3384
+ enabled: !!activeKno
4180
3385
  }),
4181
- isSearching = _Digit$Hooks$ekyc$use.isLoading,
4182
- connectionDetails = _Digit$Hooks$ekyc$use.data;
4183
- const handleSearch = params => {
4184
- if (!params.kNumber && !params.kName) {
4185
- setSearchParams({
4186
- kNumber: "",
4187
- kName: ""
4188
- });
4189
- setSearchPerformed(false);
4190
- sessionStorage.removeItem("EKYC_CREATE_SEARCH_PARAMS");
4191
- sessionStorage.removeItem("EKYC_CREATE_SEARCH_PERFORMED");
4192
- clearParams();
4193
- return;
4194
- }
4195
- if (!params.kNumber || !params.kName) {
4196
- setShowToast({
4197
- error: true,
4198
- label: t("EKYC_FILL_ALL_FIELDS")
4199
- });
4200
- return;
4201
- }
4202
- setSearchParams(params);
4203
- setSearchPerformed(true);
4204
- const currentKno = sessionStorage.getItem("EKYC_K_NUMBER");
4205
- if (currentKno !== params.kNumber) {
4206
- clearParams();
4207
- Object.keys(sessionStorage).forEach(key => {
4208
- if (key.startsWith("EKYC_") && key !== "EKYC_CREATE") sessionStorage.removeItem(key);
4209
- });
4210
- }
4211
- sessionStorage.setItem("EKYC_CREATE_SEARCH_PARAMS", JSON.stringify(params));
4212
- sessionStorage.setItem("EKYC_CREATE_SEARCH_PERFORMED", "true");
4213
- sessionStorage.setItem("EKYC_K_NUMBER", params.kNumber);
4214
- };
4215
- const closeToast = () => {
4216
- setShowToast(null);
4217
- };
4218
- return /*#__PURE__*/React__default.createElement(SearchConsumer, {
4219
- onSearch: handleSearch,
4220
- searchParams: searchParams
4221
- }, searchPerformed && /*#__PURE__*/React__default.createElement(ConnectionDetailsView, {
4222
- kNumber: searchParams.kNumber,
4223
- kName: searchParams.kName,
4224
- connectionDetails: connectionDetails,
4225
- isLoading: isSearching
4226
- }), !searchPerformed && !isSearching && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
4227
- style: {
4228
- textAlign: "center",
4229
- padding: "40px"
4230
- }
4231
- }, /*#__PURE__*/React__default.createElement("div", {
4232
- style: {
4233
- color: "#667085"
4234
- }
4235
- }, t("EKYC_SEARCH_TO_VIEW_DETAILS"))), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
4236
- error: showToast.error,
4237
- label: showToast.label,
4238
- onClose: closeToast,
4239
- isDsc: true
4240
- }));
4241
- };
4242
-
4243
- const ActionButton = _ref => {
4244
- let jumpTo = _ref.jumpTo,
4245
- state = _ref.state;
4246
- const history = reactRouterDom.useHistory();
4247
- function routeTo() {
4248
- history.push(jumpTo, _extends({}, state, {
4249
- isEditing: true
4250
- }));
4251
- }
4252
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.LinkButton, {
4253
- label: /*#__PURE__*/React__default.createElement(digitUiReactComponents.EditIcon, {
4254
- style: {
4255
- width: "20px",
4256
- height: "20px",
4257
- fill: "#F47738"
3386
+ searchData = _Digit$Hooks$ekyc$use.data,
3387
+ isSearchLoading = _Digit$Hooks$ekyc$use.isLoading;
3388
+ const userRoles = ((_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : (_Digit$SessionStorage2 = _Digit$SessionStorage.info) === null || _Digit$SessionStorage2 === void 0 ? void 0 : (_Digit$SessionStorage3 = _Digit$SessionStorage2.roles) === null || _Digit$SessionStorage3 === void 0 ? void 0 : _Digit$SessionStorage3.map(ele => ele.code)) || [];
3389
+ const isZRO = userRoles.includes("EKYC_ZRO") || userRoles.includes("ZRO");
3390
+ const isSupervisorOrSurveyorOrVendor = userRoles.includes("EKYC_SUPERVISOR") || userRoles.includes("EKYC_SURVEYOR") || userRoles.includes("EKYC_VENDOR");
3391
+ const isStatusView = location.pathname.includes("/status/");
3392
+ const hideEditButton = isSupervisorOrSurveyorOrVendor && !isZRO || isStatusView;
3393
+ const _extractReviewData = extractReviewData(searchData, flowState),
3394
+ apiNewData = _extractReviewData.newData,
3395
+ apiOldData = _extractReviewData.oldData;
3396
+ const prepareConsolidatedData = data => {
3397
+ if (!data) return null;
3398
+ const apiConn = (data === null || data === void 0 ? void 0 : data.connectionDetails) || data || {};
3399
+ const apiAddr = (data === null || data === void 0 ? void 0 : data.addressDetails) || data || {};
3400
+ const apiProp = (data === null || data === void 0 ? void 0 : data.propertyInfo) || data || {};
3401
+ const apiMeter = (data === null || data === void 0 ? void 0 : data.meterDetails) || data || {};
3402
+ return {
3403
+ connection: {
3404
+ consumerName: (apiConn === null || apiConn === void 0 ? void 0 : apiConn.consumerName) || (apiConn !== null && apiConn !== void 0 && apiConn.firstName ? [apiConn.firstName, apiConn.middleName, apiConn.lastName].filter(Boolean).join(" ") : null),
3405
+ address: (apiConn === null || apiConn === void 0 ? void 0 : apiConn.address) || (apiConn === null || apiConn === void 0 ? void 0 : apiConn.addressRaw),
3406
+ connectionType: (apiConn === null || apiConn === void 0 ? void 0 : apiConn.connectionType) || (apiConn === null || apiConn === void 0 ? void 0 : apiConn.connectionCategory),
3407
+ meterNumber: (apiConn === null || apiConn === void 0 ? void 0 : apiConn.meterNumber) || (apiConn === null || apiConn === void 0 ? void 0 : apiConn.meterNo),
3408
+ phoneNumber: (apiConn === null || apiConn === void 0 ? void 0 : apiConn.phoneNumber) || (apiConn === null || apiConn === void 0 ? void 0 : apiConn.mobileNo) || (apiConn === null || apiConn === void 0 ? void 0 : apiConn.mobileNumber),
3409
+ email: apiConn === null || apiConn === void 0 ? void 0 : apiConn.email,
3410
+ statusflag: (apiConn === null || apiConn === void 0 ? void 0 : apiConn.statusflag) || (apiConn === null || apiConn === void 0 ? void 0 : apiConn.statusFlag),
3411
+ ekycStatus: apiConn === null || apiConn === void 0 ? void 0 : apiConn.ekycStatus,
3412
+ knumber: (apiConn === null || apiConn === void 0 ? void 0 : apiConn.knumber) || (apiConn === null || apiConn === void 0 ? void 0 : apiConn.kno)
3413
+ },
3414
+ address: {
3415
+ fullAddress: (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.fullAddress) || (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.addressRaw),
3416
+ flatHouseNumber: (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.flatHouseNumber) || (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.flatNo),
3417
+ buildingTower: (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.buildingTower) || (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.building),
3418
+ landmark: apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.landmark,
3419
+ pinCode: (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.pinCode) || (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.pincode),
3420
+ ward: (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.ward) || (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.locality),
3421
+ assembly: apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.assembly,
3422
+ gpsValid: apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.gpsValid,
3423
+ latitude: apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.latitude,
3424
+ longitude: apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.longitude,
3425
+ mobileNo: (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.mobileNo) || (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.mobileNumber),
3426
+ whatsappNo: apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.whatsappNo,
3427
+ email: apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.email,
3428
+ noOfPerson: (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.noOfPerson) || (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.noOfPersons),
3429
+ knumber: (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.knumber) || (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.kno),
3430
+ doorPhotoFilestoreId: apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.doorPhotoFilestoreId
3431
+ },
3432
+ property: {
3433
+ kno: apiProp === null || apiProp === void 0 ? void 0 : apiProp.kno,
3434
+ pidNumber: apiProp === null || apiProp === void 0 ? void 0 : apiProp.pidNumber,
3435
+ typeOfConnection: apiProp === null || apiProp === void 0 ? void 0 : apiProp.typeOfConnection,
3436
+ connectionCategory: apiProp === null || apiProp === void 0 ? void 0 : apiProp.connectionCategory,
3437
+ userType: apiProp === null || apiProp === void 0 ? void 0 : apiProp.userType,
3438
+ numberOfFloors: (apiProp === null || apiProp === void 0 ? void 0 : apiProp.numberOfFloors) || (apiProp === null || apiProp === void 0 ? void 0 : apiProp.noOfFloor),
3439
+ tenantName: apiProp === null || apiProp === void 0 ? void 0 : apiProp.tenantName,
3440
+ tenantMobile: apiProp === null || apiProp === void 0 ? void 0 : apiProp.tenantMobile,
3441
+ ekycStatus: apiProp === null || apiProp === void 0 ? void 0 : apiProp.ekycStatus,
3442
+ propertyDocumentFileStoreId: apiProp === null || apiProp === void 0 ? void 0 : apiProp.propertyDocumentFileStoreId,
3443
+ buildingImageFileStoreId: apiProp === null || apiProp === void 0 ? void 0 : apiProp.buildingImageFileStoreId
3444
+ },
3445
+ meter: {
3446
+ kno: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.kno,
3447
+ metered: (apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.meterStatus) === "METERED" || (apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.metered),
3448
+ meterNumber: (apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.meterNumber) || (apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.meterNo),
3449
+ meterMake: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.meterMake,
3450
+ meterLocationAddress: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.meterLocationAddress,
3451
+ meterLatitude: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.meterLatitude,
3452
+ meterLongitude: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.meterLongitude,
3453
+ workingStatus: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.workingStatus,
3454
+ lastBillRaised: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.lastBillRaised,
3455
+ systemMeterId: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.systemMeterId,
3456
+ meterPhotoFileStoreId: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.meterPhotoFileStoreId
4258
3457
  }
4259
- }),
4260
- style: {
4261
- margin: 0,
4262
- padding: 0
4263
- },
4264
- onClick: routeTo
4265
- });
4266
- };
4267
- const checkForNA = value => value !== null && value !== undefined && value !== "" ? value : "N/A";
4268
- const boolToYesNo = (value, t) => {
4269
- if (value === true || value === "true" || String(value).toLowerCase() === "yes") return t("CORE_COMMON_YES");
4270
- if (value === false || value === "false" || String(value).toLowerCase() === "no") return t("CORE_COMMON_NO");
4271
- if (value === "true") return t("CORE_COMMON_YES");
4272
- if (value === "false") return t("CORE_COMMON_NO");
4273
- };
4274
- const extractReviewData = (searchData, flowState) => {
4275
- const rawData = searchData && Object.keys(searchData).length > 0 ? searchData : (flowState === null || flowState === void 0 ? void 0 : flowState.reviewData) || {};
4276
- const reviewWrapper = (rawData === null || rawData === void 0 ? void 0 : rawData.applicationReviewInfo) || (rawData === null || rawData === void 0 ? void 0 : rawData.applicationReview) || rawData;
4277
- const applicationData = (Array.isArray(reviewWrapper) ? reviewWrapper[0] : reviewWrapper) || {};
4278
- return {
4279
- newData: (applicationData === null || applicationData === void 0 ? void 0 : applicationData.newData) || applicationData,
4280
- oldData: (applicationData === null || applicationData === void 0 ? void 0 : applicationData.oldData) || null
4281
- };
4282
- };
4283
- const ReviewSection = _ref2 => {
4284
- let title = _ref2.title,
4285
- fields = _ref2.fields,
4286
- newData = _ref2.newData,
4287
- oldData = _ref2.oldData,
4288
- t = _ref2.t,
4289
- jumpTo = _ref2.jumpTo,
4290
- state = _ref2.state,
4291
- hideEditButton = _ref2.hideEditButton;
4292
- return /*#__PURE__*/React__default.createElement("div", {
4293
- className: "review-section-wrapper",
4294
- style: {
4295
- marginBottom: "48px",
4296
- background: "#fff",
4297
- borderRadius: "12px",
4298
- border: "1px solid #EAECF0",
4299
- overflow: "hidden"
4300
- }
4301
- }, /*#__PURE__*/React__default.createElement("div", {
4302
- style: {
4303
- padding: "20px 24px",
4304
- background: "#F9FAFB",
4305
- borderBottom: "1px solid #EAECF0",
4306
- display: "flex",
4307
- justifyContent: "space-between",
4308
- alignItems: "center"
4309
- }
4310
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardSubHeader, {
4311
- style: {
4312
- margin: 0,
4313
- fontSize: "18px",
4314
- color: "#101828",
4315
- fontWeight: "700"
4316
- }
4317
- }, title), jumpTo && !hideEditButton && /*#__PURE__*/React__default.createElement(ActionButton, {
4318
- jumpTo: jumpTo,
4319
- state: state
4320
- })), /*#__PURE__*/React__default.createElement("div", {
4321
- style: {
4322
- padding: "0 24px"
4323
- }
4324
- }, /*#__PURE__*/React__default.createElement("table", {
4325
- style: {
4326
- width: "100%",
4327
- borderCollapse: "collapse",
4328
- tableLayout: "fixed"
4329
- }
4330
- }, /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
4331
- style: {
4332
- padding: "16px 0",
4333
- textAlign: "left",
4334
- color: "#667085",
4335
- fontSize: "12px",
4336
- fontWeight: "600",
4337
- textTransform: "uppercase",
4338
- width: "30%"
4339
- }
4340
- }, t("EKYC_FIELD_NAME")), /*#__PURE__*/React__default.createElement("th", {
4341
- style: {
4342
- padding: "16px 0",
4343
- textAlign: "left",
4344
- color: "#667085",
4345
- fontSize: "12px",
4346
- fontWeight: "600",
4347
- textTransform: "uppercase",
4348
- width: "35%"
4349
- }
4350
- }, t("EKYC_EXISTING_INFORMATION")), /*#__PURE__*/React__default.createElement("th", {
4351
- style: {
4352
- padding: "16px 0",
4353
- textAlign: "left",
4354
- color: "#667085",
4355
- fontSize: "12px",
4356
- fontWeight: "600",
4357
- textTransform: "uppercase",
4358
- width: "35%"
4359
- }
4360
- }, t("EKYC_PROPOSED_UPDATES")))), /*#__PURE__*/React__default.createElement("tbody", null, fields.map((field, idx) => {
4361
- const valNew = newData === null || newData === void 0 ? void 0 : newData[field.key];
4362
- const valOld = oldData === null || oldData === void 0 ? void 0 : oldData[field.key];
4363
- const isChanged = oldData && String(valNew) !== String(valOld) && valOld !== undefined && valOld !== null;
4364
- return /*#__PURE__*/React__default.createElement("tr", {
4365
- key: idx,
4366
- style: {
4367
- borderTop: "1px solid #F2F4F7"
4368
- }
4369
- }, /*#__PURE__*/React__default.createElement("td", {
4370
- style: {
4371
- padding: "16px 0",
4372
- fontSize: "14px",
4373
- color: "#344054",
4374
- fontWeight: "500"
4375
- }
4376
- }, t(field.label)), /*#__PURE__*/React__default.createElement("td", {
4377
- style: {
4378
- padding: "16px 0",
4379
- fontSize: "14px",
4380
- color: "#667085"
4381
- }
4382
- }, field.isBool ? boolToYesNo(valOld, t) : checkForNA(valOld)), /*#__PURE__*/React__default.createElement("td", {
4383
- style: {
4384
- padding: "16px 0",
4385
- fontSize: "14px",
4386
- color: isChanged ? "#1B8B32" : "#101828",
4387
- fontWeight: isChanged ? "700" : "400"
4388
- }
4389
- }, /*#__PURE__*/React__default.createElement("div", {
4390
- style: {
4391
- display: "flex",
4392
- alignItems: "center",
4393
- gap: "8px"
4394
- }
4395
- }, field.isBool ? boolToYesNo(valNew, t) : checkForNA(valNew), isChanged && /*#__PURE__*/React__default.createElement("span", {
4396
- style: {
4397
- background: "#ECFDF3",
4398
- color: "#067647",
4399
- padding: "2px 8px",
4400
- borderRadius: "12px",
4401
- fontSize: "10px",
4402
- fontWeight: "600"
4403
- }
4404
- }, t("EKYC_CHANGED")))));
4405
- })))));
4406
- };
4407
- const Review = () => {
4408
- 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;
4409
- const _useTranslation = reactI18next.useTranslation(),
4410
- t = _useTranslation.t;
4411
- const history = reactRouterDom.useHistory();
4412
- const location = reactRouterDom.useLocation();
4413
- let _useParams = reactRouterDom.useParams(),
4414
- kno = _useParams.kno,
4415
- applicationId = _useParams.applicationId;
4416
- const _useState = React.useState(false),
4417
- agree = _useState[0],
4418
- setAgree = _useState[1];
4419
- const _useState2 = React.useState(false),
4420
- isSubmitting = _useState2[0];
4421
- const _useState3 = React.useState(false),
4422
- showPreview = _useState3[0],
4423
- setShowPreview = _useState3[1];
4424
- const _useState4 = React.useState(""),
4425
- previewUrl = _useState4[0],
4426
- setPreviewUrl = _useState4[1];
4427
- const _useState5 = React.useState(false),
4428
- showOptions = _useState5[0],
4429
- setShowOptions = _useState5[1];
4430
- const _useState6 = React.useState(false),
4431
- showToast = _useState6[0],
4432
- setShowToast = _useState6[1];
4433
- const _useState7 = React.useState({
4434
- error: false,
4435
- label: ""
4436
- }),
4437
- toastData = _useState7[0],
4438
- setToastData = _useState7[1];
4439
- const options = [{
4440
- action: t("APPROVE")
4441
- }, {
4442
- action: t("REJECT")
4443
- }];
4444
- const flowState = location.state || {};
4445
- const _flowState$edits = flowState.edits,
4446
- edits = _flowState$edits === void 0 ? {} : _flowState$edits;
4447
- const activeKno = kno || applicationId;
4448
- const _edits$aadhaarData = edits.aadhaarData,
4449
- aadhaarData = _edits$aadhaarData === void 0 ? {} : _edits$aadhaarData,
4450
- _edits$addressDetails = edits.addressDetails,
4451
- editedAddress = _edits$addressDetails === void 0 ? {} : _edits$addressDetails,
4452
- _edits$propertyDetail = edits.propertyDetails,
4453
- editedProperty = _edits$propertyDetail === void 0 ? {} : _edits$propertyDetail,
4454
- _edits$meterDetails = edits.meterDetails,
4455
- editedMeter = _edits$meterDetails === void 0 ? {} : _edits$meterDetails;
4456
- const tenantId = Digit.ULBService.getCurrentTenantId();
4457
- const workflowMutation = Digit.Hooks.ekyc.useEkycWorkflow(tenantId);
4458
- const updateMutation = Digit.Hooks.ekyc.useEkycUpdate(tenantId);
4459
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycSearchReview({
4460
- kno: activeKno,
4461
- fetchType: "REVIEW"
4462
- }, tenantId, {
4463
- enabled: !!activeKno
4464
- }),
4465
- searchData = _Digit$Hooks$ekyc$use.data,
4466
- isSearchLoading = _Digit$Hooks$ekyc$use.isLoading;
4467
- const userRoles = ((_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : (_Digit$SessionStorage2 = _Digit$SessionStorage.info) === null || _Digit$SessionStorage2 === void 0 ? void 0 : (_Digit$SessionStorage3 = _Digit$SessionStorage2.roles) === null || _Digit$SessionStorage3 === void 0 ? void 0 : _Digit$SessionStorage3.map(ele => ele.code)) || [];
4468
- const isZRO = userRoles.includes("EKYC_ZRO") || userRoles.includes("ZRO");
4469
- const isSupervisorOrSurveyorOrVendor = userRoles.includes("EKYC_SUPERVISOR") || userRoles.includes("EKYC_SURVEYOR") || userRoles.includes("EKYC_VENDOR");
4470
- const isStatusView = location.pathname.includes("/status/");
4471
- const hideEditButton = isSupervisorOrSurveyorOrVendor && !isZRO || isStatusView;
4472
- const _extractReviewData = extractReviewData(searchData, flowState),
4473
- apiNewData = _extractReviewData.newData,
4474
- apiOldData = _extractReviewData.oldData;
4475
- const prepareConsolidatedData = data => {
4476
- if (!data) return null;
4477
- const apiConn = (data === null || data === void 0 ? void 0 : data.connectionDetails) || data || {};
4478
- const apiAddr = (data === null || data === void 0 ? void 0 : data.addressDetails) || data || {};
4479
- const apiProp = (data === null || data === void 0 ? void 0 : data.propertyInfo) || data || {};
4480
- const apiMeter = (data === null || data === void 0 ? void 0 : data.meterDetails) || data || {};
4481
- return {
4482
- connection: {
4483
- consumerName: (apiConn === null || apiConn === void 0 ? void 0 : apiConn.consumerName) || (apiConn !== null && apiConn !== void 0 && apiConn.firstName ? [apiConn.firstName, apiConn.middleName, apiConn.lastName].filter(Boolean).join(" ") : null),
4484
- address: (apiConn === null || apiConn === void 0 ? void 0 : apiConn.address) || (apiConn === null || apiConn === void 0 ? void 0 : apiConn.addressRaw),
4485
- connectionType: (apiConn === null || apiConn === void 0 ? void 0 : apiConn.connectionType) || (apiConn === null || apiConn === void 0 ? void 0 : apiConn.connectionCategory),
4486
- meterNumber: (apiConn === null || apiConn === void 0 ? void 0 : apiConn.meterNumber) || (apiConn === null || apiConn === void 0 ? void 0 : apiConn.meterNo),
4487
- phoneNumber: (apiConn === null || apiConn === void 0 ? void 0 : apiConn.phoneNumber) || (apiConn === null || apiConn === void 0 ? void 0 : apiConn.mobileNo) || (apiConn === null || apiConn === void 0 ? void 0 : apiConn.mobileNumber),
4488
- email: apiConn === null || apiConn === void 0 ? void 0 : apiConn.email,
4489
- statusflag: (apiConn === null || apiConn === void 0 ? void 0 : apiConn.statusflag) || (apiConn === null || apiConn === void 0 ? void 0 : apiConn.statusFlag),
4490
- ekycStatus: apiConn === null || apiConn === void 0 ? void 0 : apiConn.ekycStatus,
4491
- knumber: (apiConn === null || apiConn === void 0 ? void 0 : apiConn.knumber) || (apiConn === null || apiConn === void 0 ? void 0 : apiConn.kno)
4492
- },
4493
- address: {
4494
- fullAddress: (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.fullAddress) || (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.addressRaw),
4495
- flatHouseNumber: (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.flatHouseNumber) || (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.flatNo),
4496
- buildingTower: (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.buildingTower) || (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.building),
4497
- landmark: apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.landmark,
4498
- pinCode: (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.pinCode) || (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.pincode),
4499
- ward: (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.ward) || (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.locality),
4500
- assembly: apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.assembly,
4501
- gpsValid: apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.gpsValid,
4502
- latitude: apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.latitude,
4503
- longitude: apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.longitude,
4504
- mobileNo: (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.mobileNo) || (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.mobileNumber),
4505
- whatsappNo: apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.whatsappNo,
4506
- email: apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.email,
4507
- noOfPerson: (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.noOfPerson) || (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.noOfPersons),
4508
- knumber: (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.knumber) || (apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.kno),
4509
- doorPhotoFilestoreId: apiAddr === null || apiAddr === void 0 ? void 0 : apiAddr.doorPhotoFilestoreId
4510
- },
4511
- property: {
4512
- kno: apiProp === null || apiProp === void 0 ? void 0 : apiProp.kno,
4513
- pidNumber: apiProp === null || apiProp === void 0 ? void 0 : apiProp.pidNumber,
4514
- typeOfConnection: apiProp === null || apiProp === void 0 ? void 0 : apiProp.typeOfConnection,
4515
- connectionCategory: apiProp === null || apiProp === void 0 ? void 0 : apiProp.connectionCategory,
4516
- userType: apiProp === null || apiProp === void 0 ? void 0 : apiProp.userType,
4517
- numberOfFloors: (apiProp === null || apiProp === void 0 ? void 0 : apiProp.numberOfFloors) || (apiProp === null || apiProp === void 0 ? void 0 : apiProp.noOfFloor),
4518
- tenantName: apiProp === null || apiProp === void 0 ? void 0 : apiProp.tenantName,
4519
- tenantMobile: apiProp === null || apiProp === void 0 ? void 0 : apiProp.tenantMobile,
4520
- ekycStatus: apiProp === null || apiProp === void 0 ? void 0 : apiProp.ekycStatus,
4521
- propertyDocumentFileStoreId: apiProp === null || apiProp === void 0 ? void 0 : apiProp.propertyDocumentFileStoreId,
4522
- buildingImageFileStoreId: apiProp === null || apiProp === void 0 ? void 0 : apiProp.buildingImageFileStoreId
4523
- },
4524
- meter: {
4525
- kno: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.kno,
4526
- metered: (apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.meterStatus) === "METERED" || (apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.metered),
4527
- meterNumber: (apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.meterNumber) || (apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.meterNo),
4528
- meterMake: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.meterMake,
4529
- meterLocationAddress: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.meterLocationAddress,
4530
- meterLatitude: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.meterLatitude,
4531
- meterLongitude: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.meterLongitude,
4532
- workingStatus: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.workingStatus,
4533
- lastBillRaised: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.lastBillRaised,
4534
- systemMeterId: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.systemMeterId,
4535
- meterPhotoFileStoreId: apiMeter === null || apiMeter === void 0 ? void 0 : apiMeter.meterPhotoFileStoreId
4536
- }
4537
- };
3458
+ };
4538
3459
  };
4539
3460
  const newDataRaw = prepareConsolidatedData(apiNewData);
4540
3461
  const oldDataRaw = prepareConsolidatedData(apiOldData);
@@ -5660,533 +4581,197 @@ const AadhaarVerification = _ref => {
5660
4581
  });
5661
4582
  }, function () {
5662
4583
  setToast({
5663
- type: "error",
5664
- message: t("Failed to update consumer details")
5665
- });
5666
- });
5667
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
5668
- } catch (e) {
5669
- return Promise.reject(e);
5670
- }
5671
- };
5672
- if (isLoading) {
5673
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
5674
- }
5675
- const Config = AadhaarVerificationConfig(t, localFormData, handleUploadProof, setDocumentId, documentId);
5676
- return /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.FormComposer, {
5677
- key: isDataLoaded ? "loaded" : "loading",
5678
- isDisabled: !canSubmit,
5679
- label: t("ES_COMMON_CONTINUE"),
5680
- config: Config.map(item => _extends({}, item, {
5681
- isCollapsible: true,
5682
- isDefaultOpen: true
5683
- })),
5684
- onSubmit: onSubmit,
5685
- defaultValues: defaultValues,
5686
- onFormValueChange: onFormValueChange,
5687
- noCard: false,
5688
- submitInForm: true
5689
- }), toast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
5690
- error: toast.type === "error",
5691
- label: toast.message,
5692
- onClose: () => setToast(null)
5693
- }));
5694
- };
5695
-
5696
- const ekycConfig = [{
5697
- body: [{
5698
- route: "consumer-details",
5699
- component: AadhaarVerification,
5700
- key: "aadhaarVerification",
5701
- texts: {
5702
- header: "EKYC_CONSUMER_CONNECTION",
5703
- submitBarLabel: "COMMON_SAVE_NEXT"
5704
- },
5705
- timeLine: [{
5706
- currentStep: 1,
5707
- actions: "EKYC_CONSUMER_CONNECTION"
5708
- }]
5709
- }, {
5710
- route: "address-details",
5711
- component: "AddressDetails",
5712
- key: "addressDetails",
5713
- doorImage: true,
5714
- showMapActualLocation: false,
5715
- texts: {
5716
- header: "EKYC_ADDRESS_DETAILS",
5717
- submitBarLabel: "COMMON_SAVE_NEXT"
5718
- },
5719
- timeLine: [{
5720
- currentStep: 2,
5721
- actions: "EKYC_ADDRESS_DETAILS"
5722
- }]
5723
- }, {
5724
- route: "property-info",
5725
- component: "PropertyInfo",
5726
- key: "propertyDetails",
5727
- texts: {
5728
- header: "EKYC_PROPERTY_INFO",
5729
- submitBarLabel: "COMMON_SAVE_NEXT"
5730
- },
5731
- timeLine: [{
5732
- currentStep: 3,
5733
- actions: "EKYC_PROPERTY_INFO"
5734
- }]
5735
- }, {
5736
- route: "meter-details",
5737
- component: "MeterDetails",
5738
- key: "meterDetails",
5739
- texts: {
5740
- header: "EKYC_METER_DETAILS",
5741
- submitBarLabel: "COMMON_SAVE_NEXT"
5742
- },
5743
- timeLine: [{
5744
- currentStep: 4,
5745
- actions: "EKYC_METER_DETAILS"
5746
- }]
5747
- }]
5748
- }];
5749
-
5750
- const _excluded$3 = ["edits"];
5751
- const EKYCForm = _ref => {
5752
- let passedPath = _ref.path;
5753
- const match = reactRouterDom.useRouteMatch();
5754
- const _useTranslation = reactI18next.useTranslation(),
5755
- t = _useTranslation.t;
5756
- const location = reactRouterDom.useLocation();
5757
- const pathname = location.pathname;
5758
- const history = reactRouterDom.useHistory();
5759
- let config = [];
5760
- const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("EKYC_CREATE", {}),
5761
- params = _Digit$Hooks$useSessi[0],
5762
- setParams = _Digit$Hooks$useSessi[1];
5763
- React.useEffect(() => {
5764
- if (location.state && Object.keys(location.state).length > 0) {
5765
- const _location$state = location.state,
5766
- edits = _location$state.edits,
5767
- rest = _objectWithoutPropertiesLoose(_location$state, _excluded$3);
5768
- setParams(_extends({}, params, rest, edits));
5769
- }
5770
- }, [location.state]);
5771
- const goNext = (skipStep, index, isAddMultiple, key) => {
5772
- let currentPath = pathname.split("/").pop();
5773
- let routeObj = config.find(routeObj => key ? routeObj.key === key : routeObj.route === currentPath);
5774
- if (!routeObj) routeObj = config.find(routeObj => routeObj.route === currentPath);
5775
- let nextStep = null;
5776
- const currentIndex = config.findIndex(c => c.route === routeObj.route);
5777
- if (currentIndex > -1 && currentIndex < config.length - 1) {
5778
- nextStep = config[currentIndex + 1].route;
5779
- }
5780
- let redirectWithHistory = history.push;
5781
- if (skipStep) {
5782
- redirectWithHistory = history.replace;
5783
- }
5784
- const base = passedPath || match.path.split("/").slice(0, -1).join("/");
5785
- if (nextStep === null) {
5786
- return redirectWithHistory(base + "/review", _extends({}, params, {
5787
- edits: params
5788
- }));
5789
- }
5790
- redirectWithHistory(base + "/" + nextStep, _extends({}, params));
5791
- };
5792
- function handleSelect(key, data, skipStep, index, isAddMultiple, silent) {
5793
- if (isAddMultiple === void 0) {
5794
- isAddMultiple = false;
5795
- }
5796
- if (silent === void 0) {
5797
- silent = false;
5798
- }
5799
- setParams(prev => _extends({}, prev, {
5800
- [key]: _extends({}, params[key], data)
5801
- }));
5802
- if (!silent) {
5803
- goNext(skipStep, index, isAddMultiple, key);
5804
- }
5805
- }
5806
- ekycConfig.forEach(obj => {
5807
- config = config.concat(obj.body);
5808
- });
5809
- config.indexRoute = "consumer-details";
5810
- const formStepRoutes = config.map(c => c.route);
5811
- const isFormStep = formStepRoutes.some(route => pathname.includes(route));
5812
- const sectionRefs = React.useRef({});
5813
- React.useEffect(() => {
5814
- if (isFormStep) {
5815
- const currentRoute = pathname.split("/").pop();
5816
- if (sectionRefs.current[currentRoute]) {
5817
- sectionRefs.current[currentRoute].scrollIntoView({
5818
- behavior: "smooth",
5819
- block: "start"
5820
- });
5821
- }
5822
- }
5823
- }, [pathname, isFormStep]);
5824
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
5825
- className: "employee-form-section-wrapper"
5826
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.VerticalTimeline, {
5827
- config: config,
5828
- showFinalStep: true
5829
- }), /*#__PURE__*/React__default.createElement("div", {
5830
- className: "employee-form-section"
5831
- }, /*#__PURE__*/React__default.createElement(reactRouterDom.Switch, null, /*#__PURE__*/React__default.createElement(reactRouterDom.Route, {
5832
- path: formStepRoutes.map(route => (passedPath || match.path.split("/").slice(0, -1).join("/")) + "/" + route)
5833
- }, /*#__PURE__*/React__default.createElement("div", {
5834
- className: "single-page-form-container"
5835
- }, config.map((routeObj, index) => {
5836
- const component = routeObj.component;
5837
- const Component = typeof component === "string" ? Digit.ComponentRegistryService.getComponent(component) : component;
5838
- return /*#__PURE__*/React__default.createElement("div", {
5839
- key: index,
5840
- ref: el => sectionRefs.current[routeObj.route] = el,
5841
- className: "form-section-unit"
5842
- }, /*#__PURE__*/React__default.createElement(Component, {
5843
- config: _extends({}, routeObj, {
5844
- isCollapsible: true,
5845
- defaultOpen: true
5846
- }),
5847
- onSelect: handleSelect,
5848
- t: t,
5849
- formData: params
5850
- }));
5851
- }))), /*#__PURE__*/React__default.createElement(reactRouterDom.Route, null, /*#__PURE__*/React__default.createElement(reactRouterDom.Redirect, {
5852
- to: (passedPath || match.path.split("/").slice(0, -1).join("/")) + "/" + config.indexRoute
5853
- }))))));
5854
- };
5855
-
5856
- function formReducer(state, payload) {
5857
- const storageKey = "EKYC.SW.INBOX";
5858
- switch (payload.action) {
5859
- case "mutateSearchForm":
5860
- Digit.SessionStorage.set(storageKey, _extends({}, state, {
5861
- searchForm: payload.data
5862
- }));
5863
- return _extends({}, state, {
5864
- searchForm: payload.data
5865
- });
5866
- case "mutateFilterForm":
5867
- Digit.SessionStorage.set(storageKey, _extends({}, state, {
5868
- filterForm: payload.data
5869
- }));
5870
- return _extends({}, state, {
5871
- filterForm: payload.data
5872
- });
5873
- case "mutateTableForm":
5874
- Digit.SessionStorage.set(storageKey, _extends({}, state, {
5875
- tableForm: payload.data
5876
- }));
5877
- return _extends({}, state, {
5878
- tableForm: payload.data
5879
- });
5880
- default:
5881
- return state;
5882
- }
5883
- }
5884
- const formInitValue = {
5885
- filterForm: {},
5886
- searchForm: {},
5887
- tableForm: {
5888
- limit: 10,
5889
- offset: 0,
5890
- sortBy: "createdTime",
5891
- sortOrder: "DESC"
5892
- }
5893
- };
5894
- const tableColumnConfig = (t, handleReview) => [{
5895
- Header: t("SURVEYOR_NAME"),
5896
- accessor: "surveyorName",
5897
- Cell: _ref => {
5898
- var _row$original, _row$original2, _row$original3;
5899
- let row = _ref.row;
5900
- const id = (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.id;
5901
- return /*#__PURE__*/React__default.createElement("span", {
5902
- className: "link",
5903
- onClick: () => handleReview(id)
5904
- }, ((_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");
5905
- }
5906
- }, {
5907
- Header: t("MOBILE_NUMBER"),
5908
- accessor: "mobileNo",
5909
- Cell: _ref2 => {
5910
- var _row$original4, _row$original5, _row$original5$owner;
5911
- let row = _ref2.row;
5912
- 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");
5913
- }
5914
- }, {
5915
- Header: t("STATUS"),
5916
- accessor: "status",
5917
- Cell: _ref3 => {
5918
- var _row$original6;
5919
- let row = _ref3.row;
5920
- const status = ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.status) || "DEFAULT";
5921
- return /*#__PURE__*/React__default.createElement("span", {
5922
- className: "ekyc-status-tag " + status
5923
- }, t(status));
5924
- }
5925
- }, {
5926
- Header: t("SERVICE_TYPE"),
5927
- accessor: "serviceType",
5928
- Cell: _ref4 => {
5929
- var _row$original7;
5930
- let row = _ref4.row;
5931
- return /*#__PURE__*/React__default.createElement("span", null, ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.serviceType) || "NA");
5932
- }
5933
- }];
5934
-
5935
- const SupervisorInboxTableConfig = _ref => {
5936
- var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _formState$tableForm, _formState$tableForm2;
5937
- let onPageSizeChange = _ref.onPageSizeChange,
5938
- formState = _ref.formState,
5939
- totalCount = _ref.totalCount,
5940
- table = _ref.table,
5941
- dispatch = _ref.dispatch,
5942
- onSortingByData = _ref.onSortingByData,
5943
- _ref$inboxStyles = _ref.inboxStyles,
5944
- inboxStyles = _ref$inboxStyles === void 0 ? {} : _ref$inboxStyles,
5945
- _ref$tableStyle = _ref.tableStyle,
5946
- tableStyle = _ref$tableStyle === void 0 ? {} : _ref$tableStyle;
5947
- const _useTranslation = reactI18next.useTranslation(),
5948
- t = _useTranslation.t;
5949
- const history = reactRouterDom.useHistory();
5950
- 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";
5951
- const handleReview = id => {
5952
- history.push("/digit-ui/" + userType + "/ekyc/assign/surveyor-details/" + id);
5953
- };
5954
- const limit = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10;
5955
- const offset = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0;
5956
- return {
5957
- disableSort: false,
5958
- autoSort: false,
5959
- manualPagination: true,
5960
- currentPage: Math.floor(offset / limit),
5961
- onPageSizeChange,
5962
- onNextPage: () => dispatch({
5963
- action: "mutateTableForm",
5964
- data: _extends({}, formState.tableForm, {
5965
- offset: Number(offset) + Number(limit)
5966
- })
5967
- }),
5968
- onPrevPage: () => dispatch({
5969
- action: "mutateTableForm",
5970
- data: _extends({}, formState.tableForm, {
5971
- offset: Number(offset) - Number(limit)
5972
- })
5973
- }),
5974
- onLastPage: () => dispatch({
5975
- action: "mutateTableForm",
5976
- data: _extends({}, formState.tableForm, {
5977
- offset: Math.ceil(totalCount / limit) * limit - Number(limit)
5978
- })
5979
- }),
5980
- onFirstPage: () => dispatch({
5981
- action: "mutateTableForm",
5982
- data: _extends({}, formState.tableForm, {
5983
- offset: 0
5984
- })
5985
- }),
5986
- totalRecords: totalCount,
5987
- onSort: onSortingByData,
5988
- data: table,
5989
- columns: tableColumnConfig(t, handleReview),
5990
- inboxStyles: _extends({}, inboxStyles),
5991
- tableStyle: _extends({}, tableStyle)
5992
- };
5993
- };
5994
-
5995
- const AssignEkyc = () => {
5996
- var _formState$tableForm, _formState$tableForm2, _formState$tableForm3, _formState$tableForm4, _formState$searchForm, _dashboardData$dashbo;
5997
- let tenantId = Digit.ULBService.getCurrentTenantId();
5998
- if (!tenantId || tenantId === "dl") {
5999
- tenantId = "dl.djb";
6000
- }
6001
- const _useReducer = React.useReducer(formReducer, formInitValue),
6002
- formState = _useReducer[0],
6003
- dispatch = _useReducer[1];
6004
- let paginationParms = {
6005
- limit: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10,
6006
- offset: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0,
6007
- sortBy: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm3 = formState.tableForm) === null || _formState$tableForm3 === void 0 ? void 0 : _formState$tableForm3.sortBy) || "createdTime",
6008
- sortOrder: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm4 = formState.tableForm) === null || _formState$tableForm4 === void 0 ? void 0 : _formState$tableForm4.sortOrder) || "DESC"
6009
- };
6010
- const mobileNumber = (formState === null || formState === void 0 ? void 0 : (_formState$searchForm = formState.searchForm) === null || _formState$searchForm === void 0 ? void 0 : _formState$searchForm.mobileNumber) || "";
6011
- const isSearchActive = !!mobileNumber;
6012
- const filters = _extends({}, paginationParms, {
6013
- status: "ACTIVE,DISABLED"
6014
- });
6015
- if (isSearchActive) {
6016
- filters.mobileNumber = mobileNumber;
6017
- }
6018
- const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSurveyorSearch(tenantId, filters, {
6019
- enabled: !!tenantId,
6020
- keepPreviousData: true
6021
- }),
6022
- dashboardData = _Digit$Hooks$fsm$useS.data,
6023
- isLoading = _Digit$Hooks$fsm$useS.isLoading;
6024
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycAssignmentProgress({
6025
- enabled: !!tenantId,
6026
- keepPreviousData: true
6027
- }),
6028
- isDataSearchLoading = _Digit$Hooks$ekyc$use.isLoading;
6029
- const sourceData = React.useMemo(() => {
6030
- return (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.surveyors) || [];
6031
- }, [dashboardData]);
6032
- const filteredData = React.useMemo(() => {
6033
- return (sourceData || []).map(item => {
6034
- var _owner$roles, _owner$roles$map, _item$additionalDetai, _item$auditDetails, _item$auditDetails2;
6035
- const owner = (item === null || item === void 0 ? void 0 : item.owner) || {};
6036
- 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(", ")) || "";
6037
- return _extends({}, item, {
6038
- id: (item === null || item === void 0 ? void 0 : item.id) || "",
6039
- surveyorName: (item === null || item === void 0 ? void 0 : item.name) || (owner === null || owner === void 0 ? void 0 : owner.name) || "",
6040
- mobileNo: (item === null || item === void 0 ? void 0 : item.mobileNo) || (owner === null || owner === void 0 ? void 0 : owner.mobileNumber) || "",
6041
- email: (owner === null || owner === void 0 ? void 0 : owner.emailId) || "",
6042
- vendorId: (item === null || item === void 0 ? void 0 : item.vendorId) || "",
6043
- tenantId: (item === null || item === void 0 ? void 0 : item.tenantId) || "",
6044
- supervisorId: (item === null || item === void 0 ? void 0 : item.supervisorId) || "",
6045
- status: (item === null || item === void 0 ? void 0 : item.status) || "",
6046
- roleCodes,
6047
- userName: (owner === null || owner === void 0 ? void 0 : owner.userName) || "",
6048
- gender: (owner === null || owner === void 0 ? void 0 : owner.gender) || "",
6049
- serviceType: (item === null || item === void 0 ? void 0 : (_item$additionalDetai = item.additionalDetails) === null || _item$additionalDetai === void 0 ? void 0 : _item$additionalDetai.serviceType) || "",
6050
- createdTime: (item === null || item === void 0 ? void 0 : (_item$auditDetails = item.auditDetails) === null || _item$auditDetails === void 0 ? void 0 : _item$auditDetails.createdTime) || 0,
6051
- lastModifiedTime: (item === null || item === void 0 ? void 0 : (_item$auditDetails2 = item.auditDetails) === null || _item$auditDetails2 === void 0 ? void 0 : _item$auditDetails2.lastModifiedTime) || 0
6052
- });
6053
- });
6054
- }, [sourceData]);
6055
- 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;
6056
- const SearchFormFields = React.useCallback(_ref => {
6057
- let registerRef = _ref.registerRef,
6058
- searchFormState = _ref.searchFormState,
6059
- controlSearchForm = _ref.controlSearchForm;
6060
- return /*#__PURE__*/React__default.createElement(SearchFormFieldsComponents, {
6061
- registerRef,
6062
- searchFormState,
6063
- controlSearchForm,
6064
- searchType: "mobile",
6065
- className: "search"
6066
- });
6067
- }, []);
6068
- const tableOrderFormDefaultValues = {
6069
- sortBy: "createdTime",
6070
- limit: window.Digit.Utils.browser.isMobile() ? 50 : 10,
6071
- offset: 0,
6072
- sortOrder: "DESC"
6073
- };
6074
- const onSearchFormSubmit = data => {
6075
- data.hasOwnProperty("") && (data === null || data === void 0 ? true : delete data[""]);
6076
- dispatch({
6077
- action: "mutateTableForm",
6078
- data: _extends({}, tableOrderFormDefaultValues)
6079
- });
6080
- dispatch({
6081
- action: "mutateSearchForm",
6082
- data
6083
- });
6084
- };
6085
- const searchFormDefaultValues = {
6086
- mobileNumber: "",
6087
- applicationNumber: "",
6088
- consumerNo: ""
6089
- };
6090
- const onSearchFormReset = setSearchFormValue => {
6091
- setSearchFormValue("mobileNumber", null);
6092
- setSearchFormValue("applicationNumber", null);
6093
- setSearchFormValue("consumerNo", null);
6094
- dispatch({
6095
- action: "mutateSearchForm",
6096
- data: searchFormDefaultValues
6097
- });
6098
- };
6099
- const propsForSearchForm = {
6100
- SearchFormFields,
6101
- onSearchFormSubmit,
6102
- searchFormDefaultValues: formState === null || formState === void 0 ? void 0 : formState.searchForm,
6103
- resetSearchFormDefaultValues: searchFormDefaultValues,
6104
- onSearchFormReset,
6105
- className: "search-form-wns-inbox"
6106
- };
6107
- const onPageSizeChange = e => {
6108
- const newLimit = Number(e.target.value);
6109
- dispatch({
6110
- action: "mutateTableForm",
6111
- data: _extends({}, formState.tableForm, {
6112
- limit: newLimit,
6113
- offset: 0
6114
- })
6115
- });
6116
- };
6117
- const onSortingByData = e => {
6118
- if (e.length > 0) {
6119
- const _e$ = e[0],
6120
- id = _e$.id,
6121
- desc = _e$.desc;
6122
- const sortOrder = desc ? "DESC" : "ASC";
6123
- const sortBy = id;
6124
- if (!(formState.tableForm.sortBy === sortBy && formState.tableForm.sortOrder === sortOrder)) {
6125
- dispatch({
6126
- action: "mutateTableForm",
6127
- data: _extends({}, formState.tableForm, {
6128
- sortBy: id,
6129
- sortOrder: desc ? "DESC" : "ASC"
6130
- })
4584
+ type: "error",
4585
+ message: t("Failed to update consumer details")
6131
4586
  });
6132
- }
4587
+ });
4588
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
4589
+ } catch (e) {
4590
+ return Promise.reject(e);
6133
4591
  }
6134
4592
  };
6135
- const propsForInboxTable = SupervisorInboxTableConfig(_extends({}, {
6136
- onPageSizeChange,
6137
- formState,
6138
- totalCount: totalRecords,
6139
- table: filteredData,
6140
- dispatch,
6141
- onSortingByData,
6142
- tenantId,
6143
- inboxStyles: {
6144
- overflowX: "scroll",
6145
- overflowY: "hidden"
4593
+ if (isLoading) {
4594
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
4595
+ }
4596
+ const Config = AadhaarVerificationConfig(t, localFormData, handleUploadProof, setDocumentId, documentId);
4597
+ return /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.FormComposer, {
4598
+ key: isDataLoaded ? "loaded" : "loading",
4599
+ isDisabled: !canSubmit,
4600
+ label: t("ES_COMMON_CONTINUE"),
4601
+ config: Config.map(item => _extends({}, item, {
4602
+ isCollapsible: true,
4603
+ isDefaultOpen: true
4604
+ })),
4605
+ onSubmit: onSubmit,
4606
+ defaultValues: defaultValues,
4607
+ onFormValueChange: onFormValueChange,
4608
+ noCard: false,
4609
+ submitInForm: true
4610
+ }), toast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
4611
+ error: toast.type === "error",
4612
+ label: toast.message,
4613
+ onClose: () => setToast(null)
4614
+ }));
4615
+ };
4616
+
4617
+ const ekycConfig = [{
4618
+ body: [{
4619
+ route: "consumer-details",
4620
+ component: AadhaarVerification,
4621
+ key: "aadhaarVerification",
4622
+ texts: {
4623
+ header: "EKYC_CONSUMER_CONNECTION",
4624
+ submitBarLabel: "COMMON_SAVE_NEXT"
6146
4625
  },
6147
- tableStyle: {
6148
- width: "70%"
4626
+ timeLine: [{
4627
+ currentStep: 1,
4628
+ actions: "EKYC_CONSUMER_CONNECTION"
4629
+ }]
4630
+ }, {
4631
+ route: "address-details",
4632
+ component: "AddressDetails",
4633
+ key: "addressDetails",
4634
+ doorImage: true,
4635
+ showMapActualLocation: false,
4636
+ texts: {
4637
+ header: "EKYC_ADDRESS_DETAILS",
4638
+ submitBarLabel: "COMMON_SAVE_NEXT"
4639
+ },
4640
+ timeLine: [{
4641
+ currentStep: 2,
4642
+ actions: "EKYC_ADDRESS_DETAILS"
4643
+ }]
4644
+ }, {
4645
+ route: "property-info",
4646
+ component: "PropertyInfo",
4647
+ key: "propertyDetails",
4648
+ texts: {
4649
+ header: "EKYC_PROPERTY_INFO",
4650
+ submitBarLabel: "COMMON_SAVE_NEXT"
4651
+ },
4652
+ timeLine: [{
4653
+ currentStep: 3,
4654
+ actions: "EKYC_PROPERTY_INFO"
4655
+ }]
4656
+ }, {
4657
+ route: "meter-details",
4658
+ component: "MeterDetails",
4659
+ key: "meterDetails",
4660
+ texts: {
4661
+ header: "EKYC_METER_DETAILS",
4662
+ submitBarLabel: "COMMON_SAVE_NEXT"
4663
+ },
4664
+ timeLine: [{
4665
+ currentStep: 4,
4666
+ actions: "EKYC_METER_DETAILS"
4667
+ }]
4668
+ }]
4669
+ }];
4670
+
4671
+ const _excluded$3 = ["edits"];
4672
+ const EKYCForm = _ref => {
4673
+ let passedPath = _ref.path;
4674
+ const match = reactRouterDom.useRouteMatch();
4675
+ const _useTranslation = reactI18next.useTranslation(),
4676
+ t = _useTranslation.t;
4677
+ const location = reactRouterDom.useLocation();
4678
+ const pathname = location.pathname;
4679
+ const history = reactRouterDom.useHistory();
4680
+ let config = [];
4681
+ const _Digit$Hooks$useSessi = Digit.Hooks.useSessionStorage("EKYC_CREATE", {}),
4682
+ params = _Digit$Hooks$useSessi[0],
4683
+ setParams = _Digit$Hooks$useSessi[1];
4684
+ React.useEffect(() => {
4685
+ if (location.state && Object.keys(location.state).length > 0) {
4686
+ const _location$state = location.state,
4687
+ edits = _location$state.edits,
4688
+ rest = _objectWithoutPropertiesLoose(_location$state, _excluded$3);
4689
+ setParams(_extends({}, params, rest, edits));
6149
4690
  }
6150
- }));
6151
- const isInboxLoading = isLoading;
6152
- const onMobileSortOrderData = data => {
6153
- const sortOrder = data.sortOrder;
6154
- dispatch({
6155
- action: "mutateTableForm",
6156
- data: _extends({}, formState.tableForm, {
6157
- sortOrder
6158
- })
6159
- });
6160
- };
6161
- const onSortFormReset = setSortFormValue => {
6162
- setSortFormValue("sortOrder", "DESC");
6163
- dispatch({
6164
- action: "mutateTableForm",
6165
- data: tableOrderFormDefaultValues
6166
- });
6167
- };
6168
- const propsForMobileSortForm = {
6169
- onMobileSortOrderData,
6170
- sortFormDefaultValues: formState === null || formState === void 0 ? void 0 : formState.tableForm,
6171
- onSortFormReset
4691
+ }, [location.state]);
4692
+ const goNext = (skipStep, index, isAddMultiple, key) => {
4693
+ let currentPath = pathname.split("/").pop();
4694
+ let routeObj = config.find(routeObj => key ? routeObj.key === key : routeObj.route === currentPath);
4695
+ if (!routeObj) routeObj = config.find(routeObj => routeObj.route === currentPath);
4696
+ let nextStep = null;
4697
+ const currentIndex = config.findIndex(c => c.route === routeObj.route);
4698
+ if (currentIndex > -1 && currentIndex < config.length - 1) {
4699
+ nextStep = config[currentIndex + 1].route;
4700
+ }
4701
+ let redirectWithHistory = history.push;
4702
+ if (skipStep) {
4703
+ redirectWithHistory = history.replace;
4704
+ }
4705
+ const base = passedPath || match.path.split("/").slice(0, -1).join("/");
4706
+ if (nextStep === null) {
4707
+ return redirectWithHistory(base + "/review", _extends({}, params, {
4708
+ edits: params
4709
+ }));
4710
+ }
4711
+ redirectWithHistory(base + "/" + nextStep, _extends({}, params));
6172
4712
  };
6173
- const propsForInboxMobileCards = useInboxMobileCardsData({
6174
- table: filteredData,
6175
- isSupervisor: true
4713
+ function handleSelect(key, data, skipStep, index, isAddMultiple, silent) {
4714
+ if (isAddMultiple === void 0) {
4715
+ isAddMultiple = false;
4716
+ }
4717
+ if (silent === void 0) {
4718
+ silent = false;
4719
+ }
4720
+ setParams(prev => _extends({}, prev, {
4721
+ [key]: _extends({}, params[key], data)
4722
+ }));
4723
+ if (!silent) {
4724
+ goNext(skipStep, index, isAddMultiple, key);
4725
+ }
4726
+ }
4727
+ ekycConfig.forEach(obj => {
4728
+ config = config.concat(obj.body);
6176
4729
  });
6177
- return /*#__PURE__*/React__default.createElement("div", {
6178
- className: "app-container"
6179
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.InboxComposer, _extends({
6180
- isInboxLoading
6181
- }, propsForSearchForm, propsForMobileSortForm, {
6182
- propsForInboxTable,
6183
- propsForInboxMobileCards,
6184
- formState,
6185
- countData: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
6186
- isCardLoading: isDataSearchLoading,
6187
- showSearchOnMobile: true,
6188
- forceTable: true
6189
- })));
4730
+ config.indexRoute = "consumer-details";
4731
+ const formStepRoutes = config.map(c => c.route);
4732
+ const isFormStep = formStepRoutes.some(route => pathname.includes(route));
4733
+ const sectionRefs = React.useRef({});
4734
+ React.useEffect(() => {
4735
+ if (isFormStep) {
4736
+ const currentRoute = pathname.split("/").pop();
4737
+ if (sectionRefs.current[currentRoute]) {
4738
+ sectionRefs.current[currentRoute].scrollIntoView({
4739
+ behavior: "smooth",
4740
+ block: "start"
4741
+ });
4742
+ }
4743
+ }
4744
+ }, [pathname, isFormStep]);
4745
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
4746
+ className: "employee-form-section-wrapper"
4747
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.VerticalTimeline, {
4748
+ config: config,
4749
+ showFinalStep: true
4750
+ }), /*#__PURE__*/React__default.createElement("div", {
4751
+ className: "employee-form-section"
4752
+ }, /*#__PURE__*/React__default.createElement(reactRouterDom.Switch, null, /*#__PURE__*/React__default.createElement(reactRouterDom.Route, {
4753
+ path: formStepRoutes.map(route => (passedPath || match.path.split("/").slice(0, -1).join("/")) + "/" + route)
4754
+ }, /*#__PURE__*/React__default.createElement("div", {
4755
+ className: "single-page-form-container"
4756
+ }, config.map((routeObj, index) => {
4757
+ const component = routeObj.component;
4758
+ const Component = typeof component === "string" ? Digit.ComponentRegistryService.getComponent(component) : component;
4759
+ return /*#__PURE__*/React__default.createElement("div", {
4760
+ key: index,
4761
+ ref: el => sectionRefs.current[routeObj.route] = el,
4762
+ className: "form-section-unit"
4763
+ }, /*#__PURE__*/React__default.createElement(Component, {
4764
+ config: _extends({}, routeObj, {
4765
+ isCollapsible: true,
4766
+ defaultOpen: true
4767
+ }),
4768
+ onSelect: handleSelect,
4769
+ t: t,
4770
+ formData: params
4771
+ }));
4772
+ }))), /*#__PURE__*/React__default.createElement(reactRouterDom.Route, null, /*#__PURE__*/React__default.createElement(reactRouterDom.Redirect, {
4773
+ to: (passedPath || match.path.split("/").slice(0, -1).join("/")) + "/" + config.indexRoute
4774
+ }))))));
6190
4775
  };
6191
4776
 
6192
4777
  const parseAdditionalDetails = additionalDetails => {
@@ -6360,79 +4945,120 @@ const SupervisorDetailsCard = () => {
6360
4945
  vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
6361
4946
  isVendorSearchLoading = _Digit$Hooks$fsm$useD.isLoading;
6362
4947
  const supervisor = React.useMemo(() => {
6363
- if (progressData !== null && progressData !== void 0 && progressData.supervisorReport) {
6364
- let found = null;
6365
- const targetId = supervisorId || (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid);
6366
- if (targetId) {
6367
- found = progressData.supervisorReport.find(s => {
6368
- var _s$supervisorId, _s$id;
6369
- 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());
6370
- });
6371
- }
6372
- if (found) return found;
4948
+ const targetOwnerOrId = supervisorId || (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid);
4949
+ if (!targetOwnerOrId) return null;
4950
+ let resolvedSupervisorId = supervisorId;
4951
+ if (!resolvedSupervisorId && supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors && targetOwnerOrId) {
4952
+ const selfSup = supervisorSearchResponse.supervisors.find(s => {
4953
+ var _s$owner, _s$owner$uuid, _s$id;
4954
+ 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());
4955
+ });
4956
+ resolvedSupervisorId = selfSup === null || selfSup === void 0 ? void 0 : selfSup.id;
4957
+ }
4958
+ const targetId = resolvedSupervisorId || targetOwnerOrId;
4959
+ let matchedSup = null;
4960
+ if (supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors) {
4961
+ matchedSup = supervisorSearchResponse.supervisors.find(s => {
4962
+ var _s$id2, _s$owner2, _s$owner2$uuid;
4963
+ 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());
4964
+ });
4965
+ }
4966
+ let progressReport = null;
4967
+ if (progressData !== null && progressData !== void 0 && progressData.supervisorReport && targetId) {
4968
+ progressReport = progressData.supervisorReport.find(s => {
4969
+ var _s$supervisorId, _s$id3;
4970
+ 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());
4971
+ });
4972
+ }
4973
+ if (matchedSup) {
4974
+ var _progressReport, _progressReport2, _progressReport3, _matchedSup$owner2, _matchedSup$owner3, _matchedSup$owner4;
4975
+ const matchedSurveyors = surveyorSearchResponse !== null && surveyorSearchResponse !== void 0 && surveyorSearchResponse.surveyors ? surveyorSearchResponse.surveyors.filter(surv => {
4976
+ var _matchedSup$owner;
4977
+ return surv.supervisorId === (matchedSup.id || ((_matchedSup$owner = matchedSup.owner) === null || _matchedSup$owner === void 0 ? void 0 : _matchedSup$owner.uuid));
4978
+ }).map(surv => {
4979
+ var _surv$owner3, _surv$owner4, _surv$owner5, _realStats, _realStats2, _realStats3, _realStats4;
4980
+ let realStats = null;
4981
+ if (progressData !== null && progressData !== void 0 && progressData.supervisorReport) {
4982
+ for (const report of progressData.supervisorReport) {
4983
+ var _report$supervisorId, _matchedSup$id, _report$id, _matchedSup$id2, _report$surveyors;
4984
+ 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;
4985
+ const matchedSurv = (_report$surveyors = report.surveyors) === null || _report$surveyors === void 0 ? void 0 : _report$surveyors.find(s => {
4986
+ var _s$surveyorId, _surv$id, _s$surveyorId2, _surv$owner, _surv$owner$uuid, _s$id4, _surv$id2, _s$id5, _surv$owner2, _surv$owner2$uuid;
4987
+ 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()));
4988
+ });
4989
+ if (matchedSurv) {
4990
+ realStats = matchedSurv;
4991
+ break;
4992
+ }
4993
+ }
4994
+ }
4995
+ return {
4996
+ surveyorId: surv.id || ((_surv$owner3 = surv.owner) === null || _surv$owner3 === void 0 ? void 0 : _surv$owner3.uuid),
4997
+ surveyorName: surv.name || ((_surv$owner4 = surv.owner) === null || _surv$owner4 === void 0 ? void 0 : _surv$owner4.name) || "N/A",
4998
+ mobileNo: ((_surv$owner5 = surv.owner) === null || _surv$owner5 === void 0 ? void 0 : _surv$owner5.mobileNumber) || surv.mobileNo || "N/A",
4999
+ status: surv.status || "ACTIVE",
5000
+ totalKnos: ((_realStats = realStats) === null || _realStats === void 0 ? void 0 : _realStats.totalKnos) || 0,
5001
+ submittedKnos: ((_realStats2 = realStats) === null || _realStats2 === void 0 ? void 0 : _realStats2.submittedKnos) || 0,
5002
+ pendingKnos: ((_realStats3 = realStats) === null || _realStats3 === void 0 ? void 0 : _realStats3.pendingKnos) || 0,
5003
+ progressPercent: ((_realStats4 = realStats) === null || _realStats4 === void 0 ? void 0 : _realStats4.progressPercent) || 0
5004
+ };
5005
+ }) : [];
5006
+ const totalKnos = ((_progressReport = progressReport) === null || _progressReport === void 0 ? void 0 : _progressReport.totalKnos) || matchedSurveyors.reduce((acc, s) => acc + (s.totalKnos || 0), 0);
5007
+ const submittedKnos = ((_progressReport2 = progressReport) === null || _progressReport2 === void 0 ? void 0 : _progressReport2.submittedKnos) || matchedSurveyors.reduce((acc, s) => acc + (s.submittedKnos || 0), 0);
5008
+ const pendingKnos = ((_progressReport3 = progressReport) === null || _progressReport3 === void 0 ? void 0 : _progressReport3.pendingKnos) || matchedSurveyors.reduce((acc, s) => acc + (s.pendingKnos || 0), 0);
5009
+ const progressPercent = progressReport ? progressReport.progressPercent : totalKnos > 0 ? Math.round(submittedKnos / totalKnos * 100) : 0;
5010
+ return {
5011
+ supervisorId: matchedSup.id || ((_matchedSup$owner2 = matchedSup.owner) === null || _matchedSup$owner2 === void 0 ? void 0 : _matchedSup$owner2.uuid),
5012
+ supervisorName: matchedSup.name || ((_matchedSup$owner3 = matchedSup.owner) === null || _matchedSup$owner3 === void 0 ? void 0 : _matchedSup$owner3.name) || "N/A",
5013
+ mobileNo: ((_matchedSup$owner4 = matchedSup.owner) === null || _matchedSup$owner4 === void 0 ? void 0 : _matchedSup$owner4.mobileNumber) || matchedSup.mobileNo || "N/A",
5014
+ status: matchedSup.status || "ACTIVE",
5015
+ assignedZoneId: matchedSup.assignedZoneId || "N/A",
5016
+ vendorId: matchedSup.vendorId,
5017
+ surveyors: matchedSurveyors,
5018
+ totalKnos,
5019
+ submittedKnos,
5020
+ pendingKnos,
5021
+ progressPercent
5022
+ };
6373
5023
  }
6374
- if (supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors) {
6375
- let matchedSup = null;
6376
- const targetId = supervisorId || (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid);
6377
- if (targetId) {
6378
- matchedSup = supervisorSearchResponse.supervisors.find(s => {
6379
- var _s$id2, _s$owner, _s$owner$uuid;
6380
- 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());
5024
+ if (progressReport) {
5025
+ var _loggedInUser$uuid;
5026
+ 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());
5027
+ const supervisorName = isSelf ? (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.name) || progressReport.supervisorName || "N/A" : progressReport.supervisorName || "N/A";
5028
+ const mobileNo = isSelf ? (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.mobileNumber) || progressReport.mobileNo || "N/A" : progressReport.mobileNo || "N/A";
5029
+ const surveyorsMapped = progressReport.surveyors ? progressReport.surveyors.map(surv => {
5030
+ var _surveyorSearchRespon, _matchedSurv$owner, _matchedSurv$owner2;
5031
+ const matchedSurv = surveyorSearchResponse === null || surveyorSearchResponse === void 0 ? void 0 : (_surveyorSearchRespon = surveyorSearchResponse.surveyors) === null || _surveyorSearchRespon === void 0 ? void 0 : _surveyorSearchRespon.find(s => {
5032
+ var _s$id6, _surv$surveyorId, _s$owner3, _s$owner3$uuid, _surv$surveyorId2;
5033
+ 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());
6381
5034
  });
6382
- }
6383
- if (matchedSup) {
6384
- var _matchedSup$owner2, _matchedSup$owner3, _matchedSup$owner4;
6385
- const matchedSurveyors = surveyorSearchResponse !== null && surveyorSearchResponse !== void 0 && surveyorSearchResponse.surveyors ? surveyorSearchResponse.surveyors.filter(surv => {
6386
- var _matchedSup$owner;
6387
- return surv.supervisorId === (matchedSup.id || ((_matchedSup$owner = matchedSup.owner) === null || _matchedSup$owner === void 0 ? void 0 : _matchedSup$owner.uuid));
6388
- }).map(surv => {
6389
- var _surv$owner3, _surv$owner4, _surv$owner5, _realStats, _realStats2, _realStats3, _realStats4;
6390
- let realStats = null;
6391
- if (progressData !== null && progressData !== void 0 && progressData.supervisorReport) {
6392
- for (const report of progressData.supervisorReport) {
6393
- var _report$surveyors;
6394
- const matchedSurv = (_report$surveyors = report.surveyors) === null || _report$surveyors === void 0 ? void 0 : _report$surveyors.find(s => {
6395
- var _surv$owner, _surv$owner2;
6396
- 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));
6397
- });
6398
- if (matchedSurv) {
6399
- realStats = matchedSurv;
6400
- break;
6401
- }
6402
- }
6403
- }
6404
- return {
6405
- surveyorId: surv.id || ((_surv$owner3 = surv.owner) === null || _surv$owner3 === void 0 ? void 0 : _surv$owner3.uuid),
6406
- surveyorName: surv.name || ((_surv$owner4 = surv.owner) === null || _surv$owner4 === void 0 ? void 0 : _surv$owner4.name) || "N/A",
6407
- mobileNo: ((_surv$owner5 = surv.owner) === null || _surv$owner5 === void 0 ? void 0 : _surv$owner5.mobileNumber) || surv.mobileNo || "N/A",
6408
- status: surv.status || "ACTIVE",
6409
- totalKnos: ((_realStats = realStats) === null || _realStats === void 0 ? void 0 : _realStats.totalKnos) || 0,
6410
- submittedKnos: ((_realStats2 = realStats) === null || _realStats2 === void 0 ? void 0 : _realStats2.submittedKnos) || 0,
6411
- pendingKnos: ((_realStats3 = realStats) === null || _realStats3 === void 0 ? void 0 : _realStats3.pendingKnos) || 0,
6412
- progressPercent: ((_realStats4 = realStats) === null || _realStats4 === void 0 ? void 0 : _realStats4.progressPercent) || 0
6413
- };
6414
- }) : [];
6415
- const totalKnos = matchedSurveyors.reduce((acc, s) => acc + (s.totalKnos || 0), 0);
6416
- const submittedKnos = matchedSurveyors.reduce((acc, s) => acc + (s.submittedKnos || 0), 0);
6417
- const pendingKnos = matchedSurveyors.reduce((acc, s) => acc + (s.pendingKnos || 0), 0);
6418
- const progressPercent = totalKnos > 0 ? Math.round(submittedKnos / totalKnos * 100) : 0;
6419
5035
  return {
6420
- supervisorId: matchedSup.id || ((_matchedSup$owner2 = matchedSup.owner) === null || _matchedSup$owner2 === void 0 ? void 0 : _matchedSup$owner2.uuid),
6421
- supervisorName: matchedSup.name || ((_matchedSup$owner3 = matchedSup.owner) === null || _matchedSup$owner3 === void 0 ? void 0 : _matchedSup$owner3.name) || "N/A",
6422
- mobileNo: ((_matchedSup$owner4 = matchedSup.owner) === null || _matchedSup$owner4 === void 0 ? void 0 : _matchedSup$owner4.mobileNumber) || matchedSup.mobileNo || "N/A",
6423
- status: matchedSup.status || "ACTIVE",
6424
- assignedZoneId: matchedSup.assignedZoneId || "N/A",
6425
- vendorId: matchedSup.vendorId,
6426
- surveyors: matchedSurveyors,
6427
- totalKnos,
6428
- submittedKnos,
6429
- pendingKnos,
6430
- progressPercent
5036
+ surveyorId: surv.surveyorId || surv.id,
5037
+ 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",
5038
+ 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",
5039
+ status: (matchedSurv === null || matchedSurv === void 0 ? void 0 : matchedSurv.status) || surv.status || "ACTIVE",
5040
+ totalKnos: surv.totalKnos || 0,
5041
+ submittedKnos: surv.submittedKnos || 0,
5042
+ pendingKnos: surv.pendingKnos || 0,
5043
+ progressPercent: surv.progressPercent || 0
6431
5044
  };
6432
- }
5045
+ }) : [];
5046
+ return {
5047
+ supervisorId: progressReport.supervisorId || progressReport.id,
5048
+ supervisorName,
5049
+ mobileNo,
5050
+ status: progressReport.status || "ACTIVE",
5051
+ assignedZoneId: progressReport.assignedZoneId || "N/A",
5052
+ vendorId: progressReport.vendorId,
5053
+ surveyors: surveyorsMapped,
5054
+ totalKnos: progressReport.totalKnos || 0,
5055
+ submittedKnos: progressReport.submittedKnos || 0,
5056
+ pendingKnos: progressReport.pendingKnos || 0,
5057
+ progressPercent: progressReport.progressPercent || 0
5058
+ };
6433
5059
  }
6434
5060
  return null;
6435
- }, [progressData, supervisorSearchResponse, surveyorSearchResponse, supervisorId, loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid]);
5061
+ }, [progressData, supervisorSearchResponse, surveyorSearchResponse, supervisorId, loggedInUser]);
6436
5062
  const fullName = (supervisor === null || supervisor === void 0 ? void 0 : supervisor.supervisorName) || "N/A";
6437
5063
  const mobileNumber = (supervisor === null || supervisor === void 0 ? void 0 : supervisor.mobileNo) || "N/A";
6438
5064
  const email = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.emailId) || "N/A";
@@ -8004,174 +6630,576 @@ const SurveyorDetailsDashboard = () => {
8004
6630
  if (currentPage > 0) {
8005
6631
  setCurrentPage(prev => prev - 1);
8006
6632
  }
8007
- },
8008
- onFirstPage: () => {
8009
- setCurrentPage(0);
8010
- },
8011
- onLastPage: () => {
8012
- var _dashboardData$dashbo8;
8013
- 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));
8014
- },
8015
- onPageSizeChange: e => {
8016
- setPageSize(Number(e.target.value));
8017
- setCurrentPage(0);
6633
+ },
6634
+ onFirstPage: () => {
6635
+ setCurrentPage(0);
6636
+ },
6637
+ onLastPage: () => {
6638
+ var _dashboardData$dashbo8;
6639
+ 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));
6640
+ },
6641
+ onPageSizeChange: e => {
6642
+ setPageSize(Number(e.target.value));
6643
+ setCurrentPage(0);
6644
+ }
6645
+ })), roles.includes("EKYC_SUPERVISOR") && /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
6646
+ label: t("EKYC_ASSIGN_KNOS"),
6647
+ onSubmit: () => setShowOptions(prev => !prev)
6648
+ }), showOptions && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Menu, {
6649
+ options: options,
6650
+ optionKey: "action",
6651
+ t: t,
6652
+ onSelect: handleMenuSelect,
6653
+ style: {
6654
+ color: "#FFFFFF",
6655
+ fontSize: "18px"
6656
+ }
6657
+ })), showModal && /*#__PURE__*/React__default.createElement(AssignEkycModal, {
6658
+ surveyor: surveyor,
6659
+ closeModal: closeModal,
6660
+ refetchDashboard: refetchDashboard
6661
+ }));
6662
+ };
6663
+
6664
+ const WorkOrder = () => {
6665
+ const tenantId = Digit.ULBService.getCurrentTenantId();
6666
+ const _useTranslation = reactI18next.useTranslation(),
6667
+ t = _useTranslation.t;
6668
+ const history = reactRouterDom.useHistory();
6669
+ const _useState = React.useState(null),
6670
+ showToast = _useState[0],
6671
+ setShowToast = _useState[1];
6672
+ const _useState2 = React.useState(null),
6673
+ vendor = _useState2[0],
6674
+ setVendor = _useState2[1];
6675
+ const _useState3 = React.useState(""),
6676
+ validFrom = _useState3[0],
6677
+ setValidFrom = _useState3[1];
6678
+ const _useState4 = React.useState(""),
6679
+ validTo = _useState4[0],
6680
+ setValidTo = _useState4[1];
6681
+ const _useState5 = React.useState(null),
6682
+ uploadedFile = _useState5[0],
6683
+ setUploadedFile = _useState5[1];
6684
+ const _useState6 = React.useState(null),
6685
+ file = _useState6[0],
6686
+ setFile = _useState6[1];
6687
+ const _useState7 = React.useState(null),
6688
+ error = _useState7[0],
6689
+ setError = _useState7[1];
6690
+ const _Digit$Hooks$fsm$useV = Digit.Hooks.fsm.useVendorSearch({
6691
+ tenantId,
6692
+ filters: {
6693
+ status: "ACTIVE"
6694
+ },
6695
+ config: {
6696
+ select: data => (data === null || data === void 0 ? void 0 : data.vendor) || []
6697
+ }
6698
+ }),
6699
+ vendorOptions = _Digit$Hooks$fsm$useV.data;
6700
+ const _Digit$Hooks$wt$useVe = Digit.Hooks.wt.useVendorWorkOrderCreate(tenantId),
6701
+ createWorkOrder = _Digit$Hooks$wt$useVe.mutate;
6702
+ React.useEffect(() => {
6703
+ (function () {
6704
+ try {
6705
+ setError(null);
6706
+ const _temp3 = function () {
6707
+ if (file) {
6708
+ const _temp2 = function () {
6709
+ if (file.size >= 10000000) {
6710
+ setError(t("EKYC_MAXIMUM_UPLOAD_SIZE_EXCEEDED") || "File size exceeds 10MB");
6711
+ } else {
6712
+ const _temp = _catch(function () {
6713
+ return Promise.resolve(Digit.UploadServices.Filestorage("EKYC", file, Digit.ULBService.getStateId())).then(function (response) {
6714
+ var _response$data, _response$data$files;
6715
+ if ((response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$files = _response$data.files) === null || _response$data$files === void 0 ? void 0 : _response$data$files.length) > 0) {
6716
+ var _response$data2, _response$data2$files;
6717
+ setUploadedFile(response === null || response === void 0 ? void 0 : (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : (_response$data2$files = _response$data2.files[0]) === null || _response$data2$files === void 0 ? void 0 : _response$data2$files.fileStoreId);
6718
+ } else {
6719
+ setError(t("EKYC_FILE_UPLOAD_ERROR"));
6720
+ }
6721
+ });
6722
+ }, function () {
6723
+ setError(t("EKYC_FILE_UPLOAD_ERROR"));
6724
+ });
6725
+ if (_temp && _temp.then) return _temp.then(function () {});
6726
+ }
6727
+ }();
6728
+ if (_temp2 && _temp2.then) return _temp2.then(function () {});
6729
+ }
6730
+ }();
6731
+ return _temp3 && _temp3.then ? _temp3.then(function () {}) : void 0;
6732
+ } catch (e) {
6733
+ Promise.reject(e);
6734
+ }
6735
+ })();
6736
+ }, [file]);
6737
+ const handleSubmit = () => {
6738
+ var _vendor$owner, _vendor$owner2;
6739
+ const payload = {
6740
+ vendorWorkOrder: {
6741
+ tenantId,
6742
+ name: vendor === null || vendor === void 0 ? void 0 : vendor.name,
6743
+ mobileNumber: vendor === null || vendor === void 0 ? void 0 : (_vendor$owner = vendor.owner) === null || _vendor$owner === void 0 ? void 0 : _vendor$owner.mobileNumber,
6744
+ emailId: vendor === null || vendor === void 0 ? void 0 : (_vendor$owner2 = vendor.owner) === null || _vendor$owner2 === void 0 ? void 0 : _vendor$owner2.emailId,
6745
+ vendorId: (vendor === null || vendor === void 0 ? void 0 : vendor.code) || (vendor === null || vendor === void 0 ? void 0 : vendor.id),
6746
+ validFrom: new Date(validFrom).getTime(),
6747
+ validTo: new Date(validTo).getTime(),
6748
+ serviceType: "EKYC",
6749
+ fileStoreId: uploadedFile
6750
+ }
6751
+ };
6752
+ createWorkOrder(payload, {
6753
+ onSuccess: result => {
6754
+ setShowToast({
6755
+ isError: false,
6756
+ label: t("EKYC_WORK_ORDER_SAVE_SUCCESS")
6757
+ });
6758
+ setTimeout(() => {
6759
+ history.push("/digit-ui/employee/module/details");
6760
+ }, 3000);
6761
+ },
6762
+ onError: err => {
6763
+ var _err$response, _err$response$data, _err$response$data$Er, _err$response$data$Er2;
6764
+ setShowToast({
6765
+ isError: true,
6766
+ label: (err === null || err === void 0 ? void 0 : (_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : (_err$response$data$Er = _err$response$data.Errors) === null || _err$response$data$Er === void 0 ? void 0 : (_err$response$data$Er2 = _err$response$data$Er[0]) === null || _err$response$data$Er2 === void 0 ? void 0 : _err$response$data$Er2.message) || t("EKYC_WORK_ORDER_SAVE_ERROR")
6767
+ });
6768
+ }
6769
+ });
6770
+ };
6771
+ function selectfile(e) {
6772
+ setUploadedFile(null);
6773
+ setFile(e.target.files[0]);
6774
+ }
6775
+ const isFormDisabled = !vendor || !validFrom || !validTo || !uploadedFile;
6776
+ const isMobile = window.Digit.Utils.browser.isMobile();
6777
+ return /*#__PURE__*/React__default.createElement("div", {
6778
+ className: "employee-form-section-wrapper"
6779
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.VerticalTimeline, {
6780
+ config: [{
6781
+ timeLine: [{
6782
+ actions: t("EKYC_WORK_ORDER_ASSIGN"),
6783
+ currentStep: 1
6784
+ }]
6785
+ }],
6786
+ showFinalStep: false
6787
+ }), /*#__PURE__*/React__default.createElement("div", {
6788
+ style: {
6789
+ flex: 1
6790
+ }
6791
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CollapsibleCardPage, {
6792
+ title: t("EKYC_UPLOAD_WORK_ORDER"),
6793
+ defaultOpen: true
6794
+ }, /*#__PURE__*/React__default.createElement("div", {
6795
+ className: "formcomposer-section-grid"
6796
+ }, /*#__PURE__*/React__default.createElement("div", {
6797
+ style: {
6798
+ display: "flex",
6799
+ flexDirection: "column"
6800
+ }
6801
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Label, null, "" + t("EKYC_VENDOR_NAME"), " ", /*#__PURE__*/React__default.createElement("span", {
6802
+ className: "check-page-link-button"
6803
+ }, "*")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
6804
+ t: t,
6805
+ option: vendorOptions,
6806
+ optionKey: "name",
6807
+ select: setVendor,
6808
+ selected: vendor,
6809
+ placeholder: t("EKYC_SELECT_VENDOR")
6810
+ })), /*#__PURE__*/React__default.createElement("div", {
6811
+ style: {
6812
+ display: "flex",
6813
+ flexDirection: "column"
6814
+ }
6815
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Label, null, "" + t("COMMON_VALID_FROM_DATE"), " ", /*#__PURE__*/React__default.createElement("span", {
6816
+ className: "check-page-link-button"
6817
+ }, "*")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.DatePicker, {
6818
+ date: validFrom,
6819
+ onChange: date => setValidFrom(date),
6820
+ style: {
6821
+ width: "100%"
6822
+ }
6823
+ })), /*#__PURE__*/React__default.createElement("div", {
6824
+ style: {
6825
+ display: "flex",
6826
+ flexDirection: "column"
6827
+ }
6828
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Label, null, "" + t("COMMON_VALID_TO_DATE"), " ", /*#__PURE__*/React__default.createElement("span", {
6829
+ className: "check-page-link-button"
6830
+ }, "*")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.DatePicker, {
6831
+ date: validTo,
6832
+ min: validFrom,
6833
+ onChange: date => setValidTo(date),
6834
+ style: {
6835
+ width: "100%"
6836
+ }
6837
+ })), /*#__PURE__*/React__default.createElement("div", {
6838
+ style: {
6839
+ display: "flex",
6840
+ flexDirection: "column"
6841
+ }
6842
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Label, null, "" + t("EKYC_UPLOAD_DOCUMENT"), " ", /*#__PURE__*/React__default.createElement("span", {
6843
+ className: "check-page-link-button"
6844
+ }, "*")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.UploadFile, {
6845
+ id: "ekyc-doc",
6846
+ extraStyleName: "propertyCreate",
6847
+ accept: "image/*, .pdf, .png, .jpeg, .jpg",
6848
+ onUpload: selectfile,
6849
+ onDelete: () => setUploadedFile(null),
6850
+ message: uploadedFile ? "1 " + t("EKYC_ACTION_FILEUPLOADED") : t("EKYC_ACTION_NO_FILEUPLOADED"),
6851
+ error: error
6852
+ })))), /*#__PURE__*/React__default.createElement("div", {
6853
+ style: {
6854
+ display: "flex",
6855
+ marginTop: "24px",
6856
+ justifyContent: isMobile ? "center" : "flex-end"
6857
+ }
6858
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
6859
+ label: t("ES_COMMON_SAVE"),
6860
+ onSubmit: isFormDisabled ? null : handleSubmit,
6861
+ disabled: isFormDisabled
6862
+ }))), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
6863
+ error: showToast.isError,
6864
+ label: showToast.label,
6865
+ onClose: () => setShowToast(null)
6866
+ }));
6867
+ };
6868
+
6869
+ function formReducer(state, payload) {
6870
+ const storageKey = "EKYC.SW.INBOX";
6871
+ switch (payload.action) {
6872
+ case "mutateSearchForm":
6873
+ Digit.SessionStorage.set(storageKey, _extends({}, state, {
6874
+ searchForm: payload.data
6875
+ }));
6876
+ return _extends({}, state, {
6877
+ searchForm: payload.data
6878
+ });
6879
+ case "mutateFilterForm":
6880
+ Digit.SessionStorage.set(storageKey, _extends({}, state, {
6881
+ filterForm: payload.data
6882
+ }));
6883
+ return _extends({}, state, {
6884
+ filterForm: payload.data
6885
+ });
6886
+ case "mutateTableForm":
6887
+ Digit.SessionStorage.set(storageKey, _extends({}, state, {
6888
+ tableForm: payload.data
6889
+ }));
6890
+ return _extends({}, state, {
6891
+ tableForm: payload.data
6892
+ });
6893
+ default:
6894
+ return state;
6895
+ }
6896
+ }
6897
+ const formInitValue = {
6898
+ filterForm: {},
6899
+ searchForm: {},
6900
+ tableForm: {
6901
+ limit: 10,
6902
+ offset: 0,
6903
+ sortBy: "createdTime",
6904
+ sortOrder: "DESC"
6905
+ }
6906
+ };
6907
+ const tableColumnConfig = (t, handleReview) => [{
6908
+ Header: t("SURVEYOR_NAME"),
6909
+ accessor: "surveyorName",
6910
+ Cell: _ref => {
6911
+ var _row$original, _row$original2, _row$original3;
6912
+ let row = _ref.row;
6913
+ const id = (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.id;
6914
+ return /*#__PURE__*/React__default.createElement("span", {
6915
+ className: "link",
6916
+ onClick: () => handleReview(id)
6917
+ }, ((_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");
6918
+ }
6919
+ }, {
6920
+ Header: t("MOBILE_NUMBER"),
6921
+ accessor: "mobileNo",
6922
+ Cell: _ref2 => {
6923
+ var _row$original4, _row$original5, _row$original5$owner;
6924
+ let row = _ref2.row;
6925
+ 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");
6926
+ }
6927
+ }, {
6928
+ Header: t("STATUS"),
6929
+ accessor: "status",
6930
+ Cell: _ref3 => {
6931
+ var _row$original6;
6932
+ let row = _ref3.row;
6933
+ const status = ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.status) || "DEFAULT";
6934
+ return /*#__PURE__*/React__default.createElement("span", {
6935
+ className: "ekyc-status-tag " + status
6936
+ }, t(status));
6937
+ }
6938
+ }, {
6939
+ Header: t("SERVICE_TYPE"),
6940
+ accessor: "serviceType",
6941
+ Cell: _ref4 => {
6942
+ var _row$original7;
6943
+ let row = _ref4.row;
6944
+ return /*#__PURE__*/React__default.createElement("span", null, ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.serviceType) || "NA");
6945
+ }
6946
+ }];
6947
+
6948
+ const SupervisorInboxTableConfig = _ref => {
6949
+ var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _formState$tableForm, _formState$tableForm2;
6950
+ let onPageSizeChange = _ref.onPageSizeChange,
6951
+ formState = _ref.formState,
6952
+ totalCount = _ref.totalCount,
6953
+ table = _ref.table,
6954
+ dispatch = _ref.dispatch,
6955
+ onSortingByData = _ref.onSortingByData,
6956
+ _ref$inboxStyles = _ref.inboxStyles,
6957
+ inboxStyles = _ref$inboxStyles === void 0 ? {} : _ref$inboxStyles,
6958
+ _ref$tableStyle = _ref.tableStyle,
6959
+ tableStyle = _ref$tableStyle === void 0 ? {} : _ref$tableStyle;
6960
+ const _useTranslation = reactI18next.useTranslation(),
6961
+ t = _useTranslation.t;
6962
+ const history = reactRouterDom.useHistory();
6963
+ 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";
6964
+ const handleReview = id => {
6965
+ history.push("/digit-ui/" + userType + "/ekyc/assign/surveyor-details/" + id);
6966
+ };
6967
+ const limit = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10;
6968
+ const offset = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0;
6969
+ return {
6970
+ disableSort: false,
6971
+ autoSort: false,
6972
+ manualPagination: true,
6973
+ currentPage: Math.floor(offset / limit),
6974
+ onPageSizeChange,
6975
+ onNextPage: () => dispatch({
6976
+ action: "mutateTableForm",
6977
+ data: _extends({}, formState.tableForm, {
6978
+ offset: Number(offset) + Number(limit)
6979
+ })
6980
+ }),
6981
+ onPrevPage: () => dispatch({
6982
+ action: "mutateTableForm",
6983
+ data: _extends({}, formState.tableForm, {
6984
+ offset: Number(offset) - Number(limit)
6985
+ })
6986
+ }),
6987
+ onLastPage: () => dispatch({
6988
+ action: "mutateTableForm",
6989
+ data: _extends({}, formState.tableForm, {
6990
+ offset: Math.ceil(totalCount / limit) * limit - Number(limit)
6991
+ })
6992
+ }),
6993
+ onFirstPage: () => dispatch({
6994
+ action: "mutateTableForm",
6995
+ data: _extends({}, formState.tableForm, {
6996
+ offset: 0
6997
+ })
6998
+ }),
6999
+ totalRecords: totalCount,
7000
+ onSort: onSortingByData,
7001
+ data: table,
7002
+ columns: tableColumnConfig(t, handleReview),
7003
+ inboxStyles: _extends({}, inboxStyles),
7004
+ tableStyle: _extends({}, tableStyle)
7005
+ };
7006
+ };
7007
+
7008
+ const AssignEkyc = () => {
7009
+ var _formState$tableForm, _formState$tableForm2, _formState$tableForm3, _formState$tableForm4, _formState$searchForm, _dashboardData$dashbo;
7010
+ let tenantId = Digit.ULBService.getCurrentTenantId();
7011
+ if (!tenantId || tenantId === "dl") {
7012
+ tenantId = "dl.djb";
7013
+ }
7014
+ const _useReducer = React.useReducer(formReducer, formInitValue),
7015
+ formState = _useReducer[0],
7016
+ dispatch = _useReducer[1];
7017
+ let paginationParms = {
7018
+ limit: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10,
7019
+ offset: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0,
7020
+ sortBy: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm3 = formState.tableForm) === null || _formState$tableForm3 === void 0 ? void 0 : _formState$tableForm3.sortBy) || "createdTime",
7021
+ sortOrder: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm4 = formState.tableForm) === null || _formState$tableForm4 === void 0 ? void 0 : _formState$tableForm4.sortOrder) || "DESC"
7022
+ };
7023
+ const mobileNumber = (formState === null || formState === void 0 ? void 0 : (_formState$searchForm = formState.searchForm) === null || _formState$searchForm === void 0 ? void 0 : _formState$searchForm.mobileNumber) || "";
7024
+ const isSearchActive = !!mobileNumber;
7025
+ const filters = _extends({}, paginationParms, {
7026
+ status: "ACTIVE,DISABLED"
7027
+ });
7028
+ if (isSearchActive) {
7029
+ filters.mobileNumber = mobileNumber;
7030
+ }
7031
+ const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSurveyorSearch(tenantId, filters, {
7032
+ enabled: !!tenantId,
7033
+ keepPreviousData: true
7034
+ }),
7035
+ dashboardData = _Digit$Hooks$fsm$useS.data,
7036
+ isLoading = _Digit$Hooks$fsm$useS.isLoading;
7037
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycAssignmentProgress({
7038
+ enabled: !!tenantId,
7039
+ keepPreviousData: true
7040
+ }),
7041
+ isDataSearchLoading = _Digit$Hooks$ekyc$use.isLoading;
7042
+ const sourceData = React.useMemo(() => {
7043
+ return (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.surveyors) || [];
7044
+ }, [dashboardData]);
7045
+ const filteredData = React.useMemo(() => {
7046
+ return (sourceData || []).map(item => {
7047
+ var _owner$roles, _owner$roles$map, _item$additionalDetai, _item$auditDetails, _item$auditDetails2;
7048
+ const owner = (item === null || item === void 0 ? void 0 : item.owner) || {};
7049
+ 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(", ")) || "";
7050
+ return _extends({}, item, {
7051
+ id: (item === null || item === void 0 ? void 0 : item.id) || "",
7052
+ surveyorName: (item === null || item === void 0 ? void 0 : item.name) || (owner === null || owner === void 0 ? void 0 : owner.name) || "",
7053
+ mobileNo: (item === null || item === void 0 ? void 0 : item.mobileNo) || (owner === null || owner === void 0 ? void 0 : owner.mobileNumber) || "",
7054
+ email: (owner === null || owner === void 0 ? void 0 : owner.emailId) || "",
7055
+ vendorId: (item === null || item === void 0 ? void 0 : item.vendorId) || "",
7056
+ tenantId: (item === null || item === void 0 ? void 0 : item.tenantId) || "",
7057
+ supervisorId: (item === null || item === void 0 ? void 0 : item.supervisorId) || "",
7058
+ status: (item === null || item === void 0 ? void 0 : item.status) || "",
7059
+ roleCodes,
7060
+ userName: (owner === null || owner === void 0 ? void 0 : owner.userName) || "",
7061
+ gender: (owner === null || owner === void 0 ? void 0 : owner.gender) || "",
7062
+ serviceType: (item === null || item === void 0 ? void 0 : (_item$additionalDetai = item.additionalDetails) === null || _item$additionalDetai === void 0 ? void 0 : _item$additionalDetai.serviceType) || "",
7063
+ createdTime: (item === null || item === void 0 ? void 0 : (_item$auditDetails = item.auditDetails) === null || _item$auditDetails === void 0 ? void 0 : _item$auditDetails.createdTime) || 0,
7064
+ lastModifiedTime: (item === null || item === void 0 ? void 0 : (_item$auditDetails2 = item.auditDetails) === null || _item$auditDetails2 === void 0 ? void 0 : _item$auditDetails2.lastModifiedTime) || 0
7065
+ });
7066
+ });
7067
+ }, [sourceData]);
7068
+ 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;
7069
+ const SearchFormFields = React.useCallback(_ref => {
7070
+ let registerRef = _ref.registerRef,
7071
+ searchFormState = _ref.searchFormState,
7072
+ controlSearchForm = _ref.controlSearchForm;
7073
+ return /*#__PURE__*/React__default.createElement(SearchFormFieldsComponents, {
7074
+ registerRef,
7075
+ searchFormState,
7076
+ controlSearchForm,
7077
+ searchType: "mobile",
7078
+ className: "search"
7079
+ });
7080
+ }, []);
7081
+ const tableOrderFormDefaultValues = {
7082
+ sortBy: "createdTime",
7083
+ limit: window.Digit.Utils.browser.isMobile() ? 50 : 10,
7084
+ offset: 0,
7085
+ sortOrder: "DESC"
7086
+ };
7087
+ const onSearchFormSubmit = data => {
7088
+ data.hasOwnProperty("") && (data === null || data === void 0 ? true : delete data[""]);
7089
+ dispatch({
7090
+ action: "mutateTableForm",
7091
+ data: _extends({}, tableOrderFormDefaultValues)
7092
+ });
7093
+ dispatch({
7094
+ action: "mutateSearchForm",
7095
+ data
7096
+ });
7097
+ };
7098
+ const searchFormDefaultValues = {
7099
+ mobileNumber: "",
7100
+ applicationNumber: "",
7101
+ consumerNo: ""
7102
+ };
7103
+ const onSearchFormReset = setSearchFormValue => {
7104
+ setSearchFormValue("mobileNumber", null);
7105
+ setSearchFormValue("applicationNumber", null);
7106
+ setSearchFormValue("consumerNo", null);
7107
+ dispatch({
7108
+ action: "mutateSearchForm",
7109
+ data: searchFormDefaultValues
7110
+ });
7111
+ };
7112
+ const propsForSearchForm = {
7113
+ SearchFormFields,
7114
+ onSearchFormSubmit,
7115
+ searchFormDefaultValues: formState === null || formState === void 0 ? void 0 : formState.searchForm,
7116
+ resetSearchFormDefaultValues: searchFormDefaultValues,
7117
+ onSearchFormReset,
7118
+ className: "search-form-wns-inbox"
7119
+ };
7120
+ const onPageSizeChange = e => {
7121
+ const newLimit = Number(e.target.value);
7122
+ dispatch({
7123
+ action: "mutateTableForm",
7124
+ data: _extends({}, formState.tableForm, {
7125
+ limit: newLimit,
7126
+ offset: 0
7127
+ })
7128
+ });
7129
+ };
7130
+ const onSortingByData = e => {
7131
+ if (e.length > 0) {
7132
+ const _e$ = e[0],
7133
+ id = _e$.id,
7134
+ desc = _e$.desc;
7135
+ const sortOrder = desc ? "DESC" : "ASC";
7136
+ const sortBy = id;
7137
+ if (!(formState.tableForm.sortBy === sortBy && formState.tableForm.sortOrder === sortOrder)) {
7138
+ dispatch({
7139
+ action: "mutateTableForm",
7140
+ data: _extends({}, formState.tableForm, {
7141
+ sortBy: id,
7142
+ sortOrder: desc ? "DESC" : "ASC"
7143
+ })
7144
+ });
7145
+ }
8018
7146
  }
8019
- })), roles.includes("EKYC_SUPERVISOR") && /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
8020
- label: t("EKYC_ASSIGN_KNOS"),
8021
- onSubmit: () => setShowOptions(prev => !prev)
8022
- }), showOptions && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Menu, {
8023
- options: options,
8024
- optionKey: "action",
8025
- t: t,
8026
- onSelect: handleMenuSelect,
8027
- style: {
8028
- color: "#FFFFFF",
8029
- fontSize: "18px"
7147
+ };
7148
+ const propsForInboxTable = SupervisorInboxTableConfig(_extends({}, {
7149
+ onPageSizeChange,
7150
+ formState,
7151
+ totalCount: totalRecords,
7152
+ table: filteredData,
7153
+ dispatch,
7154
+ onSortingByData,
7155
+ tenantId,
7156
+ inboxStyles: {
7157
+ overflowX: "scroll",
7158
+ overflowY: "hidden"
7159
+ },
7160
+ tableStyle: {
7161
+ width: "70%"
8030
7162
  }
8031
- })), showModal && /*#__PURE__*/React__default.createElement(AssignEkycModal, {
8032
- surveyor: surveyor,
8033
- closeModal: closeModal,
8034
- refetchDashboard: refetchDashboard
8035
7163
  }));
8036
- };
8037
-
8038
- const vendors = [{
8039
- id: 1,
8040
- name: "Vendor Alpha",
8041
- progress: 78,
8042
- supervisors: 12,
8043
- surveyors: 148,
8044
- completed: 154200,
8045
- pending: 43200,
8046
- rejected: 3200
8047
- }, {
8048
- id: 2,
8049
- name: "Vendor Beta",
8050
- progress: 64,
8051
- supervisors: 10,
8052
- surveyors: 122,
8053
- completed: 121000,
8054
- pending: 68500,
8055
- rejected: 2800
8056
- }, {
8057
- id: 3,
8058
- name: "Vendor Gamma",
8059
- progress: 91,
8060
- supervisors: 15,
8061
- surveyors: 182,
8062
- completed: 201500,
8063
- pending: 19800,
8064
- rejected: 1800
8065
- }];
8066
- const zones = [{
8067
- zone: "North Delhi",
8068
- totalConnections: 220000,
8069
- ekycDone: 172000,
8070
- liveSurveyors: 58,
8071
- todayCompleted: 2800
8072
- }, {
8073
- zone: "South Delhi",
8074
- totalConnections: 198000,
8075
- ekycDone: 154500,
8076
- liveSurveyors: 42,
8077
- todayCompleted: 2100
8078
- }, {
8079
- zone: "East Delhi",
8080
- totalConnections: 175000,
8081
- ekycDone: 132800,
8082
- liveSurveyors: 37,
8083
- todayCompleted: 1740
8084
- }, {
8085
- zone: "West Delhi",
8086
- totalConnections: 212000,
8087
- ekycDone: 188300,
8088
- liveSurveyors: 48,
8089
- todayCompleted: 2560
8090
- }];
8091
- 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"];
8092
- const CeoDashboard$1 = () => {
7164
+ const isInboxLoading = isLoading;
7165
+ const onMobileSortOrderData = data => {
7166
+ const sortOrder = data.sortOrder;
7167
+ dispatch({
7168
+ action: "mutateTableForm",
7169
+ data: _extends({}, formState.tableForm, {
7170
+ sortOrder
7171
+ })
7172
+ });
7173
+ };
7174
+ const onSortFormReset = setSortFormValue => {
7175
+ setSortFormValue("sortOrder", "DESC");
7176
+ dispatch({
7177
+ action: "mutateTableForm",
7178
+ data: tableOrderFormDefaultValues
7179
+ });
7180
+ };
7181
+ const propsForMobileSortForm = {
7182
+ onMobileSortOrderData,
7183
+ sortFormDefaultValues: formState === null || formState === void 0 ? void 0 : formState.tableForm,
7184
+ onSortFormReset
7185
+ };
7186
+ const propsForInboxMobileCards = useInboxMobileCardsData({
7187
+ table: filteredData,
7188
+ isSupervisor: true
7189
+ });
8093
7190
  return /*#__PURE__*/React__default.createElement("div", {
8094
- className: "ekyc-dashboard-wrapper"
8095
- }, /*#__PURE__*/React__default.createElement("div", {
8096
- className: "ceo-dashboard"
8097
- }, /*#__PURE__*/React__default.createElement("main", {
8098
- className: "main-content"
8099
- }, /*#__PURE__*/React__default.createElement("div", {
8100
- className: "kpi-grid"
8101
- }, /*#__PURE__*/React__default.createElement("div", {
8102
- className: "kpi-card primary"
8103
- }, /*#__PURE__*/React__default.createElement("div", {
8104
- className: "icon-box"
8105
- }, /*#__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", {
8106
- className: "kpi-card success"
8107
- }, /*#__PURE__*/React__default.createElement("div", {
8108
- className: "icon-box"
8109
- }, /*#__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", {
8110
- className: "kpi-card warning"
8111
- }, /*#__PURE__*/React__default.createElement("div", {
8112
- className: "icon-box"
8113
- }, /*#__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", {
8114
- className: "kpi-card danger"
8115
- }, /*#__PURE__*/React__default.createElement("div", {
8116
- className: "icon-box"
8117
- }, /*#__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", {
8118
- className: "dashboard-section"
8119
- }, /*#__PURE__*/React__default.createElement("div", {
8120
- className: "section-header"
8121
- }, /*#__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", {
8122
- className: "vendor-grid"
8123
- }, vendors.map(vendor => /*#__PURE__*/React__default.createElement("div", {
8124
- className: "vendor-card",
8125
- key: vendor.id
8126
- }, /*#__PURE__*/React__default.createElement("div", {
8127
- className: "vendor-top"
8128
- }, /*#__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", {
8129
- className: "progress-bar"
8130
- }, /*#__PURE__*/React__default.createElement("div", {
8131
- className: "progress-fill",
8132
- style: {
8133
- width: vendor.progress + "%"
8134
- }
8135
- })), /*#__PURE__*/React__default.createElement("div", {
8136
- className: "vendor-stats"
8137
- }, /*#__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", {
8138
- className: "vendor-footer"
8139
- }, /*#__PURE__*/React__default.createElement("span", null, "Pending: ", vendor.pending), /*#__PURE__*/React__default.createElement("span", null, "Rejected: ", vendor.rejected)))))), /*#__PURE__*/React__default.createElement("section", {
8140
- className: "dashboard-section"
8141
- }, /*#__PURE__*/React__default.createElement("div", {
8142
- className: "section-header"
8143
- }, /*#__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", {
8144
- className: "table-wrapper"
8145
- }, /*#__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", {
8146
- key: index
8147
- }, /*#__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", {
8148
- className: "status-badge success"
8149
- }, "Active")))))))), /*#__PURE__*/React__default.createElement("div", {
8150
- className: "bottom-grid"
8151
- }, /*#__PURE__*/React__default.createElement("section", {
8152
- className: "dashboard-section alerts-section"
8153
- }, /*#__PURE__*/React__default.createElement("div", {
8154
- className: "section-header"
8155
- }, /*#__PURE__*/React__default.createElement("h2", null, /*#__PURE__*/React__default.createElement(fa.FaExclamationTriangle, null), " Critical Alerts")), /*#__PURE__*/React__default.createElement("div", {
8156
- className: "alerts-list"
8157
- }, alerts.map((alert, index) => /*#__PURE__*/React__default.createElement("div", {
8158
- className: "alert-card",
8159
- key: index
8160
- }, /*#__PURE__*/React__default.createElement(fa.FaExclamationTriangle, null), /*#__PURE__*/React__default.createElement("p", null, alert))))), /*#__PURE__*/React__default.createElement("section", {
8161
- className: "dashboard-section team-section"
8162
- }, /*#__PURE__*/React__default.createElement("div", {
8163
- className: "section-header"
8164
- }, /*#__PURE__*/React__default.createElement("h2", null, /*#__PURE__*/React__default.createElement(fa.FaUserTie, null), " Workforce Monitoring")), /*#__PURE__*/React__default.createElement("div", {
8165
- className: "team-stats-grid"
8166
- }, /*#__PURE__*/React__default.createElement("div", {
8167
- className: "team-box"
8168
- }, /*#__PURE__*/React__default.createElement("h3", null, "37"), /*#__PURE__*/React__default.createElement("p", null, "Total Supervisors Online")), /*#__PURE__*/React__default.createElement("div", {
8169
- className: "team-box"
8170
- }, /*#__PURE__*/React__default.createElement("h3", null, "154"), /*#__PURE__*/React__default.createElement("p", null, "Surveyors Active")), /*#__PURE__*/React__default.createElement("div", {
8171
- className: "team-box"
8172
- }, /*#__PURE__*/React__default.createElement("h3", null, "12,430"), /*#__PURE__*/React__default.createElement("p", null, "Today's eKYC Completed")), /*#__PURE__*/React__default.createElement("div", {
8173
- className: "team-box"
8174
- }, /*#__PURE__*/React__default.createElement("h3", null, "92%"), /*#__PURE__*/React__default.createElement("p", null, "Operational Efficiency"))))))));
7191
+ className: "app-container"
7192
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.InboxComposer, _extends({
7193
+ isInboxLoading
7194
+ }, propsForSearchForm, propsForMobileSortForm, {
7195
+ propsForInboxTable,
7196
+ propsForInboxMobileCards,
7197
+ formState,
7198
+ countData: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
7199
+ isCardLoading: isDataSearchLoading,
7200
+ showSearchOnMobile: true,
7201
+ forceTable: true
7202
+ })));
8175
7203
  };
8176
7204
 
8177
7205
  const breadcrumb = (userType, listLabel, listPath, detailLabel) => [{
@@ -8195,26 +7223,16 @@ const getEkycRoutes = userType => [{
8195
7223
  component: Review,
8196
7224
  layout: "normal",
8197
7225
  breadcrumb: "EKYC_REVIEW"
8198
- }, {
8199
- path: "/create-kyc",
8200
- component: Create,
8201
- layout: "normal",
8202
- breadcrumb: "EKYC_CREATE_KYC"
8203
- }, {
8204
- path: "/mapping",
8205
- component: Mapping,
8206
- layout: "normal",
8207
- breadcrumb: "EKYC_MAPPING"
8208
7226
  }, {
8209
7227
  path: "/admin-dashboard",
8210
7228
  component: AdminDashboard,
8211
7229
  layout: "normal",
8212
7230
  breadcrumb: "EKYC_ADMIN_DASHBOARD"
8213
7231
  }, {
8214
- path: "/ceo-dashboard",
8215
- component: CeoDashboard$1,
7232
+ path: "/work-order",
7233
+ component: WorkOrder,
8216
7234
  layout: "normal",
8217
- breadcrumb: "CEO_M.F_DOR_FINANCE_VIEW"
7235
+ breadcrumb: "EKYC_WORK_ORDER"
8218
7236
  }, {
8219
7237
  path: "/consumer-details",
8220
7238
  component: EKYCForm,
@@ -8347,16 +7365,6 @@ const EmployeeApp = _ref => {
8347
7365
  moduleCode: "EKYC",
8348
7366
  isInbox: true
8349
7367
  }))
8350
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
8351
- path: path + "/create-kyc",
8352
- component: () => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
8353
- layoutClass: "normal"
8354
- }, /*#__PURE__*/React__default.createElement(Create, null))
8355
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
8356
- path: path + "/mapping",
8357
- component: () => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
8358
- layoutClass: "normal"
8359
- }, /*#__PURE__*/React__default.createElement(Mapping, null))
8360
7368
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
8361
7369
  path: path + "/assign/surveyor-details/:id",
8362
7370
  exact: true,
@@ -8375,11 +7383,6 @@ const EmployeeApp = _ref => {
8375
7383
  component: () => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
8376
7384
  layoutClass: "action"
8377
7385
  }, /*#__PURE__*/React__default.createElement(Review, null))
8378
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
8379
- path: path + "/ceo-dashboard",
8380
- component: () => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
8381
- layoutClass: "normal"
8382
- }, /*#__PURE__*/React__default.createElement(CeoDashboard, null))
8383
7386
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
8384
7387
  path: path + "/admin-dashboard",
8385
7388
  component: () => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
@@ -8400,6 +7403,11 @@ const EmployeeApp = _ref => {
8400
7403
  component: () => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
8401
7404
  layoutClass: "normal"
8402
7405
  }, /*#__PURE__*/React__default.createElement(SurveyorDetailsDashboard, null))
7406
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
7407
+ path: path + "/work-order",
7408
+ component: () => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
7409
+ layoutClass: "normal"
7410
+ }, /*#__PURE__*/React__default.createElement(WorkOrder, null))
8403
7411
  })))));
8404
7412
  };
8405
7413