@djb25/digit-ui-module-ekyc 1.0.31 → 1.0.32

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.
@@ -1859,7 +1859,7 @@ const useInboxTableConfig = _ref => {
1859
1859
  return dispatch({
1860
1860
  action: "mutateTableForm",
1861
1861
  data: _extends({}, formState.tableForm, {
1862
- offset: parseInt((_formState$tableForm3 = formState.tableForm) === null || _formState$tableForm3 === void 0 ? void 0 : _formState$tableForm3.offset) + 10
1862
+ offset: parseInt((_formState$tableForm3 = formState.tableForm) === null || _formState$tableForm3 === void 0 ? void 0 : _formState$tableForm3.offset) + limit
1863
1863
  }),
1864
1864
  checkPathName
1865
1865
  });
@@ -1869,7 +1869,7 @@ const useInboxTableConfig = _ref => {
1869
1869
  return dispatch({
1870
1870
  action: "mutateTableForm",
1871
1871
  data: _extends({}, formState.tableForm, {
1872
- offset: parseInt((_formState$tableForm4 = formState.tableForm) === null || _formState$tableForm4 === void 0 ? void 0 : _formState$tableForm4.offset) - 10
1872
+ offset: parseInt((_formState$tableForm4 = formState.tableForm) === null || _formState$tableForm4 === void 0 ? void 0 : _formState$tableForm4.offset) - limit
1873
1873
  }),
1874
1874
  checkPathName
1875
1875
  });
@@ -1881,7 +1881,7 @@ const useInboxTableConfig = _ref => {
1881
1881
  onLastPage: () => dispatch({
1882
1882
  action: "mutateTableForm",
1883
1883
  data: _extends({}, formState.tableForm, {
1884
- offset: Math.max(0, Math.ceil(totalCount / limit) - 10)
1884
+ offset: Math.max(0, Math.floor((totalCount - 1) / limit) * limit)
1885
1885
  }),
1886
1886
  checkPathName
1887
1887
  }),
@@ -3209,6 +3209,19 @@ function _catch(body, recover) {
3209
3209
  return result;
3210
3210
  }
3211
3211
 
3212
+ // Asynchronously await a promise and pass the result to a finally continuation
3213
+ function _finallyRethrows(body, finalizer) {
3214
+ try {
3215
+ var result = body();
3216
+ } catch (e) {
3217
+ return finalizer(true, e);
3218
+ }
3219
+ if (result && result.then) {
3220
+ return result.then(finalizer.bind(null, false), finalizer.bind(null, true));
3221
+ }
3222
+ return finalizer(false, result);
3223
+ }
3224
+
3212
3225
  const ActionButton = _ref => {
3213
3226
  let jumpTo = _ref.jumpTo,
3214
3227
  state = _ref.state;
@@ -3256,7 +3269,8 @@ const ReviewSection = _ref2 => {
3256
3269
  oldData = _ref2.oldData,
3257
3270
  t = _ref2.t,
3258
3271
  jumpTo = _ref2.jumpTo,
3259
- state = _ref2.state;
3272
+ state = _ref2.state,
3273
+ hideEditButton = _ref2.hideEditButton;
3260
3274
  return /*#__PURE__*/React.createElement("div", {
3261
3275
  className: "review-section-wrapper",
3262
3276
  style: {
@@ -3282,7 +3296,7 @@ const ReviewSection = _ref2 => {
3282
3296
  color: "#101828",
3283
3297
  fontWeight: "700"
3284
3298
  }
3285
- }, title), jumpTo && /*#__PURE__*/React.createElement(ActionButton, {
3299
+ }, title), jumpTo && !hideEditButton && /*#__PURE__*/React.createElement(ActionButton, {
3286
3300
  jumpTo: jumpTo,
3287
3301
  state: state
3288
3302
  })), /*#__PURE__*/React.createElement("div", {
@@ -3373,13 +3387,14 @@ const ReviewSection = _ref2 => {
3373
3387
  })))));
3374
3388
  };
3375
3389
  const Review = () => {
3376
- var _newDataRaw$connectio, _newDataRaw$connectio2, _newDataRaw$connectio3, _newDataRaw$address, _newDataRaw$address2, _newDataRaw$address3, _newDataRaw$address4, _newDataRaw$address5, _newDataRaw$address6, _newDataRaw$address7, _newDataRaw$address8, _newDataRaw$address9, _newDataRaw$address0, _newDataRaw$address1, _newDataRaw$address10, _newDataRaw$address11, _newDataRaw$address12, _newDataRaw$address13, _newDataRaw$address14, _newDataRaw$property, _newDataRaw$property2, _editedProperty$conne, _newDataRaw$property3, _editedProperty$conne2, _newDataRaw$property4, _editedProperty$userT, _newDataRaw$property5, _editedProperty$noOfF, _newDataRaw$property6, _newDataRaw$property7, _newDataRaw$meter, _editedMeter$meterSta, _newDataRaw$meter2, _newDataRaw$meter3, _newDataRaw$meter4, _newDataRaw$meter5, _editedMeter$workingS, _newDataRaw$meter6, _editedMeter$lastBill, _newDataRaw$meter7, _newDataRaw$meter8;
3390
+ var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _newDataRaw$connectio, _newDataRaw$connectio2, _newDataRaw$connectio3, _newDataRaw$address, _newDataRaw$address2, _newDataRaw$address3, _newDataRaw$address4, _newDataRaw$address5, _newDataRaw$address6, _newDataRaw$address7, _newDataRaw$address8, _newDataRaw$address9, _newDataRaw$address0, _newDataRaw$address1, _newDataRaw$address10, _newDataRaw$address11, _newDataRaw$address12, _newDataRaw$address13, _newDataRaw$address14, _newDataRaw$property, _newDataRaw$property2, _editedProperty$conne, _newDataRaw$property3, _editedProperty$conne2, _newDataRaw$property4, _editedProperty$userT, _newDataRaw$property5, _editedProperty$noOfF, _newDataRaw$property6, _newDataRaw$property7, _newDataRaw$meter, _editedMeter$meterSta, _newDataRaw$meter2, _newDataRaw$meter3, _newDataRaw$meter4, _newDataRaw$meter5, _editedMeter$workingS, _newDataRaw$meter6, _editedMeter$lastBill, _newDataRaw$meter7, _newDataRaw$meter8;
3377
3391
  const _useTranslation = useTranslation(),
3378
3392
  t = _useTranslation.t;
3379
3393
  const history = useHistory();
3380
3394
  const location = useLocation();
3381
3395
  let _useParams = useParams(),
3382
- kno = _useParams.kno;
3396
+ kno = _useParams.kno,
3397
+ applicationId = _useParams.applicationId;
3383
3398
  const _useState = useState(false),
3384
3399
  agree = _useState[0],
3385
3400
  setAgree = _useState[1];
@@ -3411,7 +3426,7 @@ const Review = () => {
3411
3426
  const flowState = location.state || {};
3412
3427
  const _flowState$edits = flowState.edits,
3413
3428
  edits = _flowState$edits === void 0 ? {} : _flowState$edits;
3414
- const activeKno = kno;
3429
+ const activeKno = kno || applicationId;
3415
3430
  const _edits$aadhaarData = edits.aadhaarData,
3416
3431
  aadhaarData = _edits$aadhaarData === void 0 ? {} : _edits$aadhaarData,
3417
3432
  _edits$addressDetails = edits.addressDetails,
@@ -3431,6 +3446,11 @@ const Review = () => {
3431
3446
  }),
3432
3447
  searchData = _Digit$Hooks$ekyc$use.data,
3433
3448
  isSearchLoading = _Digit$Hooks$ekyc$use.isLoading;
3449
+ const userRoles = ((_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : (_Digit$SessionStorage2 = _Digit$SessionStorage.info) === null || _Digit$SessionStorage2 === void 0 ? void 0 : (_Digit$SessionStorage3 = _Digit$SessionStorage2.roles) === null || _Digit$SessionStorage3 === void 0 ? void 0 : _Digit$SessionStorage3.map(ele => ele.code)) || [];
3450
+ const isZRO = userRoles.includes("EKYC_ZRO") || userRoles.includes("ZRO");
3451
+ const isSupervisorOrSurveyorOrVendor = userRoles.includes("EKYC_SUPERVISOR") || userRoles.includes("EKYC_SURVEYOR") || userRoles.includes("EKYC_VENDOR");
3452
+ const isStatusView = location.pathname.includes("/status/");
3453
+ const hideEditButton = isSupervisorOrSurveyorOrVendor && !isZRO || isStatusView;
3434
3454
  const _extractReviewData = extractReviewData(searchData, flowState),
3435
3455
  apiNewData = _extractReviewData.newData,
3436
3456
  apiOldData = _extractReviewData.oldData;
@@ -3776,52 +3796,56 @@ const Review = () => {
3776
3796
  newData: connectionData,
3777
3797
  oldData: oldDataRaw === null || oldDataRaw === void 0 ? void 0 : oldDataRaw.connection,
3778
3798
  t: t,
3779
- jumpTo: baseUrl + "/consumer-details?kno=" + kno,
3799
+ jumpTo: baseUrl + "/consumer-details?kno=" + activeKno,
3780
3800
  state: _extends({}, flowState, {
3781
- kNumber: kno,
3782
- kno,
3801
+ kNumber: activeKno,
3802
+ kno: activeKno,
3783
3803
  reviewData: searchData,
3784
3804
  edits
3785
- })
3805
+ }),
3806
+ hideEditButton: hideEditButton
3786
3807
  }), /*#__PURE__*/React.createElement(ReviewSection, {
3787
3808
  title: t("EKYC_ADDRESS_DETAILS"),
3788
3809
  fields: addressFields,
3789
3810
  newData: addressData,
3790
3811
  oldData: oldDataRaw === null || oldDataRaw === void 0 ? void 0 : oldDataRaw.address,
3791
3812
  t: t,
3792
- jumpTo: baseUrl + "/address-details?kno=" + kno,
3813
+ jumpTo: baseUrl + "/address-details?kno=" + activeKno,
3793
3814
  state: _extends({}, flowState, {
3794
- kNumber: kno,
3795
- kno,
3815
+ kNumber: activeKno,
3816
+ kno: activeKno,
3796
3817
  reviewData: searchData,
3797
3818
  edits
3798
- })
3819
+ }),
3820
+ hideEditButton: hideEditButton
3799
3821
  }), /*#__PURE__*/React.createElement(ReviewSection, {
3800
3822
  title: t("EKYC_PROPERTY_INFO"),
3801
3823
  fields: propertyFields,
3802
3824
  newData: propertyData,
3803
3825
  oldData: oldDataRaw === null || oldDataRaw === void 0 ? void 0 : oldDataRaw.property,
3804
3826
  t: t,
3805
- jumpTo: baseUrl + "/property-info?kno=" + kno,
3827
+ jumpTo: baseUrl + "/property-info?kno=" + activeKno,
3806
3828
  state: _extends({}, flowState, {
3807
- kNumber: kno,
3808
- kno,
3829
+ kNumber: activeKno,
3830
+ kno: activeKno,
3809
3831
  reviewData: searchData,
3810
3832
  edits
3811
- })
3833
+ }),
3834
+ hideEditButton: hideEditButton
3812
3835
  }), /*#__PURE__*/React.createElement(ReviewSection, {
3813
3836
  title: t("EKYC_METER_DETAILS"),
3814
3837
  fields: meterFields,
3815
3838
  newData: meterData,
3816
3839
  oldData: oldDataRaw === null || oldDataRaw === void 0 ? void 0 : oldDataRaw.meter,
3817
3840
  t: t,
3818
- jumpTo: baseUrl + "/meter-details?kno=" + kno,
3841
+ jumpTo: baseUrl + "/meter-details?kno=" + activeKno,
3819
3842
  state: _extends({}, flowState, {
3820
- kNumber: kno,
3821
- kno,
3843
+ kNumber: activeKno,
3844
+ kno: activeKno,
3822
3845
  reviewData: searchData,
3823
3846
  edits
3824
- })
3847
+ }),
3848
+ hideEditButton: hideEditButton
3825
3849
  }), /*#__PURE__*/React.createElement("div", {
3826
3850
  style: {
3827
3851
  marginTop: "40px"
@@ -3878,7 +3902,7 @@ const Review = () => {
3878
3902
  fill: "#F47738"
3879
3903
  }
3880
3904
  }))
3881
- }))), /*#__PURE__*/React.createElement("div", {
3905
+ }))), !hideEditButton && /*#__PURE__*/React.createElement("div", {
3882
3906
  style: {
3883
3907
  marginTop: "40px",
3884
3908
  paddingTop: "30px",
@@ -3895,7 +3919,7 @@ const Review = () => {
3895
3919
  }, t("EKYC_FINAL_DECLARATION")),
3896
3920
  onChange: handleDeclaration,
3897
3921
  checked: agree
3898
- })), /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
3922
+ })), !hideEditButton && /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
3899
3923
  label: t("TAKE_ACTION_FOR_APPROVE_REJECT"),
3900
3924
  onSubmit: () => setShowOptions(prev => !prev),
3901
3925
  disabled: !agree
