@djb25/digit-ui-module-ekyc 1.0.40 → 1.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -11,9 +11,11 @@ var fa = require('react-icons/fa');
11
11
  var recharts = require('recharts');
12
12
 
13
13
  const EKYCCard = () => {
14
+ var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3;
14
15
  const _useTranslation = reactI18next.useTranslation(),
15
16
  t = _useTranslation.t;
16
17
  const tenantId = Digit.ULBService.getCurrentTenantId();
18
+ const roles = ((_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : (_Digit$SessionStorage2 = _Digit$SessionStorage.info) === null || _Digit$SessionStorage2 === void 0 ? void 0 : (_Digit$SessionStorage3 = _Digit$SessionStorage2.roles) === null || _Digit$SessionStorage3 === void 0 ? void 0 : _Digit$SessionStorage3.map(r => r.code)) || [];
17
19
  const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycApplicationList({}, {
18
20
  tenantId,
19
21
  offset: 0,
@@ -42,10 +44,10 @@ const EKYCCard = () => {
42
44
  count: totalCount,
43
45
  label: t("EKYC_INBOX"),
44
46
  link: "/digit-ui/employee/ekyc/inbox"
45
- }, {
47
+ }, ...(!roles.includes("EMPLOYEE") ? [{
46
48
  label: t("EKYC_ASSIGN"),
47
49
  link: "/digit-ui/employee/ekyc/assign"
48
- }]
50
+ }] : [])]
49
51
  };
50
52
  return /*#__PURE__*/React__default.createElement(digitUiReactComponents.EmployeeModuleCard, propsForModuleCard);
51
53
  };
@@ -330,7 +332,7 @@ const DesktopInbox = _ref => {
330
332
  Cell: _ref4 => {
331
333
  var _row$original4;
332
334
  let row = _ref4.row;
333
- const status = ((_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : _row$original4.status) || "DEFAULT";
335
+ const status = (((_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : _row$original4.status) || "DEFAULT").toUpperCase();
334
336
  return /*#__PURE__*/React__default.createElement("span", {
335
337
  className: "ekyc-status-tag " + status
336
338
  }, t("" + status));
@@ -1942,12 +1944,6 @@ const VendorDetailsCard = () => {
1942
1944
  color: "#0B2559",
1943
1945
  type: "today",
1944
1946
  icon: /*#__PURE__*/React__default.createElement(fa.FaUsers, null)
1945
- }, {
1946
- label: "TOTAL_ASSIGNMENTS",
1947
- count: totalKnos,
1948
- color: "#3B82F6",
1949
- type: "week",
1950
- icon: /*#__PURE__*/React__default.createElement(fa.FaMapMarkedAlt, null)
1951
1947
  }, {
1952
1948
  label: "EKYC_COMPLETED",
1953
1949
  count: completedKnos,
@@ -2056,20 +2052,20 @@ const VendorDetailsCard = () => {
2056
2052
  Header: t("SUPERVISOR_NAME") || "Supervisor Name",
2057
2053
  accessor: row => (row === null || row === void 0 ? void 0 : row.name) || "N/A",
2058
2054
  Cell: _ref => {
2059
- var _row$original;
2055
+ var _Digit$SessionStorage2, _Digit$SessionStorage3, _Digit$SessionStorage4, _row$original;
2060
2056
  let row = _ref.row;
2057
+ 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";
2058
+ const targetPath = "/digit-ui/" + userType + "/ekyc/supervisor-dashboard/" + row.original.id;
2061
2059
  return /*#__PURE__*/React__default.createElement("a", {
2062
- href: "/digit-ui/employee/ekyc/assign/surveyor-details/" + row.original.id,
2060
+ href: targetPath,
2063
2061
  style: {
2064
2062
  color: "#1D70B8",
2065
2063
  fontWeight: "600",
2066
2064
  textDecoration: "none"
2067
2065
  },
2068
2066
  onClick: e => {
2069
- var _Digit$SessionStorage2, _Digit$SessionStorage3, _Digit$SessionStorage4;
2070
- 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";
2071
2067
  e.preventDefault();
2072
- history.push("/digit-ui/" + userType + "/ekyc/assign/surveyor-details/" + row.original.id);
2068
+ history.push(targetPath);
2073
2069
  }
2074
2070
  }, ((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.name) || "N/A");
2075
2071
  }
@@ -2449,17 +2445,31 @@ const useInboxTableConfig = _ref => {
2449
2445
  Cell: _ref4 => {
2450
2446
  var _row$original4;
2451
2447
  let row = _ref4.row;
2452
- const status = ((_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : _row$original4.status) || "DEFAULT";
2448
+ const status = (((_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : _row$original4.status) || "DEFAULT").toUpperCase();
2453
2449
  return /*#__PURE__*/React__default.createElement("span", {
2454
2450
  className: "ekyc-status-tag " + status
2455
2451
  }, t("" + status));
2456
2452
  }
2453
+ }, {
2454
+ Header: t("SUBMITTED_AT") || "Submitted At",
2455
+ accessor: "submittedAt",
2456
+ Cell: _ref5 => {
2457
+ let value = _ref5.value;
2458
+ return value ? Digit.DateUtils.ConvertEpochToDate(value) : "-";
2459
+ }
2460
+ }, {
2461
+ Header: t("ASSIGNED_AT") || "Assigned At",
2462
+ accessor: "assignedAt",
2463
+ Cell: _ref6 => {
2464
+ let value = _ref6.value;
2465
+ return value ? Digit.DateUtils.ConvertEpochToDate(value) : "-";
2466
+ }
2457
2467
  }, {
2458
2468
  Header: t("EKYC_EKYC_STATUS"),
2459
2469
  accessor: "ekycStatus",
2460
- Cell: _ref5 => {
2470
+ Cell: _ref7 => {
2461
2471
  var _row$original5, _row$original6;
2462
- let row = _ref5.row;
2472
+ let row = _ref7.row;
2463
2473
  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();
2464
2474
  return /*#__PURE__*/React__default.createElement("span", {
2465
2475
  className: "ekyc-status-tag " + ekycStatus
@@ -2809,6 +2819,92 @@ const SearchFormFieldsComponents = _ref => {
2809
2819
  }), (errors === null || errors === void 0 ? void 0 : errors.kNumber) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardLabelError, null, errors.kNumber.message)));
2810
2820
  };
2811
2821
 
2822
+ const useInboxMobileCardsData = _ref => {
2823
+ var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3;
2824
+ let table = _ref.table,
2825
+ tenantId = _ref.tenantId;
2826
+ const _useTranslation = reactI18next.useTranslation(),
2827
+ t = _useTranslation.t;
2828
+ const history = reactRouterDom.useHistory();
2829
+ const _useState = React.useState(""),
2830
+ selectedKno = _useState[0],
2831
+ setSelectedKno = _useState[1];
2832
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycAPI("review", tenantId),
2833
+ reviewData = _Digit$Hooks$ekyc$use.data,
2834
+ getReview = _Digit$Hooks$ekyc$use.getReview;
2835
+ 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";
2836
+ React__default.useEffect(() => {
2837
+ if (reviewData) {
2838
+ history.push("/digit-ui/" + userType + "/ekyc/review/" + selectedKno, {
2839
+ aadhaarData: reviewData === null || reviewData === void 0 ? void 0 : reviewData.aadhaarData,
2840
+ reviewData
2841
+ });
2842
+ }
2843
+ }, [reviewData]);
2844
+ const handleReview = kno => {
2845
+ setSelectedKno(kno);
2846
+ getReview({
2847
+ kno
2848
+ });
2849
+ };
2850
+ const dataForMobileInboxCards = table === null || table === void 0 ? void 0 : table.map(item => {
2851
+ const kno = item.kno || item.applicationNumber || "NA";
2852
+ const status = (item.status || "DEFAULT").toUpperCase();
2853
+ const ekycStatus = (item.ekycStatus || item.ekycstatus || "NA").toUpperCase();
2854
+ return {
2855
+ [t("EKYC_APPLICATION_NO")]: /*#__PURE__*/React__default.createElement("span", {
2856
+ className: "link",
2857
+ onClick: () => handleReview(kno)
2858
+ }, kno),
2859
+ [t("EKYC_CITIZEN_NAME")]: item.citizenName || "NA",
2860
+ [t("EKYC_STATUS")]: /*#__PURE__*/React__default.createElement("span", {
2861
+ className: "ekyc-status-tag " + status
2862
+ }, t("" + status)),
2863
+ [t("SUBMITTED_AT")]: item.submittedAt ? Digit.DateUtils.ConvertEpochToDate(item.submittedAt) : "-",
2864
+ [t("ASSIGNED_AT")]: item.assignedAt ? Digit.DateUtils.ConvertEpochToDate(item.assignedAt) : "-",
2865
+ [t("EKYC_EKYC_STATUS")]: /*#__PURE__*/React__default.createElement("span", {
2866
+ className: "ekyc-status-tag " + ekycStatus
2867
+ }, t("" + ekycStatus))
2868
+ };
2869
+ });
2870
+ const MobileSortFormValues = () => {
2871
+ const sortOrderOptions = [{
2872
+ code: "DESC",
2873
+ i18nKey: "ES_INBOX_DATE_LATEST_FIRST"
2874
+ }, {
2875
+ code: "ASC",
2876
+ i18nKey: "ES_INBOX_DATE_LATEST_LAST"
2877
+ }];
2878
+ const _useFormContext = useFormContext(),
2879
+ controlSortForm = _useFormContext.control;
2880
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.SearchField, null, /*#__PURE__*/React__default.createElement(Controller, {
2881
+ name: "sortOrder",
2882
+ control: controlSortForm,
2883
+ render: _ref2 => {
2884
+ let onChange = _ref2.onChange,
2885
+ value = _ref2.value;
2886
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.RadioButtons, {
2887
+ onSelect: e => {
2888
+ onChange(e.code);
2889
+ },
2890
+ selectedOption: sortOrderOptions.filter(option => option.code === value)[0],
2891
+ optionsKey: "i18nKey",
2892
+ name: "sortOrder",
2893
+ options: sortOrderOptions
2894
+ });
2895
+ }
2896
+ }));
2897
+ };
2898
+ return {
2899
+ data: dataForMobileInboxCards,
2900
+ isTwoDynamicPrefix: true,
2901
+ getRedirectionLink: () => {},
2902
+ handleClickEnabled: false,
2903
+ serviceRequestIdKey: "applicationNo",
2904
+ MobileSortFormValues
2905
+ };
2906
+ };
2907
+
2812
2908
  const Inbox = _ref => {
2813
2909
  var _formState$tableForm3, _formState$tableForm4, _formState$searchForm3, _formState$searchForm4;
2814
2910
  let parentRoute = _ref.parentRoute;
@@ -3032,13 +3128,39 @@ const Inbox = _ref => {
3032
3128
  width: "70%"
3033
3129
  }
3034
3130
  }));
3131
+ const onMobileSortOrderData = data => {
3132
+ const sortOrder = data.sortOrder;
3133
+ dispatch({
3134
+ action: "mutateTableForm",
3135
+ data: _extends({}, formState.tableForm, {
3136
+ sortOrder
3137
+ })
3138
+ });
3139
+ };
3140
+ const onSortFormReset = setSortFormValue => {
3141
+ setSortFormValue("sortOrder", "DESC");
3142
+ dispatch({
3143
+ action: "mutateTableForm",
3144
+ data: tableOrderFormDefaultValues
3145
+ });
3146
+ };
3147
+ const propsForMobileSortForm = {
3148
+ onMobileSortOrderData,
3149
+ sortFormDefaultValues: formState === null || formState === void 0 ? void 0 : formState.tableForm,
3150
+ onSortFormReset
3151
+ };
3152
+ const propsForInboxMobileCards = useInboxMobileCardsData({
3153
+ table: filteredData,
3154
+ tenantId
3155
+ });
3035
3156
  const isInboxLoading = isListLoading || isSearchLoading;
3036
3157
  return /*#__PURE__*/React__default.createElement("div", {
3037
3158
  className: "app-container"
3038
3159
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.InboxComposer, _extends({
3039
3160
  isInboxLoading
3040
- }, propsForSearchForm, {
3161
+ }, propsForSearchForm, propsForMobileSortForm, {
3041
3162
  propsForInboxTable,
3163
+ propsForInboxMobileCards,
3042
3164
  formState,
3043
3165
  countData: listData
3044
3166
  })));
@@ -5390,759 +5512,916 @@ const EKYCForm = _ref => {
5390
5512
  }))))));
5391
5513
  };
5392
5514
 
