@djb25/digit-ui-module-ekyc 1.0.38 → 1.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,17 +4,28 @@ import { useHistory, Link, useLocation, useParams, useRouteMatch, Switch, Route,
4
4
  import { PersonIcon, EmployeeModuleCard, Loader, Card, InboxLinks, Table, HomeIcon, TextInput, Header, SubmitBar, DetailsCard, FilterForm, FilterFormField, Dropdown, Label, CustomTooltip, CardLabelError, InboxComposer, EditIcon, DeleteIcon, CardHeader, CardText, LabelFieldPair, CardLabel, ActionBar, Modal, Toast, RadioButtons, CardSubHeader, StatusTable, Row, GenericFileIcon, CheckBox, Menu, LinkButton, UploadFile, FormComposer, VerticalTimeline, Close, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, LayoutWrapper, CitizenHomeCard, DocumentIcon, BackButton } 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, FaArrowLeft } from 'react-icons/fa';
7
+ import { FaUsers, FaCheckCircle, FaClock, FaExclamationTriangle, FaUserTie, FaChartLine, FaSearch, FaArrowRight, FaMapMarkedAlt } from 'react-icons/fa';
8
8
  import { ResponsiveContainer, LineChart, CartesianGrid, XAxis, YAxis, Tooltip, Legend, Line, BarChart, Bar, PieChart, Pie, Cell } from 'recharts';
9
9
 
10
10
  const EKYCCard = () => {
11
11
  const _useTranslation = useTranslation(),
12
12
  t = _useTranslation.t;
13
+ const tenantId = Digit.ULBService.getCurrentTenantId();
14
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycApplicationList({}, {
15
+ tenantId,
16
+ offset: 0,
17
+ limit: 1
18
+ }, {
19
+ enabled: !!tenantId
20
+ }),
21
+ listData = _Digit$Hooks$ekyc$use.data,
22
+ isLoading = _Digit$Hooks$ekyc$use.isLoading;
23
+ const totalCount = isLoading ? "-" : (listData === null || listData === void 0 ? void 0 : listData.totalCount) || 0;
13
24
  const propsForModuleCard = {
14
25
  Icon: /*#__PURE__*/React.createElement(PersonIcon, null),
15
26
  moduleName: t("ACTION_TEST_EKYC"),
16
27
  kpis: [{
17
- count: "-",
28
+ count: totalCount,
18
29
  label: t("TOTAL_EKYC"),
19
30
  link: "/digit-ui/employee/ekyc/dashboard"
20
31
  }],
@@ -22,6 +33,10 @@ const EKYCCard = () => {
22
33
  label: t("CEO_M.F_DOR_FINANCE_VIEW"),
23
34
  link: "/digit-ui/employee/ekyc/ceo-dashboard"
24
35
  }, {
36
+ label: t("EKYC_ADMIN_DASHBOARD") || "Admin Dashboard",
37
+ link: "/digit-ui/employee/ekyc/admin-dashboard"
38
+ }, {
39
+ count: totalCount,
25
40
  label: t("EKYC_INBOX"),
26
41
  link: "/digit-ui/employee/ekyc/inbox"
27
42
  }, {
@@ -1573,305 +1588,6 @@ const CeoDashboard = () => {
1573
1588
  }, /*#__PURE__*/React.createElement("h3", null, topKpis.successRate, "%"), /*#__PURE__*/React.createElement("p", null, "Operational Efficiency")))))));
1574
1589
  };
1575
1590
 
