@djb25/digit-ui-module-ekyc 1.0.23 → 1.0.25

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.
@@ -6,7 +6,6 @@ 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`
@@ -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,7 +2185,7 @@ 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
2191
  name: "kNumber",
@@ -2200,8 +2193,8 @@ const SearchFormFieldsComponents = ({
2200
2193
  defaultValue: "",
2201
2194
  rules: {
2202
2195
  pattern: {
2203
- value: /^[a-zA-Z0-9-_/]*$/,
2204
- message: t("ERR_INVALID_APPLICATION_NO")
2196
+ value: /^[0-9]{10}$/,
2197
+ message: t("ERR_INVALID_KNO")
2205
2198
  }
2206
2199
  },
2207
2200
  render: ({
@@ -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;
@@ -2308,9 +2307,6 @@ const Inbox = ({
2308
2307
  }, [sourceData]);
2309
2308
  const totalRecords = (listData === null || listData === void 0 ? void 0 : listData.totalCount) || 0;
2310
2309
  const checkPathName = location.pathname.includes("ekyc/inbox");
2311
- const PropsForInboxLinks = {
2312
- headerText: checkPathName ? "EKYC_MODULE" : "MODULE_SW"
2313
- };
2314
2310
  const SearchFormFields = useCallback(({
2315
2311
  registerRef,
2316
2312
  searchFormState,
@@ -2344,12 +2340,12 @@ const Inbox = ({
2344
2340
  });
2345
2341
  };
2346
2342
  const searchFormDefaultValues = {
2347
- mobileNumber: "",
2343
+ kNumber: "",
2348
2344
  applicationNumber: "",
2349
2345
  consumerNo: ""
2350
2346
  };
2351
2347
  const onSearchFormReset = setSearchFormValue => {
2352
- setSearchFormValue("mobileNumber", null);
2348
+ setSearchFormValue("kNumber", null);
2353
2349
  setSearchFormValue("applicationNumber", null);
2354
2350
  setSearchFormValue("consumerNo", null);
2355
2351
  dispatch({
@@ -2371,13 +2367,6 @@ const Inbox = ({
2371
2367
  setFilterFormValue,
2372
2368
  getFilterFormValue
2373
2369
  }) => /*#__PURE__*/React.createElement(React.Fragment, null), []);
2374
- const propsForFilterForm = {
2375
- FilterFormFields,
2376
- onFilterFormSubmit: () => {},
2377
- filterFormDefaultValues: "",
2378
- resetFilterFormDefaultValues: "",
2379
- onFilterFormReset: () => {}
2380
- };
2381
2370
  function formReducer(state, payload) {
2382
2371
  const storageKey = payload.checkPathName ? "EKYC.INBOX" : "EKYC.SW.INBOX";
2383
2372
  switch (payload.action) {
@@ -2469,9 +2458,8 @@ const Inbox = ({
2469
2458
  return /*#__PURE__*/React.createElement("div", {
2470
2459
  className: "app-container"
2471
2460
  }, /*#__PURE__*/React.createElement(InboxComposer, _extends({
2472
- isInboxLoading,
2473
- PropsForInboxLinks
2474
- }, propsForSearchForm, propsForFilterForm, {
2461
+ isInboxLoading
2462
+ }, propsForSearchForm, {
2475
2463
  propsForInboxTable,
2476
2464
  formState,
2477
2465
  countData: listData
@@ -3908,25 +3896,6 @@ const Review = () => {
3908
3896
  })))));
3909
3897
  };
3910
3898
 
3911
- var QueryClientContext = function () {
3912
- var context = /*#__PURE__*/React.createContext(undefined);
3913
- if (typeof window !== 'undefined') {
3914
- window.ReactQueryClientContext = context;
3915
- }
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');
3926
- }
3927
- return queryClient;
3928
- };
3929
-
3930
3899
  const AadhaarVerification = ({
3931
3900
  config,
3932
3901
  onSelect,
@@ -4198,7 +4167,7 @@ const AadhaarVerification = ({
4198
4167
  })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "No. of Residents *"), /*#__PURE__*/React.createElement(TextInput, {
4199
4168
  value: residents,
4200
4169
  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, {
4170
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Type of Identity *"), /*#__PURE__*/React.createElement(Dropdown, {
4202
4171
  option: identityTypeOptions,
4203
4172
  selected: identityType,
4204
4173
  select: setIdentityType
@@ -4303,7 +4272,6 @@ const ekycConfig = [{
4303
4272
  const EKYCForm = ({
4304
4273
  path: passedPath
4305
4274
  }) => {
4306
- const queryClient = useQueryClient();
4307
4275
  const match = useRouteMatch();
4308
4276
  const {
4309
4277
  t
@@ -4314,9 +4282,7 @@ const EKYCForm = ({
4314
4282
  } = location;
4315
4283
  const history = useHistory();
4316
4284
  let config = [];
4317
- const [params, setParams, clearParams] = Digit.Hooks.useSessionStorage("EKYC_CREATE", {});
4318
- const userInfo = Digit.UserService.getUser();
4319
- const tenantId = Digit.ULBService.getCurrentTenantId();
4285
+ const [params, setParams] = Digit.Hooks.useSessionStorage("EKYC_CREATE", {});
4320
4286
  useEffect(() => {
4321
4287
  if (location.state && Object.keys(location.state).length > 0) {
4322
4288
  const {
@@ -4343,7 +4309,7 @@ const EKYCForm = ({
4343
4309
  if (skipStep) {
4344
4310
  redirectWithHistory = history.replace;
4345
4311
  }
4346
- const base = passedPath || match.path.split('/').slice(0, -1).join('/');
4312
+ const base = passedPath || match.path.split("/").slice(0, -1).join("/");
4347
4313
  if (nextStep === null) {
4348
4314
  return redirectWithHistory(`${base}/review`, {
4349
4315
  ...params,
@@ -4354,17 +4320,17 @@ const EKYCForm = ({
4354
4320
  ...params
4355
4321
  });
4356
4322
  };
4357
- function handleSelect(key, data, skipStep, index, isAddMultiple = false) {
4358
- setParams({
4359
- ...params,
4360
- ...{
4361
- [key]: {
4362
- ...params[key],
4363
- ...data
4364
- }
4323
+ function handleSelect(key, data, skipStep, index, isAddMultiple = false, silent = false) {
4324
+ setParams(prev => ({
4325
+ ...prev,
4326
+ [key]: {
4327
+ ...params[key],
4328
+ ...data
4365
4329
  }
4366
- });
4367
- goNext(skipStep, index, isAddMultiple, key);
4330
+ }));
4331
+ if (!silent) {
4332
+ goNext(skipStep, index, isAddMultiple, key);
4333
+ }
4368
4334
  }
4369
4335
  ekycConfig.forEach(obj => {
4370
4336
  config = config.concat(obj.body);
@@ -4392,13 +4358,12 @@ const EKYCForm = ({
4392
4358
  }), /*#__PURE__*/React.createElement("div", {
4393
4359
  className: "employee-form-section"
4394
4360
  }, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(Route, {
4395
- path: formStepRoutes.map(route => `${passedPath || match.path.split('/').slice(0, -1).join('/')}/${route}`)
4361
+ path: formStepRoutes.map(route => `${passedPath || match.path.split("/").slice(0, -1).join("/")}/${route}`)
4396
4362
  }, /*#__PURE__*/React.createElement("div", {
4397
4363
  className: "single-page-form-container"
4398
4364
  }, config.map((routeObj, index) => {
4399
4365
  const {
4400
- component,
4401
- key
4366
+ component
4402
4367
  } = routeObj;
4403
4368
  const Component = typeof component === "string" ? Digit.ComponentRegistryService.getComponent(component) : component;
4404
4369
  return /*#__PURE__*/React.createElement("div", {
@@ -4416,13 +4381,14 @@ const EKYCForm = ({
4416
4381
  formData: params
4417
4382
  }));
4418
4383
  }))), /*#__PURE__*/React.createElement(Route, null, /*#__PURE__*/React.createElement(Redirect, {
4419
- to: `${passedPath || match.path.split('/').slice(0, -1).join('/')}/${config.indexRoute}`
4384
+ to: `${passedPath || match.path.split("/").slice(0, -1).join("/")}/${config.indexRoute}`
4420
4385
  }))))));
4421
4386
  };
4422
4387
 
4423
4388
  const AssignEkycModal = ({
4424
4389
  surveyor,
4425
- closeModal
4390
+ closeModal,
4391
+ refetchDashboard
4426
4392
  }) => {
4427
4393
  const [selectedKnos, setSelectedKnos] = useState([]);
4428
4394
  const [isBulkSelection, setIsBulkSelection] = useState(false);
@@ -4500,7 +4466,8 @@ const AssignEkycModal = ({
4500
4466
  label: "Assignment successful"
4501
4467
  });
4502
4468
  setShowToast(true);
4503
- setTimeout(() => {
4469
+ setTimeout(async () => {
4470
+ await refetchDashboard();
4504
4471
  closeModal();
4505
4472
  }, 1000);
4506
4473
  },
@@ -4657,34 +4624,7 @@ const AssignEkycModal = ({
4657
4624
  placeholder: "Zone",
4658
4625
  value: filters.zoneName,
4659
4626
  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, {
4627
+ })), /*#__PURE__*/React.createElement(Table, {
4688
4628
  tableTitle: "eKYC Applications",
4689
4629
  tableClass: "ekycTable",
4690
4630
  data: tableData,
@@ -4722,8 +4662,79 @@ const AssignEkycModal = ({
4722
4662
  }));
4723
4663
  };
4724
4664
 
4665
+ const downloadSurveyorPDF = async ({
4666
+ rows,
4667
+ surveyorName,
4668
+ employeeId,
4669
+ mobileNumber,
4670
+ vendorName,
4671
+ supervisorName,
4672
+ dashboardInfo,
4673
+ t
4674
+ }) => {
4675
+ const tenantId = Digit.ULBService.getCurrentTenantId();
4676
+ const initData = Digit.SessionStorage.get("initData");
4677
+ const tenants = (initData === null || initData === void 0 ? void 0 : initData.tenants) || [];
4678
+ const tenantInfo = tenants.find(tenant => tenant.code === tenantId);
4679
+ const name = "Delhi Jal Board";
4680
+ const email = "contact@delhijalboard.nic.in";
4681
+ const phoneNumber = "+91-11-23538416";
4682
+ const details = [{
4683
+ title: t("SURVEYOR_DETAILS"),
4684
+ asSectionHeader: true,
4685
+ values: [{
4686
+ title: t("SURVEYOR_NAME"),
4687
+ value: surveyorName
4688
+ }, {
4689
+ title: t("EMPLOYEE_ID"),
4690
+ value: employeeId
4691
+ }, {
4692
+ title: t("MOBILE_NUMBER"),
4693
+ value: mobileNumber
4694
+ }, {
4695
+ title: t("VENDOR_NAME"),
4696
+ value: vendorName
4697
+ }, {
4698
+ title: t("SUPERVISOR_NAME"),
4699
+ value: supervisorName
4700
+ }].filter(item => item.value)
4701
+ }, {
4702
+ title: t("SUMMARY_STATISTICS"),
4703
+ asSectionHeader: true,
4704
+ values: [{
4705
+ title: t("TOTAL_ASSIGNED"),
4706
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.total) || 0
4707
+ }, {
4708
+ title: t("COMPLETED"),
4709
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.completed) || 0
4710
+ }, {
4711
+ title: t("PENDING"),
4712
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.pending) || 0
4713
+ }, {
4714
+ title: t("SUBMITTED"),
4715
+ value: (dashboardInfo === null || dashboardInfo === void 0 ? void 0 : dashboardInfo.submittedCount) || 0
4716
+ }].filter(item => item.value)
4717
+ }];
4718
+ if (window.Digit && window.Digit.Utils && window.Digit.Utils.pdf && window.Digit.Utils.pdf.generateSurveyorReport) {
4719
+ window.Digit.Utils.pdf.generateSurveyorReport({
4720
+ tenantId,
4721
+ logo: null,
4722
+ name,
4723
+ email,
4724
+ phoneNumber,
4725
+ heading: t("EKYC_SURVEYOR_REPORT"),
4726
+ details,
4727
+ applicationNumber: employeeId,
4728
+ rows,
4729
+ t
4730
+ });
4731
+ } else {
4732
+ console.error("Digit.Utils.pdf.generateSurveyorReport is not available");
4733
+ }
4734
+ };
4735
+
4725
4736
  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;
4737
+ 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
4738
  const tenantId = Digit.ULBService.getCurrentTenantId();
4728
4739
  const [showModal, setShowModal] = useState(false);
4729
4740
  const [showOptions, setShowOptions] = useState(false);
@@ -4750,17 +4761,53 @@ const SurveyorDetailsDashboard = () => {
4750
4761
  var _surveyorSearchRespon;
4751
4762
  return (surveyorSearchResponse === null || surveyorSearchResponse === void 0 ? void 0 : (_surveyorSearchRespon = surveyorSearchResponse.surveyors) === null || _surveyorSearchRespon === void 0 ? void 0 : _surveyorSearchRespon[0]) || null;
4752
4763
  }, [surveyorSearchResponse]);
4764
+ const {
4765
+ data: vendorData
4766
+ } = Digit.Hooks.fsm.useDsoSearch(tenantId, {
4767
+ status: "ACTIVE"
4768
+ }, {
4769
+ enabled: !!tenantId
4770
+ });
4771
+ const {
4772
+ data: supervisorSearchResponse
4773
+ } = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
4774
+ status: "ACTIVE"
4775
+ }, {
4776
+ enabled: !!tenantId
4777
+ });
4778
+ const vendorName = useMemo(() => {
4779
+ var _mappedVendor$dsoDeta;
4780
+ if (!vendorData || !(surveyor !== null && surveyor !== void 0 && surveyor.vendorId)) return "N/A";
4781
+ const mappedVendor = vendorData.find(v => {
4782
+ var _v$dsoDetails, _v$dsoDetails2;
4783
+ 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;
4784
+ });
4785
+ 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";
4786
+ }, [vendorData, surveyor === null || surveyor === void 0 ? void 0 : surveyor.vendorId]);
4787
+ const supervisorName = useMemo(() => {
4788
+ var _mappedSupervisor$own;
4789
+ if (!(supervisorSearchResponse !== null && supervisorSearchResponse !== void 0 && supervisorSearchResponse.supervisors) || !(surveyor !== null && surveyor !== void 0 && surveyor.supervisorId)) return "N/A";
4790
+ const mappedSupervisor = supervisorSearchResponse.supervisors.find(s => {
4791
+ var _s$owner;
4792
+ return s.id === surveyor.supervisorId || ((_s$owner = s.owner) === null || _s$owner === void 0 ? void 0 : _s$owner.uuid) === surveyor.supervisorId;
4793
+ });
4794
+ 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";
4795
+ }, [supervisorSearchResponse, surveyor === null || surveyor === void 0 ? void 0 : surveyor.supervisorId]);
4796
+ 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";
4797
+ 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);
4798
+ 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
4799
  const [currentPage, setCurrentPage] = useState(0);
4754
4800
  const [pageSize, setPageSize] = useState(20);
4755
4801
  const queryParams = {
4756
4802
  tenantId: "dl.djb",
4757
4803
  offset: currentPage * pageSize,
4758
4804
  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
4805
+ surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner4 = surveyor.owner) === null || _surveyor$owner4 === void 0 ? void 0 : _surveyor$owner4.uuid
4760
4806
  };
4761
4807
  const {
4762
4808
  isFetching: isDashboardLoading,
4763
- data: dashboardData = {}
4809
+ data: dashboardData = {},
4810
+ refetch: refetchDashboard
4764
4811
  } = Digit.Hooks.ekyc.useEkycSurveyorDashboard({}, queryParams, {
4765
4812
  enabled: !!queryParams.tenantId && !!queryParams.surveyorId,
4766
4813
  keepPreviousData: true
@@ -4793,6 +4840,23 @@ const SurveyorDetailsDashboard = () => {
4793
4840
  value
4794
4841
  }) => value || "-"
4795
4842
  }], []);
4843
+ const [showReportMenu, setShowReportMenu] = useState(false);
4844
+ const [customDate, setCustomDate] = useState({
4845
+ from: "",
4846
+ to: ""
4847
+ });
4848
+ const [showCustomPicker, setShowCustomPicker] = useState(false);
4849
+ const reportMenuRef = useRef(null);
4850
+ useEffect(() => {
4851
+ const handler = e => {
4852
+ if (reportMenuRef.current && !reportMenuRef.current.contains(e.target)) {
4853
+ setShowReportMenu(false);
4854
+ setShowCustomPicker(false);
4855
+ }
4856
+ };
4857
+ document.addEventListener("mousedown", handler);
4858
+ return () => document.removeEventListener("mousedown", handler);
4859
+ }, []);
4796
4860
  if (isLoading) {
4797
4861
  return /*#__PURE__*/React.createElement(Loader, null);
4798
4862
  }
@@ -4838,6 +4902,83 @@ const SurveyorDetailsDashboard = () => {
4838
4902
  value: (surveyor === null || surveyor === void 0 ? void 0 : surveyor.rejectedCases) || 0,
4839
4903
  color: "#EF4444"
4840
4904
  }];
4905
+ const getDateRange = filter => {
4906
+ const now = new Date();
4907
+ const start = new Date(now);
4908
+ if (filter === "today") {
4909
+ start.setHours(0, 0, 0, 0);
4910
+ return {
4911
+ from: start,
4912
+ to: now
4913
+ };
4914
+ }
4915
+ if (filter === "week") {
4916
+ start.setDate(now.getDate() - now.getDay());
4917
+ start.setHours(0, 0, 0, 0);
4918
+ return {
4919
+ from: start,
4920
+ to: now
4921
+ };
4922
+ }
4923
+ if (filter === "month") {
4924
+ start.setDate(1);
4925
+ start.setHours(0, 0, 0, 0);
4926
+ return {
4927
+ from: start,
4928
+ to: now
4929
+ };
4930
+ }
4931
+ return null;
4932
+ };
4933
+ const handlePresetDownload = filter => {
4934
+ var _dashboardData$dashbo;
4935
+ const allRows = (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.consumerList) || [];
4936
+ const range = getDateRange(filter);
4937
+ if (!range) return;
4938
+ const filtered = allRows.filter(r => {
4939
+ const ts = r.submittedAt || r.createdTime || r.lastModifiedTime || 0;
4940
+ return ts >= range.from.getTime() && ts <= range.to.getTime();
4941
+ });
4942
+ downloadSurveyorPDF({
4943
+ rows: filtered.length ? filtered : allRows,
4944
+ surveyorName: fullName,
4945
+ vendorName,
4946
+ supervisorName,
4947
+ employeeId,
4948
+ mobileNumber,
4949
+ dashboardInfo: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
4950
+ t
4951
+ });
4952
+ setShowReportMenu(false);
4953
+ setShowCustomPicker(false);
4954
+ };
4955
+ const handleCustomDownload = () => {
4956
+ var _dashboardData$dashbo2;
4957
+ if (!customDate.from || !customDate.to) {
4958
+ alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
4959
+ return;
4960
+ }
4961
+ const from = new Date(customDate.from);
4962
+ const to = new Date(customDate.to);
4963
+ to.setHours(23, 59, 59, 999);
4964
+ const allRows = (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo2 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo2 === void 0 ? void 0 : _dashboardData$dashbo2.consumerList) || [];
4965
+ const filtered = allRows.filter(r => {
4966
+ const ts = r.createdTime || r.lastModifiedTime || 0;
4967
+ return ts >= from.getTime() && ts <= to.getTime();
4968
+ });
4969
+ downloadSurveyorPDF({
4970
+ rows: filtered.length ? filtered : allRows,
4971
+ surveyorName: fullName,
4972
+ vendorName,
4973
+ supervisorName,
4974
+ employeeId,
4975
+ mobileNumber,
4976
+ dashboardInfo: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
4977
+ t
4978
+ });
4979
+ setShowReportMenu(false);
4980
+ setShowCustomPicker(false);
4981
+ };
4841
4982
  const StatCard = ({
4842
4983
  title,
4843
4984
  value,
@@ -4857,12 +4998,13 @@ const SurveyorDetailsDashboard = () => {
4857
4998
  const options = [{
4858
4999
  action: "Assign"
4859
5000
  }];
4860
- 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";
4861
- 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);
4862
5001
  const handleMenuSelect = option => {
4863
5002
  setShowOptions(false);
4864
5003
  setShowModal(true);
4865
5004
  };
5005
+ const closeModal = async () => {
5006
+ setShowModal(false);
5007
+ };
4866
5008
  return /*#__PURE__*/React.createElement(Card, {
4867
5009
  className: "surveyor-dashboard"
4868
5010
  }, /*#__PURE__*/React.createElement("div", {
@@ -4879,26 +5021,85 @@ const SurveyorDetailsDashboard = () => {
4879
5021
  className: "designation"
4880
5022
  }, (surveyor === null || surveyor === void 0 ? void 0 : surveyor.description) || t("FIELD_SURVEYOR")), /*#__PURE__*/React.createElement("div", {
4881
5023
  className: "employee-id"
4882
- }, t("EMPLOYEE_ID"), ": ", employeeId)))), /*#__PURE__*/React.createElement("div", {
5024
+ }, t("EMPLOYEE_ID"), ": ", employeeId))), /*#__PURE__*/React.createElement("div", {
5025
+ className: "report-download",
5026
+ ref: reportMenuRef
5027
+ }, /*#__PURE__*/React.createElement("button", {
5028
+ className: "download-btn",
5029
+ onClick: () => {
5030
+ setShowReportMenu(p => !p);
5031
+ setShowCustomPicker(false);
5032
+ }
5033
+ }, t("DOWNLOAD_REPORT") || "Download Report"), showReportMenu && /*#__PURE__*/React.createElement("div", {
5034
+ className: "report-menu"
5035
+ }, [{
5036
+ label: t("TODAY") || "Today",
5037
+ key: "today"
5038
+ }, {
5039
+ label: t("THIS_WEEK") || "This Week",
5040
+ key: "week"
5041
+ }, {
5042
+ label: t("THIS_MONTH") || "This Month",
5043
+ key: "month"
5044
+ }].map(({
5045
+ label,
5046
+ key
5047
+ }) => /*#__PURE__*/React.createElement("div", {
5048
+ key: key,
5049
+ className: "menu-item",
5050
+ onClick: () => handlePresetDownload(key)
5051
+ }, label)), /*#__PURE__*/React.createElement("div", {
5052
+ className: "custom-date-trigger",
5053
+ onClick: () => setShowCustomPicker(p => !p)
5054
+ }, t("CUSTOM_DATE") || "Custom Date"), showCustomPicker && /*#__PURE__*/React.createElement("div", {
5055
+ className: "custom-picker"
5056
+ }, /*#__PURE__*/React.createElement("div", {
5057
+ className: "date-field"
5058
+ }, /*#__PURE__*/React.createElement("label", {
5059
+ className: "date-label"
5060
+ }, t("FROM_DATE") || "From"), /*#__PURE__*/React.createElement("input", {
5061
+ type: "date",
5062
+ className: "date-input",
5063
+ value: customDate.from,
5064
+ onChange: e => setCustomDate(d => ({
5065
+ ...d,
5066
+ from: e.target.value
5067
+ }))
5068
+ })), /*#__PURE__*/React.createElement("div", {
5069
+ className: "date-field"
5070
+ }, /*#__PURE__*/React.createElement("label", {
5071
+ className: "date-label"
5072
+ }, t("TO_DATE") || "To"), /*#__PURE__*/React.createElement("input", {
5073
+ type: "date",
5074
+ className: "date-input",
5075
+ value: customDate.to,
5076
+ onChange: e => setCustomDate(d => ({
5077
+ ...d,
5078
+ to: e.target.value
5079
+ }))
5080
+ })), /*#__PURE__*/React.createElement("button", {
5081
+ className: "download-action-btn",
5082
+ onClick: handleCustomDownload
5083
+ }, t("DOWNLOAD") || "Download"))))), /*#__PURE__*/React.createElement("div", {
4883
5084
  className: "stats-wrapper"
4884
5085
  }, /*#__PURE__*/React.createElement(StatCard, {
4885
5086
  title: t("TOTAL_ASSIGNED"),
4886
- value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.total) || 0,
5087
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo3 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo3 === void 0 ? void 0 : _dashboardData$dashbo3.total) || 0,
4887
5088
  type: "today",
4888
5089
  isLoading: isDashboardLoading
4889
5090
  }), /*#__PURE__*/React.createElement(StatCard, {
4890
5091
  title: t("COMPLETED"),
4891
- value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo2 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo2 === void 0 ? void 0 : _dashboardData$dashbo2.completed) || 0,
5092
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo4 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo4 === void 0 ? void 0 : _dashboardData$dashbo4.completed) || 0,
4892
5093
  type: "week",
4893
5094
  isLoading: isDashboardLoading
4894
5095
  }), /*#__PURE__*/React.createElement(StatCard, {
4895
5096
  title: t("PENDING"),
4896
- value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo3 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo3 === void 0 ? void 0 : _dashboardData$dashbo3.pending) || 0,
5097
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo5 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo5 === void 0 ? void 0 : _dashboardData$dashbo5.pending) || 0,
4897
5098
  type: "pending",
4898
5099
  isLoading: isDashboardLoading
4899
5100
  }), /*#__PURE__*/React.createElement(StatCard, {
4900
5101
  title: t("SUBMITTED"),
4901
- value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo4 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo4 === void 0 ? void 0 : _dashboardData$dashbo4.submittedCount) || 0,
5102
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo6 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo6 === void 0 ? void 0 : _dashboardData$dashbo6.submittedCount) || 0,
4902
5103
  type: "month",
4903
5104
  isLoading: isDashboardLoading
4904
5105
  })), /*#__PURE__*/React.createElement("div", {
@@ -4946,19 +5147,19 @@ const SurveyorDetailsDashboard = () => {
4946
5147
  className: "label"
4947
5148
  }, t("MOBILE"), ":"), /*#__PURE__*/React.createElement("span", {
4948
5149
  className: "value"
4949
- }, (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", {
5150
+ }, (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", {
4950
5151
  className: "detail-item"
4951
5152
  }, /*#__PURE__*/React.createElement("span", {
4952
5153
  className: "label"
4953
5154
  }, t("EMAIL"), ":"), /*#__PURE__*/React.createElement("span", {
4954
5155
  className: "value"
4955
- }, (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", {
5156
+ }, (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", {
4956
5157
  className: "detail-item"
4957
5158
  }, /*#__PURE__*/React.createElement("span", {
4958
5159
  className: "label"
4959
5160
  }, t("GENDER"), ":"), /*#__PURE__*/React.createElement("span", {
4960
5161
  className: "value"
4961
- }, (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", {
5162
+ }, (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", {
4962
5163
  className: "detail-item"
4963
5164
  }, /*#__PURE__*/React.createElement("span", {
4964
5165
  className: "label"
@@ -4982,16 +5183,16 @@ const SurveyorDetailsDashboard = () => {
4982
5183
  t: t,
4983
5184
  tableTitle: t("ASSIGNED_KNOS"),
4984
5185
  tableClass: "ekycTable",
4985
- data: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo5 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo5 === void 0 ? void 0 : _dashboardData$dashbo5.consumerList) || [],
5186
+ data: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo7 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo7 === void 0 ? void 0 : _dashboardData$dashbo7.consumerList) || [],
4986
5187
  columns: knoColumns,
4987
5188
  isLoading: isDashboardLoading,
4988
- totalRecords: dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo6 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo6 === void 0 ? void 0 : _dashboardData$dashbo6.total,
5189
+ totalRecords: dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo8 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo8 === void 0 ? void 0 : _dashboardData$dashbo8.total,
4989
5190
  currentPage: currentPage,
4990
5191
  pageSizeLimit: pageSize,
4991
5192
  isPaginationRequired: true,
4992
5193
  onNextPage: () => {
4993
- var _dashboardData$dashbo7;
4994
- 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) {
5194
+ var _dashboardData$dashbo9;
5195
+ 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) {
4995
5196
  setCurrentPage(prev => prev + 1);
4996
5197
  }
4997
5198
  },
@@ -5004,8 +5205,8 @@ const SurveyorDetailsDashboard = () => {
5004
5205
  setCurrentPage(0);
5005
5206
  },
5006
5207
  onLastPage: () => {
5007
- var _dashboardData$dashbo8;
5008
- 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));
5208
+ var _dashboardData$dashbo0;
5209
+ 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));
5009
5210
  },
5010
5211
  onPageSizeChange: e => {
5011
5212
  setPageSize(Number(e.target.value));
@@ -5025,17 +5226,111 @@ const SurveyorDetailsDashboard = () => {
5025
5226
  }
5026
5227
  })), showModal && /*#__PURE__*/React.createElement(AssignEkycModal, {
5027
5228
  surveyor: surveyor,
5028
- closeModal: () => setShowModal(false)
5229
+ closeModal: closeModal,
5230
+ refetchDashboard: refetchDashboard
5029
5231
  }));
5030
5232
  };
5031
5233
 
5234
+ function formReducer(state, payload) {
5235
+ const storageKey = "EKYC.SW.INBOX";
5236
+ switch (payload.action) {
5237
+ case "mutateSearchForm":
5238
+ Digit.SessionStorage.set(storageKey, {
5239
+ ...state,
5240
+ searchForm: payload.data
5241
+ });
5242
+ return {
5243
+ ...state,
5244
+ searchForm: payload.data
5245
+ };
5246
+ case "mutateFilterForm":
5247
+ Digit.SessionStorage.set(storageKey, {
5248
+ ...state,
5249
+ filterForm: payload.data
5250
+ });
5251
+ return {
5252
+ ...state,
5253
+ filterForm: payload.data
5254
+ };
5255
+ case "mutateTableForm":
5256
+ Digit.SessionStorage.set(storageKey, {
5257
+ ...state,
5258
+ tableForm: payload.data
5259
+ });
5260
+ return {
5261
+ ...state,
5262
+ tableForm: payload.data
5263
+ };
5264
+ default:
5265
+ return state;
5266
+ }
5267
+ }
5268
+ const formInitValue = {
5269
+ filterForm: {},
5270
+ searchForm: {},
5271
+ tableForm: {
5272
+ limit: 10,
5273
+ offset: 0,
5274
+ sortBy: "createdTime",
5275
+ sortOrder: "DESC"
5276
+ }
5277
+ };
5278
+ const tableColumnConfig = (t, handleReview) => [{
5279
+ Header: t("SURVEYOR_NAME"),
5280
+ accessor: "surveyorName",
5281
+ Cell: ({
5282
+ row
5283
+ }) => {
5284
+ var _row$original, _row$original2, _row$original3;
5285
+ const id = (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.id;
5286
+ return /*#__PURE__*/React.createElement("span", {
5287
+ className: "ekyc-application-link",
5288
+ style: {
5289
+ color: "#add8f7",
5290
+ cursor: "pointer",
5291
+ fontWeight: "bold"
5292
+ },
5293
+ onClick: () => handleReview(id)
5294
+ }, ((_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");
5295
+ }
5296
+ }, {
5297
+ Header: t("MOBILE_NUMBER"),
5298
+ accessor: "mobileNo",
5299
+ Cell: ({
5300
+ row
5301
+ }) => {
5302
+ var _row$original4, _row$original5, _row$original5$owner;
5303
+ 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");
5304
+ }
5305
+ }, {
5306
+ Header: t("STATUS"),
5307
+ accessor: "status",
5308
+ Cell: ({
5309
+ row
5310
+ }) => {
5311
+ var _row$original6;
5312
+ const status = ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.status) || "DEFAULT";
5313
+ return /*#__PURE__*/React.createElement("span", {
5314
+ className: `ekyc-status-tag ${status}`
5315
+ }, t(status));
5316
+ }
5317
+ }, {
5318
+ Header: t("SERVICE_TYPE"),
5319
+ accessor: "serviceType",
5320
+ Cell: ({
5321
+ row
5322
+ }) => {
5323
+ var _row$original7;
5324
+ return /*#__PURE__*/React.createElement("span", null, ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.serviceType) || "NA");
5325
+ }
5326
+ }];
5327
+
5032
5328
  const SupervisorInboxTableConfig = ({
5033
5329
  onPageSizeChange,
5034
5330
  formState,
5035
5331
  totalCount,
5036
5332
  table,
5037
5333
  dispatch,
5038
- checkPathName,
5039
5334
  onSortingByData,
5040
5335
  inboxStyles: _inboxStyles = {},
5041
5336
  tableStyle: _tableStyle = {}
@@ -5051,64 +5346,6 @@ const SupervisorInboxTableConfig = ({
5051
5346
  };
5052
5347
  const limit = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10;
5053
5348
  const offset = (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0;
5054
- const tableColumnConfig = [{
5055
- Header: t("SURVEYOR_ID"),
5056
- accessor: "id",
5057
- Cell: ({
5058
- row
5059
- }) => {
5060
- var _row$original;
5061
- const id = (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.id;
5062
- return /*#__PURE__*/React.createElement("span", {
5063
- className: "ekyc-application-link",
5064
- style: {
5065
- color: "#add8f7",
5066
- cursor: "pointer",
5067
- fontWeight: "bold"
5068
- },
5069
- onClick: () => handleReview(id)
5070
- }, id || "NA");
5071
- }
5072
- }, {
5073
- Header: t("SURVEYOR_NAME"),
5074
- accessor: "surveyorName",
5075
- Cell: ({
5076
- row
5077
- }) => {
5078
- var _row$original2, _row$original3;
5079
- 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");
5080
- }
5081
- }, {
5082
- Header: t("MOBILE_NUMBER"),
5083
- accessor: "mobileNo",
5084
- Cell: ({
5085
- row
5086
- }) => {
5087
- var _row$original4, _row$original5, _row$original5$owner;
5088
- 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");
5089
- }
5090
- }, {
5091
- Header: t("STATUS"),
5092
- accessor: "status",
5093
- Cell: ({
5094
- row
5095
- }) => {
5096
- var _row$original6;
5097
- const status = ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.status) || "DEFAULT";
5098
- return /*#__PURE__*/React.createElement("span", {
5099
- className: `ekyc-status-tag ${status}`
5100
- }, t(status));
5101
- }
5102
- }, {
5103
- Header: t("SERVICE_TYPE"),
5104
- accessor: "serviceType",
5105
- Cell: ({
5106
- row
5107
- }) => {
5108
- var _row$original7;
5109
- return /*#__PURE__*/React.createElement("span", null, ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.serviceType) || "NA");
5110
- }
5111
- }];
5112
5349
  return {
5113
5350
  getCellProps: () => ({
5114
5351
  style: {
@@ -5126,37 +5363,33 @@ const SupervisorInboxTableConfig = ({
5126
5363
  data: {
5127
5364
  ...formState.tableForm,
5128
5365
  offset: Number(offset) + Number(limit)
5129
- },
5130
- checkPathName
5366
+ }
5131
5367
  }),
5132
5368
  onPrevPage: () => dispatch({
5133
5369
  action: "mutateTableForm",
5134
5370
  data: {
5135
5371
  ...formState.tableForm,
5136
5372
  offset: Number(offset) - Number(limit)
5137
- },
5138
- checkPathName
5373
+ }
5139
5374
  }),
5140
5375
  onLastPage: () => dispatch({
5141
5376
  action: "mutateTableForm",
5142
5377
  data: {
5143
5378
  ...formState.tableForm,
5144
5379
  offset: Math.ceil(totalCount / limit) * limit - Number(limit)
5145
- },
5146
- checkPathName
5380
+ }
5147
5381
  }),
5148
5382
  onFirstPage: () => dispatch({
5149
5383
  action: "mutateTableForm",
5150
5384
  data: {
5151
5385
  ...formState.tableForm,
5152
5386
  offset: 0
5153
- },
5154
- checkPathName
5387
+ }
5155
5388
  }),
5156
5389
  totalRecords: totalCount,
5157
5390
  onSort: onSortingByData,
5158
5391
  data: table,
5159
- columns: tableColumnConfig,
5392
+ columns: tableColumnConfig(t, handleReview),
5160
5393
  inboxStyles: {
5161
5394
  ..._inboxStyles
5162
5395
  },
@@ -5167,70 +5400,44 @@ const SupervisorInboxTableConfig = ({
5167
5400
  };
5168
5401
 
5169
5402
  const AssignEkyc = () => {
5170
- var _formState$tableForm, _formState$tableForm2, _formState$tableForm3, _formState$tableForm4, _userDetails$info, _formState$searchForm3, _formState$searchForm4, _dashboardData$dashbo;
5171
- const tenantId = Digit.ULBService.getCurrentTenantId();
5172
- const location = useLocation();
5173
- const formInitValue = {
5174
- filterForm: {},
5175
- searchForm: {},
5176
- tableForm: {
5177
- limit: 10,
5178
- offset: 0,
5179
- sortBy: "createdTime",
5180
- sortOrder: "DESC"
5181
- }
5182
- };
5403
+ var _formState$tableForm, _formState$tableForm2, _formState$tableForm3, _formState$tableForm4, _formState$searchForm, _dashboardData$dashbo;
5404
+ let tenantId = Digit.ULBService.getCurrentTenantId();
5405
+ if (!tenantId || tenantId === "dl") {
5406
+ tenantId = "dl.djb";
5407
+ }
5183
5408
  const [formState, dispatch] = useReducer(formReducer, formInitValue);
5184
- const userDetails = Digit.SessionStorage.get("User");
5185
5409
  let paginationParms = {
5186
5410
  limit: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10,
5187
5411
  offset: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm2 = formState.tableForm) === null || _formState$tableForm2 === void 0 ? void 0 : _formState$tableForm2.offset) || 0,
5188
5412
  sortBy: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm3 = formState.tableForm) === null || _formState$tableForm3 === void 0 ? void 0 : _formState$tableForm3.sortBy) || "createdTime",
5189
5413
  sortOrder: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm4 = formState.tableForm) === null || _formState$tableForm4 === void 0 ? void 0 : _formState$tableForm4.sortOrder) || "DESC"
5190
5414
  };
5415
+ const mobileNumber = (formState === null || formState === void 0 ? void 0 : (_formState$searchForm = formState.searchForm) === null || _formState$searchForm === void 0 ? void 0 : _formState$searchForm.mobileNumber) || "";
5416
+ const isSearchActive = !!mobileNumber;
5417
+ const filters = {
5418
+ ...paginationParms,
5419
+ status: "ACTIVE,DISABLED"
5420
+ };
5421
+ if (isSearchActive) {
5422
+ filters.mobileNumber = mobileNumber;
5423
+ }
5191
5424
  const {
5192
5425
  data: dashboardData,
5193
5426
  isLoading
5194
- } = Digit.Hooks.fsm.useSurveyorSearch(tenantId, {
5195
- ...paginationParms,
5196
- status: "ACTIVE,DISABLED",
5197
- vendorId: userDetails === null || userDetails === void 0 ? void 0 : (_userDetails$info = userDetails.info) === null || _userDetails$info === void 0 ? void 0 : _userDetails$info.uuid
5198
- }, {
5427
+ } = Digit.Hooks.fsm.useSurveyorSearch(tenantId, filters, {
5199
5428
  enabled: !!tenantId,
5200
5429
  keepPreviousData: true
5201
5430
  });
5202
- const searchDetails = useMemo(() => {
5203
- var _formState$searchForm, _formState$searchForm2;
5204
- return {
5205
- kno: (formState === null || formState === void 0 ? void 0 : (_formState$searchForm = formState.searchForm) === null || _formState$searchForm === void 0 ? void 0 : _formState$searchForm.kNumber) || "",
5206
- name: (formState === null || formState === void 0 ? void 0 : (_formState$searchForm2 = formState.searchForm) === null || _formState$searchForm2 === void 0 ? void 0 : _formState$searchForm2.kName) || ""
5207
- };
5208
- }, [formState === null || formState === void 0 ? void 0 : (_formState$searchForm3 = formState.searchForm) === null || _formState$searchForm3 === void 0 ? void 0 : _formState$searchForm3.kNumber, formState === null || formState === void 0 ? void 0 : (_formState$searchForm4 = formState.searchForm) === null || _formState$searchForm4 === void 0 ? void 0 : _formState$searchForm4.kName]);
5209
- const isSearchActive = !!(searchDetails.kno || searchDetails.name);
5210
- const {
5211
- isLoading: isSearchLoading,
5212
- data: searchData
5213
- } = Digit.Hooks.ekyc.useSearchConnection({
5214
- tenantId,
5215
- details: searchDetails
5216
- }, {
5217
- enabled: !!tenantId && !!searchDetails.kno,
5218
- keepPreviousData: true
5219
- });
5220
5431
  const {
5221
5432
  isLoading: isDataSearchLoading,
5222
5433
  data
5223
- } = Digit.Hooks.ekyc.useEkycAssignmentProgress({}, {
5224
- enabled: !!tenantId && !!searchDetails.kno,
5434
+ } = Digit.Hooks.ekyc.useEkycAssignmentProgress({
5435
+ enabled: !!tenantId,
5225
5436
  keepPreviousData: true
5226
5437
  });
5227
5438
  const sourceData = useMemo(() => {
5228
- if (isSearchActive) {
5229
- if (!searchData) return [];
5230
- return [searchData];
5231
- }
5232
5439
  return (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.surveyors) || [];
5233
- }, [isSearchActive, searchData, dashboardData]);
5440
+ }, [dashboardData]);
5234
5441
  const filteredData = useMemo(() => {
5235
5442
  return (sourceData || []).map(item => {
5236
5443
  var _owner$roles, _owner$roles$map, _item$additionalDetai, _item$auditDetails, _item$auditDetails2;
@@ -5256,10 +5463,6 @@ const AssignEkyc = () => {
5256
5463
  });
5257
5464
  }, [sourceData]);
5258
5465
  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;
5259
- const checkPathName = location.pathname.includes("ekyc/inbox");
5260
- const PropsForInboxLinks = {
5261
- headerText: checkPathName ? "EKYC_MODULE" : "MODULE_SW"
5262
- };
5263
5466
  const SearchFormFields = useCallback(({
5264
5467
  registerRef,
5265
5468
  searchFormState,
@@ -5283,13 +5486,11 @@ const AssignEkyc = () => {
5283
5486
  action: "mutateTableForm",
5284
5487
  data: {
5285
5488
  ...tableOrderFormDefaultValues
5286
- },
5287
- checkPathName
5489
+ }
5288
5490
  });
5289
5491
  dispatch({
5290
5492
  action: "mutateSearchForm",
5291
- data,
5292
- checkPathName
5493
+ data
5293
5494
  });
5294
5495
  };
5295
5496
  const searchFormDefaultValues = {
@@ -5320,47 +5521,6 @@ const AssignEkyc = () => {
5320
5521
  setFilterFormValue,
5321
5522
  getFilterFormValue
5322
5523
  }) => /*#__PURE__*/React.createElement(React.Fragment, null), []);
5323
- const propsForFilterForm = {
5324
- FilterFormFields,
5325
- onFilterFormSubmit: () => {},
5326
- filterFormDefaultValues: "",
5327
- resetFilterFormDefaultValues: "",
5328
- onFilterFormReset: () => {}
5329
- };
5330
- function formReducer(state, payload) {
5331
- const storageKey = payload.checkPathName ? "EKYC.INBOX" : "EKYC.SW.INBOX";
5332
- switch (payload.action) {
5333
- case "mutateSearchForm":
5334
- Digit.SessionStorage.set(storageKey, {
5335
- ...state,
5336
- searchForm: payload.data
5337
- });
5338
- return {
5339
- ...state,
5340
- searchForm: payload.data
5341
- };
5342
- case "mutateFilterForm":
5343
- Digit.SessionStorage.set(storageKey, {
5344
- ...state,
5345
- filterForm: payload.data
5346
- });
5347
- return {
5348
- ...state,
5349
- filterForm: payload.data
5350
- };
5351
- case "mutateTableForm":
5352
- Digit.SessionStorage.set(storageKey, {
5353
- ...state,
5354
- tableForm: payload.data
5355
- });
5356
- return {
5357
- ...state,
5358
- tableForm: payload.data
5359
- };
5360
- default:
5361
- return state;
5362
- }
5363
- }
5364
5524
  const onPageSizeChange = e => {
5365
5525
  const newLimit = Number(e.target.value);
5366
5526
  dispatch({
@@ -5369,8 +5529,7 @@ const AssignEkyc = () => {
5369
5529
  ...formState.tableForm,
5370
5530
  limit: newLimit,
5371
5531
  offset: 0
5372
- },
5373
- checkPathName
5532
+ }
5374
5533
  });
5375
5534
  };
5376
5535
  const onSortingByData = e => {
@@ -5388,8 +5547,7 @@ const AssignEkyc = () => {
5388
5547
  ...formState.tableForm,
5389
5548
  sortBy: id,
5390
5549
  sortOrder: desc ? "DESC" : "ASC"
5391
- },
5392
- checkPathName
5550
+ }
5393
5551
  });
5394
5552
  }
5395
5553
  }
@@ -5403,7 +5561,6 @@ const AssignEkyc = () => {
5403
5561
  dispatch,
5404
5562
  onSortingByData,
5405
5563
  tenantId,
5406
- checkPathName,
5407
5564
  inboxStyles: {
5408
5565
  overflowX: "scroll",
5409
5566
  overflowY: "hidden"
@@ -5413,7 +5570,7 @@ const AssignEkyc = () => {
5413
5570
  }
5414
5571
  }
5415
5572
  });
5416
- const isInboxLoading = isLoading || isSearchLoading;
5573
+ const isInboxLoading = isLoading;
5417
5574
  const cards = [{
5418
5575
  label: "TOTAL_EKYC_APPLICATIONS",
5419
5576
  count: (data === null || data === void 0 ? void 0 : data.totalKnos) || 0,
@@ -5444,9 +5601,8 @@ const AssignEkyc = () => {
5444
5601
  return /*#__PURE__*/React.createElement("div", {
5445
5602
  className: "app-container"
5446
5603
  }, /*#__PURE__*/React.createElement(InboxComposer, _extends({
5447
- isInboxLoading,
5448
- PropsForInboxLinks
5449
- }, propsForSearchForm, propsForFilterForm, {
5604
+ isInboxLoading
5605
+ }, propsForSearchForm, {
5450
5606
  propsForInboxTable,
5451
5607
  formState,
5452
5608
  countData: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
@@ -5463,24 +5619,78 @@ const EmployeeApp = ({
5463
5619
  } = useTranslation();
5464
5620
  const location = useLocation();
5465
5621
  sessionStorage.removeItem("revalidateddone");
5466
- const getBreadcrumbLabel = () => {
5622
+ const getDynamicBreadcrumbs = () => {
5467
5623
  const pathname = location.pathname;
5468
- if (pathname.includes("/dashboard")) return "ES_COMMON_INBOX";
5469
- if (pathname.includes("/create-kyc")) return "EKYC_CREATE_KYC";
5470
- if (pathname.includes("/k-details")) return "EKYC_K_DETAILS";
5471
- if (pathname.includes("/consumer-details")) return "EKYC_CONSUMER_DETAILS";
5472
- if (pathname.includes("/address-details")) return "EKYC_ADDRESS_DETAILS";
5473
- if (pathname.includes("/property-info")) return "EKYC_PROPERTY_INFO";
5474
- if (pathname.includes("/meter-details")) return "EKYC_METER_DETAILS";
5475
- if (pathname.includes("/review")) return "EKYC_REVIEW";
5476
- return "ES_COMMON_INBOX";
5624
+ const crumbs = [{
5625
+ icon: HomeIcon,
5626
+ path: "/digit-ui/employee"
5627
+ }, {
5628
+ label: t("ACTION_TEST_EKYC"),
5629
+ path: `/digit-ui/employee/module/details`
5630
+ }];
5631
+ if (pathname.includes("/create-kyc")) {
5632
+ crumbs.push({
5633
+ label: t("EKYC_CREATE_KYC")
5634
+ });
5635
+ } else if (pathname.includes("/consumer-details")) {
5636
+ crumbs.push({
5637
+ label: t("EKYC_CONSUMER_DETAILS")
5638
+ });
5639
+ } else if (pathname.includes("/address-details")) {
5640
+ crumbs.push({
5641
+ label: t("EKYC_ADDRESS_DETAILS")
5642
+ });
5643
+ } else if (pathname.includes("/property-info")) {
5644
+ crumbs.push({
5645
+ label: t("EKYC_PROPERTY_INFO")
5646
+ });
5647
+ } else if (pathname.includes("/meter-details")) {
5648
+ crumbs.push({
5649
+ label: t("EKYC_METER_DETAILS")
5650
+ });
5651
+ } else if (pathname.includes("/review")) {
5652
+ crumbs.push({
5653
+ label: t("EKYC_INBOX"),
5654
+ path: `/digit-ui/employee/ekyc/inbox`
5655
+ });
5656
+ crumbs.push({
5657
+ label: t("EKYC_REVIEW")
5658
+ });
5659
+ } else if (pathname.includes("/assign/surveyor-details")) {
5660
+ crumbs.push({
5661
+ label: t("EKYC_ASSIGN"),
5662
+ path: `/digit-ui/employee/ekyc/assign`
5663
+ });
5664
+ crumbs.push({
5665
+ label: t("EKYC_SURVEYOR_DETAILS")
5666
+ });
5667
+ } else if (pathname.includes("/assign")) {
5668
+ crumbs.push({
5669
+ label: t("EKYC_ASSIGN")
5670
+ });
5671
+ } else if (pathname.includes("/ceo-dashboard")) {
5672
+ crumbs.push({
5673
+ label: t("CEO_M.F_DOR_FINANCE_VIEW")
5674
+ });
5675
+ } else if (pathname.includes("/vendors/")) {
5676
+ crumbs.push({
5677
+ label: t("EKYC_VENDOR_DETAILS")
5678
+ });
5679
+ } else if (pathname.includes("/mapping")) {
5680
+ crumbs.push({
5681
+ label: t("EKYC_MAPPING")
5682
+ });
5683
+ } else if (pathname.includes("/dashboard")) {
5684
+ crumbs.push({
5685
+ label: t("EKYC_DASHBOARD")
5686
+ });
5687
+ } else if (pathname.includes("/inbox")) {
5688
+ crumbs.push({
5689
+ label: t("EKYC_INBOX")
5690
+ });
5691
+ }
5692
+ return crumbs;
5477
5693
  };
5478
- const breadcrumbs = [{
5479
- icon: HomeIcon,
5480
- path: "/digit-ui/employee"
5481
- }, {
5482
- label: t(getBreadcrumbLabel())
5483
- }];
5484
5694
  const formStepRoutes = ["consumer-details", "address-details", "property-info", "meter-details"];
5485
5695
  return /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement("div", {
5486
5696
  className: "ground-container employee-app-container form-container"
@@ -5489,7 +5699,7 @@ const EmployeeApp = ({
5489
5699
  className: "icon"
5490
5700
  }), "Back"),
5491
5701
  onLeftClick: () => window.history.back(),
5492
- breadcrumbs: breadcrumbs
5702
+ breadcrumbs: getDynamicBreadcrumbs()
5493
5703
  }), /*#__PURE__*/React.createElement("div", {
5494
5704
  className: "employee-form"
5495
5705
  }, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(PrivateRoute, {
@@ -6249,9 +6459,6 @@ const Inbox$1 = ({
6249
6459
  }, [sourceData]);
6250
6460
  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;
6251
6461
  const checkPathName = location.pathname.includes("ekyc/inbox");
6252
- const PropsForInboxLinks = {
6253
- headerText: checkPathName ? "MODULE_WATER" : "MODULE_SW"
6254
- };
6255
6462
  const SearchFormFields = useCallback(({
6256
6463
  registerRef,
6257
6464
  searchFormState,
@@ -6312,13 +6519,6 @@ const Inbox$1 = ({
6312
6519
  setFilterFormValue,
6313
6520
  getFilterFormValue
6314
6521
  }) => /*#__PURE__*/React.createElement(React.Fragment, null), []);
6315
- const propsForFilterForm = {
6316
- FilterFormFields,
6317
- onFilterFormSubmit: () => {},
6318
- filterFormDefaultValues: "",
6319
- resetFilterFormDefaultValues: "",
6320
- onFilterFormReset: () => {}
6321
- };
6322
6522
  function formReducer(state, payload) {
6323
6523
  const storageKey = payload.checkPathName ? "EKYC.INBOX" : "EKYC.SW.INBOX";
6324
6524
  switch (payload.action) {
@@ -6410,220 +6610,14 @@ const Inbox$1 = ({
6410
6610
  return /*#__PURE__*/React.createElement("div", {
6411
6611
  className: "app-container"
6412
6612
  }, /*#__PURE__*/React.createElement(InboxComposer, _extends({
6413
- isInboxLoading,
6414
- PropsForInboxLinks
6415
- }, propsForSearchForm, propsForFilterForm, {
6613
+ isInboxLoading
6614
+ }, propsForSearchForm, {
6416
6615
  propsForInboxTable,
6417
6616
  formState
6418
6617
  })));
6419
6618
  };
6420
6619
 
6421
- const AddressDetails = ({
6422
- config,
6423
- onSelect
6424
- }) => {
6425
- var _mdmsData$MdmsRes, _mdmsData$MdmsRes$ego, _mdmsData$MdmsRes$ego2, _mdmsData$MdmsRes$ego3, _mdmsData$MdmsRes$ego4;
6426
- const {
6427
- t
6428
- } = useTranslation();
6429
- const tenantId = Digit.ULBService.getCurrentTenantId();
6430
- const [houseNo, setHouseNo] = useState("");
6431
- const [street, setStreet] = useState("");
6432
- const [locality, setLocality] = useState("");
6433
- const [landmark, setLandmark] = useState("");
6434
- const [subLocality, setSubLocality] = useState(null);
6435
- const [pinCode, setPinCode] = useState("");
6436
- const [assembly, setAssembly] = useState(null);
6437
- const [ward, setWard] = useState(null);
6438
- const [zone, setZone] = useState(null);
6439
- const [latitude, setLatitude] = useState("");
6440
- const [longitude, setLongitude] = useState("");
6441
- const [addressType, setAddressType] = useState(null);
6442
- const [doorPhoto, setDoorPhoto] = useState(null);
6443
- const [doorPhotoFileStoreId, setDoorPhotoFileStoreId] = useState(null);
6444
- const [toast, setToast] = useState(null);
6445
- const {
6446
- data: mdmsData,
6447
- isLoading
6448
- } = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]);
6449
- 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) || [];
6450
- useEffect(() => {
6451
- let isMounted = true;
6452
- if (navigator.geolocation) {
6453
- navigator.geolocation.getCurrentPosition(pos => {
6454
- if (!isMounted) return;
6455
- setLatitude(pos.coords.latitude);
6456
- setLongitude(pos.coords.longitude);
6457
- }, () => {
6458
- if (!isMounted) return;
6459
- setToast({
6460
- type: "error",
6461
- message: "GPS access denied"
6462
- });
6463
- });
6464
- }
6465
- return () => {
6466
- isMounted = false;
6467
- };
6468
- }, []);
6469
- const handlePincodeChange = e => {
6470
- const value = e.target.value;
6471
- if (/^\d{0,6}$/.test(value)) {
6472
- setPinCode(value);
6473
- if (value.length === 6) {
6474
- fetchLocationByPincode(value);
6475
- }
6476
- }
6477
- };
6478
- const fetchLocationByPincode = pin => {
6479
- console.log("Fetching location for PIN:", pin);
6480
- };
6481
- const selectphoto = async e => {
6482
- let isMounted = true;
6483
- const file = e.target.files[0];
6484
- if (!file) return;
6485
- if (file.size >= 2000000) {
6486
- setToast({
6487
- type: "error",
6488
- message: "Max size 2MB exceeded"
6489
- });
6490
- return;
6491
- }
6492
- try {
6493
- var _res$data, _res$data$files, _res$data$files$;
6494
- const res = await Digit.UploadServices.Filestorage("EKYC", file, tenantId);
6495
- if (!isMounted) return;
6496
- 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;
6497
- if (fileStoreId) {
6498
- setDoorPhotoFileStoreId(fileStoreId);
6499
- const reader = new FileReader();
6500
- reader.onloadend = () => {
6501
- if (!isMounted) return;
6502
- setDoorPhoto(reader.result);
6503
- };
6504
- reader.readAsDataURL(file);
6505
- setToast({
6506
- type: "success",
6507
- message: "Upload successful"
6508
- });
6509
- }
6510
- } catch {
6511
- if (!isMounted) return;
6512
- setToast({
6513
- type: "error",
6514
- message: "Upload failed"
6515
- });
6516
- }
6517
- return () => {
6518
- isMounted = false;
6519
- };
6520
- };
6521
- const removePhoto = () => {
6522
- setDoorPhoto(null);
6523
- setDoorPhotoFileStoreId(null);
6524
- };
6525
- const isValid = () => {
6526
- return houseNo && street && pinCode.length === 6 && assembly && ward && zone && latitude && longitude && doorPhotoFileStoreId;
6527
- };
6528
- const onStepSelect = () => {
6529
- if (!isValid()) {
6530
- setToast({
6531
- type: "error",
6532
- message: "Please fill all mandatory fields"
6533
- });
6534
- return;
6535
- }
6536
- const data = {
6537
- houseNo,
6538
- street,
6539
- locality,
6540
- landmark,
6541
- subLocality,
6542
- pinCode,
6543
- assembly: assembly === null || assembly === void 0 ? void 0 : assembly.name,
6544
- ward: ward === null || ward === void 0 ? void 0 : ward.name,
6545
- zone: zone === null || zone === void 0 ? void 0 : zone.name,
6546
- latitude,
6547
- longitude,
6548
- addressType: addressType === null || addressType === void 0 ? void 0 : addressType.name,
6549
- doorPhotoFilestoreId: doorPhotoFileStoreId
6550
- };
6551
- onSelect(config.key, data);
6552
- };
6553
- if (isLoading) return /*#__PURE__*/React.createElement(Loader, null);
6554
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(FormStep, {
6555
- t: t,
6556
- onSelect: onStepSelect,
6557
- config: config,
6558
- label: t("ES_COMMON_CONTINUE")
6559
- }, /*#__PURE__*/React.createElement(CardLabel, null, "House No / Flat No *"), /*#__PURE__*/React.createElement(TextInput, {
6560
- value: houseNo,
6561
- onChange: e => setHouseNo(e.target.value)
6562
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Street / Address Line *"), /*#__PURE__*/React.createElement(TextInput, {
6563
- value: street,
6564
- onChange: e => setStreet(e.target.value)
6565
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Locality"), /*#__PURE__*/React.createElement(TextInput, {
6566
- value: locality,
6567
- onChange: e => setLocality(e.target.value)
6568
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Landmark"), /*#__PURE__*/React.createElement(TextInput, {
6569
- value: landmark,
6570
- onChange: e => setLandmark(e.target.value)
6571
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Sub Locality"), /*#__PURE__*/React.createElement(Dropdown, {
6572
- option: [],
6573
- selected: subLocality,
6574
- select: setSubLocality
6575
- }), /*#__PURE__*/React.createElement(CardLabel, null, "PIN Code *"), /*#__PURE__*/React.createElement(TextInput, {
6576
- value: pinCode,
6577
- onChange: handlePincodeChange,
6578
- maxLength: 6
6579
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Assembly *"), /*#__PURE__*/React.createElement(Dropdown, {
6580
- option: assemblies,
6581
- selected: assembly,
6582
- select: setAssembly
6583
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Ward *"), /*#__PURE__*/React.createElement(Dropdown, {
6584
- option: (assembly === null || assembly === void 0 ? void 0 : assembly.children) || [],
6585
- selected: ward,
6586
- select: setWard
6587
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Zone *"), /*#__PURE__*/React.createElement(Dropdown, {
6588
- option: (ward === null || ward === void 0 ? void 0 : ward.children) || [],
6589
- selected: zone,
6590
- select: setZone
6591
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Latitude"), /*#__PURE__*/React.createElement(TextInput, {
6592
- value: latitude,
6593
- disabled: true
6594
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Longitude"), /*#__PURE__*/React.createElement(TextInput, {
6595
- value: longitude,
6596
- disabled: true
6597
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Address Type"), /*#__PURE__*/React.createElement(Dropdown, {
6598
- option: [{
6599
- name: "Permanent"
6600
- }, {
6601
- name: "Correspondence"
6602
- }, {
6603
- name: "Other"
6604
- }],
6605
- selected: addressType,
6606
- select: setAddressType
6607
- }), /*#__PURE__*/React.createElement(CardLabel, null, "Door Image *"), /*#__PURE__*/React.createElement(UploadFile, {
6608
- onUpload: selectphoto,
6609
- onDelete: removePhoto,
6610
- message: doorPhotoFileStoreId ? "Uploaded" : "No file selected"
6611
- }), doorPhoto && /*#__PURE__*/React.createElement("img", {
6612
- src: doorPhoto,
6613
- alt: "preview",
6614
- style: {
6615
- width: "100%",
6616
- marginTop: "10px"
6617
- }
6618
- }), toast && /*#__PURE__*/React.createElement(Toast, {
6619
- label: toast.message,
6620
- error: toast.type === "error",
6621
- onClose: () => setToast(null)
6622
- })));
6623
- };
6624
-
6625
6620
  const CitizenApp = () => {
6626
- var _Digit$SessionStorage, _Digit$SessionStorage2;
6627
6621
  const {
6628
6622
  t
6629
6623
  } = useTranslation();
@@ -6632,24 +6626,74 @@ const CitizenApp = () => {
6632
6626
  path
6633
6627
  } = useRouteMatch();
6634
6628
  sessionStorage.removeItem("revalidateddone");
6635
- const getBreadcrumbLabel = () => {
6629
+ const getDynamicBreadcrumbs = () => {
6636
6630
  const pathname = location.pathname;
6637
- if (pathname.includes("/create-kyc")) return "EKYC_CREATE_KYC";
6638
- if (pathname.includes("/aadhaar-verification")) return "EKYC_AADHAAR_VERIFICATION";
6639
- if (pathname.includes("/address-details")) return "EKYC_ADDRESS_DETAILS";
6640
- if (pathname.includes("/property-info")) return "EKYC_PROPERTY_INFO";
6641
- if (pathname.includes("/meter-details")) return "EKYC_METER_DETAILS";
6642
- if (pathname.includes("/review")) return "EKYC_REVIEW";
6643
- return "EKYC_HOME";
6631
+ const crumbs = [{
6632
+ icon: HomeIcon,
6633
+ path: "/digit-ui/citizen"
6634
+ }, {
6635
+ label: t("EKYC_MODULE_NAME"),
6636
+ path: `/digit-ui/citizen/ekyc`
6637
+ }];
6638
+ if (pathname.includes("/create-kyc")) {
6639
+ crumbs.push({
6640
+ label: t("EKYC_CREATE_KYC")
6641
+ });
6642
+ } else if (pathname.includes("/aadhaar-verification")) {
6643
+ crumbs.push({
6644
+ label: t("EKYC_AADHAAR_VERIFICATION")
6645
+ });
6646
+ } else if (pathname.includes("/address-details")) {
6647
+ crumbs.push({
6648
+ label: t("EKYC_ADDRESS_DETAILS")
6649
+ });
6650
+ } else if (pathname.includes("/property-info")) {
6651
+ crumbs.push({
6652
+ label: t("EKYC_PROPERTY_INFO")
6653
+ });
6654
+ } else if (pathname.includes("/meter-details")) {
6655
+ crumbs.push({
6656
+ label: t("EKYC_METER_DETAILS")
6657
+ });
6658
+ } else if (pathname.includes("/review")) {
6659
+ crumbs.push({
6660
+ label: t("EKYC_INBOX"),
6661
+ path: `/digit-ui/citizen/ekyc/inbox`
6662
+ });
6663
+ crumbs.push({
6664
+ label: t("EKYC_REVIEW")
6665
+ });
6666
+ } else if (pathname.includes("/assign/surveyor-details")) {
6667
+ crumbs.push({
6668
+ label: t("EKYC_ASSIGN"),
6669
+ path: `/digit-ui/citizen/ekyc/assign`
6670
+ });
6671
+ crumbs.push({
6672
+ label: t("EKYC_SURVEYOR_DETAILS")
6673
+ });
6674
+ } else if (pathname.includes("/assign")) {
6675
+ crumbs.push({
6676
+ label: t("EKYC_ASSIGN")
6677
+ });
6678
+ } else if (pathname.includes("/surveyor-dashboard")) {
6679
+ crumbs.push({
6680
+ label: t("EKYC_SURVEYOR_DASHBOARD")
6681
+ });
6682
+ } else if (pathname.includes("/dashboard")) {
6683
+ crumbs.push({
6684
+ label: t("EKYC_DASHBOARD")
6685
+ });
6686
+ } else if (pathname.includes("/inbox")) {
6687
+ crumbs.push({
6688
+ label: t("EKYC_INBOX")
6689
+ });
6690
+ } else if (pathname.includes("/status/")) {
6691
+ crumbs.push({
6692
+ label: t("EKYC_STATUS")
6693
+ });
6694
+ }
6695
+ return crumbs;
6644
6696
  };
6645
- const breadcrumbs = [{
6646
- icon: HomeIcon,
6647
- path: "/digit-ui/citizen"
6648
- }, {
6649
- label: t(getBreadcrumbLabel())
6650
- }];
6651
- 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);
6652
- const isEkyAction = !(roles !== null && roles !== void 0 && roles.includes("EKYC_SURVEYOR")) || (roles === null || roles === void 0 ? void 0 : roles.includes("EMPLOYEE"));
6653
6697
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
6654
6698
  className: "ground-container form-container"
6655
6699
  }, /*#__PURE__*/React.createElement(ModuleHeader, {
@@ -6657,7 +6701,7 @@ const CitizenApp = () => {
6657
6701
  className: "icon"
6658
6702
  }), t("CS_COMMON_BACK")),
6659
6703
  onLeftClick: () => window.history.back(),
6660
- breadcrumbs: breadcrumbs
6704
+ breadcrumbs: getDynamicBreadcrumbs()
6661
6705
  }), /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(PrivateRoute, {
6662
6706
  exact: true,
6663
6707
  path: `${path}`,
@@ -6679,11 +6723,6 @@ const CitizenApp = () => {
6679
6723
  component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
6680
6724
  layoutClass: "normal"
6681
6725
  }, /*#__PURE__*/React.createElement(AadhaarVerification, null))
6682
- }), /*#__PURE__*/React.createElement(PrivateRoute, {
6683
- path: `${path}/address-details`,
6684
- component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
6685
- layoutClass: "normal"
6686
- }, /*#__PURE__*/React.createElement(AddressDetails, null))
6687
6726
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
6688
6727
  path: `${path}/property-info`,
6689
6728
  component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
@@ -6798,7 +6837,6 @@ const componentsToRegister = {
6798
6837
  EKYC_INBOX_FILTER: props => /*#__PURE__*/React.createElement(Filter, props),
6799
6838
  EkycLinks,
6800
6839
  AadhaarVerification,
6801
- AddressDetails,
6802
6840
  PropertyInfo,
6803
6841
  MeterDetails
6804
6842
  };