@djb25/digit-ui-module-ekyc 1.0.24 → 1.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,11 @@
1
1
  import React, { useRef, useEffect, useMemo, useState, createContext, isValidElement, cloneElement, createElement, useContext, useCallback, useReducer, Fragment } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { useHistory, Link, useLocation, useParams, useRouteMatch, Switch, Route, Redirect } from 'react-router-dom';
4
- import { PersonIcon, EmployeeModuleCard, Loader, Card, InboxLinks, Table, HomeIcon, TextInput, Header, SubmitBar, DetailsCard, FilterForm, FilterFormField, Dropdown, Label, CustomTooltip, CardLabelError, InboxComposer, EditIcon, DeleteIcon, CardHeader, CardText, LabelFieldPair, CardLabel, ActionBar, Modal, Toast, RadioButtons, CardSubHeader, StatusTable, Row, GenericFileIcon, CheckBox, LinkButton, FormStep, UploadFile, VerticalTimeline, Close, Menu, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, LayoutWrapper, ModuleLinksView, CitizenHomeCard, DocumentIcon } from '@djb25/digit-ui-react-components';
4
+ import { PersonIcon, EmployeeModuleCard, Loader, Card, InboxLinks, Table, HomeIcon, TextInput, Header, SubmitBar, DetailsCard, FilterForm, FilterFormField, Dropdown, Label, CustomTooltip, CardLabelError, InboxComposer, EditIcon, DeleteIcon, CardHeader, CardText, LabelFieldPair, CardLabel, ActionBar, Modal, Toast, RadioButtons, CardSubHeader, StatusTable, Row, GenericFileIcon, CheckBox, Menu, LinkButton, UploadFile, FormComposer, VerticalTimeline, Close, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, LayoutWrapper, ModuleLinksView, CitizenHomeCard, DocumentIcon } from '@djb25/digit-ui-react-components';
5
5
  import * as Chartjs from 'chart.js/auto';
6
6
  import Chartjs__default, { Chart } from 'chart.js/auto';
7
7
  import { FaUsers, FaCheckCircle, FaClock, FaExclamationTriangle, FaUserTie, FaChartLine, FaSearch, FaArrowRight, FaMapMarkedAlt, FaArrowLeft } from 'react-icons/fa';
8
8
  import { ResponsiveContainer, LineChart, CartesianGrid, XAxis, YAxis, Tooltip, Legend, Line, BarChart, Bar, PieChart, Pie, Cell } from 'recharts';
9
- import 'react-dom';
10
9
 
11
10
  const EKYCCard = () => {
12
11
  const {
@@ -21,14 +20,11 @@ const EKYCCard = () => {
21
20
  link: `/digit-ui/employee/ekyc/dashboard`
22
21
  }],
23
22
  links: [{
24
- label: t("EKYC_DASHBOARD"),
25
- link: `/digit-ui/employee/ekyc/dashboard`
23
+ label: t("CEO_M.F_DOR_FINANCE_VIEW"),
24
+ link: `/digit-ui/employee/ekyc/ceo-dashboard`
26
25
  }, {
27
26
  label: t("EKYC_INBOX"),
28
27
  link: `/digit-ui/employee/ekyc/inbox`
29
- }, {
30
- label: t("CEO_M.F_DOR_FINANCE_VIEW"),
31
- link: `/digit-ui/employee/ekyc/ceo-dashboard`
32
28
  }, {
33
29
  label: t("EKYC_ASSIGN"),
34
30
  link: `/digit-ui/employee/ekyc/assign`
@@ -323,8 +319,8 @@ const DesktopInbox = ({
323
319
  Cell: ({
324
320
  row
325
321
  }) => {
326
- var _row$original5;
327
- const ekycStatus = ((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : _row$original5.ekycstatus) || "NA";
322
+ var _row$original5, _row$original6;
323
+ const ekycStatus = ((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : _row$original5.ekycStatus) || ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.ekycstatus) || "NA";
328
324
  return /*#__PURE__*/React.createElement("span", {
329
325
  className: `ekyc-status-tag ${ekycStatus}`
330
326
  }, t(`${ekycStatus}`));
@@ -335,8 +331,8 @@ const DesktopInbox = ({
335
331
  Cell: ({
336
332
  row
337
333
  }) => {
338
- var _row$original6, _row$original7;
339
- const kno = ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.kno) || ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.applicationNumber) || "NA";
334
+ var _row$original7, _row$original8;
335
+ const kno = ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.kno) || ((_row$original8 = row.original) === null || _row$original8 === void 0 ? void 0 : _row$original8.applicationNumber) || "NA";
340
336
  return /*#__PURE__*/React.createElement("span", {
341
337
  className: "ekyc-application-link",
342
338
  style: {
@@ -1849,8 +1845,8 @@ const useInboxTableConfig = ({
1849
1845
  Cell: ({
1850
1846
  row
1851
1847
  }) => {
1852
- var _row$original5;
1853
- const ekycStatus = ((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : _row$original5.ekycstatus) || "NA";
1848
+ var _row$original5, _row$original6;
1849
+ const ekycStatus = ((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : _row$original5.ekycStatus) || ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.ekycstatus) || "NA";
1854
1850
  return /*#__PURE__*/React.createElement("span", {
1855
1851
  className: `ekyc-status-tag ${ekycStatus}`
1856
1852
  }, t(`${ekycStatus}`));
@@ -1861,8 +1857,8 @@ const useInboxTableConfig = ({
1861
1857
  Cell: ({
1862
1858
  row
1863
1859
  }) => {
1864
- var _row$original6, _row$original7;
1865
- const kno = ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.kno) || ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.applicationNumber) || "NA";
1860
+ var _row$original7, _row$original8;
1861
+ const kno = ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.kno) || ((_row$original8 = row.original) === null || _row$original8 === void 0 ? void 0 : _row$original8.applicationNumber) || "NA";
1866
1862
  return /*#__PURE__*/React.createElement("span", {
1867
1863
  className: "ekyc-application-link",
1868
1864
  style: {
@@ -1888,25 +1884,25 @@ const useInboxTableConfig = ({
1888
1884
  manualPagination: true,
1889
1885
  initSortId: "applicationDate",
1890
1886
  onPageSizeChange: onPageSizeChange,
1891
- currentPage: Math.floor(offset / limit),
1887
+ currentPage: offset,
1892
1888
  onNextPage: () => {
1893
- var _formState$tableForm3, _formState$tableForm4;
1889
+ var _formState$tableForm3;
1894
1890
  return dispatch({
1895
1891
  action: "mutateTableForm",
1896
1892
  data: {
1897
1893
  ...formState.tableForm,
1898
- offset: parseInt((_formState$tableForm3 = formState.tableForm) === null || _formState$tableForm3 === void 0 ? void 0 : _formState$tableForm3.offset) + parseInt((_formState$tableForm4 = formState.tableForm) === null || _formState$tableForm4 === void 0 ? void 0 : _formState$tableForm4.limit)
1894
+ offset: parseInt((_formState$tableForm3 = formState.tableForm) === null || _formState$tableForm3 === void 0 ? void 0 : _formState$tableForm3.offset) + 10
1899
1895
  },
1900
1896
  checkPathName
1901
1897
  });
1902
1898
  },
1903
1899
  onPrevPage: () => {
1904
- var _formState$tableForm5, _formState$tableForm6;
1900
+ var _formState$tableForm4;
1905
1901
  return dispatch({
1906
1902
  action: "mutateTableForm",
1907
1903
  data: {
1908
1904
  ...formState.tableForm,
1909
- offset: parseInt((_formState$tableForm5 = formState.tableForm) === null || _formState$tableForm5 === void 0 ? void 0 : _formState$tableForm5.offset) - parseInt((_formState$tableForm6 = formState.tableForm) === null || _formState$tableForm6 === void 0 ? void 0 : _formState$tableForm6.limit)
1905
+ offset: parseInt((_formState$tableForm4 = formState.tableForm) === null || _formState$tableForm4 === void 0 ? void 0 : _formState$tableForm4.offset) - 10
1910
1906
  },
1911
1907
  checkPathName
1912
1908
  });
@@ -1915,17 +1911,14 @@ const useInboxTableConfig = ({
1915
1911
  onSort: onSortingByData,
1916
1912
  totalRecords: totalCount,
1917
1913
  onSearch: formState === null || formState === void 0 ? void 0 : (_formState$searchForm = formState.searchForm) === null || _formState$searchForm === void 0 ? void 0 : _formState$searchForm.message,
1918
- onLastPage: () => {
1919
- var _formState$tableForm7;
1920
- return dispatch({
1921
- action: "mutateTableForm",
1922
- data: {
1923
- ...formState.tableForm,
1924
- offset: Math.ceil(totalCount / 10) * 10 - parseInt((_formState$tableForm7 = formState.tableForm) === null || _formState$tableForm7 === void 0 ? void 0 : _formState$tableForm7.limit)
1925
- },
1926
- checkPathName
1927
- });
1928
- },
1914
+ onLastPage: () => dispatch({
1915
+ action: "mutateTableForm",
1916
+ data: {
1917
+ ...formState.tableForm,
1918
+ offset: Math.max(0, Math.ceil(totalCount / limit) - 10)
1919
+ },
1920
+ checkPathName
1921
+ }),
1929
1922
  onFirstPage: () => dispatch({
1930
1923
  action: "mutateTableForm",
1931
1924
  data: {
@@ -2192,16 +2185,16 @@ const SearchFormFieldsComponents = ({
2192
2185
  className: "mobile-input"
2193
2186
  }, /*#__PURE__*/React.createElement(Label, {
2194
2187
  className: "flex-roww flex-gap-2"
2195
- }, t("EKYC_MOBILE_NUMBER") || "Mobile Number", /*#__PURE__*/React.createElement(CustomTooltip, {
2188
+ }, t("EKYC_K.NUMBER") || "K Number", /*#__PURE__*/React.createElement(CustomTooltip, {
2196
2189
  message: t("EKYC_MOBILE_NUMBER_MESSAGE")
2197
2190
  })), /*#__PURE__*/React.createElement(Controller, {
2198
- name: "mobileNumber",
2191
+ name: "kNumber",
2199
2192
  control: controlSearchForm,
2200
2193
  defaultValue: "",
2201
2194
  rules: {
2202
2195
  pattern: {
2203
2196
  value: /^[0-9]{10}$/,
2204
- message: t("ERR_INVALID_MOBILE_NO")
2197
+ message: t("ERR_INVALID_KNO")
2205
2198
  }
2206
2199
  },
2207
2200
  render: ({
@@ -2211,7 +2204,7 @@ const SearchFormFieldsComponents = ({
2211
2204
  value: value || "",
2212
2205
  onChange: e => onChange(e.target.value)
2213
2206
  })
2214
- }), (errors === null || errors === void 0 ? void 0 : errors.mobileNumber) && /*#__PURE__*/React.createElement(CardLabelError, null, errors.mobileNumber.message)));
2207
+ }), (errors === null || errors === void 0 ? void 0 : errors.kNumber) && /*#__PURE__*/React.createElement(CardLabelError, null, errors.kNumber.message)));
2215
2208
  };
2216
2209
 
2217
2210
  const Inbox = ({
@@ -2236,7 +2229,13 @@ const Inbox = ({
2236
2229
  };
2237
2230
  const [formState, dispatch] = useReducer(formReducer, formInitValue);
2238
2231
  const filters = useMemo(() => {
2239
- return (formState === null || formState === void 0 ? void 0 : formState.searchForm) || {};
2232
+ const searchForm = (formState === null || formState === void 0 ? void 0 : formState.searchForm) || {};
2233
+ return {
2234
+ ...searchForm,
2235
+ ...(searchForm.kNumber && {
2236
+ kno: searchForm.kNumber
2237
+ })
2238
+ };
2240
2239
  }, [formState === null || formState === void 0 ? void 0 : formState.searchForm]);
2241
2240
  const queryParams = useMemo(() => {
2242
2241
  var _formState$tableForm, _formState$tableForm2;
@@ -2282,7 +2281,7 @@ const Inbox = ({
2282
2281
  return (sourceData || []).map(item => {
2283
2282
  const isSearchItem = !!item.connectionDetails;
2284
2283
  if (isSearchItem) {
2285
- var _item$propertyInfo, _item$propertyInfo2, _item$connectionDetai, _item$propertyInfo3, _item$connectionDetai2, _item$connectionDetai3;
2284
+ var _item$propertyInfo, _item$propertyInfo2, _item$connectionDetai, _item$propertyInfo3, _item$connectionDetai2, _item$connectionDetai3, _item$connectionDetai4, _item$connectionDetai5;
2286
2285
  return {
2287
2286
  applicationNo: ((_item$propertyInfo = item.propertyInfo) === null || _item$propertyInfo === void 0 ? void 0 : _item$propertyInfo.kno) || "",
2288
2287
  connectionNo: ((_item$propertyInfo2 = item.propertyInfo) === null || _item$propertyInfo2 === void 0 ? void 0 : _item$propertyInfo2.kno) || "",
@@ -2290,6 +2289,7 @@ const Inbox = ({
2290
2289
  applicationNumber: ((_item$propertyInfo3 = item.propertyInfo) === null || _item$propertyInfo3 === void 0 ? void 0 : _item$propertyInfo3.kno) || "",
2291
2290
  citizenName: ((_item$connectionDetai2 = item.connectionDetails) === null || _item$connectionDetai2 === void 0 ? void 0 : _item$connectionDetai2.consumerName) || "",
2292
2291
  status: ((_item$connectionDetai3 = item.connectionDetails) === null || _item$connectionDetai3 === void 0 ? void 0 : _item$connectionDetai3.statusflag) || "",
2292
+ 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",
2293
2293
  sla: 0
2294
2294
  };
2295
2295
  }
@@ -2302,15 +2302,13 @@ const Inbox = ({
2302
2302
  applicationNumber: item.kno || item.applicationNumber || "",
2303
2303
  citizenName: fullName || item.consumerName || item.citizenName || "",
2304
2304
  status: item.status || "",
2305
+ ekycStatus: item.ekycStatus || item.ekycstatus || "NA",
2305
2306
  sla: item.sla ?? 0
2306
2307
  };
2307
2308
  });
2308
2309
  }, [sourceData]);
2309
2310
  const totalRecords = (listData === null || listData === void 0 ? void 0 : listData.totalCount) || 0;
2310
2311
  const checkPathName = location.pathname.includes("ekyc/inbox");
2311
- const PropsForInboxLinks = {
2312
- headerText: checkPathName ? "EKYC_MODULE" : "MODULE_SW"
2313
- };
2314
2312
  const SearchFormFields = useCallback(({
2315
2313
  registerRef,
2316
2314
  searchFormState,
@@ -2344,12 +2342,12 @@ const Inbox = ({
2344
2342
  });
2345
2343
  };
2346
2344
  const searchFormDefaultValues = {
2347
- mobileNumber: "",
2345
+ kNumber: "",
2348
2346
  applicationNumber: "",
2349
2347
  consumerNo: ""
2350
2348
  };
2351
2349
  const onSearchFormReset = setSearchFormValue => {
2352
- setSearchFormValue("mobileNumber", null);
2350
+ setSearchFormValue("kNumber", null);
2353
2351
  setSearchFormValue("applicationNumber", null);
2354
2352
  setSearchFormValue("consumerNo", null);
2355
2353
  dispatch({
@@ -2371,13 +2369,6 @@ const Inbox = ({
2371
2369
  setFilterFormValue,
2372
2370
  getFilterFormValue
2373
2371
  }) => /*#__PURE__*/React.createElement(React.Fragment, null), []);
2374
- const propsForFilterForm = {
2375
- FilterFormFields,
2376
- onFilterFormSubmit: () => {},
2377
- filterFormDefaultValues: "",
2378
- resetFilterFormDefaultValues: "",
2379
- onFilterFormReset: () => {}
2380
- };
2381
2372
  function formReducer(state, payload) {
2382
2373
  const storageKey = payload.checkPathName ? "EKYC.INBOX" : "EKYC.SW.INBOX";
2383
2374
  switch (payload.action) {
@@ -2469,9 +2460,8 @@ const Inbox = ({
2469
2460
  return /*#__PURE__*/React.createElement("div", {
2470
2461
  className: "app-container"
2471
2462
  }, /*#__PURE__*/React.createElement(InboxComposer, _extends({
2472
- isInboxLoading,
2473
- PropsForInboxLinks
2474
- }, propsForSearchForm, propsForFilterForm, {
2463
+ isInboxLoading
2464
+ }, propsForSearchForm, {
2475
2465
  propsForInboxTable,
2476
2466
  formState,
2477
2467
  countData: listData
@@ -3228,7 +3218,6 @@ const boolToYesNo = (value, t) => {
3228
3218
  if (value === false || value === "false" || String(value).toLowerCase() === "no") return t("CORE_COMMON_NO");
3229
3219
  if (value === "true") return t("CORE_COMMON_YES");
3230
3220
  if (value === "false") return t("CORE_COMMON_NO");
3231
- return "N/A";
3232
3221
  };
3233
3222
  const extractReviewData = (searchData, flowState) => {
3234
3223
  const rawData = searchData && Object.keys(searchData).length > 0 ? searchData : (flowState === null || flowState === void 0 ? void 0 : flowState.reviewData) || {};
@@ -3377,6 +3366,17 @@ const Review = () => {
3377
3366
  const [isSubmitting, setIsSubmitting] = useState(false);
3378
3367
  const [showPreview, setShowPreview] = useState(false);
3379
3368
  const [previewUrl, setPreviewUrl] = useState("");
3369
+ const [showOptions, setShowOptions] = useState(false);
3370
+ const [showToast, setShowToast] = useState(false);
3371
+ const [toastData, setToastData] = useState({
3372
+ error: false,
3373
+ label: ""
3374
+ });
3375
+ const options = [{
3376
+ action: t("Approve")
3377
+ }, {
3378
+ action: t("Reject")
3379
+ }];
3380
3380
  const flowState = location.state || {};
3381
3381
  const {
3382
3382
  edits = {}
@@ -3655,6 +3655,7 @@ const Review = () => {
3655
3655
  apiId: "Rainmaker",
3656
3656
  ver: "1.0",
3657
3657
  msgId: "message-id",
3658
+ tenantId: tenantId,
3658
3659
  authToken: (_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.access_token
3659
3660
  },
3660
3661
  kno: activeKno,
@@ -3682,6 +3683,7 @@ const Review = () => {
3682
3683
  apiId: "Rainmaker",
3683
3684
  ver: "1.0",
3684
3685
  msgId: "message-id",
3686
+ tenantId: tenantId,
3685
3687
  authToken: (_Digit$UserService$ge4 = Digit.UserService.getUser()) === null || _Digit$UserService$ge4 === void 0 ? void 0 : _Digit$UserService$ge4.access_token
3686
3688
  },
3687
3689
  kno: activeKno,
@@ -3693,13 +3695,23 @@ const Review = () => {
3693
3695
  try {
3694
3696
  const result = await workflowMutation.mutateAsync(payload);
3695
3697
  if (result) {
3696
- history.push("/digit-ui/employee/ekyc/response", {
3697
- success: true,
3698
- result
3698
+ setToastData({
3699
+ error: false,
3700
+ label: t("EKYC_APPLICATION_APPROVE_SUCCESSFUL") || "Application Approved Successfully"
3699
3701
  });
3702
+ setShowToast(true);
3703
+ setTimeout(() => {
3704
+ history.push("/digit-ui/employee/ekyc/inbox");
3705
+ }, 2000);
3700
3706
  }
3701
3707
  } catch (err) {
3708
+ var _err$response, _err$response$data;
3702
3709
  console.error("Approve Error:", err);
3710
+ setToastData({
3711
+ error: true,
3712
+ label: (err === null || err === void 0 ? void 0 : err.message) || (err === null || err === void 0 ? void 0 : (_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : _err$response$data.message) || "Approve Error"
3713
+ });
3714
+ setShowToast(true);
3703
3715
  }
3704
3716
  };
3705
3717
  const handleViewDocument = fileStoreId => {
@@ -3708,6 +3720,14 @@ const Review = () => {
3708
3720
  setPreviewUrl(documentUrl);
3709
3721
  setShowPreview(true);
3710
3722
  };
3723
+ const handleMenuSelect = option => {
3724
+ setShowOptions(false);
3725
+ if (option.action === t("Approve")) {
3726
+ handleApprove();
3727
+ } else if (option.action === t("Reject")) {
3728
+ handleReject();
3729
+ }
3730
+ };
3711
3731
  if (isSearchLoading || isSubmitting) return /*#__PURE__*/React.createElement(Loader, null);
3712
3732
  const baseUrl = "/digit-ui/employee/ekyc";
3713
3733
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Card, {
@@ -3718,9 +3738,11 @@ const Review = () => {
3718
3738
  newData: connectionData,
3719
3739
  oldData: oldDataRaw === null || oldDataRaw === void 0 ? void 0 : oldDataRaw.connection,
3720
3740
  t: t,
3721
- jumpTo: `${baseUrl}/consumer-details`,
3741
+ jumpTo: `${baseUrl}/consumer-details?kno=${kno}`,
3722
3742
  state: {
3723
3743
  ...flowState,
3744
+ kNumber: kno,
3745
+ kno,
3724
3746
  reviewData: searchData,
3725
3747
  edits
3726
3748
  }
@@ -3730,9 +3752,11 @@ const Review = () => {
3730
3752
  newData: addressData,
3731
3753
  oldData: oldDataRaw === null || oldDataRaw === void 0 ? void 0 : oldDataRaw.address,
3732
3754
  t: t,
3733
- jumpTo: `${baseUrl}/address-details`,
3755
+ jumpTo: `${baseUrl}/address-details?kno=${kno}`,
3734
3756
  state: {
3735
3757
  ...flowState,
3758
+ kNumber: kno,
3759
+ kno,
3736
3760
  reviewData: searchData,
3737
3761
  edits
3738
3762
  }
@@ -3742,9 +3766,11 @@ const Review = () => {
3742
3766
  newData: propertyData,
3743
3767
  oldData: oldDataRaw === null || oldDataRaw === void 0 ? void 0 : oldDataRaw.property,
3744
3768
  t: t,
3745
- jumpTo: `${baseUrl}/property-info`,
3769
+ jumpTo: `${baseUrl}/property-info?kno=${kno}`,
3746
3770
  state: {
3747
3771
  ...flowState,
3772
+ kNumber: kno,
3773
+ kno,
3748
3774
  reviewData: searchData,
3749
3775
  edits
3750
3776
  }
@@ -3754,9 +3780,11 @@ const Review = () => {
3754
3780
  newData: meterData,
3755
3781
  oldData: oldDataRaw === null || oldDataRaw === void 0 ? void 0 : oldDataRaw.meter,
3756
3782
  t: t,
3757
- jumpTo: `${baseUrl}/meter-details`,
3783
+ jumpTo: `${baseUrl}/meter-details?kno=${kno}`,
3758
3784
  state: {
3759
3785
  ...flowState,
3786
+ kNumber: kno,
3787
+ kno,
3760
3788
  reviewData: searchData,
3761
3789
  edits
3762
3790
  }
@@ -3834,13 +3862,18 @@ const Review = () => {
3834
3862
  onChange: handleDeclaration,
3835
3863
  checked: agree
3836
3864
  })), /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
3837
- label: t("EKYC_REJECT"),
3838
- onSubmit: handleReject,
3839
- disabled: !agree
3840
- }), /*#__PURE__*/React.createElement(SubmitBar, {
3841
- label: t("EKYC_APPROVE"),
3842
- onSubmit: handleApprove,
3865
+ label: t("TAKE_ACTION_FOR_APPROVE_REJECT"),
3866
+ onSubmit: () => setShowOptions(prev => !prev),
3843
3867
  disabled: !agree
3868
+ }), showOptions && /*#__PURE__*/React.createElement(Menu, {
3869
+ options: options,
3870
+ optionKey: "action",
3871
+ t: t,
3872
+ onSelect: handleMenuSelect,
3873
+ style: {
3874
+ color: "#FFFFFF",
3875
+ fontSize: "18px"
3876
+ }
3844
3877
  }))), showPreview && /*#__PURE__*/React.createElement("div", {
3845
3878
  style: {
3846
3879
  position: "fixed",
@@ -3905,26 +3938,346 @@ const Review = () => {
3905
3938
  }, /*#__PURE__*/React.createElement("p", null, t("EKYC_DOCUMENT_PREVIEW_NOT_AVAILABLE")), /*#__PURE__*/React.createElement(LinkButton, {
3906
3939
  label: t("EKYC_OPEN_IN_NEW_TAB"),
3907
3940
  onClick: () => window.open(previewUrl, "_blank")
3908
- })))));
3941
+ })))), showToast && /*#__PURE__*/React.createElement(Toast, {
3942
+ error: toastData.error,
3943
+ label: toastData.label,
3944
+ onClose: () => setShowToast(false)
3945
+ }));
3909
3946
  };
3910
3947
 
3911
- var QueryClientContext = function () {
3912
- var context = /*#__PURE__*/React.createContext(undefined);
3913
- if (typeof window !== 'undefined') {
3914
- window.ReactQueryClientContext = context;
3948
+ const AadhaarVerificationConfig = (t, formData = {}, uploadFile, setDocumentId, documentId) => {
3949
+ var _formData$consumerTyp, _formData$occupantTyp;
3950
+ const consumerType = (formData === null || formData === void 0 ? void 0 : (_formData$consumerTyp = formData.consumerType) === null || _formData$consumerTyp === void 0 ? void 0 : _formData$consumerTyp.name) || (formData === null || formData === void 0 ? void 0 : formData.consumerType);
3951
+ const occupantType = (formData === null || formData === void 0 ? void 0 : (_formData$occupantTyp = formData.occupantType) === null || _formData$occupantTyp === void 0 ? void 0 : _formData$occupantTyp.name) || (formData === null || formData === void 0 ? void 0 : formData.occupantType);
3952
+ const informantIsConsumer = (formData === null || formData === void 0 ? void 0 : formData.informantIsConsumer) ?? true;
3953
+ const fields = [{
3954
+ label: t("Consumer Type"),
3955
+ isMandatory: true,
3956
+ type: "custom",
3957
+ key: "consumerType",
3958
+ populators: {
3959
+ name: "consumerType",
3960
+ component: props => /*#__PURE__*/React.createElement(Dropdown, {
3961
+ option: [{
3962
+ name: "Individual"
3963
+ }, {
3964
+ name: "Govt"
3965
+ }, {
3966
+ name: "Company_Society_Org"
3967
+ }],
3968
+ optionKey: "name",
3969
+ selected: props.value,
3970
+ select: props.onChange
3971
+ })
3972
+ }
3973
+ }, {
3974
+ label: t("Occupant Type"),
3975
+ isMandatory: true,
3976
+ type: "custom",
3977
+ key: "occupantType",
3978
+ populators: {
3979
+ name: "occupantType",
3980
+ component: props => /*#__PURE__*/React.createElement(Dropdown, {
3981
+ option: [{
3982
+ name: "Self"
3983
+ }, {
3984
+ name: "Tenanted"
3985
+ }],
3986
+ optionKey: "name",
3987
+ selected: props.value,
3988
+ select: props.onChange
3989
+ })
3990
+ }
3991
+ }, {
3992
+ label: t("Category Type"),
3993
+ isMandatory: true,
3994
+ type: "custom",
3995
+ key: "categoryType",
3996
+ populators: {
3997
+ name: "categoryType",
3998
+ component: props => /*#__PURE__*/React.createElement(Dropdown, {
3999
+ option: [{
4000
+ name: "Bulk"
4001
+ }, {
4002
+ name: "Non-Bulk"
4003
+ }],
4004
+ optionKey: "name",
4005
+ selected: props.value,
4006
+ select: props.onChange
4007
+ })
4008
+ }
4009
+ }, {
4010
+ label: t("First Name"),
4011
+ isMandatory: true,
4012
+ type: "text",
4013
+ populators: {
4014
+ name: "firstName",
4015
+ validation: {
4016
+ required: true
4017
+ }
4018
+ }
4019
+ }, {
4020
+ label: t("Middle Name"),
4021
+ isMandatory: false,
4022
+ type: "text",
4023
+ populators: {
4024
+ name: "middleName"
4025
+ }
4026
+ }, {
4027
+ label: t("Last Name"),
4028
+ isMandatory: false,
4029
+ type: "text",
4030
+ populators: {
4031
+ name: "lastName"
4032
+ }
4033
+ }, {
4034
+ label: t("Gender"),
4035
+ isMandatory: false,
4036
+ type: "custom",
4037
+ key: "gender",
4038
+ populators: {
4039
+ name: "gender",
4040
+ component: props => /*#__PURE__*/React.createElement(Dropdown, {
4041
+ option: [{
4042
+ name: "Male"
4043
+ }, {
4044
+ name: "Female"
4045
+ }, {
4046
+ name: "Others"
4047
+ }, {
4048
+ name: "Not prefer to say"
4049
+ }],
4050
+ optionKey: "name",
4051
+ selected: props.value,
4052
+ select: props.onChange
4053
+ })
4054
+ }
4055
+ }, {
4056
+ label: t("Parent/Spouse Name"),
4057
+ isMandatory: false,
4058
+ type: "text",
4059
+ populators: {
4060
+ name: "parentSpouseName"
4061
+ }
4062
+ }, {
4063
+ label: t("Mobile"),
4064
+ isMandatory: true,
4065
+ type: "text",
4066
+ populators: {
4067
+ name: "mobile",
4068
+ validation: {
4069
+ required: true,
4070
+ pattern: /^[6-9]\d{9}$/
4071
+ },
4072
+ error: t("Invalid mobile number")
4073
+ }
4074
+ }, {
4075
+ label: t("WhatsApp"),
4076
+ isMandatory: false,
4077
+ type: "text",
4078
+ populators: {
4079
+ name: "whatsapp"
4080
+ }
4081
+ }, {
4082
+ label: t("Email"),
4083
+ isMandatory: false,
4084
+ type: "text",
4085
+ populators: {
4086
+ name: "email",
4087
+ validation: {
4088
+ pattern: /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/
4089
+ },
4090
+ error: t("Invalid email address")
4091
+ }
4092
+ }, {
4093
+ label: t("No. of Residents"),
4094
+ isMandatory: true,
4095
+ type: "text",
4096
+ populators: {
4097
+ name: "residents",
4098
+ validation: {
4099
+ required: true,
4100
+ min: 1
4101
+ }
4102
+ }
4103
+ }, {
4104
+ label: t("Type of Identity"),
4105
+ isMandatory: true,
4106
+ type: "custom",
4107
+ key: "identityType",
4108
+ populators: {
4109
+ name: "identityType",
4110
+ component: props => /*#__PURE__*/React.createElement(Dropdown, {
4111
+ option: [{
4112
+ name: "Aadhaar Card"
4113
+ }, {
4114
+ name: "Driving License"
4115
+ }, {
4116
+ name: "Passport"
4117
+ }, {
4118
+ name: "Voter ID"
4119
+ }],
4120
+ optionKey: "name",
4121
+ selected: props.value,
4122
+ select: props.onChange
4123
+ })
4124
+ }
4125
+ }, {
4126
+ label: t("Proof of Identity"),
4127
+ isMandatory: false,
4128
+ type: "custom",
4129
+ key: "idFile",
4130
+ populators: {
4131
+ name: "idFile",
4132
+ component: props => /*#__PURE__*/React.createElement(UploadFile, {
4133
+ onUpload: e => uploadFile(e, props.onChange),
4134
+ onDelete: () => {
4135
+ props.onChange(null);
4136
+ setDocumentId(null);
4137
+ },
4138
+ message: props.value ? t("Uploaded") : t("No file selected")
4139
+ })
4140
+ }
4141
+ }, {
4142
+ label: t("Document Number"),
4143
+ isMandatory: false,
4144
+ type: "text",
4145
+ populators: {
4146
+ name: "documentNumber"
4147
+ }
4148
+ }, {
4149
+ label: t("Informant Is Consumer"),
4150
+ isMandatory: false,
4151
+ type: "custom",
4152
+ key: "informantIsConsumer",
4153
+ populators: {
4154
+ name: "informantIsConsumer",
4155
+ component: props => /*#__PURE__*/React.createElement(CheckBox, {
4156
+ label: t("Yes, the informant is the consumer"),
4157
+ checked: props.value ?? true,
4158
+ onChange: e => props.onChange(e.target.checked)
4159
+ })
4160
+ }
4161
+ }];
4162
+ if (!informantIsConsumer) {
4163
+ fields.push({
4164
+ label: t("Informant Name"),
4165
+ isMandatory: false,
4166
+ type: "text",
4167
+ populators: {
4168
+ name: "informantName"
4169
+ }
4170
+ }, {
4171
+ label: t("Informant Relation"),
4172
+ isMandatory: false,
4173
+ type: "text",
4174
+ populators: {
4175
+ name: "informantRelation"
4176
+ }
4177
+ });
3915
4178
  }
3916
- return context;
3917
- }();
3918
- function getQueryClientContext() {
3919
- var _ref;
3920
- return typeof window !== 'undefined' ? (_ref = window.ReactQueryClientContext) != null ? _ref : QueryClientContext : QueryClientContext;
3921
- }
3922
- var useQueryClient = function useQueryClient() {
3923
- var queryClient = React.useContext(getQueryClientContext());
3924
- if (!queryClient) {
3925
- throw new Error('No QueryClient set, use QueryClientProvider to set one');
4179
+ if (occupantType === "Tenanted") {
4180
+ fields.push({
4181
+ label: t("Document Proof"),
4182
+ isMandatory: false,
4183
+ type: "custom",
4184
+ key: "documentProof",
4185
+ populators: {
4186
+ name: "documentProof",
4187
+ component: props => /*#__PURE__*/React.createElement(UploadFile, {
4188
+ onUpload: e => uploadFile(e, props.onChange),
4189
+ onDelete: () => {
4190
+ props.onChange(null);
4191
+ setDocumentId(null);
4192
+ },
4193
+ message: props.value ? t("Uploaded") : t("No file selected")
4194
+ })
4195
+ }
4196
+ });
4197
+ if (!documentId) {
4198
+ fields.push({
4199
+ label: t("Owner Mobile"),
4200
+ isMandatory: true,
4201
+ type: "text",
4202
+ populators: {
4203
+ name: "ownerMobile",
4204
+ validation: {
4205
+ required: true,
4206
+ pattern: /^[6-9]\d{9}$/
4207
+ }
4208
+ }
4209
+ }, {
4210
+ label: t("Tenant Verification"),
4211
+ isMandatory: false,
4212
+ type: "text",
4213
+ populators: {
4214
+ name: "tenantVerification"
4215
+ }
4216
+ });
4217
+ }
4218
+ }
4219
+ if (consumerType === "Govt") {
4220
+ fields.push({
4221
+ label: t("Designation"),
4222
+ isMandatory: false,
4223
+ type: "text",
4224
+ populators: {
4225
+ name: "designation"
4226
+ }
4227
+ }, {
4228
+ label: t("Department"),
4229
+ isMandatory: false,
4230
+ type: "text",
4231
+ populators: {
4232
+ name: "department"
4233
+ }
4234
+ }, {
4235
+ label: t("Employee ID"),
4236
+ isMandatory: false,
4237
+ type: "text",
4238
+ populators: {
4239
+ name: "employeeId"
4240
+ }
4241
+ });
4242
+ }
4243
+ if (consumerType === "Company_Society_Org") {
4244
+ fields.push({
4245
+ label: t("Entity Name"),
4246
+ isMandatory: false,
4247
+ type: "text",
4248
+ populators: {
4249
+ name: "entityName"
4250
+ }
4251
+ }, {
4252
+ label: t("Contact Person"),
4253
+ isMandatory: false,
4254
+ type: "text",
4255
+ populators: {
4256
+ name: "contactPerson"
4257
+ }
4258
+ });
3926
4259
  }
3927
- return queryClient;
4260
+ fields.push({
4261
+ label: t("Consent"),
4262
+ isMandatory: true,
4263
+ type: "custom",
4264
+ key: "consent",
4265
+ populators: {
4266
+ name: "consent",
4267
+ validation: {
4268
+ required: true
4269
+ },
4270
+ component: props => /*#__PURE__*/React.createElement(CheckBox, {
4271
+ label: t("I hereby consent to verify my Aadhaar details."),
4272
+ checked: props.value ?? false,
4273
+ onChange: e => props.onChange(e.target.checked)
4274
+ })
4275
+ }
4276
+ });
4277
+ return [{
4278
+ head: t("EKYC_CONSUMER_CONNECTION"),
4279
+ body: fields
4280
+ }];
3928
4281
  };
3929
4282
 
3930
4283
  const AadhaarVerification = ({
@@ -3932,17 +4285,23 @@ const AadhaarVerification = ({
3932
4285
  onSelect,
3933
4286
  formData
3934
4287
  }) => {
4288
+ const {
4289
+ t
4290
+ } = useTranslation();
3935
4291
  const location = useLocation();
3936
4292
  const flowState = location.state || {};
3937
4293
  const tenantId = Digit.ULBService.getCurrentTenantId();
3938
- const searchKno = (flowState === null || flowState === void 0 ? void 0 : flowState.kNumber) || (flowState === null || flowState === void 0 ? void 0 : flowState.kno) || (formData === null || formData === void 0 ? void 0 : formData.kNumber) || (formData === null || formData === void 0 ? void 0 : formData.kno) || sessionStorage.getItem("EKYC_K_NUMBER");
4294
+ const queryParams = new URLSearchParams(location.search);
4295
+ const urlKno = queryParams.get("kno");
4296
+ const searchKno = urlKno || (flowState === null || flowState === void 0 ? void 0 : flowState.kNumber) || (flowState === null || flowState === void 0 ? void 0 : flowState.kno) || (formData === null || formData === void 0 ? void 0 : formData.kNumber) || (formData === null || formData === void 0 ? void 0 : formData.kno) || sessionStorage.getItem("EKYC_K_NUMBER") || "";
3939
4297
  const {
3940
4298
  isLoading,
3941
4299
  data: searchData
3942
4300
  } = Digit.Hooks.ekyc.useSearchConnection({
3943
4301
  tenantId,
3944
4302
  details: {
3945
- kno: searchKno
4303
+ kno: searchKno,
4304
+ fetchType: "CONNECTION"
3946
4305
  }
3947
4306
  }, {
3948
4307
  enabled: !!searchKno,
@@ -3950,297 +4309,277 @@ const AadhaarVerification = ({
3950
4309
  });
3951
4310
  const updateMutation = Digit.Hooks.ekyc.useEkycUpdate(tenantId);
3952
4311
  const savedData = (formData === null || formData === void 0 ? void 0 : formData.aadhaarVerification) || {};
3953
- const [kno, setKno] = useState(savedData.kno || searchKno || "");
3954
- const [consumerType, setConsumerType] = useState(savedData.consumerType ? {
3955
- name: savedData.consumerType
3956
- } : null);
3957
- const [occupantType, setOccupantType] = useState(savedData.occupantType ? {
3958
- name: savedData.occupantType
3959
- } : null);
3960
- const [categoryType, setCategoryType] = useState(savedData.categoryType ? {
3961
- name: savedData.categoryType
3962
- } : null);
3963
- const [consumerName, setConsumerName] = useState(savedData.consumerName || "");
3964
- const [firstName, setFirstName] = useState(savedData.firstName || "");
3965
- const [middleName, setMiddleName] = useState(savedData.middleName || "");
3966
- const [lastName, setLastName] = useState(savedData.lastName || "");
3967
- const [gender, setGender] = useState(savedData.gender ? {
3968
- name: savedData.gender
3969
- } : null);
3970
- const [parentSpouseName, setParentSpouseName] = useState(savedData.parentSpouseName || "");
3971
- const [relation, setRelation] = useState(savedData.relation || "");
3972
- const [mobile, setMobile] = useState(savedData.mobile || "");
3973
- const [whatsapp, setWhatsapp] = useState(savedData.whatsapp || "");
3974
- const [email, setEmail] = useState(savedData.email || "");
3975
- const [residents, setResidents] = useState(savedData.residents || "");
3976
- const [documentProof, setDocumentProof] = useState(savedData.documentProof || null);
3977
4312
  const [documentId, setDocumentId] = useState(savedData.documentId || null);
3978
- const [ownerMobile, setOwnerMobile] = useState(savedData.ownerMobile || "");
3979
- const [tenantVerification, setTenantVerification] = useState(savedData.tenantVerification || "");
3980
- const [designation, setDesignation] = useState(savedData.designation || "");
3981
- const [department, setDepartment] = useState(savedData.department || "");
3982
- const [employeeId, setEmployeeId] = useState(savedData.employeeId || "");
3983
- const [landline, setLandline] = useState(savedData.landline || "");
3984
- const [entityRelation, setEntityRelation] = useState(savedData.entityRelation || "");
3985
- const [contactPerson, setContactPerson] = useState(savedData.contactPerson || "");
3986
- const [entityName, setEntityName] = useState(savedData.entityName || "");
3987
- const [idProof, setIdProof] = useState(savedData.idProof ? {
3988
- name: savedData.idProof
3989
- } : null);
3990
- const [idNumber, setIdNumber] = useState(savedData.idNumber || "");
3991
- const [documentNumber, setDocumentNumber] = useState(savedData.documentNumber || "");
3992
- const [identityType, setIdentityType] = useState(savedData.identityType ? {
3993
- name: savedData.identityType
3994
- } : null);
3995
- const [idFile, setIdFile] = useState(savedData.idFile || null);
3996
- const [consent, setConsent] = useState(savedData.consent || false);
3997
- const [informantIsConsumer, setInformantIsConsumer] = useState(savedData.informantIsConsumer ?? true);
3998
- const [informantName, setInformantName] = useState(savedData.informantName || "");
3999
- const [informantRelation, setInformantRelation] = useState(savedData.informantRelation || "");
4313
+ const [documentProof, setDocumentProof] = useState(savedData.documentProof || null);
4000
4314
  const [toast, setToast] = useState(null);
4315
+ const [isDataLoaded, setIsDataLoaded] = useState(false);
4316
+ const [canSubmit, setCanSubmit] = useState(false);
4317
+ const [defaultValues, setDefaultValues] = useState(() => ({
4318
+ kno: savedData.kno || searchKno || "",
4319
+ consumerType: savedData.consumerType ? {
4320
+ name: savedData.consumerType
4321
+ } : null,
4322
+ occupantType: savedData.occupantType ? {
4323
+ name: savedData.occupantType
4324
+ } : null,
4325
+ categoryType: savedData.categoryType ? {
4326
+ name: savedData.categoryType
4327
+ } : null,
4328
+ firstName: savedData.firstName || "",
4329
+ middleName: savedData.middleName || "",
4330
+ lastName: savedData.lastName || "",
4331
+ gender: savedData.gender ? {
4332
+ name: savedData.gender
4333
+ } : null,
4334
+ parentSpouseName: savedData.parentSpouseName || "",
4335
+ mobile: savedData.mobile || "",
4336
+ whatsapp: savedData.whatsapp || "",
4337
+ email: savedData.email || "",
4338
+ residents: savedData.residents || "",
4339
+ identityType: savedData.identityType ? {
4340
+ name: savedData.identityType
4341
+ } : null,
4342
+ documentNumber: savedData.documentNumber || "",
4343
+ informantIsConsumer: savedData.informantIsConsumer ?? true,
4344
+ informantName: savedData.informantName || "",
4345
+ informantRelation: savedData.informantRelation || "",
4346
+ documentId: savedData.documentId || null,
4347
+ documentProof: savedData.documentProof || null,
4348
+ idFile: savedData.idFile || null,
4349
+ ownerMobile: savedData.ownerMobile || "",
4350
+ tenantVerification: savedData.tenantVerification || "",
4351
+ designation: savedData.designation || "",
4352
+ department: savedData.department || "",
4353
+ employeeId: savedData.employeeId || "",
4354
+ entityName: savedData.entityName || "",
4355
+ contactPerson: savedData.contactPerson || "",
4356
+ consent: savedData.consent || false
4357
+ }));
4358
+ const [localFormData, setLocalFormData] = useState(defaultValues);
4359
+ const extractApplicationData = searchData => {
4360
+ if (!searchData) return null;
4361
+ const reviewWrapper = (searchData === null || searchData === void 0 ? void 0 : searchData.applicationReviewInfo) || (searchData === null || searchData === void 0 ? void 0 : searchData.applicationReview) || searchData;
4362
+ const applicationData = (Array.isArray(reviewWrapper) ? reviewWrapper[0] : reviewWrapper) || {};
4363
+ return (applicationData === null || applicationData === void 0 ? void 0 : applicationData.newData) || applicationData;
4364
+ };
4001
4365
  useEffect(() => {
4002
- const rawData = searchData || (formData === null || formData === void 0 ? void 0 : formData.connectionDetails);
4366
+ const appData = extractApplicationData(searchData);
4367
+ const rawData = appData || (formData === null || formData === void 0 ? void 0 : formData.connectionDetails);
4003
4368
  const details = (rawData === null || rawData === void 0 ? void 0 : rawData.connectionDetails) || rawData || {};
4004
4369
  const addrDetails = (rawData === null || rawData === void 0 ? void 0 : rawData.addressDetails) || {};
4005
- if (details && Object.keys(details).length > 0 && !savedData.firstName) {
4006
- if (!kno && searchKno) setKno(searchKno);
4370
+ if (details && Object.keys(details).length > 0 && !isDataLoaded) {
4371
+ let fName = "";
4372
+ let mName = "";
4373
+ let lName = "";
4007
4374
  if (details.firstName) {
4008
- setFirstName(details.firstName);
4009
- if (details.middleName) setMiddleName(details.middleName);
4010
- if (details.lastName) setLastName(details.lastName);
4375
+ fName = details.firstName;
4376
+ mName = details.middleName || "";
4377
+ lName = details.lastName || "";
4011
4378
  } else if (details.consumerName) {
4012
- setConsumerName(details.consumerName);
4013
4379
  const parts = details.consumerName.trim().split(/\s+/);
4014
- setFirstName(parts[0] || "");
4015
- if (parts.length === 2) setLastName(parts[1]);
4380
+ fName = parts[0] || "";
4381
+ if (parts.length === 2) lName = parts[1];
4016
4382
  if (parts.length > 2) {
4017
- setMiddleName(parts.slice(1, -1).join(" "));
4018
- setLastName(parts[parts.length - 1]);
4383
+ mName = parts.slice(1, -1).join(" ");
4384
+ lName = parts[parts.length - 1];
4019
4385
  }
4020
4386
  }
4021
- if (details.phoneNumber || addrDetails.mobileNo) setMobile(details.phoneNumber || addrDetails.mobileNo);
4022
- if (details.email || addrDetails.email) setEmail(details.email || addrDetails.email);
4023
- if (addrDetails.whatsappNo) setWhatsapp(addrDetails.whatsappNo);
4024
- if (addrDetails.noOfPerson) setResidents(String(addrDetails.noOfPerson));
4025
- if (details.consumerType) setConsumerType({
4026
- name: details.consumerType
4027
- });
4028
- if (details.occupantType) setOccupantType({
4029
- name: details.occupantType
4030
- });
4031
- if (details.gender) setGender({
4032
- name: details.gender
4033
- });
4034
- if (details.parentSpouse) setParentSpouseName(details.parentSpouse);
4035
- if (details.documentNumber) {
4036
- setDocumentId(details.documentNumber);
4037
- setIdNumber(details.documentNumber);
4387
+ const updatedDefaults = {
4388
+ kno: savedData.kno || searchKno || "",
4389
+ consumerType: savedData.consumerType ? {
4390
+ name: savedData.consumerType
4391
+ } : details.consumerType ? {
4392
+ name: details.consumerType
4393
+ } : null,
4394
+ occupantType: savedData.occupantType ? {
4395
+ name: savedData.occupantType
4396
+ } : details.occupantType ? {
4397
+ name: details.occupantType
4398
+ } : null,
4399
+ categoryType: savedData.categoryType ? {
4400
+ name: savedData.categoryType
4401
+ } : null,
4402
+ firstName: savedData.firstName || fName,
4403
+ middleName: savedData.middleName || mName,
4404
+ lastName: savedData.lastName || lName,
4405
+ gender: savedData.gender ? {
4406
+ name: savedData.gender
4407
+ } : details.gender ? {
4408
+ name: details.gender
4409
+ } : null,
4410
+ parentSpouseName: savedData.parentSpouseName || details.parentSpouse || "",
4411
+ mobile: savedData.mobile || details.phoneNumber || addrDetails.mobileNo || "",
4412
+ whatsapp: savedData.whatsapp || addrDetails.whatsappNo || "",
4413
+ email: savedData.email || details.email || addrDetails.email || "",
4414
+ residents: savedData.residents || (addrDetails.noOfPerson ? String(addrDetails.noOfPerson) : ""),
4415
+ identityType: savedData.identityType ? {
4416
+ name: savedData.identityType
4417
+ } : null,
4418
+ documentNumber: savedData.documentNumber || "",
4419
+ informantIsConsumer: savedData.informantIsConsumer ?? true,
4420
+ informantName: savedData.informantName || details.informantName || "",
4421
+ informantRelation: savedData.informantRelation || details.informantRelation || "",
4422
+ documentId: savedData.documentId || details.documentNumber || null,
4423
+ documentProof: savedData.documentProof || null,
4424
+ idFile: savedData.idFile || null,
4425
+ ownerMobile: savedData.ownerMobile || "",
4426
+ tenantVerification: savedData.tenantVerification || "",
4427
+ designation: savedData.designation || "",
4428
+ department: savedData.department || "",
4429
+ employeeId: savedData.employeeId || "",
4430
+ entityName: savedData.entityName || "",
4431
+ contactPerson: savedData.contactPerson || "",
4432
+ consent: savedData.consent || false
4433
+ };
4434
+ setDefaultValues(updatedDefaults);
4435
+ setLocalFormData(updatedDefaults);
4436
+ if (updatedDefaults.documentId) {
4437
+ setDocumentId(updatedDefaults.documentId);
4038
4438
  }
4039
- if (details.informantName) setInformantName(details.informantName);
4040
- if (details.informantRelation) setInformantRelation(details.informantRelation);
4439
+ if (updatedDefaults.documentProof) {
4440
+ setDocumentProof(updatedDefaults.documentProof);
4441
+ }
4442
+ setIsDataLoaded(true);
4041
4443
  }
4042
- }, [searchData, formData === null || formData === void 0 ? void 0 : formData.connectionDetails, searchKno]);
4043
- const consumerTypeOptions = [{
4044
- name: "Individual"
4045
- }, {
4046
- name: "Govt"
4047
- }, {
4048
- name: "Company_Society_Org"
4049
- }];
4050
- const occupantOptions = [{
4051
- name: "Self"
4052
- }, {
4053
- name: "Tenanted"
4054
- }];
4055
- const genderOptions = [{
4056
- name: "Male"
4057
- }, {
4058
- name: "Female"
4059
- }, {
4060
- name: "Others"
4061
- }, {
4062
- name: "Not prefer to say"
4063
- }];
4064
- const identityTypeOptions = [{
4065
- name: "Aadhaar Card"
4066
- }, {
4067
- name: "Driving License"
4068
- }, {
4069
- name: "Passport"
4070
- }, {
4071
- name: "Voter ID"
4072
- }];
4073
- const uploadFile = async (e, setter, idSetter) => {
4444
+ }, [searchData, formData === null || formData === void 0 ? void 0 : formData.connectionDetails, isDataLoaded]);
4445
+ const handleUploadProof = async (e, onChange) => {
4074
4446
  const file = e.target.files[0];
4075
4447
  if (!file) return;
4448
+ if (file.size > 2000000) {
4449
+ setToast({
4450
+ type: "error",
4451
+ message: t("Max size 2MB exceeded")
4452
+ });
4453
+ return;
4454
+ }
4076
4455
  try {
4077
4456
  var _res$data, _res$data$files, _res$data$files$;
4078
- const res = await Digit.UploadServices.Filestorage("EKYC", file);
4079
- const id = res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$files = _res$data.files) === null || _res$data$files === void 0 ? void 0 : (_res$data$files$ = _res$data$files[0]) === null || _res$data$files$ === void 0 ? void 0 : _res$data$files$.fileStoreId;
4080
- if (id) {
4081
- setter(file.name);
4082
- idSetter(id);
4457
+ const res = await Digit.UploadServices.Filestorage("EKYC", file, tenantId);
4458
+ const fileStoreId = res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$files = _res$data.files) === null || _res$data$files === void 0 ? void 0 : (_res$data$files$ = _res$data$files[0]) === null || _res$data$files$ === void 0 ? void 0 : _res$data$files$.fileStoreId;
4459
+ if (fileStoreId) {
4460
+ onChange(file.name);
4461
+ setDocumentProof(file.name);
4462
+ setDocumentId(fileStoreId);
4463
+ setToast({
4464
+ type: "success",
4465
+ message: t("Upload successful")
4466
+ });
4083
4467
  }
4084
4468
  } catch {
4085
4469
  setToast({
4086
4470
  type: "error",
4087
- message: "Upload failed"
4471
+ message: t("Upload failed")
4088
4472
  });
4089
4473
  }
4090
4474
  };
4091
- const isValid = () => {
4092
- if (!kno) return false;
4093
- if (!consumerType) return false;
4094
- if (!occupantType) return false;
4095
- if (!categoryType) return false;
4096
- if (!firstName) return false;
4097
- if (!mobile) return false;
4098
- if (!residents || Number(residents) <= 0) return false;
4099
- if ((occupantType === null || occupantType === void 0 ? void 0 : occupantType.name) === "Tenanted" && !documentId && !ownerMobile) return false;
4100
- return consent;
4475
+ const onFormValueChange = (setValue, data) => {
4476
+ var _data$consumerType, _localFormData$consum, _data$occupantType, _localFormData$occupa;
4477
+ const consumerTypeChanged = ((data === null || data === void 0 ? void 0 : (_data$consumerType = data.consumerType) === null || _data$consumerType === void 0 ? void 0 : _data$consumerType.name) || (data === null || data === void 0 ? void 0 : data.consumerType)) !== ((localFormData === null || localFormData === void 0 ? void 0 : (_localFormData$consum = localFormData.consumerType) === null || _localFormData$consum === void 0 ? void 0 : _localFormData$consum.name) || (localFormData === null || localFormData === void 0 ? void 0 : localFormData.consumerType));
4478
+ const occupantTypeChanged = ((data === null || data === void 0 ? void 0 : (_data$occupantType = data.occupantType) === null || _data$occupantType === void 0 ? void 0 : _data$occupantType.name) || (data === null || data === void 0 ? void 0 : data.occupantType)) !== ((localFormData === null || localFormData === void 0 ? void 0 : (_localFormData$occupa = localFormData.occupantType) === null || _localFormData$occupa === void 0 ? void 0 : _localFormData$occupa.name) || (localFormData === null || localFormData === void 0 ? void 0 : localFormData.occupantType));
4479
+ const informantIsConsumerChanged = (data === null || data === void 0 ? void 0 : data.informantIsConsumer) !== (localFormData === null || localFormData === void 0 ? void 0 : localFormData.informantIsConsumer);
4480
+ if (consumerTypeChanged || occupantTypeChanged || informantIsConsumerChanged) {
4481
+ setLocalFormData(prev => ({
4482
+ ...prev,
4483
+ ...data
4484
+ }));
4485
+ }
4486
+ const knoVal = (data === null || data === void 0 ? void 0 : data.kno) || searchKno;
4487
+ const consumerTypeVal = data === null || data === void 0 ? void 0 : data.consumerType;
4488
+ const occupantTypeVal = data === null || data === void 0 ? void 0 : data.occupantType;
4489
+ const categoryTypeVal = data === null || data === void 0 ? void 0 : data.categoryType;
4490
+ const firstNameVal = data === null || data === void 0 ? void 0 : data.firstName;
4491
+ const mobileVal = data === null || data === void 0 ? void 0 : data.mobile;
4492
+ const residentsVal = data === null || data === void 0 ? void 0 : data.residents;
4493
+ const consentVal = data === null || data === void 0 ? void 0 : data.consent;
4494
+ const docId = (data === null || data === void 0 ? void 0 : data.documentId) || documentId;
4495
+ const ownerMobileVal = data === null || data === void 0 ? void 0 : data.ownerMobile;
4496
+ let valid = true;
4497
+ if (!knoVal) valid = false;
4498
+ if (!consumerTypeVal) valid = false;
4499
+ if (!occupantTypeVal) valid = false;
4500
+ if (!categoryTypeVal) valid = false;
4501
+ if (!firstNameVal) valid = false;
4502
+ if (!mobileVal || !/^[6-9]\d{9}$/.test(mobileVal)) valid = false;
4503
+ if (!residentsVal || Number(residentsVal) <= 0) valid = false;
4504
+ if ((occupantTypeVal === null || occupantTypeVal === void 0 ? void 0 : occupantTypeVal.name) === "Tenanted" && !docId && !ownerMobileVal) valid = false;
4505
+ if (!consentVal) valid = false;
4506
+ if (valid !== canSubmit) {
4507
+ setCanSubmit(valid);
4508
+ }
4101
4509
  };
4102
- const onStepSelect = async () => {
4103
- const data = {
4104
- kno,
4105
- consumerType: consumerType === null || consumerType === void 0 ? void 0 : consumerType.name,
4106
- occupantType: occupantType === null || occupantType === void 0 ? void 0 : occupantType.name,
4107
- categoryType: categoryType === null || categoryType === void 0 ? void 0 : categoryType.name,
4108
- consumerName,
4109
- firstName,
4110
- middleName,
4111
- lastName,
4112
- gender: gender === null || gender === void 0 ? void 0 : gender.name,
4113
- parentSpouseName,
4114
- relation,
4115
- mobile,
4116
- whatsapp,
4117
- email,
4118
- residents,
4119
- documentId,
4120
- ownerMobile,
4121
- tenantVerification,
4122
- designation,
4123
- department,
4124
- employeeId,
4125
- landline,
4126
- entityRelation,
4127
- contactPerson,
4128
- entityName,
4129
- idProof: idProof === null || idProof === void 0 ? void 0 : idProof.name,
4130
- idNumber,
4131
- consent,
4132
- informantIsConsumer,
4133
- informantName,
4134
- informantRelation
4510
+ const onSubmit = async data => {
4511
+ var _data$consumerType2, _data$occupantType2, _data$categoryType, _data$gender, _data$identityType;
4512
+ const submitData = {
4513
+ kno: data.kno || searchKno,
4514
+ consumerType: ((_data$consumerType2 = data.consumerType) === null || _data$consumerType2 === void 0 ? void 0 : _data$consumerType2.name) || data.consumerType,
4515
+ occupantType: ((_data$occupantType2 = data.occupantType) === null || _data$occupantType2 === void 0 ? void 0 : _data$occupantType2.name) || data.occupantType,
4516
+ categoryType: ((_data$categoryType = data.categoryType) === null || _data$categoryType === void 0 ? void 0 : _data$categoryType.name) || data.categoryType,
4517
+ consumerName: data.consumerName || `${data.firstName || ""} ${data.middleName || ""} ${data.lastName || ""}`.trim(),
4518
+ firstName: data.firstName,
4519
+ middleName: data.middleName,
4520
+ lastName: data.lastName,
4521
+ gender: ((_data$gender = data.gender) === null || _data$gender === void 0 ? void 0 : _data$gender.name) || data.gender,
4522
+ parentSpouseName: data.parentSpouseName,
4523
+ relation: data.relation || savedData.relation || "",
4524
+ mobile: data.mobile,
4525
+ whatsapp: data.whatsapp,
4526
+ email: data.email,
4527
+ residents: data.residents,
4528
+ documentId: documentId,
4529
+ documentProof: documentProof,
4530
+ ownerMobile: data.ownerMobile,
4531
+ tenantVerification: data.tenantVerification,
4532
+ designation: data.designation,
4533
+ department: data.department,
4534
+ employeeId: data.employeeId,
4535
+ landline: data.landline || savedData.landline || "",
4536
+ entityRelation: data.entityRelation || savedData.entityRelation || "",
4537
+ contactPerson: data.contactPerson,
4538
+ entityName: data.entityName,
4539
+ idProof: ((_data$identityType = data.identityType) === null || _data$identityType === void 0 ? void 0 : _data$identityType.name) || data.identityType,
4540
+ idNumber: data.documentNumber,
4541
+ consent: data.consent,
4542
+ informantIsConsumer: data.informantIsConsumer ?? true,
4543
+ informantName: data.informantName,
4544
+ informantRelation: data.informantRelation
4135
4545
  };
4136
4546
  try {
4137
4547
  await updateMutation.mutateAsync({
4138
4548
  RequestInfo: {},
4139
4549
  updateType: "CONSUMER",
4140
- ...data
4550
+ ...submitData
4141
4551
  });
4142
4552
  setToast({
4143
4553
  type: "success",
4144
- message: "Data updated successfully!"
4554
+ message: t("Data updated successfully!")
4145
4555
  });
4146
- onSelect(config.key, data);
4556
+ onSelect(config.key, submitData);
4147
4557
  } catch (error) {
4148
4558
  setToast({
4149
4559
  type: "error",
4150
- message: "Failed to update consumer details"
4560
+ message: t("Failed to update consumer details")
4151
4561
  });
4152
4562
  }
4153
4563
  };
4154
4564
  if (isLoading) {
4155
4565
  return /*#__PURE__*/React.createElement(Loader, null);
4156
4566
  }
4157
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(FormStep, {
4158
- onSelect: onStepSelect,
4159
- config: config,
4160
- isDisabled: !isValid()
4161
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Consumer Type *"), /*#__PURE__*/React.createElement(Dropdown, {
4162
- option: consumerTypeOptions,
4163
- selected: consumerType,
4164
- select: setConsumerType
4165
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Occupant Type *"), /*#__PURE__*/React.createElement(Dropdown, {
4166
- option: occupantOptions,
4167
- selected: occupantType,
4168
- select: setOccupantType
4169
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Category Type *"), /*#__PURE__*/React.createElement(Dropdown, {
4170
- option: [],
4171
- selected: categoryType,
4172
- select: setCategoryType
4173
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "First Name *"), /*#__PURE__*/React.createElement(TextInput, {
4174
- value: firstName,
4175
- onChange: e => setFirstName(e.target.value)
4176
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Middle Name"), /*#__PURE__*/React.createElement(TextInput, {
4177
- value: middleName,
4178
- onChange: e => setMiddleName(e.target.value)
4179
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Last Name"), /*#__PURE__*/React.createElement(TextInput, {
4180
- value: lastName,
4181
- onChange: e => setLastName(e.target.value)
4182
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Gender"), /*#__PURE__*/React.createElement(Dropdown, {
4183
- option: genderOptions,
4184
- selected: gender,
4185
- select: setGender
4186
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Parent/Spouse Name "), /*#__PURE__*/React.createElement(TextInput, {
4187
- value: parentSpouseName,
4188
- onChange: e => setParentSpouseName(e.target.value)
4189
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Mobile *"), /*#__PURE__*/React.createElement(TextInput, {
4190
- value: mobile,
4191
- onChange: e => setMobile(e.target.value)
4192
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "WhatsApp"), /*#__PURE__*/React.createElement(TextInput, {
4193
- value: whatsapp,
4194
- onChange: e => setWhatsapp(e.target.value)
4195
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Email"), /*#__PURE__*/React.createElement(TextInput, {
4196
- value: email,
4197
- onChange: e => setEmail(e.target.value)
4198
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "No. of Residents *"), /*#__PURE__*/React.createElement(TextInput, {
4199
- value: residents,
4200
- onChange: e => setResidents(e.target.value)
4201
- })), /*#__PURE__*/React.createElement("div", null, console.log("identityType", identityType), /*#__PURE__*/React.createElement(CardLabel, null, "Type of Identity *"), /*#__PURE__*/React.createElement(Dropdown, {
4202
- option: identityTypeOptions,
4203
- selected: identityType,
4204
- select: setIdentityType
4205
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Proof of Identity"), /*#__PURE__*/React.createElement(UploadFile, {
4206
- onUpload: e => uploadFile(e, setDocumentProof, setDocumentId)
4207
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Document Number"), /*#__PURE__*/React.createElement(TextInput, {
4208
- value: documentNumber,
4209
- onChange: e => setDocumentNumber(e.target.value)
4210
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Informant Is Consumer"), /*#__PURE__*/React.createElement(CheckBox, {
4211
- label: "Yes, the informant is the consumer",
4212
- checked: informantIsConsumer,
4213
- onChange: e => setInformantIsConsumer(e.target.checked)
4214
- })), !informantIsConsumer && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Informant Name"), /*#__PURE__*/React.createElement(TextInput, {
4215
- value: informantName,
4216
- onChange: e => setInformantName(e.target.value)
4217
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Informant Relation"), /*#__PURE__*/React.createElement(TextInput, {
4218
- value: informantRelation,
4219
- onChange: e => setInformantRelation(e.target.value)
4220
- }))), (occupantType === null || occupantType === void 0 ? void 0 : occupantType.name) === "Tenanted" && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Document Proof"), /*#__PURE__*/React.createElement(UploadFile, {
4221
- onUpload: e => uploadFile(e, setDocumentProof, setDocumentId)
4222
- })), !documentId && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Owner Mobile *"), /*#__PURE__*/React.createElement(TextInput, {
4223
- value: ownerMobile,
4224
- onChange: e => setOwnerMobile(e.target.value)
4225
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Tenant Verification"), /*#__PURE__*/React.createElement(TextInput, {
4226
- value: tenantVerification,
4227
- onChange: e => setTenantVerification(e.target.value)
4228
- })))), (consumerType === null || consumerType === void 0 ? void 0 : consumerType.name) === "Govt" && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Designation"), /*#__PURE__*/React.createElement(TextInput, {
4229
- value: designation,
4230
- onChange: e => setDesignation(e.target.value)
4231
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Department"), /*#__PURE__*/React.createElement(TextInput, {
4232
- value: department,
4233
- onChange: e => setDepartment(e.target.value)
4234
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Employee ID"), /*#__PURE__*/React.createElement(TextInput, {
4235
- value: employeeId,
4236
- onChange: e => setEmployeeId(e.target.value)
4237
- }))), (consumerType === null || consumerType === void 0 ? void 0 : consumerType.name) === "Company_Society_Org" && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Entity Name"), /*#__PURE__*/React.createElement(TextInput, {
4238
- value: entityName,
4239
- onChange: e => setEntityName(e.target.value)
4240
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Contact Person"), /*#__PURE__*/React.createElement(TextInput, {
4241
- value: contactPerson,
4242
- onChange: e => setContactPerson(e.target.value)
4243
- })))), toast && /*#__PURE__*/React.createElement(Toast, {
4567
+ const Config = AadhaarVerificationConfig(t, localFormData, handleUploadProof, setDocumentId, documentId);
4568
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(FormComposer, {
4569
+ key: isDataLoaded ? "loaded" : "loading",
4570
+ isDisabled: !canSubmit,
4571
+ label: t("ES_COMMON_CONTINUE"),
4572
+ config: Config.map(item => ({
4573
+ ...item,
4574
+ isCollapsible: true,
4575
+ isDefaultOpen: true
4576
+ })),
4577
+ onSubmit: onSubmit,
4578
+ defaultValues: defaultValues,
4579
+ onFormValueChange: onFormValueChange,
4580
+ noCard: false,
4581
+ submitInForm: true
4582
+ }), toast && /*#__PURE__*/React.createElement(Toast, {
4244
4583
  error: toast.type === "error",
4245
4584
  label: toast.message,
4246
4585
  onClose: () => setToast(null)
@@ -4265,6 +4604,7 @@ const ekycConfig = [{
4265
4604
  component: "AddressDetails",
4266
4605
  key: "addressDetails",
4267
4606
  doorImage: true,
4607
+ showMapActualLocation: false,
4268
4608
  texts: {
4269
4609
  header: "EKYC_ADDRESS_DETAILS",
4270
4610
  submitBarLabel: "COMMON_SAVE_NEXT"
@@ -4303,7 +4643,6 @@ const ekycConfig = [{
4303
4643
  const EKYCForm = ({
4304
4644
  path: passedPath
4305
4645
  }) => {
4306
- const queryClient = useQueryClient();
4307
4646
  const match = useRouteMatch();
4308
4647
  const {
4309
4648
  t
@@ -4314,9 +4653,7 @@ const EKYCForm = ({
4314
4653
  } = location;
4315
4654
  const history = useHistory();
4316
4655
  let config = [];
4317
- const [params, setParams, clearParams] = Digit.Hooks.useSessionStorage("EKYC_CREATE", {});
4318
- const userInfo = Digit.UserService.getUser();
4319
- const tenantId = Digit.ULBService.getCurrentTenantId();
4656
+ const [params, setParams] = Digit.Hooks.useSessionStorage("EKYC_CREATE", {});
4320
4657
  useEffect(() => {
4321
4658
  if (location.state && Object.keys(location.state).length > 0) {
4322
4659
  const {
@@ -4343,7 +4680,7 @@ const EKYCForm = ({
4343
4680
  if (skipStep) {
4344
4681
  redirectWithHistory = history.replace;
4345
4682
  }
4346
- const base = passedPath || match.path.split('/').slice(0, -1).join('/');
4683
+ const base = passedPath || match.path.split("/").slice(0, -1).join("/");
4347
4684
  if (nextStep === null) {
4348
4685
  return redirectWithHistory(`${base}/review`, {
4349
4686
  ...params,
@@ -4354,17 +4691,17 @@ const EKYCForm = ({
4354
4691
  ...params
4355
4692
  });
4356
4693
  };
4357
- function handleSelect(key, data, skipStep, index, isAddMultiple = false) {
4358
- setParams({
4359
- ...params,
4360
- ...{
4361
- [key]: {
4362
- ...params[key],
4363
- ...data
4364
- }
4694
+ function handleSelect(key, data, skipStep, index, isAddMultiple = false, silent = false) {
4695
+ setParams(prev => ({
4696
+ ...prev,
4697
+ [key]: {
4698
+ ...params[key],
4699
+ ...data
4365
4700
  }
4366
- });
4367
- goNext(skipStep, index, isAddMultiple, key);
4701
+ }));
4702
+ if (!silent) {
4703
+ goNext(skipStep, index, isAddMultiple, key);
4704
+ }
4368
4705
  }
4369
4706
  ekycConfig.forEach(obj => {
4370
4707
  config = config.concat(obj.body);
@@ -4392,13 +4729,12 @@ const EKYCForm = ({
4392
4729
  }), /*#__PURE__*/React.createElement("div", {
4393
4730
  className: "employee-form-section"
4394
4731
  }, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(Route, {
4395
- path: formStepRoutes.map(route => `${passedPath || match.path.split('/').slice(0, -1).join('/')}/${route}`)
4732
+ path: formStepRoutes.map(route => `${passedPath || match.path.split("/").slice(0, -1).join("/")}/${route}`)
4396
4733
  }, /*#__PURE__*/React.createElement("div", {
4397
4734
  className: "single-page-form-container"
4398
4735
  }, config.map((routeObj, index) => {
4399
4736
  const {
4400
- component,
4401
- key
4737
+ component
4402
4738
  } = routeObj;
4403
4739
  const Component = typeof component === "string" ? Digit.ComponentRegistryService.getComponent(component) : component;
4404
4740
  return /*#__PURE__*/React.createElement("div", {
@@ -4416,13 +4752,14 @@ const EKYCForm = ({
4416
4752
  formData: params
4417
4753
  }));
4418
4754
  }))), /*#__PURE__*/React.createElement(Route, null, /*#__PURE__*/React.createElement(Redirect, {
4419
- to: `${passedPath || match.path.split('/').slice(0, -1).join('/')}/${config.indexRoute}`
4755
+ to: `${passedPath || match.path.split("/").slice(0, -1).join("/")}/${config.indexRoute}`
4420
4756
  }))))));
4421
4757
  };
4422
4758
 
4423
4759
  const AssignEkycModal = ({
4424
4760
  surveyor,
4425
- closeModal
4761
+ closeModal,
4762
+ refetchDashboard
4426
4763
  }) => {
4427
4764
  const [selectedKnos, setSelectedKnos] = useState([]);
4428
4765
  const [isBulkSelection, setIsBulkSelection] = useState(false);
@@ -4500,7 +4837,8 @@ const AssignEkycModal = ({
4500
4837
  label: "Assignment successful"
4501
4838
  });
4502
4839
  setShowToast(true);
4503
- setTimeout(() => {
4840
+ setTimeout(async () => {
4841
+ await refetchDashboard();
4504
4842
  closeModal();
4505
4843
  }, 1000);
4506
4844
  },
@@ -4657,34 +4995,7 @@ const AssignEkycModal = ({
4657
4995
  placeholder: "Zone",
4658
4996
  value: filters.zoneName,
4659
4997
  onChange: e => handleFilterChange("zoneName", e.target.value)
4660
- }), /*#__PURE__*/React.createElement("input", {
4661
- className: "form-control",
4662
- placeholder: "Ward",
4663
- value: filters.ward,
4664
- onChange: e => handleFilterChange("ward", e.target.value)
4665
- }), /*#__PURE__*/React.createElement("input", {
4666
- className: "form-control",
4667
- placeholder: "Assembly",
4668
- value: filters.assembly,
4669
- onChange: e => handleFilterChange("assembly", e.target.value)
4670
- }), /*#__PURE__*/React.createElement("input", {
4671
- className: "form-control",
4672
- placeholder: "MR Key",
4673
- value: filters.mrkey,
4674
- onChange: e => handleFilterChange("mrkey", e.target.value)
4675
- }), /*#__PURE__*/React.createElement("select", {
4676
- className: "form-control",
4677
- value: filters.ekycStatus,
4678
- onChange: e => handleFilterChange("ekycStatus", e.target.value)
4679
- }, /*#__PURE__*/React.createElement("option", {
4680
- value: ""
4681
- }, "All eKYC Status"), /*#__PURE__*/React.createElement("option", {
4682
- value: "PENDING"
4683
- }, "Pending"), /*#__PURE__*/React.createElement("option", {
4684
- value: "APPROVED"
4685
- }, "Approved"), /*#__PURE__*/React.createElement("option", {
4686
- value: "REJECTED"
4687
- }, "Rejected"))), /*#__PURE__*/React.createElement(Table, {
4998
+ })), /*#__PURE__*/React.createElement(Table, {
4688
4999
  tableTitle: "eKYC Applications",
4689
5000
  tableClass: "ekycTable",
4690
5001
  data: tableData,
@@ -4722,8 +5033,79 @@ const AssignEkycModal = ({
4722
5033
  }));
4723
5034
  };
4724
5035
 
5036
+ const downloadSurveyorPDF = async ({
5037
+ rows,
5038
+ surveyorName,
5039
+ employeeId,
5040
+ mobileNumber,
5041
+ vendorName,
5042
+ supervisorName,
5043
+ dashboardInfo,
5044
+ t
5045
+ }) => {
5046
+ const tenantId = Digit.ULBService.getCurrentTenantId();
5047
+ const initData = Digit.SessionStorage.get("initData");
5048
+ const tenants = (initData === null || initData === void 0 ? void 0 : initData.tenants) || [];
5049
+ const tenantInfo = tenants.find(tenant => tenant.code === tenantId);
5050
+ const name = "Delhi Jal Board";
5051
+ const email = "contact@delhijalboard.nic.in";
5052
+ const phoneNumber = "+91-11-23538416";
5053
+ const details = [{
5054
+ title: t("SURVEYOR_DETAILS"),
5055
+ asSectionHeader: true,
5056
+ values: [{
5057
+ title: t("SURVEYOR_NAME"),
5058
+ value: surveyorName
5059
+ }, {
5060
+ title: t("EMPLOYEE_ID"),
5061
+ value: employeeId
5062
+ }, {
5063
+ title: t("MOBILE_NUMBER"),
5064
+ value: mobileNumber
5065
+ }, {
5066
+ title: t("VENDOR_NAME"),
5067
+ value: vendorName
5068
+ }, {
5069
+ title: t("SUPERVISOR_NAME"),
5070
+ value: supervisorName
5071
+ }].filter(item => item.value)
5072
+ }, {
5073
+ title: t("SUMMARY_STATISTICS"),
5074
+ asSectionHeader: true,
5075
+ values: [{
5076
+ title: t("TOTAL_ASSIGNED"),
5077
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.total) || 0
5078
+ }, {
5079
+ title: t("COMPLETED"),
5080
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.completed) || 0
5081
+ }, {
5082
+ title: t("PENDING"),
5083
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.pending) || 0
5084
+ }, {
5085
+ title: t("SUBMITTED"),
5086
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.submittedCount) || 0
5087
+ }].filter(item => item.value)
5088
+ }];
5089
+ if (window.Digit && window.Digit.Utils && window.Digit.Utils.pdf && window.Digit.Utils.pdf.generateSurveyorReport) {
5090
+ window.Digit.Utils.pdf.generateSurveyorReport({
5091
+ tenantId,
5092
+ logo: null,
5093
+ name,
5094
+ email,
5095
+ phoneNumber,
5096
+ heading: t("EKYC_SURVEYOR_REPORT"),
5097
+ details,
5098
+ applicationNumber: employeeId,
5099
+ rows,
5100
+ t
5101
+ });
5102
+ } else {
5103
+ console.error("Digit.Utils.pdf.generateSurveyorReport is not available");
5104
+ }
5105
+ };
5106
+
4725
5107
  const SurveyorDetailsDashboard = () => {
4726
- var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _Digit$SessionStorage4, _surveyor$owner, _surveyor$owner2, _surveyor$owner3, _fullName$charAt, _dashboardData$dashbo, _dashboardData$dashbo2, _dashboardData$dashbo3, _dashboardData$dashbo4, _surveyor$owner4, _surveyor$owner5, _surveyor$owner6, _surveyor$additionalD, _dashboardData$dashbo5, _dashboardData$dashbo6;
5108
+ 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;
4727
5109
  const tenantId = Digit.ULBService.getCurrentTenantId();
4728
5110
  const [showModal, setShowModal] = useState(false);
4729
5111
  const [showOptions, setShowOptions] = useState(false);
@@ -4750,13 +5132,48 @@ const SurveyorDetailsDashboard = () => {
4750
5132
  var _surveyorSearchRespon;
4751
5133
  return (surveyorSearchResponse === null || surveyorSearchResponse === void 0 ? void 0 : (_surveyorSearchRespon = surveyorSearchResponse.surveyors) === null || _surveyorSearchRespon === void 0 ? void 0 : _surveyorSearchRespon[0]) || null;
4752
5134
  }, [surveyorSearchResponse]);
5135
+ const {
5136
+ data: vendorData
5137
+ } = Digit.Hooks.fsm.useDsoSearch(tenantId, {
5138
+ status: "ACTIVE"
5139
+ }, {
5140
+ enabled: !!tenantId
5141
+ });
5142
+ const {
5143
+ data: supervisorSearchResponse
5144
+ } = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
5145
+ status: "ACTIVE"
5146
+ }, {
5147
+ enabled: !!tenantId
5148
+ });
5149
+ const vendorName = useMemo(() => {
5150
+ var _mappedVendor$dsoDeta;
5151
+ if (!vendorData || !(surveyor !== null && surveyor !== void 0 && surveyor.vendorId)) return "N/A";
5152
+ const mappedVendor = vendorData.find(v => {
5153
+ var _v$dsoDetails, _v$dsoDetails2;
5154
+ 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;
5155
+ });
5156
+ 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";
5157
+ }, [vendorData, surveyor === null || surveyor === void 0 ? void 0 : surveyor.vendorId]);
5158
+ const supervisorName = useMemo(() => {
5159
+ var _mappedSupervisor$own;
5160
+ if (!(supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors) || !(surveyor !== null && surveyor !== void 0 && surveyor.supervisorId)) return "N/A";
5161
+ const mappedSupervisor = supervisorSearchResponse.supervisors.find(s => {
5162
+ var _s$owner;
5163
+ return s.id === surveyor.supervisorId || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : _s$owner.uuid) === surveyor.supervisorId;
5164
+ });
5165
+ 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";
5166
+ }, [supervisorSearchResponse, surveyor === null || surveyor === void 0 ? void 0 : surveyor.supervisorId]);
5167
+ 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";
5168
+ 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);
5169
+ 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";
4753
5170
  const [currentPage, setCurrentPage] = useState(0);
4754
5171
  const [pageSize, setPageSize] = useState(20);
4755
5172
  const queryParams = {
4756
5173
  tenantId: "dl.djb",
4757
5174
  offset: currentPage * pageSize,
4758
5175
  limit: pageSize,
4759
- surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner = surveyor.owner) === null || _surveyor$owner === void 0 ? void 0 : _surveyor$owner.uuid
5176
+ surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner4 = surveyor.owner) === null || _surveyor$owner4 === void 0 ? void 0 : _surveyor$owner4.uuid
4760
5177
  };
4761
5178
  const {
4762
5179
  isFetching: isDashboardLoading,
@@ -4794,6 +5211,23 @@ const SurveyorDetailsDashboard = () => {
4794
5211
  value
4795
5212
  }) => value || "-"
4796
5213
  }], []);
5214
+ const [showReportMenu, setShowReportMenu] = useState(false);
5215
+ const [customDate, setCustomDate] = useState({
5216
+ from: "",
5217
+ to: ""
5218
+ });
5219
+ const [showCustomPicker, setShowCustomPicker] = useState(false);
5220
+ const reportMenuRef = useRef(null);
5221
+ useEffect(() => {
5222
+ const handler = e => {
5223
+ if (reportMenuRef.current && !reportMenuRef.current.contains(e.target)) {
5224
+ setShowReportMenu(false);
5225
+ setShowCustomPicker(false);
5226
+ }
5227
+ };
5228
+ document.addEventListener("mousedown", handler);
5229
+ return () => document.removeEventListener("mousedown", handler);
5230
+ }, []);
4797
5231
  if (isLoading) {
4798
5232
  return /*#__PURE__*/React.createElement(Loader, null);
4799
5233
  }
@@ -4839,6 +5273,83 @@ const SurveyorDetailsDashboard = () => {
4839
5273
  value: (surveyor === null || surveyor === void 0 ? void 0 : surveyor.rejectedCases) || 0,
4840
5274
  color: "#EF4444"
4841
5275
  }];
5276
+ const getDateRange = filter => {
5277
+ const now = new Date();
5278
+ const start = new Date(now);
5279
+ if (filter === "today") {
5280
+ start.setHours(0, 0, 0, 0);
5281
+ return {
5282
+ from: start,
5283
+ to: now
5284
+ };
5285
+ }
5286
+ if (filter === "week") {
5287
+ start.setDate(now.getDate() - now.getDay());
5288
+ start.setHours(0, 0, 0, 0);
5289
+ return {
5290
+ from: start,
5291
+ to: now
5292
+ };
5293
+ }
5294
+ if (filter === "month") {
5295
+ start.setDate(1);
5296
+ start.setHours(0, 0, 0, 0);
5297
+ return {
5298
+ from: start,
5299
+ to: now
5300
+ };
5301
+ }
5302
+ return null;
5303
+ };
5304
+ const handlePresetDownload = filter => {
5305
+ var _dashboardData$dashbo;
5306
+ const allRows = (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.consumerList) || [];
5307
+ const range = getDateRange(filter);
5308
+ if (!range) return;
5309
+ const filtered = allRows.filter(r => {
5310
+ const ts = r.submittedAt || r.createdTime || r.lastModifiedTime || 0;
5311
+ return ts >= range.from.getTime() && ts <= range.to.getTime();
5312
+ });
5313
+ downloadSurveyorPDF({
5314
+ rows: filtered.length ? filtered : allRows,
5315
+ surveyorName: fullName,
5316
+ vendorName,
5317
+ supervisorName,
5318
+ employeeId,
5319
+ mobileNumber,
5320
+ dashboardInfo: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
5321
+ t
5322
+ });
5323
+ setShowReportMenu(false);
5324
+ setShowCustomPicker(false);
5325
+ };
5326
+ const handleCustomDownload = () => {
5327
+ var _dashboardData$dashbo2;
5328
+ if (!customDate.from || !customDate.to) {
5329
+ alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
5330
+ return;
5331
+ }
5332
+ const from = new Date(customDate.from);
5333
+ const to = new Date(customDate.to);
5334
+ to.setHours(23, 59, 59, 999);
5335
+ const allRows = (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo2 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo2 === void 0 ? void 0 : _dashboardData$dashbo2.consumerList) || [];
5336
+ const filtered = allRows.filter(r => {
5337
+ const ts = r.createdTime || r.lastModifiedTime || 0;
5338
+ return ts >= from.getTime() && ts <= to.getTime();
5339
+ });
5340
+ downloadSurveyorPDF({
5341
+ rows: filtered.length ? filtered : allRows,
5342
+ surveyorName: fullName,
5343
+ vendorName,
5344
+ supervisorName,
5345
+ employeeId,
5346
+ mobileNumber,
5347
+ dashboardInfo: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
5348
+ t
5349
+ });
5350
+ setShowReportMenu(false);
5351
+ setShowCustomPicker(false);
5352
+ };
4842
5353
  const StatCard = ({
4843
5354
  title,
4844
5355
  value,
@@ -4858,14 +5369,11 @@ const SurveyorDetailsDashboard = () => {
4858
5369
  const options = [{
4859
5370
  action: "Assign"
4860
5371
  }];
4861
- const fullName = (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner2 = surveyor.owner) === null || _surveyor$owner2 === void 0 ? void 0 : _surveyor$owner2.name) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.name) || "N/A";
4862
- const employeeId = (surveyor === null || surveyor === void 0 ? void 0 : surveyor.employeeId) || (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner3 = surveyor.owner) === null || _surveyor$owner3 === void 0 ? void 0 : _surveyor$owner3.uuid) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.id);
4863
5372
  const handleMenuSelect = option => {
4864
5373
  setShowOptions(false);
4865
5374
  setShowModal(true);
4866
5375
  };
4867
5376
  const closeModal = async () => {
4868
- await refetchDashboard();
4869
5377
  setShowModal(false);
4870
5378
  };
4871
5379
  return /*#__PURE__*/React.createElement(Card, {
@@ -4884,26 +5392,85 @@ const SurveyorDetailsDashboard = () => {
4884
5392
  className: "designation"
4885
5393
  }, (surveyor === null || surveyor === void 0 ? void 0 : surveyor.description) || t("FIELD_SURVEYOR")), /*#__PURE__*/React.createElement("div", {
4886
5394
  className: "employee-id"
4887
- }, t("EMPLOYEE_ID"), ": ", employeeId)))), /*#__PURE__*/React.createElement("div", {
5395
+ }, t("EMPLOYEE_ID"), ": ", employeeId))), /*#__PURE__*/React.createElement("div", {
5396
+ className: "report-download",
5397
+ ref: reportMenuRef
5398
+ }, /*#__PURE__*/React.createElement("button", {
5399
+ className: "download-btn",
5400
+ onClick: () => {
5401
+ setShowReportMenu(p => !p);
5402
+ setShowCustomPicker(false);
5403
+ }
5404
+ }, t("DOWNLOAD_REPORT") || "Download Report"), showReportMenu && /*#__PURE__*/React.createElement("div", {
5405
+ className: "report-menu"
5406
+ }, [{
5407
+ label: t("TODAY") || "Today",
5408
+ key: "today"
5409
+ }, {
5410
+ label: t("THIS_WEEK") || "This Week",
5411
+ key: "week"
5412
+ }, {
5413
+ label: t("THIS_MONTH") || "This Month",
5414
+ key: "month"
5415
+ }].map(({
5416
+ label,
5417
+ key
5418
+ }) => /*#__PURE__*/React.createElement("div", {
5419
+ key: key,
5420
+ className: "menu-item",
5421
+ onClick: () => handlePresetDownload(key)
5422
+ }, label)), /*#__PURE__*/React.createElement("div", {
5423
+ className: "custom-date-trigger",
5424
+ onClick: () => setShowCustomPicker(p => !p)
5425
+ }, t("CUSTOM_DATE") || "Custom Date"), showCustomPicker && /*#__PURE__*/React.createElement("div", {
5426
+ className: "custom-picker"
5427
+ }, /*#__PURE__*/React.createElement("div", {
5428
+ className: "date-field"
5429
+ }, /*#__PURE__*/React.createElement("label", {
5430
+ className: "date-label"
5431
+ }, t("FROM_DATE") || "From"), /*#__PURE__*/React.createElement("input", {
5432
+ type: "date",
5433
+ className: "date-input",
5434
+ value: customDate.from,
5435
+ onChange: e => setCustomDate(d => ({
5436
+ ...d,
5437
+ from: e.target.value
5438
+ }))
5439
+ })), /*#__PURE__*/React.createElement("div", {
5440
+ className: "date-field"
5441
+ }, /*#__PURE__*/React.createElement("label", {
5442
+ className: "date-label"
5443
+ }, t("TO_DATE") || "To"), /*#__PURE__*/React.createElement("input", {
5444
+ type: "date",
5445
+ className: "date-input",
5446
+ value: customDate.to,
5447
+ onChange: e => setCustomDate(d => ({
5448
+ ...d,
5449
+ to: e.target.value
5450
+ }))
5451
+ })), /*#__PURE__*/React.createElement("button", {
5452
+ className: "download-action-btn",
5453
+ onClick: handleCustomDownload
5454
+ }, t("DOWNLOAD") || "Download"))))), /*#__PURE__*/React.createElement("div", {
4888
5455
  className: "stats-wrapper"
4889
5456
  }, /*#__PURE__*/React.createElement(StatCard, {
4890
5457
  title: t("TOTAL_ASSIGNED"),
4891
- value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.total) || 0,
5458
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo3 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo3 === void 0 ? void 0 : _dashboardData$dashbo3.total) || 0,
4892
5459
  type: "today",
4893
5460
  isLoading: isDashboardLoading
4894
5461
  }), /*#__PURE__*/React.createElement(StatCard, {
4895
5462
  title: t("COMPLETED"),
4896
- value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo2 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo2 === void 0 ? void 0 : _dashboardData$dashbo2.completed) || 0,
5463
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo4 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo4 === void 0 ? void 0 : _dashboardData$dashbo4.completed) || 0,
4897
5464
  type: "week",
4898
5465
  isLoading: isDashboardLoading
4899
5466
  }), /*#__PURE__*/React.createElement(StatCard, {
4900
5467
  title: t("PENDING"),
4901
- value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo3 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo3 === void 0 ? void 0 : _dashboardData$dashbo3.pending) || 0,
5468
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo5 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo5 === void 0 ? void 0 : _dashboardData$dashbo5.pending) || 0,
4902
5469
  type: "pending",
4903
5470
  isLoading: isDashboardLoading
4904
5471
  }), /*#__PURE__*/React.createElement(StatCard, {
4905
5472
  title: t("SUBMITTED"),
4906
- value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo4 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo4 === void 0 ? void 0 : _dashboardData$dashbo4.submittedCount) || 0,
5473
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo6 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo6 === void 0 ? void 0 : _dashboardData$dashbo6.submittedCount) || 0,
4907
5474
  type: "month",
4908
5475
  isLoading: isDashboardLoading
4909
5476
  })), /*#__PURE__*/React.createElement("div", {
@@ -4951,19 +5518,19 @@ const SurveyorDetailsDashboard = () => {
4951
5518
  className: "label"
4952
5519
  }, t("MOBILE"), ":"), /*#__PURE__*/React.createElement("span", {
4953
5520
  className: "value"
4954
- }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner4 = surveyor.owner) === null || _surveyor$owner4 === void 0 ? void 0 : _surveyor$owner4.mobileNumber) || (surveyor === null || surveyor === void 0 ? void 0 : surveyor.mobileNo) || "N/A")), /*#__PURE__*/React.createElement("div", {
5521
+ }, (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", {
4955
5522
  className: "detail-item"
4956
5523
  }, /*#__PURE__*/React.createElement("span", {
4957
5524
  className: "label"
4958
5525
  }, t("EMAIL"), ":"), /*#__PURE__*/React.createElement("span", {
4959
5526
  className: "value"
4960
- }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner5 = surveyor.owner) === null || _surveyor$owner5 === void 0 ? void 0 : _surveyor$owner5.emailId) || "N/A")), /*#__PURE__*/React.createElement("div", {
5527
+ }, (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", {
4961
5528
  className: "detail-item"
4962
5529
  }, /*#__PURE__*/React.createElement("span", {
4963
5530
  className: "label"
4964
5531
  }, t("GENDER"), ":"), /*#__PURE__*/React.createElement("span", {
4965
5532
  className: "value"
4966
- }, (surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner6 = surveyor.owner) === null || _surveyor$owner6 === void 0 ? void 0 : _surveyor$owner6.gender) || "N/A")), /*#__PURE__*/React.createElement("div", {
5533
+ }, (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", {
4967
5534
  className: "detail-item"
4968
5535
  }, /*#__PURE__*/React.createElement("span", {
4969
5536
  className: "label"
@@ -4987,16 +5554,16 @@ const SurveyorDetailsDashboard = () => {
4987
5554
  t: t,
4988
5555
  tableTitle: t("ASSIGNED_KNOS"),
4989
5556
  tableClass: "ekycTable",
4990
- data: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo5 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo5 === void 0 ? void 0 : _dashboardData$dashbo5.consumerList) || [],
5557
+ data: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo7 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo7 === void 0 ? void 0 : _dashboardData$dashbo7.consumerList) || [],
4991
5558
  columns: knoColumns,
4992
5559
  isLoading: isDashboardLoading,
4993
- totalRecords: dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo6 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo6 === void 0 ? void 0 : _dashboardData$dashbo6.total,
5560
+ totalRecords: dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo8 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo8 === void 0 ? void 0 : _dashboardData$dashbo8.total,
4994
5561
  currentPage: currentPage,
4995
5562
  pageSizeLimit: pageSize,
4996
5563
  isPaginationRequired: true,
4997
5564
  onNextPage: () => {
4998
- var _dashboardData$dashbo7;
4999
- 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) {
5565
+ var _dashboardData$dashbo9;
5566
+ 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) {
5000
5567
  setCurrentPage(prev => prev + 1);
5001
5568
  }
5002
5569
  },
@@ -5009,8 +5576,8 @@ const SurveyorDetailsDashboard = () => {
5009
5576
  setCurrentPage(0);
5010
5577
  },
5011
5578
  onLastPage: () => {
5012
- var _dashboardData$dashbo8;
5013
- 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));
5579
+ var _dashboardData$dashbo0;
5580
+ 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));
5014
5581
  },
5015
5582
  onPageSizeChange: e => {
5016
5583
  setPageSize(Number(e.target.value));
@@ -5030,17 +5597,111 @@ const SurveyorDetailsDashboard = () => {
5030
5597
  }
5031
5598
  })), showModal && /*#__PURE__*/React.createElement(AssignEkycModal, {
5032
5599
  surveyor: surveyor,
5033
- closeModal: closeModal
5600
+ closeModal: closeModal,
5601
+ refetchDashboard: refetchDashboard
5034
5602
  }));
5035
5603
  };
5036
5604
 
5605
+ function formReducer(state, payload) {
5606
+ const storageKey = "EKYC.SW.INBOX";
5607
+ switch (payload.action) {
5608
+ case "mutateSearchForm":
5609
+ Digit.SessionStorage.set(storageKey, {
5610
+ ...state,
5611
+ searchForm: payload.data
5612
+ });
5613
+ return {
5614
+ ...state,
5615
+ searchForm: payload.data
5616
+ };
5617
+ case "mutateFilterForm":
5618
+ Digit.SessionStorage.set(storageKey, {
5619
+ ...state,
5620
+ filterForm: payload.data
5621
+ });
5622
+ return {
5623
+ ...state,
5624
+ filterForm: payload.data
5625
+ };
5626
+ case "mutateTableForm":
5627
+ Digit.SessionStorage.set(storageKey, {
5628
+ ...state,
5629
+ tableForm: payload.data
5630
+ });
5631
+ return {
5632
+ ...state,
5633
+ tableForm: payload.data
5634
+ };
5635
+ default:
5636
+ return state;
5637
+ }
5638
+ }
5639
+ const formInitValue = {
5640
+ filterForm: {},
5641
+ searchForm: {},
5642
+ tableForm: {
5643
+ limit: 10,
5644
+ offset: 0,
5645
+ sortBy: "createdTime",
5646
+ sortOrder: "DESC"
5647
+ }
5648
+ };
5649
+ const tableColumnConfig = (t, handleReview) => [{
5650
+ Header: t("SURVEYOR_NAME"),
5651
+ accessor: "surveyorName",
5652
+ Cell: ({
5653
+ row
5654
+ }) => {
5655
+ var _row$original, _row$original2, _row$original3;
5656
+ const id = (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.id;
5657
+ return /*#__PURE__*/React.createElement("span", {
5658
+ className: "ekyc-application-link",
5659
+ style: {
5660
+ color: "#add8f7",
5661
+ cursor: "pointer",
5662
+ fontWeight: "bold"
5663
+ },
5664
+ onClick: () => handleReview(id)
5665
+ }, ((_row$original2 = row.original) === null || _row$original2 === void 0 ? void 0 : _row$original2.surveyorName) || ((_row$original3 = row.original) === null || _row$original3 === void 0 ? void 0 : _row$original3.name) || "NA");
5666
+ }
5667
+ }, {
5668
+ Header: t("MOBILE_NUMBER"),
5669
+ accessor: "mobileNo",
5670
+ Cell: ({
5671
+ row
5672
+ }) => {
5673
+ var _row$original4, _row$original5, _row$original5$owner;
5674
+ return /*#__PURE__*/React.createElement("span", null, ((_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : _row$original4.mobileNo) || ((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : (_row$original5$owner = _row$original5.owner) === null || _row$original5$owner === void 0 ? void 0 : _row$original5$owner.mobileNumber) || "NA");
5675
+ }
5676
+ }, {
5677
+ Header: t("STATUS"),
5678
+ accessor: "status",
5679
+ Cell: ({
5680
+ row
5681
+ }) => {
5682
+ var _row$original6;
5683
+ const status = ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.status) || "DEFAULT";
5684
+ return /*#__PURE__*/React.createElement("span", {
5685
+ className: `ekyc-status-tag ${status}`
5686
+ }, t(status));
5687
+ }
5688
+ }, {
5689
+ Header: t("SERVICE_TYPE"),
5690
+ accessor: "serviceType",
5691
+ Cell: ({
5692
+ row
5693
+ }) => {
5694
+ var _row$original7;
5695
+ return /*#__PURE__*/React.createElement("span", null, ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.serviceType) || "NA");
5696
+ }
5697
+ }];
5698
+
5037
5699
  const SupervisorInboxTableConfig = ({
5038
5700
  onPageSizeChange,
5039
5701
  formState,
5040
5702
  totalCount,
5041
5703
  table,
5042
5704
  dispatch,
5043
- checkPathName,
5044
5705
  onSortingByData,
5045
5706
  inboxStyles: _inboxStyles = {},
5046
5707
  tableStyle: _tableStyle = {}
@@ -5056,64 +5717,6 @@ const SupervisorInboxTableConfig = ({
5056
5717
  };
5057
5718
  const limit = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10;
5058
5719
  const offset = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0;
5059
- const tableColumnConfig = [{
5060
- Header: t("SURVEYOR_ID"),
5061
- accessor: "id",
5062
- Cell: ({
5063
- row
5064
- }) => {
5065
- var _row$original;
5066
- const id = (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.id;
5067
- return /*#__PURE__*/React.createElement("span", {
5068
- className: "ekyc-application-link",
5069
- style: {
5070
- color: "#add8f7",
5071
- cursor: "pointer",
5072
- fontWeight: "bold"
5073
- },
5074
- onClick: () => handleReview(id)
5075
- }, id || "NA");
5076
- }
5077
- }, {
5078
- Header: t("SURVEYOR_NAME"),
5079
- accessor: "surveyorName",
5080
- Cell: ({
5081
- row
5082
- }) => {
5083
- var _row$original2, _row$original3;
5084
- return /*#__PURE__*/React.createElement("span", null, ((_row$original2 = row.original) === null || _row$original2 === void 0 ? void 0 : _row$original2.surveyorName) || ((_row$original3 = row.original) === null || _row$original3 === void 0 ? void 0 : _row$original3.name) || "NA");
5085
- }
5086
- }, {
5087
- Header: t("MOBILE_NUMBER"),
5088
- accessor: "mobileNo",
5089
- Cell: ({
5090
- row
5091
- }) => {
5092
- var _row$original4, _row$original5, _row$original5$owner;
5093
- return /*#__PURE__*/React.createElement("span", null, ((_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : _row$original4.mobileNo) || ((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : (_row$original5$owner = _row$original5.owner) === null || _row$original5$owner === void 0 ? void 0 : _row$original5$owner.mobileNumber) || "NA");
5094
- }
5095
- }, {
5096
- Header: t("STATUS"),
5097
- accessor: "status",
5098
- Cell: ({
5099
- row
5100
- }) => {
5101
- var _row$original6;
5102
- const status = ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.status) || "DEFAULT";
5103
- return /*#__PURE__*/React.createElement("span", {
5104
- className: `ekyc-status-tag ${status}`
5105
- }, t(status));
5106
- }
5107
- }, {
5108
- Header: t("SERVICE_TYPE"),
5109
- accessor: "serviceType",
5110
- Cell: ({
5111
- row
5112
- }) => {
5113
- var _row$original7;
5114
- return /*#__PURE__*/React.createElement("span", null, ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.serviceType) || "NA");
5115
- }
5116
- }];
5117
5720
  return {
5118
5721
  getCellProps: () => ({
5119
5722
  style: {
@@ -5131,37 +5734,33 @@ const SupervisorInboxTableConfig = ({
5131
5734
  data: {
5132
5735
  ...formState.tableForm,
5133
5736
  offset: Number(offset) + Number(limit)
5134
- },
5135
- checkPathName
5737
+ }
5136
5738
  }),
5137
5739
  onPrevPage: () => dispatch({
5138
5740
  action: "mutateTableForm",
5139
5741
  data: {
5140
5742
  ...formState.tableForm,
5141
5743
  offset: Number(offset) - Number(limit)
5142
- },
5143
- checkPathName
5744
+ }
5144
5745
  }),
5145
5746
  onLastPage: () => dispatch({
5146
5747
  action: "mutateTableForm",
5147
5748
  data: {
5148
5749
  ...formState.tableForm,
5149
5750
  offset: Math.ceil(totalCount / limit) * limit - Number(limit)
5150
- },
5151
- checkPathName
5751
+ }
5152
5752
  }),
5153
5753
  onFirstPage: () => dispatch({
5154
5754
  action: "mutateTableForm",
5155
5755
  data: {
5156
5756
  ...formState.tableForm,
5157
5757
  offset: 0
5158
- },
5159
- checkPathName
5758
+ }
5160
5759
  }),
5161
5760
  totalRecords: totalCount,
5162
5761
  onSort: onSortingByData,
5163
5762
  data: table,
5164
- columns: tableColumnConfig,
5763
+ columns: tableColumnConfig(t, handleReview),
5165
5764
  inboxStyles: {
5166
5765
  ..._inboxStyles
5167
5766
  },
@@ -5177,19 +5776,7 @@ const AssignEkyc = () => {
5177
5776
  if (!tenantId || tenantId === "dl") {
5178
5777
  tenantId = "dl.djb";
5179
5778
  }
5180
- const location = useLocation();
5181
- const formInitValue = {
5182
- filterForm: {},
5183
- searchForm: {},
5184
- tableForm: {
5185
- limit: 10,
5186
- offset: 0,
5187
- sortBy: "createdTime",
5188
- sortOrder: "DESC"
5189
- }
5190
- };
5191
5779
  const [formState, dispatch] = useReducer(formReducer, formInitValue);
5192
- const userDetails = Digit.SessionStorage.get("User");
5193
5780
  let paginationParms = {
5194
5781
  limit: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10,
5195
5782
  offset: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0,
@@ -5247,10 +5834,6 @@ const AssignEkyc = () => {
5247
5834
  });
5248
5835
  }, [sourceData]);
5249
5836
  const totalRecords = (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.totalRecords) || (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.totalCount) || 0;
5250
- const checkPathName = location.pathname.includes("ekyc/inbox");
5251
- const PropsForInboxLinks = {
5252
- headerText: checkPathName ? "EKYC_MODULE" : "MODULE_SW"
5253
- };
5254
5837
  const SearchFormFields = useCallback(({
5255
5838
  registerRef,
5256
5839
  searchFormState,
@@ -5274,13 +5857,11 @@ const AssignEkyc = () => {
5274
5857
  action: "mutateTableForm",
5275
5858
  data: {
5276
5859
  ...tableOrderFormDefaultValues
5277
- },
5278
- checkPathName
5860
+ }
5279
5861
  });
5280
5862
  dispatch({
5281
5863
  action: "mutateSearchForm",
5282
- data,
5283
- checkPathName
5864
+ data
5284
5865
  });
5285
5866
  };
5286
5867
  const searchFormDefaultValues = {
@@ -5311,47 +5892,6 @@ const AssignEkyc = () => {
5311
5892
  setFilterFormValue,
5312
5893
  getFilterFormValue
5313
5894
  }) => /*#__PURE__*/React.createElement(React.Fragment, null), []);
5314
- const propsForFilterForm = {
5315
- FilterFormFields,
5316
- onFilterFormSubmit: () => {},
5317
- filterFormDefaultValues: "",
5318
- resetFilterFormDefaultValues: "",
5319
- onFilterFormReset: () => {}
5320
- };
5321
- function formReducer(state, payload) {
5322
- const storageKey = payload.checkPathName ? "EKYC.INBOX" : "EKYC.SW.INBOX";
5323
- switch (payload.action) {
5324
- case "mutateSearchForm":
5325
- Digit.SessionStorage.set(storageKey, {
5326
- ...state,
5327
- searchForm: payload.data
5328
- });
5329
- return {
5330
- ...state,
5331
- searchForm: payload.data
5332
- };
5333
- case "mutateFilterForm":
5334
- Digit.SessionStorage.set(storageKey, {
5335
- ...state,
5336
- filterForm: payload.data
5337
- });
5338
- return {
5339
- ...state,
5340
- filterForm: payload.data
5341
- };
5342
- case "mutateTableForm":
5343
- Digit.SessionStorage.set(storageKey, {
5344
- ...state,
5345
- tableForm: payload.data
5346
- });
5347
- return {
5348
- ...state,
5349
- tableForm: payload.data
5350
- };
5351
- default:
5352
- return state;
5353
- }
5354
- }
5355
5895
  const onPageSizeChange = e => {
5356
5896
  const newLimit = Number(e.target.value);
5357
5897
  dispatch({
@@ -5360,8 +5900,7 @@ const AssignEkyc = () => {
5360
5900
  ...formState.tableForm,
5361
5901
  limit: newLimit,
5362
5902
  offset: 0
5363
- },
5364
- checkPathName
5903
+ }
5365
5904
  });
5366
5905
  };
5367
5906
  const onSortingByData = e => {
@@ -5379,8 +5918,7 @@ const AssignEkyc = () => {
5379
5918
  ...formState.tableForm,
5380
5919
  sortBy: id,
5381
5920
  sortOrder: desc ? "DESC" : "ASC"
5382
- },
5383
- checkPathName
5921
+ }
5384
5922
  });
5385
5923
  }
5386
5924
  }
@@ -5394,7 +5932,6 @@ const AssignEkyc = () => {
5394
5932
  dispatch,
5395
5933
  onSortingByData,
5396
5934
  tenantId,
5397
- checkPathName,
5398
5935
  inboxStyles: {
5399
5936
  overflowX: "scroll",
5400
5937
  overflowY: "hidden"
@@ -5435,9 +5972,8 @@ const AssignEkyc = () => {
5435
5972
  return /*#__PURE__*/React.createElement("div", {
5436
5973
  className: "app-container"
5437
5974
  }, /*#__PURE__*/React.createElement(InboxComposer, _extends({
5438
- isInboxLoading,
5439
- PropsForInboxLinks
5440
- }, propsForSearchForm, propsForFilterForm, {
5975
+ isInboxLoading
5976
+ }, propsForSearchForm, {
5441
5977
  propsForInboxTable,
5442
5978
  formState,
5443
5979
  countData: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
@@ -5454,24 +5990,78 @@ const EmployeeApp = ({
5454
5990
  } = useTranslation();
5455
5991
  const location = useLocation();
5456
5992
  sessionStorage.removeItem("revalidateddone");
5457
- const getBreadcrumbLabel = () => {
5993
+ const getDynamicBreadcrumbs = () => {
5458
5994
  const pathname = location.pathname;
5459
- if (pathname.includes("/dashboard")) return "ES_COMMON_INBOX";
5460
- if (pathname.includes("/create-kyc")) return "EKYC_CREATE_KYC";
5461
- if (pathname.includes("/k-details")) return "EKYC_K_DETAILS";
5462
- if (pathname.includes("/consumer-details")) return "EKYC_CONSUMER_DETAILS";
5463
- if (pathname.includes("/address-details")) return "EKYC_ADDRESS_DETAILS";
5464
- if (pathname.includes("/property-info")) return "EKYC_PROPERTY_INFO";
5465
- if (pathname.includes("/meter-details")) return "EKYC_METER_DETAILS";
5466
- if (pathname.includes("/review")) return "EKYC_REVIEW";
5467
- return "ES_COMMON_INBOX";
5995
+ const crumbs = [{
5996
+ icon: HomeIcon,
5997
+ path: "/digit-ui/employee"
5998
+ }, {
5999
+ label: t("ACTION_TEST_EKYC"),
6000
+ path: `/digit-ui/employee/module/details`
6001
+ }];
6002
+ if (pathname.includes("/create-kyc")) {
6003
+ crumbs.push({
6004
+ label: t("EKYC_CREATE_KYC")
6005
+ });
6006
+ } else if (pathname.includes("/consumer-details")) {
6007
+ crumbs.push({
6008
+ label: t("EKYC_CONSUMER_DETAILS")
6009
+ });
6010
+ } else if (pathname.includes("/address-details")) {
6011
+ crumbs.push({
6012
+ label: t("EKYC_ADDRESS_DETAILS")
6013
+ });
6014
+ } else if (pathname.includes("/property-info")) {
6015
+ crumbs.push({
6016
+ label: t("EKYC_PROPERTY_INFO")
6017
+ });
6018
+ } else if (pathname.includes("/meter-details")) {
6019
+ crumbs.push({
6020
+ label: t("EKYC_METER_DETAILS")
6021
+ });
6022
+ } else if (pathname.includes("/review")) {
6023
+ crumbs.push({
6024
+ label: t("EKYC_INBOX"),
6025
+ path: `/digit-ui/employee/ekyc/inbox`
6026
+ });
6027
+ crumbs.push({
6028
+ label: t("EKYC_REVIEW")
6029
+ });
6030
+ } else if (pathname.includes("/assign/surveyor-details")) {
6031
+ crumbs.push({
6032
+ label: t("EKYC_ASSIGN"),
6033
+ path: `/digit-ui/employee/ekyc/assign`
6034
+ });
6035
+ crumbs.push({
6036
+ label: t("EKYC_SURVEYOR_DETAILS")
6037
+ });
6038
+ } else if (pathname.includes("/assign")) {
6039
+ crumbs.push({
6040
+ label: t("EKYC_ASSIGN")
6041
+ });
6042
+ } else if (pathname.includes("/ceo-dashboard")) {
6043
+ crumbs.push({
6044
+ label: t("CEO_M.F_DOR_FINANCE_VIEW")
6045
+ });
6046
+ } else if (pathname.includes("/vendors/")) {
6047
+ crumbs.push({
6048
+ label: t("EKYC_VENDOR_DETAILS")
6049
+ });
6050
+ } else if (pathname.includes("/mapping")) {
6051
+ crumbs.push({
6052
+ label: t("EKYC_MAPPING")
6053
+ });
6054
+ } else if (pathname.includes("/dashboard")) {
6055
+ crumbs.push({
6056
+ label: t("EKYC_DASHBOARD")
6057
+ });
6058
+ } else if (pathname.includes("/inbox")) {
6059
+ crumbs.push({
6060
+ label: t("EKYC_INBOX")
6061
+ });
6062
+ }
6063
+ return crumbs;
5468
6064
  };
5469
- const breadcrumbs = [{
5470
- icon: HomeIcon,
5471
- path: "/digit-ui/employee"
5472
- }, {
5473
- label: t(getBreadcrumbLabel())
5474
- }];
5475
6065
  const formStepRoutes = ["consumer-details", "address-details", "property-info", "meter-details"];
5476
6066
  return /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement("div", {
5477
6067
  className: "ground-container employee-app-container form-container"
@@ -5480,7 +6070,7 @@ const EmployeeApp = ({
5480
6070
  className: "icon"
5481
6071
  }), "Back"),
5482
6072
  onLeftClick: () => window.history.back(),
5483
- breadcrumbs: breadcrumbs
6073
+ breadcrumbs: getDynamicBreadcrumbs()
5484
6074
  }), /*#__PURE__*/React.createElement("div", {
5485
6075
  className: "employee-form"
5486
6076
  }, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(PrivateRoute, {
@@ -5550,6 +6140,139 @@ const EmployeeApp = ({
5550
6140
  })))));
5551
6141
  };
5552
6142
 
6143
+ const PropertyInfoConfig = (t, formData = {}, uploadFile, buildingImage, buildingImageId, setBuildingImage, setBuildingImageId) => {
6144
+ var _formData$propertyTyp;
6145
+ const propertyType = (formData === null || formData === void 0 ? void 0 : (_formData$propertyTyp = formData.propertyType) === null || _formData$propertyTyp === void 0 ? void 0 : _formData$propertyTyp.name) || (formData === null || formData === void 0 ? void 0 : formData.propertyType);
6146
+ const isHotel = propertyType === "Hotel";
6147
+ const isHospitalOrNursing = propertyType === "Hospital" || propertyType === "Nursing Home";
6148
+ const fields = [{
6149
+ label: t("PID Number"),
6150
+ isMandatory: false,
6151
+ type: "text",
6152
+ populators: {
6153
+ name: "pidNumber"
6154
+ }
6155
+ }, {
6156
+ label: t("Property Type"),
6157
+ isMandatory: false,
6158
+ type: "custom",
6159
+ key: "propertyType",
6160
+ populators: {
6161
+ name: "propertyType",
6162
+ component: props => /*#__PURE__*/React.createElement(Dropdown, {
6163
+ option: [{
6164
+ name: "Residential"
6165
+ }, {
6166
+ name: "Commercial"
6167
+ }, {
6168
+ name: "Hotel"
6169
+ }, {
6170
+ name: "Hospital"
6171
+ }, {
6172
+ name: "Nursing Home"
6173
+ }],
6174
+ optionKey: "name",
6175
+ selected: props.value,
6176
+ select: props.onChange
6177
+ })
6178
+ }
6179
+ }, {
6180
+ label: t("Sub Property Category"),
6181
+ isMandatory: false,
6182
+ type: "custom",
6183
+ key: "subPropertyCategory",
6184
+ populators: {
6185
+ name: "subPropertyCategory",
6186
+ component: props => /*#__PURE__*/React.createElement(Dropdown, {
6187
+ option: [],
6188
+ optionKey: "name",
6189
+ selected: props.value,
6190
+ select: props.onChange
6191
+ })
6192
+ }
6193
+ }, {
6194
+ label: t("No. of Floors"),
6195
+ isMandatory: true,
6196
+ type: "number",
6197
+ populators: {
6198
+ name: "noOfFloors",
6199
+ validation: {
6200
+ required: true,
6201
+ min: 1
6202
+ }
6203
+ }
6204
+ }, {
6205
+ label: t("Floor No. of this KNO"),
6206
+ isMandatory: false,
6207
+ type: "text",
6208
+ populators: {
6209
+ name: "floorNo"
6210
+ }
6211
+ }, {
6212
+ label: isHospitalOrNursing ? t("No of Beds") : t("No of Beds"),
6213
+ isMandatory: isHospitalOrNursing,
6214
+ type: "number",
6215
+ populators: {
6216
+ name: "noOfBeds",
6217
+ validation: isHospitalOrNursing ? {
6218
+ required: true,
6219
+ min: 1
6220
+ } : {}
6221
+ }
6222
+ }, {
6223
+ label: isHotel ? t("No. of Rooms") : t("No. of Rooms"),
6224
+ isMandatory: isHotel,
6225
+ type: "number",
6226
+ populators: {
6227
+ name: "noOfRooms",
6228
+ validation: isHotel ? {
6229
+ required: true,
6230
+ min: 1
6231
+ } : {}
6232
+ }
6233
+ }, {
6234
+ label: t("Number of Dwelling Units"),
6235
+ isMandatory: false,
6236
+ type: "number",
6237
+ populators: {
6238
+ name: "dwellingUnits"
6239
+ }
6240
+ }, {
6241
+ label: t("Building Image"),
6242
+ isMandatory: true,
6243
+ type: "custom",
6244
+ key: "buildingImage",
6245
+ populators: {
6246
+ name: "buildingImage",
6247
+ component: props => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(UploadFile, {
6248
+ onUpload: e => uploadFile(e, props.onChange),
6249
+ onDelete: () => {
6250
+ props.onChange(null);
6251
+ setBuildingImage(null);
6252
+ setBuildingImageId(null);
6253
+ },
6254
+ message: buildingImageId ? t("Uploaded") : t("No file selected")
6255
+ }), buildingImage && /*#__PURE__*/React.createElement("div", {
6256
+ style: {
6257
+ marginTop: "10px"
6258
+ }
6259
+ }, /*#__PURE__*/React.createElement("img", {
6260
+ src: buildingImage,
6261
+ alt: "preview",
6262
+ style: {
6263
+ maxWidth: "100%",
6264
+ maxHeight: "200px",
6265
+ objectFit: "contain"
6266
+ }
6267
+ })))
6268
+ }
6269
+ }];
6270
+ return [{
6271
+ head: t("EKYC_PROPERTY_DETAILS"),
6272
+ body: fields
6273
+ }];
6274
+ };
6275
+
5553
6276
  const PropertyInfo = ({
5554
6277
  config,
5555
6278
  onSelect,
@@ -5561,14 +6284,17 @@ const PropertyInfo = ({
5561
6284
  const location = useLocation();
5562
6285
  const flowState = location.state || {};
5563
6286
  const tenantId = Digit.ULBService.getCurrentTenantId();
5564
- const searchKno = (flowState === null || flowState === void 0 ? void 0 : flowState.kNumber) || (flowState === null || flowState === void 0 ? void 0 : flowState.kno) || (formData === null || formData === void 0 ? void 0 : formData.kNumber) || (formData === null || formData === void 0 ? void 0 : formData.kno) || sessionStorage.getItem("EKYC_K_NUMBER");
6287
+ const queryParams = new URLSearchParams(location.search);
6288
+ const urlKno = queryParams.get("kno");
6289
+ const searchKno = urlKno || (flowState === null || flowState === void 0 ? void 0 : flowState.kNumber) || (flowState === null || flowState === void 0 ? void 0 : flowState.kno) || (formData === null || formData === void 0 ? void 0 : formData.kNumber) || (formData === null || formData === void 0 ? void 0 : formData.kno) || sessionStorage.getItem("EKYC_K_NUMBER");
5565
6290
  const {
5566
6291
  isLoading,
5567
6292
  data: searchData
5568
6293
  } = Digit.Hooks.ekyc.useSearchConnection({
5569
6294
  tenantId,
5570
6295
  details: {
5571
- kno: searchKno
6296
+ kno: searchKno,
6297
+ fetchType: "PROPERTY"
5572
6298
  }
5573
6299
  }, {
5574
6300
  enabled: !!searchKno,
@@ -5576,69 +6302,97 @@ const PropertyInfo = ({
5576
6302
  });
5577
6303
  const updateMutation = Digit.Hooks.ekyc.useEkycUpdate(tenantId);
5578
6304
  const savedData = (formData === null || formData === void 0 ? void 0 : formData.propertyDetails) || {};
5579
- const [pidNumber, setPidNumber] = useState(savedData.pidNumber || "");
5580
- const [propertyType, setPropertyType] = useState(savedData.propertyType ? {
5581
- name: savedData.propertyType
5582
- } : null);
5583
- const [subPropertyCategory, setSubPropertyCategory] = useState(savedData.subPropertyCategory ? {
5584
- name: savedData.subPropertyCategory
5585
- } : null);
5586
- const [noOfFloors, setNoOfFloors] = useState(savedData.noOfFloors || "");
5587
- const [floorNo, setFloorNo] = useState(savedData.floorNo || "");
5588
- const [noOfRooms, setNoOfRooms] = useState(savedData.noOfRooms || "");
5589
- const [noOfBeds, setNoOfBeds] = useState(savedData.noOfBeds || "");
5590
- const [dwellingUnits, setDwellingUnits] = useState(savedData.dwellingUnits || "");
5591
6305
  const [buildingImage, setBuildingImage] = useState(null);
5592
6306
  const [buildingImageId, setBuildingImageId] = useState(savedData.buildingImageId || null);
5593
6307
  const [toast, setToast] = useState(null);
5594
- const propertyTypeOptions = [{
5595
- name: "Residential"
5596
- }, {
5597
- name: "Commercial"
5598
- }, {
5599
- name: "Hotel"
5600
- }, {
5601
- name: "Hospital"
5602
- }, {
5603
- name: "Nursing Home"
5604
- }];
6308
+ const [isDataLoaded, setIsDataLoaded] = useState(false);
6309
+ const [canSubmit, setCanSubmit] = useState(false);
6310
+ const [defaultValues, setDefaultValues] = useState(() => ({
6311
+ pidNumber: savedData.pidNumber || "",
6312
+ propertyType: savedData.propertyType ? {
6313
+ name: savedData.propertyType
6314
+ } : null,
6315
+ subPropertyCategory: savedData.subPropertyCategory ? {
6316
+ name: savedData.subPropertyCategory
6317
+ } : null,
6318
+ noOfFloors: savedData.noOfFloors || "",
6319
+ floorNo: savedData.floorNo || "",
6320
+ noOfRooms: savedData.noOfRooms || "",
6321
+ noOfBeds: savedData.noOfBeds || "",
6322
+ dwellingUnits: savedData.dwellingUnits || "",
6323
+ buildingImage: savedData.buildingImageId ? "Uploaded" : null
6324
+ }));
6325
+ const [localFormData, setLocalFormData] = useState(defaultValues);
6326
+ const extractApplicationData = searchData => {
6327
+ if (!searchData) return null;
6328
+ const reviewWrapper = (searchData === null || searchData === void 0 ? void 0 : searchData.applicationReviewInfo) || (searchData === null || searchData === void 0 ? void 0 : searchData.applicationReview) || searchData;
6329
+ const applicationData = (Array.isArray(reviewWrapper) ? reviewWrapper[0] : reviewWrapper) || {};
6330
+ return (applicationData === null || applicationData === void 0 ? void 0 : applicationData.newData) || applicationData;
6331
+ };
5605
6332
  useEffect(() => {
5606
- const rawData = searchData || (formData === null || formData === void 0 ? void 0 : formData.connectionDetails);
5607
- const propertyInfo = (rawData === null || rawData === void 0 ? void 0 : rawData.propertyInfo) || (rawData === null || rawData === void 0 ? void 0 : rawData.propertyDetails) || {};
5608
- if (propertyInfo && Object.keys(propertyInfo).length > 0 && !savedData.pidNumber) {
5609
- if (propertyInfo.pidNumber) setPidNumber(propertyInfo.pidNumber);
5610
- if (propertyInfo.numberOfFloors || propertyInfo.noOfFloor) setNoOfFloors(String(propertyInfo.numberOfFloors || propertyInfo.noOfFloor));
5611
- if (propertyInfo.buildingImageFileStoreId) setBuildingImageId(propertyInfo.buildingImageFileStoreId);
6333
+ const appData = extractApplicationData(searchData);
6334
+ const rawData = appData || (formData === null || formData === void 0 ? void 0 : formData.connectionDetails);
6335
+ const propertyInfo = (rawData === null || rawData === void 0 ? void 0 : rawData.propertyInfo) || (rawData === null || rawData === void 0 ? void 0 : rawData.propertyDetails) || rawData || {};
6336
+ if (propertyInfo && Object.keys(propertyInfo).length > 0 && !isDataLoaded) {
6337
+ let propType = null;
6338
+ let subPropCat = null;
5612
6339
  if (propertyInfo.subPropertyCategory) {
5613
- const matchingType = propertyTypeOptions.find(type => type.name.toLowerCase() === propertyInfo.subPropertyCategory.toLowerCase());
5614
- if (matchingType) setPropertyType(matchingType);else setPropertyType({
6340
+ const matchingType = [{
6341
+ name: "Residential"
6342
+ }, {
6343
+ name: "Commercial"
6344
+ }, {
6345
+ name: "Hotel"
6346
+ }, {
6347
+ name: "Hospital"
6348
+ }, {
6349
+ name: "Nursing Home"
6350
+ }].find(type => type.name.toLowerCase() === propertyInfo.subPropertyCategory.toLowerCase());
6351
+ if (matchingType) propType = matchingType;else propType = {
5615
6352
  name: propertyInfo.subPropertyCategory
5616
- });
5617
- setSubPropertyCategory({
6353
+ };
6354
+ subPropCat = {
5618
6355
  name: propertyInfo.subPropertyCategory
5619
- });
6356
+ };
5620
6357
  }
5621
6358
  if (propertyInfo.propertyType) {
5622
- setSubPropertyCategory({
6359
+ subPropCat = {
5623
6360
  name: propertyInfo.propertyType
5624
- });
5625
- if (!propertyInfo.subPropertyCategory) setPropertyType({
6361
+ };
6362
+ if (!propertyInfo.subPropertyCategory) propType = {
5626
6363
  name: propertyInfo.propertyType
5627
- });
6364
+ };
5628
6365
  }
5629
- if (propertyInfo.floorNo) setFloorNo(propertyInfo.floorNo);
5630
- if (propertyInfo.numberOfRooms !== null && propertyInfo.numberOfRooms !== undefined) setNoOfRooms(String(propertyInfo.numberOfRooms));
5631
- if (propertyInfo.numberOfBeds !== null && propertyInfo.numberOfBeds !== undefined) setNoOfBeds(String(propertyInfo.numberOfBeds));
5632
- if (propertyInfo.numberOfDwellingUnits !== null && propertyInfo.numberOfDwellingUnits !== undefined) setDwellingUnits(String(propertyInfo.numberOfDwellingUnits));
6366
+ const updatedDefaults = {
6367
+ pidNumber: savedData.pidNumber || propertyInfo.pidNumber || "",
6368
+ propertyType: savedData.propertyType ? {
6369
+ name: savedData.propertyType
6370
+ } : propType,
6371
+ subPropertyCategory: savedData.subPropertyCategory ? {
6372
+ name: savedData.subPropertyCategory
6373
+ } : subPropCat,
6374
+ noOfFloors: savedData.noOfFloors || (propertyInfo.numberOfFloors || propertyInfo.noOfFloor ? String(propertyInfo.numberOfFloors || propertyInfo.noOfFloor) : ""),
6375
+ floorNo: savedData.floorNo || propertyInfo.floorNo || "",
6376
+ noOfRooms: savedData.noOfRooms || (propertyInfo.numberOfRooms !== null && propertyInfo.numberOfRooms !== undefined ? String(propertyInfo.numberOfRooms) : ""),
6377
+ noOfBeds: savedData.noOfBeds || (propertyInfo.numberOfBeds !== null && propertyInfo.numberOfBeds !== undefined ? String(propertyInfo.numberOfBeds) : ""),
6378
+ dwellingUnits: savedData.dwellingUnits || (propertyInfo.numberOfDwellingUnits !== null && propertyInfo.numberOfDwellingUnits !== undefined ? String(propertyInfo.numberOfDwellingUnits) : ""),
6379
+ buildingImage: savedData.buildingImageId || propertyInfo.buildingImageFileStoreId || null
6380
+ };
6381
+ setDefaultValues(updatedDefaults);
6382
+ setLocalFormData(updatedDefaults);
6383
+ if (updatedDefaults.buildingImage) {
6384
+ setBuildingImageId(updatedDefaults.buildingImage);
6385
+ }
6386
+ setIsDataLoaded(true);
5633
6387
  }
5634
- }, [searchData, formData === null || formData === void 0 ? void 0 : formData.connectionDetails]);
5635
- const handleUpload = async e => {
6388
+ }, [searchData, formData === null || formData === void 0 ? void 0 : formData.connectionDetails, isDataLoaded]);
6389
+ const handleUpload = async (e, onChange) => {
5636
6390
  const file = e.target.files[0];
5637
6391
  if (!file) return;
5638
6392
  if (file.size > 2000000) {
5639
6393
  setToast({
5640
6394
  type: "error",
5641
- message: "Max size 2MB exceeded"
6395
+ message: t("Max size 2MB exceeded")
5642
6396
  });
5643
6397
  return;
5644
6398
  }
@@ -5647,132 +6401,370 @@ const PropertyInfo = ({
5647
6401
  const res = await Digit.UploadServices.Filestorage("EKYC", file, tenantId);
5648
6402
  const fileStoreId = res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$files = _res$data.files) === null || _res$data$files === void 0 ? void 0 : (_res$data$files$ = _res$data$files[0]) === null || _res$data$files$ === void 0 ? void 0 : _res$data$files$.fileStoreId;
5649
6403
  if (fileStoreId) {
6404
+ onChange(file.name);
5650
6405
  setBuildingImageId(fileStoreId);
5651
6406
  const reader = new FileReader();
5652
6407
  reader.onloadend = () => setBuildingImage(reader.result);
5653
6408
  reader.readAsDataURL(file);
5654
6409
  setToast({
5655
6410
  type: "success",
5656
- message: "Upload successful"
6411
+ message: t("Upload successful")
5657
6412
  });
5658
6413
  }
5659
6414
  } catch {
5660
6415
  setToast({
5661
6416
  type: "error",
5662
- message: "Upload failed"
6417
+ message: t("Upload failed")
5663
6418
  });
5664
6419
  }
5665
6420
  };
5666
- const isValid = () => {
5667
- if (!propertyType) return false;
5668
- if (!subPropertyCategory) return false;
5669
- if (!noOfFloors || Number(noOfFloors) < 1) return false;
5670
- if (!buildingImageId) return false;
5671
- if ((propertyType === null || propertyType === void 0 ? void 0 : propertyType.name) === "Hotel" && !noOfRooms) return false;
5672
- if (((propertyType === null || propertyType === void 0 ? void 0 : propertyType.name) === "Hospital" || (propertyType === null || propertyType === void 0 ? void 0 : propertyType.name) === "Nursing Home") && !noOfBeds) return false;
5673
- return true;
6421
+ const onFormValueChange = (setValue, data) => {
6422
+ var _data$propertyType, _localFormData$proper;
6423
+ const propertyTypeChanged = ((data === null || data === void 0 ? void 0 : (_data$propertyType = data.propertyType) === null || _data$propertyType === void 0 ? void 0 : _data$propertyType.name) || (data === null || data === void 0 ? void 0 : data.propertyType)) !== ((localFormData === null || localFormData === void 0 ? void 0 : (_localFormData$proper = localFormData.propertyType) === null || _localFormData$proper === void 0 ? void 0 : _localFormData$proper.name) || (localFormData === null || localFormData === void 0 ? void 0 : localFormData.propertyType));
6424
+ if (propertyTypeChanged) {
6425
+ setLocalFormData(prev => ({
6426
+ ...prev,
6427
+ ...data
6428
+ }));
6429
+ }
6430
+ const propTypeVal = data === null || data === void 0 ? void 0 : data.propertyType;
6431
+ const subPropCatVal = data === null || data === void 0 ? void 0 : data.subPropertyCategory;
6432
+ const noOfFloorsVal = data === null || data === void 0 ? void 0 : data.noOfFloors;
6433
+ const buildingImgId = buildingImageId || (data === null || data === void 0 ? void 0 : data.buildingImage);
6434
+ const noOfRoomsVal = data === null || data === void 0 ? void 0 : data.noOfRooms;
6435
+ const noOfBedsVal = data === null || data === void 0 ? void 0 : data.noOfBeds;
6436
+ let valid = true;
6437
+ if (!propTypeVal) valid = false;
6438
+ if (!subPropCatVal) valid = false;
6439
+ if (!noOfFloorsVal || Number(noOfFloorsVal) < 1) valid = false;
6440
+ if (!buildingImgId) valid = false;
6441
+ if ((propTypeVal === null || propTypeVal === void 0 ? void 0 : propTypeVal.name) === "Hotel" && !noOfRoomsVal) valid = false;
6442
+ if (((propTypeVal === null || propTypeVal === void 0 ? void 0 : propTypeVal.name) === "Hospital" || (propTypeVal === null || propTypeVal === void 0 ? void 0 : propTypeVal.name) === "Nursing Home") && !noOfBedsVal) valid = false;
6443
+ if (valid !== canSubmit) {
6444
+ setCanSubmit(valid);
6445
+ }
5674
6446
  };
5675
- const onStepSelect = async () => {
5676
- const data = {
5677
- pidNumber,
5678
- propertyType: propertyType === null || propertyType === void 0 ? void 0 : propertyType.name,
5679
- subPropertyCategory: subPropertyCategory === null || subPropertyCategory === void 0 ? void 0 : subPropertyCategory.name,
5680
- noOfFloors,
5681
- floorNo,
5682
- noOfRooms,
5683
- noOfBeds,
5684
- dwellingUnits,
5685
- buildingImageId
6447
+ const onSubmit = async data => {
6448
+ var _data$propertyType2, _data$subPropertyCate;
6449
+ const submitData = {
6450
+ pidNumber: data.pidNumber,
6451
+ propertyType: ((_data$propertyType2 = data.propertyType) === null || _data$propertyType2 === void 0 ? void 0 : _data$propertyType2.name) || data.propertyType,
6452
+ subPropertyCategory: ((_data$subPropertyCate = data.subPropertyCategory) === null || _data$subPropertyCate === void 0 ? void 0 : _data$subPropertyCate.name) || data.subPropertyCategory,
6453
+ noOfFloors: data.noOfFloors,
6454
+ floorNo: data.floorNo,
6455
+ noOfRooms: data.noOfRooms,
6456
+ noOfBeds: data.noOfBeds,
6457
+ dwellingUnits: data.dwellingUnits,
6458
+ buildingImageId: buildingImageId
5686
6459
  };
5687
6460
  try {
5688
6461
  await updateMutation.mutateAsync({
5689
6462
  RequestInfo: {},
5690
6463
  updateType: "PROPERTY",
5691
6464
  kno: searchKno,
5692
- ...data
6465
+ ...submitData
5693
6466
  });
5694
6467
  setToast({
5695
6468
  type: "success",
5696
- message: "Property details updated successfully!"
6469
+ message: t("Property details updated successfully!")
5697
6470
  });
5698
- onSelect(config.key, data);
6471
+ onSelect(config.key, submitData);
5699
6472
  } catch (error) {
5700
6473
  setToast({
5701
6474
  type: "error",
5702
- message: "Failed to update property details"
6475
+ message: t("Failed to update property details")
5703
6476
  });
5704
6477
  }
5705
6478
  };
5706
6479
  if (isLoading) {
5707
6480
  return /*#__PURE__*/React.createElement(Loader, null);
5708
6481
  }
5709
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(FormStep, {
5710
- t: t,
5711
- onSelect: onStepSelect,
5712
- config: config,
6482
+ const Config = PropertyInfoConfig(t, localFormData, handleUpload, buildingImage, buildingImageId, setBuildingImage, setBuildingImageId);
6483
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(FormComposer, {
6484
+ key: isDataLoaded ? "loaded" : "loading",
6485
+ isDisabled: !canSubmit,
5713
6486
  label: t("ES_COMMON_CONTINUE"),
5714
- isDisabled: !isValid()
5715
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "PID Number"), /*#__PURE__*/React.createElement(TextInput, {
5716
- value: pidNumber,
5717
- onChange: e => setPidNumber(e.target.value)
5718
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Property Type"), /*#__PURE__*/React.createElement(Dropdown, {
5719
- option: propertyTypeOptions,
5720
- selected: propertyType,
5721
- select: setPropertyType
5722
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Sub Property Category"), /*#__PURE__*/React.createElement(Dropdown, {
5723
- option: [],
5724
- selected: subPropertyCategory,
5725
- select: setSubPropertyCategory
5726
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "No. of Floors *"), /*#__PURE__*/React.createElement(TextInput, {
5727
- type: "number",
5728
- value: noOfFloors,
5729
- onChange: e => setNoOfFloors(e.target.value)
5730
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Floor No. of this KNO"), /*#__PURE__*/React.createElement(TextInput, {
5731
- value: floorNo,
5732
- onChange: e => setFloorNo(e.target.value)
5733
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "No of Beds"), /*#__PURE__*/React.createElement(TextInput, {
5734
- type: "number",
5735
- value: noOfBeds,
5736
- onChange: e => setNoOfBeds(e.target.value)
5737
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "No. of Rooms"), /*#__PURE__*/React.createElement(TextInput, {
5738
- type: "number",
5739
- value: noOfRooms,
5740
- onChange: e => setNoOfRooms(e.target.value)
5741
- })), (propertyType === null || propertyType === void 0 ? void 0 : propertyType.name) === "Hotel" && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "No. of Rooms *"), /*#__PURE__*/React.createElement(TextInput, {
5742
- type: "number",
5743
- value: noOfRooms,
5744
- onChange: e => setNoOfRooms(e.target.value)
5745
- })), ((propertyType === null || propertyType === void 0 ? void 0 : propertyType.name) === "Hospital" || (propertyType === null || propertyType === void 0 ? void 0 : propertyType.name) === "Nursing Home") && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "No. of Beds *"), /*#__PURE__*/React.createElement(TextInput, {
5746
- type: "number",
5747
- value: noOfBeds,
5748
- onChange: e => setNoOfBeds(e.target.value)
5749
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Number of Dwelling Units"), /*#__PURE__*/React.createElement(TextInput, {
5750
- type: "number",
5751
- value: dwellingUnits,
5752
- onChange: e => setDwellingUnits(e.target.value)
5753
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Building Image *"), /*#__PURE__*/React.createElement(UploadFile, {
5754
- onUpload: handleUpload,
5755
- onDelete: () => {
5756
- setBuildingImage(null);
5757
- setBuildingImageId(null);
5758
- },
5759
- message: buildingImageId ? "Uploaded" : "No file selected"
5760
- })), buildingImage && /*#__PURE__*/React.createElement("div", {
5761
- style: {
5762
- gridColumn: "span 2"
5763
- }
5764
- }, /*#__PURE__*/React.createElement("img", {
5765
- src: buildingImage,
5766
- alt: "preview",
5767
- style: {
5768
- width: "100%",
5769
- marginTop: "10px"
5770
- }
5771
- })), toast && /*#__PURE__*/React.createElement(Toast, {
5772
- label: toast.message,
6487
+ config: Config.map(item => ({
6488
+ ...item,
6489
+ isCollapsible: true,
6490
+ isDefaultOpen: true
6491
+ })),
6492
+ onSubmit: onSubmit,
6493
+ defaultValues: defaultValues,
6494
+ onFormValueChange: onFormValueChange,
6495
+ noCard: false,
6496
+ submitInForm: true
6497
+ }), toast && /*#__PURE__*/React.createElement(Toast, {
5773
6498
  error: toast.type === "error",
6499
+ label: toast.message,
5774
6500
  onClose: () => setToast(null)
5775
- })));
6501
+ }));
6502
+ };
6503
+
6504
+ const MeterDetailsConfig = (t, formData = {}, uploadPhoto, meterPhoto, meterPhotoId, setMeterPhoto, setMeterPhotoId) => {
6505
+ var _formData$meterStatus, _formData$lastBillRec, _formData$sewerConnec;
6506
+ const meterStatus = (formData === null || formData === void 0 ? void 0 : (_formData$meterStatus = formData.meterStatus) === null || _formData$meterStatus === void 0 ? void 0 : _formData$meterStatus.name) || (formData === null || formData === void 0 ? void 0 : formData.meterStatus);
6507
+ const lastBillReceived = (formData === null || formData === void 0 ? void 0 : (_formData$lastBillRec = formData.lastBillReceived) === null || _formData$lastBillRec === void 0 ? void 0 : _formData$lastBillRec.name) || (formData === null || formData === void 0 ? void 0 : formData.lastBillReceived);
6508
+ const sewerConnection = (formData === null || formData === void 0 ? void 0 : (_formData$sewerConnec = formData.sewerConnection) === null || _formData$sewerConnec === void 0 ? void 0 : _formData$sewerConnec.name) || (formData === null || formData === void 0 ? void 0 : formData.sewerConnection);
6509
+ const isFrozen = meterStatus === "Can not be identified";
6510
+ const monthYearOptions = [];
6511
+ for (let y = 1998; y <= 2026; y++) {
6512
+ for (let m = 1; m <= 12; m++) {
6513
+ monthYearOptions.push({
6514
+ name: `${m}/${y}`
6515
+ });
6516
+ }
6517
+ }
6518
+ const yesNo = [{
6519
+ name: "Yes"
6520
+ }, {
6521
+ name: "No"
6522
+ }];
6523
+ const fields = [{
6524
+ label: t("Connection Category"),
6525
+ isMandatory: true,
6526
+ type: "text",
6527
+ populators: {
6528
+ name: "connectionCategory",
6529
+ validation: {
6530
+ required: true
6531
+ }
6532
+ }
6533
+ }, {
6534
+ label: t("SA Type"),
6535
+ isMandatory: false,
6536
+ type: "text",
6537
+ populators: {
6538
+ name: "saType"
6539
+ }
6540
+ }, {
6541
+ label: t("Status"),
6542
+ isMandatory: false,
6543
+ type: "text",
6544
+ populators: {
6545
+ name: "status"
6546
+ }
6547
+ }, {
6548
+ label: t("MR Code"),
6549
+ isMandatory: false,
6550
+ type: "text",
6551
+ populators: {
6552
+ name: "mrCode"
6553
+ }
6554
+ }, {
6555
+ label: t("Area Code"),
6556
+ isMandatory: false,
6557
+ type: "text",
6558
+ populators: {
6559
+ name: "areaCode"
6560
+ }
6561
+ }, {
6562
+ label: t("MR Key"),
6563
+ isMandatory: false,
6564
+ type: "text",
6565
+ populators: {
6566
+ name: "mrKey"
6567
+ }
6568
+ }];
6569
+ if (!isFrozen) {
6570
+ fields.push({
6571
+ label: t("Meter Number"),
6572
+ isMandatory: false,
6573
+ type: "text",
6574
+ populators: {
6575
+ name: "meterNumber"
6576
+ }
6577
+ }, {
6578
+ label: t("Meter Maker"),
6579
+ isMandatory: false,
6580
+ type: "text",
6581
+ populators: {
6582
+ name: "meterMaker"
6583
+ }
6584
+ }, {
6585
+ label: t("Meter Condition"),
6586
+ isMandatory: false,
6587
+ type: "custom",
6588
+ key: "meterCondition",
6589
+ populators: {
6590
+ name: "meterCondition",
6591
+ component: props => /*#__PURE__*/React.createElement(Dropdown, {
6592
+ option: [{
6593
+ name: "Damaged"
6594
+ }, {
6595
+ name: "Not-Damaged"
6596
+ }],
6597
+ optionKey: "name",
6598
+ selected: props.value,
6599
+ select: props.onChange
6600
+ })
6601
+ }
6602
+ });
6603
+ if (meterStatus === "Metered") {
6604
+ fields.push({
6605
+ label: t("Meter Photo *"),
6606
+ isMandatory: true,
6607
+ type: "custom",
6608
+ key: "meterPhoto",
6609
+ populators: {
6610
+ name: "meterPhoto",
6611
+ component: props => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(UploadFile, {
6612
+ onUpload: e => uploadPhoto(e, props.onChange),
6613
+ onDelete: () => {
6614
+ props.onChange(null);
6615
+ setMeterPhoto(null);
6616
+ setMeterPhotoId(null);
6617
+ },
6618
+ message: meterPhotoId ? t("Uploaded") : t("No file selected")
6619
+ }), meterPhoto && /*#__PURE__*/React.createElement("div", {
6620
+ style: {
6621
+ marginTop: "10px"
6622
+ }
6623
+ }, /*#__PURE__*/React.createElement("img", {
6624
+ src: meterPhoto,
6625
+ alt: "preview",
6626
+ style: {
6627
+ maxWidth: "100%",
6628
+ maxHeight: "200px",
6629
+ objectFit: "contain"
6630
+ }
6631
+ })))
6632
+ }
6633
+ });
6634
+ }
6635
+ }
6636
+ fields.push({
6637
+ label: t("Meter Status"),
6638
+ isMandatory: true,
6639
+ type: "custom",
6640
+ key: "meterStatus",
6641
+ populators: {
6642
+ name: "meterStatus",
6643
+ component: props => /*#__PURE__*/React.createElement(Dropdown, {
6644
+ option: [{
6645
+ name: "Metered"
6646
+ }, {
6647
+ name: "Unmetered"
6648
+ }, {
6649
+ name: "Can not be identified"
6650
+ }],
6651
+ optionKey: "name",
6652
+ selected: props.value,
6653
+ select: props.onChange
6654
+ })
6655
+ }
6656
+ }, {
6657
+ label: t("Meter Location"),
6658
+ isMandatory: true,
6659
+ type: "custom",
6660
+ key: "meterLocation",
6661
+ populators: {
6662
+ name: "meterLocation",
6663
+ component: props => /*#__PURE__*/React.createElement(Dropdown, {
6664
+ option: [{
6665
+ name: "Inside"
6666
+ }, {
6667
+ name: "Outside"
6668
+ }],
6669
+ optionKey: "name",
6670
+ selected: props.value,
6671
+ select: props.onChange
6672
+ })
6673
+ }
6674
+ }, {
6675
+ label: t("Last Bill Received"),
6676
+ isMandatory: true,
6677
+ type: "custom",
6678
+ key: "lastBillReceived",
6679
+ populators: {
6680
+ name: "lastBillReceived",
6681
+ component: props => /*#__PURE__*/React.createElement(Dropdown, {
6682
+ option: yesNo,
6683
+ optionKey: "name",
6684
+ selected: props.value,
6685
+ select: props.onChange
6686
+ })
6687
+ }
6688
+ });
6689
+ if (lastBillReceived === "Yes") {
6690
+ fields.push({
6691
+ label: t("When was the last bill received *"),
6692
+ isMandatory: true,
6693
+ type: "custom",
6694
+ key: "billMonthYear",
6695
+ populators: {
6696
+ name: "billMonthYear",
6697
+ component: props => /*#__PURE__*/React.createElement(Dropdown, {
6698
+ option: monthYearOptions,
6699
+ optionKey: "name",
6700
+ selected: props.value,
6701
+ select: props.onChange
6702
+ })
6703
+ }
6704
+ });
6705
+ } else if (lastBillReceived === "No") {
6706
+ fields.push({
6707
+ label: t("Reason *"),
6708
+ isMandatory: true,
6709
+ type: "text",
6710
+ populators: {
6711
+ name: "reason",
6712
+ validation: {
6713
+ required: true
6714
+ }
6715
+ }
6716
+ });
6717
+ }
6718
+ fields.push({
6719
+ label: t("Access to Meter"),
6720
+ isMandatory: false,
6721
+ type: "custom",
6722
+ key: "accessToMeter",
6723
+ populators: {
6724
+ name: "accessToMeter",
6725
+ component: props => /*#__PURE__*/React.createElement(Dropdown, {
6726
+ option: yesNo,
6727
+ optionKey: "name",
6728
+ selected: props.value,
6729
+ select: props.onChange
6730
+ })
6731
+ }
6732
+ }, {
6733
+ label: t("Sewer Connection"),
6734
+ isMandatory: true,
6735
+ type: "custom",
6736
+ key: "sewerConnection",
6737
+ populators: {
6738
+ name: "sewerConnection",
6739
+ component: props => /*#__PURE__*/React.createElement(Dropdown, {
6740
+ option: yesNo,
6741
+ optionKey: "name",
6742
+ selected: props.value,
6743
+ select: props.onChange
6744
+ })
6745
+ }
6746
+ });
6747
+ if (sewerConnection === "No") {
6748
+ fields.push({
6749
+ label: t("Septic Tank"),
6750
+ isMandatory: true,
6751
+ type: "custom",
6752
+ key: "septicTank",
6753
+ populators: {
6754
+ name: "septicTank",
6755
+ component: props => /*#__PURE__*/React.createElement(Dropdown, {
6756
+ option: yesNo,
6757
+ optionKey: "name",
6758
+ selected: props.value,
6759
+ select: props.onChange
6760
+ })
6761
+ }
6762
+ });
6763
+ }
6764
+ return [{
6765
+ head: t("EKYC_METER_DETAILS"),
6766
+ body: fields
6767
+ }];
5776
6768
  };
5777
6769
 
5778
6770
  const MeterDetails = ({
@@ -5780,17 +6772,23 @@ const MeterDetails = ({
5780
6772
  onSelect,
5781
6773
  formData
5782
6774
  }) => {
6775
+ const {
6776
+ t
6777
+ } = useTranslation();
5783
6778
  const location = useLocation();
5784
6779
  const flowState = location.state || {};
5785
6780
  const tenantId = Digit.ULBService.getCurrentTenantId();
5786
- const searchKno = (flowState === null || flowState === void 0 ? void 0 : flowState.kNumber) || (flowState === null || flowState === void 0 ? void 0 : flowState.kno) || (formData === null || formData === void 0 ? void 0 : formData.kNumber) || (formData === null || formData === void 0 ? void 0 : formData.kno) || sessionStorage.getItem("EKYC_K_NUMBER");
6781
+ const queryParams = new URLSearchParams(location.search);
6782
+ const urlKno = queryParams.get("kno");
6783
+ const searchKno = urlKno || (flowState === null || flowState === void 0 ? void 0 : flowState.kNumber) || (flowState === null || flowState === void 0 ? void 0 : flowState.kno) || (formData === null || formData === void 0 ? void 0 : formData.kNumber) || (formData === null || formData === void 0 ? void 0 : formData.kno) || sessionStorage.getItem("EKYC_K_NUMBER");
5787
6784
  const {
5788
6785
  isLoading,
5789
6786
  data: searchData
5790
6787
  } = Digit.Hooks.ekyc.useSearchConnection({
5791
6788
  tenantId,
5792
6789
  details: {
5793
- kno: searchKno
6790
+ kno: searchKno,
6791
+ fetchType: "METER"
5794
6792
  }
5795
6793
  }, {
5796
6794
  enabled: !!searchKno,
@@ -5798,113 +6796,110 @@ const MeterDetails = ({
5798
6796
  });
5799
6797
  const updateMutation = Digit.Hooks.ekyc.useEkycUpdate(tenantId);
5800
6798
  const savedData = (formData === null || formData === void 0 ? void 0 : formData.meterDetails) || {};
5801
- const [connectionCategory, setConnectionCategory] = useState(savedData.connectionCategory || "");
5802
- const [saType, setSaType] = useState(savedData.saType || "");
5803
- const [status, setStatus] = useState(savedData.status || "");
5804
- const [mrCode, setMrCode] = useState(savedData.mrCode || "");
5805
- const [areaCode, setAreaCode] = useState(savedData.areaCode || "");
5806
- const [mrKey, setMrKey] = useState(savedData.mrKey || "");
5807
- const [meterNumber, setMeterNumber] = useState(savedData.meterNumber || "");
5808
- const [meterMaker, setMeterMaker] = useState(savedData.meterMaker || "");
5809
- const [meterStatus, setMeterStatus] = useState(savedData.meterStatus ? {
5810
- name: savedData.meterStatus
5811
- } : null);
5812
- const [meterCondition, setMeterCondition] = useState(savedData.meterCondition ? {
5813
- name: savedData.meterCondition
5814
- } : null);
5815
- const [meterLocation, setMeterLocation] = useState(savedData.meterLocation ? {
5816
- name: savedData.meterLocation
5817
- } : null);
5818
- const [lastBillReceived, setLastBillReceived] = useState(savedData.lastBillReceived ? {
5819
- name: savedData.lastBillReceived
5820
- } : null);
5821
- const [billMonthYear, setBillMonthYear] = useState(savedData.billMonthYear ? {
5822
- name: savedData.billMonthYear
5823
- } : null);
5824
- const [reason, setReason] = useState(savedData.reason || "");
5825
- const [accessToMeter, setAccessToMeter] = useState(savedData.accessToMeter ? {
5826
- name: savedData.accessToMeter
5827
- } : null);
5828
- const [sewerConnection, setSewerConnection] = useState(savedData.sewerConnection ? {
5829
- name: savedData.sewerConnection
5830
- } : null);
5831
- const [septicTank, setSepticTank] = useState(savedData.septicTank ? {
5832
- name: savedData.septicTank
5833
- } : null);
5834
6799
  const [meterPhoto, setMeterPhoto] = useState(null);
5835
6800
  const [meterPhotoId, setMeterPhotoId] = useState(savedData.meterPhotoId || null);
5836
6801
  const [toast, setToast] = useState(null);
5837
- const yesNo = [{
5838
- name: "Yes"
5839
- }, {
5840
- name: "No"
5841
- }];
5842
- const meterStatusOptions = [{
5843
- name: "Metered"
5844
- }, {
5845
- name: "Unmetered"
5846
- }, {
5847
- name: "Can not be identified"
5848
- }];
5849
- const meterConditionOptions = [{
5850
- name: "Damaged"
5851
- }, {
5852
- name: "Not-Damaged"
5853
- }];
5854
- const meterLocationOptions = [{
5855
- name: "Inside"
5856
- }, {
5857
- name: "Outside"
5858
- }];
5859
- const monthYearOptions = [];
5860
- for (let y = 1998; y <= 2026; y++) {
5861
- for (let m = 1; m <= 12; m++) {
5862
- monthYearOptions.push({
5863
- name: `${m}/${y}`
5864
- });
5865
- }
5866
- }
6802
+ const [isDataLoaded, setIsDataLoaded] = useState(false);
6803
+ const [canSubmit, setCanSubmit] = useState(false);
6804
+ const [defaultValues, setDefaultValues] = useState(() => ({
6805
+ connectionCategory: savedData.connectionCategory || "",
6806
+ saType: savedData.saType || "",
6807
+ status: savedData.status || "",
6808
+ mrCode: savedData.mrCode || "",
6809
+ areaCode: savedData.areaCode || "",
6810
+ mrKey: savedData.mrKey || "",
6811
+ meterNumber: savedData.meterNumber || "",
6812
+ meterMaker: savedData.meterMaker || "",
6813
+ meterStatus: savedData.meterStatus ? {
6814
+ name: savedData.meterStatus
6815
+ } : null,
6816
+ meterCondition: savedData.meterCondition ? {
6817
+ name: savedData.meterCondition
6818
+ } : null,
6819
+ meterLocation: savedData.meterLocation ? {
6820
+ name: savedData.meterLocation
6821
+ } : null,
6822
+ lastBillReceived: savedData.lastBillReceived ? {
6823
+ name: savedData.lastBillReceived
6824
+ } : null,
6825
+ billMonthYear: savedData.billMonthYear ? {
6826
+ name: savedData.billMonthYear
6827
+ } : null,
6828
+ reason: savedData.reason || "",
6829
+ accessToMeter: savedData.accessToMeter ? {
6830
+ name: savedData.accessToMeter
6831
+ } : null,
6832
+ sewerConnection: savedData.sewerConnection ? {
6833
+ name: savedData.sewerConnection
6834
+ } : null,
6835
+ septicTank: savedData.septicTank ? {
6836
+ name: savedData.septicTank
6837
+ } : null,
6838
+ meterPhoto: savedData.meterPhotoId ? "Uploaded" : null
6839
+ }));
6840
+ const [localFormData, setLocalFormData] = useState(defaultValues);
6841
+ const extractApplicationData = searchData => {
6842
+ if (!searchData) return null;
6843
+ const reviewWrapper = (searchData === null || searchData === void 0 ? void 0 : searchData.applicationReviewInfo) || (searchData === null || searchData === void 0 ? void 0 : searchData.applicationReview) || searchData;
6844
+ const applicationData = (Array.isArray(reviewWrapper) ? reviewWrapper[0] : reviewWrapper) || {};
6845
+ return (applicationData === null || applicationData === void 0 ? void 0 : applicationData.newData) || applicationData;
6846
+ };
5867
6847
  useEffect(() => {
5868
- const rawData = searchData || (formData === null || formData === void 0 ? void 0 : formData.connectionDetails);
6848
+ const appData = extractApplicationData(searchData);
6849
+ const rawData = appData || (formData === null || formData === void 0 ? void 0 : formData.connectionDetails);
5869
6850
  const apiMeter = (rawData === null || rawData === void 0 ? void 0 : rawData.meterDetails) || rawData || {};
5870
- if (apiMeter && Object.keys(apiMeter).length > 0 && !savedData.connectionCategory) {
5871
- if (apiMeter.connectionCategory) setConnectionCategory(apiMeter.connectionCategory);
5872
- if (apiMeter.saType) setSaType(apiMeter.saType);
5873
- if (apiMeter.statusFlag) setStatus(apiMeter.statusFlag);
5874
- if (apiMeter.mrcode) setMrCode(String(apiMeter.mrcode));
5875
- if (apiMeter.areacode) setAreaCode(String(apiMeter.areacode));
5876
- if (apiMeter.mrkey) setMrKey(String(apiMeter.mrkey));
5877
- if (apiMeter.meterNumber) setMeterNumber(apiMeter.meterNumber);
5878
- if (apiMeter.meterMake) setMeterMaker(apiMeter.meterMake);
6851
+ if (apiMeter && Object.keys(apiMeter).length > 0 && !isDataLoaded) {
6852
+ let mStatus = null;
6853
+ let mCondition = null;
6854
+ let mLoc = null;
6855
+ let billRec = null;
6856
+ let billMonYr = null;
6857
+ let accToMeter = null;
6858
+ let sewerConn = null;
6859
+ let sepTank = null;
5879
6860
  if (apiMeter.meterStatus) {
5880
- const matchingStatus = meterStatusOptions.find(o => o.name.toLowerCase() === apiMeter.meterStatus.toLowerCase());
5881
- if (matchingStatus) setMeterStatus(matchingStatus);else setMeterStatus({
6861
+ const matchingStatus = [{
6862
+ name: "Metered"
6863
+ }, {
6864
+ name: "Unmetered"
6865
+ }, {
6866
+ name: "Can not be identified"
6867
+ }].find(o => o.name.toLowerCase() === apiMeter.meterStatus.toLowerCase());
6868
+ if (matchingStatus) mStatus = matchingStatus;else mStatus = {
5882
6869
  name: apiMeter.meterStatus
5883
- });
6870
+ };
5884
6871
  } else if (apiMeter.metered !== undefined) {
5885
- setMeterStatus({
6872
+ mStatus = {
5886
6873
  name: apiMeter.metered ? "Metered" : "Unmetered"
5887
- });
6874
+ };
5888
6875
  }
5889
6876
  if (apiMeter.meterCondition) {
5890
- const matchingCond = meterConditionOptions.find(o => o.name.toLowerCase() === apiMeter.meterCondition.toLowerCase());
5891
- if (matchingCond) setMeterCondition(matchingCond);else setMeterCondition({
6877
+ const matchingCond = [{
6878
+ name: "Damaged"
6879
+ }, {
6880
+ name: "Not-Damaged"
6881
+ }].find(o => o.name.toLowerCase() === apiMeter.meterCondition.toLowerCase());
6882
+ if (matchingCond) mCondition = matchingCond;else mCondition = {
5892
6883
  name: apiMeter.meterCondition
5893
- });
6884
+ };
5894
6885
  }
5895
6886
  if (apiMeter.meterLocation) {
5896
- const matchingLoc = meterLocationOptions.find(o => o.name.toLowerCase() === apiMeter.meterLocation.toLowerCase() || apiMeter.meterLocation.toLowerCase().includes(o.name.toLowerCase()));
5897
- if (matchingLoc) setMeterLocation(matchingLoc);else setMeterLocation({
6887
+ const matchingLoc = [{
6888
+ name: "Inside"
6889
+ }, {
6890
+ name: "Outside"
6891
+ }].find(o => o.name.toLowerCase() === apiMeter.meterLocation.toLowerCase() || apiMeter.meterLocation.toLowerCase().includes(o.name.toLowerCase()));
6892
+ if (matchingLoc) mLoc = matchingLoc;else mLoc = {
5898
6893
  name: apiMeter.meterLocation
5899
- });
6894
+ };
5900
6895
  }
5901
6896
  if (apiMeter.lastBillRaised !== undefined && apiMeter.lastBillRaised !== null) {
5902
6897
  const strVal = String(apiMeter.lastBillRaised).toLowerCase();
5903
- if (strVal === "true" || strVal === "yes") setLastBillReceived({
6898
+ if (strVal === "true" || strVal === "yes") billRec = {
5904
6899
  name: "Yes"
5905
- });else setLastBillReceived({
6900
+ };else billRec = {
5906
6901
  name: "No"
5907
- });
6902
+ };
5908
6903
  }
5909
6904
  if (apiMeter.lastBillReceivedDate) {
5910
6905
  const formatted = apiMeter.lastBillReceivedDate.replace("-", "/");
@@ -5912,199 +6907,213 @@ const MeterDetails = ({
5912
6907
  if (parsedParts.length === 2) {
5913
6908
  const mon = parseInt(parsedParts[0], 10);
5914
6909
  const yr = parseInt(parsedParts[1], 10);
5915
- setBillMonthYear({
6910
+ billMonYr = {
5916
6911
  name: `${mon}/${yr}`
5917
- });
6912
+ };
5918
6913
  } else {
5919
- setBillMonthYear({
6914
+ billMonYr = {
5920
6915
  name: apiMeter.lastBillReceivedDate
5921
- });
6916
+ };
5922
6917
  }
5923
6918
  }
5924
- if (apiMeter.lastBillNotRaisedReason) setReason(apiMeter.lastBillNotRaisedReason);
5925
6919
  if (apiMeter.accessToMeter !== undefined && apiMeter.accessToMeter !== null) {
5926
6920
  const strVal = String(apiMeter.accessToMeter).toLowerCase();
5927
- if (strVal === "true" || strVal === "yes") setAccessToMeter({
6921
+ if (strVal === "true" || strVal === "yes") accToMeter = {
5928
6922
  name: "Yes"
5929
- });else setAccessToMeter({
6923
+ };else accToMeter = {
5930
6924
  name: "No"
5931
- });
6925
+ };
5932
6926
  }
5933
6927
  if (apiMeter.sewerConnection !== undefined && apiMeter.sewerConnection !== null) {
5934
6928
  const strVal = String(apiMeter.sewerConnection).toLowerCase();
5935
- if (strVal === "true" || strVal === "yes") setSewerConnection({
6929
+ if (strVal === "true" || strVal === "yes") sewerConn = {
5936
6930
  name: "Yes"
5937
- });else setSewerConnection({
6931
+ };else sewerConn = {
5938
6932
  name: "No"
5939
- });
6933
+ };
5940
6934
  }
5941
6935
  if (apiMeter.septicTank !== undefined && apiMeter.septicTank !== null) {
5942
6936
  const strVal = String(apiMeter.septicTank).toLowerCase();
5943
- if (strVal === "true" || strVal === "yes") setSepticTank({
6937
+ if (strVal === "true" || strVal === "yes") sepTank = {
5944
6938
  name: "Yes"
5945
- });else setSepticTank({
6939
+ };else sepTank = {
5946
6940
  name: "No"
5947
- });
6941
+ };
6942
+ }
6943
+ const updatedDefaults = {
6944
+ connectionCategory: savedData.connectionCategory || apiMeter.connectionCategory || "",
6945
+ saType: savedData.saType || apiMeter.saType || "",
6946
+ status: savedData.status || apiMeter.statusFlag || "",
6947
+ mrCode: savedData.mrCode || (apiMeter.mrcode ? String(apiMeter.mrcode) : ""),
6948
+ areaCode: savedData.areaCode || (apiMeter.areacode ? String(apiMeter.areacode) : ""),
6949
+ mrKey: savedData.mrKey || (apiMeter.mrkey ? String(apiMeter.mrkey) : ""),
6950
+ meterNumber: savedData.meterNumber || apiMeter.meterNumber || "",
6951
+ meterMaker: savedData.meterMaker || apiMeter.meterMake || "",
6952
+ meterStatus: savedData.meterStatus ? {
6953
+ name: savedData.meterStatus
6954
+ } : mStatus,
6955
+ meterCondition: savedData.meterCondition ? {
6956
+ name: savedData.meterCondition
6957
+ } : mCondition,
6958
+ meterLocation: savedData.meterLocation ? {
6959
+ name: savedData.meterLocation
6960
+ } : mLoc,
6961
+ lastBillReceived: savedData.lastBillReceived ? {
6962
+ name: savedData.lastBillReceived
6963
+ } : billRec,
6964
+ billMonthYear: savedData.billMonthYear ? {
6965
+ name: savedData.billMonthYear
6966
+ } : billMonYr,
6967
+ reason: savedData.reason || apiMeter.lastBillNotRaisedReason || "",
6968
+ accessToMeter: savedData.accessToMeter ? {
6969
+ name: savedData.accessToMeter
6970
+ } : accToMeter,
6971
+ sewerConnection: savedData.sewerConnection ? {
6972
+ name: savedData.sewerConnection
6973
+ } : sewerConn,
6974
+ septicTank: savedData.septicTank ? {
6975
+ name: savedData.septicTank
6976
+ } : sepTank,
6977
+ meterPhoto: savedData.meterPhotoId || apiMeter.meterPhotoFileStoreId || null
6978
+ };
6979
+ setDefaultValues(updatedDefaults);
6980
+ setLocalFormData(updatedDefaults);
6981
+ if (updatedDefaults.meterPhoto) {
6982
+ setMeterPhotoId(updatedDefaults.meterPhoto);
5948
6983
  }
5949
- if (apiMeter.meterPhotoFileStoreId) setMeterPhotoId(apiMeter.meterPhotoFileStoreId);
6984
+ setIsDataLoaded(true);
5950
6985
  }
5951
- }, [searchData, formData === null || formData === void 0 ? void 0 : formData.connectionDetails]);
5952
- const isFrozen = (meterStatus === null || meterStatus === void 0 ? void 0 : meterStatus.name) === "Can not be identified";
5953
- const uploadPhoto = async e => {
6986
+ }, [searchData, formData === null || formData === void 0 ? void 0 : formData.connectionDetails, isDataLoaded]);
6987
+ const handleUpload = async (e, onChange) => {
5954
6988
  const file = e.target.files[0];
5955
6989
  if (!file) return;
6990
+ if (file.size > 2000000) {
6991
+ setToast({
6992
+ type: "error",
6993
+ message: t("Max size 2MB exceeded")
6994
+ });
6995
+ return;
6996
+ }
5956
6997
  try {
5957
6998
  var _res$data, _res$data$files, _res$data$files$;
5958
6999
  const res = await Digit.UploadServices.Filestorage("EKYC", file, tenantId);
5959
- const id = res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$files = _res$data.files) === null || _res$data$files === void 0 ? void 0 : (_res$data$files$ = _res$data$files[0]) === null || _res$data$files$ === void 0 ? void 0 : _res$data$files$.fileStoreId;
5960
- if (id) {
5961
- setMeterPhotoId(id);
7000
+ const fileStoreId = res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$files = _res$data.files) === null || _res$data$files === void 0 ? void 0 : (_res$data$files$ = _res$data$files[0]) === null || _res$data$files$ === void 0 ? void 0 : _res$data$files$.fileStoreId;
7001
+ if (fileStoreId) {
7002
+ onChange(file.name);
7003
+ setMeterPhotoId(fileStoreId);
5962
7004
  const reader = new FileReader();
5963
7005
  reader.onloadend = () => setMeterPhoto(reader.result);
5964
7006
  reader.readAsDataURL(file);
7007
+ setToast({
7008
+ type: "success",
7009
+ message: t("Upload successful")
7010
+ });
5965
7011
  }
5966
7012
  } catch {
5967
7013
  setToast({
5968
7014
  type: "error",
5969
- message: "Upload failed"
7015
+ message: t("Upload failed")
5970
7016
  });
5971
7017
  }
5972
7018
  };
5973
- const isValid = () => {
5974
- if (!connectionCategory) return false;
5975
- if (!meterStatus) return false;
5976
- if (!meterLocation) return false;
5977
- if (!lastBillReceived) return false;
5978
- if (!sewerConnection) return false;
5979
- if ((meterStatus === null || meterStatus === void 0 ? void 0 : meterStatus.name) === "Metered" && !meterPhotoId) return false;
5980
- if ((lastBillReceived === null || lastBillReceived === void 0 ? void 0 : lastBillReceived.name) === "No" && !reason) return false;
5981
- if ((lastBillReceived === null || lastBillReceived === void 0 ? void 0 : lastBillReceived.name) === "Yes" && !billMonthYear) return false;
5982
- if ((sewerConnection === null || sewerConnection === void 0 ? void 0 : sewerConnection.name) === "No" && !septicTank) return false;
5983
- return true;
7019
+ const onFormValueChange = (setValue, data) => {
7020
+ var _data$meterStatus, _localFormData$meterS, _data$lastBillReceive, _localFormData$lastBi, _data$sewerConnection, _localFormData$sewerC;
7021
+ const meterStatusChanged = ((data === null || data === void 0 ? void 0 : (_data$meterStatus = data.meterStatus) === null || _data$meterStatus === void 0 ? void 0 : _data$meterStatus.name) || (data === null || data === void 0 ? void 0 : data.meterStatus)) !== ((localFormData === null || localFormData === void 0 ? void 0 : (_localFormData$meterS = localFormData.meterStatus) === null || _localFormData$meterS === void 0 ? void 0 : _localFormData$meterS.name) || (localFormData === null || localFormData === void 0 ? void 0 : localFormData.meterStatus));
7022
+ const lastBillReceivedChanged = ((data === null || data === void 0 ? void 0 : (_data$lastBillReceive = data.lastBillReceived) === null || _data$lastBillReceive === void 0 ? void 0 : _data$lastBillReceive.name) || (data === null || data === void 0 ? void 0 : data.lastBillReceived)) !== ((localFormData === null || localFormData === void 0 ? void 0 : (_localFormData$lastBi = localFormData.lastBillReceived) === null || _localFormData$lastBi === void 0 ? void 0 : _localFormData$lastBi.name) || (localFormData === null || localFormData === void 0 ? void 0 : localFormData.lastBillReceived));
7023
+ const sewerConnectionChanged = ((data === null || data === void 0 ? void 0 : (_data$sewerConnection = data.sewerConnection) === null || _data$sewerConnection === void 0 ? void 0 : _data$sewerConnection.name) || (data === null || data === void 0 ? void 0 : data.sewerConnection)) !== ((localFormData === null || localFormData === void 0 ? void 0 : (_localFormData$sewerC = localFormData.sewerConnection) === null || _localFormData$sewerC === void 0 ? void 0 : _localFormData$sewerC.name) || (localFormData === null || localFormData === void 0 ? void 0 : localFormData.sewerConnection));
7024
+ if (meterStatusChanged || lastBillReceivedChanged || sewerConnectionChanged) {
7025
+ setLocalFormData(prev => ({
7026
+ ...prev,
7027
+ ...data
7028
+ }));
7029
+ }
7030
+ const connCatVal = data === null || data === void 0 ? void 0 : data.connectionCategory;
7031
+ const mStatusVal = data === null || data === void 0 ? void 0 : data.meterStatus;
7032
+ const mLocVal = data === null || data === void 0 ? void 0 : data.meterLocation;
7033
+ const billRecVal = data === null || data === void 0 ? void 0 : data.lastBillReceived;
7034
+ const sewerConnVal = data === null || data === void 0 ? void 0 : data.sewerConnection;
7035
+ const mPhotoId = meterPhotoId || (data === null || data === void 0 ? void 0 : data.meterPhoto);
7036
+ const reasonVal = data === null || data === void 0 ? void 0 : data.reason;
7037
+ const billMonYrVal = data === null || data === void 0 ? void 0 : data.billMonthYear;
7038
+ const sepTankVal = data === null || data === void 0 ? void 0 : data.septicTank;
7039
+ let valid = true;
7040
+ if (!connCatVal) valid = false;
7041
+ if (!mStatusVal) valid = false;
7042
+ if (!mLocVal) valid = false;
7043
+ if (!billRecVal) valid = false;
7044
+ if (!sewerConnVal) valid = false;
7045
+ if ((mStatusVal === null || mStatusVal === void 0 ? void 0 : mStatusVal.name) === "Metered" && !mPhotoId) valid = false;
7046
+ if ((billRecVal === null || billRecVal === void 0 ? void 0 : billRecVal.name) === "No" && !reasonVal) valid = false;
7047
+ if ((billRecVal === null || billRecVal === void 0 ? void 0 : billRecVal.name) === "Yes" && !billMonYrVal) valid = false;
7048
+ if ((sewerConnVal === null || sewerConnVal === void 0 ? void 0 : sewerConnVal.name) === "No" && !sepTankVal) valid = false;
7049
+ if (valid !== canSubmit) {
7050
+ setCanSubmit(valid);
7051
+ }
5984
7052
  };
5985
- const onStepSelect = async () => {
5986
- const data = {
5987
- connectionCategory,
5988
- saType,
5989
- status,
5990
- mrCode,
5991
- areaCode,
5992
- mrKey,
5993
- meterNumber,
5994
- meterMaker,
5995
- meterStatus: meterStatus === null || meterStatus === void 0 ? void 0 : meterStatus.name,
5996
- meterCondition: meterCondition === null || meterCondition === void 0 ? void 0 : meterCondition.name,
5997
- meterLocation: meterLocation === null || meterLocation === void 0 ? void 0 : meterLocation.name,
5998
- lastBillReceived: lastBillReceived === null || lastBillReceived === void 0 ? void 0 : lastBillReceived.name,
5999
- billMonthYear: billMonthYear === null || billMonthYear === void 0 ? void 0 : billMonthYear.name,
6000
- reason,
6001
- accessToMeter: accessToMeter === null || accessToMeter === void 0 ? void 0 : accessToMeter.name,
6002
- sewerConnection: sewerConnection === null || sewerConnection === void 0 ? void 0 : sewerConnection.name,
6003
- septicTank: septicTank === null || septicTank === void 0 ? void 0 : septicTank.name,
6004
- meterPhotoId
7053
+ const onSubmit = async data => {
7054
+ var _data$meterStatus2, _data$meterCondition, _data$meterLocation, _data$lastBillReceive2, _data$billMonthYear, _data$accessToMeter, _data$sewerConnection2, _data$septicTank;
7055
+ const submitData = {
7056
+ connectionCategory: data.connectionCategory,
7057
+ saType: data.saType,
7058
+ status: data.status,
7059
+ mrCode: data.mrCode,
7060
+ areaCode: data.areaCode,
7061
+ mrKey: data.mrKey,
7062
+ meterNumber: data.meterNumber,
7063
+ meterMaker: data.meterMaker,
7064
+ meterStatus: ((_data$meterStatus2 = data.meterStatus) === null || _data$meterStatus2 === void 0 ? void 0 : _data$meterStatus2.name) || data.meterStatus,
7065
+ meterCondition: ((_data$meterCondition = data.meterCondition) === null || _data$meterCondition === void 0 ? void 0 : _data$meterCondition.name) || data.meterCondition,
7066
+ meterLocation: ((_data$meterLocation = data.meterLocation) === null || _data$meterLocation === void 0 ? void 0 : _data$meterLocation.name) || data.meterLocation,
7067
+ lastBillReceived: ((_data$lastBillReceive2 = data.lastBillReceived) === null || _data$lastBillReceive2 === void 0 ? void 0 : _data$lastBillReceive2.name) || data.lastBillReceived,
7068
+ billMonthYear: ((_data$billMonthYear = data.billMonthYear) === null || _data$billMonthYear === void 0 ? void 0 : _data$billMonthYear.name) || data.billMonthYear,
7069
+ reason: data.reason,
7070
+ accessToMeter: ((_data$accessToMeter = data.accessToMeter) === null || _data$accessToMeter === void 0 ? void 0 : _data$accessToMeter.name) || data.accessToMeter,
7071
+ sewerConnection: ((_data$sewerConnection2 = data.sewerConnection) === null || _data$sewerConnection2 === void 0 ? void 0 : _data$sewerConnection2.name) || data.sewerConnection,
7072
+ septicTank: ((_data$septicTank = data.septicTank) === null || _data$septicTank === void 0 ? void 0 : _data$septicTank.name) || data.septicTank,
7073
+ meterPhotoId: meterPhotoId
6005
7074
  };
6006
7075
  try {
6007
7076
  await updateMutation.mutateAsync({
6008
7077
  RequestInfo: {},
6009
7078
  updateType: "METER",
6010
7079
  kno: searchKno,
6011
- ...data
7080
+ ...submitData
6012
7081
  });
6013
7082
  setToast({
6014
7083
  type: "success",
6015
- message: "Meter details updated successfully!"
7084
+ message: t("Meter details updated successfully!")
6016
7085
  });
6017
- onSelect(config.key, data);
7086
+ onSelect(config.key, submitData);
6018
7087
  } catch (error) {
6019
7088
  setToast({
6020
7089
  type: "error",
6021
- message: "Failed to update meter details"
7090
+ message: t("Failed to update meter details")
6022
7091
  });
6023
7092
  }
6024
7093
  };
6025
7094
  if (isLoading) {
6026
7095
  return /*#__PURE__*/React.createElement(Loader, null);
6027
7096
  }
6028
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(FormStep, {
6029
- onSelect: onStepSelect,
6030
- config: config,
6031
- isDisabled: !isValid()
6032
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Connection Category *"), /*#__PURE__*/React.createElement(TextInput, {
6033
- value: connectionCategory,
6034
- onChange: e => setConnectionCategory(e.target.value)
6035
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "SA Type"), /*#__PURE__*/React.createElement(TextInput, {
6036
- value: saType,
6037
- onChange: e => setSaType(e.target.value)
6038
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Status"), /*#__PURE__*/React.createElement(TextInput, {
6039
- value: status,
6040
- onChange: e => setStatus(e.target.value)
6041
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "MR Code"), /*#__PURE__*/React.createElement(TextInput, {
6042
- value: mrCode,
6043
- onChange: e => setMrCode(e.target.value)
6044
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Area Code"), /*#__PURE__*/React.createElement(TextInput, {
6045
- value: areaCode,
6046
- onChange: e => setAreaCode(e.target.value)
6047
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "MR Key"), /*#__PURE__*/React.createElement(TextInput, {
6048
- value: mrKey,
6049
- onChange: e => setMrKey(e.target.value)
6050
- })), !isFrozen && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Meter Number"), /*#__PURE__*/React.createElement(TextInput, {
6051
- value: meterNumber,
6052
- onChange: e => setMeterNumber(e.target.value)
6053
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Meter Maker"), /*#__PURE__*/React.createElement(TextInput, {
6054
- value: meterMaker,
6055
- onChange: e => setMeterMaker(e.target.value)
6056
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Meter Condition"), /*#__PURE__*/React.createElement(Dropdown, {
6057
- option: meterConditionOptions,
6058
- selected: meterCondition,
6059
- select: setMeterCondition
6060
- })), (meterStatus === null || meterStatus === void 0 ? void 0 : meterStatus.name) === "Metered" && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Meter Photo *"), /*#__PURE__*/React.createElement(UploadFile, {
6061
- onUpload: uploadPhoto,
6062
- message: meterPhotoId ? "Uploaded" : "No file"
6063
- })), meterPhoto && /*#__PURE__*/React.createElement("div", {
6064
- style: {
6065
- gridColumn: "span 2"
6066
- }
6067
- }, /*#__PURE__*/React.createElement("img", {
6068
- src: meterPhoto,
6069
- style: {
6070
- width: "100%"
6071
- }
6072
- })))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Meter Status *"), /*#__PURE__*/React.createElement(Dropdown, {
6073
- option: meterStatusOptions,
6074
- selected: meterStatus,
6075
- select: setMeterStatus
6076
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Meter Location *"), /*#__PURE__*/React.createElement(Dropdown, {
6077
- option: meterLocationOptions,
6078
- selected: meterLocation,
6079
- select: setMeterLocation
6080
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Last Bill Received *"), /*#__PURE__*/React.createElement(Dropdown, {
6081
- option: yesNo,
6082
- selected: lastBillReceived,
6083
- select: setLastBillReceived
6084
- })), (lastBillReceived === null || lastBillReceived === void 0 ? void 0 : lastBillReceived.name) === "Yes" && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "When was the last bill received *"), /*#__PURE__*/React.createElement(Dropdown, {
6085
- option: monthYearOptions,
6086
- selected: billMonthYear,
6087
- select: setBillMonthYear
6088
- })), (lastBillReceived === null || lastBillReceived === void 0 ? void 0 : lastBillReceived.name) === "No" && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Reason *"), /*#__PURE__*/React.createElement(TextInput, {
6089
- value: reason,
6090
- onChange: e => setReason(e.target.value)
6091
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Access to Meter"), /*#__PURE__*/React.createElement(Dropdown, {
6092
- option: yesNo,
6093
- selected: accessToMeter,
6094
- select: setAccessToMeter
6095
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Sewer Connection *"), /*#__PURE__*/React.createElement(Dropdown, {
6096
- option: yesNo,
6097
- selected: sewerConnection,
6098
- select: setSewerConnection
6099
- })), (sewerConnection === null || sewerConnection === void 0 ? void 0 : sewerConnection.name) === "No" && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Septic Tank *"), /*#__PURE__*/React.createElement(Dropdown, {
6100
- option: yesNo,
6101
- selected: septicTank,
6102
- select: setSepticTank
6103
- })), toast && /*#__PURE__*/React.createElement(Toast, {
6104
- label: toast.message,
7097
+ const Config = MeterDetailsConfig(t, localFormData, handleUpload, meterPhoto, meterPhotoId, setMeterPhoto, setMeterPhotoId);
7098
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(FormComposer, {
7099
+ key: isDataLoaded ? "loaded" : "loading",
7100
+ isDisabled: !canSubmit,
7101
+ label: t("ES_COMMON_CONTINUE"),
7102
+ config: Config.map(item => ({
7103
+ ...item,
7104
+ isCollapsible: true,
7105
+ isDefaultOpen: true
7106
+ })),
7107
+ onSubmit: onSubmit,
7108
+ defaultValues: defaultValues,
7109
+ onFormValueChange: onFormValueChange,
7110
+ noCard: false,
7111
+ submitInForm: true
7112
+ }), toast && /*#__PURE__*/React.createElement(Toast, {
6105
7113
  error: toast.type === "error",
7114
+ label: toast.message,
6106
7115
  onClose: () => setToast(null)
6107
- })));
7116
+ }));
6108
7117
  };
6109
7118
 
6110
7119
  const Home = () => {
@@ -6155,7 +7164,7 @@ const Home = () => {
6155
7164
  const Inbox$1 = ({
6156
7165
  parentRoute
6157
7166
  }) => {
6158
- var _formState$tableForm3, _formState$tableForm4, _formState$searchForm3, _formState$searchForm4, _dashboardData$dashbo2;
7167
+ var _formState$tableForm3, _formState$tableForm4, _formState$searchForm3, _formState$searchForm4, _dashboardData$dashbo;
6159
7168
  const tenantId = Digit.ULBService.getCurrentTenantId();
6160
7169
  const location = useLocation();
6161
7170
  const formInitValue = {
@@ -6178,10 +7187,19 @@ const Inbox$1 = ({
6178
7187
  search: (formState === null || formState === void 0 ? void 0 : formState.searchForm) || {}
6179
7188
  };
6180
7189
  }, [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]);
7190
+ const filters = useMemo(() => {
7191
+ const searchForm = (formState === null || formState === void 0 ? void 0 : formState.searchForm) || {};
7192
+ return {
7193
+ ...searchForm,
7194
+ ...(searchForm.kNumber && {
7195
+ kno: searchForm.kNumber
7196
+ })
7197
+ };
7198
+ }, [formState === null || formState === void 0 ? void 0 : formState.searchForm]);
6181
7199
  const {
6182
7200
  isLoading,
6183
7201
  data: dashboardData = {}
6184
- } = Digit.Hooks.ekyc.useEkycSurveyorDashboard({}, queryParams, {
7202
+ } = Digit.Hooks.ekyc.useEkycApplicationList(filters, queryParams, {
6185
7203
  enabled: !!tenantId,
6186
7204
  keepPreviousData: true
6187
7205
  });
@@ -6204,18 +7222,17 @@ const Inbox$1 = ({
6204
7222
  keepPreviousData: true
6205
7223
  });
6206
7224
  const sourceData = useMemo(() => {
6207
- var _dashboardData$dashbo;
6208
7225
  if (isSearchActive) {
6209
7226
  if (!searchData) return [];
6210
7227
  return [searchData];
6211
7228
  }
6212
- return (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.consumerList) || [];
7229
+ return (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.consumerList) || [];
6213
7230
  }, [isSearchActive, searchData, dashboardData]);
6214
7231
  const filteredData = useMemo(() => {
6215
7232
  return (sourceData || []).map(item => {
6216
7233
  const isSearchItem = !!item.connectionDetails;
6217
7234
  if (isSearchItem) {
6218
- var _item$propertyInfo, _item$propertyInfo2, _item$connectionDetai, _item$propertyInfo3, _item$connectionDetai2, _item$connectionDetai3;
7235
+ var _item$propertyInfo, _item$propertyInfo2, _item$connectionDetai, _item$propertyInfo3, _item$connectionDetai2, _item$connectionDetai3, _item$connectionDetai4, _item$connectionDetai5;
6219
7236
  return {
6220
7237
  applicationNo: ((_item$propertyInfo = item.propertyInfo) === null || _item$propertyInfo === void 0 ? void 0 : _item$propertyInfo.kno) || "",
6221
7238
  connectionNo: ((_item$propertyInfo2 = item.propertyInfo) === null || _item$propertyInfo2 === void 0 ? void 0 : _item$propertyInfo2.kno) || "",
@@ -6223,6 +7240,7 @@ const Inbox$1 = ({
6223
7240
  applicationNumber: ((_item$propertyInfo3 = item.propertyInfo) === null || _item$propertyInfo3 === void 0 ? void 0 : _item$propertyInfo3.kno) || "",
6224
7241
  citizenName: ((_item$connectionDetai2 = item.connectionDetails) === null || _item$connectionDetai2 === void 0 ? void 0 : _item$connectionDetai2.consumerName) || "",
6225
7242
  status: ((_item$connectionDetai3 = item.connectionDetails) === null || _item$connectionDetai3 === void 0 ? void 0 : _item$connectionDetai3.statusflag) || "",
7243
+ 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",
6226
7244
  sla: 0
6227
7245
  };
6228
7246
  }
@@ -6234,15 +7252,13 @@ const Inbox$1 = ({
6234
7252
  applicationNumber: item.kno || item.applicationNumber || "",
6235
7253
  citizenName: item.consumerName || item.citizenName || "",
6236
7254
  status: item.status || "",
7255
+ ekycStatus: item.ekycStatus || item.ekycstatus || "NA",
6237
7256
  sla: item.sla ?? 0
6238
7257
  };
6239
7258
  });
6240
7259
  }, [sourceData]);
6241
- const totalRecords = (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo2 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo2 === void 0 ? void 0 : _dashboardData$dashbo2.totalRecords) || (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.totalCount) || 0;
7260
+ const totalRecords = (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.totalRecords) || (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.totalCount) || 0;
6242
7261
  const checkPathName = location.pathname.includes("ekyc/inbox");
6243
- const PropsForInboxLinks = {
6244
- headerText: checkPathName ? "MODULE_WATER" : "MODULE_SW"
6245
- };
6246
7262
  const SearchFormFields = useCallback(({
6247
7263
  registerRef,
6248
7264
  searchFormState,
@@ -6276,12 +7292,12 @@ const Inbox$1 = ({
6276
7292
  });
6277
7293
  };
6278
7294
  const searchFormDefaultValues = {
6279
- mobileNumber: "",
7295
+ kNumber: "",
6280
7296
  applicationNumber: "",
6281
7297
  consumerNo: ""
6282
7298
  };
6283
7299
  const onSearchFormReset = setSearchFormValue => {
6284
- setSearchFormValue("mobileNumber", null);
7300
+ setSearchFormValue("kNumber", null);
6285
7301
  setSearchFormValue("applicationNumber", null);
6286
7302
  setSearchFormValue("consumerNo", null);
6287
7303
  dispatch({
@@ -6303,13 +7319,6 @@ const Inbox$1 = ({
6303
7319
  setFilterFormValue,
6304
7320
  getFilterFormValue
6305
7321
  }) => /*#__PURE__*/React.createElement(React.Fragment, null), []);
6306
- const propsForFilterForm = {
6307
- FilterFormFields,
6308
- onFilterFormSubmit: () => {},
6309
- filterFormDefaultValues: "",
6310
- resetFilterFormDefaultValues: "",
6311
- onFilterFormReset: () => {}
6312
- };
6313
7322
  function formReducer(state, payload) {
6314
7323
  const storageKey = payload.checkPathName ? "EKYC.INBOX" : "EKYC.SW.INBOX";
6315
7324
  switch (payload.action) {
@@ -6401,220 +7410,14 @@ const Inbox$1 = ({
6401
7410
  return /*#__PURE__*/React.createElement("div", {
6402
7411
  className: "app-container"
6403
7412
  }, /*#__PURE__*/React.createElement(InboxComposer, _extends({
6404
- isInboxLoading,
6405
- PropsForInboxLinks
6406
- }, propsForSearchForm, propsForFilterForm, {
7413
+ isInboxLoading
7414
+ }, propsForSearchForm, {
6407
7415
  propsForInboxTable,
6408
7416
  formState
6409
7417
  })));
6410
7418
  };
6411
7419
 
6412
- const AddressDetails = ({
6413
- config,
6414
- onSelect
6415
- }) => {
6416
- var _mdmsData$MdmsRes, _mdmsData$MdmsRes$ego, _mdmsData$MdmsRes$ego2, _mdmsData$MdmsRes$ego3, _mdmsData$MdmsRes$ego4;
6417
- const {
6418
- t
6419
- } = useTranslation();
6420
- const tenantId = Digit.ULBService.getCurrentTenantId();
6421
- const [houseNo, setHouseNo] = useState("");
6422
- const [street, setStreet] = useState("");
6423
- const [locality, setLocality] = useState("");
6424
- const [landmark, setLandmark] = useState("");
6425
- const [subLocality, setSubLocality] = useState(null);
6426
- const [pinCode, setPinCode] = useState("");
6427
- const [assembly, setAssembly] = useState(null);
6428
- const [ward, setWard] = useState(null);
6429
- const [zone, setZone] = useState(null);
6430
- const [latitude, setLatitude] = useState("");
6431
- const [longitude, setLongitude] = useState("");
6432
- const [addressType, setAddressType] = useState(null);
6433
- const [doorPhoto, setDoorPhoto] = useState(null);
6434
- const [doorPhotoFileStoreId, setDoorPhotoFileStoreId] = useState(null);
6435
- const [toast, setToast] = useState(null);
6436
- const {
6437
- data: mdmsData,
6438
- isLoading
6439
- } = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]);
6440
- const assemblies = (mdmsData === null || mdmsData === void 0 ? void 0 : (_mdmsData$MdmsRes = mdmsData.MdmsRes) === null || _mdmsData$MdmsRes === void 0 ? void 0 : (_mdmsData$MdmsRes$ego = _mdmsData$MdmsRes["egov-location"]) === null || _mdmsData$MdmsRes$ego === void 0 ? void 0 : (_mdmsData$MdmsRes$ego2 = _mdmsData$MdmsRes$ego.TenantBoundary) === null || _mdmsData$MdmsRes$ego2 === void 0 ? void 0 : (_mdmsData$MdmsRes$ego3 = _mdmsData$MdmsRes$ego2[0]) === null || _mdmsData$MdmsRes$ego3 === void 0 ? void 0 : (_mdmsData$MdmsRes$ego4 = _mdmsData$MdmsRes$ego3.boundary) === null || _mdmsData$MdmsRes$ego4 === void 0 ? void 0 : _mdmsData$MdmsRes$ego4.children) || [];
6441
- useEffect(() => {
6442
- let isMounted = true;
6443
- if (navigator.geolocation) {
6444
- navigator.geolocation.getCurrentPosition(pos => {
6445
- if (!isMounted) return;
6446
- setLatitude(pos.coords.latitude);
6447
- setLongitude(pos.coords.longitude);
6448
- }, () => {
6449
- if (!isMounted) return;
6450
- setToast({
6451
- type: "error",
6452
- message: "GPS access denied"
6453
- });
6454
- });
6455
- }
6456
- return () => {
6457
- isMounted = false;
6458
- };
6459
- }, []);
6460
- const handlePincodeChange = e => {
6461
- const value = e.target.value;
6462
- if (/^\d{0,6}$/.test(value)) {
6463
- setPinCode(value);
6464
- if (value.length === 6) {
6465
- fetchLocationByPincode(value);
6466
- }
6467
- }
6468
- };
6469
- const fetchLocationByPincode = pin => {
6470
- console.log("Fetching location for PIN:", pin);
6471
- };
6472
- const selectphoto = async e => {
6473
- let isMounted = true;
6474
- const file = e.target.files[0];
6475
- if (!file) return;
6476
- if (file.size >= 2000000) {
6477
- setToast({
6478
- type: "error",
6479
- message: "Max size 2MB exceeded"
6480
- });
6481
- return;
6482
- }
6483
- try {
6484
- var _res$data, _res$data$files, _res$data$files$;
6485
- const res = await Digit.UploadServices.Filestorage("EKYC", file, tenantId);
6486
- if (!isMounted) return;
6487
- const fileStoreId = res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$files = _res$data.files) === null || _res$data$files === void 0 ? void 0 : (_res$data$files$ = _res$data$files[0]) === null || _res$data$files$ === void 0 ? void 0 : _res$data$files$.fileStoreId;
6488
- if (fileStoreId) {
6489
- setDoorPhotoFileStoreId(fileStoreId);
6490
- const reader = new FileReader();
6491
- reader.onloadend = () => {
6492
- if (!isMounted) return;
6493
- setDoorPhoto(reader.result);
6494
- };
6495
- reader.readAsDataURL(file);
6496
- setToast({
6497
- type: "success",
6498
- message: "Upload successful"
6499
- });
6500
- }
6501
- } catch {
6502
- if (!isMounted) return;
6503
- setToast({
6504
- type: "error",
6505
- message: "Upload failed"
6506
- });
6507
- }
6508
- return () => {
6509
- isMounted = false;
6510
- };
6511
- };
6512
- const removePhoto = () => {
6513
- setDoorPhoto(null);
6514
- setDoorPhotoFileStoreId(null);
6515
- };
6516
- const isValid = () => {
6517
- return houseNo && street && pinCode.length === 6 && assembly && ward && zone && latitude && longitude && doorPhotoFileStoreId;
6518
- };
6519
- const onStepSelect = () => {
6520
- if (!isValid()) {
6521
- setToast({
6522
- type: "error",
6523
- message: "Please fill all mandatory fields"
6524
- });
6525
- return;
6526
- }
6527
- const data = {
6528
- houseNo,
6529
- street,
6530
- locality,
6531
- landmark,
6532
- subLocality,
6533
- pinCode,
6534
- assembly: assembly === null || assembly === void 0 ? void 0 : assembly.name,
6535
- ward: ward === null || ward === void 0 ? void 0 : ward.name,
6536
- zone: zone === null || zone === void 0 ? void 0 : zone.name,
6537
- latitude,
6538
- longitude,
6539
- addressType: addressType === null || addressType === void 0 ? void 0 : addressType.name,
6540
- doorPhotoFilestoreId: doorPhotoFileStoreId
6541
- };
6542
- onSelect(config.key, data);
6543
- };
6544
- if (isLoading) return /*#__PURE__*/React.createElement(Loader, null);
6545
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(FormStep, {
6546
- t: t,
6547
- onSelect: onStepSelect,
6548
- config: config,
6549
- label: t("ES_COMMON_CONTINUE")
6550
- }, /*#__PURE__*/React.createElement(CardLabel, null, "House No / Flat No *"), /*#__PURE__*/React.createElement(TextInput, {
6551
- value: houseNo,
6552
- onChange: e => setHouseNo(e.target.value)
6553
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Street / Address Line *"), /*#__PURE__*/React.createElement(TextInput, {
6554
- value: street,
6555
- onChange: e => setStreet(e.target.value)
6556
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Locality"), /*#__PURE__*/React.createElement(TextInput, {
6557
- value: locality,
6558
- onChange: e => setLocality(e.target.value)
6559
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Landmark"), /*#__PURE__*/React.createElement(TextInput, {
6560
- value: landmark,
6561
- onChange: e => setLandmark(e.target.value)
6562
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Sub Locality"), /*#__PURE__*/React.createElement(Dropdown, {
6563
- option: [],
6564
- selected: subLocality,
6565
- select: setSubLocality
6566
- }), /*#__PURE__*/React.createElement(CardLabel, null, "PIN Code *"), /*#__PURE__*/React.createElement(TextInput, {
6567
- value: pinCode,
6568
- onChange: handlePincodeChange,
6569
- maxLength: 6
6570
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Assembly *"), /*#__PURE__*/React.createElement(Dropdown, {
6571
- option: assemblies,
6572
- selected: assembly,
6573
- select: setAssembly
6574
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Ward *"), /*#__PURE__*/React.createElement(Dropdown, {
6575
- option: (assembly === null || assembly === void 0 ? void 0 : assembly.children) || [],
6576
- selected: ward,
6577
- select: setWard
6578
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Zone *"), /*#__PURE__*/React.createElement(Dropdown, {
6579
- option: (ward === null || ward === void 0 ? void 0 : ward.children) || [],
6580
- selected: zone,
6581
- select: setZone
6582
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Latitude"), /*#__PURE__*/React.createElement(TextInput, {
6583
- value: latitude,
6584
- disabled: true
6585
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Longitude"), /*#__PURE__*/React.createElement(TextInput, {
6586
- value: longitude,
6587
- disabled: true
6588
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Address Type"), /*#__PURE__*/React.createElement(Dropdown, {
6589
- option: [{
6590
- name: "Permanent"
6591
- }, {
6592
- name: "Correspondence"
6593
- }, {
6594
- name: "Other"
6595
- }],
6596
- selected: addressType,
6597
- select: setAddressType
6598
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Door Image *"), /*#__PURE__*/React.createElement(UploadFile, {
6599
- onUpload: selectphoto,
6600
- onDelete: removePhoto,
6601
- message: doorPhotoFileStoreId ? "Uploaded" : "No file selected"
6602
- }), doorPhoto && /*#__PURE__*/React.createElement("img", {
6603
- src: doorPhoto,
6604
- alt: "preview",
6605
- style: {
6606
- width: "100%",
6607
- marginTop: "10px"
6608
- }
6609
- }), toast && /*#__PURE__*/React.createElement(Toast, {
6610
- label: toast.message,
6611
- error: toast.type === "error",
6612
- onClose: () => setToast(null)
6613
- })));
6614
- };
6615
-
6616
7420
  const CitizenApp = () => {
6617
- var _Digit$SessionStorage, _Digit$SessionStorage2;
6618
7421
  const {
6619
7422
  t
6620
7423
  } = useTranslation();
@@ -6623,24 +7426,74 @@ const CitizenApp = () => {
6623
7426
  path
6624
7427
  } = useRouteMatch();
6625
7428
  sessionStorage.removeItem("revalidateddone");
6626
- const getBreadcrumbLabel = () => {
7429
+ const getDynamicBreadcrumbs = () => {
6627
7430
  const pathname = location.pathname;
6628
- if (pathname.includes("/create-kyc")) return "EKYC_CREATE_KYC";
6629
- if (pathname.includes("/aadhaar-verification")) return "EKYC_AADHAAR_VERIFICATION";
6630
- if (pathname.includes("/address-details")) return "EKYC_ADDRESS_DETAILS";
6631
- if (pathname.includes("/property-info")) return "EKYC_PROPERTY_INFO";
6632
- if (pathname.includes("/meter-details")) return "EKYC_METER_DETAILS";
6633
- if (pathname.includes("/review")) return "EKYC_REVIEW";
6634
- return "EKYC_HOME";
7431
+ const crumbs = [{
7432
+ icon: HomeIcon,
7433
+ path: "/digit-ui/citizen"
7434
+ }, {
7435
+ label: t("EKYC_MODULE_NAME"),
7436
+ path: `/digit-ui/citizen/ekyc`
7437
+ }];
7438
+ if (pathname.includes("/create-kyc")) {
7439
+ crumbs.push({
7440
+ label: t("EKYC_CREATE_KYC")
7441
+ });
7442
+ } else if (pathname.includes("/aadhaar-verification")) {
7443
+ crumbs.push({
7444
+ label: t("EKYC_AADHAAR_VERIFICATION")
7445
+ });
7446
+ } else if (pathname.includes("/address-details")) {
7447
+ crumbs.push({
7448
+ label: t("EKYC_ADDRESS_DETAILS")
7449
+ });
7450
+ } else if (pathname.includes("/property-info")) {
7451
+ crumbs.push({
7452
+ label: t("EKYC_PROPERTY_INFO")
7453
+ });
7454
+ } else if (pathname.includes("/meter-details")) {
7455
+ crumbs.push({
7456
+ label: t("EKYC_METER_DETAILS")
7457
+ });
7458
+ } else if (pathname.includes("/review")) {
7459
+ crumbs.push({
7460
+ label: t("EKYC_INBOX"),
7461
+ path: `/digit-ui/citizen/ekyc/inbox`
7462
+ });
7463
+ crumbs.push({
7464
+ label: t("EKYC_REVIEW")
7465
+ });
7466
+ } else if (pathname.includes("/assign/surveyor-details")) {
7467
+ crumbs.push({
7468
+ label: t("EKYC_ASSIGN"),
7469
+ path: `/digit-ui/citizen/ekyc/assign`
7470
+ });
7471
+ crumbs.push({
7472
+ label: t("EKYC_SURVEYOR_DETAILS")
7473
+ });
7474
+ } else if (pathname.includes("/assign")) {
7475
+ crumbs.push({
7476
+ label: t("EKYC_ASSIGN")
7477
+ });
7478
+ } else if (pathname.includes("/surveyor-dashboard")) {
7479
+ crumbs.push({
7480
+ label: t("EKYC_SURVEYOR_DASHBOARD")
7481
+ });
7482
+ } else if (pathname.includes("/dashboard")) {
7483
+ crumbs.push({
7484
+ label: t("EKYC_DASHBOARD")
7485
+ });
7486
+ } else if (pathname.includes("/inbox")) {
7487
+ crumbs.push({
7488
+ label: t("EKYC_INBOX")
7489
+ });
7490
+ } else if (pathname.includes("/status/")) {
7491
+ crumbs.push({
7492
+ label: t("EKYC_STATUS")
7493
+ });
7494
+ }
7495
+ return crumbs;
6635
7496
  };
6636
- const breadcrumbs = [{
6637
- icon: HomeIcon,
6638
- path: "/digit-ui/citizen"
6639
- }, {
6640
- label: t(getBreadcrumbLabel())
6641
- }];
6642
- const roles = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : (_Digit$SessionStorage2 = _Digit$SessionStorage.info) === null || _Digit$SessionStorage2 === void 0 ? void 0 : _Digit$SessionStorage2.roles.map(ele => ele.code);
6643
- const isEkyAction = !(roles !== null && roles !== void 0 && roles.includes("EKYC_SURVEYOR")) || (roles === null || roles === void 0 ? void 0 : roles.includes("EMPLOYEE"));
6644
7497
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
6645
7498
  className: "ground-container form-container"
6646
7499
  }, /*#__PURE__*/React.createElement(ModuleHeader, {
@@ -6648,7 +7501,7 @@ const CitizenApp = () => {
6648
7501
  className: "icon"
6649
7502
  }), t("CS_COMMON_BACK")),
6650
7503
  onLeftClick: () => window.history.back(),
6651
- breadcrumbs: breadcrumbs
7504
+ breadcrumbs: getDynamicBreadcrumbs()
6652
7505
  }), /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(PrivateRoute, {
6653
7506
  exact: true,
6654
7507
  path: `${path}`,
@@ -6670,11 +7523,6 @@ const CitizenApp = () => {
6670
7523
  component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
6671
7524
  layoutClass: "normal"
6672
7525
  }, /*#__PURE__*/React.createElement(AadhaarVerification, null))
6673
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
6674
- path: `${path}/address-details`,
6675
- component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
6676
- layoutClass: "normal"
6677
- }, /*#__PURE__*/React.createElement(AddressDetails, null))
6678
7526
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
6679
7527
  path: `${path}/property-info`,
6680
7528
  component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
@@ -6789,7 +7637,6 @@ const componentsToRegister = {
6789
7637
  EKYC_INBOX_FILTER: props => /*#__PURE__*/React.createElement(Filter, props),
6790
7638
  EkycLinks,
6791
7639
  AadhaarVerification,
6792
- AddressDetails,
6793
7640
  PropertyInfo,
6794
7641
  MeterDetails
6795
7642
  };