1576
- const VendorDetails = () => {
1577
- var _vendor$dailyPerforma, _vendor$dailyPerforma2;
1578
- const history = useHistory();
1579
- const _useParams = useParams(),
1580
- _useParams$vendorId = _useParams.vendorId,
1581
- vendorId = _useParams$vendorId === void 0 ? 1 : _useParams$vendorId;
1582
- const vendor = useMemo(() => ekycMockData.vendors.find(item => item.id === Number(vendorId)), [vendorId]);
1583
- const tenantId = Digit.ULBService.getCurrentTenantId();
1584
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycSurveyorDashboard({}, {
1585
- tenantId,
1586
- offset: 0,
1587
- limit: 10
1588
- }, {
1589
- enabled: !!tenantId
1590
- });
1591
- if (!vendor) {
1592
- return /*#__PURE__*/React.createElement("div", {
1593
- className: "ekyc-dashboard-wrapper"
1594
- }, /*#__PURE__*/React.createElement("div", {
1595
- className: "dashboard-shell"
1596
- }, /*#__PURE__*/React.createElement("div", {
1597
- className: "detail-header"
1598
- }, /*#__PURE__*/React.createElement("button", {
1599
- className: "back-button",
1600
- onClick: () => history.goBack()
1601
- }, /*#__PURE__*/React.createElement(FaArrowLeft, null), " Back")), /*#__PURE__*/React.createElement("div", {
1602
- className: "empty-state"
1603
- }, /*#__PURE__*/React.createElement("h2", null, "Vendor analytics not found"), /*#__PURE__*/React.createElement("p", null, "The selected vendor does not exist in the current report. Please return to the dashboard."))));
1604
- }
1605
- const zoneRows = vendor.zones.slice(0, 8);
1606
- const performanceData = vendor.dailyPerformance.map(row => ({
1607
- day: row.day,
1608
- completed: row.completed,
1609
- pending: row.pending,
1610
- rejected: row.rejected
1611
- }));
1612
- return /*#__PURE__*/React.createElement("div", {
1613
- className: "ekyc-dashboard-wrapper"
1614
- }, /*#__PURE__*/React.createElement("div", {
1615
- className: "dashboard-shell detail-shell"
1616
- }, /*#__PURE__*/React.createElement("section", {
1617
- className: "kpi-grid detail-kpi-grid"
1618
- }, [{
1619
- label: "Assigned Connections",
1620
- value: vendor.assignedConnections,
1621
- icon: /*#__PURE__*/React.createElement(FaUsers, null),
1622
- variant: "primary"
1623
- }, {
1624
- label: "Agency eKYC",
1625
- value: vendor.completedEkyc,
1626
- icon: /*#__PURE__*/React.createElement(FaCheckCircle, null),
1627
- variant: "success"
1628
- }, {
1629
- label: "Self eKYC",
1630
- value: vendor.selfEkyc,
1631
- icon: /*#__PURE__*/React.createElement(FaUsers, null),
1632
- variant: "info"
1633
- }, {
1634
- label: "Pending",
1635
- value: vendor.pending,
1636
- icon: /*#__PURE__*/React.createElement(FaClock, null),
1637
- variant: "warning"
1638
- }, {
1639
- label: "Rejected",
1640
- value: vendor.rejected,
1641
- icon: /*#__PURE__*/React.createElement(FaExclamationTriangle, null),
1642
- variant: "danger"
1643
- }, {
1644
- label: "Success Rate",
1645
- value: vendor.successRate + "%",
1646
- icon: /*#__PURE__*/React.createElement(FaCheckCircle, null),
1647
- variant: "success"
1648
- }].map(item => {
1649
- var _item$value$toLocaleS, _item$value, _item$value$toLocaleS2;
1650
- return /*#__PURE__*/React.createElement("article", {
1651
- key: item.label,
1652
- className: "kpi-card card-" + item.variant
1653
- }, /*#__PURE__*/React.createElement("div", {
1654
- className: "kpi-icon"
1655
- }, item.icon), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", {
1656
- className: "kpi-title"
1657
- }, item.label), /*#__PURE__*/React.createElement("h2", null, (_item$value$toLocaleS = (_item$value = item.value) === null || _item$value === void 0 ? void 0 : (_item$value$toLocaleS2 = _item$value.toLocaleString) === null || _item$value$toLocaleS2 === void 0 ? void 0 : _item$value$toLocaleS2.call(_item$value)) != null ? _item$value$toLocaleS : item.value)));
1658
- })), /*#__PURE__*/React.createElement("section", {
1659
- className: "analytics-grid detail-analytics-grid"
1660
- }, /*#__PURE__*/React.createElement("div", {
1661
- className: "analytics-panel glass-card"
1662
- }, /*#__PURE__*/React.createElement("div", {
1663
- className: "section-header"
1664
- }, /*#__PURE__*/React.createElement("h2", null, "Daily Completion Trend"), /*#__PURE__*/React.createElement("span", {
1665
- className: "badge success"
1666
- }, "Performance")), /*#__PURE__*/React.createElement(ExecutiveLineChart, {
1667
- data: performanceData,
1668
- dataKey: "completed",
1669
- name: "Completed"
1670
- })), /*#__PURE__*/React.createElement("div", {
1671
- className: "analytics-panel glass-card"
1672
- }, /*#__PURE__*/React.createElement("div", {
1673
- className: "section-header"
1674
- }, /*#__PURE__*/React.createElement("h2", null, "Pending vs Completed"), /*#__PURE__*/React.createElement("span", {
1675
- className: "badge warning"
1676
- }, "Workload")), /*#__PURE__*/React.createElement(ExecutiveBarChart, {
1677
- data: performanceData,
1678
- categories: [{
1679
- key: "completed",
1680
- name: "Completed"
1681
- }, {
1682
- key: "pending",
1683
- name: "Pending"
1684
- }],
1685
- xKey: "day"
1686
- })), /*#__PURE__*/React.createElement("div", {
1687
- className: "analytics-panel glass-card"
1688
- }, /*#__PURE__*/React.createElement("div", {
1689
- className: "section-header"
1690
- }, /*#__PURE__*/React.createElement("h2", null, "Self vs Agency Split"), /*#__PURE__*/React.createElement("span", {
1691
- className: "badge info"
1692
- }, "Adoption")), /*#__PURE__*/React.createElement(ExecutivePieChart, {
1693
- data: [{
1694
- label: "Agency eKYC",
1695
- value: vendor.completedEkyc
1696
- }, {
1697
- label: "Citizen Self eKYC",
1698
- value: vendor.selfEkyc
1699
- }],
1700
- dataKey: "value",
1701
- labelKey: "label"
1702
- }))), /*#__PURE__*/React.createElement("section", {
1703
- className: "zone-section detail-zone-section"
1704
- }, /*#__PURE__*/React.createElement("div", {
1705
- className: "section-header"
1706
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h2", null, /*#__PURE__*/React.createElement(FaMapMarkedAlt, null), " Zone-wise Jurisdiction Analytics"), /*#__PURE__*/React.createElement("p", null, "Drill into the current operational load and heatmap intensity for this vendor."))), /*#__PURE__*/React.createElement("div", {
1707
- className: "table-wrapper glass-card"
1708
- }, /*#__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, "Cluster"), /*#__PURE__*/React.createElement("th", null, "Assigned"), /*#__PURE__*/React.createElement("th", null, "Agency eKYC"), /*#__PURE__*/React.createElement("th", null, "Pending"), /*#__PURE__*/React.createElement("th", null, "Activity Score"))), /*#__PURE__*/React.createElement("tbody", null, zoneRows.map((row, index) => {
1709
- var _row$activeDemand$toL, _row$activeDemand, _row$pppZones$toLocal, _row$pppZones, _row$inactiveDemand$t, _row$inactiveDemand;
1710
- return /*#__PURE__*/React.createElement("tr", {
1711
- key: row.location + "-" + index
1712
- }, /*#__PURE__*/React.createElement("td", null, row.location), /*#__PURE__*/React.createElement("td", null, row.cluster || row.district), /*#__PURE__*/React.createElement("td", null, (_row$activeDemand$toL = (_row$activeDemand = row.activeDemand) === null || _row$activeDemand === void 0 ? void 0 : _row$activeDemand.toLocaleString()) != null ? _row$activeDemand$toL : "—"), /*#__PURE__*/React.createElement("td", null, (_row$pppZones$toLocal = (_row$pppZones = row.pppZones) === null || _row$pppZones === void 0 ? void 0 : _row$pppZones.toLocaleString()) != null ? _row$pppZones$toLocal : "—"), /*#__PURE__*/React.createElement("td", null, (_row$inactiveDemand$t = (_row$inactiveDemand = row.inactiveDemand) === null || _row$inactiveDemand === void 0 ? void 0 : _row$inactiveDemand.toLocaleString()) != null ? _row$inactiveDemand$t : "—"), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", {
1713
- className: "status-badge " + (row.intensityScore > 65 ? "danger" : row.intensityScore > 45 ? "warning" : "success")
1714
- }, row.intensityScore, "%")));
1715
- }))))), /*#__PURE__*/React.createElement("section", {
1716
- className: "bottom-grid detail-bottom-grid"
1717
- }, /*#__PURE__*/React.createElement("div", {
1718
- className: "cards-summary glass-card"
1719
- }, /*#__PURE__*/React.createElement("h2", null, "Operational Efficiency"), /*#__PURE__*/React.createElement("div", {
1720
- className: "efficiency-grid"
1721
- }, /*#__PURE__*/React.createElement("div", {
1722
- className: "efficiency-box"
1723
- }, /*#__PURE__*/React.createElement("h3", null, vendor.activeSurveyors), /*#__PURE__*/React.createElement("p", null, "Active Surveyors")), /*#__PURE__*/React.createElement("div", {
1724
- className: "efficiency-box"
1725
- }, /*#__PURE__*/React.createElement("h3", null, vendor.supervisors), /*#__PURE__*/React.createElement("p", null, "Supervisors")), /*#__PURE__*/React.createElement("div", {
1726
- className: "efficiency-box"
1727
- }, /*#__PURE__*/React.createElement("h3", null, vendor.progress, "%"), /*#__PURE__*/React.createElement("p", null, "Execution Rate")), /*#__PURE__*/React.createElement("div", {
1728
- className: "efficiency-box"
1729
- }, /*#__PURE__*/React.createElement("h3", null, (_vendor$dailyPerforma = vendor.dailyPerformance.slice(-1)[0]) === null || _vendor$dailyPerforma === void 0 ? void 0 : (_vendor$dailyPerforma2 = _vendor$dailyPerforma.completed) === null || _vendor$dailyPerforma2 === void 0 ? void 0 : _vendor$dailyPerforma2.toLocaleString()), /*#__PURE__*/React.createElement("p", null, "Latest Day Completed")))), /*#__PURE__*/React.createElement("div", {
1730
- className: "cards-summary glass-card"
1731
- }, /*#__PURE__*/React.createElement("h2", null, "Supervisor Pulse"), /*#__PURE__*/React.createElement("div", {
1732
- className: "pulse-list"
1733
- }, vendor.jurisdictions.map(zone => /*#__PURE__*/React.createElement("div", {
1734
- key: zone,
1735
- className: "pulse-row"
1736
- }, /*#__PURE__*/React.createElement("span", null, zone), /*#__PURE__*/React.createElement("span", null, Math.max(12, Math.round(Math.random() * 38)), " active"))))))));
1737
- };
1738
-
1739
- const useInboxTableConfig = _ref => {
1740
- var _formState$tableForm, _formState$tableForm2, _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _formState$searchForm;
1741
- let onPageSizeChange = _ref.onPageSizeChange,
1742
- formState = _ref.formState,
1743
- totalCount = _ref.totalCount,
1744
- table = _ref.table,
1745
- dispatch = _ref.dispatch,
1746
- checkPathName = _ref.checkPathName,
1747
- onSortingByData = _ref.onSortingByData,
1748
- tenantId = _ref.tenantId,
1749
- _ref$inboxStyles = _ref.inboxStyles,
1750
- inboxStyles = _ref$inboxStyles === void 0 ? {} : _ref$inboxStyles,
1751
- _ref$tableStyle = _ref.tableStyle,
1752
- tableStyle = _ref$tableStyle === void 0 ? {} : _ref$tableStyle;
1753
- const _useTranslation = useTranslation(),
1754
- t = _useTranslation.t;
1755
- const history = useHistory();
1756
- const _useState = useState(""),
1757
- selectedKno = _useState[0],
1758
- setSelectedKno = _useState[1];
1759
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycAPI("review", tenantId),
1760
- reviewData = _Digit$Hooks$ekyc$use.data,
1761
- getReview = _Digit$Hooks$ekyc$use.getReview;
1762
- const handleReview = kno => {
1763
- setSelectedKno(kno);
1764
- getReview({
1765
- kno
1766
- });
1767
- };
1768
- const limit = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10;
1769
- const offset = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0;
1770
- 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";
1771
- React.useEffect(() => {
1772
- if (reviewData) {
1773
- history.push("/digit-ui/" + userType + "/ekyc/review/" + selectedKno, {
1774
- aadhaarData: reviewData === null || reviewData === void 0 ? void 0 : reviewData.aadhaarData,
1775
- reviewData
1776
- });
1777
- }
1778
- }, [reviewData]);
1779
- const tableColumnConfig = [{
1780
- Header: t("EKYC_APPLICATION_NO"),
1781
- accessor: "applicationNumber",
1782
- disableSortBy: true,
1783
- Cell: _ref2 => {
1784
- var _row$original, _row$original2;
1785
- let row = _ref2.row;
1786
- const kno = ((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.kno) || ((_row$original2 = row.original) === null || _row$original2 === void 0 ? void 0 : _row$original2.applicationNumber) || "NA";
1787
- return /*#__PURE__*/React.createElement("span", {
1788
- className: "link",
1789
- onClick: () => handleReview(kno)
1790
- }, kno);
1791
- }
1792
- }, {
1793
- Header: t("EKYC_CITIZEN_NAME"),
1794
- accessor: "citizenName",
1795
- Cell: _ref3 => {
1796
- var _row$original3;
1797
- let row = _ref3.row;
1798
- return /*#__PURE__*/React.createElement("span", null, ((_row$original3 = row.original) === null || _row$original3 === void 0 ? void 0 : _row$original3.citizenName) || "NA");
1799
- }
1800
- }, {
1801
- Header: t("EKYC_STATUS"),
1802
- accessor: "actionStatus",
1803
- Cell: _ref4 => {
1804
- var _row$original4;
1805
- let row = _ref4.row;
1806
- const status = ((_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : _row$original4.status) || "DEFAULT";
1807
- return /*#__PURE__*/React.createElement("span", {
1808
- className: "ekyc-status-tag " + status
1809
- }, t("" + status));
1810
- }
1811
- }, {
1812
- Header: t("EKYC_EKYC_STATUS"),
1813
- accessor: "ekycStatus",
1814
- Cell: _ref5 => {
1815
- var _row$original5, _row$original6;
1816
- let row = _ref5.row;
1817
- const ekycStatus = (((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : _row$original5.ekycStatus) || ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.ekycstatus) || "NA").toUpperCase();
1818
- return /*#__PURE__*/React.createElement("span", {
1819
- className: "ekyc-status-tag " + ekycStatus
1820
- }, t("" + ekycStatus));
1821
- }
1822
- }];
1823
- return {
1824
- disableSort: false,
1825
- autoSort: false,
1826
- manualPagination: true,
1827
- initSortId: "applicationDate",
1828
- onPageSizeChange: onPageSizeChange,
1829
- currentPage: offset,
1830
- onNextPage: () => {
1831
- var _formState$tableForm3;
1832
- return dispatch({
1833
- action: "mutateTableForm",
1834
- data: _extends({}, formState.tableForm, {
1835
- offset: parseInt((_formState$tableForm3 = formState.tableForm) === null || _formState$tableForm3 === void 0 ? void 0 : _formState$tableForm3.offset) + limit
1836
- }),
1837
- checkPathName
1838
- });
1839
- },
1840
- onPrevPage: () => {
1841
- var _formState$tableForm4;
1842
- return dispatch({
1843
- action: "mutateTableForm",
1844
- data: _extends({}, formState.tableForm, {
1845
- offset: parseInt((_formState$tableForm4 = formState.tableForm) === null || _formState$tableForm4 === void 0 ? void 0 : _formState$tableForm4.offset) - limit
1846
- }),
1847
- checkPathName
1848
- });
1849
- },
1850
- pageSizeLimit: limit,
1851
- onSort: onSortingByData,
1852
- totalRecords: totalCount,
1853
- onSearch: formState === null || formState === void 0 ? void 0 : (_formState$searchForm = formState.searchForm) === null || _formState$searchForm === void 0 ? void 0 : _formState$searchForm.message,
1854
- onLastPage: () => dispatch({
1855
- action: "mutateTableForm",
1856
- data: _extends({}, formState.tableForm, {
1857
- offset: Math.max(0, Math.floor((totalCount - 1) / limit) * limit)
1858
- }),
1859
- checkPathName
1860
- }),
1861
- onFirstPage: () => dispatch({
1862
- action: "mutateTableForm",
1863
- data: _extends({}, formState.tableForm, {
1864
- offset: 0
1865
- }),
1866
- checkPathName
1867
- }),
1868
- data: table,
1869
- columns: tableColumnConfig,
1870
- inboxStyles: _extends({}, inboxStyles),
1871
- tableStyle: _extends({}, tableStyle)
1872
- };
1873
- };
1874
-
1875
1591
  const _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator")) : "@@iterator";
1876
1592
  const _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
1877
1593
  function _catch(body, recover) {
@@ -1897,35 +1613,937 @@ function _finallyRethrows(body, finalizer) {
1897
1613
  return finalizer(false, result);
1898
1614
  }
1899
1615
 
1900
- var isNullOrUndefined = value => value == null;
1901
- const isObjectType = value => typeof value === 'object';
1902
- var isObject = value => !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !(value instanceof Date);
1903
- var isKey = value => /^\w*$/.test(value);
1904
- var compact = value => value.filter(Boolean);
1905
- var stringToPath = input => compact(input.replace(/["|']/g, '').replace(/\[/g, '.').replace(/\]/g, '').split('.'));
1906
- function set(object, path, value) {
1907
- let index = -1;
1908
- const tempPath = isKey(path) ? [path] : stringToPath(path);
1909
- const length = tempPath.length;
1910
- const lastIndex = length - 1;
1911
- while (++index < length) {
1912
- const key = tempPath[index];
1913
- let newValue = value;
1914
- if (index !== lastIndex) {
1915
- const objValue = object[key];
1916
- newValue = isObject(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index + 1]) ? [] : {};
1917
- }
1918
- object[key] = newValue;
1919
- object = object[key];
1920
- }
1921
- return object;
1922
- }
1923
- var isUndefined = val => val === undefined;
1924
- var get = function (obj, path, defaultValue) {
1925
- if (obj === void 0) {
1926
- obj = {};
1927
- }
1928
- const result = compact(path.split(/[,[\].]+?/)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], obj);
1616
+ const downloadSurveyorPDF = function (_ref) {
1617
+ let rows = _ref.rows,
1618
+ surveyorName = _ref.surveyorName,
1619
+ employeeId = _ref.employeeId,
1620
+ mobileNumber = _ref.mobileNumber,
1621
+ vendorName = _ref.vendorName,
1622
+ supervisorName = _ref.supervisorName,
1623
+ dashboardInfo = _ref.dashboardInfo,
1624
+ t = _ref.t;
1625
+ try {
1626
+ const tenantId = Digit.ULBService.getCurrentTenantId();
1627
+ const initData = Digit.SessionStorage.get("initData");
1628
+ const tenants = (initData === null || initData === void 0 ? void 0 : initData.tenants) || [];
1629
+ const tenantInfo = tenants.find(tenant => tenant.code === tenantId);
1630
+ const capitalize = text => text && text.substr(0, 1).toUpperCase() + text.substr(1);
1631
+ const ulbCamel = ulb => ulb && ulb.toLowerCase().split(" ").map(capitalize).join(" ");
1632
+ const name = "Delhi Jal Board";
1633
+ const email = "contact@delhijalboard.nic.in";
1634
+ const phoneNumber = "+91-11-23538416";
1635
+ const currentDate = new Date();
1636
+ const formattedDate = currentDate.toLocaleDateString("en-IN", {
1637
+ day: "2-digit",
1638
+ month: "2-digit",
1639
+ year: "numeric"
1640
+ });
1641
+ const formattedTime = currentDate.toLocaleTimeString("en-IN", {
1642
+ hour: "2-digit",
1643
+ minute: "2-digit",
1644
+ second: "2-digit",
1645
+ hour12: false
1646
+ });
1647
+ const downloadDateTime = formattedDate + " " + formattedTime;
1648
+ const isValDefined = val => val !== undefined && val !== null && val !== "";
1649
+ const details = [{
1650
+ title: t("SURVEYOR_DETAILS"),
1651
+ asSectionHeader: true,
1652
+ values: [{
1653
+ title: t("SURVEYOR_NAME"),
1654
+ value: surveyorName
1655
+ }, {
1656
+ title: t("MOBILE_NUMBER"),
1657
+ value: mobileNumber
1658
+ }, {
1659
+ title: t("VENDOR_NAME"),
1660
+ value: vendorName
1661
+ }, {
1662
+ title: t("SUPERVISOR_NAME"),
1663
+ value: supervisorName
1664
+ }].filter(item => isValDefined(item.value))
1665
+ }, {
1666
+ title: t("SUMMARY_STATISTICS"),
1667
+ asSectionHeader: true,
1668
+ values: [{
1669
+ title: t("TOTAL_ASSIGNED"),
1670
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.total) || 0
1671
+ }, {
1672
+ title: t("COMPLETED"),
1673
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.completed) || 0
1674
+ }, {
1675
+ title: t("PENDING"),
1676
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.pending) || 0
1677
+ }, {
1678
+ title: t("SUBMITTED"),
1679
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.submittedCount) || 0
1680
+ }].filter(item => isValDefined(item.value))
1681
+ }];
1682
+ if (window.Digit && window.Digit.Utils && window.Digit.Utils.pdf && window.Digit.Utils.pdf.generateSurveyorReport) {
1683
+ window.Digit.Utils.pdf.generateSurveyorReport({
1684
+ tenantId,
1685
+ logo: null,
1686
+ name,
1687
+ email,
1688
+ phoneNumber,
1689
+ heading: t("EKYC_SURVEYOR_REPORT"),
1690
+ details,
1691
+ applicationNumber: employeeId,
1692
+ rows,
1693
+ t,
1694
+ hideApplicationNumber: true,
1695
+ downloadTime: downloadDateTime
1696
+ });
1697
+ } else {
1698
+ console.error("Digit.Utils.pdf.generateSurveyorReport is not available");
1699
+ }
1700
+ return Promise.resolve();
1701
+ } catch (e) {
1702
+ return Promise.reject(e);
1703
+ }
1704
+ };
1705
+ const downloadVendorPDF = function (_ref3) {
1706
+ let rows = _ref3.rows,
1707
+ vendorName = _ref3.vendorName,
1708
+ mobileNumber = _ref3.mobileNumber,
1709
+ email = _ref3.email,
1710
+ dashboardInfo = _ref3.dashboardInfo,
1711
+ t = _ref3.t;
1712
+ try {
1713
+ const tenantId = Digit.ULBService.getCurrentTenantId();
1714
+ const name = "Delhi Jal Board";
1715
+ const emailContact = "contact@delhijalboard.nic.in";
1716
+ const phoneNumber = "+91-11-23538416";
1717
+ const currentDate = new Date();
1718
+ const formattedDate = currentDate.toLocaleDateString("en-IN", {
1719
+ day: "2-digit",
1720
+ month: "2-digit",
1721
+ year: "numeric"
1722
+ });
1723
+ const formattedTime = currentDate.toLocaleTimeString("en-IN", {
1724
+ hour: "2-digit",
1725
+ minute: "2-digit",
1726
+ second: "2-digit",
1727
+ hour12: false
1728
+ });
1729
+ const downloadDateTime = formattedDate + " " + formattedTime;
1730
+ const isValDefined = val => val !== undefined && val !== null && val !== "";
1731
+ const details = [{
1732
+ title: t("VENDOR_DETAILS") || "Vendor Details",
1733
+ asSectionHeader: true,
1734
+ values: [{
1735
+ title: t("VENDOR_NAME") || "Vendor Name",
1736
+ value: vendorName
1737
+ }, {
1738
+ title: t("MOBILE_NUMBER") || "Mobile Number",
1739
+ value: mobileNumber
1740
+ }, {
1741
+ title: t("EMAIL") || "Email",
1742
+ value: email
1743
+ }].filter(item => isValDefined(item.value))
1744
+ }, {
1745
+ title: t("SUMMARY_STATISTICS") || "Summary Statistics",
1746
+ asSectionHeader: true,
1747
+ values: [{
1748
+ title: t("TOTAL_ASSIGNED") || "Total Assigned",
1749
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.total) || 0
1750
+ }, {
1751
+ title: t("COMPLETED") || "Completed",
1752
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.completed) || 0
1753
+ }, {
1754
+ title: t("PENDING") || "Pending",
1755
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.pending) || 0
1756
+ }, {
1757
+ title: t("SUBMITTED") || "Submitted",
1758
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.submittedCount) || 0
1759
+ }].filter(item => isValDefined(item.value))
1760
+ }];
1761
+ const mappedRows = rows.map(row => ({
1762
+ kno: row.name || "N/A",
1763
+ firstName: row.mobileNo || "N/A",
1764
+ lastName: "",
1765
+ mobileNo: row.status || "N/A",
1766
+ zoneName: String(row.total || 0),
1767
+ ekycStatus: (row.completed || 0) + " / " + (row.pending || 0),
1768
+ submittedAt: 1717171717171,
1769
+ progress: row.progress || "0%"
1770
+ }));
1771
+ const originalToLocaleDateString = Date.prototype.toLocaleDateString;
1772
+ let progressIndex = 0;
1773
+ Date.prototype.toLocaleDateString = function () {
1774
+ if (progressIndex < mappedRows.length) {
1775
+ return mappedRows[progressIndex++].progress || "0%";
1776
+ }
1777
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1778
+ args[_key2] = arguments[_key2];
1779
+ }
1780
+ return originalToLocaleDateString.apply(this, args);
1781
+ };
1782
+ const customT = key => {
1783
+ if (key === "KNO") return t("SUPERVISOR_NAME") || "Supervisor Name";
1784
+ if (key === "CONSUMER") return t("MOBILE_NUMBER") || "Mobile Number";
1785
+ if (key === "MOBILE") return t("STATUS") || "Status";
1786
+ if (key === "ZONE") return t("TOTAL_EKYC_APPLICATIONS") || "Total eKYC Applications";
1787
+ if (key === "EKYC_STATUS") return t("COMPLETED_PENDING") || "Completed / Pending";
1788
+ if (key === "SUBMITTED_DATE") return t("OVERALL_PROGRESS") || "Overall Progress";
1789
+ if (key === "CONSUMER_LIST") return t("CONNECTED_SUPERVISORS") || "Connected Supervisors";
1790
+ return t(key);
1791
+ };
1792
+ try {
1793
+ if (window.Digit && window.Digit.Utils && window.Digit.Utils.pdf && window.Digit.Utils.pdf.generateSurveyorReport) {
1794
+ window.Digit.Utils.pdf.generateSurveyorReport({
1795
+ tenantId,
1796
+ logo: null,
1797
+ name,
1798
+ email: emailContact,
1799
+ phoneNumber,
1800
+ heading: t("EKYC_VENDOR_REPORT") || "eKYC Vendor Report",
1801
+ details,
1802
+ applicationNumber: mobileNumber,
1803
+ rows: mappedRows,
1804
+ t: customT,
1805
+ hideApplicationNumber: true,
1806
+ downloadTime: downloadDateTime
1807
+ });
1808
+ } else {
1809
+ console.error("Digit.Utils.pdf.generateSurveyorReport is not available");
1810
+ }
1811
+ } finally {
1812
+ Date.prototype.toLocaleDateString = originalToLocaleDateString;
1813
+ }
1814
+ return Promise.resolve();
1815
+ } catch (e) {
1816
+ return Promise.reject(e);
1817
+ }
1818
+ };
1819
+
1820
+ const VendorDetailsCard = () => {
1821
+ var _Digit$SessionStorage, _vendor$owner, _vendor$owner2, _vendorName$charAt;
1822
+ const _useTranslation = useTranslation(),
1823
+ t = _useTranslation.t;
1824
+ const history = useHistory();
1825
+ const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
1826
+ const _useParams = useParams(),
1827
+ vendorId = _useParams.vendorId;
1828
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycAssignmentProgress({
1829
+ enabled: !!tenantId,
1830
+ keepPreviousData: true
1831
+ }),
1832
+ isProgressLoading = _Digit$Hooks$ekyc$use.isLoading,
1833
+ progressData = _Digit$Hooks$ekyc$use.data;
1834
+ const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
1835
+ status: "ACTIVE"
1836
+ }, {
1837
+ enabled: !!tenantId
1838
+ }),
1839
+ vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
1840
+ isVendorSearchLoading = _Digit$Hooks$fsm$useD.isLoading;
1841
+ const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
1842
+ status: "ACTIVE"
1843
+ }, {
1844
+ enabled: !!tenantId
1845
+ }),
1846
+ supervisorSearchResponse = _Digit$Hooks$fsm$useS.data,
1847
+ isSupervisorSearchLoading = _Digit$Hooks$fsm$useS.isLoading;
1848
+ const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
1849
+ const vendor = useMemo(() => {
1850
+ const userUuid = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid;
1851
+ const userMobile = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.mobileNumber;
1852
+ const matchesUser = v => {
1853
+ var _v$owner, _v$owner2, _v$owner3;
1854
+ const ownerUuid = ((_v$owner = v.owner) === null || _v$owner === void 0 ? void 0 : _v$owner.uuid) || ((_v$owner2 = v.owner) === null || _v$owner2 === void 0 ? void 0 : _v$owner2.id);
1855
+ const ownerMobile = ((_v$owner3 = v.owner) === null || _v$owner3 === void 0 ? void 0 : _v$owner3.mobileNumber) || v.mobileNumber;
1856
+ return userUuid && ownerUuid === userUuid || userMobile && ownerMobile === userMobile;
1857
+ };
1858
+ if (vendorSearchResponse) {
1859
+ if (vendorId) {
1860
+ const matched = vendorSearchResponse.find(v => {
1861
+ var _v$dsoDetails, _v$dsoDetails2;
1862
+ return ((_v$dsoDetails = v.dsoDetails) === null || _v$dsoDetails === void 0 ? void 0 : _v$dsoDetails.id) === vendorId || ((_v$dsoDetails2 = v.dsoDetails) === null || _v$dsoDetails2 === void 0 ? void 0 : _v$dsoDetails2.vendorId) === vendorId || v.id === vendorId || v.vendorId === vendorId;
1863
+ });
1864
+ if (matched) return matched.dsoDetails || matched;
1865
+ } else {
1866
+ const matched = vendorSearchResponse.find(v => matchesUser(v.dsoDetails || v));
1867
+ if (matched) return matched.dsoDetails || matched;
1868
+ if (vendorSearchResponse.length > 0) return vendorSearchResponse[0].dsoDetails || vendorSearchResponse[0];
1869
+ }
1870
+ }
1871
+ if (vendorId) {
1872
+ return ekycMockData.vendors.find(v => v.id === Number(vendorId) || v.name === vendorId) || ekycMockData.vendors[0];
1873
+ } else {
1874
+ const matchedMock = ekycMockData.vendors.find(v => {
1875
+ var _v$name, _loggedInUser$name;
1876
+ return ((_v$name = v.name) === null || _v$name === void 0 ? void 0 : _v$name.toLowerCase()) === (loggedInUser === null || loggedInUser === void 0 ? void 0 : (_loggedInUser$name = loggedInUser.name) === null || _loggedInUser$name === void 0 ? void 0 : _loggedInUser$name.toLowerCase());
1877
+ });
1878
+ return matchedMock || ekycMockData.vendors[0];
1879
+ }
1880
+ }, [vendorSearchResponse, vendorId, loggedInUser]);
1881
+ const vendorSupervisors = useMemo(() => {
1882
+ if (!(supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors)) {
1883
+ if (vendor && Array.isArray(ekycMockData.vendors)) {
1884
+ const mockSupList = Array.from({
1885
+ length: vendor.supervisors || 5
1886
+ }, (_, i) => ({
1887
+ id: "SUP_V_" + (vendor.id || 1) + "_" + i,
1888
+ name: "Supervisor " + (i + 1) + " (" + vendor.name + ")",
1889
+ mobileNo: "99999120" + i,
1890
+ status: "ACTIVE",
1891
+ totalKnos: Math.round(1000 + Math.random() * 4000),
1892
+ submittedKnos: Math.round(500 + Math.random() * 2000),
1893
+ pendingKnos: Math.round(200 + Math.random() * 1000),
1894
+ progressPercent: Math.round(40 + Math.random() * 50)
1895
+ }));
1896
+ return mockSupList;
1897
+ }
1898
+ return [];
1899
+ }
1900
+ const currentVendorId = (vendor === null || vendor === void 0 ? void 0 : vendor.id) || (vendor === null || vendor === void 0 ? void 0 : vendor.vendorId) || vendorId;
1901
+ const matchedSups = supervisorSearchResponse.supervisors.filter(s => s.vendorId === currentVendorId);
1902
+ return matchedSups.map(sup => {
1903
+ var _progressData$supervi, _sup$owner2, _sup$owner3, _sup$owner4;
1904
+ const report = progressData === null || progressData === void 0 ? void 0 : (_progressData$supervi = progressData.supervisorReport) === null || _progressData$supervi === void 0 ? void 0 : _progressData$supervi.find(r => {
1905
+ var _sup$owner;
1906
+ return r.supervisorId === sup.id || r.supervisorId === ((_sup$owner = sup.owner) === null || _sup$owner === void 0 ? void 0 : _sup$owner.uuid);
1907
+ });
1908
+ return {
1909
+ id: sup.id || ((_sup$owner2 = sup.owner) === null || _sup$owner2 === void 0 ? void 0 : _sup$owner2.uuid),
1910
+ name: sup.name || ((_sup$owner3 = sup.owner) === null || _sup$owner3 === void 0 ? void 0 : _sup$owner3.name) || "N/A",
1911
+ mobileNo: ((_sup$owner4 = sup.owner) === null || _sup$owner4 === void 0 ? void 0 : _sup$owner4.mobileNumber) || sup.mobileNo || "N/A",
1912
+ status: sup.status || "ACTIVE",
1913
+ totalKnos: (report === null || report === void 0 ? void 0 : report.totalKnos) || 0,
1914
+ submittedKnos: (report === null || report === void 0 ? void 0 : report.submittedKnos) || 0,
1915
+ pendingKnos: (report === null || report === void 0 ? void 0 : report.pendingKnos) || 0,
1916
+ progressPercent: (report === null || report === void 0 ? void 0 : report.progressPercent) || 0
1917
+ };
1918
+ });
1919
+ }, [supervisorSearchResponse, vendor, progressData, vendorId]);
1920
+ const vendorName = (vendor === null || vendor === void 0 ? void 0 : vendor.name) || "N/A";
1921
+ const mobileNumber = (vendor === null || vendor === void 0 ? void 0 : vendor.mobileNumber) || (vendor === null || vendor === void 0 ? void 0 : (_vendor$owner = vendor.owner) === null || _vendor$owner === void 0 ? void 0 : _vendor$owner.mobileNumber) || "N/A";
1922
+ const email = (vendor === null || vendor === void 0 ? void 0 : (_vendor$owner2 = vendor.owner) === null || _vendor$owner2 === void 0 ? void 0 : _vendor$owner2.emailId) || "N/A";
1923
+ const status = vendor ? "ACTIVE" : "N/A";
1924
+ const jurisdictions = useMemo(() => {
1925
+ if (Array.isArray(vendor === null || vendor === void 0 ? void 0 : vendor.jurisdictions)) {
1926
+ return vendor.jurisdictions.join(", ");
1927
+ }
1928
+ return "N/A";
1929
+ }, [vendor]);
1930
+ const cards = useMemo(() => {
1931
+ const hasRealData = vendorSupervisors.some(s => s.totalKnos > 0);
1932
+ const totalKnos = hasRealData ? vendorSupervisors.reduce((acc, s) => acc + (s.totalKnos || 0), 0) : (progressData === null || progressData === void 0 ? void 0 : progressData.totalKnos) || (vendor === null || vendor === void 0 ? void 0 : vendor.assignedConnections) || 0;
1933
+ const completedKnos = hasRealData ? vendorSupervisors.reduce((acc, s) => acc + (s.submittedKnos || 0), 0) : (progressData === null || progressData === void 0 ? void 0 : progressData.completedKnos) || (vendor === null || vendor === void 0 ? void 0 : vendor.completedEkyc) || 0;
1934
+ const pendingKnos = hasRealData ? vendorSupervisors.reduce((acc, s) => acc + (s.pendingKnos || 0), 0) : totalKnos - completedKnos;
1935
+ const progressPercent = totalKnos > 0 ? Math.round(completedKnos / totalKnos * 100) : (vendor === null || vendor === void 0 ? void 0 : vendor.progress) || 0;
1936
+ return [{
1937
+ label: "TOTAL_EKYC_APPLICATIONS",
1938
+ count: totalKnos,
1939
+ color: "#0B2559",
1940
+ type: "today",
1941
+ icon: /*#__PURE__*/React.createElement(FaUsers, null)
1942
+ }, {
1943
+ label: "TOTAL_ASSIGNMENTS",
1944
+ count: totalKnos,
1945
+ color: "#3B82F6",
1946
+ type: "week",
1947
+ icon: /*#__PURE__*/React.createElement(FaMapMarkedAlt, null)
1948
+ }, {
1949
+ label: "EKYC_COMPLETED",
1950
+ count: completedKnos,
1951
+ color: "#10B981",
1952
+ type: "month",
1953
+ icon: /*#__PURE__*/React.createElement(FaCheckCircle, null)
1954
+ }, {
1955
+ label: "PENDING_APPLICATIONS",
1956
+ count: pendingKnos,
1957
+ color: "#F59E0B",
1958
+ type: "pending",
1959
+ icon: /*#__PURE__*/React.createElement(FaClock, null)
1960
+ }, {
1961
+ label: "OVERALL_PROGRESS",
1962
+ count: progressPercent + "%",
1963
+ color: "#A855F7",
1964
+ type: "progress",
1965
+ icon: /*#__PURE__*/React.createElement(FaChartLine, null)
1966
+ }];
1967
+ }, [vendorSupervisors, vendor, progressData]);
1968
+ const _useState = useState(0),
1969
+ currentPage = _useState[0],
1970
+ setCurrentPage = _useState[1];
1971
+ const _useState2 = useState(20),
1972
+ pageSize = _useState2[0],
1973
+ setPageSize = _useState2[1];
1974
+ const _useState3 = useState(false),
1975
+ ekycDownloadLoading = _useState3[0],
1976
+ setEkycDownloadLoading = _useState3[1];
1977
+ const handleDownloadEkycData = function () {
1978
+ try {
1979
+ setEkycDownloadLoading(true);
1980
+ return Promise.resolve(_finallyRethrows(function () {
1981
+ return _catch(function () {
1982
+ return Promise.resolve(Digit.EkycService.application_list({
1983
+ tenantId: tenantId,
1984
+ offset: 0,
1985
+ limit: 10000,
1986
+ reportDownload: true
1987
+ })).then(function (response) {
1988
+ const consumerList = (response === null || response === void 0 ? void 0 : response.consumerList) || [];
1989
+ if (!consumerList || consumerList.length === 0) {
1990
+ alert(t("NO_EKYC_DATA_FOUND") || "No eKYC data found to download.");
1991
+ return;
1992
+ }
1993
+ const excludedKeys = ["status", "source", "submittedAt", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "assignedTime", "isSelfAssigned", "userType", "tenantName", "tenantMobile"];
1994
+ const headerMapping = {
1995
+ kno: t("KNO") || "KNO",
1996
+ firstName: t("FIRST_NAME") || "First Name",
1997
+ middleName: t("MIDDLE_NAME") || "Middle Name",
1998
+ lastName: t("LAST_NAME") || "Last Name",
1999
+ gender: t("GENDER") || "Gender",
2000
+ mobileNumber: t("MOBILE_NUMBER") || "Mobile Number",
2001
+ emailId: t("EMAIL_ID") || "Email ID",
2002
+ fatherOrHusbandName: t("FATHER_HUSBUND_NAME") || "Father/Husband Name",
2003
+ relationship: t("RELATIONSHIP") || "Relationship",
2004
+ dob: t("DOB") || "Date of Birth",
2005
+ ekycStatus: t("EKYC_STATUS") || "eKYC Status",
2006
+ zoneName: t("ZONE") || "Zone",
2007
+ assembly: t("ASSEMBLY") || "Assembly",
2008
+ ward: t("WARD") || "Ward",
2009
+ pincode: t("PINCODE") || "Pincode",
2010
+ mrkey: t("MR_KEY") || "MR Key",
2011
+ createdTime: t("CREATED_TIME") || "Created Time",
2012
+ lastModifiedTime: t("LAST_MODIFIED_TIME") || "Last Modified Time"
2013
+ };
2014
+ const excelData = consumerList.map(item => {
2015
+ const cleanObj = {};
2016
+ const fullName = [item.firstName, item.middleName, item.lastName].filter(Boolean).join(" ");
2017
+ if (fullName) {
2018
+ cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = fullName;
2019
+ }
2020
+ Object.keys(item).forEach(key => {
2021
+ if (excludedKeys.includes(key)) return;
2022
+ const val = item[key];
2023
+ if (typeof val === "object" && val !== null) {
2024
+ return;
2025
+ }
2026
+ const friendlyHeader = headerMapping[key] || t(key.toUpperCase()) || key;
2027
+ cleanObj[friendlyHeader] = val;
2028
+ });
2029
+ return cleanObj;
2030
+ });
2031
+ const cleanFileName = "eKYC_Data_" + vendorName.replace(/[^a-zA-Z0-9]/g, "_");
2032
+ Digit.Download.Excel(excelData, cleanFileName);
2033
+ });
2034
+ }, function (error) {
2035
+ console.error("Failed to download eKYC data:", error);
2036
+ alert(t("EKYC_DOWNLOAD_FAILED") || "Failed to download eKYC data. Please try again.");
2037
+ });
2038
+ }, function (_wasThrown, _result) {
2039
+ setEkycDownloadLoading(false);
2040
+ if (_wasThrown) throw _result;
2041
+ return _result;
2042
+ }));
2043
+ } catch (e) {
2044
+ return Promise.reject(e);
2045
+ }
2046
+ };
2047
+ const paginatedSupervisors = useMemo(() => {
2048
+ const start = currentPage * pageSize;
2049
+ const end = start + pageSize;
2050
+ return vendorSupervisors.slice(start, end);
2051
+ }, [vendorSupervisors, currentPage, pageSize]);
2052
+ const supervisorColumns = useMemo(() => [{
2053
+ Header: t("SUPERVISOR_NAME") || "Supervisor Name",
2054
+ accessor: row => (row === null || row === void 0 ? void 0 : row.name) || "N/A",
2055
+ Cell: _ref => {
2056
+ var _row$original;
2057
+ let row = _ref.row;
2058
+ return /*#__PURE__*/React.createElement("a", {
2059
+ href: "/digit-ui/employee/ekyc/assign/surveyor-details/" + row.original.id,
2060
+ style: {
2061
+ color: "#1D70B8",
2062
+ fontWeight: "600",
2063
+ textDecoration: "none"
2064
+ },
2065
+ onClick: e => {
2066
+ var _Digit$SessionStorage2, _Digit$SessionStorage3, _Digit$SessionStorage4;
2067
+ const userType = ((_Digit$SessionStorage2 = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage2 === void 0 ? void 0 : (_Digit$SessionStorage3 = _Digit$SessionStorage2.info) === null || _Digit$SessionStorage3 === void 0 ? void 0 : (_Digit$SessionStorage4 = _Digit$SessionStorage3.type) === null || _Digit$SessionStorage4 === void 0 ? void 0 : _Digit$SessionStorage4.toLowerCase()) || "citizen";
2068
+ e.preventDefault();
2069
+ history.push("/digit-ui/" + userType + "/ekyc/assign/surveyor-details/" + row.original.id);
2070
+ }
2071
+ }, ((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.name) || "N/A");
2072
+ }
2073
+ }, {
2074
+ Header: t("MOBILE_NUMBER") || "Mobile Number",
2075
+ accessor: row => (row === null || row === void 0 ? void 0 : row.mobileNo) || "N/A",
2076
+ id: "mobileNumber"
2077
+ }, {
2078
+ Header: t("STATUS") || "Status",
2079
+ accessor: row => (row === null || row === void 0 ? void 0 : row.status) || "ACTIVE",
2080
+ id: "status",
2081
+ Cell: _ref2 => {
2082
+ let value = _ref2.value;
2083
+ return /*#__PURE__*/React.createElement("span", {
2084
+ className: "status-badge verified"
2085
+ }, t(value) || value);
2086
+ }
2087
+ }, {
2088
+ Header: t("TOTAL_EKYC_APPLICATIONS") || "Total eKYC Applications",
2089
+ accessor: row => (row === null || row === void 0 ? void 0 : row.totalKnos) || 0,
2090
+ id: "totalEkycApplications"
2091
+ }, {
2092
+ Header: t("EKYC_COMPLETED") || "eKYC Completed",
2093
+ accessor: row => (row === null || row === void 0 ? void 0 : row.submittedKnos) || 0,
2094
+ id: "ekycCompleted"
2095
+ }, {
2096
+ Header: t("PENDING_APPLICATIONS") || "Pending Applications",
2097
+ accessor: row => (row === null || row === void 0 ? void 0 : row.pendingKnos) || 0,
2098
+ id: "pendingApplications"
2099
+ }, {
2100
+ Header: t("OVERALL_PROGRESS") || "Overall Progress",
2101
+ accessor: row => (row !== null && row !== void 0 && row.progressPercent || (row === null || row === void 0 ? void 0 : row.progressPercent) === 0 ? row.progressPercent : row.progress) + "%",
2102
+ id: "overallProgress"
2103
+ }], [t, history]);
2104
+ const _useState4 = useState(false),
2105
+ showReportMenu = _useState4[0],
2106
+ setShowReportMenu = _useState4[1];
2107
+ const _useState5 = useState({
2108
+ from: "",
2109
+ to: ""
2110
+ }),
2111
+ customDate = _useState5[0],
2112
+ setCustomDate = _useState5[1];
2113
+ const _useState6 = useState(false),
2114
+ showCustomPicker = _useState6[0],
2115
+ setShowCustomPicker = _useState6[1];
2116
+ const _useState7 = useState(false),
2117
+ reportLoading = _useState7[0],
2118
+ setReportLoading = _useState7[1];
2119
+ const reportMenuRef = useRef(null);
2120
+ useEffect(() => {
2121
+ const handler = e => {
2122
+ if (reportMenuRef.current && !reportMenuRef.current.contains(e.target)) {
2123
+ setShowReportMenu(false);
2124
+ setShowCustomPicker(false);
2125
+ }
2126
+ };
2127
+ document.addEventListener("mousedown", handler);
2128
+ return () => document.removeEventListener("mousedown", handler);
2129
+ }, []);
2130
+ const handleDownload = () => {
2131
+ setReportLoading(true);
2132
+ try {
2133
+ const rowsWithStats = vendorSupervisors.map(s => ({
2134
+ name: s.name,
2135
+ mobileNo: s.mobileNo,
2136
+ status: s.status,
2137
+ total: s.totalKnos,
2138
+ completed: s.submittedKnos,
2139
+ pending: s.pendingKnos,
2140
+ progress: s.progressPercent + "%"
2141
+ }));
2142
+ const totalKnos = vendorSupervisors.reduce((acc, s) => acc + (s.totalKnos || 0), 0) || (vendor === null || vendor === void 0 ? void 0 : vendor.assignedConnections) || 0;
2143
+ const completedKnos = vendorSupervisors.reduce((acc, s) => acc + (s.submittedKnos || 0), 0) || (vendor === null || vendor === void 0 ? void 0 : vendor.completedEkyc) || 0;
2144
+ downloadVendorPDF({
2145
+ rows: rowsWithStats,
2146
+ vendorName,
2147
+ mobileNumber,
2148
+ email,
2149
+ dashboardInfo: {
2150
+ total: totalKnos,
2151
+ completed: completedKnos,
2152
+ pending: totalKnos - completedKnos,
2153
+ submittedCount: completedKnos
2154
+ },
2155
+ t
2156
+ });
2157
+ } catch (err) {
2158
+ console.error("Failed to generate report:", err);
2159
+ } finally {
2160
+ setReportLoading(false);
2161
+ setShowReportMenu(false);
2162
+ setShowCustomPicker(false);
2163
+ }
2164
+ };
2165
+ const handlePresetDownload = filter => {
2166
+ handleDownload();
2167
+ };
2168
+ const handleCustomDownload = () => {
2169
+ if (!customDate.from || !customDate.to) {
2170
+ alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
2171
+ return;
2172
+ }
2173
+ handleDownload();
2174
+ };
2175
+ const StatCard = _ref3 => {
2176
+ let title = _ref3.title,
2177
+ value = _ref3.value,
2178
+ type = _ref3.type,
2179
+ isLoading = _ref3.isLoading,
2180
+ icon = _ref3.icon;
2181
+ return /*#__PURE__*/React.createElement("div", {
2182
+ className: "stat-card " + type
2183
+ }, isLoading ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
2184
+ className: "stat-title skeleton skeleton-text"
2185
+ }), /*#__PURE__*/React.createElement("div", {
2186
+ className: "stat-value skeleton skeleton-number"
2187
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
2188
+ className: "stat-title"
2189
+ }, title), /*#__PURE__*/React.createElement("div", {
2190
+ className: "stat-value"
2191
+ }, value), icon && /*#__PURE__*/React.createElement("div", {
2192
+ className: "stat-icon"
2193
+ }, icon)));
2194
+ };
2195
+ const isPageLoading = isProgressLoading || isVendorSearchLoading || isSupervisorSearchLoading;
2196
+ if (isPageLoading && !vendor) {
2197
+ return /*#__PURE__*/React.createElement(Loader, null);
2198
+ }
2199
+ if (!vendor) {
2200
+ return /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
2201
+ style: {
2202
+ padding: "24px"
2203
+ }
2204
+ }, t("NO_VENDOR_FOUND") || "No Vendor Found"));
2205
+ }
2206
+ return /*#__PURE__*/React.createElement(Card, {
2207
+ className: "surveyor-dashboard"
2208
+ }, /*#__PURE__*/React.createElement("div", {
2209
+ className: "ekyc-dashboard-section"
2210
+ }, /*#__PURE__*/React.createElement("div", {
2211
+ className: "ekyc-dashboard-header"
2212
+ }, /*#__PURE__*/React.createElement("div", {
2213
+ className: "avatar"
2214
+ }, vendorName === null || vendorName === void 0 ? void 0 : (_vendorName$charAt = vendorName.charAt(0)) === null || _vendorName$charAt === void 0 ? void 0 : _vendorName$charAt.toUpperCase()), /*#__PURE__*/React.createElement("div", {
2215
+ className: "header-content"
2216
+ }, /*#__PURE__*/React.createElement("h2", {
2217
+ className: "name"
2218
+ }, vendorName), /*#__PURE__*/React.createElement("div", {
2219
+ className: "designation"
2220
+ }, t("VENDOR_AGENCY") || "Agency / Vendor"))), /*#__PURE__*/React.createElement("div", {
2221
+ className: "report-download",
2222
+ ref: reportMenuRef
2223
+ }, /*#__PURE__*/React.createElement("button", {
2224
+ className: "download-btn",
2225
+ disabled: reportLoading,
2226
+ onClick: () => {
2227
+ setShowReportMenu(p => !p);
2228
+ setShowCustomPicker(false);
2229
+ }
2230
+ }, reportLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_REPORT") || "Download Report"), showReportMenu && /*#__PURE__*/React.createElement("div", {
2231
+ className: "report-menu"
2232
+ }, [{
2233
+ label: t("TODAY") || "Today",
2234
+ key: "today"
2235
+ }, {
2236
+ label: t("THIS_WEEK") || "This Week",
2237
+ key: "week"
2238
+ }, {
2239
+ label: t("THIS_MONTH") || "This Month",
2240
+ key: "month"
2241
+ }].map(_ref4 => {
2242
+ let label = _ref4.label,
2243
+ key = _ref4.key;
2244
+ return /*#__PURE__*/React.createElement("div", {
2245
+ key: key,
2246
+ className: "menu-item",
2247
+ onClick: () => handlePresetDownload()
2248
+ }, label);
2249
+ }), /*#__PURE__*/React.createElement("div", {
2250
+ className: "custom-date-trigger",
2251
+ onClick: () => setShowCustomPicker(p => !p)
2252
+ }, t("CUSTOM_DATE") || "Custom Date"), showCustomPicker && /*#__PURE__*/React.createElement("div", {
2253
+ className: "custom-picker"
2254
+ }, /*#__PURE__*/React.createElement("div", {
2255
+ className: "date-field"
2256
+ }, /*#__PURE__*/React.createElement("label", {
2257
+ className: "date-label"
2258
+ }, t("FROM_DATE") || "From"), /*#__PURE__*/React.createElement("input", {
2259
+ type: "date",
2260
+ className: "date-input",
2261
+ value: customDate.from,
2262
+ onChange: e => setCustomDate(d => _extends({}, d, {
2263
+ from: e.target.value
2264
+ }))
2265
+ })), /*#__PURE__*/React.createElement("div", {
2266
+ className: "date-field"
2267
+ }, /*#__PURE__*/React.createElement("label", {
2268
+ className: "date-label"
2269
+ }, t("TO_DATE") || "To"), /*#__PURE__*/React.createElement("input", {
2270
+ type: "date",
2271
+ className: "date-input",
2272
+ value: customDate.to,
2273
+ onChange: e => setCustomDate(d => _extends({}, d, {
2274
+ to: e.target.value
2275
+ }))
2276
+ })), /*#__PURE__*/React.createElement("button", {
2277
+ className: "download-action-btn",
2278
+ onClick: handleCustomDownload
2279
+ }, t("DOWNLOAD") || "Download"))))), /*#__PURE__*/React.createElement("div", {
2280
+ className: "stats-wrapper"
2281
+ }, cards.map((card, idx) => /*#__PURE__*/React.createElement(StatCard, {
2282
+ key: idx,
2283
+ title: t(card.label),
2284
+ value: card.count,
2285
+ type: card.type,
2286
+ isLoading: isPageLoading,
2287
+ icon: card.icon
2288
+ }))), /*#__PURE__*/React.createElement("div", {
2289
+ className: "ekyc-dashboard-section"
2290
+ }, /*#__PURE__*/React.createElement("div", {
2291
+ className: "ekyc-details-wrapper"
2292
+ }, /*#__PURE__*/React.createElement("div", {
2293
+ className: "details-left"
2294
+ }, /*#__PURE__*/React.createElement("div", {
2295
+ className: "details-grid"
2296
+ }, /*#__PURE__*/React.createElement("div", {
2297
+ className: "detail-item"
2298
+ }, /*#__PURE__*/React.createElement("span", {
2299
+ className: "label"
2300
+ }, t("MOBILE")), /*#__PURE__*/React.createElement("span", {
2301
+ className: "value"
2302
+ }, mobileNumber)), /*#__PURE__*/React.createElement("div", {
2303
+ className: "detail-item"
2304
+ }, /*#__PURE__*/React.createElement("span", {
2305
+ className: "label"
2306
+ }, t("EMAIL")), /*#__PURE__*/React.createElement("span", {
2307
+ className: "value"
2308
+ }, email)), /*#__PURE__*/React.createElement("div", {
2309
+ className: "detail-item"
2310
+ }, /*#__PURE__*/React.createElement("span", {
2311
+ className: "label"
2312
+ }, t("STATUS")), /*#__PURE__*/React.createElement("span", {
2313
+ className: "value"
2314
+ }, status)), /*#__PURE__*/React.createElement("div", {
2315
+ className: "detail-item"
2316
+ }, /*#__PURE__*/React.createElement("span", {
2317
+ className: "label"
2318
+ }, t("JURISDICTIONS") || "Jurisdictions"), /*#__PURE__*/React.createElement("span", {
2319
+ className: "value"
2320
+ }, jurisdictions)))), /*#__PURE__*/React.createElement("div", {
2321
+ className: "details-right"
2322
+ }, /*#__PURE__*/React.createElement("div", {
2323
+ className: "download-card"
2324
+ }, /*#__PURE__*/React.createElement("h4", null, t("DOWNLOAD_EKYC_DATA") || "Download eKYC Data"), /*#__PURE__*/React.createElement("p", null, t("DOWNLOAD_EKYC_DATA_DESC") || "Export the complete eKYC verification records for your assigned jurisdiction into Excel format."), /*#__PURE__*/React.createElement("button", {
2325
+ className: "download-excel-btn",
2326
+ disabled: ekycDownloadLoading,
2327
+ onClick: handleDownloadEkycData
2328
+ }, /*#__PURE__*/React.createElement("svg", {
2329
+ width: "16",
2330
+ height: "16",
2331
+ viewBox: "0 0 24 24",
2332
+ fill: "none",
2333
+ stroke: "currentColor",
2334
+ strokeWidth: "2.5",
2335
+ strokeLinecap: "round",
2336
+ strokeLinejoin: "round"
2337
+ }, /*#__PURE__*/React.createElement("path", {
2338
+ d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
2339
+ }), /*#__PURE__*/React.createElement("polyline", {
2340
+ points: "7 10 12 15 17 10"
2341
+ }), /*#__PURE__*/React.createElement("line", {
2342
+ x1: "12",
2343
+ y1: "15",
2344
+ x2: "12",
2345
+ y2: "3"
2346
+ })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel"))))), /*#__PURE__*/React.createElement(Card, {
2347
+ className: "dashboard-card"
2348
+ }, /*#__PURE__*/React.createElement(Table, {
2349
+ t: t,
2350
+ tableTitle: t("CONNECTED_SUPERVISORS") || "Connected Supervisors",
2351
+ tableClass: "ekycTable",
2352
+ data: paginatedSupervisors,
2353
+ columns: supervisorColumns,
2354
+ isLoading: isPageLoading,
2355
+ totalRecords: vendorSupervisors.length,
2356
+ currentPage: currentPage,
2357
+ pageSizeLimit: pageSize,
2358
+ isPaginationRequired: true,
2359
+ onNextPage: () => {
2360
+ if (currentPage < Math.ceil(vendorSupervisors.length / pageSize) - 1) {
2361
+ setCurrentPage(prev => prev + 1);
2362
+ }
2363
+ },
2364
+ onPrevPage: () => {
2365
+ if (currentPage > 0) {
2366
+ setCurrentPage(prev => prev - 1);
2367
+ }
2368
+ },
2369
+ onFirstPage: () => {
2370
+ setCurrentPage(0);
2371
+ },
2372
+ onLastPage: () => {
2373
+ setCurrentPage(Math.max(Math.ceil(vendorSupervisors.length / pageSize) - 1, 0));
2374
+ },
2375
+ onPageSizeChange: e => {
2376
+ setPageSize(Number(e.target.value));
2377
+ setCurrentPage(0);
2378
+ }
2379
+ })));
2380
+ };
2381
+
2382
+ const useInboxTableConfig = _ref => {
2383
+ var _formState$tableForm, _formState$tableForm2, _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _formState$searchForm;
2384
+ let onPageSizeChange = _ref.onPageSizeChange,
2385
+ formState = _ref.formState,
2386
+ totalCount = _ref.totalCount,
2387
+ table = _ref.table,
2388
+ dispatch = _ref.dispatch,
2389
+ checkPathName = _ref.checkPathName,
2390
+ onSortingByData = _ref.onSortingByData,
2391
+ tenantId = _ref.tenantId,
2392
+ _ref$inboxStyles = _ref.inboxStyles,
2393
+ inboxStyles = _ref$inboxStyles === void 0 ? {} : _ref$inboxStyles,
2394
+ _ref$tableStyle = _ref.tableStyle,
2395
+ tableStyle = _ref$tableStyle === void 0 ? {} : _ref$tableStyle;
2396
+ const _useTranslation = useTranslation(),
2397
+ t = _useTranslation.t;
2398
+ const history = useHistory();
2399
+ const _useState = useState(""),
2400
+ selectedKno = _useState[0],
2401
+ setSelectedKno = _useState[1];
2402
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycAPI("review", tenantId),
2403
+ reviewData = _Digit$Hooks$ekyc$use.data,
2404
+ getReview = _Digit$Hooks$ekyc$use.getReview;
2405
+ const handleReview = kno => {
2406
+ setSelectedKno(kno);
2407
+ getReview({
2408
+ kno
2409
+ });
2410
+ };
2411
+ const limit = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10;
2412
+ const offset = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0;
2413
+ 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";
2414
+ React.useEffect(() => {
2415
+ if (reviewData) {
2416
+ history.push("/digit-ui/" + userType + "/ekyc/review/" + selectedKno, {
2417
+ aadhaarData: reviewData === null || reviewData === void 0 ? void 0 : reviewData.aadhaarData,
2418
+ reviewData
2419
+ });
2420
+ }
2421
+ }, [reviewData]);
2422
+ const tableColumnConfig = [{
2423
+ Header: t("EKYC_APPLICATION_NO"),
2424
+ accessor: "applicationNumber",
2425
+ disableSortBy: true,
2426
+ Cell: _ref2 => {
2427
+ var _row$original, _row$original2;
2428
+ let row = _ref2.row;
2429
+ const kno = ((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.kno) || ((_row$original2 = row.original) === null || _row$original2 === void 0 ? void 0 : _row$original2.applicationNumber) || "NA";
2430
+ return /*#__PURE__*/React.createElement("span", {
2431
+ className: "link",
2432
+ onClick: () => handleReview(kno)
2433
+ }, kno);
2434
+ }
2435
+ }, {
2436
+ Header: t("EKYC_CITIZEN_NAME"),
2437
+ accessor: "citizenName",
2438
+ Cell: _ref3 => {
2439
+ var _row$original3;
2440
+ let row = _ref3.row;
2441
+ return /*#__PURE__*/React.createElement("span", null, ((_row$original3 = row.original) === null || _row$original3 === void 0 ? void 0 : _row$original3.citizenName) || "NA");
2442
+ }
2443
+ }, {
2444
+ Header: t("EKYC_STATUS"),
2445
+ accessor: "actionStatus",
2446
+ Cell: _ref4 => {
2447
+ var _row$original4;
2448
+ let row = _ref4.row;
2449
+ const status = ((_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : _row$original4.status) || "DEFAULT";
2450
+ return /*#__PURE__*/React.createElement("span", {
2451
+ className: "ekyc-status-tag " + status
2452
+ }, t("" + status));
2453
+ }
2454
+ }, {
2455
+ Header: t("EKYC_EKYC_STATUS"),
2456
+ accessor: "ekycStatus",
2457
+ Cell: _ref5 => {
2458
+ var _row$original5, _row$original6;
2459
+ let row = _ref5.row;
2460
+ const ekycStatus = (((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : _row$original5.ekycStatus) || ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.ekycstatus) || "NA").toUpperCase();
2461
+ return /*#__PURE__*/React.createElement("span", {
2462
+ className: "ekyc-status-tag " + ekycStatus
2463
+ }, t("" + ekycStatus));
2464
+ }
2465
+ }];
2466
+ return {
2467
+ disableSort: false,
2468
+ autoSort: false,
2469
+ manualPagination: true,
2470
+ initSortId: "applicationDate",
2471
+ onPageSizeChange: onPageSizeChange,
2472
+ currentPage: offset,
2473
+ onNextPage: () => {
2474
+ var _formState$tableForm3;
2475
+ return dispatch({
2476
+ action: "mutateTableForm",
2477
+ data: _extends({}, formState.tableForm, {
2478
+ offset: parseInt((_formState$tableForm3 = formState.tableForm) === null || _formState$tableForm3 === void 0 ? void 0 : _formState$tableForm3.offset) + limit
2479
+ }),
2480
+ checkPathName
2481
+ });
2482
+ },
2483
+ onPrevPage: () => {
2484
+ var _formState$tableForm4;
2485
+ return dispatch({
2486
+ action: "mutateTableForm",
2487
+ data: _extends({}, formState.tableForm, {
2488
+ offset: parseInt((_formState$tableForm4 = formState.tableForm) === null || _formState$tableForm4 === void 0 ? void 0 : _formState$tableForm4.offset) - limit
2489
+ }),
2490
+ checkPathName
2491
+ });
2492
+ },
2493
+ pageSizeLimit: limit,
2494
+ onSort: onSortingByData,
2495
+ totalRecords: totalCount,
2496
+ onSearch: formState === null || formState === void 0 ? void 0 : (_formState$searchForm = formState.searchForm) === null || _formState$searchForm === void 0 ? void 0 : _formState$searchForm.message,
2497
+ onLastPage: () => dispatch({
2498
+ action: "mutateTableForm",
2499
+ data: _extends({}, formState.tableForm, {
2500
+ offset: Math.max(0, Math.floor((totalCount - 1) / limit) * limit)
2501
+ }),
2502
+ checkPathName
2503
+ }),
2504
+ onFirstPage: () => dispatch({
2505
+ action: "mutateTableForm",
2506
+ data: _extends({}, formState.tableForm, {
2507
+ offset: 0
2508
+ }),
2509
+ checkPathName
2510
+ }),
2511
+ data: table,
2512
+ columns: tableColumnConfig,
2513
+ inboxStyles: _extends({}, inboxStyles),
2514
+ tableStyle: _extends({}, tableStyle)
2515
+ };
2516
+ };
2517
+
2518
+ var isNullOrUndefined = value => value == null;
2519
+ const isObjectType = value => typeof value === 'object';
2520
+ var isObject = value => !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !(value instanceof Date);
2521
+ var isKey = value => /^\w*$/.test(value);
2522
+ var compact = value => value.filter(Boolean);
2523
+ var stringToPath = input => compact(input.replace(/["|']/g, '').replace(/\[/g, '.').replace(/\]/g, '').split('.'));
2524
+ function set(object, path, value) {
2525
+ let index = -1;
2526
+ const tempPath = isKey(path) ? [path] : stringToPath(path);
2527
+ const length = tempPath.length;
2528
+ const lastIndex = length - 1;
2529
+ while (++index < length) {
2530
+ const key = tempPath[index];
2531
+ let newValue = value;
2532
+ if (index !== lastIndex) {
2533
+ const objValue = object[key];
2534
+ newValue = isObject(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index + 1]) ? [] : {};
2535
+ }
2536
+ object[key] = newValue;
2537
+ object = object[key];
2538
+ }
2539
+ return object;
2540
+ }
2541
+ var isUndefined = val => val === undefined;
2542
+ var get = function (obj, path, defaultValue) {
2543
+ if (obj === void 0) {
2544
+ obj = {};
2545
+ }
2546
+ const result = compact(path.split(/[,[\].]+?/)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], obj);
1929
2547
  return isUndefined(result) || result === obj ? isUndefined(obj[path]) ? defaultValue : obj[path] : result;
1930
2548
  };
1931
2549
  var isPrimitive = value => isNullOrUndefined(value) || !isObjectType(value);
@@ -4907,7 +5525,9 @@ const AssignEkycModal = _ref => {
4907
5525
  useEffect(() => {
4908
5526
  setCurrentPage(0);
4909
5527
  }, [debouncedFilters, filters.kno]);
4910
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycApplicationList(_extends({}, filters.kno && {
5528
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycApplicationList(_extends({
5529
+ unassignedOnly: true
5530
+ }, filters.kno && {
4911
5531
  kno: filters.kno
4912
5532
  }, debouncedFilters.ekycStatus && {
4913
5533
  ekycStatus: debouncedFilters.ekycStatus
@@ -5180,242 +5800,35 @@ const AssignEkycModal = _ref => {
5180
5800
  pageSizeLimit: pageSize,
5181
5801
  manualPagination: true,
5182
5802
  isPaginationRequired: true,
5183
- onNextPage: () => {
5184
- if (currentPage < ((applicationData === null || applicationData === void 0 ? void 0 : applicationData.totalPages) || 1) - 1) {
5185
- setCurrentPage(prev => prev + 1);
5186
- }
5187
- },
5188
- onPrevPage: () => {
5189
- if (currentPage > 0) {
5190
- setCurrentPage(prev => prev - 1);
5191
- }
5192
- },
5193
- onFirstPage: () => {
5194
- setCurrentPage(0);
5195
- },
5196
- onLastPage: () => {
5197
- setCurrentPage(Math.max(((applicationData === null || applicationData === void 0 ? void 0 : applicationData.totalPages) || 1) - 1, 0));
5198
- },
5199
- onPageSizeChange: e => {
5200
- setPageSize(Number(e.target.value));
5201
- setCurrentPage(0);
5202
- }
5203
- })), showToast && /*#__PURE__*/React.createElement(Toast, {
5204
- error: toastData.error,
5205
- label: toastData.label,
5206
- onClose: () => setShowToast(false)
5207
- }));
5208
- };
5209
-
5210
- const downloadSurveyorPDF = function (_ref) {
5211
- let rows = _ref.rows,
5212
- surveyorName = _ref.surveyorName,
5213
- employeeId = _ref.employeeId,
5214
- mobileNumber = _ref.mobileNumber,
5215
- vendorName = _ref.vendorName,
5216
- supervisorName = _ref.supervisorName,
5217
- dashboardInfo = _ref.dashboardInfo,
5218
- t = _ref.t;
5219
- try {
5220
- const tenantId = Digit.ULBService.getCurrentTenantId();
5221
- const initData = Digit.SessionStorage.get("initData");
5222
- const tenants = (initData === null || initData === void 0 ? void 0 : initData.tenants) || [];
5223
- const tenantInfo = tenants.find(tenant => tenant.code === tenantId);
5224
- const capitalize = text => text && text.substr(0, 1).toUpperCase() + text.substr(1);
5225
- const ulbCamel = ulb => ulb && ulb.toLowerCase().split(" ").map(capitalize).join(" ");
5226
- const name = "Delhi Jal Board";
5227
- const email = "contact@delhijalboard.nic.in";
5228
- const phoneNumber = "+91-11-23538416";
5229
- const currentDate = new Date();
5230
- const formattedDate = currentDate.toLocaleDateString("en-IN", {
5231
- day: "2-digit",
5232
- month: "2-digit",
5233
- year: "numeric"
5234
- });
5235
- const formattedTime = currentDate.toLocaleTimeString("en-IN", {
5236
- hour: "2-digit",
5237
- minute: "2-digit",
5238
- second: "2-digit",
5239
- hour12: false
5240
- });
5241
- const downloadDateTime = formattedDate + " " + formattedTime;
5242
- const isValDefined = val => val !== undefined && val !== null && val !== "";
5243
- const details = [{
5244
- title: t("SURVEYOR_DETAILS"),
5245
- asSectionHeader: true,
5246
- values: [{
5247
- title: t("SURVEYOR_NAME"),
5248
- value: surveyorName
5249
- }, {
5250
- title: t("MOBILE_NUMBER"),
5251
- value: mobileNumber
5252
- }, {
5253
- title: t("VENDOR_NAME"),
5254
- value: vendorName
5255
- }, {
5256
- title: t("SUPERVISOR_NAME"),
5257
- value: supervisorName
5258
- }].filter(item => isValDefined(item.value))
5259
- }, {
5260
- title: t("SUMMARY_STATISTICS"),
5261
- asSectionHeader: true,
5262
- values: [{
5263
- title: t("TOTAL_ASSIGNED"),
5264
- value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.total) || 0
5265
- }, {
5266
- title: t("COMPLETED"),
5267
- value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.completed) || 0
5268
- }, {
5269
- title: t("PENDING"),
5270
- value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.pending) || 0
5271
- }, {
5272
- title: t("SUBMITTED"),
5273
- value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.submittedCount) || 0
5274
- }].filter(item => isValDefined(item.value))
5275
- }];
5276
- if (window.Digit && window.Digit.Utils && window.Digit.Utils.pdf && window.Digit.Utils.pdf.generateSurveyorReport) {
5277
- window.Digit.Utils.pdf.generateSurveyorReport({
5278
- tenantId,
5279
- logo: null,
5280
- name,
5281
- email,
5282
- phoneNumber,
5283
- heading: t("EKYC_SURVEYOR_REPORT"),
5284
- details,
5285
- applicationNumber: employeeId,
5286
- rows,
5287
- t,
5288
- hideApplicationNumber: true,
5289
- downloadTime: downloadDateTime
5290
- });
5291
- } else {
5292
- console.error("Digit.Utils.pdf.generateSurveyorReport is not available");
5293
- }
5294
- return Promise.resolve();
5295
- } catch (e) {
5296
- return Promise.reject(e);
5297
- }
5298
- };
5299
- const downloadSupervisorPDF = function (_ref2) {
5300
- let rows = _ref2.rows,
5301
- supervisorName = _ref2.supervisorName,
5302
- mobileNumber = _ref2.mobileNumber,
5303
- vendorName = _ref2.vendorName,
5304
- dashboardInfo = _ref2.dashboardInfo,
5305
- t = _ref2.t;
5306
- try {
5307
- const tenantId = Digit.ULBService.getCurrentTenantId();
5308
- const name = "Delhi Jal Board";
5309
- const email = "contact@delhijalboard.nic.in";
5310
- const phoneNumber = "+91-11-23538416";
5311
- const currentDate = new Date();
5312
- const formattedDate = currentDate.toLocaleDateString("en-IN", {
5313
- day: "2-digit",
5314
- month: "2-digit",
5315
- year: "numeric"
5316
- });
5317
- const formattedTime = currentDate.toLocaleTimeString("en-IN", {
5318
- hour: "2-digit",
5319
- minute: "2-digit",
5320
- second: "2-digit",
5321
- hour12: false
5322
- });
5323
- const downloadDateTime = formattedDate + " " + formattedTime;
5324
- const isValDefined = val => val !== undefined && val !== null && val !== "";
5325
- const details = [{
5326
- title: t("SUPERVISOR_DETAILS") || "Supervisor Details",
5327
- asSectionHeader: true,
5328
- values: [{
5329
- title: t("SUPERVISOR_NAME") || "Supervisor Name",
5330
- value: supervisorName
5331
- }, {
5332
- title: t("MOBILE_NUMBER") || "Mobile Number",
5333
- value: mobileNumber
5334
- }, {
5335
- title: t("VENDOR_NAME") || "Vendor Name",
5336
- value: vendorName
5337
- }].filter(item => isValDefined(item.value))
5338
- }, {
5339
- title: t("SUMMARY_STATISTICS") || "Summary Statistics",
5340
- asSectionHeader: true,
5341
- values: [{
5342
- title: t("TOTAL_ASSIGNED") || "Total Assigned",
5343
- value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.total) || 0
5344
- }, {
5345
- title: t("COMPLETED") || "Completed",
5346
- value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.completed) || 0
5347
- }, {
5348
- title: t("PENDING") || "Pending",
5349
- value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.pending) || 0
5350
- }, {
5351
- title: t("SUBMITTED") || "Submitted",
5352
- value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.submittedCount) || 0
5353
- }].filter(item => isValDefined(item.value))
5354
- }];
5355
- const mappedRows = rows.map(row => {
5356
- var _row$owner, _row$owner2;
5357
- return {
5358
- kno: row.name || ((_row$owner = row.owner) === null || _row$owner === void 0 ? void 0 : _row$owner.name) || "N/A",
5359
- firstName: ((_row$owner2 = row.owner) === null || _row$owner2 === void 0 ? void 0 : _row$owner2.mobileNumber) || row.mobileNo || "N/A",
5360
- lastName: "",
5361
- mobileNo: row.status || "N/A",
5362
- zoneName: String(row.total || 0),
5363
- ekycStatus: (row.completed || 0) + " / " + (row.pending || 0),
5364
- submittedAt: 1717171717171,
5365
- progress: row.progress || "0%"
5366
- };
5367
- });
5368
- const originalToLocaleDateString = Date.prototype.toLocaleDateString;
5369
- let progressIndex = 0;
5370
- Date.prototype.toLocaleDateString = function () {
5371
- if (progressIndex < mappedRows.length) {
5372
- return mappedRows[progressIndex++].progress || "0%";
5373
- }
5374
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5375
- args[_key] = arguments[_key];
5803
+ onNextPage: () => {
5804
+ if (currentPage < ((applicationData === null || applicationData === void 0 ? void 0 : applicationData.totalPages) || 1) - 1) {
5805
+ setCurrentPage(prev => prev + 1);
5376
5806
  }
5377
- return originalToLocaleDateString.apply(this, args);
5378
- };
5379
- const customT = key => {
5380
- if (key === "KNO") return t("SURVEYOR_NAME") || "Surveyor Name";
5381
- if (key === "CONSUMER") return t("MOBILE_NUMBER") || "Mobile Number";
5382
- if (key === "MOBILE") return t("STATUS") || "Status";
5383
- if (key === "ZONE") return t("TOTAL_EKYC_APPLICATIONS") || "Total eKYC Applications";
5384
- if (key === "EKYC_STATUS") return t("COMPLETED_PENDING") || "Completed / Pending";
5385
- if (key === "SUBMITTED_DATE") return t("OVERALL_PROGRESS") || "Overall Progress";
5386
- if (key === "CONSUMER_LIST") return t("CONNECTED_SURVEYORS") || "Connected Surveyors";
5387
- return t(key);
5388
- };
5389
- try {
5390
- if (window.Digit && window.Digit.Utils && window.Digit.Utils.pdf && window.Digit.Utils.pdf.generateSurveyorReport) {
5391
- window.Digit.Utils.pdf.generateSurveyorReport({
5392
- tenantId,
5393
- logo: null,
5394
- name,
5395
- email,
5396
- phoneNumber,
5397
- heading: t("EKYC_SUPERVISOR_REPORT") || "eKYC Supervisor Report",
5398
- details,
5399
- applicationNumber: mobileNumber,
5400
- rows: mappedRows,
5401
- t: customT,
5402
- hideApplicationNumber: true,
5403
- downloadTime: downloadDateTime
5404
- });
5405
- } else {
5406
- console.error("Digit.Utils.pdf.generateSurveyorReport is not available");
5807
+ },
5808
+ onPrevPage: () => {
5809
+ if (currentPage > 0) {
5810
+ setCurrentPage(prev => prev - 1);
5407
5811
  }
5408
- } finally {
5409
- Date.prototype.toLocaleDateString = originalToLocaleDateString;
5812
+ },
5813
+ onFirstPage: () => {
5814
+ setCurrentPage(0);
5815
+ },
5816
+ onLastPage: () => {
5817
+ setCurrentPage(Math.max(((applicationData === null || applicationData === void 0 ? void 0 : applicationData.totalPages) || 1) - 1, 0));
5818
+ },
5819
+ onPageSizeChange: e => {
5820
+ setPageSize(Number(e.target.value));
5821
+ setCurrentPage(0);
5410
5822
  }
5411
- return Promise.resolve();
5412
- } catch (e) {
5413
- return Promise.reject(e);
5414
- }
5823
+ })), showToast && /*#__PURE__*/React.createElement(Toast, {
5824
+ error: toastData.error,
5825
+ label: toastData.label,
5826
+ onClose: () => setShowToast(false)
5827
+ }));
5415
5828
  };