5393
- const AssignEkycModal = _ref => {
5394
- let surveyor = _ref.surveyor,
5395
- closeModal = _ref.closeModal,
5396
- refetchDashboard = _ref.refetchDashboard;
5515
+ function formReducer(state, payload) {
5516
+ const storageKey = "EKYC.SW.INBOX";
5517
+ switch (payload.action) {
5518
+ case "mutateSearchForm":
5519
+ Digit.SessionStorage.set(storageKey, _extends({}, state, {
5520
+ searchForm: payload.data
5521
+ }));
5522
+ return _extends({}, state, {
5523
+ searchForm: payload.data
5524
+ });
5525
+ case "mutateFilterForm":
5526
+ Digit.SessionStorage.set(storageKey, _extends({}, state, {
5527
+ filterForm: payload.data
5528
+ }));
5529
+ return _extends({}, state, {
5530
+ filterForm: payload.data
5531
+ });
5532
+ case "mutateTableForm":
5533
+ Digit.SessionStorage.set(storageKey, _extends({}, state, {
5534
+ tableForm: payload.data
5535
+ }));
5536
+ return _extends({}, state, {
5537
+ tableForm: payload.data
5538
+ });
5539
+ default:
5540
+ return state;
5541
+ }
5542
+ }
5543
+ const formInitValue = {
5544
+ filterForm: {},
5545
+ searchForm: {},
5546
+ tableForm: {
5547
+ limit: 10,
5548
+ offset: 0,
5549
+ sortBy: "createdTime",
5550
+ sortOrder: "DESC"
5551
+ }
5552
+ };
5553
+ const tableColumnConfig = (t, handleReview) => [{
5554
+ Header: t("SURVEYOR_NAME"),
5555
+ accessor: "surveyorName",
5556
+ Cell: _ref => {
5557
+ var _row$original, _row$original2, _row$original3;
5558
+ let row = _ref.row;
5559
+ const id = (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.id;
5560
+ return /*#__PURE__*/React__default.createElement("span", {
5561
+ className: "link",
5562
+ onClick: () => handleReview(id)
5563
+ }, ((_row$original2 = row.original) === null || _row$original2 === void 0 ? void 0 : _row$original2.surveyorName) || ((_row$original3 = row.original) === null || _row$original3 === void 0 ? void 0 : _row$original3.name) || "NA");
5564
+ }
5565
+ }, {
5566
+ Header: t("MOBILE_NUMBER"),
5567
+ accessor: "mobileNo",
5568
+ Cell: _ref2 => {
5569
+ var _row$original4, _row$original5, _row$original5$owner;
5570
+ let row = _ref2.row;
5571
+ return /*#__PURE__*/React__default.createElement("span", null, ((_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : _row$original4.mobileNo) || ((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : (_row$original5$owner = _row$original5.owner) === null || _row$original5$owner === void 0 ? void 0 : _row$original5$owner.mobileNumber) || "NA");
5572
+ }
5573
+ }, {
5574
+ Header: t("STATUS"),
5575
+ accessor: "status",
5576
+ Cell: _ref3 => {
5577
+ var _row$original6;
5578
+ let row = _ref3.row;
5579
+ const status = ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.status) || "DEFAULT";
5580
+ return /*#__PURE__*/React__default.createElement("span", {
5581
+ className: "ekyc-status-tag " + status
5582
+ }, t(status));
5583
+ }
5584
+ }, {
5585
+ Header: t("SERVICE_TYPE"),
5586
+ accessor: "serviceType",
5587
+ Cell: _ref4 => {
5588
+ var _row$original7;
5589
+ let row = _ref4.row;
5590
+ return /*#__PURE__*/React__default.createElement("span", null, ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.serviceType) || "NA");
5591
+ }
5592
+ }];
5593
+
5594
+ const SupervisorInboxTableConfig = _ref => {
5595
+ var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _formState$tableForm, _formState$tableForm2;
5596
+ let onPageSizeChange = _ref.onPageSizeChange,
5597
+ formState = _ref.formState,
5598
+ totalCount = _ref.totalCount,
5599
+ table = _ref.table,
5600
+ dispatch = _ref.dispatch,
5601
+ onSortingByData = _ref.onSortingByData,
5602
+ _ref$inboxStyles = _ref.inboxStyles,
5603
+ inboxStyles = _ref$inboxStyles === void 0 ? {} : _ref$inboxStyles,
5604
+ _ref$tableStyle = _ref.tableStyle,
5605
+ tableStyle = _ref$tableStyle === void 0 ? {} : _ref$tableStyle;
5397
5606
  const _useTranslation = reactI18next.useTranslation(),
5398
5607
  t = _useTranslation.t;
5399
- const _useState = React.useState([]),
5400
- selectedKnos = _useState[0],
5401
- setSelectedKnos = _useState[1];
5402
- const _useState2 = React.useState(false),
5403
- isBulkSelection = _useState2[0],
5404
- setIsBulkSelection = _useState2[1];
5405
- const _useState3 = React.useState(0),
5406
- currentPage = _useState3[0],
5407
- setCurrentPage = _useState3[1];
5408
- const _useState4 = React.useState(10),
5409
- pageSize = _useState4[0],
5410
- setPageSize = _useState4[1];
5411
- const _useState5 = React.useState(false),
5412
- showToast = _useState5[0],
5413
- setShowToast = _useState5[1];
5414
- const _useState6 = React.useState({
5415
- error: false,
5416
- label: ""
5608
+ const history = reactRouterDom.useHistory();
5609
+ 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";
5610
+ const handleReview = id => {
5611
+ history.push("/digit-ui/" + userType + "/ekyc/assign/surveyor-details/" + id);
5612
+ };
5613
+ const limit = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10;
5614
+ const offset = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0;
5615
+ return {
5616
+ disableSort: false,
5617
+ autoSort: false,
5618
+ manualPagination: true,
5619
+ currentPage: Math.floor(offset / limit),
5620
+ onPageSizeChange,
5621
+ onNextPage: () => dispatch({
5622
+ action: "mutateTableForm",
5623
+ data: _extends({}, formState.tableForm, {
5624
+ offset: Number(offset) + Number(limit)
5625
+ })
5417
5626
  }),
5418
- toastData = _useState6[0],
5419
- setToastData = _useState6[1];
5420
- const _useState7 = React.useState({
5421
- kno: "",
5422
- pincode: "",
5423
- zoneCode: "",
5424
- zoneName: "",
5425
- ward: "",
5426
- assembly: "",
5427
- mrkey: "",
5428
- ekycStatus: ""
5627
+ onPrevPage: () => dispatch({
5628
+ action: "mutateTableForm",
5629
+ data: _extends({}, formState.tableForm, {
5630
+ offset: Number(offset) - Number(limit)
5631
+ })
5429
5632
  }),
5430
- filters = _useState7[0],
5431
- setFilters = _useState7[1];
5432
- const _useState8 = React.useState(filters),
5433
- debouncedFilters = _useState8[0],
5434
- setDebouncedFilters = _useState8[1];
5435
- const _Digit$Hooks$ws$useWS = Digit.Hooks.ws.useWSConfigMDMS.ZROLocation("dl.djb"),
5436
- zroLocationsData = _Digit$Hooks$ws$useWS.data,
5437
- isZroLoading = _Digit$Hooks$ws$useWS.isLoading;
5438
- const mappedZROLocation = React.useMemo(() => {
5439
- return (zroLocationsData || []).map(item => ({
5440
- code: item.code,
5441
- name: item.name
5442
- }));
5443
- }, [zroLocationsData]);
5444
- const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS("dl.djb", "egov-location", ["TenantBoundary"]),
5445
- egovLocationData = _Digit$Hooks$useCommo.data;
5446
- const boundaryData = React.useMemo(() => {
5447
- var _egovLocationData$ego;
5448
- const tenantBoundary = (egovLocationData === null || egovLocationData === void 0 ? void 0 : (_egovLocationData$ego = egovLocationData["egov-location"]) === null || _egovLocationData$ego === void 0 ? void 0 : _egovLocationData$ego.TenantBoundary) || [];
5449
- const revenueData = tenantBoundary.find(item => {
5450
- var _item$hierarchyType;
5451
- return (item === null || item === void 0 ? void 0 : (_item$hierarchyType = item.hierarchyType) === null || _item$hierarchyType === void 0 ? void 0 : _item$hierarchyType.code) === "REVENUE";
5452
- });
5453
- const boundary = (revenueData === null || revenueData === void 0 ? void 0 : revenueData.boundary) || [];
5454
- return Array.isArray(boundary) ? boundary : [boundary];
5455
- }, [egovLocationData]);
5456
- const _useMemo = React.useMemo(() => {
5457
- const assemblies = new Map();
5458
- const wards = new Map();
5459
- const boundaries = Array.isArray(boundaryData) ? boundaryData : boundaryData ? [boundaryData] : [];
5460
- const traverse = node => {
5461
- if (!node) return;
5462
- if (node.label === "Ward" || node.label === "WARD" || node.label === "Block" || node.label === "BLOCK") {
5463
- const code = node.code || node.localname || node.name;
5464
- const name = node.name || node.localname || code;
5465
- if (code) wards.set(code, {
5466
- code,
5467
- name: name
5468
- });
5469
- }
5470
- if (node.label === "Assembly Constituency" || node.label === "ASSEMBLY_CONSTITUENCY") {
5471
- const code = node.code || node.localname || node.name;
5472
- const name = node.name || node.localname || code;
5473
- if (code) assemblies.set(code, {
5474
- code,
5475
- name: name
5476
- });
5477
- }
5478
- if (node.children && node.children.length > 0) {
5479
- node.children.forEach(traverse);
5480
- }
5481
- };
5482
- boundaries.forEach(traverse);
5483
- return {
5484
- assemblyOptions: Array.from(assemblies.values()).sort((a, b) => a.name.localeCompare(b.name)),
5485
- wardOptions: Array.from(wards.values()).sort((a, b) => a.name.localeCompare(b.name))
5486
- };
5487
- }, [boundaryData]),
5488
- assemblyOptions = _useMemo.assemblyOptions,
5489
- wardOptions = _useMemo.wardOptions;
5490
- const structuredLocalityData = React.useMemo(() => {
5491
- let localities = [];
5492
- const boundaries = Array.isArray(boundaryData) ? boundaryData : boundaryData ? [boundaryData] : [];
5493
- const extractLocalities = node => {
5494
- if (!node) return;
5495
- if (node.label === "Locality" || node.label === "LOCALITY") {
5496
- localities.push(_extends({}, node, {
5497
- name: node.localname || node.name || node.code
5498
- }));
5499
- }
5500
- if (node.children && node.children.length > 0) {
5501
- node.children.forEach(child => extractLocalities(child));
5502
- }
5503
- };
5504
- boundaries.forEach(rootNode => extractLocalities(rootNode));
5505
- return localities;
5506
- }, [boundaryData]);
5507
- const fetchedPincodes = React.useMemo(() => {
5508
- const pinSet = new Set();
5509
- structuredLocalityData.forEach(loc => {
5510
- if (loc.pincode) {
5511
- const pins = Array.isArray(loc.pincode) ? loc.pincode : [loc.pincode];
5512
- pins.forEach(p => {
5513
- if (p) {
5514
- const sanitizedPin = p.toString().split(".")[0];
5515
- pinSet.add(sanitizedPin);
5516
- }
5517
- });
5518
- }
5519
- });
5520
- return Array.from(pinSet).sort();
5521
- }, [structuredLocalityData]);
5522
- React.useEffect(() => {
5523
- const timer = setTimeout(() => {
5524
- setDebouncedFilters(filters);
5525
- }, 500);
5526
- return () => clearTimeout(timer);
5527
- }, [filters]);
5528
- React.useEffect(() => {
5529
- setCurrentPage(0);
5530
- }, [debouncedFilters, filters.kno]);
5531
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycApplicationList(_extends({
5532
- unassignedOnly: true
5533
- }, filters.kno && {
5534
- kno: filters.kno
5535
- }, debouncedFilters.ekycStatus && {
5536
- ekycStatus: debouncedFilters.ekycStatus
5537
- }, debouncedFilters.zoneName && {
5538
- zoneName: debouncedFilters.zoneName
5539
- }, debouncedFilters.assembly && {
5540
- assembly: debouncedFilters.assembly
5541
- }, debouncedFilters.ward && {
5542
- ward: debouncedFilters.ward
5543
- }, debouncedFilters.mrkey && {
5544
- mrkey: debouncedFilters.mrkey
5545
- }, debouncedFilters.pincode && {
5546
- pincode: debouncedFilters.pincode
5547
- }), {
5548
- tenantId: "dl.djb",
5549
- offset: currentPage * pageSize,
5550
- limit: pageSize
5551
- }, {
5552
- keepPreviousData: true
5633
+ onLastPage: () => dispatch({
5634
+ action: "mutateTableForm",
5635
+ data: _extends({}, formState.tableForm, {
5636
+ offset: Math.ceil(totalCount / limit) * limit - Number(limit)
5637
+ })
5553
5638
  }),
5554
- applicationData = _Digit$Hooks$ekyc$use.data,
5555
- isLoading = _Digit$Hooks$ekyc$use.isFetching;
5556
- const handleAssignmentError = (errMsg, variables) => {
5557
- const isAlreadyAssigned = errMsg.toLowerCase().includes("already assigned") || errMsg.toLowerCase().includes("already assign") || errMsg.toLowerCase().includes("active assignment") || errMsg.toLowerCase().includes("mrkey") || errMsg.toLowerCase().includes("mr key") || errMsg.toLowerCase().includes("kno") || errMsg.toLowerCase().includes("already exists");
5558
- if (isAlreadyAssigned) {
5559
- const isMrKeyType = (variables === null || variables === void 0 ? void 0 : variables.assignmentType) === "MRKEY";
5560
- if (isMrKeyType) {
5561
- setToastData({
5562
- error: true,
5563
- label: t("EKYC_MR_KEY_ALREADY_ASSIGNED_WITH_ANOTHER_SURVEYOR") || "mr key is already assign with another surveyor"
5564
- });
5565
- } else {
5566
- setToastData({
5567
- error: true,
5568
- label: t("EKYC_KNO_ALREADY_ASSIGNED_WITH_ANOTHER_SURVEYOR") || "kno is already assign with another surveyor"
5569
- });
5570
- }
5571
- } else {
5572
- setToastData({
5573
- error: true,
5574
- label: t(errMsg) || errMsg || t("EKYC_SOMETHING_WENT_WRONG") || "Something went wrong"
5575
- });
5576
- }
5577
- setShowToast(true);
5639
+ onFirstPage: () => dispatch({
5640
+ action: "mutateTableForm",
5641
+ data: _extends({}, formState.tableForm, {
5642
+ offset: 0
5643
+ })
5644
+ }),
5645
+ totalRecords: totalCount,
5646
+ onSort: onSortingByData,
5647
+ data: table,
5648
+ columns: tableColumnConfig(t, handleReview),
5649
+ inboxStyles: _extends({}, inboxStyles),
5650
+ tableStyle: _extends({}, tableStyle)
5578
5651
  };
5579
- const assignmentMutation = Digit.Hooks.ekyc.useEkycAssignmentCreate({
5580
- onSuccess: (response, variables) => {
5581
- if (response !== null && response !== void 0 && response.error) {
5582
- var _response$data;
5583
- const errMsg = (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.message) || "";
5584
- handleAssignmentError(errMsg, variables);
5585
- return;
5586
- }
5587
- if (response !== null && response !== void 0 && response.skipped && response.skipped.length > 0) {
5588
- var _response$skipped$;
5589
- const reason = ((_response$skipped$ = response.skipped[0]) === null || _response$skipped$ === void 0 ? void 0 : _response$skipped$.reason) || "";
5590
- handleAssignmentError(reason, variables);
5591
- return;
5592
- }
5593
- setToastData({
5594
- error: false,
5595
- label: t("EKYC_ASSIGNMENT_SUCCESSFUL") || "Assignment successful"
5596
- });
5597
- setShowToast(true);
5598
- setTimeout(function () {
5599
- try {
5600
- return Promise.resolve(refetchDashboard()).then(function () {
5601
- closeModal();
5602
- });
5603
- } catch (e) {
5604
- return Promise.reject(e);
5605
- }
5606
- }, 1000);
5607
- },
5608
- onError: (error, variables) => {
5609
- var _error$data, _error$response, _error$response$data;
5610
- const errMsg = (error === null || error === void 0 ? void 0 : (_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.message) || (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.message) || "";
5611
- handleAssignmentError(errMsg, variables);
5612
- }
5613
- });
5614
- const tableData = (applicationData === null || applicationData === void 0 ? void 0 : applicationData.consumerList) || [];
5615
- const getAssignmentPayload = () => {
5616
- if (isBulkSelection) {
5617
- const filterMappings = [{
5618
- key: "ekycStatus",
5619
- type: "EKYCSTATUS"
5620
- }, {
5621
- key: "zoneName",
5622
- type: "ZONENAME"
5623
- }, {
5624
- key: "assembly",
5625
- type: "ASSEMBLY"
5626
- }, {
5627
- key: "ward",
5628
- type: "WARD"
5629
- }, {
5630
- key: "mrkey",
5631
- type: "MRKEY"
5632
- }, {
5633
- key: "pincode",
5634
- type: "PINCODE"
5635
- }];
5636
- const appliedFilter = filterMappings.find(_ref2 => {
5637
- let key = _ref2.key;
5638
- return debouncedFilters[key];
5639
- });
5640
- if (appliedFilter) {
5641
- return {
5642
- assignmentType: appliedFilter.type,
5643
- assignmentValue: debouncedFilters[appliedFilter.key]
5644
- };
5645
- }
5646
- }
5652
+ };
5653
+
5654
+ const useSupervisorInboxMobileCardsData = _ref => {
5655
+ var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3;
5656
+ let table = _ref.table;
5657
+ const _useTranslation = reactI18next.useTranslation(),
5658
+ t = _useTranslation.t;
5659
+ const history = reactRouterDom.useHistory();
5660
+ 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";
5661
+ const handleReview = id => {
5662
+ history.push("/digit-ui/" + userType + "/ekyc/assign/surveyor-details/" + id);
5663
+ };
5664
+ const dataForMobileInboxCards = table === null || table === void 0 ? void 0 : table.map(item => {
5665
+ var _item$owner;
5666
+ const id = item.id;
5667
+ const status = item.status || "DEFAULT";
5647
5668
  return {
5648
- assignmentType: "KNO",
5649
- assignmentValue: selectedKnos
5669
+ [t("SURVEYOR_NAME")]: /*#__PURE__*/React__default.createElement("span", {
5670
+ className: "link",
5671
+ onClick: () => handleReview(id)
5672
+ }, item.surveyorName || item.name || "NA"),
5673
+ [t("MOBILE_NUMBER")]: item.mobileNo || ((_item$owner = item.owner) === null || _item$owner === void 0 ? void 0 : _item$owner.mobileNumber) || "NA",
5674
+ [t("STATUS")]: /*#__PURE__*/React__default.createElement("span", {
5675
+ className: "ekyc-status-tag " + status
5676
+ }, t(status)),
5677
+ [t("SERVICE_TYPE")]: item.serviceType || "NA"
5650
5678
  };
5679
+ });
5680
+ const MobileSortFormValues = () => {
5681
+ const sortOrderOptions = [{
5682
+ code: "DESC",
5683
+ i18nKey: "ES_INBOX_DATE_LATEST_FIRST"
5684
+ }, {
5685
+ code: "ASC",
5686
+ i18nKey: "ES_INBOX_DATE_LATEST_LAST"
5687
+ }];
5688
+ const _useFormContext = useFormContext(),
5689
+ controlSortForm = _useFormContext.control;
5690
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.SearchField, null, /*#__PURE__*/React__default.createElement(Controller, {
5691
+ name: "sortOrder",
5692
+ control: controlSortForm,
5693
+ render: _ref2 => {
5694
+ let onChange = _ref2.onChange,
5695
+ value = _ref2.value;
5696
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.RadioButtons, {
5697
+ onSelect: e => {
5698
+ onChange(e.code);
5699
+ },
5700
+ selectedOption: sortOrderOptions.filter(option => option.code === value)[0],
5701
+ optionsKey: "i18nKey",
5702
+ name: "sortOrder",
5703
+ options: sortOrderOptions
5704
+ });
5705
+ }
5706
+ }));
5651
5707
  };
5652
- const handleAssign = () => {
5653
- var _surveyor$owner;
5654
- const _getAssignmentPayload = getAssignmentPayload(),
5655
- assignmentType = _getAssignmentPayload.assignmentType,
5656
- assignmentValue = _getAssignmentPayload.assignmentValue;
5657
- assignmentMutation.mutate({
5658
- tenantId: "dl.djb",
5659
- surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner = surveyor.owner) === null || _surveyor$owner === void 0 ? void 0 : _surveyor$owner.uuid,
5660
- assignmentType,
5661
- assignmentValue
5662
- });
5708
+ return {
5709
+ data: dataForMobileInboxCards,
5710
+ isTwoDynamicPrefix: true,
5711
+ getRedirectionLink: () => {},
5712
+ handleClickEnabled: false,
5713
+ serviceRequestIdKey: "id",
5714
+ MobileSortFormValues
5663
5715
  };
5664
- const handleSelectAll = () => {
5665
- setIsBulkSelection(true);
5666
- const pageKnos = tableData.map(item => item.kno);
5667
- const allSelected = pageKnos.length > 0 && pageKnos.every(kno => selectedKnos.includes(kno));
5668
- setSelectedKnos(prev => allSelected ? prev.filter(kno => !pageKnos.includes(kno)) : [...new Set([...prev, ...pageKnos])]);
5716
+ };
5717
+
5718
+ const AssignEkyc = () => {
5719
+ var _formState$tableForm, _formState$tableForm2, _formState$tableForm3, _formState$tableForm4, _formState$searchForm, _dashboardData$dashbo;
5720
+ let tenantId = Digit.ULBService.getCurrentTenantId();
5721
+ if (!tenantId || tenantId === "dl") {
5722
+ tenantId = "dl.djb";
5723
+ }
5724
+ const _useReducer = React.useReducer(formReducer, formInitValue),
5725
+ formState = _useReducer[0],
5726
+ dispatch = _useReducer[1];
5727
+ let paginationParms = {
5728
+ limit: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10,
5729
+ offset: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0,
5730
+ sortBy: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm3 = formState.tableForm) === null || _formState$tableForm3 === void 0 ? void 0 : _formState$tableForm3.sortBy) || "createdTime",
5731
+ sortOrder: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm4 = formState.tableForm) === null || _formState$tableForm4 === void 0 ? void 0 : _formState$tableForm4.sortOrder) || "DESC"
5669
5732
  };
5670
- const handleFilterChange = (key, value) => {
5671
- setFilters(prev => _extends({}, prev, {
5672
- [key]: value
5673
- }));
5674
- };
5675
- const columns = React.useMemo(() => [{
5676
- Header: () => /*#__PURE__*/React__default.createElement("input", {
5677
- type: "checkbox",
5678
- checked: tableData.length > 0 && tableData.every(item => selectedKnos.includes(item.kno)),
5679
- onChange: handleSelectAll
5733
+ const mobileNumber = (formState === null || formState === void 0 ? void 0 : (_formState$searchForm = formState.searchForm) === null || _formState$searchForm === void 0 ? void 0 : _formState$searchForm.mobileNumber) || "";
5734
+ const isSearchActive = !!mobileNumber;
5735
+ const filters = _extends({}, paginationParms, {
5736
+ status: "ACTIVE,DISABLED"
5737
+ });
5738
+ if (isSearchActive) {
5739
+ filters.mobileNumber = mobileNumber;
5740
+ }
5741
+ const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSurveyorSearch(tenantId, filters, {
5742
+ enabled: !!tenantId,
5743
+ keepPreviousData: true
5680
5744
  }),
5681
- id: "selection",
5682
- Cell: _ref3 => {
5683
- let row = _ref3.row;
5684
- const kno = row.original.kno;
5685
- return /*#__PURE__*/React__default.createElement("input", {
5686
- type: "checkbox",
5687
- checked: selectedKnos.includes(kno),
5688
- onChange: () => handleSelect(kno)
5745
+ dashboardData = _Digit$Hooks$fsm$useS.data,
5746
+ isLoading = _Digit$Hooks$fsm$useS.isLoading;
5747
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycAssignmentProgress({
5748
+ enabled: !!tenantId,
5749
+ keepPreviousData: true
5750
+ }),
5751
+ isDataSearchLoading = _Digit$Hooks$ekyc$use.isLoading;
5752
+ const sourceData = React.useMemo(() => {
5753
+ return (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.surveyors) || [];
5754
+ }, [dashboardData]);
5755
+ const filteredData = React.useMemo(() => {
5756
+ return (sourceData || []).map(item => {
5757
+ var _owner$roles, _owner$roles$map, _item$additionalDetai, _item$auditDetails, _item$auditDetails2;
5758
+ const owner = (item === null || item === void 0 ? void 0 : item.owner) || {};
5759
+ const roleCodes = (owner === null || owner === void 0 ? void 0 : (_owner$roles = owner.roles) === null || _owner$roles === void 0 ? void 0 : (_owner$roles$map = _owner$roles.map(role => role.code)) === null || _owner$roles$map === void 0 ? void 0 : _owner$roles$map.join(", ")) || "";
5760
+ return _extends({}, item, {
5761
+ id: (item === null || item === void 0 ? void 0 : item.id) || "",
5762
+ surveyorName: (item === null || item === void 0 ? void 0 : item.name) || (owner === null || owner === void 0 ? void 0 : owner.name) || "",
5763
+ mobileNo: (item === null || item === void 0 ? void 0 : item.mobileNo) || (owner === null || owner === void 0 ? void 0 : owner.mobileNumber) || "",
5764
+ email: (owner === null || owner === void 0 ? void 0 : owner.emailId) || "",
5765
+ vendorId: (item === null || item === void 0 ? void 0 : item.vendorId) || "",
5766
+ tenantId: (item === null || item === void 0 ? void 0 : item.tenantId) || "",
5767
+ supervisorId: (item === null || item === void 0 ? void 0 : item.supervisorId) || "",
5768
+ status: (item === null || item === void 0 ? void 0 : item.status) || "",
5769
+ roleCodes,
5770
+ userName: (owner === null || owner === void 0 ? void 0 : owner.userName) || "",
5771
+ gender: (owner === null || owner === void 0 ? void 0 : owner.gender) || "",
5772
+ serviceType: (item === null || item === void 0 ? void 0 : (_item$additionalDetai = item.additionalDetails) === null || _item$additionalDetai === void 0 ? void 0 : _item$additionalDetai.serviceType) || "",
5773
+ createdTime: (item === null || item === void 0 ? void 0 : (_item$auditDetails = item.auditDetails) === null || _item$auditDetails === void 0 ? void 0 : _item$auditDetails.createdTime) || 0,
5774
+ lastModifiedTime: (item === null || item === void 0 ? void 0 : (_item$auditDetails2 = item.auditDetails) === null || _item$auditDetails2 === void 0 ? void 0 : _item$auditDetails2.lastModifiedTime) || 0
5689
5775
  });
5776
+ });
5777
+ }, [sourceData]);
5778
+ const totalRecords = (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.totalRecords) || (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.totalCount) || 0;
5779
+ const SearchFormFields = React.useCallback(_ref => {
5780
+ let registerRef = _ref.registerRef,
5781
+ searchFormState = _ref.searchFormState,
5782
+ controlSearchForm = _ref.controlSearchForm;
5783
+ return /*#__PURE__*/React__default.createElement(SearchFormFieldsComponents, {
5784
+ registerRef,
5785
+ searchFormState,
5786
+ controlSearchForm,
5787
+ searchType: "mobile",
5788
+ className: "search"
5789
+ });
5790
+ }, []);
5791
+ const tableOrderFormDefaultValues = {
5792
+ sortBy: "createdTime",
5793
+ limit: window.Digit.Utils.browser.isMobile() ? 50 : 10,
5794
+ offset: 0,
5795
+ sortOrder: "DESC"
5796
+ };
5797
+ const onSearchFormSubmit = data => {
5798
+ data.hasOwnProperty("") && (data === null || data === void 0 ? true : delete data[""]);
5799
+ dispatch({
5800
+ action: "mutateTableForm",
5801
+ data: _extends({}, tableOrderFormDefaultValues)
5802
+ });
5803
+ dispatch({
5804
+ action: "mutateSearchForm",
5805
+ data
5806
+ });
5807
+ };
5808
+ const searchFormDefaultValues = {
5809
+ mobileNumber: "",
5810
+ applicationNumber: "",
5811
+ consumerNo: ""
5812
+ };
5813
+ const onSearchFormReset = setSearchFormValue => {
5814
+ setSearchFormValue("mobileNumber", null);
5815
+ setSearchFormValue("applicationNumber", null);
5816
+ setSearchFormValue("consumerNo", null);
5817
+ dispatch({
5818
+ action: "mutateSearchForm",
5819
+ data: searchFormDefaultValues
5820
+ });
5821
+ };
5822
+ const propsForSearchForm = {
5823
+ SearchFormFields,
5824
+ onSearchFormSubmit,
5825
+ searchFormDefaultValues: formState === null || formState === void 0 ? void 0 : formState.searchForm,
5826
+ resetSearchFormDefaultValues: searchFormDefaultValues,
5827
+ onSearchFormReset,
5828
+ className: "search-form-wns-inbox"
5829
+ };
5830
+ const onPageSizeChange = e => {
5831
+ const newLimit = Number(e.target.value);
5832
+ dispatch({
5833
+ action: "mutateTableForm",
5834
+ data: _extends({}, formState.tableForm, {
5835
+ limit: newLimit,
5836
+ offset: 0
5837
+ })
5838
+ });
5839
+ };
5840
+ const onSortingByData = e => {
5841
+ if (e.length > 0) {
5842
+ const _e$ = e[0],
5843
+ id = _e$.id,
5844
+ desc = _e$.desc;
5845
+ const sortOrder = desc ? "DESC" : "ASC";
5846
+ const sortBy = id;
5847
+ if (!(formState.tableForm.sortBy === sortBy && formState.tableForm.sortOrder === sortOrder)) {
5848
+ dispatch({
5849
+ action: "mutateTableForm",
5850
+ data: _extends({}, formState.tableForm, {
5851
+ sortBy: id,
5852
+ sortOrder: desc ? "DESC" : "ASC"
5853
+ })
5854
+ });
5855
+ }
5690
5856
  }
5691
- }, {
5692
- Header: "KNO",
5693
- accessor: "kno"
5694
- }, {
5695
- Header: "Consumer Name",
5696
- accessor: row => ((row.firstName || "") + " " + (row.middleName || "") + " " + (row.lastName || "")).trim(),
5697
- id: "consumerName"
5698
- }, {
5699
- Header: "Zone",
5700
- accessor: "zoneName"
5701
- }, {
5702
- Header: "Pincode",
5703
- accessor: "pincode"
5704
- }, {
5705
- Header: "Status",
5706
- accessor: "status",
5707
- Cell: _ref4 => {
5708
- let value = _ref4.value;
5709
- return /*#__PURE__*/React__default.createElement("span", {
5710
- className: "status-badge " + (value === "ACTIVE" ? "verified" : value === "PENDING" ? "pending" : "assigned")
5711
- }, value);
5712
- }
5713
- }, {
5714
- Header: "eKYC Status",
5715
- accessor: "ekycStatus",
5716
- Cell: _ref5 => {
5717
- let value = _ref5.value;
5718
- return value || "-";
5857
+ };
5858
+ const propsForInboxTable = SupervisorInboxTableConfig(_extends({}, {
5859
+ onPageSizeChange,
5860
+ formState,
5861
+ totalCount: totalRecords,
5862
+ table: filteredData,
5863
+ dispatch,
5864
+ onSortingByData,
5865
+ tenantId,
5866
+ inboxStyles: {
5867
+ overflowX: "scroll",
5868
+ overflowY: "hidden"
5869
+ },
5870
+ tableStyle: {
5871
+ width: "70%"
5719
5872
  }
5720
- }], [selectedKnos, tableData]);
5721
- const handleSelect = kno => {
5722
- setSelectedKnos(prev => prev.includes(kno) ? prev.filter(item => item !== kno) : [...prev, kno]);
5873
+ }));
5874
+ const isInboxLoading = isLoading;
5875
+ const onMobileSortOrderData = data => {
5876
+ const sortOrder = data.sortOrder;
5877
+ dispatch({
5878
+ action: "mutateTableForm",
5879
+ data: _extends({}, formState.tableForm, {
5880
+ sortOrder
5881
+ })
5882
+ });
5723
5883
  };
5724
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Modal, {
5725
- headerBarMain: "Assign KNOs to " + (surveyor === null || surveyor === void 0 ? void 0 : surveyor.name),
5726
- headerBarEnd: /*#__PURE__*/React__default.createElement(digitUiReactComponents.Close, {
5727
- onClick: closeModal
5884
+ const onSortFormReset = setSortFormValue => {
5885
+ setSortFormValue("sortOrder", "DESC");
5886
+ dispatch({
5887
+ action: "mutateTableForm",
5888
+ data: tableOrderFormDefaultValues
5889
+ });
5890
+ };
5891
+ const propsForMobileSortForm = {
5892
+ onMobileSortOrderData,
5893
+ sortFormDefaultValues: formState === null || formState === void 0 ? void 0 : formState.tableForm,
5894
+ onSortFormReset
5895
+ };
5896
+ const propsForInboxMobileCards = useSupervisorInboxMobileCardsData({
5897
+ table: filteredData
5898
+ });
5899
+ return /*#__PURE__*/React__default.createElement("div", {
5900
+ className: "app-container"
5901
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.InboxComposer, _extends({
5902
+ isInboxLoading
5903
+ }, propsForSearchForm, propsForMobileSortForm, {
5904
+ propsForInboxTable,
5905
+ propsForInboxMobileCards,
5906
+ formState,
5907
+ countData: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
5908
+ isCardLoading: isDataSearchLoading
5909
+ })));
5910
+ };
5911
+
5912
+ const AdminDashboard = () => {
5913
+ var _Digit$SessionStorage, _loggedInUser$roles, _fullName$charAt;
5914
+ const _useTranslation = reactI18next.useTranslation(),
5915
+ t = _useTranslation.t;
5916
+ const history = reactRouterDom.useHistory();
5917
+ let tenantId = Digit.ULBService.getCurrentTenantId();
5918
+ if (!tenantId || tenantId === "dl") {
5919
+ tenantId = "dl.djb";
5920
+ }
5921
+ const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
5922
+ const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
5923
+ status: "ACTIVE"
5924
+ }, {
5925
+ enabled: !!tenantId
5728
5926
  }),
5729
- actionCancelLabel: "Cancel",
5730
- actionCancelOnSubmit: closeModal,
5731
- actionSaveLabel: "Assign " + selectedKnos.length + " KNOs",
5732
- actionSaveOnSubmit: handleAssign,
5733
- isDisabled: !(selectedKnos !== null && selectedKnos !== void 0 && selectedKnos.length)
5734
- }, /*#__PURE__*/React__default.createElement("div", {
5735
- className: "assign-knos-modal"
5736
- }, /*#__PURE__*/React__default.createElement("div", {
5737
- className: "filters-grid"
5738
- }, /*#__PURE__*/React__default.createElement("input", {
5739
- className: "form-control",
5740
- placeholder: "KNO",
5741
- value: filters.kno,
5742
- onChange: e => handleFilterChange("kno", e.target.value)
5743
- }), /*#__PURE__*/React__default.createElement("select", {
5744
- className: "form-control",
5745
- value: filters.pincode,
5746
- onChange: e => handleFilterChange("pincode", e.target.value)
5747
- }, /*#__PURE__*/React__default.createElement("option", {
5748
- value: ""
5749
- }, "Select Pincode"), fetchedPincodes.map(pin => /*#__PURE__*/React__default.createElement("option", {
5750
- key: pin,
5751
- value: pin
5752
- }, pin))), /*#__PURE__*/React__default.createElement("select", {
5753
- className: "form-control",
5754
- value: filters.zoneName,
5755
- onChange: e => {
5756
- const val = e.target.value;
5757
- setFilters(prev => _extends({}, prev, {
5758
- zoneCode: val,
5759
- zoneName: val
5760
- }));
5761
- },
5762
- disabled: isZroLoading
5763
- }, /*#__PURE__*/React__default.createElement("option", {
5764
- value: ""
5765
- }, isZroLoading ? "Loading ZRO Locations..." : "Select ZRO Location"), mappedZROLocation.map(loc => /*#__PURE__*/React__default.createElement("option", {
5766
- key: loc.code,
5767
- value: loc.name
5768
- }, loc.name))), /*#__PURE__*/React__default.createElement("select", {
5769
- className: "form-control",
5770
- value: filters.ward,
5771
- onChange: e => handleFilterChange("ward", e.target.value)
5772
- }, /*#__PURE__*/React__default.createElement("option", {
5773
- value: ""
5774
- }, "Select Ward"), wardOptions.map(ward => /*#__PURE__*/React__default.createElement("option", {
5775
- key: ward.code,
5776
- value: ward.name
5777
- }, ward.name))), /*#__PURE__*/React__default.createElement("select", {
5778
- className: "form-control",
5779
- value: filters.assembly,
5780
- onChange: e => handleFilterChange("assembly", e.target.value)
5781
- }, /*#__PURE__*/React__default.createElement("option", {
5782
- value: ""
5783
- }, "Select Assembly"), assemblyOptions.map(assembly => /*#__PURE__*/React__default.createElement("option", {
5784
- key: assembly.code,
5785
- value: assembly.name
5786
- }, assembly.name))), /*#__PURE__*/React__default.createElement("input", {
5787
- className: "form-control",
5788
- placeholder: "MR Key",
5789
- value: filters.mrkey,
5790
- onChange: e => handleFilterChange("mrkey", e.target.value)
5791
- }), selectedKnos.length > 0 && /*#__PURE__*/React__default.createElement("button", {
5792
- className: "clear-selected-btn",
5793
- type: "button",
5794
- onClick: () => setSelectedKnos([])
5795
- }, t("EKYC_CLEAR_SELECTION") || "Clear Selected (" + selectedKnos.length + ")")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Table, {
5796
- tableTitle: "eKYC Applications",
5797
- tableClass: "ekycTable",
5798
- data: tableData,
5799
- columns: columns,
5800
- isLoading: isLoading,
5801
- totalRecords: (applicationData === null || applicationData === void 0 ? void 0 : applicationData.totalCount) || 0,
5802
- currentPage: currentPage,
5803
- pageSizeLimit: pageSize,
5804
- manualPagination: true,
5805
- isPaginationRequired: true,
5806
- onNextPage: () => {
5807
- if (currentPage < ((applicationData === null || applicationData === void 0 ? void 0 : applicationData.totalPages) || 1) - 1) {
5808
- setCurrentPage(prev => prev + 1);
5809
- }
5810
- },
5811
- onPrevPage: () => {
5812
- if (currentPage > 0) {
5813
- setCurrentPage(prev => prev - 1);
5814
- }
5815
- },
5816
- onFirstPage: () => {
5817
- setCurrentPage(0);
5818
- },
5819
- onLastPage: () => {
5820
- setCurrentPage(Math.max(((applicationData === null || applicationData === void 0 ? void 0 : applicationData.totalPages) || 1) - 1, 0));
5821
- },
5822
- onPageSizeChange: e => {
5823
- setPageSize(Number(e.target.value));
5824
- setCurrentPage(0);
5927
+ vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
5928
+ isVendorSearchLoading = _Digit$Hooks$fsm$useD.isLoading;
5929
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycAssignmentProgress({
5930
+ enabled: !!tenantId,
5931
+ keepPreviousData: true
5932
+ }),
5933
+ progressData = _Digit$Hooks$ekyc$use.data,
5934
+ isProgressLoading = _Digit$Hooks$ekyc$use.isLoading;
5935
+ const vendorsList = React.useMemo(() => {
5936
+ if (vendorSearchResponse && vendorSearchResponse.length > 0) {
5937
+ return vendorSearchResponse.map(v => {
5938
+ var _progressData$supervi, _dso$owner, _v$owner, _dso$owner2;
5939
+ const dso = v.dsoDetails || v;
5940
+ const supervisorsList = dso.supervisors || [];
5941
+ const surveyorsList = dso.surveyors || [];
5942
+ const supervisorIds = supervisorsList.map(s => {
5943
+ var _s$owner;
5944
+ return s.id || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : _s$owner.uuid);
5945
+ }).filter(Boolean);
5946
+ 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))) || [];
5947
+ const completed = matchedReports.reduce((acc, r) => acc + (r.submittedKnos || 0), 0);
5948
+ const pending = matchedReports.reduce((acc, r) => acc + (r.pendingKnos || 0), 0);
5949
+ const total = matchedReports.reduce((acc, r) => acc + (r.totalKnos || 0), 0);
5950
+ const progress = total > 0 ? Math.round(completed / total * 100) : 0;
5951
+ const rejected = 0;
5952
+ return {
5953
+ id: dso.id || dso.vendorId || v.id || v.vendorId,
5954
+ name: dso.name || dso.displayName || v.name || "N/A",
5955
+ 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",
5956
+ mobileNumber: dso.mobileNumber || ((_dso$owner2 = dso.owner) === null || _dso$owner2 === void 0 ? void 0 : _dso$owner2.mobileNumber) || v.mobileNumber || "N/A",
5957
+ supervisors: supervisorsList.length,
5958
+ surveyors: surveyorsList.length,
5959
+ completed: completed,
5960
+ progress: progress,
5961
+ pending: pending,
5962
+ rejected: rejected
5963
+ };
5964
+ });
5825
5965
  }
5826
- })), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
5827
- error: toastData.error,
5828
- label: toastData.label,
5829
- onClose: () => setShowToast(false)
5830
- }));
5966
+ return [];
5967
+ }, [vendorSearchResponse, progressData]);
5968
+ const _useState = React.useState(false),
5969
+ ekycDownloadLoading = _useState[0],
5970
+ setEkycDownloadLoading = _useState[1];
5971
+ const _useState2 = React.useState(0),
5972
+ currentPage = _useState2[0];
5973
+ const _useState3 = React.useState(20),
5974
+ pageSize = _useState3[0];
5975
+ const _Digit$Hooks$ekyc$use2 = Digit.Hooks.ekyc.useEkycApplicationList({}, {
5976
+ tenantId,
5977
+ offset: currentPage * pageSize,
5978
+ limit: pageSize
5979
+ }, {
5980
+ keepPreviousData: true
5981
+ });
5982
+ const fullName = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.name) || "Admin";
5983
+ const mobileNumber = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.mobileNumber) || "N/A";
5984
+ 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";
5985
+ const handleDownloadEkycData = function () {
5986
+ try {
5987
+ setEkycDownloadLoading(true);
5988
+ return Promise.resolve(_finallyRethrows(function () {
5989
+ return _catch(function () {
5990
+ return Promise.resolve(Digit.EkycService.application_list({
5991
+ tenantId: tenantId,
5992
+ offset: 0,
5993
+ limit: 10000,
5994
+ reportDownload: true
5995
+ })).then(function (response) {
5996
+ const consumerList = (response === null || response === void 0 ? void 0 : response.consumerList) || [];
5997
+ if (consumerList.length === 0) {
5998
+ alert(t("NO_DATA_FOUND") || "No data found for download.");
5999
+ return;
6000
+ }
6001
+ 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"];
6002
+ const headerMapping = {
6003
+ kno: t("KNO") || "KNO",
6004
+ firstName: t("FIRST_NAME") || "First Name",
6005
+ middleName: t("MIDDLE_NAME") || "Middle Name",
6006
+ lastName: t("LAST_NAME") || "Last Name",
6007
+ gender: t("GENDER") || "Gender",
6008
+ mobileNumber: t("MOBILE_NUMBER") || "Mobile Number",
6009
+ emailId: t("EMAIL_ID") || "Email ID",
6010
+ fatherOrHusbandName: t("FATHER_HUSBUND_NAME") || "Father/Husband Name",
6011
+ relationship: t("RELATIONSHIP") || "Relationship",
6012
+ dob: t("DOB") || "Date of Birth",
6013
+ ekycStatus: t("EKYC_STATUS") || "eKYC Status",
6014
+ zoneName: t("ZONE") || "Zone",
6015
+ assembly: t("ASSEMBLY") || "Assembly",
6016
+ ward: t("WARD") || "Ward",
6017
+ pincode: t("PINCODE") || "Pincode",
6018
+ mrkey: t("MR_KEY") || "MR Key",
6019
+ createdTime: t("CREATED_TIME") || "Created Time",
6020
+ lastModifiedTime: t("LAST_MODIFIED_TIME") || "Last Modified Time"
6021
+ };
6022
+ const excelData = consumerList.map(item => {
6023
+ const cleanObj = {};
6024
+ const name = [item.firstName, item.middleName, item.lastName].filter(Boolean).join(" ");
6025
+ if (name) {
6026
+ cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = name;
6027
+ }
6028
+ Object.keys(item).forEach(key => {
6029
+ if (excludedKeys.includes(key)) return;
6030
+ const val = item[key];
6031
+ if (typeof val === "object" && val !== null) {
6032
+ return;
6033
+ }
6034
+ const friendlyHeader = headerMapping[key] || t(key.toUpperCase()) || key;
6035
+ cleanObj[friendlyHeader] = val;
6036
+ });
6037
+ return cleanObj;
6038
+ });
6039
+ const cleanFileName = "eKYC_All_Data_Admin_" + fullName.replace(/[^a-zA-Z0-9]/g, "_");
6040
+ Digit.Download.Excel(excelData, cleanFileName);
6041
+ });
6042
+ }, function (error) {
6043
+ console.error("Error downloading eKYC Excel:", error);
6044
+ });
6045
+ }, function (_wasThrown, _result) {
6046
+ setEkycDownloadLoading(false);
6047
+ if (_wasThrown) throw _result;
6048
+ return _result;
6049
+ }));
6050
+ } catch (e) {
6051
+ return Promise.reject(e);
6052
+ }
6053
+ };
6054
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
6055
+ className: "surveyor-dashboard"
6056
+ }, /*#__PURE__*/React__default.createElement("div", {
6057
+ className: "ekyc-dashboard-section"
6058
+ }, /*#__PURE__*/React__default.createElement("div", {
6059
+ className: "ekyc-dashboard-header"
6060
+ }, /*#__PURE__*/React__default.createElement("div", {
6061
+ className: "avatar"
6062
+ }, fullName === null || fullName === void 0 ? void 0 : (_fullName$charAt = fullName.charAt(0)) === null || _fullName$charAt === void 0 ? void 0 : _fullName$charAt.toUpperCase()), /*#__PURE__*/React__default.createElement("div", {
6063
+ className: "header-content"
6064
+ }, /*#__PURE__*/React__default.createElement("h2", {
6065
+ className: "name"
6066
+ }, fullName), /*#__PURE__*/React__default.createElement("div", {
6067
+ className: "designation"
6068
+ }, t("EKYC_ADMIN") || "eKYC Admin / Manager"), /*#__PURE__*/React__default.createElement("div", {
6069
+ className: "mobile-number"
6070
+ }, mobileNumber))), /*#__PURE__*/React__default.createElement("button", {
6071
+ className: "download-excel-btn",
6072
+ disabled: ekycDownloadLoading,
6073
+ onClick: handleDownloadEkycData
6074
+ }, /*#__PURE__*/React__default.createElement("svg", {
6075
+ width: "16",
6076
+ height: "16",
6077
+ viewBox: "0 0 24 24",
6078
+ fill: "none",
6079
+ stroke: "currentColor",
6080
+ strokeWidth: "2.5",
6081
+ strokeLinecap: "round",
6082
+ strokeLinejoin: "round"
6083
+ }, /*#__PURE__*/React__default.createElement("path", {
6084
+ d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
6085
+ }), /*#__PURE__*/React__default.createElement("polyline", {
6086
+ points: "7 10 12 15 17 10"
6087
+ }), /*#__PURE__*/React__default.createElement("line", {
6088
+ x1: "12",
6089
+ y1: "15",
6090
+ x2: "12",
6091
+ y2: "3"
6092
+ })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel")), /*#__PURE__*/React__default.createElement("div", {
6093
+ className: "admin-performance-section"
6094
+ }, /*#__PURE__*/React__default.createElement("h3", {
6095
+ className: "section-title"
6096
+ }, t("EKYC_VENDORS_PERFORMANCE") || "eKYC Vendors Performance"), isVendorSearchLoading || isProgressLoading ? /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null) : /*#__PURE__*/React__default.createElement("div", {
6097
+ className: "vendors-grid"
6098
+ }, vendorsList.length === 0 ? /*#__PURE__*/React__default.createElement("div", {
6099
+ className: "no-vendors"
6100
+ }, t("NO_VENDORS_FOUND") || "No vendors found.") : vendorsList.map(vendor => /*#__PURE__*/React__default.createElement("div", {
6101
+ key: vendor.id,
6102
+ className: "vendor-perf-card",
6103
+ onClick: () => history.push("/digit-ui/employee/ekyc/vendors/" + vendor.id)
6104
+ }, /*#__PURE__*/React__default.createElement("div", {
6105
+ className: "card-header"
6106
+ }, /*#__PURE__*/React__default.createElement("div", {
6107
+ className: "vendor-info"
6108
+ }, /*#__PURE__*/React__default.createElement("h4", null, vendor.name), /*#__PURE__*/React__default.createElement("p", null, t("MOBILE") || "Mobile", ": ", vendor.mobileNumber)), /*#__PURE__*/React__default.createElement("span", {
6109
+ className: "progress-badge"
6110
+ }, vendor.progress, "%")), /*#__PURE__*/React__default.createElement("div", {
6111
+ className: "progress-bar-container"
6112
+ }, /*#__PURE__*/React__default.createElement("div", {
6113
+ className: "progress-bar-fill",
6114
+ style: {
6115
+ width: vendor.progress + "%"
6116
+ }
6117
+ })), /*#__PURE__*/React__default.createElement("div", {
6118
+ className: "stats-grid"
6119
+ }, /*#__PURE__*/React__default.createElement("div", {
6120
+ className: "stat-item"
6121
+ }, /*#__PURE__*/React__default.createElement("div", {
6122
+ className: "value"
6123
+ }, vendor.supervisors), /*#__PURE__*/React__default.createElement("div", {
6124
+ className: "label"
6125
+ }, t("SUPERVISORS") || "Supervisors")), /*#__PURE__*/React__default.createElement("div", {
6126
+ className: "stat-item"
6127
+ }, /*#__PURE__*/React__default.createElement("div", {
6128
+ className: "value"
6129
+ }, vendor.surveyors), /*#__PURE__*/React__default.createElement("div", {
6130
+ className: "label"
6131
+ }, t("SURVEYORS") || "Surveyors")), /*#__PURE__*/React__default.createElement("div", {
6132
+ className: "stat-item"
6133
+ }, /*#__PURE__*/React__default.createElement("div", {
6134
+ className: "value completed-val"
6135
+ }, vendor.completed), /*#__PURE__*/React__default.createElement("div", {
6136
+ className: "label"
6137
+ }, t("COMPLETED") || "Completed"))), /*#__PURE__*/React__default.createElement("div", {
6138
+ className: "card-footer"
6139
+ }, /*#__PURE__*/React__default.createElement("span", null, t("PENDING") || "Pending", ": ", /*#__PURE__*/React__default.createElement("span", {
6140
+ className: "pending-count"
6141
+ }, vendor.pending)), /*#__PURE__*/React__default.createElement("span", null, t("REJECTED") || "Rejected", ": ", /*#__PURE__*/React__default.createElement("span", {
6142
+ className: "rejected-count"
6143
+ }, vendor.rejected))))))));
5831
6144
  };
5832
6145
 
5833
- const SurveyorDetailsDashboard = () => {
5834
- 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;
5835
- const tenantId = Digit.ULBService.getCurrentTenantId();
5836
- const _useState = React.useState(false),
5837
- showModal = _useState[0],
5838
- setShowModal = _useState[1];
5839
- const _useState2 = React.useState(false),
5840
- showOptions = _useState2[0],
5841
- setShowOptions = _useState2[1];
5842
- const _useState3 = React.useState(false),
5843
- ekycDownloadLoading = _useState3[0],
5844
- setEkycDownloadLoading = _useState3[1];
5845
- const _useParams = reactRouterDom.useParams(),
5846
- surveyorId = _useParams.id;
5847
- 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;
6146
+ const SupervisorDetailsCard = () => {
6147
+ var _Digit$SessionStorage, _fullName$charAt;
5848
6148
  const _useTranslation = reactI18next.useTranslation(),
5849
- t = _useTranslation.t;
5850
- const searchParams = surveyorId ? {
5851
- ids: surveyorId
5852
- } : {
5853
- ownerIds
5854
- };
5855
- const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSurveyorSearch(tenantId, searchParams, {
5856
- staleTime: Infinity
6149
+ t = _useTranslation.t;
6150
+ const history = reactRouterDom.useHistory();
6151
+ const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
6152
+ const _useParams = reactRouterDom.useParams(),
6153
+ supervisorId = _useParams.id;
6154
+ const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
6155
+ const _useState = React.useState(false),
6156
+ ekycDownloadLoading = _useState[0],
6157
+ setEkycDownloadLoading = _useState[1];
6158
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycAssignmentProgress({
6159
+ enabled: !!tenantId,
6160
+ keepPreviousData: true
5857
6161
  }),
5858
- surveyorSearchResponse = _Digit$Hooks$fsm$useS.data,
5859
- isLoading = _Digit$Hooks$fsm$useS.isLoading;
5860
- const roles = (_Digit$SessionStorage3 = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage3 === void 0 ? void 0 : (_Digit$SessionStorage4 = _Digit$SessionStorage3.info) === null || _Digit$SessionStorage4 === void 0 ? void 0 : _Digit$SessionStorage4.roles.map(ele => ele.code);
5861
- const surveyor = React.useMemo(() => {
5862
- var _surveyorSearchRespon;
5863
- return (surveyorSearchResponse === null || surveyorSearchResponse === void 0 ? void 0 : (_surveyorSearchRespon = surveyorSearchResponse.surveyors) === null || _surveyorSearchRespon === void 0 ? void 0 : _surveyorSearchRespon[0]) || null;
5864
- }, [surveyorSearchResponse]);
5865
- const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
6162
+ isProgressLoading = _Digit$Hooks$ekyc$use.isLoading,
6163
+ progressData = _Digit$Hooks$ekyc$use.data;
6164
+ const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
6165
+ status: "ACTIVE"
6166
+ }, {
6167
+ enabled: !!tenantId
6168
+ }),
6169
+ supervisorSearchResponse = _Digit$Hooks$fsm$useS.data,
6170
+ isSupervisorSearchLoading = _Digit$Hooks$fsm$useS.isLoading;
6171
+ const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSurveyorSearch(tenantId, {
5866
6172
  status: "ACTIVE"
5867
6173
  }, {
5868
6174
  enabled: !!tenantId
5869
6175
  }),
5870
- vendorData = _Digit$Hooks$fsm$useD.data;
5871
- const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
6176
+ surveyorSearchResponse = _Digit$Hooks$fsm$useS2.data,
6177
+ isSurveyorSearchLoading = _Digit$Hooks$fsm$useS2.isLoading;
6178
+ const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
5872
6179
  status: "ACTIVE"
5873
6180
  }, {
5874
6181
  enabled: !!tenantId
5875
6182
  }),
5876
- supervisorSearchResponse = _Digit$Hooks$fsm$useS2.data;
6183
+ vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
6184
+ isVendorSearchLoading = _Digit$Hooks$fsm$useD.isLoading;
6185
+ const supervisor = React.useMemo(() => {
6186
+ if (progressData !== null && progressData !== void 0 && progressData.supervisorReport) {
6187
+ let found = null;
6188
+ const targetId = supervisorId || (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid);
6189
+ if (targetId) {
6190
+ found = progressData.supervisorReport.find(s => {
6191
+ var _s$supervisorId, _s$id;
6192
+ return ((_s$supervisorId = s.supervisorId) === null || _s$supervisorId === void 0 ? void 0 : _s$supervisorId.toLowerCase()) === (targetId === null || targetId === void 0 ? void 0 : targetId.toLowerCase()) || ((_s$id = s.id) === null || _s$id === void 0 ? void 0 : _s$id.toLowerCase()) === (targetId === null || targetId === void 0 ? void 0 : targetId.toLowerCase());
6193
+ });
6194
+ }
6195
+ if (found) return found;
6196
+ }
6197
+ if (supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors) {
6198
+ let matchedSup = null;
6199
+ const targetId = supervisorId || (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid);
6200
+ if (targetId) {
6201
+ matchedSup = supervisorSearchResponse.supervisors.find(s => {
6202
+ var _s$id2, _s$owner, _s$owner$uuid;
6203
+ return ((_s$id2 = s.id) === null || _s$id2 === void 0 ? void 0 : _s$id2.toLowerCase()) === (targetId === null || targetId === void 0 ? void 0 : targetId.toLowerCase()) || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : (_s$owner$uuid = _s$owner.uuid) === null || _s$owner$uuid === void 0 ? void 0 : _s$owner$uuid.toLowerCase()) === (targetId === null || targetId === void 0 ? void 0 : targetId.toLowerCase());
6204
+ });
6205
+ }
6206
+ if (matchedSup) {
6207
+ var _matchedSup$owner2, _matchedSup$owner3, _matchedSup$owner4;
6208
+ const matchedSurveyors = surveyorSearchResponse !== null && surveyorSearchResponse !== void 0 && surveyorSearchResponse.surveyors ? surveyorSearchResponse.surveyors.filter(surv => {
6209
+ var _matchedSup$owner;
6210
+ return surv.supervisorId === (matchedSup.id || ((_matchedSup$owner = matchedSup.owner) === null || _matchedSup$owner === void 0 ? void 0 : _matchedSup$owner.uuid));
6211
+ }).map(surv => {
6212
+ var _surv$owner3, _surv$owner4, _surv$owner5, _realStats, _realStats2, _realStats3, _realStats4;
6213
+ let realStats = null;
6214
+ if (progressData !== null && progressData !== void 0 && progressData.supervisorReport) {
6215
+ for (const report of progressData.supervisorReport) {
6216
+ var _report$surveyors;
6217
+ const matchedSurv = (_report$surveyors = report.surveyors) === null || _report$surveyors === void 0 ? void 0 : _report$surveyors.find(s => {
6218
+ var _surv$owner, _surv$owner2;
6219
+ return s.surveyorId && (s.surveyorId === surv.id || s.surveyorId === ((_surv$owner = surv.owner) === null || _surv$owner === void 0 ? void 0 : _surv$owner.uuid)) || s.id && (s.id === surv.id || s.id === ((_surv$owner2 = surv.owner) === null || _surv$owner2 === void 0 ? void 0 : _surv$owner2.uuid));
6220
+ });
6221
+ if (matchedSurv) {
6222
+ realStats = matchedSurv;
6223
+ break;
6224
+ }
6225
+ }
6226
+ }
6227
+ return {
6228
+ surveyorId: surv.id || ((_surv$owner3 = surv.owner) === null || _surv$owner3 === void 0 ? void 0 : _surv$owner3.uuid),
6229
+ surveyorName: surv.name || ((_surv$owner4 = surv.owner) === null || _surv$owner4 === void 0 ? void 0 : _surv$owner4.name) || "N/A",
6230
+ mobileNo: ((_surv$owner5 = surv.owner) === null || _surv$owner5 === void 0 ? void 0 : _surv$owner5.mobileNumber) || surv.mobileNo || "N/A",
6231
+ status: surv.status || "ACTIVE",
6232
+ totalKnos: ((_realStats = realStats) === null || _realStats === void 0 ? void 0 : _realStats.totalKnos) || 0,
6233
+ submittedKnos: ((_realStats2 = realStats) === null || _realStats2 === void 0 ? void 0 : _realStats2.submittedKnos) || 0,
6234
+ pendingKnos: ((_realStats3 = realStats) === null || _realStats3 === void 0 ? void 0 : _realStats3.pendingKnos) || 0,
6235
+ progressPercent: ((_realStats4 = realStats) === null || _realStats4 === void 0 ? void 0 : _realStats4.progressPercent) || 0
6236
+ };
6237
+ }) : [];
6238
+ const totalKnos = matchedSurveyors.reduce((acc, s) => acc + (s.totalKnos || 0), 0);
6239
+ const submittedKnos = matchedSurveyors.reduce((acc, s) => acc + (s.submittedKnos || 0), 0);
6240
+ const pendingKnos = matchedSurveyors.reduce((acc, s) => acc + (s.pendingKnos || 0), 0);
6241
+ const progressPercent = totalKnos > 0 ? Math.round(submittedKnos / totalKnos * 100) : 0;
6242
+ return {
6243
+ supervisorId: matchedSup.id || ((_matchedSup$owner2 = matchedSup.owner) === null || _matchedSup$owner2 === void 0 ? void 0 : _matchedSup$owner2.uuid),
6244
+ supervisorName: matchedSup.name || ((_matchedSup$owner3 = matchedSup.owner) === null || _matchedSup$owner3 === void 0 ? void 0 : _matchedSup$owner3.name) || "N/A",
6245
+ mobileNo: ((_matchedSup$owner4 = matchedSup.owner) === null || _matchedSup$owner4 === void 0 ? void 0 : _matchedSup$owner4.mobileNumber) || matchedSup.mobileNo || "N/A",
6246
+ status: matchedSup.status || "ACTIVE",
6247
+ assignedZoneId: matchedSup.assignedZoneId || "N/A",
6248
+ vendorId: matchedSup.vendorId,
6249
+ surveyors: matchedSurveyors,
6250
+ totalKnos,
6251
+ submittedKnos,
6252
+ pendingKnos,
6253
+ progressPercent
6254
+ };
6255
+ }
6256
+ }
6257
+ return null;
6258
+ }, [progressData, supervisorSearchResponse, surveyorSearchResponse, supervisorId, loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid]);
6259
+ const fullName = (supervisor === null || supervisor === void 0 ? void 0 : supervisor.supervisorName) || "N/A";
6260
+ const mobileNumber = (supervisor === null || supervisor === void 0 ? void 0 : supervisor.mobileNo) || "N/A";
6261
+ const email = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.emailId) || "N/A";
6262
+ const gender = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.gender) || "N/A";
6263
+ const status = (supervisor === null || supervisor === void 0 ? void 0 : supervisor.status) || "N/A";
6264
+ const assignedZone = (supervisor === null || supervisor === void 0 ? void 0 : supervisor.assignedZoneId) || "N/A";
5877
6265
  const vendorName = React.useMemo(() => {
5878
- var _mappedVendor$dsoDeta;
5879
- if (surveyor !== null && surveyor !== void 0 && surveyor.vendorName) return surveyor.vendorName;
5880
- if (!vendorData || !(surveyor !== null && surveyor !== void 0 && surveyor.vendorId)) return "N/A";
5881
- const mappedVendor = vendorData.find(v => {
6266
+ var _matchedVendor$dsoDet;
6267
+ if (!vendorSearchResponse || !supervisor) return "N/A";
6268
+ const targetVendorId = supervisor.vendorId;
6269
+ if (!targetVendorId) return "N/A";
6270
+ const matchedVendor = vendorSearchResponse.find(v => {
5882
6271
  var _v$dsoDetails, _v$dsoDetails2;
5883
- return ((_v$dsoDetails = v.dsoDetails) === null || _v$dsoDetails === void 0 ? void 0 : _v$dsoDetails.id) === surveyor.vendorId || ((_v$dsoDetails2 = v.dsoDetails) === null || _v$dsoDetails2 === void 0 ? void 0 : _v$dsoDetails2.vendorId) === surveyor.vendorId;
5884
- });
5885
- return (mappedVendor === null || mappedVendor === void 0 ? void 0 : (_mappedVendor$dsoDeta = mappedVendor.dsoDetails) === null || _mappedVendor$dsoDeta === void 0 ? void 0 : _mappedVendor$dsoDeta.name) || surveyor.vendorId || "N/A";
5886
- }, [vendorData, surveyor === null || surveyor === void 0 ? void 0 : surveyor.vendorId, surveyor === null || surveyor === void 0 ? void 0 : surveyor.vendorName]);
5887
- const supervisorName = React.useMemo(() => {
5888
- var _mappedSupervisor$own;
5889
- if (surveyor !== null && surveyor !== void 0 && surveyor.supervisorName) return surveyor.supervisorName;
5890
- if (!(supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors) || !(surveyor !== null && surveyor !== void 0 && surveyor.supervisorId)) return "N/A";
5891
- const mappedSupervisor = supervisorSearchResponse.supervisors.find(s => {
5892
- var _s$owner;
5893
- return s.id === surveyor.supervisorId || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : _s$owner.uuid) === surveyor.supervisorId;
6272
+ return ((_v$dsoDetails = v.dsoDetails) === null || _v$dsoDetails === void 0 ? void 0 : _v$dsoDetails.id) === targetVendorId || ((_v$dsoDetails2 = v.dsoDetails) === null || _v$dsoDetails2 === void 0 ? void 0 : _v$dsoDetails2.vendorId) === targetVendorId || v.id === targetVendorId || v.vendorId === targetVendorId;
5894
6273
  });
5895
- return (mappedSupervisor === null || mappedSupervisor === void 0 ? void 0 : mappedSupervisor.name) || (mappedSupervisor === null || mappedSupervisor === void 0 ? void 0 : (_mappedSupervisor$own = mappedSupervisor.owner) === null || _mappedSupervisor$own === void 0 ? void 0 : _mappedSupervisor$own.name) || surveyor.supervisorId || "N/A";
5896
- }, [supervisorSearchResponse, surveyor === null || surveyor === void 0 ? void 0 : surveyor.supervisorId, surveyor === null || surveyor === void 0 ? void 0 : surveyor.supervisorName]);
5897
- 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";
5898
- 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);
5899
- 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";
5900
- const _useState4 = React.useState(0),
5901
- currentPage = _useState4[0],
5902
- setCurrentPage = _useState4[1];
5903
- const _useState5 = React.useState(20),
5904
- pageSize = _useState5[0],
5905
- setPageSize = _useState5[1];
5906
- const queryParams = {
5907
- tenantId: "dl.djb",
5908
- offset: currentPage * pageSize,
5909
- limit: pageSize,
5910
- surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner4 = surveyor.owner) === null || _surveyor$owner4 === void 0 ? void 0 : _surveyor$owner4.uuid
5911
- };
5912
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycSurveyorDashboard({}, queryParams, {
5913
- enabled: !!queryParams.tenantId && !!queryParams.surveyorId,
5914
- keepPreviousData: true
5915
- }),
5916
- isDashboardLoading = _Digit$Hooks$ekyc$use.isFetching,
5917
- _Digit$Hooks$ekyc$use2 = _Digit$Hooks$ekyc$use.data,
5918
- dashboardData = _Digit$Hooks$ekyc$use2 === void 0 ? {} : _Digit$Hooks$ekyc$use2,
5919
- refetchDashboard = _Digit$Hooks$ekyc$use.refetch;
5920
- const knoColumns = React.useMemo(() => [{
5921
- Header: "KNO",
5922
- accessor: "kno"
6274
+ return (matchedVendor === null || matchedVendor === void 0 ? void 0 : (_matchedVendor$dsoDet = matchedVendor.dsoDetails) === null || _matchedVendor$dsoDet === void 0 ? void 0 : _matchedVendor$dsoDet.name) || (matchedVendor === null || matchedVendor === void 0 ? void 0 : matchedVendor.name) || "N/A";
6275
+ }, [vendorSearchResponse, supervisor]);
6276
+ const surveyors = React.useMemo(() => {
6277
+ return (supervisor === null || supervisor === void 0 ? void 0 : supervisor.surveyors) || [];
6278
+ }, [supervisor]);
6279
+ const cards = React.useMemo(() => [{
6280
+ label: "TOTAL_EKYC_APPLICATIONS",
6281
+ count: (supervisor === null || supervisor === void 0 ? void 0 : supervisor.totalKnos) || 0,
6282
+ color: "#0B2559",
6283
+ type: "today",
6284
+ icon: /*#__PURE__*/React__default.createElement(fa.FaUsers, null)
5923
6285
  }, {
5924
- Header: "Consumer Name",
5925
- accessor: row => ((row.firstName || "") + " " + (row.middleName || "") + " " + (row.lastName || "")).trim(),
5926
- id: "consumerName"
6286
+ label: "EKYC_COMPLETED",
6287
+ count: (supervisor === null || supervisor === void 0 ? void 0 : supervisor.submittedKnos) || 0,
6288
+ color: "#10B981",
6289
+ type: "month",
6290
+ icon: /*#__PURE__*/React__default.createElement(fa.FaCheckCircle, null)
5927
6291
  }, {
5928
- Header: "Zone",
5929
- accessor: "zoneName"
6292
+ label: "PENDING_APPLICATIONS",
6293
+ count: (supervisor === null || supervisor === void 0 ? void 0 : supervisor.pendingKnos) || 0,
6294
+ color: "#F59E0B",
6295
+ type: "pending",
6296
+ icon: /*#__PURE__*/React__default.createElement(fa.FaClock, null)
5930
6297
  }, {
5931
- Header: "Status",
5932
- accessor: "status",
6298
+ label: "OVERALL_PROGRESS",
6299
+ count: ((supervisor === null || supervisor === void 0 ? void 0 : supervisor.progressPercent) || 0) + "%",
6300
+ color: "#A855F7",
6301
+ type: "progress",
6302
+ icon: /*#__PURE__*/React__default.createElement(fa.FaChartLine, null)
6303
+ }], [supervisor]);
6304
+ const _useState2 = React.useState(0),
6305
+ currentPage = _useState2[0],
6306
+ setCurrentPage = _useState2[1];
6307
+ const _useState3 = React.useState(20),
6308
+ pageSize = _useState3[0],
6309
+ setPageSize = _useState3[1];
6310
+ const paginatedSurveyors = React.useMemo(() => {
6311
+ const start = currentPage * pageSize;
6312
+ const end = start + pageSize;
6313
+ return surveyors.slice(start, end);
6314
+ }, [surveyors, currentPage, pageSize]);
6315
+ const surveyorColumns = React.useMemo(() => [{
6316
+ Header: t("SURVEYOR_NAME") || "Surveyor Name",
6317
+ accessor: row => (row === null || row === void 0 ? void 0 : row.surveyorName) || "N/A",
5933
6318
  Cell: _ref => {
5934
- let value = _ref.value;
5935
- return /*#__PURE__*/React__default.createElement("span", {
5936
- className: "status-badge " + (value === "ACTIVE" ? "verified" : value === "PENDING" ? "pending" : "assigned")
5937
- }, value);
6319
+ var _Digit$SessionStorage2, _Digit$SessionStorage3, _Digit$SessionStorage4, _row$original;
6320
+ let row = _ref.row;
6321
+ 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";
6322
+ const targetPath = "/digit-ui/" + userType + "/ekyc/surveyor-dashboard/" + row.original.surveyorId;
6323
+ return /*#__PURE__*/React__default.createElement("a", {
6324
+ href: targetPath,
6325
+ style: {
6326
+ color: "#1D70B8",
6327
+ fontWeight: "600",
6328
+ textDecoration: "none"
6329
+ },
6330
+ onClick: e => {
6331
+ e.preventDefault();
6332
+ history.push(targetPath);
6333
+ }
6334
+ }, ((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.surveyorName) || "N/A");
5938
6335
  }
5939
6336
  }, {
5940
- Header: "eKYC Status",
5941
- accessor: "ekycStatus",
5942
- Cell: _ref2 => {
5943
- let value = _ref2.value;
5944
- return value || "-";
5945
- }
5946
- }], []);
5947
- const _useState6 = React.useState(false),
5948
- showReportMenu = _useState6[0],
5949
- setShowReportMenu = _useState6[1];
5950
- const _useState7 = React.useState({
5951
- from: "",
5952
- to: ""
5953
- }),
5954
- customDate = _useState7[0],
5955
- setCustomDate = _useState7[1];
5956
- const _useState8 = React.useState(false),
5957
- showCustomPicker = _useState8[0],
5958
- setShowCustomPicker = _useState8[1];
5959
- const _useState9 = React.useState(false),
5960
- reportLoading = _useState9[0],
5961
- setReportLoading = _useState9[1];
5962
- const reportMenuRef = React.useRef(null);
5963
- React.useEffect(() => {
5964
- const handler = e => {
5965
- if (reportMenuRef.current && !reportMenuRef.current.contains(e.target)) {
5966
- setShowReportMenu(false);
5967
- setShowCustomPicker(false);
5968
- }
5969
- };
5970
- document.addEventListener("mousedown", handler);
5971
- return () => document.removeEventListener("mousedown", handler);
5972
- }, []);
5973
- if (isLoading) {
5974
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
5975
- }
5976
- if (!surveyor) {
5977
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, null, /*#__PURE__*/React__default.createElement("div", {
5978
- style: {
5979
- padding: "24px"
5980
- }
5981
- }, t("NO_SURVEYOR_FOUND")));
5982
- }
5983
- const getDateRange = filter => {
5984
- const now = new Date();
5985
- const start = new Date(now);
5986
- if (filter === "today") {
5987
- start.setHours(0, 0, 0, 0);
5988
- return {
5989
- from: start,
5990
- to: now
5991
- };
5992
- }
5993
- if (filter === "week") {
5994
- start.setDate(now.getDate() - now.getDay());
5995
- start.setHours(0, 0, 0, 0);
5996
- return {
5997
- from: start,
5998
- to: now
5999
- };
6000
- }
6001
- if (filter === "month") {
6002
- start.setDate(1);
6003
- start.setHours(0, 0, 0, 0);
6004
- return {
6005
- from: start,
6006
- to: now
6007
- };
6008
- }
6009
- return null;
6010
- };
6011
- const handlePresetDownload = function (filter) {
6012
- try {
6013
- const range = getDateRange(filter);
6014
- if (!range) return Promise.resolve();
6015
- setReportLoading(true);
6016
- const _temp = _finallyRethrows(function () {
6017
- return _catch(function () {
6018
- var _surveyor$owner5;
6019
- return Promise.resolve(Digit.EkycService.dashboard({}, {
6020
- tenantId: "dl.djb",
6021
- offset: 0,
6022
- limit: 1000,
6023
- surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner5 = surveyor.owner) === null || _surveyor$owner5 === void 0 ? void 0 : _surveyor$owner5.uuid,
6024
- fromDate: range.from.getTime(),
6025
- toDate: range.to.getTime()
6026
- })).then(function (response) {
6027
- var _response$dashboardIn;
6028
- const rows = (response === null || response === void 0 ? void 0 : (_response$dashboardIn = response.dashboardInfo) === null || _response$dashboardIn === void 0 ? void 0 : _response$dashboardIn.consumerList) || [];
6029
- downloadSurveyorPDF({
6030
- rows: rows,
6031
- surveyorName: fullName,
6032
- vendorName,
6033
- supervisorName,
6034
- employeeId,
6035
- mobileNumber,
6036
- dashboardInfo: (response === null || response === void 0 ? void 0 : response.dashboardInfo) || {},
6037
- t
6038
- });
6039
- });
6040
- }, function (err) {
6041
- console.error("Failed to fetch dashboard data for report download:", err);
6042
- });
6043
- }, function (_wasThrown, _result) {
6044
- setReportLoading(false);
6045
- setShowReportMenu(false);
6046
- setShowCustomPicker(false);
6047
- if (_wasThrown) throw _result;
6048
- return _result;
6049
- });
6050
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
6051
- } catch (e) {
6052
- return Promise.reject(e);
6337
+ Header: t("MOBILE_NUMBER") || "Mobile Number",
6338
+ accessor: row => (row === null || row === void 0 ? void 0 : row.mobileNo) || "N/A",
6339
+ id: "mobileNumber"
6340
+ }, {
6341
+ Header: t("STATUS") || "Status",
6342
+ accessor: () => "ACTIVE",
6343
+ id: "status",
6344
+ Cell: _ref2 => {
6345
+ let value = _ref2.value;
6346
+ return /*#__PURE__*/React__default.createElement("span", {
6347
+ className: "status-badge verified"
6348
+ }, t(value) || value);
6053
6349
  }
6054
- };
6055
- const handleCustomDownload = function () {
6056
- try {
6057
- if (!customDate.from || !customDate.to) {
6058
- alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
6059
- return Promise.resolve();
6060
- }
6061
- const from = new Date(customDate.from);
6062
- from.setHours(0, 0, 0, 0);
6063
- const to = new Date(customDate.to);
6064
- to.setHours(23, 59, 59, 999);
6065
- setReportLoading(true);
6066
- const _temp2 = _finallyRethrows(function () {
6067
- return _catch(function () {
6068
- var _surveyor$owner6;
6069
- return Promise.resolve(Digit.EkycService.dashboard({}, {
6070
- tenantId: "dl.djb",
6071
- offset: 0,
6072
- limit: 1000,
6073
- surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner6 = surveyor.owner) === null || _surveyor$owner6 === void 0 ? void 0 : _surveyor$owner6.uuid,
6074
- fromDate: from.getTime(),
6075
- toDate: to.getTime()
6076
- })).then(function (response) {
6077
- var _response$dashboardIn2;
6078
- const rows = (response === null || response === void 0 ? void 0 : (_response$dashboardIn2 = response.dashboardInfo) === null || _response$dashboardIn2 === void 0 ? void 0 : _response$dashboardIn2.consumerList) || [];
6079
- downloadSurveyorPDF({
6080
- rows: rows,
6081
- surveyorName: fullName,
6082
- vendorName,
6083
- supervisorName,
6084
- employeeId,
6085
- mobileNumber,
6086
- dashboardInfo: (response === null || response === void 0 ? void 0 : response.dashboardInfo) || {},
6087
- t
6088
- });
6089
- });
6090
- }, function (err) {
6091
- console.error("Failed to fetch custom dashboard data for report download:", err);
6092
- });
6093
- }, function (_wasThrown2, _result2) {
6094
- setReportLoading(false);
6350
+ }, {
6351
+ Header: t("TOTAL_EKYC_APPLICATIONS") || "Total eKYC Applications",
6352
+ accessor: row => (row === null || row === void 0 ? void 0 : row.totalKnos) || 0,
6353
+ id: "totalEkycApplications"
6354
+ }, {
6355
+ Header: t("EKYC_COMPLETED") || "eKYC Completed",
6356
+ accessor: row => (row === null || row === void 0 ? void 0 : row.submittedKnos) || 0,
6357
+ id: "ekycCompleted"
6358
+ }, {
6359
+ Header: t("PENDING_APPLICATIONS") || "Pending Applications",
6360
+ accessor: row => (row === null || row === void 0 ? void 0 : row.pendingKnos) || 0,
6361
+ id: "pendingApplications"
6362
+ }, {
6363
+ Header: t("OVERALL_PROGRESS") || "Overall Progress",
6364
+ accessor: row => ((row === null || row === void 0 ? void 0 : row.progressPercent) || 0) + "%",
6365
+ id: "overallProgress"
6366
+ }], [t, history]);
6367
+ const _useState4 = React.useState(false),
6368
+ showReportMenu = _useState4[0],
6369
+ setShowReportMenu = _useState4[1];
6370
+ const _useState5 = React.useState({
6371
+ from: "",
6372
+ to: ""
6373
+ }),
6374
+ customDate = _useState5[0],
6375
+ setCustomDate = _useState5[1];
6376
+ const _useState6 = React.useState(false),
6377
+ showCustomPicker = _useState6[0],
6378
+ setShowCustomPicker = _useState6[1];
6379
+ const _useState7 = React.useState(false),
6380
+ reportLoading = _useState7[0];
6381
+ const reportMenuRef = React.useRef(null);
6382
+ React.useEffect(() => {
6383
+ const handler = e => {
6384
+ if (reportMenuRef.current && !reportMenuRef.current.contains(e.target)) {
6095
6385
  setShowReportMenu(false);
6096
6386
  setShowCustomPicker(false);
6097
- if (_wasThrown2) throw _result2;
6098
- return _result2;
6099
- });
6100
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
6101
- } catch (e) {
6102
- return Promise.reject(e);
6103
- }
6104
- };
6105
- const StatCard = _ref3 => {
6106
- let title = _ref3.title,
6107
- value = _ref3.value,
6108
- type = _ref3.type,
6109
- isLoading = _ref3.isLoading,
6110
- icon = _ref3.icon;
6111
- return /*#__PURE__*/React__default.createElement("div", {
6112
- className: "stat-card " + type
6113
- }, isLoading ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
6114
- className: "stat-title skeleton skeleton-text"
6115
- }), /*#__PURE__*/React__default.createElement("div", {
6116
- className: "stat-value skeleton skeleton-number"
6117
- })) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
6118
- className: "stat-title"
6119
- }, title), /*#__PURE__*/React__default.createElement("div", {
6120
- className: "stat-value"
6121
- }, value), icon && /*#__PURE__*/React__default.createElement("div", {
6122
- className: "stat-icon"
6123
- }, icon)));
6387
+ }
6388
+ };
6389
+ document.addEventListener("mousedown", handler);
6390
+ return () => document.removeEventListener("mousedown", handler);
6391
+ }, []);
6392
+ const handlePresetDownload = filter => {
6393
+ handleDownload();
6124
6394
  };