@@ -4815,7 +4839,8 @@ const AssignEkycModal = _ref => {
4815
4839
  let surveyor = _ref.surveyor,
4816
4840
  closeModal = _ref.closeModal,
4817
4841
  refetchDashboard = _ref.refetchDashboard;
4818
- const _useTranslation = useTranslation();
4842
+ const _useTranslation = useTranslation(),
4843
+ t = _useTranslation.t;
4819
4844
  const _useState = useState([]),
4820
4845
  selectedKnos = _useState[0],
4821
4846
  setSelectedKnos = _useState[1];
@@ -4975,16 +5000,43 @@ const AssignEkycModal = _ref => {
4975
5000
  onSuccess: response => {
4976
5001
  if (response !== null && response !== void 0 && response.error) {
4977
5002
  var _response$data;
4978
- setToastData({
4979
- error: true,
4980
- label: (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.message) || "Something went wrong"
4981
- });
5003
+ const errMsg = (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.message) || "";
5004
+ const isMrKeyAlreadyAssigned = errMsg.toLowerCase().includes("already assigned") || errMsg.toLowerCase().includes("already assign") || errMsg.toLowerCase().includes("mrkey") || errMsg.toLowerCase().includes("mr key");
5005
+ if (isMrKeyAlreadyAssigned) {
5006
+ setToastData({
5007
+ error: true,
5008
+ label: t("EKYC_MR_KEY_ALREADY_ASSIGNED_WITH_ANOTHER_SURVEYOR") || "mr key is already assign with another surveyor"
5009
+ });
5010
+ } else {
5011
+ setToastData({
5012
+ error: true,
5013
+ label: t(errMsg) || errMsg || t("EKYC_SOMETHING_WENT_WRONG") || "Something went wrong"
5014
+ });
5015
+ }
5016
+ setShowToast(true);
5017
+ return;
5018
+ }
5019
+ if (response !== null && response !== void 0 && response.skipped && response.skipped.length > 0) {
5020
+ var _response$skipped$;
5021
+ const reason = ((_response$skipped$ = response.skipped[0]) === null || _response$skipped$ === void 0 ? void 0 : _response$skipped$.reason) || "";
5022
+ const isMrKeyAlreadyAssigned = reason.toLowerCase().includes("already exists") || reason.toLowerCase().includes("already assign") || reason.toLowerCase().includes("active assignment") || reason.toLowerCase().includes("mrkey") || reason.toLowerCase().includes("mr key");
5023
+ if (isMrKeyAlreadyAssigned) {
5024
+ setToastData({
5025
+ error: true,
5026
+ label: t("EKYC_MR_KEY_ALREADY_ASSIGNED_WITH_ANOTHER_SURVEYOR") || "mr key is already assign with another surveyor"
5027
+ });
5028
+ } else {
5029
+ setToastData({
5030
+ error: true,
5031
+ label: t(reason) || reason || t("EKYC_ASSIGNMENT_SKIPPED") || "Assignment skipped"
5032
+ });
5033
+ }
4982
5034
  setShowToast(true);
4983
5035
  return;
4984
5036
  }
4985
5037
  setToastData({
4986
5038
  error: false,
4987
- label: "Assignment successful"
5039
+ label: t("EKYC_ASSIGNMENT_SUCCESSFUL") || "Assignment successful"
4988
5040
  });
4989
5041
  setShowToast(true);
4990
5042
  setTimeout(function () {
@@ -4999,10 +5051,19 @@ const AssignEkycModal = _ref => {
4999
5051
  },
5000
5052
  onError: error => {
5001
5053
  var _error$data, _error$response, _error$response$data;
5002
- setToastData({
5003
- error: true,
5004
- label: (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) || "Something went wrong"
5005
- });
5054
+ 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) || "";
5055
+ const isMrKeyAlreadyAssigned = errMsg.toLowerCase().includes("already assigned") || errMsg.toLowerCase().includes("already assign") || errMsg.toLowerCase().includes("mrkey") || errMsg.toLowerCase().includes("mr key");
5056
+ if (isMrKeyAlreadyAssigned) {
5057
+ setToastData({
5058
+ error: true,
5059
+ label: t("EKYC_MR_KEY_ALREADY_ASSIGNED_WITH_ANOTHER_SURVEYOR") || "mr key is already assign with another surveyor"
5060
+ });
5061
+ } else {
5062
+ setToastData({
5063
+ error: true,
5064
+ label: t(errMsg) || errMsg || t("EKYC_SOMETHING_WENT_WRONG") || "Something went wrong"
5065
+ });
5066
+ }
5006
5067
  setShowToast(true);
5007
5068
  }
5008
5069
  });
@@ -5264,6 +5325,7 @@ const downloadSurveyorPDF = function (_ref) {
5264
5325
  hour12: false
5265
5326
  });
5266
5327
  const downloadDateTime = formattedDate + " " + formattedTime;
5328
+ const isValDefined = val => val !== undefined && val !== null && val !== "";
5267
5329
  const details = [{
5268
5330
  title: t("SURVEYOR_DETAILS"),
5269
5331
  asSectionHeader: true,
@@ -5279,7 +5341,7 @@ const downloadSurveyorPDF = function (_ref) {
5279
5341
  }, {
5280
5342
  title: t("SUPERVISOR_NAME"),
5281
5343
  value: supervisorName
5282
- }].filter(item => item.value)
5344
+ }].filter(item => isValDefined(item.value))
5283
5345
  }, {
5284
5346
  title: t("SUMMARY_STATISTICS"),
5285
5347
  asSectionHeader: true,
@@ -5295,7 +5357,7 @@ const downloadSurveyorPDF = function (_ref) {
5295
5357
  }, {
5296
5358
  title: t("SUBMITTED"),
5297
5359
  value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.submittedCount) || 0
5298
- }].filter(item => item.value)
5360
+ }].filter(item => isValDefined(item.value))
5299
5361
  }];
5300
5362
  if (window.Digit && window.Digit.Utils && window.Digit.Utils.pdf && window.Digit.Utils.pdf.generateSurveyorReport) {
5301
5363
  window.Digit.Utils.pdf.generateSurveyorReport({
@@ -5320,9 +5382,126 @@ const downloadSurveyorPDF = function (_ref) {
5320
5382
  return Promise.reject(e);
5321
5383
  }
5322
5384
  };
5385
+ const downloadSupervisorPDF = function (_ref2) {
5386
+ let rows = _ref2.rows,
5387
+ supervisorName = _ref2.supervisorName,
5388
+ mobileNumber = _ref2.mobileNumber,
5389
+ vendorName = _ref2.vendorName,
5390
+ dashboardInfo = _ref2.dashboardInfo,
5391
+ t = _ref2.t;
5392
+ try {
5393
+ const tenantId = Digit.ULBService.getCurrentTenantId();
5394
+ const name = "Delhi Jal Board";
5395
+ const email = "contact@delhijalboard.nic.in";
5396
+ const phoneNumber = "+91-11-23538416";
5397
+ const currentDate = new Date();
5398
+ const formattedDate = currentDate.toLocaleDateString("en-IN", {
5399
+ day: "2-digit",
5400
+ month: "2-digit",
5401
+ year: "numeric"
5402
+ });
5403
+ const formattedTime = currentDate.toLocaleTimeString("en-IN", {
5404
+ hour: "2-digit",
5405
+ minute: "2-digit",
5406
+ second: "2-digit",
5407
+ hour12: false
5408
+ });
5409
+ const downloadDateTime = formattedDate + " " + formattedTime;
5410
+ const isValDefined = val => val !== undefined && val !== null && val !== "";
5411
+ const details = [{
5412
+ title: t("SUPERVISOR_DETAILS") || "Supervisor Details",
5413
+ asSectionHeader: true,
5414
+ values: [{
5415
+ title: t("SUPERVISOR_NAME") || "Supervisor Name",
5416
+ value: supervisorName
5417
+ }, {
5418
+ title: t("MOBILE_NUMBER") || "Mobile Number",
5419
+ value: mobileNumber
5420
+ }, {
5421
+ title: t("VENDOR_NAME") || "Vendor Name",
5422
+ value: vendorName
5423
+ }].filter(item => isValDefined(item.value))
5424
+ }, {
5425
+ title: t("SUMMARY_STATISTICS") || "Summary Statistics",
5426
+ asSectionHeader: true,
5427
+ values: [{
5428
+ title: t("TOTAL_ASSIGNED") || "Total Assigned",
5429
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.total) || 0
5430
+ }, {
5431
+ title: t("COMPLETED") || "Completed",
5432
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.completed) || 0
5433
+ }, {
5434
+ title: t("PENDING") || "Pending",
5435
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.pending) || 0
5436
+ }, {
5437
+ title: t("SUBMITTED") || "Submitted",
5438
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.submittedCount) || 0
5439
+ }].filter(item => isValDefined(item.value))
5440
+ }];
5441
+ const mappedRows = rows.map(row => {
5442
+ var _row$owner, _row$owner2;
5443
+ return {
5444
+ kno: row.name || ((_row$owner = row.owner) === null || _row$owner === void 0 ? void 0 : _row$owner.name) || "N/A",
5445
+ firstName: ((_row$owner2 = row.owner) === null || _row$owner2 === void 0 ? void 0 : _row$owner2.mobileNumber) || row.mobileNo || "N/A",
5446
+ lastName: "",
5447
+ mobileNo: row.status || "N/A",
5448
+ zoneName: String(row.total || 0),
5449
+ ekycStatus: (row.completed || 0) + " / " + (row.pending || 0),
5450
+ submittedAt: 1717171717171,
5451
+ progress: row.progress || "0%"
5452
+ };
5453
+ });
5454
+ const originalToLocaleDateString = Date.prototype.toLocaleDateString;
5455
+ let progressIndex = 0;
5456
+ Date.prototype.toLocaleDateString = function () {
5457
+ if (progressIndex < mappedRows.length) {
5458
+ return mappedRows[progressIndex++].progress || "0%";
5459
+ }
5460
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5461
+ args[_key] = arguments[_key];
5462
+ }
5463
+ return originalToLocaleDateString.apply(this, args);
5464
+ };
5465
+ const customT = key => {
5466
+ if (key === "KNO") return t("SURVEYOR_NAME") || "Surveyor Name";
5467
+ if (key === "CONSUMER") return t("MOBILE_NUMBER") || "Mobile Number";
5468
+ if (key === "MOBILE") return t("STATUS") || "Status";
5469
+ if (key === "ZONE") return t("TOTAL_EKYC_APPLICATIONS") || "Total eKYC Applications";
5470
+ if (key === "EKYC_STATUS") return t("COMPLETED_PENDING") || "Completed / Pending";
5471
+ if (key === "SUBMITTED_DATE") return t("OVERALL_PROGRESS") || "Overall Progress";
5472
+ if (key === "CONSUMER_LIST") return t("CONNECTED_SURVEYORS") || "Connected Surveyors";
5473
+ return t(key);
5474
+ };
5475
+ try {
5476
+ if (window.Digit && window.Digit.Utils && window.Digit.Utils.pdf && window.Digit.Utils.pdf.generateSurveyorReport) {
5477
+ window.Digit.Utils.pdf.generateSurveyorReport({
5478
+ tenantId,
5479
+ logo: null,
5480
+ name,
5481
+ email,
5482
+ phoneNumber,
5483
+ heading: t("EKYC_SUPERVISOR_REPORT") || "eKYC Supervisor Report",
5484
+ details,
5485
+ applicationNumber: mobileNumber,
5486
+ rows: mappedRows,
5487
+ t: customT,
5488
+ hideApplicationNumber: true,
5489
+ downloadTime: downloadDateTime
5490
+ });
5491
+ } else {
5492
+ console.error("Digit.Utils.pdf.generateSurveyorReport is not available");
5493
+ }
5494
+ } finally {
5495
+ Date.prototype.toLocaleDateString = originalToLocaleDateString;
5496
+ }
5497
+ return Promise.resolve();
5498
+ } catch (e) {
5499
+ return Promise.reject(e);
5500
+ }
5501
+ };
5323
5502
 