5416
5829
 
5417
5830
  const SurveyorDetailsDashboard = () => {
5418
- var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _Digit$SessionStorage4, _surveyor$owner, _surveyor$owner2, _surveyor$owner3, _surveyor$owner4, _fullName$charAt, _dashboardData$dashbo, _dashboardData$dashbo2, _dashboardData$dashbo3, _dashboardData$dashbo4, _surveyor$owner7, _surveyor$owner8, _surveyor$owner9, _surveyor$additionalD, _dashboardData$dashbo5, _dashboardData$dashbo6;
5831
+ var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _Digit$SessionStorage4, _surveyor$owner, _surveyor$owner2, _surveyor$owner3, _surveyor$owner4, _fullName$charAt, _dashboardData$dashbo, _dashboardData$dashbo2, _dashboardData$dashbo3, _dashboardData$dashbo4, _surveyor$owner8, _surveyor$owner9, _surveyor$owner0, _surveyor$additionalD, _dashboardData$dashbo5, _dashboardData$dashbo6;
5419
5832
  const tenantId = Digit.ULBService.getCurrentTenantId();
5420
5833
  const _useState = useState(false),
5421
5834
  showModal = _useState[0],
@@ -5423,6 +5836,9 @@ const SurveyorDetailsDashboard = () => {
5423
5836
  const _useState2 = useState(false),
5424
5837
  showOptions = _useState2[0],
5425
5838
  setShowOptions = _useState2[1];
5839
+ const _useState3 = useState(false),
5840
+ ekycDownloadLoading = _useState3[0],
5841
+ setEkycDownloadLoading = _useState3[1];
5426
5842
  const _useParams = useParams(),
5427
5843
  surveyorId = _useParams.id;
5428
5844
  const ownerIds = (_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$SessionStorage2.uuid;
@@ -5478,12 +5894,12 @@ const SurveyorDetailsDashboard = () => {
5478
5894
  const fullName = (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner = surveyor.owner) === null || _surveyor$owner === void 0 ? void 0 : _surveyor$owner.name) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.name) || "N/A";
5479
5895
  const employeeId = (surveyor === null || surveyor === void 0 ? void 0 : surveyor.employeeId) || (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner2 = surveyor.owner) === null || _surveyor$owner2 === void 0 ? void 0 : _surveyor$owner2.uuid) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.id);