6125
- const options = [{
6126
- action: "Assign"
6127
- }];
6128
- const handleMenuSelect = option => {
6129
- setShowOptions(false);
6130
- setShowModal(true);
6395
+ const handleCustomDownload = () => {
6396
+ if (!customDate.from || !customDate.to) {
6397
+ alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
6398
+ return;
6399
+ }
6400
+ handleDownload();
6131
6401
  };
6132
6402
  const handleDownloadEkycData = function () {
6133
6403
  try {
6404
+ if (!surveyors || surveyors.length === 0) {
6405
+ alert(t("NO_SURVEYORS_ASSIGNED") || "No surveyors assigned to this supervisor.");
6406
+ return Promise.resolve();
6407
+ }
6134
6408
  setEkycDownloadLoading(true);
6135
6409
  return Promise.resolve(_finallyRethrows(function () {
6136
6410
  return _catch(function () {
6137
- var _surveyor$owner7;
6138
- return Promise.resolve(Digit.EkycService.application_list({
6411
+ const fetchPromises = surveyors.map(s => Digit.EkycService.application_list({
6139
6412
  tenantId: tenantId || "dl.djb",
6140
6413
  offset: 0,
6141
- limit: 10000,
6142
- surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner7 = surveyor.owner) === null || _surveyor$owner7 === void 0 ? void 0 : _surveyor$owner7.uuid,
6414
+ limit: 5000,
6415
+ surveyorId: s.surveyorId || s.id,
6143
6416
  reportDownload: true
6144
- })).then(function (response) {
6145
- const consumerList = (response === null || response === void 0 ? void 0 : response.consumerList) || [];
6417
+ }).catch(err => {
6418
+ console.error("Error fetching applications for surveyor " + s.surveyorName + ":", err);
6419
+ return {
6420
+ consumerList: []
6421
+ };
6422
+ }));
6423
+ return Promise.resolve(Promise.all(fetchPromises)).then(function (results) {
6424
+ const consumerList = results.flatMap(res => (res === null || res === void 0 ? void 0 : res.consumerList) || []);
6146
6425
  if (consumerList.length === 0) {
6147
6426
  alert(t("NO_DATA_FOUND") || "No data found for download.");
6148
6427
  return;
@@ -6185,29 +6464,52 @@ const SurveyorDetailsDashboard = () => {
6185
6464
  });
6186
6465
  return cleanObj;
6187
6466
  });
6188
- const cleanFileName = "eKYC_Data_" + fullName.replace(/[^a-zA-Z0-9]/g, "_");
6467
+ const cleanFileName = "eKYC_Data_Supervisor_" + fullName.replace(/[^a-zA-Z0-9]/g, "_");
6189
6468
  Digit.Download.Excel(excelData, cleanFileName);
6190
6469
  });
6191
6470
  }, function (error) {
6192
6471
  console.error("Error downloading eKYC Excel:", error);
6193
6472
  });
6194
- }, function (_wasThrown3, _result3) {
6473
+ }, function (_wasThrown, _result) {
6195
6474
  setEkycDownloadLoading(false);
6196
- if (_wasThrown3) throw _result3;
6197
- return _result3;
6475
+ if (_wasThrown) throw _result;
6476
+ return _result;
6198
6477
  }));
6199
6478
  } catch (e) {
6200
6479
  return Promise.reject(e);
6201
6480
  }
6202
6481
  };