5324
5503
  const SurveyorDetailsDashboard = () => {
5325
- var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _Digit$SessionStorage4, _surveyor$owner, _surveyor$owner2, _surveyor$owner3, _surveyor$owner4, _fullName$charAt, _dashboardData$dashbo3, _dashboardData$dashbo4, _dashboardData$dashbo5, _dashboardData$dashbo6, _surveyor$owner5, _surveyor$owner6, _surveyor$owner7, _surveyor$additionalD, _dashboardData$dashbo7, _dashboardData$dashbo8;
5504
+ var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _Digit$SessionStorage4, _surveyor$owner, _surveyor$owner2, _surveyor$owner3, _surveyor$owner4, _fullName$charAt, _dashboardData$dashbo, _dashboardData$dashbo2, _dashboardData$dashbo3, _dashboardData$dashbo4, _surveyor$owner7, _surveyor$owner8, _surveyor$owner9, _surveyor$additionalD, _dashboardData$dashbo5, _dashboardData$dashbo6;
5326
5505
  const tenantId = Digit.ULBService.getCurrentTenantId();
5327
5506
  const _useState = useState(false),
5328
5507
  showModal = _useState[0],
@@ -5364,22 +5543,24 @@ const SurveyorDetailsDashboard = () => {
5364
5543
  supervisorSearchResponse = _Digit$Hooks$fsm$useS2.data;
5365
5544
  const vendorName = useMemo(() => {
5366
5545
  var _mappedVendor$dsoDeta;
5546
+ if (surveyor !== null && surveyor !== void 0 && surveyor.vendorName) return surveyor.vendorName;
5367
5547
  if (!vendorData || !(surveyor !== null && surveyor !== void 0 && surveyor.vendorId)) return "N/A";
5368
5548
  const mappedVendor = vendorData.find(v => {
5369
5549
  var _v$dsoDetails, _v$dsoDetails2;
5370
5550
  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;
5371
5551
  });
5372
5552
  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";
5373
- }, [vendorData, surveyor === null || surveyor === void 0 ? void 0 : surveyor.vendorId]);
5553
+ }, [vendorData, surveyor === null || surveyor === void 0 ? void 0 : surveyor.vendorId, surveyor === null || surveyor === void 0 ? void 0 : surveyor.vendorName]);
5374
5554
  const supervisorName = useMemo(() => {
5375
5555
  var _mappedSupervisor$own;
5556
+ if (surveyor !== null && surveyor !== void 0 && surveyor.supervisorName) return surveyor.supervisorName;
5376
5557
  if (!(supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors) || !(surveyor !== null && surveyor !== void 0 && surveyor.supervisorId)) return "N/A";
5377
5558
  const mappedSupervisor = supervisorSearchResponse.supervisors.find(s => {
5378
5559
  var _s$owner;
5379
5560
  return s.id === surveyor.supervisorId || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : _s$owner.uuid) === surveyor.supervisorId;
5380
5561
  });
5381
5562
  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";
5382
- }, [supervisorSearchResponse, surveyor === null || surveyor === void 0 ? void 0 : surveyor.supervisorId]);
5563
+ }, [supervisorSearchResponse, surveyor === null || surveyor === void 0 ? void 0 : surveyor.supervisorId, surveyor === null || surveyor === void 0 ? void 0 : surveyor.supervisorName]);
5383
5564
  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";
5384
5565
  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);
5385
5566
  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";
@@ -5413,9 +5594,6 @@ const SurveyorDetailsDashboard = () => {
5413
5594
  }, {
5414
5595
  Header: "Zone",
5415
5596
  accessor: "zoneName"
5416
- }, {
5417
- Header: "Pincode",
5418
- accessor: "pincode"
5419
5597
  }, {
5420
5598
  Header: "Status",
5421
5599
  accessor: "status",
@@ -5445,6 +5623,9 @@ const SurveyorDetailsDashboard = () => {
5445
5623
  const _useState7 = useState(false),
5446
5624
  showCustomPicker = _useState7[0],
5447
5625
  setShowCustomPicker = _useState7[1];
5626
+ const _useState8 = useState(false),
5627
+ reportLoading = _useState8[0],
5628
+ setReportLoading = _useState8[1];
5448
5629
  const reportMenuRef = useRef(null);
5449
5630
  useEffect(() => {
5450
5631
  const handler = e => {
@@ -5494,54 +5675,99 @@ const SurveyorDetailsDashboard = () => {
5494
5675
  }
5495
5676
  return null;
5496
5677
  };
5497
- const handlePresetDownload = filter => {
5498
- var _dashboardData$dashbo;
5499
- const allRows = (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.consumerList) || [];
5500
- const range = getDateRange(filter);
5501
- if (!range) return;
5502
- const filtered = allRows.filter(r => {
5503
- const ts = r.submittedAt || r.createdTime || r.lastModifiedTime || 0;
5504
- return ts >= range.from.getTime() && ts <= range.to.getTime();
5505
- });
5506
- downloadSurveyorPDF({
5507
- rows: filtered.length ? filtered : allRows,
5508
- surveyorName: fullName,
5509
- vendorName,
5510
- supervisorName,
5511
- employeeId,
5512
- mobileNumber,
5513
- dashboardInfo: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
5514
- t
5515
- });
5516
- setShowReportMenu(false);
5517
- setShowCustomPicker(false);
5678
+ const handlePresetDownload = function (filter) {
5679
+ try {
5680
+ const range = getDateRange(filter);
5681
+ if (!range) return Promise.resolve();
5682
+ setReportLoading(true);
5683
+ const _temp = _finallyRethrows(function () {
5684
+ return _catch(function () {
5685
+ var _surveyor$owner5;
5686
+ return Promise.resolve(Digit.EkycService.dashboard({}, {
5687
+ tenantId: "dl.djb",
5688
+ offset: 0,
5689
+ limit: 1000,
5690
+ surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner5 = surveyor.owner) === null || _surveyor$owner5 === void 0 ? void 0 : _surveyor$owner5.uuid,
5691
+ fromDate: range.from.getTime(),
5692
+ toDate: range.to.getTime()
5693
+ })).then(function (response) {
5694
+ var _response$dashboardIn;
5695
+ const rows = (response === null || response === void 0 ? void 0 : (_response$dashboardIn = response.dashboardInfo) === null || _response$dashboardIn === void 0 ? void 0 : _response$dashboardIn.consumerList) || [];
5696
+ downloadSurveyorPDF({
5697
+ rows: rows,
5698
+ surveyorName: fullName,
5699
+ vendorName,
5700
+ supervisorName,
5701
+ employeeId,
5702
+ mobileNumber,
5703
+ dashboardInfo: (response === null || response === void 0 ? void 0 : response.dashboardInfo) || {},
5704
+ t
5705
+ });
5706
+ });
5707
+ }, function (err) {
5708
+ console.error("Failed to fetch dashboard data for report download:", err);
5709
+ });
5710
+ }, function (_wasThrown, _result) {
5711
+ setReportLoading(false);
5712
+ setShowReportMenu(false);
5713
+ setShowCustomPicker(false);
5714
+ if (_wasThrown) throw _result;
5715
+ return _result;
5716
+ });
5717
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
5718
+ } catch (e) {
5719
+ return Promise.reject(e);
5720
+ }
5518
5721
  };
5519
- const handleCustomDownload = () => {
5520
- var _dashboardData$dashbo2;
5521
- if (!customDate.from || !customDate.to) {
5522
- alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
5523
- return;
5722
+ const handleCustomDownload = function () {
5723
+ try {
5724
+ if (!customDate.from || !customDate.to) {
5725
+ alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
5726
+ return Promise.resolve();
5727
+ }
5728
+ const from = new Date(customDate.from);
5729
+ from.setHours(0, 0, 0, 0);
5730
+ const to = new Date(customDate.to);
5731
+ to.setHours(23, 59, 59, 999);
5732
+ setReportLoading(true);
5733
+ const _temp2 = _finallyRethrows(function () {
5734
+ return _catch(function () {
5735
+ var _surveyor$owner6;
5736
+ return Promise.resolve(Digit.EkycService.dashboard({}, {
5737
+ tenantId: "dl.djb",
5738
+ offset: 0,
5739
+ limit: 1000,
5740
+ surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner6 = surveyor.owner) === null || _surveyor$owner6 === void 0 ? void 0 : _surveyor$owner6.uuid,
5741
+ fromDate: from.getTime(),
5742
+ toDate: to.getTime()
5743
+ })).then(function (response) {
5744
+ var _response$dashboardIn2;
5745
+ const rows = (response === null || response === void 0 ? void 0 : (_response$dashboardIn2 = response.dashboardInfo) === null || _response$dashboardIn2 === void 0 ? void 0 : _response$dashboardIn2.consumerList) || [];
5746
+ downloadSurveyorPDF({
5747
+ rows: rows,
5748
+ surveyorName: fullName,
5749
+ vendorName,
5750
+ supervisorName,
5751
+ employeeId,
5752
+ mobileNumber,
5753
+ dashboardInfo: (response === null || response === void 0 ? void 0 : response.dashboardInfo) || {},
5754
+ t
5755
+ });
5756
+ });
5757
+ }, function (err) {
5758
+ console.error("Failed to fetch custom dashboard data for report download:", err);
5759
+ });
5760
+ }, function (_wasThrown2, _result2) {
5761
+ setReportLoading(false);
5762
+ setShowReportMenu(false);
5763
+ setShowCustomPicker(false);
5764
+ if (_wasThrown2) throw _result2;
5765
+ return _result2;
5766
+ });
5767
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
5768
+ } catch (e) {
5769
+ return Promise.reject(e);
5524
5770
  }
5525
- const from = new Date(customDate.from);
5526
- const to = new Date(customDate.to);
5527
- to.setHours(23, 59, 59, 999);
5528
- const allRows = (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo2 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo2 === void 0 ? void 0 : _dashboardData$dashbo2.consumerList) || [];
5529
- const filtered = allRows.filter(r => {
5530
- const ts = r.createdTime || r.lastModifiedTime || 0;
5531
- return ts >= from.getTime() && ts <= to.getTime();
5532
- });
5533
- downloadSurveyorPDF({
5534
- rows: filtered.length ? filtered : allRows,
5535
- surveyorName: fullName,
5536
- vendorName,
5537
- supervisorName,
5538
- employeeId,
5539
- mobileNumber,
5540
- dashboardInfo: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
5541
- t
5542
- });
5543
- setShowReportMenu(false);
5544
- setShowCustomPicker(false);
5545
5771
  };
5546
5772
  const StatCard = _ref3 => {
5547
5773
  let title = _ref3.title,
@@ -5594,11 +5820,12 @@ const SurveyorDetailsDashboard = () => {
5594
5820
  ref: reportMenuRef
5595
5821
  }, /*#__PURE__*/React.createElement("button", {
5596
5822
  className: "download-btn",
5823
+ disabled: reportLoading,
5597
5824
  onClick: () => {
5598
5825
  setShowReportMenu(p => !p);
5599
5826
  setShowCustomPicker(false);
5600
5827
  }
5601
- }, t("DOWNLOAD_REPORT") || "Download Report"), showReportMenu && /*#__PURE__*/React.createElement("div", {
5828
+ }, reportLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_REPORT") || "Download Report"), showReportMenu && /*#__PURE__*/React.createElement("div", {
5602
5829
  className: "report-menu"
5603
5830
  }, [{
5604
5831
  label: t("TODAY") || "Today",
@@ -5651,22 +5878,22 @@ const SurveyorDetailsDashboard = () => {
5651
5878
  className: "stats-wrapper"
5652
5879
  }, /*#__PURE__*/React.createElement(StatCard, {
5653
5880
  title: t("TOTAL_ASSIGNED"),
5654
- value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo3 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo3 === void 0 ? void 0 : _dashboardData$dashbo3.total) || 0,
5881
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.total) || 0,
5655
5882
  type: "today",
5656
5883
  isLoading: isDashboardLoading
5657
5884
  }), /*#__PURE__*/React.createElement(StatCard, {
5658
5885
  title: t("COMPLETED"),
5659
- value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo4 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo4 === void 0 ? void 0 : _dashboardData$dashbo4.completed) || 0,
5886
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo2 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo2 === void 0 ? void 0 : _dashboardData$dashbo2.completed) || 0,
5660
5887
  type: "week",
5661
5888
  isLoading: isDashboardLoading
5662
5889
  }), /*#__PURE__*/React.createElement(StatCard, {
5663
5890
  title: t("PENDING"),
5664
- value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo5 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo5 === void 0 ? void 0 : _dashboardData$dashbo5.pending) || 0,
5891
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo3 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo3 === void 0 ? void 0 : _dashboardData$dashbo3.pending) || 0,
5665
5892
  type: "pending",
5666
5893
  isLoading: isDashboardLoading
5667
5894
  }), /*#__PURE__*/React.createElement(StatCard, {
5668
5895
  title: t("SUBMITTED"),
5669
- value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo6 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo6 === void 0 ? void 0 : _dashboardData$dashbo6.submittedCount) || 0,
5896
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo4 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo4 === void 0 ? void 0 : _dashboardData$dashbo4.submittedCount) || 0,
5670
5897
  type: "month",
5671
5898
  isLoading: isDashboardLoading
5672
5899
  })), /*#__PURE__*/React.createElement("div", {
@@ -5681,19 +5908,19 @@ const SurveyorDetailsDashboard = () => {
5681
5908
  className: "label"
5682
5909
  }, t("MOBILE"), ":"), /*#__PURE__*/React.createElement("span", {
5683
5910
  className: "value"
5684
- }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner5 = surveyor.owner) === null || _surveyor$owner5 === void 0 ? void 0 : _surveyor$owner5.mobileNumber) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.mobileNo) || "N/A")), /*#__PURE__*/React.createElement("div", {
5911
+ }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner7 = surveyor.owner) === null || _surveyor$owner7 === void 0 ? void 0 : _surveyor$owner7.mobileNumber) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.mobileNo) || "N/A")), /*#__PURE__*/React.createElement("div", {
5685
5912
  className: "detail-item"
5686
5913
  }, /*#__PURE__*/React.createElement("span", {
5687
5914
  className: "label"
5688
5915
  }, t("EMAIL"), ":"), /*#__PURE__*/React.createElement("span", {
5689
5916
  className: "value"
5690
- }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner6 = surveyor.owner) === null || _surveyor$owner6 === void 0 ? void 0 : _surveyor$owner6.emailId) || "N/A")), /*#__PURE__*/React.createElement("div", {
5917
+ }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner8 = surveyor.owner) === null || _surveyor$owner8 === void 0 ? void 0 : _surveyor$owner8.emailId) || "N/A")), /*#__PURE__*/React.createElement("div", {
5691
5918
  className: "detail-item"
5692
5919
  }, /*#__PURE__*/React.createElement("span", {
5693
5920
  className: "label"
5694
5921
  }, t("GENDER"), ":"), /*#__PURE__*/React.createElement("span", {
5695
5922
  className: "value"
5696
- }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner7 = surveyor.owner) === null || _surveyor$owner7 === void 0 ? void 0 : _surveyor$owner7.gender) || "N/A")), /*#__PURE__*/React.createElement("div", {
5923
+ }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner9 = surveyor.owner) === null || _surveyor$owner9 === void 0 ? void 0 : _surveyor$owner9.gender) || "N/A")), /*#__PURE__*/React.createElement("div", {
5697
5924
  className: "detail-item"
5698
5925
  }, /*#__PURE__*/React.createElement("span", {
5699
5926
  className: "label"
@@ -5711,22 +5938,28 @@ const SurveyorDetailsDashboard = () => {
5711
5938
  className: "label"
5712
5939
  }, t("VENDOR_NAME") || "Vendor Name", ":"), /*#__PURE__*/React.createElement("span", {
5713
5940
  className: "value"
5714
- }, vendorName)))), /*#__PURE__*/React.createElement(Card, {
5941
+ }, vendorName)), /*#__PURE__*/React.createElement("div", {
5942
+ className: "detail-item"
5943
+ }, /*#__PURE__*/React.createElement("span", {
5944
+ className: "label"
5945
+ }, t("SUPERVISOR_NAME") || "Supervisor Name", ":"), /*#__PURE__*/React.createElement("span", {
5946
+ className: "value"
5947
+ }, supervisorName)))), /*#__PURE__*/React.createElement(Card, {
5715
5948
  className: "dashboard-card"
5716
5949
  }, /*#__PURE__*/React.createElement(Table, {
5717
5950
  t: t,
5718
5951
  tableTitle: t("ASSIGNED_KNOS"),
5719
5952
  tableClass: "ekycTable",
5720
- data: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo7 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo7 === void 0 ? void 0 : _dashboardData$dashbo7.consumerList) || [],
5953
+ data: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo5 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo5 === void 0 ? void 0 : _dashboardData$dashbo5.consumerList) || [],
5721
5954
  columns: knoColumns,
5722
5955
  isLoading: isDashboardLoading,
5723
- totalRecords: dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo8 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo8 === void 0 ? void 0 : _dashboardData$dashbo8.total,
5956
+ totalRecords: dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo6 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo6 === void 0 ? void 0 : _dashboardData$dashbo6.total,
5724
5957
  currentPage: currentPage,
5725
5958
  pageSizeLimit: pageSize,
5726
5959
  isPaginationRequired: true,
5727
5960
  onNextPage: () => {
5728
- var _dashboardData$dashbo9;
5729
- if (currentPage < ((dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo9 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo9 === void 0 ? void 0 : _dashboardData$dashbo9.totalPages) || 1) - 1) {
5961
+ var _dashboardData$dashbo7;
5962
+ 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) {
5730
5963
  setCurrentPage(prev => prev + 1);
5731
5964
  }
5732
5965
  },
@@ -5739,8 +5972,8 @@ const SurveyorDetailsDashboard = () => {
5739
5972
  setCurrentPage(0);
5740
5973
  },
5741
5974
  onLastPage: () => {
5742
- var _dashboardData$dashbo0;
5743
- setCurrentPage(Math.max(((dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo0 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo0 === void 0 ? void 0 : _dashboardData$dashbo0.totalPages) || 1) - 1, 0));
5975
+ var _dashboardData$dashbo8;
5976
+ 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));
5744
5977
  },