5480
5896
  const mobileNumber = (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner3 = surveyor.owner) === null || _surveyor$owner3 === void 0 ? void 0 : _surveyor$owner3.mobileNumber) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.mobileNo) || "N/A";
5481
- const _useState3 = useState(0),
5482
- currentPage = _useState3[0],
5483
- setCurrentPage = _useState3[1];
5484
- const _useState4 = useState(20),
5485
- pageSize = _useState4[0],
5486
- setPageSize = _useState4[1];
5897
+ const _useState4 = useState(0),
5898
+ currentPage = _useState4[0],
5899
+ setCurrentPage = _useState4[1];
5900
+ const _useState5 = useState(20),
5901
+ pageSize = _useState5[0],
5902
+ setPageSize = _useState5[1];
5487
5903
  const queryParams = {
5488
5904
  tenantId: "dl.djb",
5489
5905
  offset: currentPage * pageSize,
@@ -5525,21 +5941,21 @@ const SurveyorDetailsDashboard = () => {
5525
5941
  return value || "-";
5526
5942
  }
5527
5943
  }], []);
5528
- const _useState5 = useState(false),
5529
- showReportMenu = _useState5[0],
5530
- setShowReportMenu = _useState5[1];
5531
- const _useState6 = useState({
5944
+ const _useState6 = useState(false),
5945
+ showReportMenu = _useState6[0],
5946
+ setShowReportMenu = _useState6[1];
5947
+ const _useState7 = useState({
5532
5948
  from: "",
5533
5949
  to: ""
5534
5950
  }),
5535
- customDate = _useState6[0],
5536
- setCustomDate = _useState6[1];
5537
- const _useState7 = useState(false),
5538
- showCustomPicker = _useState7[0],
5539
- setShowCustomPicker = _useState7[1];
5951
+ customDate = _useState7[0],
5952
+ setCustomDate = _useState7[1];
5540
5953
  const _useState8 = useState(false),
5541
- reportLoading = _useState8[0],
5542
- setReportLoading = _useState8[1];
5954
+ showCustomPicker = _useState8[0],
5955
+ setShowCustomPicker = _useState8[1];
5956
+ const _useState9 = useState(false),
5957
+ reportLoading = _useState9[0],
5958
+ setReportLoading = _useState9[1];
5543
5959
  const reportMenuRef = useRef(null);
5544
5960
  useEffect(() => {
5545
5961
  const handler = e => {
@@ -5687,7 +6103,8 @@ const SurveyorDetailsDashboard = () => {
5687
6103
  let title = _ref3.title,
5688
6104
  value = _ref3.value,
5689
6105
  type = _ref3.type,
5690
- isLoading = _ref3.isLoading;
6106
+ isLoading = _ref3.isLoading,
6107
+ icon = _ref3.icon;
5691
6108
  return /*#__PURE__*/React.createElement("div", {
5692
6109
  className: "stat-card " + type
5693
6110
  }, isLoading ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
@@ -5698,7 +6115,9 @@ const SurveyorDetailsDashboard = () => {
5698
6115
  className: "stat-title"
5699
6116
  }, title), /*#__PURE__*/React.createElement("div", {
5700
6117
  className: "stat-value"
5701
- }, value)));
6118
+ }, value), icon && /*#__PURE__*/React.createElement("div", {
6119
+ className: "stat-icon"
6120
+ }, icon)));
5702
6121
  };