6203
- const closeModal = function () {
6204
- try {
6205
- setShowModal(false);
6206
- return Promise.resolve();
6207
- } catch (e) {
6208
- return Promise.reject(e);
6209
- }
6482
+ const StatCard = _ref3 => {
6483
+ let title = _ref3.title,
6484
+ value = _ref3.value,
6485
+ type = _ref3.type,
6486
+ isLoading = _ref3.isLoading,
6487
+ icon = _ref3.icon;
6488
+ return /*#__PURE__*/React__default.createElement("div", {
6489
+ className: "stat-card " + type
6490
+ }, isLoading ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
6491
+ className: "stat-title skeleton skeleton-text"
6492
+ }), /*#__PURE__*/React__default.createElement("div", {
6493
+ className: "stat-value skeleton skeleton-number"
6494
+ })) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
6495
+ className: "stat-title"
6496
+ }, title), /*#__PURE__*/React__default.createElement("div", {
6497
+ className: "stat-value"
6498
+ }, value), icon && /*#__PURE__*/React__default.createElement("div", {
6499
+ className: "stat-icon"
6500
+ }, icon)));
6210
6501
  };
6502
+ const isPageLoading = isProgressLoading || isSupervisorSearchLoading || isSurveyorSearchLoading || isVendorSearchLoading;
6503
+ if (isPageLoading && !supervisor) {
6504
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
6505
+ }
6506
+ if (!supervisor) {
6507
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, null, /*#__PURE__*/React__default.createElement("div", {
6508
+ style: {
6509
+ padding: "24px"
6510
+ }
6511
+ }, t("NO_SUPERVISOR_FOUND")));
6512
+ }
6211
6513
  return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
6212
6514
  className: "surveyor-dashboard"
6213
6515
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -6222,7 +6524,7 @@ const SurveyorDetailsDashboard = () => {
6222
6524
  className: "name"
6223
6525
  }, fullName), /*#__PURE__*/React__default.createElement("div", {
6224
6526
  className: "designation"
6225
- }, (surveyor === null || surveyor === void 0 ? void 0 : surveyor.description) || t("FIELD_SURVEYOR")))), /*#__PURE__*/React__default.createElement("div", {
6527
+ }, t("FIELD_SUPERVISOR") || "Field Supervisor"))), /*#__PURE__*/React__default.createElement("div", {
6226
6528
  className: "report-download",
6227
6529
  ref: reportMenuRef
6228
6530
  }, /*#__PURE__*/React__default.createElement("button", {
@@ -6249,7 +6551,7 @@ const SurveyorDetailsDashboard = () => {
6249
6551
  return /*#__PURE__*/React__default.createElement("div", {
6250
6552
  key: key,
6251
6553
  className: "menu-item",
6252
- onClick: () => handlePresetDownload(key)
6554
+ onClick: () => handlePresetDownload()
6253
6555
  }, label);
6254
6556
  }), /*#__PURE__*/React__default.createElement("div", {
6255
6557
  className: "custom-date-trigger",
@@ -6283,33 +6585,14 @@ const SurveyorDetailsDashboard = () => {
6283
6585
  onClick: handleCustomDownload
6284
6586
  }, t("DOWNLOAD") || "Download"))))), /*#__PURE__*/React__default.createElement("div", {
6285
6587
  className: "stats-wrapper"
6286
- }, /*#__PURE__*/React__default.createElement(StatCard, {
6287
- title: t("TOTAL_ASSIGNED"),
6288
- value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.total) || 0,
6289
- type: "today",
6290
- isLoading: isDashboardLoading,
6291
- icon: /*#__PURE__*/React__default.createElement(fa.FaUsers, null)
6292
- }), /*#__PURE__*/React__default.createElement(StatCard, {
6293
- title: t("COMPLETED"),
6294
- value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo2 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo2 === void 0 ? void 0 : _dashboardData$dashbo2.completed) || 0,
6295
- type: "week",
6296
- isLoading: isDashboardLoading,
6297
- icon: /*#__PURE__*/React__default.createElement(fa.FaCheckCircle, null)
6298
- }), /*#__PURE__*/React__default.createElement(StatCard, {
6299
- title: t("PENDING"),
6300
- value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo3 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo3 === void 0 ? void 0 : _dashboardData$dashbo3.pending) || 0,
6301
- type: "pending",
6302
- isLoading: isDashboardLoading,
6303
- icon: /*#__PURE__*/React__default.createElement(fa.FaClock, null)
6304
- }), /*#__PURE__*/React__default.createElement(StatCard, {
6305
- title: t("SUBMITTED"),
6306
- value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo4 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo4 === void 0 ? void 0 : _dashboardData$dashbo4.submittedCount) || 0,
6307
- type: "month",
6308
- isLoading: isDashboardLoading,
6309
- icon: /*#__PURE__*/React__default.createElement(fa.FaChartLine, null)
6310
- })), /*#__PURE__*/React__default.createElement("div", {
6311
- className: "charts-wrapper"
6312
- }), /*#__PURE__*/React__default.createElement("div", {
6588
+ }, cards.map((card, idx) => /*#__PURE__*/React__default.createElement(StatCard, {
6589
+ key: idx,
6590
+ title: t(card.label),
6591
+ value: card.count,
6592
+ type: card.type,
6593
+ isLoading: isProgressLoading,
6594
+ icon: card.icon
6595
+ }))), /*#__PURE__*/React__default.createElement("div", {
6313
6596
  className: "ekyc-dashboard-section"
6314
6597
  }, /*#__PURE__*/React__default.createElement("div", {
6315
6598
  className: "ekyc-details-wrapper"
@@ -6323,43 +6606,37 @@ const SurveyorDetailsDashboard = () => {
6323
6606
  className: "label"
6324
6607
  }, t("MOBILE")), /*#__PURE__*/React__default.createElement("span", {
6325
6608
  className: "value"
6326
- }, (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__default.createElement("div", {
6609
+ }, mobileNumber)), /*#__PURE__*/React__default.createElement("div", {
6327
6610
  className: "detail-item"
6328
6611
  }, /*#__PURE__*/React__default.createElement("span", {
6329
6612
  className: "label"
6330
6613
  }, t("EMAIL")), /*#__PURE__*/React__default.createElement("span", {
6331
6614
  className: "value"
6332
- }, (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__default.createElement("div", {
6615
+ }, email)), /*#__PURE__*/React__default.createElement("div", {
6333
6616
  className: "detail-item"
6334
6617
  }, /*#__PURE__*/React__default.createElement("span", {
6335
6618
  className: "label"
6336
6619
  }, t("GENDER")), /*#__PURE__*/React__default.createElement("span", {
6337
6620
  className: "value"
6338
- }, (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__default.createElement("div", {
6621
+ }, gender)), /*#__PURE__*/React__default.createElement("div", {
6339
6622
  className: "detail-item"
6340
6623
  }, /*#__PURE__*/React__default.createElement("span", {
6341
6624
  className: "label"
6342
6625
  }, t("STATUS")), /*#__PURE__*/React__default.createElement("span", {
6343
6626
  className: "value"
6344
- }, (surveyor === null || surveyor === void 0 ? void 0 : surveyor.status) || "N/A")), /*#__PURE__*/React__default.createElement("div", {
6627
+ }, status)), /*#__PURE__*/React__default.createElement("div", {
6345
6628
  className: "detail-item"
6346
6629
  }, /*#__PURE__*/React__default.createElement("span", {
6347
6630
  className: "label"
6348
- }, t("SERVICE_TYPE")), /*#__PURE__*/React__default.createElement("span", {
6631
+ }, t("ASSIGNED_ZONE") || "Assigned Zone"), /*#__PURE__*/React__default.createElement("span", {
6349
6632
  className: "value"
6350
- }, (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__default.createElement("div", {
6633
+ }, assignedZone)), /*#__PURE__*/React__default.createElement("div", {
6351
6634
  className: "detail-item"
6352
6635
  }, /*#__PURE__*/React__default.createElement("span", {
6353
6636
  className: "label"
6354
6637
  }, t("VENDOR_NAME") || "Vendor Name"), /*#__PURE__*/React__default.createElement("span", {
6355
6638
  className: "value"
6356
- }, vendorName)), /*#__PURE__*/React__default.createElement("div", {
6357
- className: "detail-item"
6358
- }, /*#__PURE__*/React__default.createElement("span", {
6359
- className: "label"
6360
- }, t("SUPERVISOR_NAME") || "Supervisor Name"), /*#__PURE__*/React__default.createElement("span", {
6361
- className: "value"
6362
- }, supervisorName)))), /*#__PURE__*/React__default.createElement("div", {
6639
+ }, vendorName)))), /*#__PURE__*/React__default.createElement("div", {
6363
6640
  className: "details-right"
6364
6641
  }, /*#__PURE__*/React__default.createElement("div", {
6365
6642
  className: "download-card"
@@ -6389,19 +6666,17 @@ const SurveyorDetailsDashboard = () => {
6389
6666
  className: "dashboard-card"
6390
6667
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Table, {
6391
6668
  t: t,
6392
- tableTitle: t("ASSIGNED_KNOS"),
6393
- tableClass: "ekycTable",
6394
- data: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo5 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo5 === void 0 ? void 0 : _dashboardData$dashbo5.consumerList) || [],
6395
- columns: knoColumns,
6396
- isLoading: isDashboardLoading,
6397
- totalRecords: dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo6 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo6 === void 0 ? void 0 : _dashboardData$dashbo6.total,
6669
+ tableTitle: t("CONNECTED_SURVEYORS") || "Connected Surveyors",
6670
+ tableClass: "ekycTable",
6671
+ data: paginatedSurveyors,
6672
+ columns: surveyorColumns,
6673
+ isLoading: isProgressLoading,
6674
+ totalRecords: surveyors.length,
6398
6675
  currentPage: currentPage,
6399
6676
  pageSizeLimit: pageSize,
6400
- showAutoSerialNo: true,
6401
6677
  isPaginationRequired: true,
6402
6678
  onNextPage: () => {
6403
- var _dashboardData$dashbo7;
6404
- if (currentPage < ((dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo7 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo7 === void 0 ? void 0 : _dashboardData$dashbo7.totalPages) || 1) - 1) {
6679
+ if (currentPage < Math.ceil(surveyors.length / pageSize) - 1) {
6405
6680
  setCurrentPage(prev => prev + 1);
6406
6681
  }
6407
6682
  },
@@ -6414,422 +6689,795 @@ const SurveyorDetailsDashboard = () => {
6414
6689
  setCurrentPage(0);
6415
6690
  },
6416
6691
  onLastPage: () => {
6417
- var _dashboardData$dashbo8;
6418
- setCurrentPage(Math.max(((dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo8 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo8 === void 0 ? void 0 : _dashboardData$dashbo8.totalPages) || 1) - 1, 0));
6692
+ setCurrentPage(Math.max(Math.ceil(surveyors.length / pageSize) - 1, 0));
6419
6693
  },
6420
6694
  onPageSizeChange: e => {
6421
6695
  setPageSize(Number(e.target.value));
6422
6696
  setCurrentPage(0);
6423
6697
  }
6424
- })), (!roles.includes("EKYC_SURVEYOR") || roles.includes("EMPLOYEE")) && /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
6425
- label: t("EKYC_ASSIGN_KNOS"),
6426
- onSubmit: () => setShowOptions(prev => !prev)
6427
- }), showOptions && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Menu, {
6428
- options: options,
6429
- optionKey: "action",
6430
- t: t,
6431
- onSelect: handleMenuSelect,
6432
- style: {
6433
- color: "#FFFFFF",
6434
- fontSize: "18px"
6435
- }
6436
- })), showModal && /*#__PURE__*/React__default.createElement(AssignEkycModal, {
6437
- surveyor: surveyor,
6438
- closeModal: closeModal,
6439
- refetchDashboard: refetchDashboard
6440
- }));
6441
- };
6442
-
6443
- function formReducer(state, payload) {
6444
- const storageKey = "EKYC.SW.INBOX";
6445
- switch (payload.action) {
6446
- case "mutateSearchForm":
6447
- Digit.SessionStorage.set(storageKey, _extends({}, state, {
6448
- searchForm: payload.data
6449
- }));
6450
- return _extends({}, state, {
6451
- searchForm: payload.data
6452
- });
6453
- case "mutateFilterForm":
6454
- Digit.SessionStorage.set(storageKey, _extends({}, state, {
6455
- filterForm: payload.data
6456
- }));
6457
- return _extends({}, state, {
6458
- filterForm: payload.data
6459
- });
6460
- case "mutateTableForm":
6461
- Digit.SessionStorage.set(storageKey, _extends({}, state, {
6462
- tableForm: payload.data
6463
- }));
6464
- return _extends({}, state, {
6465
- tableForm: payload.data
6466
- });
6467
- default:
6468
- return state;
6469
- }
6470
- }
6471
- const formInitValue = {
6472
- filterForm: {},
6473
- searchForm: {},
6474
- tableForm: {
6475
- limit: 10,
6476
- offset: 0,
6477
- sortBy: "createdTime",
6478
- sortOrder: "DESC"
6479
- }
6698
+ })));
6480
6699
  };