5745
5978
  onPageSizeChange: e => {
5746
5979
  setPageSize(Number(e.target.value));
@@ -7314,6 +7547,12 @@ const Home = () => {
7314
7547
  link: "/digit-ui/citizen/ekyc/assign"
7315
7548
  });
7316
7549
  }
7550
+ if (roles.includes("EKYC_SUPERVISOR")) {
7551
+ propsForModuleCard.links.push({
7552
+ label: t("EKYC_SUPERVISOR_DASHBOARD"),
7553
+ link: "/digit-ui/citizen/ekyc/supervisor-dashboard"
7554
+ });
7555
+ }
7317
7556
  if (roles.length === 1 && roles.includes("CITIZEN")) {
7318
7557
  propsForModuleCard.links.push({
7319
7558
  label: t("EKYC_STATUS"),
@@ -7334,7 +7573,7 @@ const Inbox$1 = _ref => {
7334
7573
  filterForm: {},
7335
7574
  searchForm: {},
7336
7575
  tableForm: {
7337
- limit: 10,
7576
+ limit: 20,
7338
7577
  offset: 0,
7339
7578
  sortBy: "createdTime",
7340
7579
  sortOrder: "DESC"
@@ -7348,7 +7587,7 @@ const Inbox$1 = _ref => {
7348
7587
  return {
7349
7588
  tenantId,
7350
7589
  offset: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.offset) || 0,
7351
- limit: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.limit) || 10,
7590
+ limit: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.limit) || 20,
7352
7591
  search: (formState === null || formState === void 0 ? void 0 : formState.searchForm) || {}
7353
7592
  };
7354
7593
  }, [tenantId, formState === null || formState === void 0 ? void 0 : (_formState$tableForm3 = formState.tableForm) === null || _formState$tableForm3 === void 0 ? void 0 : _formState$tableForm3.offset, formState === null || formState === void 0 ? void 0 : (_formState$tableForm4 = formState.tableForm) === null || _formState$tableForm4 === void 0 ? void 0 : _formState$tableForm4.limit, formState === null || formState === void 0 ? void 0 : formState.searchForm]);
@@ -7394,24 +7633,27 @@ const Inbox$1 = _ref => {
7394
7633
  var _item$sla;
7395
7634
  const isSearchItem = !!item.connectionDetails;
7396
7635
  if (isSearchItem) {
7397
- var _item$propertyInfo, _item$propertyInfo2, _item$connectionDetai, _item$propertyInfo3, _item$connectionDetai2, _item$connectionDetai3, _item$connectionDetai4, _item$connectionDetai5;
7636
+ var _item$propertyInfo, _item$propertyInfo2, _item$propertyInfo3, _item$connectionDetai, _item$connectionDetai2, _item$connectionDetai3;
7637
+ const searchDetails = item.connectionDetails || {};
7638
+ const fullName = searchDetails.firstName || searchDetails.middleName || searchDetails.lastName ? ((searchDetails.firstName || "") + " " + (searchDetails.middleName || "") + " " + (searchDetails.lastName || "")).trim().replace(/\s+/g, " ") : searchDetails.consumerName || "";
7398
7639
  return {
7399
7640
  applicationNo: ((_item$propertyInfo = item.propertyInfo) === null || _item$propertyInfo === void 0 ? void 0 : _item$propertyInfo.kno) || "",
7400
7641
  connectionNo: ((_item$propertyInfo2 = item.propertyInfo) === null || _item$propertyInfo2 === void 0 ? void 0 : _item$propertyInfo2.kno) || "",
7401
- owner: ((_item$connectionDetai = item.connectionDetails) === null || _item$connectionDetai === void 0 ? void 0 : _item$connectionDetai.consumerName) || "",
7642
+ owner: fullName,
7402
7643
  applicationNumber: ((_item$propertyInfo3 = item.propertyInfo) === null || _item$propertyInfo3 === void 0 ? void 0 : _item$propertyInfo3.kno) || "",
7403
- citizenName: ((_item$connectionDetai2 = item.connectionDetails) === null || _item$connectionDetai2 === void 0 ? void 0 : _item$connectionDetai2.consumerName) || "",
7404
- status: ((_item$connectionDetai3 = item.connectionDetails) === null || _item$connectionDetai3 === void 0 ? void 0 : _item$connectionDetai3.statusflag) || "",
7405
- ekycStatus: (((_item$connectionDetai4 = item.connectionDetails) === null || _item$connectionDetai4 === void 0 ? void 0 : _item$connectionDetai4.ekycStatus) || ((_item$connectionDetai5 = item.connectionDetails) === null || _item$connectionDetai5 === void 0 ? void 0 : _item$connectionDetai5.ekycstatus) || item.ekycStatus || item.ekycstatus || "NA").toUpperCase(),
7644
+ citizenName: fullName,
7645
+ status: ((_item$connectionDetai = item.connectionDetails) === null || _item$connectionDetai === void 0 ? void 0 : _item$connectionDetai.statusflag) || "",
7646
+ ekycStatus: (((_item$connectionDetai2 = item.connectionDetails) === null || _item$connectionDetai2 === void 0 ? void 0 : _item$connectionDetai2.ekycStatus) || ((_item$connectionDetai3 = item.connectionDetails) === null || _item$connectionDetai3 === void 0 ? void 0 : _item$connectionDetai3.ekycstatus) || item.ekycStatus || item.ekycstatus || "NA").toUpperCase(),
7406
7647
  sla: 0
7407
7648
  };
7408
7649
  }
7650
+ const fullName = item.firstName || item.middleName || item.lastName ? ((item.firstName || "") + " " + (item.middleName || "") + " " + (item.lastName || "")).trim().replace(/\s+/g, " ") : item.consumerName || item.citizenName || "";
7409
7651
  return _extends({}, item, {
7410
7652
  applicationNo: item.kno || item.applicationNumber || "",
7411
7653
  connectionNo: item.connectionNo || "",
7412
- owner: item.consumerName || item.citizenName || "",
7654
+ owner: fullName,
7413
7655
  applicationNumber: item.kno || item.applicationNumber || "",
7414
- citizenName: item.consumerName || item.citizenName || "",
7656
+ citizenName: fullName,
7415
7657
  status: item.status || "",
7416
7658
  ekycStatus: (item.ekycStatus || item.ekycstatus || "NA").toUpperCase(),
7417
7659
  sla: (_item$sla = item.sla) != null ? _item$sla : 0
@@ -7434,7 +7676,7 @@ const Inbox$1 = _ref => {
7434
7676
  }, []);
7435
7677
  const tableOrderFormDefaultValues = {
7436
7678
  sortBy: "createdTime",
7437
- limit: window.Digit.Utils.browser.isMobile() ? 50 : 10,
7679
+ limit: window.Digit.Utils.browser.isMobile() ? 50 : 20,
7438
7680
  offset: 0,
7439
7681
  sortOrder: "DESC"
7440
7682
  };
@@ -7560,61 +7802,927 @@ const Inbox$1 = _ref => {
7560
7802
  })));
7561
7803
  };
7562
7804
 