5703
6122
  const options = [{
5704
6123
  action: "Assign"
@@ -5707,6 +6126,77 @@ const SurveyorDetailsDashboard = () => {
5707
6126
  setShowOptions(false);
5708
6127
  setShowModal(true);
5709
6128
  };
6129
+ const handleDownloadEkycData = function () {
6130
+ try {
6131
+ setEkycDownloadLoading(true);
6132
+ return Promise.resolve(_finallyRethrows(function () {
6133
+ return _catch(function () {
6134
+ var _surveyor$owner7;
6135
+ return Promise.resolve(Digit.EkycService.application_list({
6136
+ tenantId: tenantId || "dl.djb",
6137
+ offset: 0,
6138
+ limit: 10000,
6139
+ surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner7 = surveyor.owner) === null || _surveyor$owner7 === void 0 ? void 0 : _surveyor$owner7.uuid,
6140
+ reportDownload: true
6141
+ })).then(function (response) {
6142
+ const consumerList = (response === null || response === void 0 ? void 0 : response.consumerList) || [];
6143
+ if (consumerList.length === 0) {
6144
+ alert(t("NO_DATA_FOUND") || "No data found for download.");
6145
+ return;
6146
+ }
6147
+ const excludedKeys = ["status", "source", "submittedAt", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "assignedTime", "isSelfAssigned", "userType", "tenantName", "tenantMobile"];
6148
+ const headerMapping = {
6149
+ kno: t("KNO") || "KNO",
6150
+ firstName: t("FIRST_NAME") || "First Name",
6151
+ middleName: t("MIDDLE_NAME") || "Middle Name",
6152
+ lastName: t("LAST_NAME") || "Last Name",
6153
+ gender: t("GENDER") || "Gender",
6154
+ mobileNumber: t("MOBILE_NUMBER") || "Mobile Number",
6155
+ emailId: t("EMAIL_ID") || "Email ID",
6156
+ fatherOrHusbandName: t("FATHER_HUSBUND_NAME") || "Father/Husband Name",
6157
+ relationship: t("RELATIONSHIP") || "Relationship",
6158
+ dob: t("DOB") || "Date of Birth",
6159
+ ekycStatus: t("EKYC_STATUS") || "eKYC Status",
6160
+ zoneName: t("ZONE") || "Zone",
6161
+ assembly: t("ASSEMBLY") || "Assembly",
6162
+ ward: t("WARD") || "Ward",
6163
+ pincode: t("PINCODE") || "Pincode",
6164
+ mrkey: t("MR_KEY") || "MR Key",
6165
+ createdTime: t("CREATED_TIME") || "Created Time",
6166
+ lastModifiedTime: t("LAST_MODIFIED_TIME") || "Last Modified Time"
6167
+ };
6168
+ const excelData = consumerList.map(item => {
6169
+ const cleanObj = {};
6170
+ const fullName = [item.firstName, item.middleName, item.lastName].filter(Boolean).join(" ");
6171
+ if (fullName) {
6172
+ cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = fullName;
6173
+ }
6174
+ Object.keys(item).forEach(key => {
6175
+ if (excludedKeys.includes(key)) return;
6176
+ const val = item[key];
6177
+ if (typeof val === "object" && val !== null) {
6178
+ return;
6179
+ }
6180
+ const friendlyHeader = headerMapping[key] || t(key.toUpperCase()) || key;
6181
+ cleanObj[friendlyHeader] = val;
6182
+ });
6183
+ return cleanObj;
6184
+ });
6185
+ const cleanFileName = "eKYC_Data_" + fullName.replace(/[^a-zA-Z0-9]/g, "_");
6186
+ Digit.Download.Excel(excelData, cleanFileName);
6187
+ });
6188
+ }, function (error) {
6189
+ console.error("Error downloading eKYC Excel:", error);
6190
+ });
6191
+ }, function (_wasThrown3, _result3) {
6192
+ setEkycDownloadLoading(false);
6193
+ if (_wasThrown3) throw _result3;
6194
+ return _result3;
6195
+ }));
6196
+ } catch (e) {
6197
+ return Promise.reject(e);
6198
+ }
6199
+ };
5710
6200
  const closeModal = function () {
5711
6201
  try {
5712
6202
  setShowModal(false);
@@ -5794,71 +6284,105 @@ const SurveyorDetailsDashboard = () => {
5794
6284
  title: t("TOTAL_ASSIGNED"),
5795
6285
  value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.total) || 0,
5796
6286
  type: "today",
5797
- isLoading: isDashboardLoading
6287
+ isLoading: isDashboardLoading,
6288
+ icon: /*#__PURE__*/React.createElement(FaUsers, null)
5798
6289
  }), /*#__PURE__*/React.createElement(StatCard, {
5799
6290
  title: t("COMPLETED"),
5800
6291
  value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo2 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo2 === void 0 ? void 0 : _dashboardData$dashbo2.completed) || 0,
5801
6292
  type: "week",
5802
- isLoading: isDashboardLoading
6293
+ isLoading: isDashboardLoading,
6294
+ icon: /*#__PURE__*/React.createElement(FaCheckCircle, null)
5803
6295
  }), /*#__PURE__*/React.createElement(StatCard, {
5804
6296
  title: t("PENDING"),
5805
6297
  value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo3 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo3 === void 0 ? void 0 : _dashboardData$dashbo3.pending) || 0,
5806
6298
  type: "pending",
5807
- isLoading: isDashboardLoading
6299
+ isLoading: isDashboardLoading,
6300
+ icon: /*#__PURE__*/React.createElement(FaClock, null)
5808
6301
  }), /*#__PURE__*/React.createElement(StatCard, {
5809
6302
  title: t("SUBMITTED"),
5810
6303
  value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo4 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo4 === void 0 ? void 0 : _dashboardData$dashbo4.submittedCount) || 0,
5811
6304
  type: "month",
5812
- isLoading: isDashboardLoading
6305
+ isLoading: isDashboardLoading,
6306
+ icon: /*#__PURE__*/React.createElement(FaChartLine, null)
5813
6307
  })), /*#__PURE__*/React.createElement("div", {
5814
6308
  className: "charts-wrapper"
5815
6309
  }), /*#__PURE__*/React.createElement("div", {
5816
6310
  className: "ekyc-dashboard-section"
6311
+ }, /*#__PURE__*/React.createElement("div", {
6312
+ className: "ekyc-details-wrapper"
6313
+ }, /*#__PURE__*/React.createElement("div", {
6314
+ className: "details-left"
5817
6315
  }, /*#__PURE__*/React.createElement("div", {
5818
6316
  className: "details-grid"
5819
6317
  }, /*#__PURE__*/React.createElement("div", {
5820
6318
  className: "detail-item"
5821
6319
  }, /*#__PURE__*/React.createElement("span", {
5822
6320
  className: "label"
5823
- }, t("MOBILE"), ":"), /*#__PURE__*/React.createElement("span", {
6321
+ }, t("MOBILE")), /*#__PURE__*/React.createElement("span", {
5824
6322
  className: "value"
5825
- }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner7 = surveyor.owner) === null || _surveyor$owner7 === void 0 ? void 0 : _surveyor$owner7.mobileNumber) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.mobileNo) || "N/A")), /*#__PURE__*/React.createElement("div", {
6323
+ }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner8 = surveyor.owner) === null || _surveyor$owner8 === void 0 ? void 0 : _surveyor$owner8.mobileNumber) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.mobileNo) || "N/A")), /*#__PURE__*/React.createElement("div", {
5826
6324
  className: "detail-item"
5827
6325
  }, /*#__PURE__*/React.createElement("span", {
5828
6326
  className: "label"
5829
- }, t("EMAIL"), ":"), /*#__PURE__*/React.createElement("span", {
6327
+ }, t("EMAIL")), /*#__PURE__*/React.createElement("span", {
5830
6328
  className: "value"
5831
- }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner8 = surveyor.owner) === null || _surveyor$owner8 === void 0 ? void 0 : _surveyor$owner8.emailId) || "N/A")), /*#__PURE__*/React.createElement("div", {
6329
+ }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner9 = surveyor.owner) === null || _surveyor$owner9 === void 0 ? void 0 : _surveyor$owner9.emailId) || "N/A")), /*#__PURE__*/React.createElement("div", {
5832
6330
  className: "detail-item"
5833
6331
  }, /*#__PURE__*/React.createElement("span", {
5834
6332
  className: "label"
5835
- }, t("GENDER"), ":"), /*#__PURE__*/React.createElement("span", {
6333
+ }, t("GENDER")), /*#__PURE__*/React.createElement("span", {
5836
6334
  className: "value"
5837
- }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner9 = surveyor.owner) === null || _surveyor$owner9 === void 0 ? void 0 : _surveyor$owner9.gender) || "N/A")), /*#__PURE__*/React.createElement("div", {
6335
+ }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner0 = surveyor.owner) === null || _surveyor$owner0 === void 0 ? void 0 : _surveyor$owner0.gender) || "N/A")), /*#__PURE__*/React.createElement("div", {
5838
6336
  className: "detail-item"
5839
6337
  }, /*#__PURE__*/React.createElement("span", {
5840
6338
  className: "label"
5841
- }, t("STATUS"), ":"), /*#__PURE__*/React.createElement("span", {
6339
+ }, t("STATUS")), /*#__PURE__*/React.createElement("span", {
5842
6340
  className: "value"
5843
6341
  }, (surveyor === null || surveyor === void 0 ? void 0 : surveyor.status) || "N/A")), /*#__PURE__*/React.createElement("div", {
5844
6342
  className: "detail-item"
5845
6343
  }, /*#__PURE__*/React.createElement("span", {
5846
6344
  className: "label"
5847
- }, t("SERVICE_TYPE"), ":"), /*#__PURE__*/React.createElement("span", {
6345
+ }, t("SERVICE_TYPE")), /*#__PURE__*/React.createElement("span", {
5848
6346
  className: "value"
5849
6347
  }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$additionalD = surveyor.additionalDetails) === null || _surveyor$additionalD === void 0 ? void 0 : _surveyor$additionalD.serviceType) || "N/A")), /*#__PURE__*/React.createElement("div", {
5850
6348
  className: "detail-item"
5851
6349
  }, /*#__PURE__*/React.createElement("span", {
5852
6350
  className: "label"
5853
- }, t("VENDOR_NAME") || "Vendor Name", ":"), /*#__PURE__*/React.createElement("span", {
6351
+ }, t("VENDOR_NAME") || "Vendor Name"), /*#__PURE__*/React.createElement("span", {
5854
6352
  className: "value"
5855
6353
  }, vendorName)), /*#__PURE__*/React.createElement("div", {
5856
6354
  className: "detail-item"
5857
6355
  }, /*#__PURE__*/React.createElement("span", {
5858
6356
  className: "label"
5859
- }, t("SUPERVISOR_NAME") || "Supervisor Name", ":"), /*#__PURE__*/React.createElement("span", {
6357
+ }, t("SUPERVISOR_NAME") || "Supervisor Name"), /*#__PURE__*/React.createElement("span", {
5860
6358
  className: "value"
5861
- }, supervisorName)))), /*#__PURE__*/React.createElement(Card, {
6359
+ }, supervisorName)))), /*#__PURE__*/React.createElement("div", {
6360
+ className: "details-right"
6361
+ }, /*#__PURE__*/React.createElement("div", {
6362
+ className: "download-card"
6363
+ }, /*#__PURE__*/React.createElement("h4", null, t("DOWNLOAD_EKYC_DATA") || "Download eKYC Data"), /*#__PURE__*/React.createElement("p", null, t("DOWNLOAD_EKYC_DATA_DESC") || "Export the complete eKYC verification records for your assigned jurisdiction into Excel format."), /*#__PURE__*/React.createElement("button", {
6364
+ className: "download-excel-btn",
6365
+ disabled: ekycDownloadLoading,
6366
+ onClick: handleDownloadEkycData
6367
+ }, /*#__PURE__*/React.createElement("svg", {
6368
+ width: "16",
6369
+ height: "16",
6370
+ viewBox: "0 0 24 24",
6371
+ fill: "none",
6372
+ stroke: "currentColor",
6373
+ strokeWidth: "2.5",
6374
+ strokeLinecap: "round",
6375
+ strokeLinejoin: "round"
6376
+ }, /*#__PURE__*/React.createElement("path", {
6377
+ d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
6378
+ }), /*#__PURE__*/React.createElement("polyline", {
6379
+ points: "7 10 12 15 17 10"
6380
+ }), /*#__PURE__*/React.createElement("line", {
6381
+ x1: "12",
6382
+ y1: "15",
6383
+ x2: "12",
6384
+ y2: "3"
6385
+ })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel"))))), /*#__PURE__*/React.createElement(Card, {
5862
6386
  className: "dashboard-card"
5863
6387
  }, /*#__PURE__*/React.createElement(Table, {
5864
6388
  t: t,
@@ -5870,6 +6394,7 @@ const SurveyorDetailsDashboard = () => {
5870
6394
  totalRecords: dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo6 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo6 === void 0 ? void 0 : _dashboardData$dashbo6.total,
5871
6395
  currentPage: currentPage,
5872
6396
  pageSizeLimit: pageSize,
6397
+ showAutoSerialNo: true,
5873
6398
  isPaginationRequired: true,
5874
6399
  onNextPage: () => {
5875
6400
  var _dashboardData$dashbo7;
@@ -6084,8 +6609,7 @@ const AssignEkyc = () => {
6084
6609
  enabled: !!tenantId,
6085
6610
  keepPreviousData: true
6086
6611
  }),
6087
- isDataSearchLoading = _Digit$Hooks$ekyc$use.isLoading,
6088
- data = _Digit$Hooks$ekyc$use.data;
6612
+ isDataSearchLoading = _Digit$Hooks$ekyc$use.isLoading;
6089
6613
  const sourceData = useMemo(() => {
6090
6614
  return (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.surveyors) || [];
6091
6615
  }, [dashboardData]);
@@ -6191,62 +6715,411 @@ const AssignEkyc = () => {
6191
6715
  });
6192
6716
  }
6193
6717
  }
6194
- };
6195
- const propsForInboxTable = SupervisorInboxTableConfig(_extends({}, {
6196
- onPageSizeChange,
6197
- formState,
6198
- totalCount: totalRecords,
6199
- table: filteredData,
6200
- dispatch,
6201
- onSortingByData,
6202
- tenantId,
6203
- inboxStyles: {
6204
- overflowX: "scroll",
6205
- overflowY: "hidden"
6206
- },
6207
- tableStyle: {
6208
- width: "70%"
6718
+ };
6719
+ const propsForInboxTable = SupervisorInboxTableConfig(_extends({}, {
6720
+ onPageSizeChange,
6721
+ formState,
6722
+ totalCount: totalRecords,
6723
+ table: filteredData,
6724
+ dispatch,
6725
+ onSortingByData,
6726
+ tenantId,
6727
+ inboxStyles: {
6728
+ overflowX: "scroll",
6729
+ overflowY: "hidden"
6730
+ },
6731
+ tableStyle: {
6732
+ width: "70%"
6733
+ }
6734
+ }));
6735
+ const isInboxLoading = isLoading;
6736
+ return /*#__PURE__*/React.createElement("div", {
6737
+ className: "app-container"
6738
+ }, /*#__PURE__*/React.createElement(InboxComposer, _extends({
6739
+ isInboxLoading
6740
+ }, propsForSearchForm, {
6741
+ propsForInboxTable,
6742
+ formState,
6743
+ countData: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
6744
+ isCardLoading: isDataSearchLoading
6745
+ })));
6746
+ };
6747
+
6748
+ const AdminDashboard = () => {
6749
+ var _Digit$SessionStorage, _loggedInUser$roles, _fullName$charAt;
6750
+ const _useTranslation = useTranslation(),
6751
+ t = _useTranslation.t;
6752
+ const history = useHistory();
6753
+ let tenantId = Digit.ULBService.getCurrentTenantId();
6754
+ if (!tenantId || tenantId === "dl") {
6755
+ tenantId = "dl.djb";
6756
+ }
6757
+ const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
6758
+ const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
6759
+ status: "ACTIVE"
6760
+ }, {
6761
+ enabled: !!tenantId
6762
+ }),
6763
+ vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
6764
+ isVendorSearchLoading = _Digit$Hooks$fsm$useD.isLoading;
6765
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycAssignmentProgress({
6766
+ enabled: !!tenantId,
6767
+ keepPreviousData: true
6768
+ }),
6769
+ progressData = _Digit$Hooks$ekyc$use.data,
6770
+ isProgressLoading = _Digit$Hooks$ekyc$use.isLoading;
6771
+ const vendorsList = useMemo(() => {
6772
+ if (vendorSearchResponse && vendorSearchResponse.length > 0) {
6773
+ return vendorSearchResponse.map(v => {
6774
+ var _progressData$supervi, _dso$owner, _v$owner, _dso$owner2;
6775
+ const dso = v.dsoDetails || v;
6776
+ const supervisorsList = dso.supervisors || [];
6777
+ const surveyorsList = dso.surveyors || [];
6778
+ const supervisorIds = supervisorsList.map(s => {
6779
+ var _s$owner;
6780
+ return s.id || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : _s$owner.uuid);
6781
+ }).filter(Boolean);
6782
+ const matchedReports = (progressData === null || progressData === void 0 ? void 0 : (_progressData$supervi = progressData.supervisorReport) === null || _progressData$supervi === void 0 ? void 0 : _progressData$supervi.filter(r => supervisorIds.includes(r.supervisorId))) || [];
6783
+ const completed = matchedReports.reduce((acc, r) => acc + (r.submittedKnos || 0), 0);
6784
+ const pending = matchedReports.reduce((acc, r) => acc + (r.pendingKnos || 0), 0);
6785
+ const total = matchedReports.reduce((acc, r) => acc + (r.totalKnos || 0), 0);
6786
+ const progress = total > 0 ? Math.round(completed / total * 100) : 0;
6787
+ const rejected = 0;
6788
+ return {
6789
+ id: dso.id || dso.vendorId || v.id || v.vendorId,
6790
+ name: dso.name || dso.displayName || v.name || "N/A",
6791
+ ownerName: ((_dso$owner = dso.owner) === null || _dso$owner === void 0 ? void 0 : _dso$owner.name) || ((_v$owner = v.owner) === null || _v$owner === void 0 ? void 0 : _v$owner.name) || "N/A",
6792
+ mobileNumber: dso.mobileNumber || ((_dso$owner2 = dso.owner) === null || _dso$owner2 === void 0 ? void 0 : _dso$owner2.mobileNumber) || v.mobileNumber || "N/A",
6793
+ supervisors: supervisorsList.length,
6794
+ surveyors: surveyorsList.length,
6795
+ completed: completed,
6796
+ progress: progress,
6797
+ pending: pending,
6798
+ rejected: rejected
6799
+ };
6800
+ });
6801
+ }
6802
+ return [];
6803
+ }, [vendorSearchResponse, progressData]);
6804
+ const _useState = useState(false),
6805
+ ekycDownloadLoading = _useState[0],
6806
+ setEkycDownloadLoading = _useState[1];
6807
+ const _useState2 = useState(0),
6808
+ currentPage = _useState2[0];
6809
+ const _useState3 = useState(20),
6810
+ pageSize = _useState3[0];
6811
+ const _Digit$Hooks$ekyc$use2 = Digit.Hooks.ekyc.useEkycApplicationList({}, {
6812
+ tenantId,
6813
+ offset: currentPage * pageSize,
6814
+ limit: pageSize
6815
+ }, {
6816
+ keepPreviousData: true
6817
+ });
6818
+ const fullName = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.name) || "Admin";
6819
+ const mobileNumber = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.mobileNumber) || "N/A";
6820
+ const roleText = (loggedInUser === null || loggedInUser === void 0 ? void 0 : (_loggedInUser$roles = loggedInUser.roles) === null || _loggedInUser$roles === void 0 ? void 0 : _loggedInUser$roles.map(r => r.name).join(", ")) || "EKYC Admin";
6821
+ const handleDownloadEkycData = function () {
6822
+ try {
6823
+ setEkycDownloadLoading(true);
6824
+ return Promise.resolve(_finallyRethrows(function () {
6825
+ return _catch(function () {
6826
+ return Promise.resolve(Digit.EkycService.application_list({
6827
+ tenantId: tenantId,
6828
+ offset: 0,
6829
+ limit: 10000,
6830
+ reportDownload: true
6831
+ })).then(function (response) {
6832
+ const consumerList = (response === null || response === void 0 ? void 0 : response.consumerList) || [];
6833
+ if (consumerList.length === 0) {
6834
+ alert(t("NO_DATA_FOUND") || "No data found for download.");
6835
+ return;
6836
+ }
6837
+ const excludedKeys = ["status", "source", "submittedAt", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "assignedTime", "isSelfAssigned", "userType", "tenantName", "tenantMobile"];
6838
+ const headerMapping = {
6839
+ kno: t("KNO") || "KNO",
6840
+ firstName: t("FIRST_NAME") || "First Name",
6841
+ middleName: t("MIDDLE_NAME") || "Middle Name",
6842
+ lastName: t("LAST_NAME") || "Last Name",
6843
+ gender: t("GENDER") || "Gender",
6844
+ mobileNumber: t("MOBILE_NUMBER") || "Mobile Number",
6845
+ emailId: t("EMAIL_ID") || "Email ID",
6846
+ fatherOrHusbandName: t("FATHER_HUSBUND_NAME") || "Father/Husband Name",
6847
+ relationship: t("RELATIONSHIP") || "Relationship",
6848
+ dob: t("DOB") || "Date of Birth",
6849
+ ekycStatus: t("EKYC_STATUS") || "eKYC Status",
6850
+ zoneName: t("ZONE") || "Zone",
6851
+ assembly: t("ASSEMBLY") || "Assembly",
6852
+ ward: t("WARD") || "Ward",
6853
+ pincode: t("PINCODE") || "Pincode",
6854
+ mrkey: t("MR_KEY") || "MR Key",
6855
+ createdTime: t("CREATED_TIME") || "Created Time",
6856
+ lastModifiedTime: t("LAST_MODIFIED_TIME") || "Last Modified Time"
6857
+ };
6858
+ const excelData = consumerList.map(item => {
6859
+ const cleanObj = {};
6860
+ const name = [item.firstName, item.middleName, item.lastName].filter(Boolean).join(" ");
6861
+ if (name) {
6862
+ cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = name;
6863
+ }
6864
+ Object.keys(item).forEach(key => {
6865
+ if (excludedKeys.includes(key)) return;
6866
+ const val = item[key];
6867
+ if (typeof val === "object" && val !== null) {
6868
+ return;
6869
+ }
6870
+ const friendlyHeader = headerMapping[key] || t(key.toUpperCase()) || key;
6871
+ cleanObj[friendlyHeader] = val;
6872
+ });
6873
+ return cleanObj;
6874
+ });
6875
+ const cleanFileName = "eKYC_All_Data_Admin_" + fullName.replace(/[^a-zA-Z0-9]/g, "_");
6876
+ Digit.Download.Excel(excelData, cleanFileName);
6877
+ });
6878
+ }, function (error) {
6879
+ console.error("Error downloading eKYC Excel:", error);
6880
+ });
6881
+ }, function (_wasThrown, _result) {
6882
+ setEkycDownloadLoading(false);
6883
+ if (_wasThrown) throw _result;
6884
+ return _result;
6885
+ }));
6886
+ } catch (e) {
6887
+ return Promise.reject(e);
6888
+ }
6889
+ };
6890
+ return /*#__PURE__*/React.createElement(Card, {
6891
+ className: "surveyor-dashboard"
6892
+ }, /*#__PURE__*/React.createElement("div", {
6893
+ className: "ekyc-dashboard-section"
6894
+ }, /*#__PURE__*/React.createElement("div", {
6895
+ className: "ekyc-dashboard-header"
6896
+ }, /*#__PURE__*/React.createElement("div", {
6897
+ className: "avatar"
6898
+ }, fullName === null || fullName === void 0 ? void 0 : (_fullName$charAt = fullName.charAt(0)) === null || _fullName$charAt === void 0 ? void 0 : _fullName$charAt.toUpperCase()), /*#__PURE__*/React.createElement("div", {
6899
+ className: "header-content"
6900
+ }, /*#__PURE__*/React.createElement("h2", {
6901
+ className: "name"
6902
+ }, fullName), /*#__PURE__*/React.createElement("div", {
6903
+ className: "designation"
6904
+ }, t("EKYC_ADMIN") || "eKYC Admin / Manager"), /*#__PURE__*/React.createElement("div", {
6905
+ className: "mobile-number"
6906
+ }, mobileNumber))), /*#__PURE__*/React.createElement("button", {
6907
+ className: "download-excel-btn",
6908
+ disabled: ekycDownloadLoading,
6909
+ onClick: handleDownloadEkycData,
6910
+ style: {
6911
+ margin: 0,
6912
+ padding: "8px 16px",
6913
+ height: "auto",
6914
+ minHeight: "36px",
6915
+ width: "auto"
6916
+ }
6917
+ }, /*#__PURE__*/React.createElement("svg", {
6918
+ width: "16",
6919
+ height: "16",
6920
+ viewBox: "0 0 24 24",
6921
+ fill: "none",
6922
+ stroke: "currentColor",
6923
+ strokeWidth: "2.5",
6924
+ strokeLinecap: "round",
6925
+ strokeLinejoin: "round",
6926
+ style: {
6927
+ marginRight: "8px"
6928
+ }
6929
+ }, /*#__PURE__*/React.createElement("path", {
6930
+ d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
6931
+ }), /*#__PURE__*/React.createElement("polyline", {
6932
+ points: "7 10 12 15 17 10"
6933
+ }), /*#__PURE__*/React.createElement("line", {
6934
+ x1: "12",
6935
+ y1: "15",
6936
+ x2: "12",
6937
+ y2: "3"
6938
+ })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel")), /*#__PURE__*/React.createElement("div", {
6939
+ style: {
6940
+ marginTop: "32px"
6941
+ }
6942
+ }, /*#__PURE__*/React.createElement("h3", {
6943
+ style: {
6944
+ fontSize: "20px",
6945
+ fontWeight: "700",
6946
+ color: "#101828",
6947
+ marginBottom: "20px"
6948
+ }
6949
+ }, t("EKYC_VENDORS_PERFORMANCE") || "eKYC Vendors Performance"), isVendorSearchLoading || isProgressLoading ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement("div", {
6950
+ style: {
6951
+ display: "grid",
6952
+ gridTemplateColumns: "repeat(3, 1fr)",
6953
+ gap: "24px",
6954
+ width: "100%"
6955
+ }
6956
+ }, vendorsList.length === 0 ? /*#__PURE__*/React.createElement("div", {
6957
+ style: {
6958
+ gridColumn: "span 3",
6959
+ textAlign: "center",
6960
+ padding: "40px",
6961
+ color: "#64748B",
6962
+ fontSize: "16px"
6963
+ }
6964
+ }, t("NO_VENDORS_FOUND") || "No vendors found.") : vendorsList.map(vendor => /*#__PURE__*/React.createElement("div", {
6965
+ key: vendor.id,
6966
+ onClick: () => history.push("/digit-ui/employee/ekyc/vendors/" + vendor.id),
6967
+ style: {
6968
+ background: "#ffffff",
6969
+ border: "1px solid #E2E8F0",
6970
+ borderRadius: "16px",
6971
+ padding: "24px",
6972
+ boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03)",
6973
+ cursor: "pointer",
6974
+ transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
6975
+ display: "flex",
6976
+ flexDirection: "column",
6977
+ justifyContent: "space-between",
6978
+ gap: "16px"
6979
+ },
6980
+ onMouseEnter: e => {
6981
+ e.currentTarget.style.transform = "translateY(-4px)";
6982
+ e.currentTarget.style.boxShadow = "0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04)";
6983
+ e.currentTarget.style.borderColor = "#CBD5E1";
6984
+ },
6985
+ onMouseLeave: e => {
6986
+ e.currentTarget.style.transform = "translateY(0)";
6987
+ e.currentTarget.style.boxShadow = "0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03)";
6988
+ e.currentTarget.style.borderColor = "#E2E8F0";
6989
+ }
6990
+ }, /*#__PURE__*/React.createElement("div", {
6991
+ style: {
6992
+ display: "flex",
6993
+ justifyContent: "space-between",
6994
+ alignItems: "flex-start"
6995
+ }
6996
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h4", {
6997
+ style: {
6998
+ fontSize: "18px",
6999
+ fontWeight: "700",
7000
+ color: "#0B2559",
7001
+ margin: 0
7002
+ }
7003
+ }, vendor.name), /*#__PURE__*/React.createElement("p", {
7004
+ style: {
7005
+ fontSize: "12px",
7006
+ color: "#64748B",
7007
+ marginTop: "2px",
7008
+ marginBottom: 0
7009
+ }
7010
+ }, t("MOBILE") || "Mobile", ": ", vendor.mobileNumber)), /*#__PURE__*/React.createElement("span", {
7011
+ style: {
7012
+ background: "#E0F2FE",
7013
+ color: "#0369A1",
7014
+ padding: "6px 12px",
7015
+ borderRadius: "999px",
7016
+ fontSize: "13px",
7017
+ fontWeight: "700"
7018
+ }
7019
+ }, vendor.progress, "%")), /*#__PURE__*/React.createElement("div", {
7020
+ style: {
7021
+ width: "100%",
7022
+ height: "8px",
7023
+ background: "#F1F5F9",
7024
+ borderRadius: "999px",
7025
+ overflow: "hidden"
7026
+ }
7027
+ }, /*#__PURE__*/React.createElement("div", {
7028
+ style: {
7029
+ width: vendor.progress + "%",
7030
+ height: "100%",
7031
+ background: "linear-gradient(90deg, #3B82F6 0%, #10B981 100%)",
7032
+ borderRadius: "999px"
7033
+ }
7034
+ })), /*#__PURE__*/React.createElement("div", {
7035
+ style: {
7036
+ display: "grid",
7037
+ gridTemplateColumns: "repeat(3, 1fr)",
7038
+ gap: "12px"
7039
+ }
7040
+ }, /*#__PURE__*/React.createElement("div", {
7041
+ style: {
7042
+ background: "#F8FAFC",
7043
+ padding: "12px 8px",
7044
+ borderRadius: "10px",
7045
+ textAlign: "center"
7046
+ }
7047
+ }, /*#__PURE__*/React.createElement("div", {
7048
+ style: {
7049
+ fontSize: "16px",
7050
+ fontWeight: "700",
7051
+ color: "#1E293B"
6209
7052
  }
6210
- }));
6211
- const isInboxLoading = isLoading;
6212
- const cards = [{
6213
- label: "TOTAL_EKYC_APPLICATIONS",
6214
- count: (data === null || data === void 0 ? void 0 : data.totalKnos) || 0,
6215
- color: "#0B2559",
6216
- filter: null,
6217
- active: true
6218
- }, {
6219
- label: "TOTAL_ASSIGNMENTS",
6220
- count: (data === null || data === void 0 ? void 0 : data.totalAssignments) || 0,
6221
- color: "#3B82F6",
6222
- filter: ["ASSIGNED"]
6223
- }, {
6224
- label: "EKYC_COMPLETED",
6225
- count: (data === null || data === void 0 ? void 0 : data.completedKnos) || 0,
6226
- color: "#10B981",
6227
- filter: ["COMPLETED"]
6228
- }, {
6229
- label: "PENDING_APPLICATIONS",
6230
- count: ((data === null || data === void 0 ? void 0 : data.totalKnos) || 0) - ((data === null || data === void 0 ? void 0 : data.completedKnos) || 0),
6231
- color: "#F59E0B",
6232
- filter: ["PENDING"]
6233
- }, {
6234
- label: "OVERALL_PROGRESS",
6235
- count: ((data === null || data === void 0 ? void 0 : data.overallProgressPercent) || 0) + "%",
6236
- color: "#A855F7",
6237
- filter: ["IN_PROGRESS"]
6238
- }];
6239
- return /*#__PURE__*/React.createElement("div", {
6240
- className: "app-container"
6241
- }, /*#__PURE__*/React.createElement(InboxComposer, _extends({
6242
- isInboxLoading
6243
- }, propsForSearchForm, {
6244
- propsForInboxTable,
6245
- formState,
6246
- countData: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
6247
- cards,
6248
- isCardLoading: isDataSearchLoading
6249
- })));
7053
+ }, vendor.supervisors), /*#__PURE__*/React.createElement("div", {
7054
+ style: {
7055
+ fontSize: "10px",
7056
+ fontWeight: "600",
7057
+ color: "#64748B",
7058
+ textTransform: "uppercase",
7059
+ marginTop: "4px"
7060
+ }
7061
+ }, t("SUPERVISORS") || "Supervisors")), /*#__PURE__*/React.createElement("div", {
7062
+ style: {
7063
+ background: "#F8FAFC",
7064
+ padding: "12px 8px",
7065
+ borderRadius: "10px",
7066
+ textAlign: "center"
7067
+ }
7068
+ }, /*#__PURE__*/React.createElement("div", {
7069
+ style: {
7070
+ fontSize: "16px",
7071
+ fontWeight: "700",
7072
+ color: "#1E293B"
7073
+ }
7074
+ }, vendor.surveyors), /*#__PURE__*/React.createElement("div", {
7075
+ style: {
7076
+ fontSize: "10px",
7077
+ fontWeight: "600",
7078
+ color: "#64748B",
7079
+ textTransform: "uppercase",
7080
+ marginTop: "4px"
7081
+ }
7082
+ }, t("SURVEYORS") || "Surveyors")), /*#__PURE__*/React.createElement("div", {
7083
+ style: {
7084
+ background: "#F8FAFC",
7085
+ padding: "12px 8px",
7086
+ borderRadius: "10px",
7087
+ textAlign: "center"
7088
+ }
7089
+ }, /*#__PURE__*/React.createElement("div", {
7090
+ style: {
7091
+ fontSize: "16px",
7092
+ fontWeight: "700",
7093
+ color: "#10B981"
7094
+ }
7095
+ }, vendor.completed), /*#__PURE__*/React.createElement("div", {
7096
+ style: {
7097
+ fontSize: "10px",
7098
+ fontWeight: "600",
7099
+ color: "#64748B",
7100
+ textTransform: "uppercase",
7101
+ marginTop: "4px"
7102
+ }
7103
+ }, t("COMPLETED") || "Completed"))), /*#__PURE__*/React.createElement("div", {
7104
+ style: {
7105
+ display: "flex",
7106
+ justifyContent: "space-between",
7107
+ fontSize: "12px",
7108
+ color: "#64748B",
7109
+ borderTop: "1px solid #F1F5F9",
7110
+ paddingTop: "12px"
7111
+ }
7112
+ }, /*#__PURE__*/React.createElement("span", null, t("PENDING") || "Pending", ": ", /*#__PURE__*/React.createElement("span", {
7113
+ style: {
7114
+ fontWeight: "700",
7115
+ color: "#F59E0B"
7116
+ }
7117
+ }, vendor.pending)), /*#__PURE__*/React.createElement("span", null, t("REJECTED") || "Rejected", ": ", /*#__PURE__*/React.createElement("span", {
7118
+ style: {
7119
+ fontWeight: "700",
7120
+ color: "#EF4444"
7121
+ }
7122
+ }, vendor.rejected))))))));
6250
7123
  };