6481
- const tableColumnConfig = (t, handleReview) => [{
6482
- Header: t("SURVEYOR_NAME"),
6483
- accessor: "surveyorName",
6484
- Cell: _ref => {
6485
- var _row$original, _row$original2, _row$original3;
6486
- let row = _ref.row;
6487
- const id = (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.id;
6488
- return /*#__PURE__*/React__default.createElement("span", {
6489
- className: "link",
6490
- onClick: () => handleReview(id)
6491
- }, ((_row$original2 = row.original) === null || _row$original2 === void 0 ? void 0 : _row$original2.surveyorName) || ((_row$original3 = row.original) === null || _row$original3 === void 0 ? void 0 : _row$original3.name) || "NA");
6492
- }
6493
- }, {
6494
- Header: t("MOBILE_NUMBER"),
6495
- accessor: "mobileNo",
6496
- Cell: _ref2 => {
6497
- var _row$original4, _row$original5, _row$original5$owner;
6498
- let row = _ref2.row;
6499
- return /*#__PURE__*/React__default.createElement("span", null, ((_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : _row$original4.mobileNo) || ((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : (_row$original5$owner = _row$original5.owner) === null || _row$original5$owner === void 0 ? void 0 : _row$original5$owner.mobileNumber) || "NA");
6500
- }
6501
- }, {
6502
- Header: t("STATUS"),
6503
- accessor: "status",
6504
- Cell: _ref3 => {
6505
- var _row$original6;
6506
- let row = _ref3.row;
6507
- const status = ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.status) || "DEFAULT";
6508
- return /*#__PURE__*/React__default.createElement("span", {
6509
- className: "ekyc-status-tag " + status
6510
- }, t(status));
6511
- }
6512
- }, {
6513
- Header: t("SERVICE_TYPE"),
6514
- accessor: "serviceType",
6515
- Cell: _ref4 => {
6516
- var _row$original7;
6517
- let row = _ref4.row;
6518
- return /*#__PURE__*/React__default.createElement("span", null, ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.serviceType) || "NA");
6519
- }
6520
- }];
6521
6700
 
6522
- const SupervisorInboxTableConfig = _ref => {
6523
- var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _formState$tableForm, _formState$tableForm2;
6524
- let onPageSizeChange = _ref.onPageSizeChange,
6525
- formState = _ref.formState,
6526
- totalCount = _ref.totalCount,
6527
- table = _ref.table,
6528
- dispatch = _ref.dispatch,
6529
- onSortingByData = _ref.onSortingByData,
6530
- _ref$inboxStyles = _ref.inboxStyles,
6531
- inboxStyles = _ref$inboxStyles === void 0 ? {} : _ref$inboxStyles,
6532
- _ref$tableStyle = _ref.tableStyle,
6533
- tableStyle = _ref$tableStyle === void 0 ? {} : _ref$tableStyle;
6701
+ const AssignEkycModal = _ref => {
6702
+ let surveyor = _ref.surveyor,
6703
+ closeModal = _ref.closeModal,
6704
+ refetchDashboard = _ref.refetchDashboard;
6534
6705
  const _useTranslation = reactI18next.useTranslation(),
6535
6706
  t = _useTranslation.t;
6536
- const history = reactRouterDom.useHistory();
6537
- 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";
6538
- const handleReview = id => {
6539
- history.push("/digit-ui/" + userType + "/ekyc/assign/surveyor-details/" + id);
6540
- };
6541
- const limit = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10;
6542
- const offset = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0;
6543
- return {
6544
- disableSort: false,
6545
- autoSort: false,
6546
- manualPagination: true,
6547
- currentPage: Math.floor(offset / limit),
6548
- onPageSizeChange,
6549
- onNextPage: () => dispatch({
6550
- action: "mutateTableForm",
6551
- data: _extends({}, formState.tableForm, {
6552
- offset: Number(offset) + Number(limit)
6553
- })
6554
- }),
6555
- onPrevPage: () => dispatch({
6556
- action: "mutateTableForm",
6557
- data: _extends({}, formState.tableForm, {
6558
- offset: Number(offset) - Number(limit)
6559
- })
6560
- }),
6561
- onLastPage: () => dispatch({
6562
- action: "mutateTableForm",
6563
- data: _extends({}, formState.tableForm, {
6564
- offset: Math.ceil(totalCount / limit) * limit - Number(limit)
6565
- })
6566
- }),
6567
- onFirstPage: () => dispatch({
6568
- action: "mutateTableForm",
6569
- data: _extends({}, formState.tableForm, {
6570
- offset: 0
6571
- })
6707
+ const _useState = React.useState([]),
6708
+ selectedKnos = _useState[0],
6709
+ setSelectedKnos = _useState[1];
6710
+ const _useState2 = React.useState(false),
6711
+ isBulkSelection = _useState2[0],
6712
+ setIsBulkSelection = _useState2[1];
6713
+ const _useState3 = React.useState(0),
6714
+ currentPage = _useState3[0],
6715
+ setCurrentPage = _useState3[1];
6716
+ const _useState4 = React.useState(10),
6717
+ pageSize = _useState4[0],
6718
+ setPageSize = _useState4[1];
6719
+ const _useState5 = React.useState(false),
6720
+ showToast = _useState5[0],
6721
+ setShowToast = _useState5[1];
6722
+ const _useState6 = React.useState({
6723
+ error: false,
6724
+ label: ""
6572
6725
  }),
6573
- totalRecords: totalCount,
6574
- onSort: onSortingByData,
6575
- data: table,
6576
- columns: tableColumnConfig(t, handleReview),
6577
- inboxStyles: _extends({}, inboxStyles),
6578
- tableStyle: _extends({}, tableStyle)
6579
- };
6580
- };
6581
-
6582
- const AssignEkyc = () => {
6583
- var _formState$tableForm, _formState$tableForm2, _formState$tableForm3, _formState$tableForm4, _formState$searchForm, _dashboardData$dashbo;
6584
- let tenantId = Digit.ULBService.getCurrentTenantId();
6585
- if (!tenantId || tenantId === "dl") {
6586
- tenantId = "dl.djb";
6587
- }
6588
- const _useReducer = React.useReducer(formReducer, formInitValue),
6589
- formState = _useReducer[0],
6590
- dispatch = _useReducer[1];
6591
- let paginationParms = {
6592
- limit: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10,
6593
- offset: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0,
6594
- sortBy: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm3 = formState.tableForm) === null || _formState$tableForm3 === void 0 ? void 0 : _formState$tableForm3.sortBy) || "createdTime",
6595
- sortOrder: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm4 = formState.tableForm) === null || _formState$tableForm4 === void 0 ? void 0 : _formState$tableForm4.sortOrder) || "DESC"
6596
- };
6597
- const mobileNumber = (formState === null || formState === void 0 ? void 0 : (_formState$searchForm = formState.searchForm) === null || _formState$searchForm === void 0 ? void 0 : _formState$searchForm.mobileNumber) || "";
6598
- const isSearchActive = !!mobileNumber;
6599
- const filters = _extends({}, paginationParms, {
6600
- status: "ACTIVE,DISABLED"
6601
- });
6602
- if (isSearchActive) {
6603
- filters.mobileNumber = mobileNumber;
6604
- }
6605
- const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSurveyorSearch(tenantId, filters, {
6606
- enabled: !!tenantId,
6607
- keepPreviousData: true
6726
+ toastData = _useState6[0],
6727
+ setToastData = _useState6[1];
6728
+ const _useState7 = React.useState({
6729
+ kno: "",
6730
+ pincode: "",
6731
+ zoneCode: "",
6732
+ zoneName: "",
6733
+ ward: "",
6734
+ assembly: "",
6735
+ mrkey: "",
6736
+ ekycStatus: ""
6608
6737
  }),
6609
- dashboardData = _Digit$Hooks$fsm$useS.data,
6610
- isLoading = _Digit$Hooks$fsm$useS.isLoading;
6611
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycAssignmentProgress({
6612
- enabled: !!tenantId,
6738
+ filters = _useState7[0],
6739
+ setFilters = _useState7[1];
6740
+ const _useState8 = React.useState(filters),
6741
+ debouncedFilters = _useState8[0],
6742
+ setDebouncedFilters = _useState8[1];
6743
+ const _Digit$Hooks$ws$useWS = Digit.Hooks.ws.useWSConfigMDMS.ZROLocation("dl.djb"),
6744
+ zroLocationsData = _Digit$Hooks$ws$useWS.data,
6745
+ isZroLoading = _Digit$Hooks$ws$useWS.isLoading;
6746
+ const mappedZROLocation = React.useMemo(() => {
6747
+ return (zroLocationsData || []).map(item => ({
6748
+ code: item.code,
6749
+ name: item.name
6750
+ }));
6751
+ }, [zroLocationsData]);
6752
+ const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS("dl.djb", "egov-location", ["TenantBoundary"]),
6753
+ egovLocationData = _Digit$Hooks$useCommo.data;
6754
+ const boundaryData = React.useMemo(() => {
6755
+ var _egovLocationData$ego;
6756
+ const tenantBoundary = (egovLocationData === null || egovLocationData === void 0 ? void 0 : (_egovLocationData$ego = egovLocationData["egov-location"]) === null || _egovLocationData$ego === void 0 ? void 0 : _egovLocationData$ego.TenantBoundary) || [];
6757
+ const revenueData = tenantBoundary.find(item => {
6758
+ var _item$hierarchyType;
6759
+ return (item === null || item === void 0 ? void 0 : (_item$hierarchyType = item.hierarchyType) === null || _item$hierarchyType === void 0 ? void 0 : _item$hierarchyType.code) === "REVENUE";
6760
+ });
6761
+ const boundary = (revenueData === null || revenueData === void 0 ? void 0 : revenueData.boundary) || [];
6762
+ return Array.isArray(boundary) ? boundary : [boundary];
6763
+ }, [egovLocationData]);
6764
+ const _useMemo = React.useMemo(() => {
6765
+ const assemblies = new Map();
6766
+ const wards = new Map();
6767
+ const boundaries = Array.isArray(boundaryData) ? boundaryData : boundaryData ? [boundaryData] : [];
6768
+ const traverse = node => {
6769
+ if (!node) return;
6770
+ if (node.label === "Ward" || node.label === "WARD" || node.label === "Block" || node.label === "BLOCK") {
6771
+ const code = node.code || node.localname || node.name;
6772
+ const name = node.name || node.localname || code;
6773
+ if (code) wards.set(code, {
6774
+ code,
6775
+ name: name
6776
+ });
6777
+ }
6778
+ if (node.label === "Assembly Constituency" || node.label === "ASSEMBLY_CONSTITUENCY") {
6779
+ const code = node.code || node.localname || node.name;
6780
+ const name = node.name || node.localname || code;
6781
+ if (code) assemblies.set(code, {
6782
+ code,
6783
+ name: name
6784
+ });
6785
+ }
6786
+ if (node.children && node.children.length > 0) {
6787
+ node.children.forEach(traverse);
6788
+ }
6789
+ };
6790
+ boundaries.forEach(traverse);
6791
+ return {
6792
+ assemblyOptions: Array.from(assemblies.values()).sort((a, b) => a.name.localeCompare(b.name)),
6793
+ wardOptions: Array.from(wards.values()).sort((a, b) => a.name.localeCompare(b.name))
6794
+ };
6795
+ }, [boundaryData]),
6796
+ assemblyOptions = _useMemo.assemblyOptions,
6797
+ wardOptions = _useMemo.wardOptions;
6798
+ const structuredLocalityData = React.useMemo(() => {
6799
+ let localities = [];
6800
+ const boundaries = Array.isArray(boundaryData) ? boundaryData : boundaryData ? [boundaryData] : [];
6801
+ const extractLocalities = node => {
6802
+ if (!node) return;
6803
+ if (node.label === "Locality" || node.label === "LOCALITY") {
6804
+ localities.push(_extends({}, node, {
6805
+ name: node.localname || node.name || node.code
6806
+ }));
6807
+ }
6808
+ if (node.children && node.children.length > 0) {
6809
+ node.children.forEach(child => extractLocalities(child));
6810
+ }
6811
+ };
6812
+ boundaries.forEach(rootNode => extractLocalities(rootNode));
6813
+ return localities;
6814
+ }, [boundaryData]);
6815
+ const fetchedPincodes = React.useMemo(() => {
6816
+ const pinSet = new Set();
6817
+ structuredLocalityData.forEach(loc => {
6818
+ if (loc.pincode) {
6819
+ const pins = Array.isArray(loc.pincode) ? loc.pincode : [loc.pincode];
6820
+ pins.forEach(p => {
6821
+ if (p) {
6822
+ const sanitizedPin = p.toString().split(".")[0];
6823
+ pinSet.add(sanitizedPin);
6824
+ }
6825
+ });
6826
+ }
6827
+ });
6828
+ return Array.from(pinSet).sort();
6829
+ }, [structuredLocalityData]);
6830
+ React.useEffect(() => {
6831
+ const timer = setTimeout(() => {
6832
+ setDebouncedFilters(filters);
6833
+ }, 500);
6834
+ return () => clearTimeout(timer);
6835
+ }, [filters]);
6836
+ React.useEffect(() => {
6837
+ setCurrentPage(0);
6838
+ }, [debouncedFilters, filters.kno]);
6839
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycApplicationList(_extends({
6840
+ unassignedOnly: true
6841
+ }, filters.kno && {
6842
+ kno: filters.kno
6843
+ }, debouncedFilters.ekycStatus && {
6844
+ ekycStatus: debouncedFilters.ekycStatus
6845
+ }, debouncedFilters.zoneName && {
6846
+ zoneName: debouncedFilters.zoneName
6847
+ }, debouncedFilters.assembly && {
6848
+ assembly: debouncedFilters.assembly
6849
+ }, debouncedFilters.ward && {
6850
+ ward: debouncedFilters.ward
6851
+ }, debouncedFilters.mrkey && {
6852
+ mrkey: debouncedFilters.mrkey
6853
+ }, debouncedFilters.pincode && {
6854
+ pincode: debouncedFilters.pincode
6855
+ }), {
6856
+ tenantId: "dl.djb",
6857
+ offset: currentPage * pageSize,
6858
+ limit: pageSize
6859
+ }, {
6613
6860
  keepPreviousData: true
6614
6861
  }),
6615
- isDataSearchLoading = _Digit$Hooks$ekyc$use.isLoading;
6616
- const sourceData = React.useMemo(() => {
6617
- return (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.surveyors) || [];
6618
- }, [dashboardData]);
6619
- const filteredData = React.useMemo(() => {
6620
- return (sourceData || []).map(item => {
6621
- var _owner$roles, _owner$roles$map, _item$additionalDetai, _item$auditDetails, _item$auditDetails2;
6622
- const owner = (item === null || item === void 0 ? void 0 : item.owner) || {};
6623
- const roleCodes = (owner === null || owner === void 0 ? void 0 : (_owner$roles = owner.roles) === null || _owner$roles === void 0 ? void 0 : (_owner$roles$map = _owner$roles.map(role => role.code)) === null || _owner$roles$map === void 0 ? void 0 : _owner$roles$map.join(", ")) || "";
6624
- return _extends({}, item, {
6625
- id: (item === null || item === void 0 ? void 0 : item.id) || "",
6626
- surveyorName: (item === null || item === void 0 ? void 0 : item.name) || (owner === null || owner === void 0 ? void 0 : owner.name) || "",
6627
- mobileNo: (item === null || item === void 0 ? void 0 : item.mobileNo) || (owner === null || owner === void 0 ? void 0 : owner.mobileNumber) || "",
6628
- email: (owner === null || owner === void 0 ? void 0 : owner.emailId) || "",
6629
- vendorId: (item === null || item === void 0 ? void 0 : item.vendorId) || "",
6630
- tenantId: (item === null || item === void 0 ? void 0 : item.tenantId) || "",
6631
- supervisorId: (item === null || item === void 0 ? void 0 : item.supervisorId) || "",
6632
- status: (item === null || item === void 0 ? void 0 : item.status) || "",
6633
- roleCodes,
6634
- userName: (owner === null || owner === void 0 ? void 0 : owner.userName) || "",
6635
- gender: (owner === null || owner === void 0 ? void 0 : owner.gender) || "",
6636
- serviceType: (item === null || item === void 0 ? void 0 : (_item$additionalDetai = item.additionalDetails) === null || _item$additionalDetai === void 0 ? void 0 : _item$additionalDetai.serviceType) || "",
6637
- createdTime: (item === null || item === void 0 ? void 0 : (_item$auditDetails = item.auditDetails) === null || _item$auditDetails === void 0 ? void 0 : _item$auditDetails.createdTime) || 0,
6638
- lastModifiedTime: (item === null || item === void 0 ? void 0 : (_item$auditDetails2 = item.auditDetails) === null || _item$auditDetails2 === void 0 ? void 0 : _item$auditDetails2.lastModifiedTime) || 0
6862
+ applicationData = _Digit$Hooks$ekyc$use.data,
6863
+ isLoading = _Digit$Hooks$ekyc$use.isFetching;
6864
+ const handleAssignmentError = (errMsg, variables) => {
6865
+ const isAlreadyAssigned = errMsg.toLowerCase().includes("already assigned") || errMsg.toLowerCase().includes("already assign") || errMsg.toLowerCase().includes("active assignment") || errMsg.toLowerCase().includes("mrkey") || errMsg.toLowerCase().includes("mr key") || errMsg.toLowerCase().includes("kno") || errMsg.toLowerCase().includes("already exists");
6866
+ if (isAlreadyAssigned) {
6867
+ const isMrKeyType = (variables === null || variables === void 0 ? void 0 : variables.assignmentType) === "MRKEY";
6868
+ if (isMrKeyType) {
6869
+ setToastData({
6870
+ error: true,
6871
+ label: t("EKYC_MR_KEY_ALREADY_ASSIGNED_WITH_ANOTHER_SURVEYOR") || "mr key is already assign with another surveyor"
6872
+ });
6873
+ } else {
6874
+ setToastData({
6875
+ error: true,
6876
+ label: t("EKYC_KNO_ALREADY_ASSIGNED_WITH_ANOTHER_SURVEYOR") || "kno is already assign with another surveyor"
6877
+ });
6878
+ }
6879
+ } else {
6880
+ setToastData({
6881
+ error: true,
6882
+ label: t(errMsg) || errMsg || t("EKYC_SOMETHING_WENT_WRONG") || "Something went wrong"
6639
6883
  });
6640
- });
6641
- }, [sourceData]);
6642
- const totalRecords = (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.totalRecords) || (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.totalCount) || 0;
6643
- const SearchFormFields = React.useCallback(_ref => {
6644
- let registerRef = _ref.registerRef,
6645
- searchFormState = _ref.searchFormState,
6646
- controlSearchForm = _ref.controlSearchForm;
6647
- return /*#__PURE__*/React__default.createElement(SearchFormFieldsComponents, {
6648
- registerRef,
6649
- searchFormState,
6650
- controlSearchForm,
6651
- searchType: "mobile",
6652
- className: "search"
6653
- });
6654
- }, []);
6655
- const tableOrderFormDefaultValues = {
6656
- sortBy: "createdTime",
6657
- limit: window.Digit.Utils.browser.isMobile() ? 50 : 10,
6658
- offset: 0,
6659
- sortOrder: "DESC"
6660
- };
6661
- const onSearchFormSubmit = data => {
6662
- data.hasOwnProperty("") && (data === null || data === void 0 ? true : delete data[""]);
6663
- dispatch({
6664
- action: "mutateTableForm",
6665
- data: _extends({}, tableOrderFormDefaultValues)
6666
- });
6667
- dispatch({
6668
- action: "mutateSearchForm",
6669
- data
6670
- });
6671
- };
6672
- const searchFormDefaultValues = {
6673
- mobileNumber: "",
6674
- applicationNumber: "",
6675
- consumerNo: ""
6884
+ }
6885
+ setShowToast(true);
6676
6886
  };
6677
- const onSearchFormReset = setSearchFormValue => {
6678
- setSearchFormValue("mobileNumber", null);
6679
- setSearchFormValue("applicationNumber", null);
6680
- setSearchFormValue("consumerNo", null);
6681
- dispatch({
6682
- action: "mutateSearchForm",
6683
- data: searchFormDefaultValues
6887
+ const assignmentMutation = Digit.Hooks.ekyc.useEkycAssignmentCreate({
6888
+ onSuccess: (response, variables) => {
6889
+ if (response !== null && response !== void 0 && response.error) {
6890
+ var _response$data;
6891
+ const errMsg = (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.message) || "";
6892
+ handleAssignmentError(errMsg, variables);
6893
+ return;
6894
+ }
6895
+ if (response !== null && response !== void 0 && response.skipped && response.skipped.length > 0) {
6896
+ var _response$skipped$;
6897
+ const reason = ((_response$skipped$ = response.skipped[0]) === null || _response$skipped$ === void 0 ? void 0 : _response$skipped$.reason) || "";
6898
+ handleAssignmentError(reason, variables);
6899
+ return;
6900
+ }
6901
+ setToastData({
6902
+ error: false,
6903
+ label: t("EKYC_ASSIGNMENT_SUCCESSFUL") || "Assignment successful"
6904
+ });
6905
+ setShowToast(true);
6906
+ setTimeout(function () {
6907
+ try {
6908
+ return Promise.resolve(refetchDashboard()).then(function () {
6909
+ closeModal();
6910
+ });
6911
+ } catch (e) {
6912
+ return Promise.reject(e);
6913
+ }
6914
+ }, 1000);
6915
+ },
6916
+ onError: (error, variables) => {
6917
+ var _error$data, _error$response, _error$response$data;
6918
+ const errMsg = (error === null || error === void 0 ? void 0 : (_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.message) || (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.message) || "";
6919
+ handleAssignmentError(errMsg, variables);
6920
+ }
6921
+ });
6922
+ const tableData = (applicationData === null || applicationData === void 0 ? void 0 : applicationData.consumerList) || [];
6923
+ const getAssignmentPayload = () => {
6924
+ if (isBulkSelection) {
6925
+ const filterMappings = [{
6926
+ key: "ekycStatus",
6927
+ type: "EKYCSTATUS"
6928
+ }, {
6929
+ key: "zoneName",
6930
+ type: "ZONENAME"
6931
+ }, {
6932
+ key: "assembly",
6933
+ type: "ASSEMBLY"
6934
+ }, {
6935
+ key: "ward",
6936
+ type: "WARD"
6937
+ }, {
6938
+ key: "mrkey",
6939
+ type: "MRKEY"
6940
+ }, {
6941
+ key: "pincode",
6942
+ type: "PINCODE"
6943
+ }];
6944
+ const appliedFilter = filterMappings.find(_ref2 => {
6945
+ let key = _ref2.key;
6946
+ return debouncedFilters[key];
6947
+ });
6948
+ if (appliedFilter) {
6949
+ return {
6950
+ assignmentType: appliedFilter.type,
6951
+ assignmentValue: debouncedFilters[appliedFilter.key]
6952
+ };
6953
+ }
6954
+ }
6955
+ return {
6956
+ assignmentType: "KNO",
6957
+ assignmentValue: selectedKnos
6958
+ };
6959
+ };
6960
+ const handleAssign = () => {
6961
+ var _surveyor$owner;
6962
+ const _getAssignmentPayload = getAssignmentPayload(),
6963
+ assignmentType = _getAssignmentPayload.assignmentType,
6964
+ assignmentValue = _getAssignmentPayload.assignmentValue;
6965
+ assignmentMutation.mutate({
6966
+ tenantId: "dl.djb",
6967
+ surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner = surveyor.owner) === null || _surveyor$owner === void 0 ? void 0 : _surveyor$owner.uuid,
6968
+ assignmentType,
6969
+ assignmentValue
6684
6970
  });
6685
6971
  };
6686
- const propsForSearchForm = {
6687
- SearchFormFields,
6688
- onSearchFormSubmit,
6689
- searchFormDefaultValues: formState === null || formState === void 0 ? void 0 : formState.searchForm,
6690
- resetSearchFormDefaultValues: searchFormDefaultValues,
6691
- onSearchFormReset,
6692
- className: "search-form-wns-inbox"
6972
+ const handleSelectAll = () => {
6973
+ setIsBulkSelection(true);
6974
+ const pageKnos = tableData.map(item => item.kno);
6975
+ const allSelected = pageKnos.length > 0 && pageKnos.every(kno => selectedKnos.includes(kno));
6976
+ setSelectedKnos(prev => allSelected ? prev.filter(kno => !pageKnos.includes(kno)) : [...new Set([...prev, ...pageKnos])]);
6693
6977
  };
6694
- const onPageSizeChange = e => {
6695
- const newLimit = Number(e.target.value);
6696
- dispatch({
6697
- action: "mutateTableForm",
6698
- data: _extends({}, formState.tableForm, {
6699
- limit: newLimit,
6700
- offset: 0
6701
- })
6702
- });
6978
+ const handleFilterChange = (key, value) => {
6979
+ setFilters(prev => _extends({}, prev, {
6980
+ [key]: value
6981
+ }));
6703
6982
  };
6704
- const onSortingByData = e => {
6705
- if (e.length > 0) {
6706
- const _e$ = e[0],
6707
- id = _e$.id,
6708
- desc = _e$.desc;
6709
- const sortOrder = desc ? "DESC" : "ASC";
6710
- const sortBy = id;
6711
- if (!(formState.tableForm.sortBy === sortBy && formState.tableForm.sortOrder === sortOrder)) {
6712
- dispatch({
6713
- action: "mutateTableForm",
6714
- data: _extends({}, formState.tableForm, {
6715
- sortBy: id,
6716
- sortOrder: desc ? "DESC" : "ASC"
6717
- })
6718
- });
6719
- }
6983
+ const columns = React.useMemo(() => [{
6984
+ Header: () => /*#__PURE__*/React__default.createElement("input", {
6985
+ type: "checkbox",
6986
+ checked: tableData.length > 0 && tableData.every(item => selectedKnos.includes(item.kno)),
6987
+ onChange: handleSelectAll
6988
+ }),
6989
+ id: "selection",
6990
+ Cell: _ref3 => {
6991
+ let row = _ref3.row;
6992
+ const kno = row.original.kno;
6993
+ return /*#__PURE__*/React__default.createElement("input", {
6994
+ type: "checkbox",
6995
+ checked: selectedKnos.includes(kno),
6996
+ onChange: () => handleSelect(kno)
6997
+ });
6998
+ }
6999
+ }, {
7000
+ Header: "KNO",
7001
+ accessor: "kno"
7002
+ }, {
7003
+ Header: "Consumer Name",
7004
+ accessor: row => ((row.firstName || "") + " " + (row.middleName || "") + " " + (row.lastName || "")).trim(),
7005
+ id: "consumerName"
7006
+ }, {
7007
+ Header: "Zone",
7008
+ accessor: "zoneName"
7009
+ }, {
7010
+ Header: "Pincode",
7011
+ accessor: "pincode"
7012
+ }, {
7013
+ Header: "Status",
7014
+ accessor: "status",
7015
+ Cell: _ref4 => {
7016
+ let value = _ref4.value;
7017
+ return /*#__PURE__*/React__default.createElement("span", {
7018
+ className: "status-badge " + (value === "ACTIVE" ? "verified" : value === "PENDING" ? "pending" : "assigned")
7019
+ }, value);
7020
+ }
7021
+ }, {
7022
+ Header: "eKYC Status",
7023
+ accessor: "ekycStatus",
7024
+ Cell: _ref5 => {
7025
+ let value = _ref5.value;
7026
+ const status = (value || "NA").toUpperCase();
7027
+ return value ? /*#__PURE__*/React__default.createElement("span", {
7028
+ className: "ekyc-status-tag " + status
7029
+ }, t(status)) : "-";
6720
7030
  }
7031
+ }], [selectedKnos, tableData]);
7032
+ const handleSelect = kno => {
7033
+ setSelectedKnos(prev => prev.includes(kno) ? prev.filter(item => item !== kno) : [...prev, kno]);
6721
7034
  };
6722
- const propsForInboxTable = SupervisorInboxTableConfig(_extends({}, {
6723
- onPageSizeChange,
6724
- formState,
6725
- totalCount: totalRecords,
6726
- table: filteredData,
6727
- dispatch,
6728
- onSortingByData,
6729
- tenantId,
6730
- inboxStyles: {
6731
- overflowX: "scroll",
6732
- overflowY: "hidden"
7035
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Modal, {
7036
+ headerBarMain: "Assign KNOs to " + (surveyor === null || surveyor === void 0 ? void 0 : surveyor.name),
7037
+ headerBarEnd: /*#__PURE__*/React__default.createElement(digitUiReactComponents.Close, {
7038
+ onClick: closeModal
7039
+ }),
7040
+ actionCancelLabel: "Cancel",
7041
+ actionCancelOnSubmit: closeModal,
7042
+ actionSaveLabel: "Assign " + selectedKnos.length + " KNOs",
7043
+ actionSaveOnSubmit: handleAssign,
7044
+ isDisabled: !(selectedKnos !== null && selectedKnos !== void 0 && selectedKnos.length)
7045
+ }, /*#__PURE__*/React__default.createElement("div", {
7046
+ className: "assign-knos-modal"
7047
+ }, /*#__PURE__*/React__default.createElement("div", {
7048
+ className: "filters-grid"
7049
+ }, /*#__PURE__*/React__default.createElement("input", {
7050
+ className: "form-control",
7051
+ placeholder: "KNO",
7052
+ value: filters.kno,
7053
+ onChange: e => handleFilterChange("kno", e.target.value)
7054
+ }), /*#__PURE__*/React__default.createElement("select", {
7055
+ className: "form-control",
7056
+ value: filters.pincode,
7057
+ onChange: e => handleFilterChange("pincode", e.target.value)
7058
+ }, /*#__PURE__*/React__default.createElement("option", {
7059
+ value: ""
7060
+ }, "Select Pincode"), fetchedPincodes.map(pin => /*#__PURE__*/React__default.createElement("option", {
7061
+ key: pin,
7062
+ value: pin
7063
+ }, pin))), /*#__PURE__*/React__default.createElement("select", {
7064
+ className: "form-control",
7065
+ value: filters.zoneName,
7066
+ onChange: e => {
7067
+ const val = e.target.value;
7068
+ setFilters(prev => _extends({}, prev, {
7069
+ zoneCode: val,
7070
+ zoneName: val
7071
+ }));
6733
7072
  },
6734
- tableStyle: {
6735
- width: "70%"
7073
+ disabled: isZroLoading
7074
+ }, /*#__PURE__*/React__default.createElement("option", {
7075
+ value: ""
7076
+ }, isZroLoading ? "Loading ZRO Locations..." : "Select ZRO Location"), mappedZROLocation.map(loc => /*#__PURE__*/React__default.createElement("option", {
7077
+ key: loc.code,
7078
+ value: loc.name
7079
+ }, loc.name))), /*#__PURE__*/React__default.createElement("select", {
7080
+ className: "form-control",
7081
+ value: filters.ward,
7082
+ onChange: e => handleFilterChange("ward", e.target.value)
7083
+ }, /*#__PURE__*/React__default.createElement("option", {
7084
+ value: ""
7085
+ }, "Select Ward"), wardOptions.map(ward => /*#__PURE__*/React__default.createElement("option", {
7086
+ key: ward.code,
7087
+ value: ward.name
7088
+ }, ward.name))), /*#__PURE__*/React__default.createElement("select", {
7089
+ className: "form-control",
7090
+ value: filters.assembly,
7091
+ onChange: e => handleFilterChange("assembly", e.target.value)
7092
+ }, /*#__PURE__*/React__default.createElement("option", {
7093
+ value: ""
7094
+ }, "Select Assembly"), assemblyOptions.map(assembly => /*#__PURE__*/React__default.createElement("option", {
7095
+ key: assembly.code,
7096
+ value: assembly.name
7097
+ }, assembly.name))), /*#__PURE__*/React__default.createElement("input", {
7098
+ className: "form-control",
7099
+ placeholder: "MR Key",
7100
+ value: filters.mrkey,
7101
+ onChange: e => handleFilterChange("mrkey", e.target.value)
7102
+ }), selectedKnos.length > 0 && /*#__PURE__*/React__default.createElement("button", {
7103
+ className: "clear-selected-btn",
7104
+ type: "button",
7105
+ onClick: () => setSelectedKnos([])
7106
+ }, t("EKYC_CLEAR_SELECTION") || "Clear Selected (" + selectedKnos.length + ")")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Table, {
7107
+ tableTitle: "eKYC Applications",
7108
+ tableClass: "ekycTable",
7109
+ data: tableData,
7110
+ columns: columns,
7111
+ isLoading: isLoading,
7112
+ totalRecords: (applicationData === null || applicationData === void 0 ? void 0 : applicationData.totalCount) || 0,
7113
+ currentPage: currentPage,
7114
+ pageSizeLimit: pageSize,
7115
+ manualPagination: true,
7116
+ isPaginationRequired: true,
7117
+ onNextPage: () => {
7118
+ if (currentPage < ((applicationData === null || applicationData === void 0 ? void 0 : applicationData.totalPages) || 1) - 1) {
7119
+ setCurrentPage(prev => prev + 1);
7120
+ }
7121
+ },
7122
+ onPrevPage: () => {
7123
+ if (currentPage > 0) {
7124
+ setCurrentPage(prev => prev - 1);
7125
+ }
7126
+ },
7127
+ onFirstPage: () => {
7128
+ setCurrentPage(0);
7129
+ },
7130
+ onLastPage: () => {
7131
+ setCurrentPage(Math.max(((applicationData === null || applicationData === void 0 ? void 0 : applicationData.totalPages) || 1) - 1, 0));
7132
+ },
7133
+ onPageSizeChange: e => {
7134
+ setPageSize(Number(e.target.value));
7135
+ setCurrentPage(0);
6736
7136
  }
7137
+ })), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
7138
+ error: toastData.error,
7139
+ label: toastData.label,
7140
+ onClose: () => setShowToast(false)
6737
7141
  }));
6738
- const isInboxLoading = isLoading;
6739
- return /*#__PURE__*/React__default.createElement("div", {
6740
- className: "app-container"
6741
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.InboxComposer, _extends({
6742
- isInboxLoading
6743
- }, propsForSearchForm, {
6744
- propsForInboxTable,
6745
- formState,
6746
- countData: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
6747
- isCardLoading: isDataSearchLoading
6748
- })));
6749
7142
  };
6750
7143
 
6751
- const AdminDashboard = () => {
6752
- var _Digit$SessionStorage, _loggedInUser$roles, _fullName$charAt;
7144
+ const SurveyorDetailsDashboard = () => {
7145
+ 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;
7146
+ const tenantId = Digit.ULBService.getCurrentTenantId();
7147
+ const _useState = React.useState(false),
7148
+ showModal = _useState[0],
7149
+ setShowModal = _useState[1];
7150
+ const _useState2 = React.useState(false),
7151
+ showOptions = _useState2[0],
7152
+ setShowOptions = _useState2[1];
7153
+ const _useState3 = React.useState(false),
7154
+ ekycDownloadLoading = _useState3[0],
7155
+ setEkycDownloadLoading = _useState3[1];
7156
+ const _useParams = reactRouterDom.useParams(),
7157
+ surveyorId = _useParams.id;
7158
+ 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;
6753
7159
  const _useTranslation = reactI18next.useTranslation(),
6754
7160
  t = _useTranslation.t;
6755
- const history = reactRouterDom.useHistory();
6756
- let tenantId = Digit.ULBService.getCurrentTenantId();
6757
- if (!tenantId || tenantId === "dl") {
6758
- tenantId = "dl.djb";
6759
- }
6760
- const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
7161
+ const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSurveyorSearch(tenantId, {
7162
+ ids: surveyorId
7163
+ }, {
7164
+ enabled: !!surveyorId,
7165
+ staleTime: Infinity
7166
+ }),
7167
+ surveyorSearchById = _Digit$Hooks$fsm$useS.data,
7168
+ isLoadingId = _Digit$Hooks$fsm$useS.isLoading;
7169
+ const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSurveyorSearch(tenantId, surveyorId ? {
7170
+ ownerIds: surveyorId
7171
+ } : {
7172
+ ownerIds
7173
+ }, {
7174
+ enabled: true,
7175
+ staleTime: Infinity
7176
+ }),
7177
+ surveyorSearchByOwner = _Digit$Hooks$fsm$useS2.data,
7178
+ isLoadingOwner = _Digit$Hooks$fsm$useS2.isLoading;
7179
+ const surveyorSearchResponse = React.useMemo(() => {
7180
+ if (surveyorId) {
7181
+ var _surveyorSearchById$s;
7182
+ return surveyorSearchById !== null && surveyorSearchById !== void 0 && (_surveyorSearchById$s = surveyorSearchById.surveyors) !== null && _surveyorSearchById$s !== void 0 && _surveyorSearchById$s.length ? surveyorSearchById : surveyorSearchByOwner;
7183
+ }
7184
+ return surveyorSearchByOwner;
7185
+ }, [surveyorId, surveyorSearchById, surveyorSearchByOwner]);
7186
+ const isLoading = surveyorId ? isLoadingId || isLoadingOwner : isLoadingOwner;
7187
+ const roles = (_Digit$SessionStorage3 = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage3 === void 0 ? void 0 : (_Digit$SessionStorage4 = _Digit$SessionStorage3.info) === null || _Digit$SessionStorage4 === void 0 ? void 0 : _Digit$SessionStorage4.roles.map(ele => ele.code);
7188
+ const surveyor = React.useMemo(() => {
7189
+ var _surveyorSearchRespon;
7190
+ return (surveyorSearchResponse === null || surveyorSearchResponse === void 0 ? void 0 : (_surveyorSearchRespon = surveyorSearchResponse.surveyors) === null || _surveyorSearchRespon === void 0 ? void 0 : _surveyorSearchRespon[0]) || null;
7191
+ }, [surveyorSearchResponse]);
6761
7192
  const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
6762
7193
  status: "ACTIVE"
6763
7194
  }, {
6764
7195
  enabled: !!tenantId
6765
7196
  }),
6766
- vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
6767
- isVendorSearchLoading = _Digit$Hooks$fsm$useD.isLoading;
6768
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycAssignmentProgress({
6769
- enabled: !!tenantId,
7197
+ vendorData = _Digit$Hooks$fsm$useD.data,
7198
+ isVendorLoading = _Digit$Hooks$fsm$useD.isLoading;
7199
+ const _Digit$Hooks$fsm$useS3 = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
7200
+ status: "ACTIVE"
7201
+ }, {
7202
+ enabled: !!tenantId
7203
+ }),
7204
+ supervisorSearchResponse = _Digit$Hooks$fsm$useS3.data,
7205
+ isSupervisorSearchLoading = _Digit$Hooks$fsm$useS3.isLoading;
7206
+ const vendorName = React.useMemo(() => {
7207
+ var _mappedVendor$dsoDeta;
7208
+ if (surveyor !== null && surveyor !== void 0 && surveyor.vendorName) return surveyor.vendorName;
7209
+ if (!vendorData || !(surveyor !== null && surveyor !== void 0 && surveyor.vendorId)) return "N/A";
7210
+ const mappedVendor = vendorData.find(v => {
7211
+ var _v$dsoDetails, _v$dsoDetails2;
7212
+ return ((_v$dsoDetails = v.dsoDetails) === null || _v$dsoDetails === void 0 ? void 0 : _v$dsoDetails.id) === surveyor.vendorId || ((_v$dsoDetails2 = v.dsoDetails) === null || _v$dsoDetails2 === void 0 ? void 0 : _v$dsoDetails2.vendorId) === surveyor.vendorId;
7213
+ });
7214
+ return (mappedVendor === null || mappedVendor === void 0 ? void 0 : (_mappedVendor$dsoDeta = mappedVendor.dsoDetails) === null || _mappedVendor$dsoDeta === void 0 ? void 0 : _mappedVendor$dsoDeta.name) || surveyor.vendorId || "N/A";
7215
+ }, [vendorData, surveyor === null || surveyor === void 0 ? void 0 : surveyor.vendorId, surveyor === null || surveyor === void 0 ? void 0 : surveyor.vendorName]);
7216
+ const supervisorName = React.useMemo(() => {
7217
+ var _mappedSupervisor$own;
7218
+ if (surveyor !== null && surveyor !== void 0 && surveyor.supervisorName) return surveyor.supervisorName;
7219
+ if (!(supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors) || !(surveyor !== null && surveyor !== void 0 && surveyor.supervisorId)) return "N/A";
7220
+ const mappedSupervisor = supervisorSearchResponse.supervisors.find(s => {
7221
+ var _s$owner;
7222
+ return s.id === surveyor.supervisorId || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : _s$owner.uuid) === surveyor.supervisorId;
7223
+ });
7224
+ return (mappedSupervisor === null || mappedSupervisor === void 0 ? void 0 : mappedSupervisor.name) || (mappedSupervisor === null || mappedSupervisor === void 0 ? void 0 : (_mappedSupervisor$own = mappedSupervisor.owner) === null || _mappedSupervisor$own === void 0 ? void 0 : _mappedSupervisor$own.name) || surveyor.supervisorId || "N/A";
7225
+ }, [supervisorSearchResponse, surveyor === null || surveyor === void 0 ? void 0 : surveyor.supervisorId, surveyor === null || surveyor === void 0 ? void 0 : surveyor.supervisorName]);
7226
+ 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";
7227
+ 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);
7228
+ 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";
7229
+ const _useState4 = React.useState(0),
7230
+ currentPage = _useState4[0],
7231
+ setCurrentPage = _useState4[1];
7232
+ const _useState5 = React.useState(20),
7233
+ pageSize = _useState5[0],
7234
+ setPageSize = _useState5[1];
7235
+ const queryParams = {
7236
+ tenantId: "dl.djb",
7237
+ offset: currentPage * pageSize,
7238
+ limit: pageSize,
7239
+ surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner4 = surveyor.owner) === null || _surveyor$owner4 === void 0 ? void 0 : _surveyor$owner4.uuid
7240
+ };
7241
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycSurveyorDashboard({}, queryParams, {
7242
+ enabled: !!queryParams.tenantId && !!queryParams.surveyorId,
6770
7243
  keepPreviousData: true
6771
7244
  }),
6772
- progressData = _Digit$Hooks$ekyc$use.data,
6773
- isProgressLoading = _Digit$Hooks$ekyc$use.isLoading;
6774
- const vendorsList = React.useMemo(() => {
6775
- if (vendorSearchResponse && vendorSearchResponse.length > 0) {
6776
- return vendorSearchResponse.map(v => {
6777
- var _progressData$supervi, _dso$owner, _v$owner, _dso$owner2;
6778
- const dso = v.dsoDetails || v;
6779
- const supervisorsList = dso.supervisors || [];
6780
- const surveyorsList = dso.surveyors || [];
6781
- const supervisorIds = supervisorsList.map(s => {
6782
- var _s$owner;
6783
- return s.id || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : _s$owner.uuid);
6784
- }).filter(Boolean);
6785
- 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))) || [];
6786
- const completed = matchedReports.reduce((acc, r) => acc + (r.submittedKnos || 0), 0);
6787
- const pending = matchedReports.reduce((acc, r) => acc + (r.pendingKnos || 0), 0);
6788
- const total = matchedReports.reduce((acc, r) => acc + (r.totalKnos || 0), 0);
6789
- const progress = total > 0 ? Math.round(completed / total * 100) : 0;
6790
- const rejected = 0;
6791
- return {
6792
- id: dso.id || dso.vendorId || v.id || v.vendorId,
6793
- name: dso.name || dso.displayName || v.name || "N/A",
6794
- 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",
6795
- mobileNumber: dso.mobileNumber || ((_dso$owner2 = dso.owner) === null || _dso$owner2 === void 0 ? void 0 : _dso$owner2.mobileNumber) || v.mobileNumber || "N/A",
6796
- supervisors: supervisorsList.length,
6797
- surveyors: surveyorsList.length,
6798
- completed: completed,
6799
- progress: progress,
6800
- pending: pending,
6801
- rejected: rejected
6802
- };
7245
+ isDashboardLoading = _Digit$Hooks$ekyc$use.isFetching,
7246
+ _Digit$Hooks$ekyc$use2 = _Digit$Hooks$ekyc$use.data,
7247
+ dashboardData = _Digit$Hooks$ekyc$use2 === void 0 ? {} : _Digit$Hooks$ekyc$use2,
7248
+ refetchDashboard = _Digit$Hooks$ekyc$use.refetch;
7249
+ const knoColumns = React.useMemo(() => [{
7250
+ Header: t("KNO") || "KNO",
7251
+ accessor: "kno"
7252
+ }, {
7253
+ Header: t("CONSUMER_NAME") || "Consumer Name",
7254
+ accessor: row => ((row.firstName || "") + " " + (row.middleName || "") + " " + (row.lastName || "")).trim(),
7255
+ id: "consumerName"
7256
+ }, {
7257
+ Header: t("ZONE") || "Zone",
7258
+ accessor: "zoneName"
7259
+ }, {
7260
+ Header: t("EKYC_STATUS") || "eKYC Status",
7261
+ accessor: "ekycStatus",
7262
+ Cell: _ref => {
7263
+ let value = _ref.value;
7264
+ const status = (value || "NA").toUpperCase();
7265
+ return value ? /*#__PURE__*/React__default.createElement("span", {
7266
+ className: "ekyc-status-tag " + status
7267
+ }, t(status)) : "-";
7268
+ }
7269
+ }, {
7270
+ Header: t("SUBMITTED_AT") || "Submitted At",
7271
+ accessor: "submittedAt",
7272
+ Cell: _ref2 => {
7273
+ let value = _ref2.value;
7274
+ return value ? Digit.DateUtils.ConvertEpochToDate(value) : "-";
7275
+ }
7276
+ }, {
7277
+ Header: t("ASSIGNED_AT") || "Assigned At",
7278
+ accessor: "assignedAt",
7279
+ Cell: _ref3 => {
7280
+ let value = _ref3.value;
7281
+ return value ? Digit.DateUtils.ConvertEpochToDate(value) : "-";
7282
+ }
7283
+ }], [t]);
7284
+ const _useState6 = React.useState(false),
7285
+ showReportMenu = _useState6[0],
7286
+ setShowReportMenu = _useState6[1];
7287
+ const _useState7 = React.useState({
7288
+ from: "",
7289
+ to: ""
7290
+ }),
7291
+ customDate = _useState7[0],
7292
+ setCustomDate = _useState7[1];
7293
+ const _useState8 = React.useState(false),
7294
+ showCustomPicker = _useState8[0],
7295
+ setShowCustomPicker = _useState8[1];
7296
+ const _useState9 = React.useState(false),
7297
+ reportLoading = _useState9[0],
7298
+ setReportLoading = _useState9[1];
7299
+ const reportMenuRef = React.useRef(null);
7300
+ React.useEffect(() => {
7301
+ const handler = e => {
7302
+ if (reportMenuRef.current && !reportMenuRef.current.contains(e.target)) {
7303
+ setShowReportMenu(false);
7304
+ setShowCustomPicker(false);
7305
+ }
7306
+ };
7307
+ document.addEventListener("mousedown", handler);
7308
+ return () => document.removeEventListener("mousedown", handler);
7309
+ }, []);
7310
+ const isPageLoading = isLoading || isVendorLoading || isSupervisorSearchLoading;
7311
+ if (isPageLoading && !surveyor) {
7312
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
7313
+ }
7314
+ if (!surveyor) {
7315
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, null, /*#__PURE__*/React__default.createElement("div", {
7316
+ style: {
7317
+ padding: "24px"
7318
+ }
7319
+ }, t("NO_SURVEYOR_FOUND")));
7320
+ }
7321
+ const getDateRange = filter => {
7322
+ const now = new Date();
7323
+ const start = new Date(now);
7324
+ if (filter === "today") {
7325
+ start.setHours(0, 0, 0, 0);
7326
+ return {
7327
+ from: start,
7328
+ to: now
7329
+ };
7330
+ }
7331
+ if (filter === "week") {
7332
+ start.setDate(now.getDate() - now.getDay());
7333
+ start.setHours(0, 0, 0, 0);
7334
+ return {
7335
+ from: start,
7336
+ to: now
7337
+ };
7338
+ }
7339
+ if (filter === "month") {
7340
+ start.setDate(1);
7341
+ start.setHours(0, 0, 0, 0);
7342
+ return {
7343
+ from: start,
7344
+ to: now
7345
+ };
7346
+ }
7347
+ return null;
7348
+ };
7349
+ const handlePresetDownload = function (filter) {
7350
+ try {
7351
+ const range = getDateRange(filter);
7352
+ if (!range) return Promise.resolve();
7353
+ setReportLoading(true);
7354
+ const _temp = _finallyRethrows(function () {
7355
+ return _catch(function () {
7356
+ var _surveyor$owner5;
7357
+ return Promise.resolve(Digit.EkycService.dashboard({}, {
7358
+ tenantId: "dl.djb",
7359
+ offset: 0,
7360
+ limit: 1000,
7361
+ surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner5 = surveyor.owner) === null || _surveyor$owner5 === void 0 ? void 0 : _surveyor$owner5.uuid,
7362
+ fromDate: range.from.getTime(),
7363
+ toDate: range.to.getTime()
7364
+ })).then(function (response) {
7365
+ var _response$dashboardIn;
7366
+ const rows = (response === null || response === void 0 ? void 0 : (_response$dashboardIn = response.dashboardInfo) === null || _response$dashboardIn === void 0 ? void 0 : _response$dashboardIn.consumerList) || [];
7367
+ downloadSurveyorPDF({
7368
+ rows: rows,
7369
+ surveyorName: fullName,
7370
+ vendorName,
7371
+ supervisorName,
7372
+ employeeId,
7373
+ mobileNumber,
7374
+ dashboardInfo: (response === null || response === void 0 ? void 0 : response.dashboardInfo) || {},
7375
+ t
7376
+ });
7377
+ });
7378
+ }, function (err) {
7379
+ console.error("Failed to fetch dashboard data for report download:", err);
7380
+ });
7381
+ }, function (_wasThrown, _result) {
7382
+ setReportLoading(false);
7383
+ setShowReportMenu(false);
7384
+ setShowCustomPicker(false);
7385
+ if (_wasThrown) throw _result;
7386
+ return _result;
7387
+ });
7388
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
7389
+ } catch (e) {
7390
+ return Promise.reject(e);
7391
+ }
7392
+ };
7393
+ const handleCustomDownload = function () {
7394
+ try {
7395
+ if (!customDate.from || !customDate.to) {
7396
+ alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
7397
+ return Promise.resolve();
7398
+ }
7399
+ const from = new Date(customDate.from);
7400
+ from.setHours(0, 0, 0, 0);
7401
+ const to = new Date(customDate.to);
7402
+ to.setHours(23, 59, 59, 999);
7403
+ setReportLoading(true);
7404
+ const _temp2 = _finallyRethrows(function () {
7405
+ return _catch(function () {
7406
+ var _surveyor$owner6;
7407
+ return Promise.resolve(Digit.EkycService.dashboard({}, {
7408
+ tenantId: "dl.djb",
7409
+ offset: 0,
7410
+ limit: 1000,
7411
+ surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner6 = surveyor.owner) === null || _surveyor$owner6 === void 0 ? void 0 : _surveyor$owner6.uuid,
7412
+ fromDate: from.getTime(),
7413
+ toDate: to.getTime()
7414
+ })).then(function (response) {
7415
+ var _response$dashboardIn2;
7416
+ const rows = (response === null || response === void 0 ? void 0 : (_response$dashboardIn2 = response.dashboardInfo) === null || _response$dashboardIn2 === void 0 ? void 0 : _response$dashboardIn2.consumerList) || [];
7417
+ downloadSurveyorPDF({
7418
+ rows: rows,
7419
+ surveyorName: fullName,
7420
+ vendorName,
7421
+ supervisorName,
7422
+ employeeId,
7423
+ mobileNumber,
7424
+ dashboardInfo: (response === null || response === void 0 ? void 0 : response.dashboardInfo) || {},
7425
+ t
7426
+ });
7427
+ });
7428
+ }, function (err) {
7429
+ console.error("Failed to fetch custom dashboard data for report download:", err);
7430
+ });
7431
+ }, function (_wasThrown2, _result2) {
7432
+ setReportLoading(false);
7433
+ setShowReportMenu(false);
7434
+ setShowCustomPicker(false);
7435
+ if (_wasThrown2) throw _result2;
7436
+ return _result2;
6803
7437
  });
7438
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
7439
+ } catch (e) {
7440
+ return Promise.reject(e);
6804
7441
  }
6805
- return [];
6806
- }, [vendorSearchResponse, progressData]);
6807
- const _useState = React.useState(false),
6808
- ekycDownloadLoading = _useState[0],
6809
- setEkycDownloadLoading = _useState[1];
6810
- const _useState2 = React.useState(0),
6811
- currentPage = _useState2[0];
6812
- const _useState3 = React.useState(20),
6813
- pageSize = _useState3[0];
6814
- const _Digit$Hooks$ekyc$use2 = Digit.Hooks.ekyc.useEkycApplicationList({}, {
6815
- tenantId,
6816
- offset: currentPage * pageSize,
6817
- limit: pageSize
6818
- }, {
6819
- keepPreviousData: true
6820
- });
6821
- const fullName = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.name) || "Admin";
6822
- const mobileNumber = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.mobileNumber) || "N/A";
6823
- 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";
7442
+ };
7443
+ const StatCard = _ref4 => {
7444
+ let title = _ref4.title,
7445
+ value = _ref4.value,
7446
+ type = _ref4.type,
7447
+ isLoading = _ref4.isLoading,
7448
+ icon = _ref4.icon;
7449
+ return /*#__PURE__*/React__default.createElement("div", {
7450
+ className: "stat-card " + type
7451
+ }, isLoading ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
7452
+ className: "stat-title skeleton skeleton-text"
7453
+ }), /*#__PURE__*/React__default.createElement("div", {
7454
+ className: "stat-value skeleton skeleton-number"
7455
+ })) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
7456
+ className: "stat-title"
7457
+ }, title), /*#__PURE__*/React__default.createElement("div", {
7458
+ className: "stat-value"
7459
+ }, value), icon && /*#__PURE__*/React__default.createElement("div", {
7460
+ className: "stat-icon"
7461
+ }, icon)));
7462
+ };
7463
+ const options = [{
7464
+ action: "Assign"
7465
+ }];
7466
+ const handleMenuSelect = option => {
7467
+ setShowOptions(false);
7468
+ setShowModal(true);
7469
+ };
6824
7470
  const handleDownloadEkycData = function () {
6825
7471
  try {
6826
7472
  setEkycDownloadLoading(true);
6827
7473
  return Promise.resolve(_finallyRethrows(function () {
6828
7474
  return _catch(function () {
7475
+ var _surveyor$owner7;
6829
7476
  return Promise.resolve(Digit.EkycService.application_list({
6830
- tenantId: tenantId,
7477
+ tenantId: tenantId || "dl.djb",
6831
7478
  offset: 0,
6832
7479
  limit: 10000,
7480
+ surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner7 = surveyor.owner) === null || _surveyor$owner7 === void 0 ? void 0 : _surveyor$owner7.uuid,
6833
7481
  reportDownload: true
6834
7482
  })).then(function (response) {
6835
7483
  const consumerList = (response === null || response === void 0 ? void 0 : response.consumerList) || [];
@@ -6860,9 +7508,9 @@ const AdminDashboard = () => {
6860
7508
  };
6861
7509
  const excelData = consumerList.map(item => {
6862
7510
  const cleanObj = {};
6863
- const name = [item.firstName, item.middleName, item.lastName].filter(Boolean).join(" ");
6864
- if (name) {
6865
- cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = name;
7511
+ const fullName = [item.firstName, item.middleName, item.lastName].filter(Boolean).join(" ");
7512
+ if (fullName) {
7513
+ cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = fullName;
6866
7514
  }
6867
7515
  Object.keys(item).forEach(key => {
6868
7516
  if (excludedKeys.includes(key)) return;
@@ -6875,21 +7523,29 @@ const AdminDashboard = () => {
6875
7523
  });
6876
7524
  return cleanObj;
6877
7525
  });
6878
- const cleanFileName = "eKYC_All_Data_Admin_" + fullName.replace(/[^a-zA-Z0-9]/g, "_");
7526
+ const cleanFileName = "eKYC_Data_" + fullName.replace(/[^a-zA-Z0-9]/g, "_");
6879
7527
  Digit.Download.Excel(excelData, cleanFileName);
6880
7528
  });
6881
7529
  }, function (error) {
6882
7530
  console.error("Error downloading eKYC Excel:", error);
6883
7531
  });
6884
- }, function (_wasThrown, _result) {
7532
+ }, function (_wasThrown3, _result3) {
6885
7533
  setEkycDownloadLoading(false);
6886
- if (_wasThrown) throw _result;
6887
- return _result;
7534
+ if (_wasThrown3) throw _result3;
7535
+ return _result3;
6888
7536
  }));
6889
7537
  } catch (e) {
6890
7538
  return Promise.reject(e);
6891
7539
  }
6892
7540
  };
7541
+ const closeModal = function () {
7542
+ try {
7543
+ setShowModal(false);
7544
+ return Promise.resolve();
7545
+ } catch (e) {
7546
+ return Promise.reject(e);
7547
+ }
7548
+ };
6893
7549
  return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
6894
7550
  className: "surveyor-dashboard"
6895
7551
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -6904,19 +7560,151 @@ const AdminDashboard = () => {
6904
7560
  className: "name"
6905
7561
  }, fullName), /*#__PURE__*/React__default.createElement("div", {
6906
7562
  className: "designation"
6907
- }, t("EKYC_ADMIN") || "eKYC Admin / Manager"), /*#__PURE__*/React__default.createElement("div", {
6908
- className: "mobile-number"
6909
- }, mobileNumber))), /*#__PURE__*/React__default.createElement("button", {
7563
+ }, (surveyor === null || surveyor === void 0 ? void 0 : surveyor.description) || t("FIELD_SURVEYOR")))), /*#__PURE__*/React__default.createElement("div", {
7564
+ className: "report-download",
7565
+ ref: reportMenuRef
7566
+ }, /*#__PURE__*/React__default.createElement("button", {
7567
+ className: "download-btn",
7568
+ disabled: reportLoading,
7569
+ onClick: () => {
7570
+ setShowReportMenu(p => !p);
7571
+ setShowCustomPicker(false);
7572
+ }
7573
+ }, reportLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_REPORT") || "Download Report"), showReportMenu && /*#__PURE__*/React__default.createElement("div", {
7574
+ className: "report-menu"
7575
+ }, [{
7576
+ label: t("TODAY") || "Today",
7577
+ key: "today"
7578
+ }, {
7579
+ label: t("THIS_WEEK") || "This Week",
7580
+ key: "week"
7581
+ }, {
7582
+ label: t("THIS_MONTH") || "This Month",
7583
+ key: "month"
7584
+ }].map(_ref5 => {
7585
+ let label = _ref5.label,
7586
+ key = _ref5.key;
7587
+ return /*#__PURE__*/React__default.createElement("div", {
7588
+ key: key,
7589
+ className: "menu-item",
7590
+ onClick: () => handlePresetDownload(key)
7591
+ }, label);
7592
+ }), /*#__PURE__*/React__default.createElement("div", {
7593
+ className: "custom-date-trigger",
7594
+ onClick: () => setShowCustomPicker(p => !p)
7595
+ }, t("CUSTOM_DATE") || "Custom Date"), showCustomPicker && /*#__PURE__*/React__default.createElement("div", {
7596
+ className: "custom-picker"
7597
+ }, /*#__PURE__*/React__default.createElement("div", {
7598
+ className: "date-field"
7599
+ }, /*#__PURE__*/React__default.createElement("label", {
7600
+ className: "date-label"
7601
+ }, t("FROM_DATE") || "From"), /*#__PURE__*/React__default.createElement("input", {
7602
+ type: "date",
7603
+ className: "date-input",
7604
+ value: customDate.from,
7605
+ onChange: e => setCustomDate(d => _extends({}, d, {
7606
+ from: e.target.value
7607
+ }))
7608
+ })), /*#__PURE__*/React__default.createElement("div", {
7609
+ className: "date-field"
7610
+ }, /*#__PURE__*/React__default.createElement("label", {
7611
+ className: "date-label"
7612
+ }, t("TO_DATE") || "To"), /*#__PURE__*/React__default.createElement("input", {
7613
+ type: "date",
7614
+ className: "date-input",
7615
+ value: customDate.to,
7616
+ onChange: e => setCustomDate(d => _extends({}, d, {
7617
+ to: e.target.value
7618
+ }))
7619
+ })), /*#__PURE__*/React__default.createElement("button", {
7620
+ className: "download-action-btn",
7621
+ onClick: handleCustomDownload
7622
+ }, t("DOWNLOAD") || "Download"))))), /*#__PURE__*/React__default.createElement("div", {
7623
+ className: "stats-wrapper"
7624
+ }, /*#__PURE__*/React__default.createElement(StatCard, {
7625
+ title: t("TOTAL_ASSIGNED"),
7626
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.total) || 0,
7627
+ type: "today",
7628
+ isLoading: isDashboardLoading,
7629
+ icon: /*#__PURE__*/React__default.createElement(fa.FaUsers, null)
7630
+ }), /*#__PURE__*/React__default.createElement(StatCard, {
7631
+ title: t("COMPLETED"),
7632
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo2 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo2 === void 0 ? void 0 : _dashboardData$dashbo2.completed) || 0,
7633
+ type: "week",
7634
+ isLoading: isDashboardLoading,
7635
+ icon: /*#__PURE__*/React__default.createElement(fa.FaCheckCircle, null)
7636
+ }), /*#__PURE__*/React__default.createElement(StatCard, {
7637
+ title: t("PENDING"),
7638
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo3 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo3 === void 0 ? void 0 : _dashboardData$dashbo3.pending) || 0,
7639
+ type: "pending",
7640
+ isLoading: isDashboardLoading,
7641
+ icon: /*#__PURE__*/React__default.createElement(fa.FaClock, null)
7642
+ }), /*#__PURE__*/React__default.createElement(StatCard, {
7643
+ title: t("SUBMITTED"),
7644
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo4 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo4 === void 0 ? void 0 : _dashboardData$dashbo4.submittedCount) || 0,
7645
+ type: "month",
7646
+ isLoading: isDashboardLoading,
7647
+ icon: /*#__PURE__*/React__default.createElement(fa.FaChartLine, null)
7648
+ })), /*#__PURE__*/React__default.createElement("div", {
7649
+ className: "charts-wrapper"
7650
+ }), /*#__PURE__*/React__default.createElement("div", {
7651
+ className: "ekyc-dashboard-section"
7652
+ }, /*#__PURE__*/React__default.createElement("div", {
7653
+ className: "ekyc-details-wrapper"
7654
+ }, /*#__PURE__*/React__default.createElement("div", {
7655
+ className: "details-left"
7656
+ }, /*#__PURE__*/React__default.createElement("div", {
7657
+ className: "details-grid"
7658
+ }, /*#__PURE__*/React__default.createElement("div", {
7659
+ className: "detail-item"
7660
+ }, /*#__PURE__*/React__default.createElement("span", {
7661
+ className: "label"
7662
+ }, t("MOBILE")), /*#__PURE__*/React__default.createElement("span", {
7663
+ className: "value"
7664
+ }, (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__default.createElement("div", {
7665
+ className: "detail-item"
7666
+ }, /*#__PURE__*/React__default.createElement("span", {
7667
+ className: "label"
7668
+ }, t("EMAIL")), /*#__PURE__*/React__default.createElement("span", {
7669
+ className: "value"
7670
+ }, (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__default.createElement("div", {
7671
+ className: "detail-item"
7672
+ }, /*#__PURE__*/React__default.createElement("span", {
7673
+ className: "label"
7674
+ }, t("GENDER")), /*#__PURE__*/React__default.createElement("span", {
7675
+ className: "value"
7676
+ }, (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__default.createElement("div", {
7677
+ className: "detail-item"
7678
+ }, /*#__PURE__*/React__default.createElement("span", {
7679
+ className: "label"
7680
+ }, t("STATUS")), /*#__PURE__*/React__default.createElement("span", {
7681
+ className: "value"
7682
+ }, (surveyor === null || surveyor === void 0 ? void 0 : surveyor.status) || "N/A")), /*#__PURE__*/React__default.createElement("div", {
7683
+ className: "detail-item"
7684
+ }, /*#__PURE__*/React__default.createElement("span", {
7685
+ className: "label"
7686
+ }, t("SERVICE_TYPE")), /*#__PURE__*/React__default.createElement("span", {
7687
+ className: "value"
7688
+ }, (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__default.createElement("div", {
7689
+ className: "detail-item"
7690
+ }, /*#__PURE__*/React__default.createElement("span", {
7691
+ className: "label"
7692
+ }, t("VENDOR_NAME") || "Vendor Name"), /*#__PURE__*/React__default.createElement("span", {
7693
+ className: "value"
7694
+ }, vendorName)), /*#__PURE__*/React__default.createElement("div", {
7695
+ className: "detail-item"
7696
+ }, /*#__PURE__*/React__default.createElement("span", {
7697
+ className: "label"
7698
+ }, t("SUPERVISOR_NAME") || "Supervisor Name"), /*#__PURE__*/React__default.createElement("span", {
7699
+ className: "value"
7700
+ }, supervisorName)))), /*#__PURE__*/React__default.createElement("div", {
7701
+ className: "details-right"
7702
+ }, /*#__PURE__*/React__default.createElement("div", {
7703
+ className: "download-card"
7704
+ }, /*#__PURE__*/React__default.createElement("h4", null, t("DOWNLOAD_EKYC_DATA") || "Download eKYC Data"), /*#__PURE__*/React__default.createElement("p", null, t("DOWNLOAD_EKYC_DATA_DESC") || "Export the complete eKYC verification records for your assigned jurisdiction into Excel format."), /*#__PURE__*/React__default.createElement("button", {
6910
7705
  className: "download-excel-btn",
6911
7706
  disabled: ekycDownloadLoading,
6912
- onClick: handleDownloadEkycData,
6913
- style: {
6914
- margin: 0,
6915
- padding: "8px 16px",
6916
- height: "auto",
6917
- minHeight: "36px",
6918
- width: "auto"
6919
- }
7707
+ onClick: handleDownloadEkycData
6920
7708
  }, /*#__PURE__*/React__default.createElement("svg", {
6921
7709
  width: "16",
6922
7710
  height: "16",
@@ -6925,206 +7713,297 @@ const AdminDashboard = () => {
6925
7713
  stroke: "currentColor",
6926
7714
  strokeWidth: "2.5",
6927
7715
  strokeLinecap: "round",
6928
- strokeLinejoin: "round",
6929
- style: {
6930
- marginRight: "8px"
6931
- }
6932
- }, /*#__PURE__*/React__default.createElement("path", {
6933
- d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
6934
- }), /*#__PURE__*/React__default.createElement("polyline", {
6935
- points: "7 10 12 15 17 10"
6936
- }), /*#__PURE__*/React__default.createElement("line", {
6937
- x1: "12",
6938
- y1: "15",
6939
- x2: "12",
6940
- y2: "3"
6941
- })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel")), /*#__PURE__*/React__default.createElement("div", {
6942
- style: {
6943
- marginTop: "32px"
6944
- }
6945
- }, /*#__PURE__*/React__default.createElement("h3", {
6946
- style: {
6947
- fontSize: "20px",
6948
- fontWeight: "700",
6949
- color: "#101828",
6950
- marginBottom: "20px"
6951
- }
6952
- }, t("EKYC_VENDORS_PERFORMANCE") || "eKYC Vendors Performance"), isVendorSearchLoading || isProgressLoading ? /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null) : /*#__PURE__*/React__default.createElement("div", {
6953
- style: {
6954
- display: "grid",
6955
- gridTemplateColumns: "repeat(3, 1fr)",
6956
- gap: "24px",
6957
- width: "100%"
6958
- }
6959
- }, vendorsList.length === 0 ? /*#__PURE__*/React__default.createElement("div", {
6960
- style: {
6961
- gridColumn: "span 3",
6962
- textAlign: "center",
6963
- padding: "40px",
6964
- color: "#64748B",
6965
- fontSize: "16px"
6966
- }
6967
- }, t("NO_VENDORS_FOUND") || "No vendors found.") : vendorsList.map(vendor => /*#__PURE__*/React__default.createElement("div", {
6968
- key: vendor.id,
6969
- onClick: () => history.push("/digit-ui/employee/ekyc/vendors/" + vendor.id),
6970
- style: {
6971
- background: "#ffffff",
6972
- border: "1px solid #E2E8F0",
6973
- borderRadius: "16px",
6974
- padding: "24px",
6975
- boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03)",
6976
- cursor: "pointer",
6977
- transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
6978
- display: "flex",
6979
- flexDirection: "column",
6980
- justifyContent: "space-between",
6981
- gap: "16px"
7716
+ strokeLinejoin: "round"
7717
+ }, /*#__PURE__*/React__default.createElement("path", {
7718
+ d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
7719
+ }), /*#__PURE__*/React__default.createElement("polyline", {
7720
+ points: "7 10 12 15 17 10"
7721
+ }), /*#__PURE__*/React__default.createElement("line", {
7722
+ x1: "12",
7723
+ y1: "15",
7724
+ x2: "12",
7725
+ y2: "3"
7726
+ })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel"))))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
7727
+ className: "dashboard-card"
7728
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Table, {
7729
+ t: t,
7730
+ tableTitle: t("ASSIGNED_KNOS"),
7731
+ tableClass: "ekycTable",
7732
+ data: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo5 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo5 === void 0 ? void 0 : _dashboardData$dashbo5.consumerList) || [],
7733
+ columns: knoColumns,
7734
+ isLoading: isDashboardLoading,
7735
+ totalRecords: dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo6 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo6 === void 0 ? void 0 : _dashboardData$dashbo6.total,
7736
+ currentPage: currentPage,
7737
+ pageSizeLimit: pageSize,
7738
+ showAutoSerialNo: true,
7739
+ isPaginationRequired: true,
7740
+ onNextPage: () => {
7741
+ var _dashboardData$dashbo7;
7742
+ if (currentPage < ((dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo7 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo7 === void 0 ? void 0 : _dashboardData$dashbo7.totalPages) || 1) - 1) {
7743
+ setCurrentPage(prev => prev + 1);
7744
+ }
7745
+ },
7746
+ onPrevPage: () => {
7747
+ if (currentPage > 0) {
7748
+ setCurrentPage(prev => prev - 1);
7749
+ }
6982
7750
  },
6983
- onMouseEnter: e => {
6984
- e.currentTarget.style.transform = "translateY(-4px)";
6985
- e.currentTarget.style.boxShadow = "0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04)";
6986
- e.currentTarget.style.borderColor = "#CBD5E1";
7751
+ onFirstPage: () => {
7752
+ setCurrentPage(0);
6987
7753
  },
6988
- onMouseLeave: e => {
6989
- e.currentTarget.style.transform = "translateY(0)";
6990
- e.currentTarget.style.boxShadow = "0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03)";
6991
- e.currentTarget.style.borderColor = "#E2E8F0";
6992
- }
6993
- }, /*#__PURE__*/React__default.createElement("div", {
6994
- style: {
6995
- display: "flex",
6996
- justifyContent: "space-between",
6997
- alignItems: "flex-start"
6998
- }
6999
- }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h4", {
7000
- style: {
7001
- fontSize: "18px",
7002
- fontWeight: "700",
7003
- color: "#0B2559",
7004
- margin: 0
7005
- }
7006
- }, vendor.name), /*#__PURE__*/React__default.createElement("p", {
7007
- style: {
7008
- fontSize: "12px",
7009
- color: "#64748B",
7010
- marginTop: "2px",
7011
- marginBottom: 0
7012
- }
7013
- }, t("MOBILE") || "Mobile", ": ", vendor.mobileNumber)), /*#__PURE__*/React__default.createElement("span", {
7014
- style: {
7015
- background: "#E0F2FE",
7016
- color: "#0369A1",
7017
- padding: "6px 12px",
7018
- borderRadius: "999px",
7019
- fontSize: "13px",
7020
- fontWeight: "700"
7754
+ onLastPage: () => {
7755
+ var _dashboardData$dashbo8;
7756
+ setCurrentPage(Math.max(((dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo8 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo8 === void 0 ? void 0 : _dashboardData$dashbo8.totalPages) || 1) - 1, 0));
7757
+ },
7758
+ onPageSizeChange: e => {
7759
+ setPageSize(Number(e.target.value));
7760
+ setCurrentPage(0);
7021
7761
  }
7022
- }, vendor.progress, "%")), /*#__PURE__*/React__default.createElement("div", {
7762
+ })), roles.includes("EKYC_SUPERVISOR") && /*#__PURE__*/React__default.createElement(digitUiReactComponents.ActionBar, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.SubmitBar, {
7763
+ label: t("EKYC_ASSIGN_KNOS"),
7764
+ onSubmit: () => setShowOptions(prev => !prev)
7765
+ }), showOptions && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Menu, {
7766
+ options: options,
7767
+ optionKey: "action",
7768
+ t: t,
7769
+ onSelect: handleMenuSelect,
7023
7770
  style: {
7024
- width: "100%",
7025
- height: "8px",
7026
- background: "#F1F5F9",
7027
- borderRadius: "999px",
7028
- overflow: "hidden"
7771
+ color: "#FFFFFF",
7772
+ fontSize: "18px"
7029
7773
  }
7774
+ })), showModal && /*#__PURE__*/React__default.createElement(AssignEkycModal, {
7775
+ surveyor: surveyor,
7776
+ closeModal: closeModal,
7777
+ refetchDashboard: refetchDashboard
7778
+ }));
7779
+ };
7780
+
7781
+ const vendors = [{
7782
+ id: 1,
7783
+ name: "Vendor Alpha",
7784
+ progress: 78,
7785
+ supervisors: 12,
7786
+ surveyors: 148,
7787
+ completed: 154200,
7788
+ pending: 43200,
7789
+ rejected: 3200
7790
+ }, {
7791
+ id: 2,
7792
+ name: "Vendor Beta",
7793
+ progress: 64,
7794
+ supervisors: 10,
7795
+ surveyors: 122,
7796
+ completed: 121000,
7797
+ pending: 68500,
7798
+ rejected: 2800
7799
+ }, {
7800
+ id: 3,
7801
+ name: "Vendor Gamma",
7802
+ progress: 91,
7803
+ supervisors: 15,
7804
+ surveyors: 182,
7805
+ completed: 201500,
7806
+ pending: 19800,
7807
+ rejected: 1800
7808
+ }];
7809
+ const zones = [{
7810
+ zone: "North Delhi",
7811
+ totalConnections: 220000,
7812
+ ekycDone: 172000,
7813
+ liveSurveyors: 58,
7814
+ todayCompleted: 2800
7815
+ }, {
7816
+ zone: "South Delhi",
7817
+ totalConnections: 198000,
7818
+ ekycDone: 154500,
7819
+ liveSurveyors: 42,
7820
+ todayCompleted: 2100
7821
+ }, {
7822
+ zone: "East Delhi",
7823
+ totalConnections: 175000,
7824
+ ekycDone: 132800,
7825
+ liveSurveyors: 37,
7826
+ todayCompleted: 1740
7827
+ }, {
7828
+ zone: "West Delhi",
7829
+ totalConnections: 212000,
7830
+ ekycDone: 188300,
7831
+ liveSurveyors: 48,
7832
+ todayCompleted: 2560
7833
+ }];
7834
+ const alerts = ["15 Surveyors inactive for more than 2 hours", "Vendor Beta completion dropped by 12% this week", "North Delhi has highest pending backlog", "2,843 eKYC applications rejected today"];
7835
+ const CeoDashboard$1 = () => {
7836
+ return /*#__PURE__*/React__default.createElement("div", {
7837
+ className: "ekyc-dashboard-wrapper"
7838
+ }, /*#__PURE__*/React__default.createElement("div", {
7839
+ className: "ceo-dashboard"
7840
+ }, /*#__PURE__*/React__default.createElement("main", {
7841
+ className: "main-content"
7842
+ }, /*#__PURE__*/React__default.createElement("div", {
7843
+ className: "kpi-grid"
7844
+ }, /*#__PURE__*/React__default.createElement("div", {
7845
+ className: "kpi-card primary"
7846
+ }, /*#__PURE__*/React__default.createElement("div", {
7847
+ className: "icon-box"
7848
+ }, /*#__PURE__*/React__default.createElement(fa.FaUsers, null)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h3", null, "7,85,000"), /*#__PURE__*/React__default.createElement("p", null, "Total Water Connections"))), /*#__PURE__*/React__default.createElement("div", {
7849
+ className: "kpi-card success"
7850
+ }, /*#__PURE__*/React__default.createElement("div", {
7851
+ className: "icon-box"
7852
+ }, /*#__PURE__*/React__default.createElement(fa.FaCheckCircle, null)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h3", null, "6,47,300"), /*#__PURE__*/React__default.createElement("p", null, "eKYC Completed"))), /*#__PURE__*/React__default.createElement("div", {
7853
+ className: "kpi-card warning"
7854
+ }, /*#__PURE__*/React__default.createElement("div", {
7855
+ className: "icon-box"
7856
+ }, /*#__PURE__*/React__default.createElement(fa.FaClock, null)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h3", null, "1,31,500"), /*#__PURE__*/React__default.createElement("p", null, "Pending eKYC"))), /*#__PURE__*/React__default.createElement("div", {
7857
+ className: "kpi-card danger"
7858
+ }, /*#__PURE__*/React__default.createElement("div", {
7859
+ className: "icon-box"
7860
+ }, /*#__PURE__*/React__default.createElement(fa.FaExclamationTriangle, null)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h3", null, "7,200"), /*#__PURE__*/React__default.createElement("p", null, "Rejected Applications")))), /*#__PURE__*/React__default.createElement("section", {
7861
+ className: "dashboard-section"
7862
+ }, /*#__PURE__*/React__default.createElement("div", {
7863
+ className: "section-header"
7864
+ }, /*#__PURE__*/React__default.createElement("h2", null, /*#__PURE__*/React__default.createElement(fa.FaChartLine, null), " Vendor Performance Overview"), /*#__PURE__*/React__default.createElement("button", null, "View All")), /*#__PURE__*/React__default.createElement("div", {
7865
+ className: "vendor-grid"
7866
+ }, vendors.map(vendor => /*#__PURE__*/React__default.createElement("div", {
7867
+ className: "vendor-card",
7868
+ key: vendor.id
7030
7869
  }, /*#__PURE__*/React__default.createElement("div", {
7870
+ className: "vendor-top"
7871
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h3", null, vendor.name), /*#__PURE__*/React__default.createElement("p", null, "Jurisdiction Assigned Vendor")), /*#__PURE__*/React__default.createElement("span", null, vendor.progress, "%")), /*#__PURE__*/React__default.createElement("div", {
7872
+ className: "progress-bar"
7873
+ }, /*#__PURE__*/React__default.createElement("div", {
7874
+ className: "progress-fill",
7031
7875
  style: {
7032
- width: vendor.progress + "%",
7033
- height: "100%",
7034
- background: "linear-gradient(90deg, #3B82F6 0%, #10B981 100%)",
7035
- borderRadius: "999px"
7876
+ width: vendor.progress + "%"
7036
7877
  }
7037
7878
  })), /*#__PURE__*/React__default.createElement("div", {
7038
- style: {
7039
- display: "grid",
7040
- gridTemplateColumns: "repeat(3, 1fr)",
7041
- gap: "12px"
7042
- }
7879
+ className: "vendor-stats"
7880
+ }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h4", null, vendor.supervisors), /*#__PURE__*/React__default.createElement("p", null, "Supervisors")), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h4", null, vendor.surveyors), /*#__PURE__*/React__default.createElement("p", null, "Surveyors")), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h4", null, vendor.completed), /*#__PURE__*/React__default.createElement("p", null, "Completed"))), /*#__PURE__*/React__default.createElement("div", {
7881
+ className: "vendor-footer"
7882
+ }, /*#__PURE__*/React__default.createElement("span", null, "Pending: ", vendor.pending), /*#__PURE__*/React__default.createElement("span", null, "Rejected: ", vendor.rejected)))))), /*#__PURE__*/React__default.createElement("section", {
7883
+ className: "dashboard-section"
7043
7884
  }, /*#__PURE__*/React__default.createElement("div", {
7044
- style: {
7045
- background: "#F8FAFC",
7046
- padding: "12px 8px",
7047
- borderRadius: "10px",
7048
- textAlign: "center"
7049
- }
7885
+ className: "section-header"
7886
+ }, /*#__PURE__*/React__default.createElement("h2", null, /*#__PURE__*/React__default.createElement(fa.FaMapMarkedAlt, null), " Jurisdiction Monitoring"), /*#__PURE__*/React__default.createElement("button", null, "Export Data")), /*#__PURE__*/React__default.createElement("div", {
7887
+ className: "table-wrapper"
7888
+ }, /*#__PURE__*/React__default.createElement("table", null, /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", null, "Zone"), /*#__PURE__*/React__default.createElement("th", null, "Total Connections"), /*#__PURE__*/React__default.createElement("th", null, "eKYC Done"), /*#__PURE__*/React__default.createElement("th", null, "Live Surveyors"), /*#__PURE__*/React__default.createElement("th", null, "Today's Completion"), /*#__PURE__*/React__default.createElement("th", null, "Status"))), /*#__PURE__*/React__default.createElement("tbody", null, zones.map((item, index) => /*#__PURE__*/React__default.createElement("tr", {
7889
+ key: index
7890
+ }, /*#__PURE__*/React__default.createElement("td", null, item.zone), /*#__PURE__*/React__default.createElement("td", null, item.totalConnections), /*#__PURE__*/React__default.createElement("td", null, item.ekycDone), /*#__PURE__*/React__default.createElement("td", null, item.liveSurveyors), /*#__PURE__*/React__default.createElement("td", null, item.todayCompleted), /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement("span", {
7891
+ className: "status-badge success"
7892
+ }, "Active")))))))), /*#__PURE__*/React__default.createElement("div", {
7893
+ className: "bottom-grid"
7894
+ }, /*#__PURE__*/React__default.createElement("section", {
7895
+ className: "dashboard-section alerts-section"
7050
7896
  }, /*#__PURE__*/React__default.createElement("div", {
7051
- style: {
7052
- fontSize: "16px",
7053
- fontWeight: "700",
7054
- color: "#1E293B"
7055
- }
7056
- }, vendor.supervisors), /*#__PURE__*/React__default.createElement("div", {
7057
- style: {
7058
- fontSize: "10px",
7059
- fontWeight: "600",
7060
- color: "#64748B",
7061
- textTransform: "uppercase",
7062
- marginTop: "4px"
7063
- }
7064
- }, t("SUPERVISORS") || "Supervisors")), /*#__PURE__*/React__default.createElement("div", {
7065
- style: {
7066
- background: "#F8FAFC",
7067
- padding: "12px 8px",
7068
- borderRadius: "10px",
7069
- textAlign: "center"
7070
- }
7897
+ className: "section-header"
7898
+ }, /*#__PURE__*/React__default.createElement("h2", null, /*#__PURE__*/React__default.createElement(fa.FaExclamationTriangle, null), " Critical Alerts")), /*#__PURE__*/React__default.createElement("div", {
7899
+ className: "alerts-list"
7900
+ }, alerts.map((alert, index) => /*#__PURE__*/React__default.createElement("div", {
7901
+ className: "alert-card",
7902
+ key: index
7903
+ }, /*#__PURE__*/React__default.createElement(fa.FaExclamationTriangle, null), /*#__PURE__*/React__default.createElement("p", null, alert))))), /*#__PURE__*/React__default.createElement("section", {
7904
+ className: "dashboard-section team-section"
7071
7905
  }, /*#__PURE__*/React__default.createElement("div", {
7072
- style: {
7073
- fontSize: "16px",
7074
- fontWeight: "700",
7075
- color: "#1E293B"
7076
- }
7077
- }, vendor.surveyors), /*#__PURE__*/React__default.createElement("div", {
7078
- style: {
7079
- fontSize: "10px",
7080
- fontWeight: "600",
7081
- color: "#64748B",
7082
- textTransform: "uppercase",
7083
- marginTop: "4px"
7084
- }
7085
- }, t("SURVEYORS") || "Surveyors")), /*#__PURE__*/React__default.createElement("div", {
7086
- style: {
7087
- background: "#F8FAFC",
7088
- padding: "12px 8px",
7089
- borderRadius: "10px",
7090
- textAlign: "center"
7091
- }
7906
+ className: "section-header"
7907
+ }, /*#__PURE__*/React__default.createElement("h2", null, /*#__PURE__*/React__default.createElement(fa.FaUserTie, null), " Workforce Monitoring")), /*#__PURE__*/React__default.createElement("div", {
7908
+ className: "team-stats-grid"
7092
7909
  }, /*#__PURE__*/React__default.createElement("div", {
7093
- style: {
7094
- fontSize: "16px",
7095
- fontWeight: "700",
7096
- color: "#10B981"
7097
- }
7098
- }, vendor.completed), /*#__PURE__*/React__default.createElement("div", {
7099
- style: {
7100
- fontSize: "10px",
7101
- fontWeight: "600",
7102
- color: "#64748B",
7103
- textTransform: "uppercase",
7104
- marginTop: "4px"
7105
- }
7106
- }, t("COMPLETED") || "Completed"))), /*#__PURE__*/React__default.createElement("div", {
7107
- style: {
7108
- display: "flex",
7109
- justifyContent: "space-between",
7110
- fontSize: "12px",
7111
- color: "#64748B",
7112
- borderTop: "1px solid #F1F5F9",
7113
- paddingTop: "12px"
7114
- }
7115
- }, /*#__PURE__*/React__default.createElement("span", null, t("PENDING") || "Pending", ": ", /*#__PURE__*/React__default.createElement("span", {
7116
- style: {
7117
- fontWeight: "700",
7118
- color: "#F59E0B"
7119
- }
7120
- }, vendor.pending)), /*#__PURE__*/React__default.createElement("span", null, t("REJECTED") || "Rejected", ": ", /*#__PURE__*/React__default.createElement("span", {
7121
- style: {
7122
- fontWeight: "700",
7123
- color: "#EF4444"
7124
- }
7125
- }, vendor.rejected))))))));
7910
+ className: "team-box"
7911
+ }, /*#__PURE__*/React__default.createElement("h3", null, "37"), /*#__PURE__*/React__default.createElement("p", null, "Total Supervisors Online")), /*#__PURE__*/React__default.createElement("div", {
7912
+ className: "team-box"
7913
+ }, /*#__PURE__*/React__default.createElement("h3", null, "154"), /*#__PURE__*/React__default.createElement("p", null, "Surveyors Active")), /*#__PURE__*/React__default.createElement("div", {
7914
+ className: "team-box"
7915
+ }, /*#__PURE__*/React__default.createElement("h3", null, "12,430"), /*#__PURE__*/React__default.createElement("p", null, "Today's eKYC Completed")), /*#__PURE__*/React__default.createElement("div", {
7916
+ className: "team-box"
7917
+ }, /*#__PURE__*/React__default.createElement("h3", null, "92%"), /*#__PURE__*/React__default.createElement("p", null, "Operational Efficiency"))))))));
7126
7918
  };