7563
- const CitizenApp = () => {
7805
+ const SurveyorStatsCell = _ref => {
7806
+ let surveyorId = _ref.surveyorId,
7807
+ type = _ref.type;
7808
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycSurveyorDashboard({}, {
7809
+ tenantId: "dl.djb",
7810
+ offset: 0,
7811
+ limit: 1,
7812
+ surveyorId: surveyorId
7813
+ }, {
7814
+ enabled: !!surveyorId,
7815
+ staleTime: 60000
7816
+ }),
7817
+ data = _Digit$Hooks$ekyc$use.data,
7818
+ isLoading = _Digit$Hooks$ekyc$use.isLoading;
7819
+ if (isLoading) return "...";
7820
+ const dashboardInfo = (data === null || data === void 0 ? void 0 : data.dashboardInfo) || {};
7821
+ const total = (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.total) || 0;
7822
+ const completed = (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.completed) || 0;
7823
+ const pending = (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.pending) || 0;
7824
+ const progress = total > 0 ? Math.round(completed / total * 100) + "%" : "0%";
7825
+ if (type === "total") return total;
7826
+ if (type === "completed") return completed;
7827
+ if (type === "pending") return pending;
7828
+ if (type === "progress") return progress;
7829
+ return null;
7830
+ };
7831
+ const SupervisorDetailsCard = () => {
7832
+ var _Digit$SessionStorage, _Digit$SessionStorage2, _supervisor$owner, _supervisor$owner3, _fullName$charAt, _supervisor$owner6, _supervisor$owner7, _supervisor$owner8, _supervisor$additiona;
7564
7833
  const _useTranslation = useTranslation(),
7565
7834
  t = _useTranslation.t;
7566
- const location = useLocation();
7567
- const _useRouteMatch = useRouteMatch(),
7568
- path = _useRouteMatch.path;
7569
- sessionStorage.removeItem("revalidateddone");
7570
- const getDynamicBreadcrumbs = () => {
7571
- const pathname = location.pathname;
7572
- const crumbs = [{
7573
- icon: HomeIcon,
7574
- path: "/digit-ui/citizen"
7835
+ const tenantId = Digit.ULBService.getCurrentTenantId() || "dl.djb";
7836
+ const _useParams = useParams(),
7837
+ supervisorId = _useParams.id;
7838
+ 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;
7839
+ const searchParams = supervisorId ? {
7840
+ ids: supervisorId
7841
+ } : {
7842
+ ownerIds
7843
+ };
7844
+ const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorSearch(tenantId, searchParams, {
7845
+ staleTime: Infinity
7846
+ }),
7847
+ supervisorSearchResponse = _Digit$Hooks$fsm$useS.data,
7848
+ isSupervisorSearchLoading = _Digit$Hooks$fsm$useS.isLoading;
7849
+ const supervisor = useMemo(() => {
7850
+ var _supervisorSearchResp;
7851
+ return (supervisorSearchResponse === null || supervisorSearchResponse === void 0 ? void 0 : (_supervisorSearchResp = supervisorSearchResponse.supervisors) === null || _supervisorSearchResp === void 0 ? void 0 : _supervisorSearchResp[0]) || null;
7852
+ }, [supervisorSearchResponse]);
7853
+ const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
7854
+ status: "ACTIVE"
7575
7855
  }, {
7576
- label: t("EKYC_MODULE_NAME"),
7577
- path: "/digit-ui/citizen/ekyc"
7578
- }];
7579
- if (pathname.includes("/create-kyc")) {
7580
- crumbs.push({
7581
- label: t("EKYC_CREATE_KYC")
7582
- });
7583
- } else if (pathname.includes("/aadhaar-verification")) {
7584
- crumbs.push({
7585
- label: t("EKYC_AADHAAR_VERIFICATION")
7586
- });
7587
- } else if (pathname.includes("/address-details")) {
7588
- crumbs.push({
7589
- label: t("EKYC_ADDRESS_DETAILS")
7590
- });
7591
- } else if (pathname.includes("/property-info")) {
7592
- crumbs.push({
7593
- label: t("EKYC_PROPERTY_INFO")
7594
- });
7595
- } else if (pathname.includes("/meter-details")) {
7596
- crumbs.push({
7597
- label: t("EKYC_METER_DETAILS")
7856
+ enabled: !!tenantId
7857
+ }),
7858
+ vendorData = _Digit$Hooks$fsm$useD.data;
7859
+ const vendorName = useMemo(() => {
7860
+ var _mappedVendor$dsoDeta;
7861
+ if (!vendorData || !(supervisor !== null && supervisor !== void 0 && supervisor.vendorId)) return "N/A";
7862
+ const mappedVendor = vendorData.find(v => {
7863
+ var _v$dsoDetails, _v$dsoDetails2;
7864
+ return ((_v$dsoDetails = v.dsoDetails) === null || _v$dsoDetails === void 0 ? void 0 : _v$dsoDetails.id) === supervisor.vendorId || ((_v$dsoDetails2 = v.dsoDetails) === null || _v$dsoDetails2 === void 0 ? void 0 : _v$dsoDetails2.vendorId) === supervisor.vendorId;
7865
+ });
7866
+ return (mappedVendor === null || mappedVendor === void 0 ? void 0 : (_mappedVendor$dsoDeta = mappedVendor.dsoDetails) === null || _mappedVendor$dsoDeta === void 0 ? void 0 : _mappedVendor$dsoDeta.name) || supervisor.vendorId || "N/A";
7867
+ }, [vendorData, supervisor === null || supervisor === void 0 ? void 0 : supervisor.vendorId]);
7868
+ const fullName = (supervisor === null || supervisor === void 0 ? void 0 : (_supervisor$owner = supervisor.owner) === null || _supervisor$owner === void 0 ? void 0 : _supervisor$owner.name) || (supervisor === null || supervisor === void 0 ? void 0 : supervisor.name) || "N/A";
7869
+ const mobileNumber = (supervisor === null || supervisor === void 0 ? void 0 : (_supervisor$owner3 = supervisor.owner) === null || _supervisor$owner3 === void 0 ? void 0 : _supervisor$owner3.mobileNumber) || (supervisor === null || supervisor === void 0 ? void 0 : supervisor.mobileNo) || "N/A";
7870
+ const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSurveyorSearch(tenantId, {
7871
+ supervisorIds: supervisor === null || supervisor === void 0 ? void 0 : supervisor.id
7872
+ }, {
7873
+ enabled: !!tenantId && !!(supervisor !== null && supervisor !== void 0 && supervisor.id)
7874
+ }),
7875
+ surveyorsResponse = _Digit$Hooks$fsm$useS2.data,
7876
+ isSurveyorsLoading = _Digit$Hooks$fsm$useS2.isLoading;
7877
+ const surveyors = useMemo(() => {
7878
+ return (surveyorsResponse === null || surveyorsResponse === void 0 ? void 0 : surveyorsResponse.surveyors) || (surveyorsResponse === null || surveyorsResponse === void 0 ? void 0 : surveyorsResponse.surveyor) || [];
7879
+ }, [surveyorsResponse]);
7880
+ const _Digit$Hooks$ekyc$use2 = Digit.Hooks.ekyc.useEkycAssignmentProgress({
7881
+ enabled: !!tenantId,
7882
+ keepPreviousData: true
7883
+ }),
7884
+ isProgressLoading = _Digit$Hooks$ekyc$use2.isLoading,
7885
+ progressData = _Digit$Hooks$ekyc$use2.data;
7886
+ const cards = useMemo(() => [{
7887
+ label: "TOTAL_EKYC_APPLICATIONS",
7888
+ count: (progressData === null || progressData === void 0 ? void 0 : progressData.totalKnos) || 0,
7889
+ color: "#0B2559",
7890
+ type: "today"
7891
+ }, {
7892
+ label: "TOTAL_ASSIGNMENTS",
7893
+ count: (progressData === null || progressData === void 0 ? void 0 : progressData.totalAssignments) || 0,
7894
+ color: "#3B82F6",
7895
+ type: "week"
7896
+ }, {
7897
+ label: "EKYC_COMPLETED",
7898
+ count: (progressData === null || progressData === void 0 ? void 0 : progressData.completedKnos) || 0,
7899
+ color: "#10B981",
7900
+ type: "month"
7901
+ }, {
7902
+ label: "PENDING_APPLICATIONS",
7903
+ count: ((progressData === null || progressData === void 0 ? void 0 : progressData.totalKnos) || 0) - ((progressData === null || progressData === void 0 ? void 0 : progressData.completedKnos) || 0),
7904
+ color: "#F59E0B",
7905
+ type: "pending"
7906
+ }, {
7907
+ label: "OVERALL_PROGRESS",
7908
+ count: ((progressData === null || progressData === void 0 ? void 0 : progressData.overallProgressPercent) || 0) + "%",
7909
+ color: "#A855F7",
7910
+ type: "progress"
7911
+ }], [progressData]);
7912
+ const _useState = useState(0),
7913
+ currentPage = _useState[0],
7914
+ setCurrentPage = _useState[1];
7915
+ const _useState2 = useState(20),
7916
+ pageSize = _useState2[0],
7917
+ setPageSize = _useState2[1];
7918
+ const paginatedSurveyors = useMemo(() => {
7919
+ const start = currentPage * pageSize;
7920
+ const end = start + pageSize;
7921
+ return surveyors.slice(start, end);
7922
+ }, [surveyors, currentPage, pageSize]);
7923
+ const surveyorColumns = useMemo(() => [{
7924
+ Header: t("SURVEYOR_NAME") || "Surveyor Name",
7925
+ accessor: row => {
7926
+ var _row$owner;
7927
+ return (row === null || row === void 0 ? void 0 : row.name) || (row === null || row === void 0 ? void 0 : (_row$owner = row.owner) === null || _row$owner === void 0 ? void 0 : _row$owner.name) || "N/A";
7928
+ },
7929
+ Cell: _ref2 => {
7930
+ var _row$original, _row$original2, _row$original2$owner;
7931
+ let row = _ref2.row;
7932
+ return /*#__PURE__*/React.createElement("a", {
7933
+ href: "/digit-ui/citizen/ekyc/surveyor-dashboard/" + row.original.id,
7934
+ style: {
7935
+ color: "#1D70B8",
7936
+ fontWeight: "600",
7937
+ textDecoration: "none"
7938
+ }
7939
+ }, ((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.name) || ((_row$original2 = row.original) === null || _row$original2 === void 0 ? void 0 : (_row$original2$owner = _row$original2.owner) === null || _row$original2$owner === void 0 ? void 0 : _row$original2$owner.name) || "N/A");
7940
+ }
7941
+ }, {
7942
+ Header: t("MOBILE_NUMBER") || "Mobile Number",
7943
+ accessor: row => {
7944
+ var _row$owner2;
7945
+ return (row === null || row === void 0 ? void 0 : (_row$owner2 = row.owner) === null || _row$owner2 === void 0 ? void 0 : _row$owner2.mobileNumber) || (row === null || row === void 0 ? void 0 : row.mobileNo) || "N/A";
7946
+ },
7947
+ id: "mobileNumber"
7948
+ }, {
7949
+ Header: t("STATUS") || "Status",
7950
+ accessor: "status",
7951
+ Cell: _ref3 => {
7952
+ let value = _ref3.value;
7953
+ return /*#__PURE__*/React.createElement("span", {
7954
+ className: "status-badge " + (value === "ACTIVE" ? "verified" : "pending")
7955
+ }, t(value) || value);
7956
+ }
7957
+ }, {
7958
+ Header: t("TOTAL_EKYC_APPLICATIONS") || "Total eKYC Applications",
7959
+ accessor: row => (row === null || row === void 0 ? void 0 : row.totalEkycApplications) || 0,
7960
+ id: "totalEkycApplications",
7961
+ Cell: _ref4 => {
7962
+ var _row$original3, _row$original3$owner;
7963
+ let row = _ref4.row;
7964
+ return /*#__PURE__*/React.createElement(SurveyorStatsCell, {
7965
+ surveyorId: (_row$original3 = row.original) === null || _row$original3 === void 0 ? void 0 : (_row$original3$owner = _row$original3.owner) === null || _row$original3$owner === void 0 ? void 0 : _row$original3$owner.uuid,
7966
+ type: "total"
7598
7967
  });
7599
- } else if (pathname.includes("/review")) {
7600
- crumbs.push({
7601
- label: t("EKYC_INBOX"),
7602
- path: "/digit-ui/citizen/ekyc/inbox"
7968
+ }
7969
+ }, {
7970
+ Header: t("EKYC_COMPLETED") || "eKYC Completed",
7971
+ accessor: row => (row === null || row === void 0 ? void 0 : row.ekycCompleted) || 0,
7972
+ id: "ekycCompleted",
7973
+ Cell: _ref5 => {
7974
+ var _row$original4, _row$original4$owner;
7975
+ let row = _ref5.row;
7976
+ return /*#__PURE__*/React.createElement(SurveyorStatsCell, {
7977
+ surveyorId: (_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : (_row$original4$owner = _row$original4.owner) === null || _row$original4$owner === void 0 ? void 0 : _row$original4$owner.uuid,
7978
+ type: "completed"
7603
7979
  });
7604
- crumbs.push({
7605
- label: t("EKYC_REVIEW")
7980
+ }
7981
+ }, {
7982
+ Header: t("PENDING_APPLICATIONS") || "Pending Applications",
7983
+ accessor: row => (row === null || row === void 0 ? void 0 : row.pendingApplications) || 0,
7984
+ id: "pendingApplications",
7985
+ Cell: _ref6 => {
7986
+ var _row$original5, _row$original5$owner;
7987
+ let row = _ref6.row;
7988
+ return /*#__PURE__*/React.createElement(SurveyorStatsCell, {
7989
+ surveyorId: (_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : (_row$original5$owner = _row$original5.owner) === null || _row$original5$owner === void 0 ? void 0 : _row$original5$owner.uuid,
7990
+ type: "pending"
7606
7991
  });
7607
- } else if (pathname.includes("/assign/surveyor-details")) {
7608
- crumbs.push({
7609
- label: t("EKYC_ASSIGN"),
7610
- path: "/digit-ui/citizen/ekyc/assign"
7992
+ }
7993
+ }, {
7994
+ Header: t("OVERALL_PROGRESS") || "Overall Progress",
7995
+ accessor: row => (row === null || row === void 0 ? void 0 : row.overallProgress) || "N/A",
7996
+ id: "overallProgress",
7997
+ Cell: _ref7 => {
7998
+ var _row$original6, _row$original6$owner;
7999
+ let row = _ref7.row;
8000
+ return /*#__PURE__*/React.createElement(SurveyorStatsCell, {
8001
+ surveyorId: (_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : (_row$original6$owner = _row$original6.owner) === null || _row$original6$owner === void 0 ? void 0 : _row$original6$owner.uuid,
8002
+ type: "progress"
7611
8003
  });
7612
- crumbs.push({
8004
+ }
8005
+ }], [t]);
8006
+ const _useState3 = useState(false),
8007
+ showReportMenu = _useState3[0],
8008
+ setShowReportMenu = _useState3[1];
8009
+ const _useState4 = useState({
8010
+ from: "",
8011
+ to: ""
8012
+ }),
8013
+ customDate = _useState4[0],
8014
+ setCustomDate = _useState4[1];
8015
+ const _useState5 = useState(false),
8016
+ showCustomPicker = _useState5[0],
8017
+ setShowCustomPicker = _useState5[1];
8018
+ const _useState6 = useState(false),
8019
+ reportLoading = _useState6[0],
8020
+ setReportLoading = _useState6[1];
8021
+ const reportMenuRef = useRef(null);
8022
+ useEffect(() => {
8023
+ const handler = e => {
8024
+ if (reportMenuRef.current && !reportMenuRef.current.contains(e.target)) {
8025
+ setShowReportMenu(false);
8026
+ setShowCustomPicker(false);
8027
+ }
8028
+ };
8029
+ document.addEventListener("mousedown", handler);
8030
+ return () => document.removeEventListener("mousedown", handler);
8031
+ }, []);
8032
+ const getDateRange = filter => {
8033
+ const now = new Date();
8034
+ const start = new Date(now);
8035
+ if (filter === "today") {
8036
+ start.setHours(0, 0, 0, 0);
8037
+ return {
8038
+ from: start,
8039
+ to: now
8040
+ };
8041
+ }
8042
+ if (filter === "week") {
8043
+ start.setDate(now.getDate() - now.getDay());
8044
+ start.setHours(0, 0, 0, 0);
8045
+ return {
8046
+ from: start,
8047
+ to: now
8048
+ };
8049
+ }
8050
+ if (filter === "month") {
8051
+ start.setDate(1);
8052
+ start.setHours(0, 0, 0, 0);
8053
+ return {
8054
+ from: start,
8055
+ to: now
8056
+ };
8057
+ }
8058
+ return null;
8059
+ };
8060
+ const handlePresetDownload = function (filter) {
8061
+ try {
8062
+ const range = getDateRange(filter);
8063
+ if (!range) return Promise.resolve();
8064
+ setReportLoading(true);
8065
+ const _temp = _finallyRethrows(function () {
8066
+ return _catch(function () {
8067
+ const surveyorsList = surveyors || [];
8068
+ return Promise.resolve(Promise.all(surveyorsList.map(function (surveyor) {
8069
+ try {
8070
+ return Promise.resolve(_catch(function () {
8071
+ var _surveyor$owner;
8072
+ return Promise.resolve(Digit.EkycService.dashboard({}, {
8073
+ tenantId: "dl.djb",
8074
+ offset: 0,
8075
+ limit: 1,
8076
+ surveyorId: (_surveyor$owner = surveyor.owner) === null || _surveyor$owner === void 0 ? void 0 : _surveyor$owner.uuid,
8077
+ fromDate: range.from.getTime(),
8078
+ toDate: range.to.getTime()
8079
+ })).then(function (response) {
8080
+ const info = (response === null || response === void 0 ? void 0 : response.dashboardInfo) || {};
8081
+ const total = info.total || 0;
8082
+ const completed = info.completed || 0;
8083
+ const pending = info.pending || 0;
8084
+ const progress = total > 0 ? Math.round(completed / total * 100) + "%" : "0%";
8085
+ return _extends({}, surveyor, {
8086
+ total,
8087
+ completed,
8088
+ pending,
8089
+ progress
8090
+ });
8091
+ });
8092
+ }, function (err) {
8093
+ console.error("Failed to fetch stats for surveyor:", surveyor.id, err);
8094
+ return _extends({}, surveyor, {
8095
+ total: 0,
8096
+ completed: 0,
8097
+ pending: 0,
8098
+ progress: "0%"
8099
+ });
8100
+ }));
8101
+ } catch (e) {
8102
+ return Promise.reject(e);
8103
+ }
8104
+ }))).then(function (rowsWithStats) {
8105
+ var _supervisor$owner4;
8106
+ return Promise.resolve(Digit.EkycService.dashboard({}, {
8107
+ tenantId: "dl.djb",
8108
+ offset: 0,
8109
+ limit: 1,
8110
+ supervisorId: supervisor === null || supervisor === void 0 ? void 0 : (_supervisor$owner4 = supervisor.owner) === null || _supervisor$owner4 === void 0 ? void 0 : _supervisor$owner4.uuid,
8111
+ fromDate: range.from.getTime(),
8112
+ toDate: range.to.getTime()
8113
+ })).then(function (overallResponse) {
8114
+ downloadSupervisorPDF({
8115
+ rows: rowsWithStats,
8116
+ supervisorName: fullName,
8117
+ mobileNumber,
8118
+ vendorName,
8119
+ dashboardInfo: (overallResponse === null || overallResponse === void 0 ? void 0 : overallResponse.dashboardInfo) || {},
8120
+ t
8121
+ });
8122
+ });
8123
+ });
8124
+ }, function (err) {
8125
+ console.error("Failed to fetch dashboard data for report download:", err);
8126
+ });
8127
+ }, function (_wasThrown, _result) {
8128
+ setReportLoading(false);
8129
+ setShowReportMenu(false);
8130
+ setShowCustomPicker(false);
8131
+ if (_wasThrown) throw _result;
8132
+ return _result;
8133
+ });
8134
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
8135
+ } catch (e) {
8136
+ return Promise.reject(e);
8137
+ }
8138
+ };
8139
+ const handleCustomDownload = function () {
8140
+ try {
8141
+ if (!customDate.from || !customDate.to) {
8142
+ alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
8143
+ return Promise.resolve();
8144
+ }
8145
+ const from = new Date(customDate.from);
8146
+ from.setHours(0, 0, 0, 0);
8147
+ const to = new Date(customDate.to);
8148
+ to.setHours(23, 59, 59, 999);
8149
+ setReportLoading(true);
8150
+ const _temp2 = _finallyRethrows(function () {
8151
+ return _catch(function () {
8152
+ const surveyorsList = surveyors || [];
8153
+ return Promise.resolve(Promise.all(surveyorsList.map(function (surveyor) {
8154
+ try {
8155
+ return Promise.resolve(_catch(function () {
8156
+ var _surveyor$owner2;
8157
+ return Promise.resolve(Digit.EkycService.dashboard({}, {
8158
+ tenantId: "dl.djb",
8159
+ offset: 0,
8160
+ limit: 1,
8161
+ surveyorId: (_surveyor$owner2 = surveyor.owner) === null || _surveyor$owner2 === void 0 ? void 0 : _surveyor$owner2.uuid,
8162
+ fromDate: from.getTime(),
8163
+ toDate: to.getTime()
8164
+ })).then(function (response) {
8165
+ const info = (response === null || response === void 0 ? void 0 : response.dashboardInfo) || {};
8166
+ const total = info.total || 0;
8167
+ const completed = info.completed || 0;
8168
+ const pending = info.pending || 0;
8169
+ const progress = total > 0 ? Math.round(completed / total * 100) + "%" : "0%";
8170
+ return _extends({}, surveyor, {
8171
+ total,
8172
+ completed,
8173
+ pending,
8174
+ progress
8175
+ });
8176
+ });
8177
+ }, function (err) {
8178
+ console.error("Failed to fetch stats for surveyor:", surveyor.id, err);
8179
+ return _extends({}, surveyor, {
8180
+ total: 0,
8181
+ completed: 0,
8182
+ pending: 0,
8183
+ progress: "0%"
8184
+ });
8185
+ }));
8186
+ } catch (e) {
8187
+ return Promise.reject(e);
8188
+ }
8189
+ }))).then(function (rowsWithStats) {
8190
+ var _supervisor$owner5;
8191
+ return Promise.resolve(Digit.EkycService.dashboard({}, {
8192
+ tenantId: "dl.djb",
8193
+ offset: 0,
8194
+ limit: 1,
8195
+ supervisorId: supervisor === null || supervisor === void 0 ? void 0 : (_supervisor$owner5 = supervisor.owner) === null || _supervisor$owner5 === void 0 ? void 0 : _supervisor$owner5.uuid,
8196
+ fromDate: from.getTime(),
8197
+ toDate: to.getTime()
8198
+ })).then(function (overallResponse) {
8199
+ downloadSupervisorPDF({
8200
+ rows: rowsWithStats,
8201
+ supervisorName: fullName,
8202
+ mobileNumber,
8203
+ vendorName,
8204
+ dashboardInfo: (overallResponse === null || overallResponse === void 0 ? void 0 : overallResponse.dashboardInfo) || {},
8205
+ t
8206
+ });
8207
+ });
8208
+ });
8209
+ }, function (err) {
8210
+ console.error("Failed to fetch custom dashboard data for report download:", err);
8211
+ });
8212
+ }, function (_wasThrown2, _result2) {
8213
+ setReportLoading(false);
8214
+ setShowReportMenu(false);
8215
+ setShowCustomPicker(false);
8216
+ if (_wasThrown2) throw _result2;
8217
+ return _result2;
8218
+ });
8219
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
8220
+ } catch (e) {
8221
+ return Promise.reject(e);
8222
+ }
8223
+ };
8224
+ const StatCard = _ref8 => {
8225
+ let title = _ref8.title,
8226
+ value = _ref8.value,
8227
+ type = _ref8.type,
8228
+ color = _ref8.color,
8229
+ isLoading = _ref8.isLoading;
8230
+ return /*#__PURE__*/React.createElement("div", {
8231
+ className: "stat-card " + type,
8232
+ style: color ? {
8233
+ borderLeft: "5px solid " + color
8234
+ } : {}
8235
+ }, isLoading ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
8236
+ className: "stat-title skeleton skeleton-text"
8237
+ }), /*#__PURE__*/React.createElement("div", {
8238
+ className: "stat-value skeleton skeleton-number"
8239
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
8240
+ className: "stat-title"
8241
+ }, title), /*#__PURE__*/React.createElement("div", {
8242
+ className: "stat-value",
8243
+ style: color ? {
8244
+ color
8245
+ } : {}
8246
+ }, value)));
8247
+ };
8248
+ if (isSupervisorSearchLoading) {
8249
+ return /*#__PURE__*/React.createElement(Loader, null);
8250
+ }
8251
+ if (!supervisor) {
8252
+ return /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
8253
+ style: {
8254
+ padding: "24px"
8255
+ }
8256
+ }, t("NO_SUPERVISOR_FOUND")));
8257
+ }
8258
+ return /*#__PURE__*/React.createElement(Card, {
8259
+ className: "surveyor-dashboard"
8260
+ }, /*#__PURE__*/React.createElement("div", {
8261
+ className: "ekyc-dashboard-section"
8262
+ }, /*#__PURE__*/React.createElement("div", {
8263
+ className: "ekyc-dashboard-header"
8264
+ }, /*#__PURE__*/React.createElement("div", {
8265
+ className: "avatar"
8266
+ }, fullName === null || fullName === void 0 ? void 0 : (_fullName$charAt = fullName.charAt(0)) === null || _fullName$charAt === void 0 ? void 0 : _fullName$charAt.toUpperCase()), /*#__PURE__*/React.createElement("div", {
8267
+ className: "header-content"
8268
+ }, /*#__PURE__*/React.createElement("h2", {
8269
+ className: "name"
8270
+ }, fullName), /*#__PURE__*/React.createElement("div", {
8271
+ className: "designation"
8272
+ }, t("FIELD_SUPERVISOR") || "Field Supervisor"))), /*#__PURE__*/React.createElement("div", {
8273
+ className: "report-download",
8274
+ ref: reportMenuRef
8275
+ }, /*#__PURE__*/React.createElement("button", {
8276
+ className: "download-btn",
8277
+ disabled: reportLoading,
8278
+ onClick: () => {
8279
+ setShowReportMenu(p => !p);
8280
+ setShowCustomPicker(false);
8281
+ }
8282
+ }, reportLoading ? t("DOWNLOADING") || "Downloading..." : t("DOWNLOAD_REPORT") || "Download Report"), showReportMenu && /*#__PURE__*/React.createElement("div", {
8283
+ className: "report-menu"
8284
+ }, [{
8285
+ label: t("TODAY") || "Today",
8286
+ key: "today"
8287
+ }, {
8288
+ label: t("THIS_WEEK") || "This Week",
8289
+ key: "week"
8290
+ }, {
8291
+ label: t("THIS_MONTH") || "This Month",
8292
+ key: "month"
8293
+ }].map(_ref9 => {
8294
+ let label = _ref9.label,
8295
+ key = _ref9.key;
8296
+ return /*#__PURE__*/React.createElement("div", {
8297
+ key: key,
8298
+ className: "menu-item",
8299
+ onClick: () => handlePresetDownload(key)
8300
+ }, label);
8301
+ }), /*#__PURE__*/React.createElement("div", {
8302
+ className: "custom-date-trigger",
8303
+ onClick: () => setShowCustomPicker(p => !p)
8304
+ }, t("CUSTOM_DATE") || "Custom Date"), showCustomPicker && /*#__PURE__*/React.createElement("div", {
8305
+ className: "custom-picker"
8306
+ }, /*#__PURE__*/React.createElement("div", {
8307
+ className: "date-field"
8308
+ }, /*#__PURE__*/React.createElement("label", {
8309
+ className: "date-label"
8310
+ }, t("FROM_DATE") || "From"), /*#__PURE__*/React.createElement("input", {
8311
+ type: "date",
8312
+ className: "date-input",
8313
+ value: customDate.from,
8314
+ onChange: e => setCustomDate(d => _extends({}, d, {
8315
+ from: e.target.value
8316
+ }))
8317
+ })), /*#__PURE__*/React.createElement("div", {
8318
+ className: "date-field"
8319
+ }, /*#__PURE__*/React.createElement("label", {
8320
+ className: "date-label"
8321
+ }, t("TO_DATE") || "To"), /*#__PURE__*/React.createElement("input", {
8322
+ type: "date",
8323
+ className: "date-input",
8324
+ value: customDate.to,
8325
+ onChange: e => setCustomDate(d => _extends({}, d, {
8326
+ to: e.target.value
8327
+ }))
8328
+ })), /*#__PURE__*/React.createElement("button", {
8329
+ className: "download-action-btn",
8330
+ onClick: handleCustomDownload
8331
+ }, t("DOWNLOAD") || "Download"))))), /*#__PURE__*/React.createElement("div", {
8332
+ className: "stats-wrapper"
8333
+ }, cards.map((card, idx) => /*#__PURE__*/React.createElement(StatCard, {
8334
+ key: idx,
8335
+ title: t(card.label),
8336
+ value: card.count,
8337
+ type: card.type,
8338
+ color: card.color,
8339
+ isLoading: isProgressLoading
8340
+ }))), /*#__PURE__*/React.createElement("div", {
8341
+ className: "ekyc-dashboard-section"
8342
+ }, /*#__PURE__*/React.createElement("div", {
8343
+ className: "details-grid"
8344
+ }, /*#__PURE__*/React.createElement("div", {
8345
+ className: "detail-item"
8346
+ }, /*#__PURE__*/React.createElement("span", {
8347
+ className: "label"
8348
+ }, t("MOBILE"), ":"), /*#__PURE__*/React.createElement("span", {
8349
+ className: "value"
8350
+ }, (supervisor === null || supervisor === void 0 ? void 0 : (_supervisor$owner6 = supervisor.owner) === null || _supervisor$owner6 === void 0 ? void 0 : _supervisor$owner6.mobileNumber) || (supervisor === null || supervisor === void 0 ? void 0 : supervisor.mobileNo) || "N/A")), /*#__PURE__*/React.createElement("div", {
8351
+ className: "detail-item"
8352
+ }, /*#__PURE__*/React.createElement("span", {
8353
+ className: "label"
8354
+ }, t("EMAIL"), ":"), /*#__PURE__*/React.createElement("span", {
8355
+ className: "value"
8356
+ }, (supervisor === null || supervisor === void 0 ? void 0 : (_supervisor$owner7 = supervisor.owner) === null || _supervisor$owner7 === void 0 ? void 0 : _supervisor$owner7.emailId) || "N/A")), /*#__PURE__*/React.createElement("div", {
8357
+ className: "detail-item"
8358
+ }, /*#__PURE__*/React.createElement("span", {
8359
+ className: "label"
8360
+ }, t("GENDER"), ":"), /*#__PURE__*/React.createElement("span", {
8361
+ className: "value"
8362
+ }, (supervisor === null || supervisor === void 0 ? void 0 : (_supervisor$owner8 = supervisor.owner) === null || _supervisor$owner8 === void 0 ? void 0 : _supervisor$owner8.gender) || "N/A")), /*#__PURE__*/React.createElement("div", {
8363
+ className: "detail-item"
8364
+ }, /*#__PURE__*/React.createElement("span", {
8365
+ className: "label"
8366
+ }, t("STATUS"), ":"), /*#__PURE__*/React.createElement("span", {
8367
+ className: "value"
8368
+ }, (supervisor === null || supervisor === void 0 ? void 0 : supervisor.status) || "N/A")), /*#__PURE__*/React.createElement("div", {
8369
+ className: "detail-item"
8370
+ }, /*#__PURE__*/React.createElement("span", {
8371
+ className: "label"
8372
+ }, t("SERVICE_TYPE"), ":"), /*#__PURE__*/React.createElement("span", {
8373
+ className: "value"
8374
+ }, (supervisor === null || supervisor === void 0 ? void 0 : (_supervisor$additiona = supervisor.additionalDetails) === null || _supervisor$additiona === void 0 ? void 0 : _supervisor$additiona.serviceType) || "N/A")), /*#__PURE__*/React.createElement("div", {
8375
+ className: "detail-item"
8376
+ }, /*#__PURE__*/React.createElement("span", {
8377
+ className: "label"
8378
+ }, t("VENDOR_NAME") || "Vendor Name", ":"), /*#__PURE__*/React.createElement("span", {
8379
+ className: "value"
8380
+ }, vendorName)))), /*#__PURE__*/React.createElement(Card, {
8381
+ className: "dashboard-card"
8382
+ }, /*#__PURE__*/React.createElement(Table, {
8383
+ t: t,
8384
+ tableTitle: t("CONNECTED_SURVEYORS") || "Connected Surveyors",
8385
+ tableClass: "ekycTable",
8386
+ data: paginatedSurveyors,
8387
+ columns: surveyorColumns,
8388
+ isLoading: isSurveyorsLoading,
8389
+ totalRecords: surveyors.length,
8390
+ currentPage: currentPage,
8391
+ pageSizeLimit: pageSize,
8392
+ isPaginationRequired: true,
8393
+ onNextPage: () => {
8394
+ if (currentPage < Math.ceil(surveyors.length / pageSize) - 1) {
8395
+ setCurrentPage(prev => prev + 1);
8396
+ }
8397
+ },
8398
+ onPrevPage: () => {
8399
+ if (currentPage > 0) {
8400
+ setCurrentPage(prev => prev - 1);
8401
+ }
8402
+ },
8403
+ onFirstPage: () => {
8404
+ setCurrentPage(0);
8405
+ },
8406
+ onLastPage: () => {
8407
+ setCurrentPage(Math.max(Math.ceil(surveyors.length / pageSize) - 1, 0));
8408
+ },
8409
+ onPageSizeChange: e => {
8410
+ setPageSize(Number(e.target.value));
8411
+ setCurrentPage(0);
8412
+ }
8413
+ })));
8414
+ };
8415
+
8416
+ const EkycStatus = () => {
8417
+ const _useTranslation = useTranslation(),
8418
+ t = _useTranslation.t;
8419
+ const _useParams = useParams(),
8420
+ id = _useParams.id;
8421
+ const history = useHistory();
8422
+ const _useState = useState({
8423
+ searchForm: {
8424
+ kNumber: id && id !== ":id" ? id : ""
8425
+ },
8426
+ filterForm: {}
8427
+ }),
8428
+ formState = _useState[0],
8429
+ setFormState = _useState[1];
8430
+ const _useState2 = useState(id && id !== ":id" ? id : ""),
8431
+ searchQuery = _useState2[0],
8432
+ setSearchQuery = _useState2[1];
8433
+ const _useState3 = useState(""),
8434
+ errorMsg = _useState3[0],
8435
+ setErrorMsg = _useState3[1];
8436
+ const tenantId = Digit.ULBService.getCurrentTenantId();
8437
+ useEffect(() => {
8438
+ var _formState$searchForm;
8439
+ const currentKNumber = (formState === null || formState === void 0 ? void 0 : (_formState$searchForm = formState.searchForm) === null || _formState$searchForm === void 0 ? void 0 : _formState$searchForm.kNumber) || "";
8440
+ const targetKNumber = id && id !== ":id" ? id : "";
8441
+ if (currentKNumber !== targetKNumber) {
8442
+ setFormState({
8443
+ searchForm: {
8444
+ kNumber: targetKNumber
8445
+ },
8446
+ filterForm: {}
8447
+ });
8448
+ setSearchQuery(targetKNumber);
8449
+ }
8450
+ }, [id]);
8451
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycSearchReview({
8452
+ kno: searchQuery,
8453
+ fetchType: "REVIEW"
8454
+ }, tenantId, {
8455
+ enabled: !!searchQuery,
8456
+ retry: false,
8457
+ onError: err => {
8458
+ setErrorMsg((err === null || err === void 0 ? void 0 : err.message) || t("EKYC_STATUS_NOT_FOUND", "eKYC Application not found."));
8459
+ }
8460
+ }),
8461
+ searchData = _Digit$Hooks$ekyc$use.data,
8462
+ isReviewLoading = _Digit$Hooks$ekyc$use.isLoading;
8463
+ const _Digit$Hooks$ekyc$use2 = Digit.Hooks.ekyc.useSearchConnection({
8464
+ tenantId,
8465
+ details: {
8466
+ kno: searchQuery
8467
+ }
8468
+ }, {
8469
+ enabled: !!searchQuery,
8470
+ retry: false
8471
+ }),
8472
+ connectionSearchData = _Digit$Hooks$ekyc$use2.data,
8473
+ isConnectionLoading = _Digit$Hooks$ekyc$use2.isLoading;
8474
+ const isLoading = isReviewLoading || isConnectionLoading;
8475
+ const onSearchFormSubmit = data => {
8476
+ var _data$kNumber;
8477
+ const val = data === null || data === void 0 ? void 0 : (_data$kNumber = data.kNumber) === null || _data$kNumber === void 0 ? void 0 : _data$kNumber.trim();
8478
+ if (!val) {
8479
+ setErrorMsg(t("EKYC_PLEASE_ENTER_KNO", "Please enter a valid K-Number."));
8480
+ return;
8481
+ }
8482
+ setErrorMsg("");
8483
+ setFormState({
8484
+ searchForm: data,
8485
+ filterForm: {}
8486
+ });
8487
+ setSearchQuery(val);
8488
+ history.push("/digit-ui/citizen/ekyc/" + val);
8489
+ };
8490
+ const searchFormDefaultValues = {
8491
+ kNumber: ""
8492
+ };
8493
+ const onSearchFormReset = setSearchFormValue => {
8494
+ setSearchFormValue("kNumber", "");
8495
+ setErrorMsg("");
8496
+ setFormState({
8497
+ searchForm: {
8498
+ kNumber: ""
8499
+ },
8500
+ filterForm: {}
8501
+ });
8502
+ setSearchQuery("");
8503
+ history.push("/digit-ui/citizen/ekyc/:id");
8504
+ };
8505
+ const SearchFormFields = useCallback(_ref => {
8506
+ let registerRef = _ref.registerRef,
8507
+ searchFormState = _ref.searchFormState,
8508
+ controlSearchForm = _ref.controlSearchForm;
8509
+ return /*#__PURE__*/React.createElement(SearchFormFieldsComponents, {
8510
+ registerRef,
8511
+ searchFormState,
8512
+ controlSearchForm,
8513
+ searchType: "kno",
8514
+ className: "search"
8515
+ });
8516
+ }, []);
8517
+ const propsForSearchForm = {
8518
+ SearchFormFields,
8519
+ onSearchFormSubmit,
8520
+ searchFormDefaultValues: formState === null || formState === void 0 ? void 0 : formState.searchForm,
8521
+ resetSearchFormDefaultValues: searchFormDefaultValues,
8522
+ onSearchFormReset,
8523
+ className: "search-form-wns-inbox"
8524
+ };
8525
+ const propsForInboxTable = {
8526
+ columns: [],
8527
+ data: [],
8528
+ limit: 10,
8529
+ offset: 0
8530
+ };
8531
+ const propsForInboxMobileCards = {
8532
+ data: []
8533
+ };
8534
+ const getStatusDetails = () => {
8535
+ if (!searchData) return null;
8536
+ const reviewWrapper = (searchData === null || searchData === void 0 ? void 0 : searchData.applicationReviewInfo) || (searchData === null || searchData === void 0 ? void 0 : searchData.applicationReview) || searchData;
8537
+ const appData = (Array.isArray(reviewWrapper) ? reviewWrapper[0] : reviewWrapper) || {};
8538
+ const newData = (appData === null || appData === void 0 ? void 0 : appData.newData) || appData;
8539
+ const connection = (newData === null || newData === void 0 ? void 0 : newData.connectionDetails) || newData || {};
8540
+ const naText = t("CS_NA", "N/A");
8541
+ const connRaw = (connectionSearchData === null || connectionSearchData === void 0 ? void 0 : connectionSearchData.connectionDetails) || connectionSearchData || {};
8542
+ const addrRaw = (connectionSearchData === null || connectionSearchData === void 0 ? void 0 : connectionSearchData.addressDetails) || {};
8543
+ const propRaw = (connectionSearchData === null || connectionSearchData === void 0 ? void 0 : connectionSearchData.propertyInfo) || {};
8544
+ const meterRaw = (connectionSearchData === null || connectionSearchData === void 0 ? void 0 : connectionSearchData.meterDetails) || {};
8545
+ const rawStatus = ((connection === null || connection === void 0 ? void 0 : connection.ekycStatus) || (connection === null || connection === void 0 ? void 0 : connection.ekycstatus) || (connRaw === null || connRaw === void 0 ? void 0 : connRaw.ekycStatus) || (propRaw === null || propRaw === void 0 ? void 0 : propRaw.ekycStatus) || (meterRaw === null || meterRaw === void 0 ? void 0 : meterRaw.ekycStatus) || "NA").toUpperCase();
8546
+ const reviewName = (connection === null || connection === void 0 ? void 0 : connection.consumerName) || [newData === null || newData === void 0 ? void 0 : newData.firstName, newData === null || newData === void 0 ? void 0 : newData.middleName, newData === null || newData === void 0 ? void 0 : newData.lastName].filter(Boolean).join(" ");
8547
+ const connName = (connRaw === null || connRaw === void 0 ? void 0 : connRaw.consumerName) || [connRaw === null || connRaw === void 0 ? void 0 : connRaw.firstName, connRaw === null || connRaw === void 0 ? void 0 : connRaw.middleName, connRaw === null || connRaw === void 0 ? void 0 : connRaw.lastName].filter(Boolean).join(" ");
8548
+ const reviewPhone = (connection === null || connection === void 0 ? void 0 : connection.phoneNumber) || (connection === null || connection === void 0 ? void 0 : connection.mobileNo) || (connection === null || connection === void 0 ? void 0 : connection.mobileNumber);
8549
+ const connPhone = (connRaw === null || connRaw === void 0 ? void 0 : connRaw.phoneNumber) || (connRaw === null || connRaw === void 0 ? void 0 : connRaw.mobileNo) || (connRaw === null || connRaw === void 0 ? void 0 : connRaw.mobileNumber) || (addrRaw === null || addrRaw === void 0 ? void 0 : addrRaw.mobileNo) || (addrRaw === null || addrRaw === void 0 ? void 0 : addrRaw.phoneNumber) || (addrRaw === null || addrRaw === void 0 ? void 0 : addrRaw.mobileNumber);
8550
+ const reviewType = (connection === null || connection === void 0 ? void 0 : connection.connectionType) || (connection === null || connection === void 0 ? void 0 : connection.connectionCategory);
8551
+ const connType = (connRaw === null || connRaw === void 0 ? void 0 : connRaw.connectionType) || (connRaw === null || connRaw === void 0 ? void 0 : connRaw.connectionCategory) || (connRaw === null || connRaw === void 0 ? void 0 : connRaw.knoCategory) || (propRaw === null || propRaw === void 0 ? void 0 : propRaw.connectionType) || (propRaw === null || propRaw === void 0 ? void 0 : propRaw.connectionCategory) || (meterRaw === null || meterRaw === void 0 ? void 0 : meterRaw.connectionCategory);
8552
+ return {
8553
+ kno: (connection === null || connection === void 0 ? void 0 : connection.knumber) || (connection === null || connection === void 0 ? void 0 : connection.kno) || (connRaw === null || connRaw === void 0 ? void 0 : connRaw.knumber) || (connRaw === null || connRaw === void 0 ? void 0 : connRaw.kno) || searchQuery,
8554
+ consumerName: reviewName && reviewName !== naText && reviewName !== "" ? reviewName : connName || naText,
8555
+ phoneNumber: reviewPhone && reviewPhone !== naText && reviewPhone !== "" ? reviewPhone : connPhone || naText,
8556
+ connectionType: reviewType && reviewType !== naText && reviewType !== "" ? reviewType : connType || naText,
8557
+ status: rawStatus
8558
+ };
8559
+ };
8560
+ const details = getStatusDetails();
8561
+ const timelineConfig = [{
8562
+ route: "submitted",
8563
+ timeLine: [{
8564
+ currentStep: 1,
8565
+ actions: t("EKYC_STEP_SUBMITTED", "eKYC Survey Submitted")
8566
+ }]
8567
+ }, {
8568
+ route: "verification",
8569
+ timeLine: [{
8570
+ currentStep: 2,
8571
+ actions: t("EKYC_STEP_UNDER_VERIFICATION", "Under Verification")
8572
+ }]
8573
+ }, {
8574
+ route: "zro-decision",
8575
+ timeLine: [{
8576
+ currentStep: 3,
8577
+ actions: t("EKYC_STEP_ZRO_DECISION", "ZRO Decision")
8578
+ }]
8579
+ }];
8580
+ let activeStepIndex = 0;
8581
+ if (details) {
8582
+ if (details.status === "APPROVED") {
8583
+ activeStepIndex = 3;
8584
+ } else if (details.status === "REJECTED") {
8585
+ activeStepIndex = 2;
8586
+ } else if (details.status === "PENDING_FOR_VERIFICATION") {
8587
+ activeStepIndex = 1;
8588
+ } else {
8589
+ activeStepIndex = 1;
8590
+ }
8591
+ }
8592
+ const getStatusText = status => {
8593
+ const key = "EKYC_STATUS_" + status;
8594
+ const val = t(key);
8595
+ if (val === key) {
8596
+ if (status === "APPROVED") return "Approved";
8597
+ if (status === "REJECTED") return "Rejected";
8598
+ if (status === "PENDING_FOR_VERIFICATION") return "Pending For Verification";
8599
+ return status;
8600
+ }
8601
+ return val;
8602
+ };
8603
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
8604
+ className: "employee-form-section-wrapper"
8605
+ }, !isLoading && details && /*#__PURE__*/React.createElement(VerticalTimeline, {
8606
+ config: timelineConfig,
8607
+ currentActiveIndex: activeStepIndex
8608
+ }), /*#__PURE__*/React.createElement("div", {
8609
+ className: "employee-form-section"
8610
+ }, /*#__PURE__*/React.createElement("div", {
8611
+ className: "single-page-form-container"
8612
+ }, /*#__PURE__*/React.createElement(Card, {
8613
+ className: "ekyc-status-search-card"
8614
+ }, /*#__PURE__*/React.createElement(CardHeader, {
8615
+ className: "ekyc-status-card-header"
8616
+ }, t("EKYC_APPLICATION_STATUS_TRACKER", "eKYC Application Status")), /*#__PURE__*/React.createElement(CardText, {
8617
+ className: "ekyc-status-card-text"
8618
+ }, t("EKYC_STATUS_TRACKER_SUBHEADER", "Enter your K-Number below to track the real-time status of your eKYC application.")), /*#__PURE__*/React.createElement("div", {
8619
+ className: "status-search-composer-wrapper"
8620
+ }, /*#__PURE__*/React.createElement(InboxComposer, _extends({
8621
+ isInboxLoading: false
8622
+ }, propsForSearchForm, {
8623
+ propsForInboxTable,
8624
+ propsForInboxMobileCards,
8625
+ formState
8626
+ })))), errorMsg && /*#__PURE__*/React.createElement("div", {
8627
+ className: "ekyc-status-error-msg"
8628
+ }, errorMsg), isLoading && /*#__PURE__*/React.createElement(Loader, null), !isLoading && details && /*#__PURE__*/React.createElement(Card, {
8629
+ className: "ekyc-status-results-card"
8630
+ }, /*#__PURE__*/React.createElement("div", {
8631
+ className: "ekyc-status-overview-header"
8632
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
8633
+ className: "ekyc-status-label-title"
8634
+ }, t("EKYC_CURRENT_STATUS", "Current Status")), /*#__PURE__*/React.createElement("div", {
8635
+ className: "ekyc-status-value-text"
8636
+ }, getStatusText(details.status))), /*#__PURE__*/React.createElement("span", {
8637
+ className: "ekyc-status-badge " + details.status.toLowerCase()
8638
+ }, details.status)), /*#__PURE__*/React.createElement("div", {
8639
+ className: "ekyc-status-details-section"
8640
+ }, /*#__PURE__*/React.createElement("h3", {
8641
+ className: "ekyc-status-details-title"
8642
+ }, t("EKYC_CONNECTION_SUMMARY", "Connection Summary")), /*#__PURE__*/React.createElement(StatusTable, null, /*#__PURE__*/React.createElement(Row, {
8643
+ label: t("EKYC_K_NUMBER", "K-Number"),
8644
+ text: details.kno
8645
+ }), /*#__PURE__*/React.createElement(Row, {
8646
+ label: t("EKYC_CONSUMER_NAME", "Consumer Name"),
8647
+ text: details.consumerName
8648
+ }), /*#__PURE__*/React.createElement(Row, {
8649
+ label: t("EKYC_MOBILE_NO", "Mobile Number"),
8650
+ text: details.phoneNumber
8651
+ }), /*#__PURE__*/React.createElement(Row, {
8652
+ label: t("EKYC_CONNECTION_TYPE", "Connection Type"),
8653
+ text: details.connectionType
8654
+ }))), /*#__PURE__*/React.createElement("div", {
8655
+ className: "ekyc-status-action-section",
8656
+ style: {
8657
+ marginTop: "24px",
8658
+ display: "flex",
8659
+ justifyContent: "flex-end"
8660
+ }
8661
+ }, /*#__PURE__*/React.createElement(SubmitBar, {
8662
+ label: t("EKYC_VIEW_APPLICATION", "View Application"),
8663
+ onSubmit: () => history.push("/digit-ui/citizen/ekyc/status/" + details.kno)
8664
+ })))))));
8665
+ };
8666
+
8667
+ const CitizenApp = () => {
8668
+ const _useTranslation = useTranslation(),
8669
+ t = _useTranslation.t;
8670
+ const location = useLocation();
8671
+ const _useRouteMatch = useRouteMatch(),
8672
+ path = _useRouteMatch.path;
8673
+ sessionStorage.removeItem("revalidateddone");
8674
+ const getDynamicBreadcrumbs = () => {
8675
+ const pathname = location.pathname;
8676
+ const crumbs = [{
8677
+ icon: HomeIcon,
8678
+ path: "/digit-ui/citizen"
8679
+ }, {
8680
+ label: t("EKYC_MODULE_NAME"),
8681
+ path: "/digit-ui/citizen/ekyc"
8682
+ }];
8683
+ if (pathname.includes("/create-kyc")) {
8684
+ crumbs.push({
8685
+ label: t("EKYC_CREATE_KYC")
8686
+ });
8687
+ } else if (pathname.includes("/aadhaar-verification")) {
8688
+ crumbs.push({
8689
+ label: t("EKYC_AADHAAR_VERIFICATION")
8690
+ });
8691
+ } else if (pathname.includes("/address-details")) {
8692
+ crumbs.push({
8693
+ label: t("EKYC_ADDRESS_DETAILS")
8694
+ });
8695
+ } else if (pathname.includes("/property-info")) {
8696
+ crumbs.push({
8697
+ label: t("EKYC_PROPERTY_INFO")
8698
+ });
8699
+ } else if (pathname.includes("/meter-details")) {
8700
+ crumbs.push({
8701
+ label: t("EKYC_METER_DETAILS")
8702
+ });
8703
+ } else if (pathname.includes("/review")) {
8704
+ crumbs.push({
8705
+ label: t("EKYC_INBOX"),
8706
+ path: "/digit-ui/citizen/ekyc/inbox"
8707
+ });
8708
+ crumbs.push({
8709
+ label: t("EKYC_REVIEW")
8710
+ });
8711
+ } else if (pathname.includes("/assign/surveyor-details")) {
8712
+ crumbs.push({
8713
+ label: t("EKYC_ASSIGN"),
8714
+ path: "/digit-ui/citizen/ekyc/assign"
8715
+ });
8716
+ crumbs.push({
7613
8717
  label: t("EKYC_SURVEYOR_DETAILS")
7614
8718
  });
7615
- } else if (pathname.includes("/assign")) {
8719
+ } else if (pathname.includes("/inbox")) {
7616
8720
  crumbs.push({
7617
- label: t("EKYC_ASSIGN")
8721
+ label: t("EKYC_INBOX")
8722
+ });
8723
+ } else if (pathname.includes("/supervisor-dashboard")) {
8724
+ crumbs.push({
8725
+ label: t("EKYC_SUPERVISOR_DASHBOARD")
7618
8726
  });
7619
8727
  } else if (pathname.includes("/surveyor-dashboard")) {
7620
8728
  crumbs.push({
@@ -7624,13 +8732,14 @@ const CitizenApp = () => {
7624
8732
  crumbs.push({
7625
8733
  label: t("EKYC_DASHBOARD")
7626
8734
  });
7627
- } else if (pathname.includes("/inbox")) {
8735
+ } else if (pathname.includes("/assign")) {
7628
8736
  crumbs.push({
7629
- label: t("EKYC_INBOX")
8737
+ label: t("EKYC_ASSIGN")
7630
8738
  });
7631
- } else if (pathname.includes("/status/")) {
8739
+ } else if (pathname.includes("/status/") || /^\/digit-ui\/citizen\/ekyc\/[^/]+$/.test(pathname)) {
8740
+ const statusLabel = t("EKYC_STATUS");
7632
8741
  crumbs.push({
7633
- label: t("EKYC_STATUS")
8742
+ label: statusLabel === "EKYC_STATUS" || statusLabel === "STATUS" ? "eKYC Status" : statusLabel
7634
8743
  });
7635
8744
  }
7636
8745
  return crumbs;
@@ -7706,6 +8815,16 @@ const CitizenApp = () => {
7706
8815
  component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
7707
8816
  layoutClass: "normal"
7708
8817
  }, /*#__PURE__*/React.createElement(Review, null))
8818
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
8819
+ path: path + "/supervisor-dashboard",
8820
+ component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
8821
+ layoutClass: "normal"
8822
+ }, /*#__PURE__*/React.createElement(SupervisorDetailsCard, null))
8823
+ }), /*#__PURE__*/React.createElement(PrivateRoute, {
8824
+ path: path + "/:id",
8825
+ component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
8826
+ layoutClass: "normal"
8827
+ }, /*#__PURE__*/React.createElement(EkycStatus, null))
7709
8828
  }))));
7710
8829
  };
7711
8830