6251
7124
 
6252
7125
  const EmployeeApp = _ref => {
@@ -6308,6 +7181,10 @@ const EmployeeApp = _ref => {
6308
7181
  crumbs.push({
6309
7182
  label: t("CEO_M.F_DOR_FINANCE_VIEW")
6310
7183
  });
7184
+ } else if (pathname.includes("/admin-dashboard")) {
7185
+ crumbs.push({
7186
+ label: t("EKYC_ADMIN_DASHBOARD") || "Admin Dashboard"
7187
+ });
6311
7188
  } else if (pathname.includes("/vendors/")) {
6312
7189
  crumbs.push({
6313
7190
  label: t("EKYC_VENDOR_DETAILS")
@@ -6397,11 +7274,16 @@ const EmployeeApp = _ref => {
6397
7274
  component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
6398
7275
  layoutClass: "normal"
6399
7276
  }, /*#__PURE__*/React.createElement(CeoDashboard, null))
7277
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
7278
+ path: path + "/admin-dashboard",
7279
+ component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
7280
+ layoutClass: "normal"
7281
+ }, /*#__PURE__*/React.createElement(AdminDashboard, null))
6400
7282
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
6401
7283
  path: path + "/vendors/:vendorId",
6402
7284
  component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
6403
7285
  layoutClass: "normal"
6404
- }, /*#__PURE__*/React.createElement(VendorDetails, null))
7286
+ }, /*#__PURE__*/React.createElement(VendorDetailsCard, null))
6405
7287
  })))));