7127
7919
 
7920
+ const breadcrumb = (userType, listLabel, listPath, detailLabel) => [{
7921
+ label: listLabel,
7922
+ path: "/digit-ui/" + userType + "/ekyc/" + listPath
7923
+ }, {
7924
+ label: detailLabel
7925
+ }];
7926
+ const getEkycRoutes = userType => [{
7927
+ path: "/dashboard",
7928
+ component: Dashboard,
7929
+ layout: "normal",
7930
+ breadcrumb: "EKYC_DASHBOARD"
7931
+ }, {
7932
+ path: "/inbox",
7933
+ component: Inbox,
7934
+ layout: "normal",
7935
+ breadcrumb: "EKYC_INBOX"
7936
+ }, {
7937
+ path: "/review/:kno",
7938
+ component: Review,
7939
+ layout: "normal",
7940
+ breadcrumb: "EKYC_REVIEW"
7941
+ }, {
7942
+ path: "/create-kyc",
7943
+ component: Create,
7944
+ layout: "normal",
7945
+ breadcrumb: "EKYC_CREATE_KYC"
7946
+ }, {
7947
+ path: "/mapping",
7948
+ component: Mapping,
7949
+ layout: "normal",
7950
+ breadcrumb: "EKYC_MAPPING"
7951
+ }, {
7952
+ path: "/admin-dashboard",
7953
+ component: AdminDashboard,
7954
+ layout: "normal",
7955
+ breadcrumb: "EKYC_ADMIN_DASHBOARD"
7956
+ }, {
7957
+ path: "/ceo-dashboard",
7958
+ component: CeoDashboard$1,
7959
+ layout: "normal",
7960
+ breadcrumb: "CEO_M.F_DOR_FINANCE_VIEW"
7961
+ }, {
7962
+ path: "/consumer-details",
7963
+ component: EKYCForm,
7964
+ layout: "normal",
7965
+ breadcrumb: "EKYC_CONSUMER_DETAILS"
7966
+ }, {
7967
+ path: "/address-details",
7968
+ component: EKYCForm,
7969
+ layout: "normal",
7970
+ breadcrumb: "EKYC_ADDRESS_DETAILS"
7971
+ }, {
7972
+ path: "/property-info",
7973
+ component: EKYCForm,
7974
+ layout: "normal",
7975
+ breadcrumb: "EKYC_PROPERTY_INFO"
7976
+ }, {
7977
+ path: "/meter-details",
7978
+ component: EKYCForm,
7979
+ layout: "normal",
7980
+ breadcrumb: "EKYC_METER_DETAILS"
7981
+ }, {
7982
+ path: ["/assign"],
7983
+ component: AssignEkyc,
7984
+ layout: "normal",
7985
+ breadcrumb: [{
7986
+ label: "EKYC_ASSIGN",
7987
+ path: "/digit-ui/" + userType + "/ekyc/assign"
7988
+ }]
7989
+ }, {
7990
+ path: ["/vendors/:vendorId", "/vendors"],
7991
+ component: VendorDetailsCard,
7992
+ layout: "normal",
7993
+ breadcrumb: breadcrumb(userType, "EKYC_VENDORS", "vendors:vendorId", "EKYC_VENDOR_DETAILS")
7994
+ }, {
7995
+ path: ["/supervisor-dashboard/:id", "/supervisor-dashboard"],
7996
+ component: SupervisorDetailsCard,
7997
+ layout: "action",
7998
+ breadcrumb: breadcrumb(userType, "EKYC_SUPERVISOR_DASHBOARD", "supervisor-dashboard:id", "EKYC_SUPERVISOR_DETAILS")
7999
+ }, {
8000
+ path: ["/surveyor-dashboard/:id", "/surveyor-dashboard"],
8001
+ component: SurveyorDetailsDashboard,
8002
+ layout: "action",
8003
+ breadcrumb: breadcrumb(userType, "EKYC_SURVEYOR_DASHBOARD", "surveyor-dashboard/:id", "EKYC_SURVEYOR_DETAILS")
8004
+ }];
8005
+ const ekycRoutes = getEkycRoutes("employee");
8006
+
7128
8007
  const EmployeeApp = _ref => {
7129
8008
  let path = _ref.path;
7130
8009
  const _useTranslation = reactI18next.useTranslation(),
@@ -7132,7 +8011,6 @@ const EmployeeApp = _ref => {
7132
8011
  const location = reactRouterDom.useLocation();
7133
8012
  sessionStorage.removeItem("revalidateddone");
7134
8013
  const getDynamicBreadcrumbs = () => {
7135
- const pathname = location.pathname;
7136
8014
  const crumbs = [{
7137
8015
  icon: digitUiReactComponents.HomeIcon,
7138
8016
  path: "/digit-ui/employee"
@@ -7140,70 +8018,44 @@ const EmployeeApp = _ref => {
7140
8018
  label: t("ACTION_TEST_EKYC"),
7141
8019
  path: "/digit-ui/employee/module/details"
7142
8020
  }];
7143
- if (pathname.includes("/create-kyc")) {
7144
- crumbs.push({
7145
- label: t("EKYC_CREATE_KYC")
7146
- });
7147
- } else if (pathname.includes("/consumer-details")) {
7148
- crumbs.push({
7149
- label: t("EKYC_CONSUMER_DETAILS")
7150
- });
7151
- } else if (pathname.includes("/address-details")) {
7152
- crumbs.push({
7153
- label: t("EKYC_ADDRESS_DETAILS")
7154
- });
7155
- } else if (pathname.includes("/property-info")) {
7156
- crumbs.push({
7157
- label: t("EKYC_PROPERTY_INFO")
7158
- });
7159
- } else if (pathname.includes("/meter-details")) {
7160
- crumbs.push({
7161
- label: t("EKYC_METER_DETAILS")
7162
- });
7163
- } else if (pathname.includes("/review")) {
7164
- crumbs.push({
7165
- label: t("EKYC_INBOX"),
7166
- path: "/digit-ui/employee/ekyc/inbox"
7167
- });
7168
- crumbs.push({
7169
- label: t("EKYC_REVIEW")
7170
- });
7171
- } else if (pathname.includes("/assign/surveyor-details")) {
7172
- crumbs.push({
7173
- label: t("EKYC_ASSIGN"),
7174
- path: "/digit-ui/employee/ekyc/assign"
7175
- });
7176
- crumbs.push({
7177
- label: t("EKYC_SURVEYOR_DETAILS")
7178
- });
7179
- } else if (pathname.includes("/assign")) {
7180
- crumbs.push({
7181
- label: t("EKYC_ASSIGN")
7182
- });
7183
- } else if (pathname.includes("/ceo-dashboard")) {
7184
- crumbs.push({
7185
- label: t("CEO_M.F_DOR_FINANCE_VIEW")
7186
- });
7187
- } else if (pathname.includes("/admin-dashboard")) {
7188
- crumbs.push({
7189
- label: t("EKYC_ADMIN_DASHBOARD") || "Admin Dashboard"
7190
- });
7191
- } else if (pathname.includes("/vendors/")) {
7192
- crumbs.push({
7193
- label: t("EKYC_VENDOR_DETAILS")
7194
- });
7195
- } else if (pathname.includes("/mapping")) {
7196
- crumbs.push({
7197
- label: t("EKYC_MAPPING")
7198
- });
7199
- } else if (pathname.includes("/dashboard")) {
7200
- crumbs.push({
7201
- label: t("EKYC_DASHBOARD")
7202
- });
7203
- } else if (pathname.includes("/inbox")) {
7204
- crumbs.push({
7205
- label: t("EKYC_INBOX")
8021
+ const pathSegments = location.pathname.split("/").filter(Boolean);
8022
+ const ekycIndex = pathSegments.indexOf("ekyc");
8023
+ const relativeSegments = ekycIndex !== -1 ? pathSegments.slice(ekycIndex + 1) : [];
8024
+ let matchedPath = "";
8025
+ const currentRoute = ekycRoutes.find(route => {
8026
+ const paths = Array.isArray(route.path) ? route.path : [route.path];
8027
+ return paths.some(singlePath => {
8028
+ const routeSegments = singlePath.split("/").filter(Boolean);
8029
+ if (routeSegments.length === relativeSegments.length && routeSegments.every((seg, i) => seg.startsWith(":") || seg === relativeSegments[i])) {
8030
+ matchedPath = singlePath;
8031
+ return true;
8032
+ }
8033
+ return false;
7206
8034
  });
8035
+ });
8036
+ if (currentRoute) {
8037
+ if (Array.isArray(currentRoute.breadcrumb)) {
8038
+ currentRoute.breadcrumb.forEach(crumb => {
8039
+ let crumbPath = crumb.path;
8040
+ if (crumbPath && matchedPath) {
8041
+ matchedPath.split("/").filter(Boolean).forEach((segment, idx) => {
8042
+ if (segment.startsWith(":")) {
8043
+ const val = relativeSegments[idx];
8044
+ crumbPath = crumbPath.replace(new RegExp("\\/" + segment, "g"), "/" + val).replace(new RegExp("(\\w+)" + segment, "g"), "$1/" + val).replace(new RegExp(segment, "g"), val);
8045
+ }
8046
+ });
8047
+ }
8048
+ crumbs.push(_extends({
8049
+ label: t(crumb.label)
8050
+ }, crumbPath ? {
8051
+ path: crumbPath
8052
+ } : {}));
8053
+ });
8054
+ } else {
8055
+ crumbs.push({
8056
+ label: t(currentRoute.breadcrumb)
8057
+ });
8058
+ }
7207
8059
  }
7208
8060
  return crumbs;
7209
8061
  };
@@ -7248,12 +8100,6 @@ const EmployeeApp = _ref => {
7248
8100
  component: () => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
7249
8101
  layoutClass: "normal"
7250
8102
  }, /*#__PURE__*/React__default.createElement(Mapping, null))
7251
- }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
7252
- path: path + "/assign",
7253
- exact: true,
7254
- component: () => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
7255
- layoutClass: "normal"
7256
- }, /*#__PURE__*/React__default.createElement(AssignEkyc, null))
7257
8103
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
7258
8104
  path: path + "/assign/surveyor-details/:id",
7259
8105
  exact: true,
@@ -7287,6 +8133,16 @@ const EmployeeApp = _ref => {
7287
8133
  component: () => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
7288
8134
  layoutClass: "normal"
7289
8135
  }, /*#__PURE__*/React__default.createElement(VendorDetailsCard, null))
8136
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
8137
+ path: [path + "/supervisor-dashboard/:id", path + "/supervisor-dashboard"],
8138
+ component: () => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
8139
+ layoutClass: "normal"
8140
+ }, /*#__PURE__*/React__default.createElement(SupervisorDetailsCard, null))
8141
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
8142
+ path: [path + "/surveyor-dashboard/:id", path + "/surveyor-dashboard"],
8143
+ component: () => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
8144
+ layoutClass: "normal"
8145
+ }, /*#__PURE__*/React__default.createElement(SurveyorDetailsDashboard, null))
7290
8146
  })))));
7291
8147
  };
7292
8148
 
@@ -8331,20 +9187,17 @@ const Home = () => {
8331
9187
  }
8332
9188
  if (roles.includes("EKYC_SUPERVISOR") || roles.includes("EKYC_VENDOR")) {
8333
9189
  propsForModuleCard.links.push({
8334
- label: t("EKYC_DASHBOARD"),
8335
- link: "/digit-ui/citizen/ekyc/dashboard"
8336
- }, {
8337
9190
  label: t("EKYC_INBOX"),
8338
9191
  link: "/digit-ui/citizen/ekyc/inbox"
8339
- }, {
8340
- label: t("EKYC_ASSIGN"),
8341
- link: "/digit-ui/citizen/ekyc/assign"
8342
9192
  });
8343
9193
  }
8344
9194
  if (roles.includes("EKYC_SUPERVISOR")) {
8345
9195
  propsForModuleCard.links.push({
8346
9196
  label: t("EKYC_SUPERVISOR_DASHBOARD"),
8347
9197
  link: "/digit-ui/citizen/ekyc/supervisor-dashboard"
9198
+ }, {
9199
+ label: t("EKYC_ASSIGN"),
9200
+ link: "/digit-ui/citizen/ekyc/assign"
8348
9201
  });
8349
9202
  }
8350
9203
  if (roles.includes("EKYC_VENDOR")) {
@@ -8549,470 +9402,97 @@ const Inbox$1 = _ref => {
8549
9402
  });
8550
9403
  case "mutateTableForm":
8551
9404
  Digit.SessionStorage.set(storageKey, _extends({}, state, {
8552
- tableForm: payload.data
8553
- }));
8554
- return _extends({}, state, {
8555
- tableForm: payload.data
8556
- });
8557
- default:
8558
- return state;
8559
- }
8560
- }
8561
- const onPageSizeChange = e => {
8562
- const newLimit = Number(e.target.value);
8563
- dispatch({
8564
- action: "mutateTableForm",
8565
- data: _extends({}, formState.tableForm, {
8566
- limit: newLimit,
8567
- offset: 0
8568
- }),
8569
- checkPathName
8570
- });
8571
- };
8572
- const onSortingByData = e => {
8573
- if (e.length > 0) {
8574
- const _e$ = e[0],
8575
- id = _e$.id,
8576
- desc = _e$.desc;
8577
- const sortOrder = desc ? "DESC" : "ASC";
8578
- const sortBy = id;
8579
- if (!(formState.tableForm.sortBy === sortBy && formState.tableForm.sortOrder === sortOrder)) {
8580
- dispatch({
8581
- action: "mutateTableForm",
8582
- data: _extends({}, formState.tableForm, {
8583
- sortBy: id,
8584
- sortOrder: desc ? "DESC" : "ASC"
8585
- }),
8586
- checkPathName
8587
- });
8588
- }
8589
- }
8590
- };
8591
- const propsForInboxTable = useInboxTableConfig(_extends({}, {
8592
- parentRoute,
8593
- onPageSizeChange,
8594
- formState,
8595
- totalCount: totalRecords,
8596
- table: filteredData,
8597
- dispatch,
8598
- onSortingByData,
8599
- tenantId,
8600
- checkPathName,
8601
- inboxStyles: {
8602
- overflowX: "scroll",
8603
- overflowY: "hidden"
8604
- },
8605
- tableStyle: {
8606
- width: "70%"
8607
- }
8608
- }));
8609
- const isInboxLoading = isLoading || isSearchLoading;
8610
- return /*#__PURE__*/React__default.createElement("div", {
8611
- className: "app-container"
8612
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.InboxComposer, _extends({
8613
- isInboxLoading
8614
- }, propsForSearchForm, {
8615
- propsForInboxTable,
8616
- formState
8617
- })));
8618
- };
8619
-
8620
- const SupervisorDetailsCard = () => {
8621
- var _Digit$SessionStorage, _fullName$charAt;
8622
- const _useTranslation = reactI18next.useTranslation(),
8623
- t = _useTranslation.t;
8624
- const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
8625
- const _useParams = reactRouterDom.useParams(),
8626
- supervisorId = _useParams.id;
8627
- const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
8628
- const _useState = React.useState(false),
8629
- ekycDownloadLoading = _useState[0],
8630
- setEkycDownloadLoading = _useState[1];
8631
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycAssignmentProgress({
8632
- enabled: !!tenantId,
8633
- keepPreviousData: true
8634
- }),
8635
- isProgressLoading = _Digit$Hooks$ekyc$use.isLoading,
8636
- progressData = _Digit$Hooks$ekyc$use.data;
8637
- const supervisor = React.useMemo(() => {
8638
- if (!(progressData !== null && progressData !== void 0 && progressData.supervisorReport)) return null;
8639
- if (supervisorId) {
8640
- return progressData.supervisorReport.find(s => s.supervisorId === supervisorId) || progressData.supervisorReport[0];
8641
- }
8642
- const userUuid = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid;
8643
- if (userUuid) {
8644
- return progressData.supervisorReport.find(s => s.supervisorId === userUuid) || progressData.supervisorReport[0];
8645
- }
8646
- return progressData.supervisorReport[0];
8647
- }, [progressData, supervisorId, loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.uuid]);
8648
- const fullName = (supervisor === null || supervisor === void 0 ? void 0 : supervisor.supervisorName) || (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.name) || "N/A";
8649
- const mobileNumber = (supervisor === null || supervisor === void 0 ? void 0 : supervisor.mobileNo) || (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.mobileNumber) || "N/A";
8650
- const email = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.emailId) || "N/A";
8651
- const gender = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.gender) || "N/A";
8652
- const status = supervisor ? "ACTIVE" : "N/A";
8653
- const assignedZone = (supervisor === null || supervisor === void 0 ? void 0 : supervisor.assignedZoneId) || "N/A";
8654
- const vendorName = "N/A";
8655
- const surveyors = React.useMemo(() => {
8656
- return (supervisor === null || supervisor === void 0 ? void 0 : supervisor.surveyors) || [];
8657
- }, [supervisor]);
8658
- const _useState2 = React.useState(0),
8659
- currentPage = _useState2[0],
8660
- setCurrentPage = _useState2[1];
8661
- const _useState3 = React.useState(20),
8662
- pageSize = _useState3[0],
8663
- setPageSize = _useState3[1];
8664
- const paginatedSurveyors = React.useMemo(() => {
8665
- const start = currentPage * pageSize;
8666
- const end = start + pageSize;
8667
- return surveyors.slice(start, end);
8668
- }, [surveyors, currentPage, pageSize]);
8669
- const surveyorColumns = React.useMemo(() => [{
8670
- Header: t("SURVEYOR_NAME") || "Surveyor Name",
8671
- accessor: row => (row === null || row === void 0 ? void 0 : row.surveyorName) || "N/A",
8672
- Cell: _ref => {
8673
- var _row$original;
8674
- let row = _ref.row;
8675
- return /*#__PURE__*/React__default.createElement("a", {
8676
- href: "/digit-ui/citizen/ekyc/surveyor-dashboard/" + row.original.surveyorId,
8677
- style: {
8678
- color: "#1D70B8",
8679
- fontWeight: "600",
8680
- textDecoration: "none"
8681
- }
8682
- }, ((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.surveyorName) || "N/A");
8683
- }
8684
- }, {
8685
- Header: t("MOBILE_NUMBER") || "Mobile Number",
8686
- accessor: row => (row === null || row === void 0 ? void 0 : row.mobileNo) || "N/A",
8687
- id: "mobileNumber"
8688
- }, {
8689
- Header: t("STATUS") || "Status",
8690
- accessor: () => "ACTIVE",
8691
- id: "status",
8692
- Cell: _ref2 => {
8693
- let value = _ref2.value;
8694
- return /*#__PURE__*/React__default.createElement("span", {
8695
- className: "status-badge verified"
8696
- }, t(value) || value);
8697
- }
8698
- }, {
8699
- Header: t("TOTAL_EKYC_APPLICATIONS") || "Total eKYC Applications",
8700
- accessor: row => (row === null || row === void 0 ? void 0 : row.totalKnos) || 0,
8701
- id: "totalEkycApplications"
8702
- }, {
8703
- Header: t("EKYC_COMPLETED") || "eKYC Completed",
8704
- accessor: row => (row === null || row === void 0 ? void 0 : row.submittedKnos) || 0,
8705
- id: "ekycCompleted"
8706
- }, {
8707
- Header: t("PENDING_APPLICATIONS") || "Pending Applications",
8708
- accessor: row => (row === null || row === void 0 ? void 0 : row.pendingKnos) || 0,
8709
- id: "pendingApplications"
8710
- }, {
8711
- Header: t("OVERALL_PROGRESS") || "Overall Progress",
8712
- accessor: row => ((row === null || row === void 0 ? void 0 : row.progressPercent) || 0) + "%",
8713
- id: "overallProgress"
8714
- }], [t]);
8715
- const _useState4 = React.useState(false),
8716
- showReportMenu = _useState4[0],
8717
- setShowReportMenu = _useState4[1];
8718
- const _useState5 = React.useState({
8719
- from: "",
8720
- to: ""
8721
- }),
8722
- customDate = _useState5[0],
8723
- setCustomDate = _useState5[1];
8724
- const _useState6 = React.useState(false),
8725
- showCustomPicker = _useState6[0],
8726
- setShowCustomPicker = _useState6[1];
8727
- const _useState7 = React.useState(false),
8728
- reportLoading = _useState7[0];
8729
- const reportMenuRef = React.useRef(null);
8730
- React.useEffect(() => {
8731
- const handler = e => {
8732
- if (reportMenuRef.current && !reportMenuRef.current.contains(e.target)) {
8733
- setShowReportMenu(false);
8734
- setShowCustomPicker(false);
8735
- }
8736
- };
8737
- document.addEventListener("mousedown", handler);
8738
- return () => document.removeEventListener("mousedown", handler);
8739
- }, []);
8740
- const handlePresetDownload = filter => {
8741
- handleDownload();
8742
- };
8743
- const handleCustomDownload = () => {
8744
- if (!customDate.from || !customDate.to) {
8745
- alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
8746
- return;
8747
- }
8748
- handleDownload();
8749
- };
8750
- const handleDownloadEkycData = function () {
8751
- try {
8752
- if (!surveyors || surveyors.length === 0) {
8753
- alert(t("NO_SURVEYORS_ASSIGNED") || "No surveyors assigned to this supervisor.");
8754
- return Promise.resolve();
8755
- }
8756
- setEkycDownloadLoading(true);
8757
- return Promise.resolve(_finallyRethrows(function () {
8758
- return _catch(function () {
8759
- const fetchPromises = surveyors.map(s => Digit.EkycService.application_list({
8760
- tenantId: tenantId || "dl.djb",
8761
- offset: 0,
8762
- limit: 5000,
8763
- surveyorId: s.surveyorId || s.id,
8764
- reportDownload: true
8765
- }).catch(err => {
8766
- console.error("Error fetching applications for surveyor " + s.surveyorName + ":", err);
8767
- return {
8768
- consumerList: []
8769
- };
8770
- }));
8771
- return Promise.resolve(Promise.all(fetchPromises)).then(function (results) {
8772
- const consumerList = results.flatMap(res => (res === null || res === void 0 ? void 0 : res.consumerList) || []);
8773
- if (consumerList.length === 0) {
8774
- alert(t("NO_DATA_FOUND") || "No data found for download.");
8775
- return;
8776
- }
8777
- 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"];
8778
- const headerMapping = {
8779
- kno: t("KNO") || "KNO",
8780
- firstName: t("FIRST_NAME") || "First Name",
8781
- middleName: t("MIDDLE_NAME") || "Middle Name",
8782
- lastName: t("LAST_NAME") || "Last Name",
8783
- gender: t("GENDER") || "Gender",
8784
- mobileNumber: t("MOBILE_NUMBER") || "Mobile Number",
8785
- emailId: t("EMAIL_ID") || "Email ID",
8786
- fatherOrHusbandName: t("FATHER_HUSBUND_NAME") || "Father/Husband Name",
8787
- relationship: t("RELATIONSHIP") || "Relationship",
8788
- dob: t("DOB") || "Date of Birth",
8789
- ekycStatus: t("EKYC_STATUS") || "eKYC Status",
8790
- zoneName: t("ZONE") || "Zone",
8791
- assembly: t("ASSEMBLY") || "Assembly",
8792
- ward: t("WARD") || "Ward",
8793
- pincode: t("PINCODE") || "Pincode",
8794
- mrkey: t("MR_KEY") || "MR Key",
8795
- createdTime: t("CREATED_TIME") || "Created Time",
8796
- lastModifiedTime: t("LAST_MODIFIED_TIME") || "Last Modified Time"
8797
- };
8798
- const excelData = consumerList.map(item => {
8799
- const cleanObj = {};
8800
- const fullName = [item.firstName, item.middleName, item.lastName].filter(Boolean).join(" ");
8801
- if (fullName) {
8802
- cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = fullName;
8803
- }
8804
- Object.keys(item).forEach(key => {
8805
- if (excludedKeys.includes(key)) return;
8806
- const val = item[key];
8807
- if (typeof val === "object" && val !== null) {
8808
- return;
8809
- }
8810
- const friendlyHeader = headerMapping[key] || t(key.toUpperCase()) || key;
8811
- cleanObj[friendlyHeader] = val;
8812
- });
8813
- return cleanObj;
8814
- });
8815
- const cleanFileName = "eKYC_Data_Supervisor_" + fullName.replace(/[^a-zA-Z0-9]/g, "_");
8816
- Digit.Download.Excel(excelData, cleanFileName);
8817
- });
8818
- }, function (error) {
8819
- console.error("Error downloading eKYC Excel:", error);
9405
+ tableForm: payload.data
9406
+ }));
9407
+ return _extends({}, state, {
9408
+ tableForm: payload.data
8820
9409
  });
8821
- }, function (_wasThrown, _result) {
8822
- setEkycDownloadLoading(false);
8823
- if (_wasThrown) throw _result;
8824
- return _result;
8825
- }));
8826
- } catch (e) {
8827
- return Promise.reject(e);
9410
+ default:
9411
+ return state;
8828
9412
  }
8829
- };
8830
- if (isProgressLoading) {
8831
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
8832
9413
  }
8833
- if (!supervisor) {
8834
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, null, /*#__PURE__*/React__default.createElement("div", {
8835
- style: {
8836
- padding: "24px"
9414
+ const onPageSizeChange = e => {
9415
+ const newLimit = Number(e.target.value);
9416
+ dispatch({
9417
+ action: "mutateTableForm",
9418
+ data: _extends({}, formState.tableForm, {
9419
+ limit: newLimit,
9420
+ offset: 0
9421
+ }),
9422
+ checkPathName
9423
+ });
9424
+ };
9425
+ const onSortingByData = e => {
9426
+ if (e.length > 0) {
9427
+ const _e$ = e[0],
9428
+ id = _e$.id,
9429
+ desc = _e$.desc;
9430
+ const sortOrder = desc ? "DESC" : "ASC";
9431
+ const sortBy = id;
9432
+ if (!(formState.tableForm.sortBy === sortBy && formState.tableForm.sortOrder === sortOrder)) {
9433
+ dispatch({
9434
+ action: "mutateTableForm",
9435
+ data: _extends({}, formState.tableForm, {
9436
+ sortBy: id,
9437
+ sortOrder: desc ? "DESC" : "ASC"
9438
+ }),
9439
+ checkPathName
9440
+ });
8837
9441
  }
8838
- }, t("NO_SUPERVISOR_FOUND")));
8839
- }
8840
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
8841
- className: "surveyor-dashboard"
8842
- }, /*#__PURE__*/React__default.createElement("div", {
8843
- className: "ekyc-dashboard-section"
8844
- }, /*#__PURE__*/React__default.createElement("div", {
8845
- className: "ekyc-dashboard-header"
8846
- }, /*#__PURE__*/React__default.createElement("div", {
8847
- className: "avatar"
8848
- }, fullName === null || fullName === void 0 ? void 0 : (_fullName$charAt = fullName.charAt(0)) === null || _fullName$charAt === void 0 ? void 0 : _fullName$charAt.toUpperCase()), /*#__PURE__*/React__default.createElement("div", {
8849
- className: "header-content"
8850
- }, /*#__PURE__*/React__default.createElement("h2", {
8851
- className: "name"
8852
- }, fullName), /*#__PURE__*/React__default.createElement("div", {
8853
- className: "designation"
8854
- }, t("FIELD_SUPERVISOR") || "Field Supervisor"))), /*#__PURE__*/React__default.createElement("div", {
8855
- className: "report-download",
8856
- ref: reportMenuRef
8857
- }, /*#__PURE__*/React__default.createElement("button", {
8858
- className: "download-btn",
8859
- disabled: reportLoading,
8860
- onClick: () => {
8861
- setShowReportMenu(p => !p);
8862
- setShowCustomPicker(false);
8863
9442
  }
8864
- }, reportLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_REPORT") || "Download Report"), showReportMenu && /*#__PURE__*/React__default.createElement("div", {
8865
- className: "report-menu"
8866
- }, [{
8867
- label: t("TODAY") || "Today",
8868
- key: "today"
8869
- }, {
8870
- label: t("THIS_WEEK") || "This Week",
8871
- key: "week"
8872
- }, {
8873
- label: t("THIS_MONTH") || "This Month",
8874
- key: "month"
8875
- }].map(_ref3 => {
8876
- let label = _ref3.label,
8877
- key = _ref3.key;
8878
- return /*#__PURE__*/React__default.createElement("div", {
8879
- key: key,
8880
- className: "menu-item",
8881
- onClick: () => handlePresetDownload()
8882
- }, label);
8883
- }), /*#__PURE__*/React__default.createElement("div", {
8884
- className: "custom-date-trigger",
8885
- onClick: () => setShowCustomPicker(p => !p)
8886
- }, t("CUSTOM_DATE") || "Custom Date"), showCustomPicker && /*#__PURE__*/React__default.createElement("div", {
8887
- className: "custom-picker"
8888
- }, /*#__PURE__*/React__default.createElement("div", {
8889
- className: "date-field"
8890
- }, /*#__PURE__*/React__default.createElement("label", {
8891
- className: "date-label"
8892
- }, t("FROM_DATE") || "From"), /*#__PURE__*/React__default.createElement("input", {
8893
- type: "date",
8894
- className: "date-input",
8895
- value: customDate.from,
8896
- onChange: e => setCustomDate(d => _extends({}, d, {
8897
- from: e.target.value
8898
- }))
8899
- })), /*#__PURE__*/React__default.createElement("div", {
8900
- className: "date-field"
8901
- }, /*#__PURE__*/React__default.createElement("label", {
8902
- className: "date-label"
8903
- }, t("TO_DATE") || "To"), /*#__PURE__*/React__default.createElement("input", {
8904
- type: "date",
8905
- className: "date-input",
8906
- value: customDate.to,
8907
- onChange: e => setCustomDate(d => _extends({}, d, {
8908
- to: e.target.value
8909
- }))
8910
- })), /*#__PURE__*/React__default.createElement("button", {
8911
- className: "download-action-btn",
8912
- onClick: handleCustomDownload
8913
- }, t("DOWNLOAD") || "Download"))))), /*#__PURE__*/React__default.createElement("div", {
8914
- className: "ekyc-dashboard-section"
8915
- }, /*#__PURE__*/React__default.createElement("div", {
8916
- className: "ekyc-details-wrapper"
8917
- }, /*#__PURE__*/React__default.createElement("div", {
8918
- className: "details-left"
8919
- }, /*#__PURE__*/React__default.createElement("div", {
8920
- className: "details-grid"
8921
- }, /*#__PURE__*/React__default.createElement("div", {
8922
- className: "detail-item"
8923
- }, /*#__PURE__*/React__default.createElement("span", {
8924
- className: "label"
8925
- }, t("MOBILE")), /*#__PURE__*/React__default.createElement("span", {
8926
- className: "value"
8927
- }, mobileNumber)), /*#__PURE__*/React__default.createElement("div", {
8928
- className: "detail-item"
8929
- }, /*#__PURE__*/React__default.createElement("span", {
8930
- className: "label"
8931
- }, t("EMAIL")), /*#__PURE__*/React__default.createElement("span", {
8932
- className: "value"
8933
- }, email)), /*#__PURE__*/React__default.createElement("div", {
8934
- className: "detail-item"
8935
- }, /*#__PURE__*/React__default.createElement("span", {
8936
- className: "label"
8937
- }, t("GENDER")), /*#__PURE__*/React__default.createElement("span", {
8938
- className: "value"
8939
- }, gender)), /*#__PURE__*/React__default.createElement("div", {
8940
- className: "detail-item"
8941
- }, /*#__PURE__*/React__default.createElement("span", {
8942
- className: "label"
8943
- }, t("STATUS")), /*#__PURE__*/React__default.createElement("span", {
8944
- className: "value"
8945
- }, status)), /*#__PURE__*/React__default.createElement("div", {
8946
- className: "detail-item"
8947
- }, /*#__PURE__*/React__default.createElement("span", {
8948
- className: "label"
8949
- }, t("ASSIGNED_ZONE") || "Assigned Zone"), /*#__PURE__*/React__default.createElement("span", {
8950
- className: "value"
8951
- }, assignedZone)), /*#__PURE__*/React__default.createElement("div", {
8952
- className: "detail-item"
8953
- }, /*#__PURE__*/React__default.createElement("span", {
8954
- className: "label"
8955
- }, t("VENDOR_NAME") || "Vendor Name"), /*#__PURE__*/React__default.createElement("span", {
8956
- className: "value"
8957
- }, vendorName)))), /*#__PURE__*/React__default.createElement("div", {
8958
- className: "details-right"
8959
- }, /*#__PURE__*/React__default.createElement("div", {
8960
- className: "download-card"
8961
- }, /*#__PURE__*/React__default.createElement("h4", null, t("DOWNLOAD_EKYC_DATA") || "Download eKYC Data"), /*#__PURE__*/React__default.createElement("p", null, t("DOWNLOAD_EKYC_DATA_DESC") || "Export the complete eKYC verification records for your assigned jurisdiction into Excel format."), /*#__PURE__*/React__default.createElement("button", {
8962
- className: "download-excel-btn",
8963
- disabled: ekycDownloadLoading,
8964
- onClick: handleDownloadEkycData
8965
- }, /*#__PURE__*/React__default.createElement("svg", {
8966
- width: "16",
8967
- height: "16",
8968
- viewBox: "0 0 24 24",
8969
- fill: "none",
8970
- stroke: "currentColor",
8971
- strokeWidth: "2.5",
8972
- strokeLinecap: "round",
8973
- strokeLinejoin: "round"
8974
- }, /*#__PURE__*/React__default.createElement("path", {
8975
- d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
8976
- }), /*#__PURE__*/React__default.createElement("polyline", {
8977
- points: "7 10 12 15 17 10"
8978
- }), /*#__PURE__*/React__default.createElement("line", {
8979
- x1: "12",
8980
- y1: "15",
8981
- x2: "12",
8982
- y2: "3"
8983
- })), ekycDownloadLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_EXCEL") || "Download Excel"))))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
8984
- className: "dashboard-card"
8985
- }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Table, {
8986
- t: t,
8987
- tableTitle: t("CONNECTED_SURVEYORS") || "Connected Surveyors",
8988
- tableClass: "ekycTable",
8989
- data: paginatedSurveyors,
8990
- columns: surveyorColumns,
8991
- isLoading: isProgressLoading,
8992
- totalRecords: surveyors.length,
8993
- currentPage: currentPage,
8994
- pageSizeLimit: pageSize,
8995
- isPaginationRequired: true,
8996
- onNextPage: () => {
8997
- if (currentPage < Math.ceil(surveyors.length / pageSize) - 1) {
8998
- setCurrentPage(prev => prev + 1);
8999
- }
9000
- },
9001
- onPrevPage: () => {
9002
- if (currentPage > 0) {
9003
- setCurrentPage(prev => prev - 1);
9004
- }
9005
- },
9006
- onFirstPage: () => {
9007
- setCurrentPage(0);
9008
- },
9009
- onLastPage: () => {
9010
- setCurrentPage(Math.max(Math.ceil(surveyors.length / pageSize) - 1, 0));
9443
+ };
9444
+ const propsForInboxTable = useInboxTableConfig(_extends({}, {
9445
+ parentRoute,
9446
+ onPageSizeChange,
9447
+ formState,
9448
+ totalCount: totalRecords,
9449
+ table: filteredData,
9450
+ dispatch,
9451
+ onSortingByData,
9452
+ tenantId,
9453
+ checkPathName,
9454
+ inboxStyles: {
9455
+ overflowX: "scroll",
9456
+ overflowY: "hidden"
9011
9457
  },
9012
- onPageSizeChange: e => {
9013
- setPageSize(Number(e.target.value));
9014
- setCurrentPage(0);
9458
+ tableStyle: {
9459
+ width: "70%"
9015
9460
  }
9461
+ }));
9462
+ const onMobileSortOrderData = data => {
9463
+ const sortOrder = data.sortOrder;
9464
+ dispatch({
9465
+ action: "mutateTableForm",
9466
+ data: _extends({}, formState.tableForm, {
9467
+ sortOrder
9468
+ })
9469
+ });
9470
+ };
9471
+ const onSortFormReset = setSortFormValue => {
9472
+ setSortFormValue("sortOrder", "DESC");
9473
+ dispatch({
9474
+ action: "mutateTableForm",
9475
+ data: tableOrderFormDefaultValues
9476
+ });
9477
+ };
9478
+ const propsForMobileSortForm = {
9479
+ onMobileSortOrderData,
9480
+ sortFormDefaultValues: formState === null || formState === void 0 ? void 0 : formState.tableForm,
9481
+ onSortFormReset
9482
+ };
9483
+ const propsForInboxMobileCards = useInboxMobileCardsData({
9484
+ table: filteredData,
9485
+ tenantId
9486
+ });
9487
+ const isInboxLoading = isLoading || isSearchLoading;
9488
+ return /*#__PURE__*/React__default.createElement("div", {
9489
+ className: "app-container"
9490
+ }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.InboxComposer, _extends({
9491
+ isInboxLoading
9492
+ }, propsForSearchForm, propsForMobileSortForm, {
9493
+ propsForInboxTable,
9494
+ propsForInboxMobileCards,
9495
+ formState
9016
9496
  })));
9017
9497
  };
9018
9498
 
@@ -9393,7 +9873,7 @@ const CitizenApp = () => {
9393
9873
  layoutClass: "normal"
9394
9874
  }, /*#__PURE__*/React__default.createElement(Home, null))
9395
9875
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
9396
- path: [path + "/vendor-dashboard/:vendorId", path + "/vendor-dashboard", path + "/dashboard"],
9876
+ path: [path + "/vendor-dashboard/:vendorId", path + "/vendor-dashboard"],
9397
9877
  component: () => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
9398
9878
  layoutClass: "normal"
9399
9879
  }, /*#__PURE__*/React__default.createElement(VendorDetailsCard, null))
@@ -9450,7 +9930,7 @@ const CitizenApp = () => {
9450
9930
  layoutClass: "normal"
9451
9931
  }, /*#__PURE__*/React__default.createElement(Review, null))
9452
9932
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
9453
- path: path + "/supervisor-dashboard",
9933
+ path: [path + "/supervisor-dashboard/:id", path + "/supervisor-dashboard"],
9454
9934
  component: () => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
9455
9935
  layoutClass: "normal"
9456
9936
  }, /*#__PURE__*/React__default.createElement(SupervisorDetailsCard, null))