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