6406
7288
  };
6407
7289
 
@@ -7462,6 +8344,12 @@ const Home = () => {
7462
8344
  link: "/digit-ui/citizen/ekyc/supervisor-dashboard"
7463
8345
  });
7464
8346
  }
8347
+ if (roles.includes("EKYC_VENDOR")) {
8348
+ propsForModuleCard.links.push({
8349
+ label: t("EKYC_VENDOR_DASHBOARD"),
8350
+ link: "/digit-ui/citizen/ekyc/vendor-dashboard"
8351
+ });
8352
+ }
7465
8353
  if (roles.includes("EKYC_SUPERVISOR") || roles.includes("EKYC_VENDOR")) {
7466
8354
  propsForModuleCard.links.push({
7467
8355
  label: t("TITLE_VENDOR_MANAGEMENT"),
@@ -7726,119 +8614,50 @@ const Inbox$1 = _ref => {
7726
8614
  })));
7727
8615
  };
7728
8616
 
7729
- const SurveyorStatsCell = _ref => {
7730
- let surveyorId = _ref.surveyorId,
7731
- type = _ref.type;
7732
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycSurveyorDashboard({}, {
7733
- tenantId: "dl.djb",
7734
- offset: 0,
7735
- limit: 1,
7736
- surveyorId: surveyorId
7737
- }, {
7738
- enabled: !!surveyorId,
7739
- staleTime: 60000
7740
- }),
7741
- data = _Digit$Hooks$ekyc$use.data,
7742
- isLoading = _Digit$Hooks$ekyc$use.isLoading;
7743
- if (isLoading) return "...";
7744
- const dashboardInfo = (data === null || data === void 0 ? void 0 : data.dashboardInfo) || {};
7745
- const total = (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.total) || 0;
7746
- const completed = (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.completed) || 0;
7747
- const pending = (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.pending) || 0;
7748
- const progress = total > 0 ? Math.round(completed / total * 100) + "%" : "0%";
7749
- if (type === "total") return total;
7750
- if (type === "completed") return completed;
7751
- if (type === "pending") return pending;
7752
- if (type === "progress") return progress;
7753
- return null;
7754
- };
7755
8617
  const SupervisorDetailsCard = () => {
7756
- var _Digit$SessionStorage, _Digit$SessionStorage2, _supervisor$owner, _supervisor$owner3, _fullName$charAt, _supervisor$owner6, _supervisor$owner7, _supervisor$owner8, _supervisor$additiona;
8618
+ var _Digit$SessionStorage, _fullName$charAt;
7757
8619
  const _useTranslation = useTranslation(),
7758
8620
  t = _useTranslation.t;
7759
8621
  const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
7760
8622
  const _useParams = useParams(),
7761
8623
  supervisorId = _useParams.id;
7762
- const ownerIds = (_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$SessionStorage2.uuid;
7763
- const searchParams = supervisorId ? {
7764
- ids: supervisorId
7765
- } : {
7766
- ownerIds
7767
- };
7768
- const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorSearch(tenantId, searchParams, {
7769
- staleTime: Infinity
7770
- }),
7771
- supervisorSearchResponse = _Digit$Hooks$fsm$useS.data,
7772
- isSupervisorSearchLoading = _Digit$Hooks$fsm$useS.isLoading;
7773
- const supervisor = useMemo(() => {
7774
- var _supervisorSearchResp;
7775
- return (supervisorSearchResponse === null || supervisorSearchResponse === void 0 ? void 0 : (_supervisorSearchResp = supervisorSearchResponse.supervisors) === null || _supervisorSearchResp === void 0 ? void 0 : _supervisorSearchResp[0]) || null;
7776
- }, [supervisorSearchResponse]);
7777
- const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
7778
- status: "ACTIVE"
7779
- }, {
7780
- enabled: !!tenantId
7781
- }),
7782
- vendorData = _Digit$Hooks$fsm$useD.data;
7783
- const vendorName = useMemo(() => {
7784
- var _mappedVendor$dsoDeta;
7785
- if (!vendorData || !(supervisor !== null && supervisor !== void 0 && supervisor.vendorId)) return "N/A";
7786
- const mappedVendor = vendorData.find(v => {
7787
- var _v$dsoDetails, _v$dsoDetails2;
7788
- return ((_v$dsoDetails = v.dsoDetails) === null || _v$dsoDetails === void 0 ? void 0 : _v$dsoDetails.id) === supervisor.vendorId || ((_v$dsoDetails2 = v.dsoDetails) === null || _v$dsoDetails2 === void 0 ? void 0 : _v$dsoDetails2.vendorId) === supervisor.vendorId;
7789
- });
7790
- return (mappedVendor === null || mappedVendor === void 0 ? void 0 : (_mappedVendor$dsoDeta = mappedVendor.dsoDetails) === null || _mappedVendor$dsoDeta === void 0 ? void 0 : _mappedVendor$dsoDeta.name) || supervisor.vendorId || "N/A";
7791
- }, [vendorData, supervisor === null || supervisor === void 0 ? void 0 : supervisor.vendorId]);
7792
- const fullName = (supervisor === null || supervisor === void 0 ? void 0 : (_supervisor$owner = supervisor.owner) === null || _supervisor$owner === void 0 ? void 0 : _supervisor$owner.name) || (supervisor === null || supervisor === void 0 ? void 0 : supervisor.name) || "N/A";
7793
- const mobileNumber = (supervisor === null || supervisor === void 0 ? void 0 : (_supervisor$owner3 = supervisor.owner) === null || _supervisor$owner3 === void 0 ? void 0 : _supervisor$owner3.mobileNumber) || (supervisor === null || supervisor === void 0 ? void 0 : supervisor.mobileNo) || "N/A";
7794
- const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSurveyorSearch(tenantId, {
7795
- supervisorIds: supervisor === null || supervisor === void 0 ? void 0 : supervisor.id
7796
- }, {
7797
- enabled: !!tenantId && !!(supervisor !== null && supervisor !== void 0 && supervisor.id)
7798
- }),
7799
- surveyorsResponse = _Digit$Hooks$fsm$useS2.data,
7800
- isSurveyorsLoading = _Digit$Hooks$fsm$useS2.isLoading;
7801
- const surveyors = useMemo(() => {
7802
- return (surveyorsResponse === null || surveyorsResponse === void 0 ? void 0 : surveyorsResponse.surveyors) || (surveyorsResponse === null || surveyorsResponse === void 0 ? void 0 : surveyorsResponse.surveyor) || [];
7803
- }, [surveyorsResponse]);
7804
- const _Digit$Hooks$ekyc$use2 = Digit.Hooks.ekyc.useEkycAssignmentProgress({
8624
+ const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
8625
+ const _useState = useState(false),
8626
+ ekycDownloadLoading = _useState[0],
8627
+ setEkycDownloadLoading = _useState[1];
8628
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycAssignmentProgress({
7805
8629
  enabled: !!tenantId,
7806
8630
  keepPreviousData: true
7807
8631
  }),
7808
- isProgressLoading = _Digit$Hooks$ekyc$use2.isLoading,
7809
- progressData = _Digit$Hooks$ekyc$use2.data;
7810
- const cards = useMemo(() => [{
7811
- label: "TOTAL_EKYC_APPLICATIONS",
7812
- count: (progressData === null || progressData === void 0 ? void 0 : progressData.totalKnos) || 0,
7813
- color: "#0B2559",
7814
- type: "today"
7815
- }, {
7816
- label: "TOTAL_ASSIGNMENTS",
7817
- count: (progressData === null || progressData === void 0 ? void 0 : progressData.totalAssignments) || 0,
7818
- color: "#3B82F6",
7819
- type: "week"
7820
- }, {
7821
- label: "EKYC_COMPLETED",
7822
- count: (progressData === null || progressData === void 0 ? void 0 : progressData.completedKnos) || 0,
7823
- color: "#10B981",
7824
- type: "month"
7825
- }, {
7826
- label: "PENDING_APPLICATIONS",
7827
- count: ((progressData === null || progressData === void 0 ? void 0 : progressData.totalKnos) || 0) - ((progressData === null || progressData === void 0 ? void 0 : progressData.completedKnos) || 0),
7828
- color: "#F59E0B",
7829
- type: "pending"
7830
- }, {
7831
- label: "OVERALL_PROGRESS",
7832
- count: ((progressData === null || progressData === void 0 ? void 0 : progressData.overallProgressPercent) || 0) + "%",
7833
- color: "#A855F7",
7834
- type: "progress"
7835
- }], [progressData]);
7836
- const _useState = useState(0),
7837
- currentPage = _useState[0],
7838
- setCurrentPage = _useState[1];
7839
- const _useState2 = useState(20),
7840
- pageSize = _useState2[0],
7841
- setPageSize = _useState2[1];
8632
+ isProgressLoading = _Digit$Hooks$ekyc$use.isLoading,
8633
+ progressData = _Digit$Hooks$ekyc$use.data;
8634
+ const supervisor = useMemo(() => {
8635
+ if (!(progressData !== null && progressData !== void 0 && progressData.supervisorReport)) return null;
8636
+ if (supervisorId) {
8637
+ return progressData.supervisorReport.find(s => s.supervisorId === supervisorId) || progressData.supervisorReport[0];
8638
+ }
8639
+ const userUuid = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid;
8640
+ if (userUuid) {
8641
+ return progressData.supervisorReport.find(s => s.supervisorId === userUuid) || progressData.supervisorReport[0];
8642
+ }
8643
+ return progressData.supervisorReport[0];
8644
+ }, [progressData, supervisorId, loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid]);
8645
+ const fullName = (supervisor === null || supervisor === void 0 ? void 0 : supervisor.supervisorName) || (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.name) || "N/A";
8646
+ const mobileNumber = (supervisor === null || supervisor === void 0 ? void 0 : supervisor.mobileNo) || (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.mobileNumber) || "N/A";
8647
+ const email = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.emailId) || "N/A";
8648
+ const gender = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.gender) || "N/A";
8649
+ const status = supervisor ? "ACTIVE" : "N/A";
8650
+ const assignedZone = (supervisor === null || supervisor === void 0 ? void 0 : supervisor.assignedZoneId) || "N/A";
8651
+ const vendorName = "N/A";
8652
+ const surveyors = useMemo(() => {
8653
+ return (supervisor === null || supervisor === void 0 ? void 0 : supervisor.surveyors) || [];
8654
+ }, [supervisor]);
8655
+ const _useState2 = useState(0),
8656
+ currentPage = _useState2[0],
8657
+ setCurrentPage = _useState2[1];
8658
+ const _useState3 = useState(20),
8659
+ pageSize = _useState3[0],
8660
+ setPageSize = _useState3[1];
7842
8661
  const paginatedSurveyors = useMemo(() => {
7843
8662
  const start = currentPage * pageSize;
7844
8663
  const end = start + pageSize;
@@ -7846,102 +8665,64 @@ const SupervisorDetailsCard = () => {
7846
8665
  }, [surveyors, currentPage, pageSize]);
7847
8666
  const surveyorColumns = useMemo(() => [{
7848
8667
  Header: t("SURVEYOR_NAME") || "Surveyor Name",
7849
- accessor: row => {
7850
- var _row$owner;
7851
- return (row === null || row === void 0 ? void 0 : row.name) || (row === null || row === void 0 ? void 0 : (_row$owner = row.owner) === null || _row$owner === void 0 ? void 0 : _row$owner.name) || "N/A";
7852
- },
7853
- Cell: _ref2 => {
7854
- var _row$original, _row$original2, _row$original2$owner;
7855
- let row = _ref2.row;
8668
+ accessor: row => (row === null || row === void 0 ? void 0 : row.surveyorName) || "N/A",
8669
+ Cell: _ref => {
8670
+ var _row$original;
8671
+ let row = _ref.row;
7856
8672
  return /*#__PURE__*/React.createElement("a", {
7857
- href: "/digit-ui/citizen/ekyc/surveyor-dashboard/" + row.original.id,
8673
+ href: "/digit-ui/citizen/ekyc/surveyor-dashboard/" + row.original.surveyorId,
7858
8674
  style: {
7859
8675
  color: "#1D70B8",
7860
8676
  fontWeight: "600",
7861
8677
  textDecoration: "none"
7862
8678
  }
7863
- }, ((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.name) || ((_row$original2 = row.original) === null || _row$original2 === void 0 ? void 0 : (_row$original2$owner = _row$original2.owner) === null || _row$original2$owner === void 0 ? void 0 : _row$original2$owner.name) || "N/A");
8679
+ }, ((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.surveyorName) || "N/A");
7864
8680
  }
7865
8681
  }, {
7866
8682
  Header: t("MOBILE_NUMBER") || "Mobile Number",
7867
- accessor: row => {
7868
- var _row$owner2;
7869
- return (row === null || row === void 0 ? void 0 : (_row$owner2 = row.owner) === null || _row$owner2 === void 0 ? void 0 : _row$owner2.mobileNumber) || (row === null || row === void 0 ? void 0 : row.mobileNo) || "N/A";
7870
- },
8683
+ accessor: row => (row === null || row === void 0 ? void 0 : row.mobileNo) || "N/A",
7871
8684
  id: "mobileNumber"
7872
8685
  }, {
7873
8686
  Header: t("STATUS") || "Status",
7874
- accessor: "status",
7875
- Cell: _ref3 => {
7876
- let value = _ref3.value;
8687
+ accessor: () => "ACTIVE",
8688
+ id: "status",
8689
+ Cell: _ref2 => {
8690
+ let value = _ref2.value;
7877
8691
  return /*#__PURE__*/React.createElement("span", {
7878
- className: "status-badge " + (value === "ACTIVE" ? "verified" : "pending")
8692
+ className: "status-badge verified"
7879
8693
  }, t(value) || value);
7880
8694
  }
7881
8695
  }, {
7882
8696
  Header: t("TOTAL_EKYC_APPLICATIONS") || "Total eKYC Applications",
7883
- accessor: row => (row === null || row === void 0 ? void 0 : row.totalEkycApplications) || 0,
7884
- id: "totalEkycApplications",
7885
- Cell: _ref4 => {
7886
- var _row$original3, _row$original3$owner;
7887
- let row = _ref4.row;
7888
- return /*#__PURE__*/React.createElement(SurveyorStatsCell, {
7889
- surveyorId: (_row$original3 = row.original) === null || _row$original3 === void 0 ? void 0 : (_row$original3$owner = _row$original3.owner) === null || _row$original3$owner === void 0 ? void 0 : _row$original3$owner.uuid,
7890
- type: "total"
7891
- });
7892
- }
8697
+ accessor: row => (row === null || row === void 0 ? void 0 : row.totalKnos) || 0,
8698
+ id: "totalEkycApplications"
7893
8699
  }, {
7894
8700
  Header: t("EKYC_COMPLETED") || "eKYC Completed",
7895
- accessor: row => (row === null || row === void 0 ? void 0 : row.ekycCompleted) || 0,
7896
- id: "ekycCompleted",
7897
- Cell: _ref5 => {
7898
- var _row$original4, _row$original4$owner;
7899
- let row = _ref5.row;
7900
- return /*#__PURE__*/React.createElement(SurveyorStatsCell, {
7901
- surveyorId: (_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : (_row$original4$owner = _row$original4.owner) === null || _row$original4$owner === void 0 ? void 0 : _row$original4$owner.uuid,
7902
- type: "completed"
7903
- });
7904
- }
8701
+ accessor: row => (row === null || row === void 0 ? void 0 : row.submittedKnos) || 0,
8702
+ id: "ekycCompleted"
7905
8703
  }, {
7906
8704
  Header: t("PENDING_APPLICATIONS") || "Pending Applications",
7907
- accessor: row => (row === null || row === void 0 ? void 0 : row.pendingApplications) || 0,
7908
- id: "pendingApplications",
7909
- Cell: _ref6 => {
7910
- var _row$original5, _row$original5$owner;
7911
- let row = _ref6.row;
7912
- return /*#__PURE__*/React.createElement(SurveyorStatsCell, {
7913
- surveyorId: (_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.uuid,
7914
- type: "pending"
7915
- });
7916
- }
8705
+ accessor: row => (row === null || row === void 0 ? void 0 : row.pendingKnos) || 0,
8706
+ id: "pendingApplications"
7917
8707
  }, {
7918
8708
  Header: t("OVERALL_PROGRESS") || "Overall Progress",
7919
- accessor: row => (row === null || row === void 0 ? void 0 : row.overallProgress) || "N/A",
7920
- id: "overallProgress",
7921
- Cell: _ref7 => {
7922
- var _row$original6, _row$original6$owner;
7923
- let row = _ref7.row;
7924
- return /*#__PURE__*/React.createElement(SurveyorStatsCell, {
7925
- surveyorId: (_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : (_row$original6$owner = _row$original6.owner) === null || _row$original6$owner === void 0 ? void 0 : _row$original6$owner.uuid,
7926
- type: "progress"
7927
- });
7928
- }
8709
+ accessor: row => ((row === null || row === void 0 ? void 0 : row.progressPercent) || 0) + "%",
8710
+ id: "overallProgress"
7929
8711
  }], [t]);
7930
- const _useState3 = useState(false),
7931
- showReportMenu = _useState3[0],
7932
- setShowReportMenu = _useState3[1];
7933
- const _useState4 = useState({
8712
+ const _useState4 = useState(false),
8713
+ showReportMenu = _useState4[0],
8714
+ setShowReportMenu = _useState4[1];
8715
+ const _useState5 = useState({
7934
8716
  from: "",
7935
8717
  to: ""
7936
8718
  }),
7937
- customDate = _useState4[0],
7938
- setCustomDate = _useState4[1];
7939
- const _useState5 = useState(false),
7940
- showCustomPicker = _useState5[0],
7941
- setShowCustomPicker = _useState5[1];
8719
+ customDate = _useState5[0],
8720
+ setCustomDate = _useState5[1];
7942
8721
  const _useState6 = useState(false),
7943
- reportLoading = _useState6[0],
7944
- setReportLoading = _useState6[1];
8722
+ showCustomPicker = _useState6[0],
8723
+ setShowCustomPicker = _useState6[1];
8724
+ const _useState7 = useState(false),
8725
+ reportLoading = _useState7[0];
7945
8726
  const reportMenuRef = useRef(null);
7946
8727
  useEffect(() => {
7947
8728
  const handler = e => {
@@ -7953,223 +8734,97 @@ const SupervisorDetailsCard = () => {
7953
8734
  document.addEventListener("mousedown", handler);
7954
8735
  return () => document.removeEventListener("mousedown", handler);
7955
8736
  }, []);
7956
- const getDateRange = filter => {
7957
- const now = new Date();
7958
- const start = new Date(now);
7959
- if (filter === "today") {
7960
- start.setHours(0, 0, 0, 0);
7961
- return {
7962
- from: start,
7963
- to: now
7964
- };
7965
- }
7966
- if (filter === "week") {
7967
- start.setDate(now.getDate() - now.getDay());
7968
- start.setHours(0, 0, 0, 0);
7969
- return {
7970
- from: start,
7971
- to: now
7972
- };
7973
- }
7974
- if (filter === "month") {
7975
- start.setDate(1);
7976
- start.setHours(0, 0, 0, 0);
7977
- return {
7978
- from: start,
7979
- to: now
7980
- };
7981
- }
7982
- return null;
8737
+ const handlePresetDownload = filter => {
8738
+ handleDownload();
7983
8739
  };
7984
- const handlePresetDownload = function (filter) {
7985
- try {
7986
- const range = getDateRange(filter);
7987
- if (!range) return Promise.resolve();
7988
- setReportLoading(true);
7989
- const _temp = _finallyRethrows(function () {
7990
- return _catch(function () {
7991
- const surveyorsList = surveyors || [];
7992
- return Promise.resolve(Promise.all(surveyorsList.map(function (surveyor) {
7993
- try {
7994
- return Promise.resolve(_catch(function () {
7995
- var _surveyor$owner;
7996
- return Promise.resolve(Digit.EkycService.dashboard({}, {
7997
- tenantId: "dl.djb",
7998
- offset: 0,
7999
- limit: 1,
8000
- surveyorId: (_surveyor$owner = surveyor.owner) === null || _surveyor$owner === void 0 ? void 0 : _surveyor$owner.uuid,
8001
- fromDate: range.from.getTime(),
8002
- toDate: range.to.getTime()
8003
- })).then(function (response) {
8004
- const info = (response === null || response === void 0 ? void 0 : response.dashboardInfo) || {};
8005
- const total = info.total || 0;
8006
- const completed = info.completed || 0;
8007
- const pending = info.pending || 0;
8008
- const progress = total > 0 ? Math.round(completed / total * 100) + "%" : "0%";
8009
- return _extends({}, surveyor, {
8010
- total,
8011
- completed,
8012
- pending,
8013
- progress
8014
- });
8015
- });
8016
- }, function (err) {
8017
- console.error("Failed to fetch stats for surveyor:", surveyor.id, err);
8018
- return _extends({}, surveyor, {
8019
- total: 0,
8020
- completed: 0,
8021
- pending: 0,
8022
- progress: "0%"
8023
- });
8024
- }));
8025
- } catch (e) {
8026
- return Promise.reject(e);
8027
- }
8028
- }))).then(function (rowsWithStats) {
8029
- var _supervisor$owner4;
8030
- return Promise.resolve(Digit.EkycService.dashboard({}, {
8031
- tenantId: "dl.djb",
8032
- offset: 0,
8033
- limit: 1,
8034
- supervisorId: supervisor === null || supervisor === void 0 ? void 0 : (_supervisor$owner4 = supervisor.owner) === null || _supervisor$owner4 === void 0 ? void 0 : _supervisor$owner4.uuid,
8035
- fromDate: range.from.getTime(),
8036
- toDate: range.to.getTime()
8037
- })).then(function (overallResponse) {
8038
- downloadSupervisorPDF({
8039
- rows: rowsWithStats,
8040
- supervisorName: fullName,
8041
- mobileNumber,
8042
- vendorName,
8043
- dashboardInfo: (overallResponse === null || overallResponse === void 0 ? void 0 : overallResponse.dashboardInfo) || {},
8044
- t
8045
- });
8046
- });
8047
- });
8048
- }, function (err) {
8049
- console.error("Failed to fetch dashboard data for report download:", err);
8050
- });
8051
- }, function (_wasThrown, _result) {
8052
- setReportLoading(false);
8053
- setShowReportMenu(false);
8054
- setShowCustomPicker(false);
8055
- if (_wasThrown) throw _result;
8056
- return _result;
8057
- });
8058
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
8059
- } catch (e) {
8060
- return Promise.reject(e);
8740
+ const handleCustomDownload = () => {
8741
+ if (!customDate.from || !customDate.to) {
8742
+ alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
8743
+ return;
8061
8744
  }
8745
+ handleDownload();
8062
8746
  };
8063
- const handleCustomDownload = function () {
8747
+ const handleDownloadEkycData = function () {
8064
8748
  try {
8065
- if (!customDate.from || !customDate.to) {
8066
- alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
8749
+ if (!surveyors || surveyors.length === 0) {
8750
+ alert(t("NO_SURVEYORS_ASSIGNED") || "No surveyors assigned to this supervisor.");
8067
8751
  return Promise.resolve();
8068
8752
  }
8069
- const from = new Date(customDate.from);
8070
- from.setHours(0, 0, 0, 0);
8071
- const to = new Date(customDate.to);
8072
- to.setHours(23, 59, 59, 999);
8073
- setReportLoading(true);
8074
- const _temp2 = _finallyRethrows(function () {
8753
+ setEkycDownloadLoading(true);
8754
+ return Promise.resolve(_finallyRethrows(function () {
8075
8755
  return _catch(function () {
8076
- const surveyorsList = surveyors || [];
8077
- return Promise.resolve(Promise.all(surveyorsList.map(function (surveyor) {
8078
- try {
8079
- return Promise.resolve(_catch(function () {
8080
- var _surveyor$owner2;
8081
- return Promise.resolve(Digit.EkycService.dashboard({}, {
8082
- tenantId: "dl.djb",
8083
- offset: 0,
8084
- limit: 1,
8085
- surveyorId: (_surveyor$owner2 = surveyor.owner) === null || _surveyor$owner2 === void 0 ? void 0 : _surveyor$owner2.uuid,
8086
- fromDate: from.getTime(),
8087
- toDate: to.getTime()
8088
- })).then(function (response) {
8089
- const info = (response === null || response === void 0 ? void 0 : response.dashboardInfo) || {};
8090
- const total = info.total || 0;
8091
- const completed = info.completed || 0;
8092
- const pending = info.pending || 0;
8093
- const progress = total > 0 ? Math.round(completed / total * 100) + "%" : "0%";
8094
- return _extends({}, surveyor, {
8095
- total,
8096
- completed,
8097
- pending,
8098
- progress
8099
- });
8100
- });
8101
- }, function (err) {
8102
- console.error("Failed to fetch stats for surveyor:", surveyor.id, err);
8103
- return _extends({}, surveyor, {
8104
- total: 0,
8105
- completed: 0,
8106
- pending: 0,
8107
- progress: "0%"
8108
- });
8109
- }));
8110
- } catch (e) {
8111
- return Promise.reject(e);
8756
+ const fetchPromises = surveyors.map(s => Digit.EkycService.application_list({
8757
+ tenantId: tenantId || "dl.djb",
8758
+ offset: 0,
8759
+ limit: 5000,
8760
+ surveyorId: s.surveyorId || s.id,
8761
+ reportDownload: true
8762
+ }).catch(err => {
8763
+ console.error("Error fetching applications for surveyor " + s.surveyorName + ":", err);
8764
+ return {
8765
+ consumerList: []
8766
+ };
8767
+ }));
8768
+ return Promise.resolve(Promise.all(fetchPromises)).then(function (results) {
8769
+ const consumerList = results.flatMap(res => (res === null || res === void 0 ? void 0 : res.consumerList) || []);
8770
+ if (consumerList.length === 0) {
8771
+ alert(t("NO_DATA_FOUND") || "No data found for download.");
8772
+ return;
8112
8773
  }
8113
- }))).then(function (rowsWithStats) {
8114
- var _supervisor$owner5;
8115
- return Promise.resolve(Digit.EkycService.dashboard({}, {
8116
- tenantId: "dl.djb",
8117
- offset: 0,
8118
- limit: 1,
8119
- supervisorId: supervisor === null || supervisor === void 0 ? void 0 : (_supervisor$owner5 = supervisor.owner) === null || _supervisor$owner5 === void 0 ? void 0 : _supervisor$owner5.uuid,
8120
- fromDate: from.getTime(),
8121
- toDate: to.getTime()
8122
- })).then(function (overallResponse) {
8123
- downloadSupervisorPDF({
8124
- rows: rowsWithStats,
8125
- supervisorName: fullName,
8126
- mobileNumber,
8127
- vendorName,
8128
- dashboardInfo: (overallResponse === null || overallResponse === void 0 ? void 0 : overallResponse.dashboardInfo) || {},
8129
- t
8774
+ const excludedKeys = ["status", "source", "submittedAt", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "assignedTime", "isSelfAssigned", "userType", "tenantName", "tenantMobile"];
8775
+ const headerMapping = {
8776
+ kno: t("KNO") || "KNO",
8777
+ firstName: t("FIRST_NAME") || "First Name",
8778
+ middleName: t("MIDDLE_NAME") || "Middle Name",
8779
+ lastName: t("LAST_NAME") || "Last Name",
8780
+ gender: t("GENDER") || "Gender",
8781
+ mobileNumber: t("MOBILE_NUMBER") || "Mobile Number",
8782
+ emailId: t("EMAIL_ID") || "Email ID",
8783
+ fatherOrHusbandName: t("FATHER_HUSBUND_NAME") || "Father/Husband Name",
8784
+ relationship: t("RELATIONSHIP") || "Relationship",
8785
+ dob: t("DOB") || "Date of Birth",
8786
+ ekycStatus: t("EKYC_STATUS") || "eKYC Status",
8787
+ zoneName: t("ZONE") || "Zone",
8788
+ assembly: t("ASSEMBLY") || "Assembly",
8789
+ ward: t("WARD") || "Ward",
8790
+ pincode: t("PINCODE") || "Pincode",
8791
+ mrkey: t("MR_KEY") || "MR Key",
8792
+ createdTime: t("CREATED_TIME") || "Created Time",
8793
+ lastModifiedTime: t("LAST_MODIFIED_TIME") || "Last Modified Time"
8794
+ };
8795
+ const excelData = consumerList.map(item => {
8796
+ const cleanObj = {};
8797
+ const fullName = [item.firstName, item.middleName, item.lastName].filter(Boolean).join(" ");
8798
+ if (fullName) {
8799
+ cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = fullName;
8800
+ }
8801
+ Object.keys(item).forEach(key => {
8802
+ if (excludedKeys.includes(key)) return;
8803
+ const val = item[key];
8804
+ if (typeof val === "object" && val !== null) {
8805
+ return;
8806
+ }
8807
+ const friendlyHeader = headerMapping[key] || t(key.toUpperCase()) || key;
8808
+ cleanObj[friendlyHeader] = val;
8130
8809
  });
8810
+ return cleanObj;
8131
8811
  });
8812
+ const cleanFileName = "eKYC_Data_Supervisor_" + fullName.replace(/[^a-zA-Z0-9]/g, "_");
8813
+ Digit.Download.Excel(excelData, cleanFileName);
8132
8814
  });
8133
- }, function (err) {
8134
- console.error("Failed to fetch custom dashboard data for report download:", err);
8815
+ }, function (error) {
8816
+ console.error("Error downloading eKYC Excel:", error);
8135
8817
  });
8136
- }, function (_wasThrown2, _result2) {
8137
- setReportLoading(false);
8138
- setShowReportMenu(false);
8139
- setShowCustomPicker(false);
8140
- if (_wasThrown2) throw _result2;
8141
- return _result2;
8142
- });
8143
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
8818
+ }, function (_wasThrown, _result) {
8819
+ setEkycDownloadLoading(false);
8820
+ if (_wasThrown) throw _result;
8821
+ return _result;
8822
+ }));
8144
8823
  } catch (e) {
8145
8824
  return Promise.reject(e);
8146
8825
  }
8147
8826
  };
8148
- const StatCard = _ref8 => {
8149
- let title = _ref8.title,
8150
- value = _ref8.value,
8151
- type = _ref8.type,
8152
- color = _ref8.color,
8153
- isLoading = _ref8.isLoading;
8154
- return /*#__PURE__*/React.createElement("div", {
8155
- className: "stat-card " + type,
8156
- style: color ? {
8157
- borderLeft: "5px solid " + color
8158
- } : {}
8159
- }, isLoading ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
8160
- className: "stat-title skeleton skeleton-text"
8161
- }), /*#__PURE__*/React.createElement("div", {
8162
- className: "stat-value skeleton skeleton-number"
8163
- })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
8164
- className: "stat-title"
8165
- }, title), /*#__PURE__*/React.createElement("div", {
8166
- className: "stat-value",
8167
- style: color ? {
8168
- color
8169
- } : {}
8170
- }, value)));
8171
- };
8172
- if (isSupervisorSearchLoading) {
8827
+ if (isProgressLoading) {
8173
8828
  return /*#__PURE__*/React.createElement(Loader, null);
8174
8829
  }
8175
8830
  if (!supervisor) {
@@ -8214,13 +8869,13 @@ const SupervisorDetailsCard = () => {
8214
8869
  }, {
8215
8870
  label: t("THIS_MONTH") || "This Month",
8216
8871
  key: "month"
8217
- }].map(_ref9 => {
8218
- let label = _ref9.label,
8219
- key = _ref9.key;
8872
+ }].map(_ref3 => {
8873
+ let label = _ref3.label,
8874
+ key = _ref3.key;
8220
8875
  return /*#__PURE__*/React.createElement("div", {
8221
8876
  key: key,
8222
8877
  className: "menu-item",
8223
- onClick: () => handlePresetDownload(key)
8878
+ onClick: () => handlePresetDownload()
8224
8879
  }, label);
8225
8880
  }), /*#__PURE__*/React.createElement("div", {
8226
8881
  className: "custom-date-trigger",
@@ -8253,55 +8908,76 @@ const SupervisorDetailsCard = () => {
8253
8908
  className: "download-action-btn",
8254
8909
  onClick: handleCustomDownload
8255
8910
  }, t("DOWNLOAD") || "Download"))))), /*#__PURE__*/React.createElement("div", {
8256
- className: "stats-wrapper"
8257
- }, cards.map((card, idx) => /*#__PURE__*/React.createElement(StatCard, {
8258
- key: idx,
8259
- title: t(card.label),
8260
- value: card.count,
8261
- type: card.type,
8262
- color: card.color,
8263
- isLoading: isProgressLoading
8264
- }))), /*#__PURE__*/React.createElement("div", {
8265
8911
  className: "ekyc-dashboard-section"
8912
+ }, /*#__PURE__*/React.createElement("div", {
8913
+ className: "ekyc-details-wrapper"
8914
+ }, /*#__PURE__*/React.createElement("div", {
8915
+ className: "details-left"
8266
8916
  }, /*#__PURE__*/React.createElement("div", {
8267
8917
  className: "details-grid"
8268
8918
  }, /*#__PURE__*/React.createElement("div", {
8269
8919
  className: "detail-item"
8270
8920
  }, /*#__PURE__*/React.createElement("span", {
8271
8921
  className: "label"
8272
- }, t("MOBILE"), ":"), /*#__PURE__*/React.createElement("span", {
8922
+ }, t("MOBILE")), /*#__PURE__*/React.createElement("span", {
8273
8923
  className: "value"
8274
- }, (supervisor === null || supervisor === void 0 ? void 0 : (_supervisor$owner6 = supervisor.owner) === null || _supervisor$owner6 === void 0 ? void 0 : _supervisor$owner6.mobileNumber) || (supervisor === null || supervisor === void 0 ? void 0 : supervisor.mobileNo) || "N/A")), /*#__PURE__*/React.createElement("div", {
8924
+ }, mobileNumber)), /*#__PURE__*/React.createElement("div", {
8275
8925
  className: "detail-item"
8276
8926
  }, /*#__PURE__*/React.createElement("span", {
8277
8927
  className: "label"
8278
- }, t("EMAIL"), ":"), /*#__PURE__*/React.createElement("span", {
8928
+ }, t("EMAIL")), /*#__PURE__*/React.createElement("span", {
8279
8929
  className: "value"
8280
- }, (supervisor === null || supervisor === void 0 ? void 0 : (_supervisor$owner7 = supervisor.owner) === null || _supervisor$owner7 === void 0 ? void 0 : _supervisor$owner7.emailId) || "N/A")), /*#__PURE__*/React.createElement("div", {
8930
+ }, email)), /*#__PURE__*/React.createElement("div", {
8281
8931
  className: "detail-item"
8282
8932
  }, /*#__PURE__*/React.createElement("span", {
8283
8933
  className: "label"
8284
- }, t("GENDER"), ":"), /*#__PURE__*/React.createElement("span", {
8934
+ }, t("GENDER")), /*#__PURE__*/React.createElement("span", {
8285
8935
  className: "value"
8286
- }, (supervisor === null || supervisor === void 0 ? void 0 : (_supervisor$owner8 = supervisor.owner) === null || _supervisor$owner8 === void 0 ? void 0 : _supervisor$owner8.gender) || "N/A")), /*#__PURE__*/React.createElement("div", {
8936
+ }, gender)), /*#__PURE__*/React.createElement("div", {
8287
8937
  className: "detail-item"
8288
8938
  }, /*#__PURE__*/React.createElement("span", {
8289
8939
  className: "label"
8290
- }, t("STATUS"), ":"), /*#__PURE__*/React.createElement("span", {
8940
+ }, t("STATUS")), /*#__PURE__*/React.createElement("span", {
8291
8941
  className: "value"
8292
- }, (supervisor === null || supervisor === void 0 ? void 0 : supervisor.status) || "N/A")), /*#__PURE__*/React.createElement("div", {
8942
+ }, status)), /*#__PURE__*/React.createElement("div", {
8293
8943
  className: "detail-item"
8294
8944
  }, /*#__PURE__*/React.createElement("span", {
8295
8945
  className: "label"
8296
- }, t("SERVICE_TYPE"), ":"), /*#__PURE__*/React.createElement("span", {
8946
+ }, t("ASSIGNED_ZONE") || "Assigned Zone"), /*#__PURE__*/React.createElement("span", {
8297
8947
  className: "value"
8298
- }, (supervisor === null || supervisor === void 0 ? void 0 : (_supervisor$additiona = supervisor.additionalDetails) === null || _supervisor$additiona === void 0 ? void 0 : _supervisor$additiona.serviceType) || "N/A")), /*#__PURE__*/React.createElement("div", {
8948
+ }, assignedZone)), /*#__PURE__*/React.createElement("div", {
8299
8949
  className: "detail-item"
8300
8950
  }, /*#__PURE__*/React.createElement("span", {
8301
8951
  className: "label"
8302
- }, t("VENDOR_NAME") || "Vendor Name", ":"), /*#__PURE__*/React.createElement("span", {
8952
+ }, t("VENDOR_NAME") || "Vendor Name"), /*#__PURE__*/React.createElement("span", {
8303
8953
  className: "value"
8304
- }, vendorName)))), /*#__PURE__*/React.createElement(Card, {
8954
+ }, vendorName)))), /*#__PURE__*/React.createElement("div", {
8955
+ className: "details-right"
8956
+ }, /*#__PURE__*/React.createElement("div", {
8957
+ className: "download-card"
8958
+ }, /*#__PURE__*/React.createElement("h4", null, t("DOWNLOAD_EKYC_DATA") || "Download eKYC Data"), /*#__PURE__*/React.createElement("p", null, t("DOWNLOAD_EKYC_DATA_DESC") || "Export the complete eKYC verification records for your assigned jurisdiction into Excel format."), /*#__PURE__*/React.createElement("button", {
8959
+ className: "download-excel-btn",
8960
+ disabled: ekycDownloadLoading,
8961
+ onClick: handleDownloadEkycData
8962
+ }, /*#__PURE__*/React.createElement("svg", {
8963
+ width: "16",
8964
+ height: "16",
8965
+ viewBox: "0 0 24 24",
8966
+ fill: "none",
8967
+ stroke: "currentColor",
8968
+ strokeWidth: "2.5",
8969
+ strokeLinecap: "round",
8970
+ strokeLinejoin: "round"
8971
+ }, /*#__PURE__*/React.createElement("path", {
8972
+ d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
8973
+ }), /*#__PURE__*/React.createElement("polyline", {
8974
+ points: "7 10 12 15 17 10"
8975
+ }), /*#__PURE__*/React.createElement("line", {
8976
+ x1: "12",
8977
+ y1: "15",
8978
+ x2: "12",
8979
+ y2: "3"
8980
+ })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel"))))), /*#__PURE__*/React.createElement(Card, {
8305
8981
  className: "dashboard-card"
8306
8982
  }, /*#__PURE__*/React.createElement(Table, {
8307
8983
  t: t,
@@ -8309,7 +8985,7 @@ const SupervisorDetailsCard = () => {
8309
8985
  tableClass: "ekycTable",
8310
8986
  data: paginatedSurveyors,
8311
8987
  columns: surveyorColumns,
8312
- isLoading: isSurveyorsLoading,
8988
+ isLoading: isProgressLoading,
8313
8989
  totalRecords: surveyors.length,
8314
8990
  currentPage: currentPage,
8315
8991
  pageSizeLimit: pageSize,
@@ -8656,6 +9332,10 @@ const CitizenApp = () => {
8656
9332
  crumbs.push({
8657
9333
  label: t("EKYC_SURVEYOR_DASHBOARD")
8658
9334
  });
9335
+ } else if (pathname.includes("/vendor-dashboard")) {
9336
+ crumbs.push({
9337
+ label: t("EKYC_VENDOR_DASHBOARD") || "Vendor Dashboard"
9338
+ });
8659
9339
  } else if (pathname.includes("/dashboard")) {
8660
9340
  crumbs.push({
8661
9341
  label: t("EKYC_DASHBOARD")
@@ -8710,10 +9390,10 @@ const CitizenApp = () => {
8710
9390
  layoutClass: "normal"
8711
9391
  }, /*#__PURE__*/React.createElement(Home, null))
8712
9392
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
8713
- path: path + "/dashboard",
9393
+ path: [path + "/vendor-dashboard/:vendorId", path + "/vendor-dashboard", path + "/dashboard"],
8714
9394
  component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
8715
9395
  layoutClass: "normal"
8716
- }, /*#__PURE__*/React.createElement(VendorDetails, null))
9396
+ }, /*#__PURE__*/React.createElement(VendorDetailsCard, null))
8717
9397
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
8718
9398
  path: path + "/inbox",
8719
9399
  component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {