@djb25/digit-ui-module-ekyc 1.0.24 → 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,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;
@@ -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,13 +4761,48 @@ 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,
@@ -4794,6 +4840,23 @@ const SurveyorDetailsDashboard = () => {
4794
4840
  value
4795
4841
  }) => value || "-"
4796
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
+ }, []);
4797
4860
  if (isLoading) {
4798
4861
  return /*#__PURE__*/React.createElement(Loader, null);
4799
4862
  }
@@ -4839,6 +4902,83 @@ const SurveyorDetailsDashboard = () => {
4839
4902
  value: (surveyor === null || surveyor === void 0 ? void 0 : surveyor.rejectedCases) || 0,
4840
4903
  color: "#EF4444"
4841
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
+ };
4842
4982
  const StatCard = ({
4843
4983
  title,
4844
4984
  value,
@@ -4858,14 +4998,11 @@ const SurveyorDetailsDashboard = () => {
4858
4998
  const options = [{
4859
4999
  action: "Assign"
4860
5000
  }];
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
5001
  const handleMenuSelect = option => {
4864
5002
  setShowOptions(false);
4865
5003
  setShowModal(true);
4866
5004
  };
4867
5005
  const closeModal = async () => {
4868
- await refetchDashboard();
4869
5006
  setShowModal(false);
4870
5007
  };
4871
5008
  return /*#__PURE__*/React.createElement(Card, {
@@ -4884,26 +5021,85 @@ const SurveyorDetailsDashboard = () => {
4884
5021
  className: "designation"
4885
5022
  }, (surveyor === null || surveyor === void 0 ? void 0 : surveyor.description) || t("FIELD_SURVEYOR")), /*#__PURE__*/React.createElement("div", {
4886
5023
  className: "employee-id"
4887
- }, 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", {
4888
5084
  className: "stats-wrapper"
4889
5085
  }, /*#__PURE__*/React.createElement(StatCard, {
4890
5086
  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,
5087
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo3 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo3 === void 0 ? void 0 : _dashboardData$dashbo3.total) || 0,
4892
5088
  type: "today",
4893
5089
  isLoading: isDashboardLoading
4894
5090
  }), /*#__PURE__*/React.createElement(StatCard, {
4895
5091
  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,
5092
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo4 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo4 === void 0 ? void 0 : _dashboardData$dashbo4.completed) || 0,
4897
5093
  type: "week",
4898
5094
  isLoading: isDashboardLoading
4899
5095
  }), /*#__PURE__*/React.createElement(StatCard, {
4900
5096
  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,
5097
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo5 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo5 === void 0 ? void 0 : _dashboardData$dashbo5.pending) || 0,
4902
5098
  type: "pending",
4903
5099
  isLoading: isDashboardLoading
4904
5100
  }), /*#__PURE__*/React.createElement(StatCard, {
4905
5101
  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,
5102
+ value: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo6 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo6 === void 0 ? void 0 : _dashboardData$dashbo6.submittedCount) || 0,
4907
5103
  type: "month",
4908
5104
  isLoading: isDashboardLoading
4909
5105
  })), /*#__PURE__*/React.createElement("div", {
@@ -4951,19 +5147,19 @@ const SurveyorDetailsDashboard = () => {
4951
5147
  className: "label"
4952
5148
  }, t("MOBILE"), ":"), /*#__PURE__*/React.createElement("span", {
4953
5149
  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", {
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", {
4955
5151
  className: "detail-item"
4956
5152
  }, /*#__PURE__*/React.createElement("span", {
4957
5153
  className: "label"
4958
5154
  }, t("EMAIL"), ":"), /*#__PURE__*/React.createElement("span", {
4959
5155
  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", {
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", {
4961
5157
  className: "detail-item"
4962
5158
  }, /*#__PURE__*/React.createElement("span", {
4963
5159
  className: "label"
4964
5160
  }, t("GENDER"), ":"), /*#__PURE__*/React.createElement("span", {
4965
5161
  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", {
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", {
4967
5163
  className: "detail-item"
4968
5164
  }, /*#__PURE__*/React.createElement("span", {
4969
5165
  className: "label"
@@ -4987,16 +5183,16 @@ const SurveyorDetailsDashboard = () => {
4987
5183
  t: t,
4988
5184
  tableTitle: t("ASSIGNED_KNOS"),
4989
5185
  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) || [],
5186
+ data: (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo7 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo7 === void 0 ? void 0 : _dashboardData$dashbo7.consumerList) || [],
4991
5187
  columns: knoColumns,
4992
5188
  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,
5189
+ totalRecords: dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo8 = dashboardData.dashboardInfo) === null || _dashboardData$dashbo8 === void 0 ? void 0 : _dashboardData$dashbo8.total,
4994
5190
  currentPage: currentPage,
4995
5191
  pageSizeLimit: pageSize,
4996
5192
  isPaginationRequired: true,
4997
5193
  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) {
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) {
5000
5196
  setCurrentPage(prev => prev + 1);
5001
5197
  }
5002
5198
  },
@@ -5009,8 +5205,8 @@ const SurveyorDetailsDashboard = () => {
5009
5205
  setCurrentPage(0);
5010
5206
  },
5011
5207
  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));
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));
5014
5210
  },
5015
5211
  onPageSizeChange: e => {
5016
5212
  setPageSize(Number(e.target.value));
@@ -5030,17 +5226,111 @@ const SurveyorDetailsDashboard = () => {
5030
5226
  }
5031
5227
  })), showModal && /*#__PURE__*/React.createElement(AssignEkycModal, {
5032
5228
  surveyor: surveyor,
5033
- closeModal: closeModal
5229
+ closeModal: closeModal,
5230
+ refetchDashboard: refetchDashboard
5034
5231
  }));
5035
5232
  };
5036
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
+
5037
5328
  const SupervisorInboxTableConfig = ({
5038
5329
  onPageSizeChange,
5039
5330
  formState,
5040
5331
  totalCount,
5041
5332
  table,
5042
5333
  dispatch,
5043
- checkPathName,
5044
5334
  onSortingByData,
5045
5335
  inboxStyles: _inboxStyles = {},
5046
5336
  tableStyle: _tableStyle = {}
@@ -5056,64 +5346,6 @@ const SupervisorInboxTableConfig = ({
5056
5346
  };
5057
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;
5058
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;
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
5349
  return {
5118
5350
  getCellProps: () => ({
5119
5351
  style: {
@@ -5131,37 +5363,33 @@ const SupervisorInboxTableConfig = ({
5131
5363
  data: {
5132
5364
  ...formState.tableForm,
5133
5365
  offset: Number(offset) + Number(limit)
5134
- },
5135
- checkPathName
5366
+ }
5136
5367
  }),
5137
5368
  onPrevPage: () => dispatch({
5138
5369
  action: "mutateTableForm",
5139
5370
  data: {
5140
5371
  ...formState.tableForm,
5141
5372
  offset: Number(offset) - Number(limit)
5142
- },
5143
- checkPathName
5373
+ }
5144
5374
  }),
5145
5375
  onLastPage: () => dispatch({
5146
5376
  action: "mutateTableForm",
5147
5377
  data: {
5148
5378
  ...formState.tableForm,
5149
5379
  offset: Math.ceil(totalCount / limit) * limit - Number(limit)
5150
- },
5151
- checkPathName
5380
+ }
5152
5381
  }),
5153
5382
  onFirstPage: () => dispatch({
5154
5383
  action: "mutateTableForm",
5155
5384
  data: {
5156
5385
  ...formState.tableForm,
5157
5386
  offset: 0
5158
- },
5159
- checkPathName
5387
+ }
5160
5388
  }),
5161
5389
  totalRecords: totalCount,
5162
5390
  onSort: onSortingByData,
5163
5391
  data: table,
5164
- columns: tableColumnConfig,
5392
+ columns: tableColumnConfig(t, handleReview),
5165
5393
  inboxStyles: {
5166
5394
  ..._inboxStyles
5167
5395
  },
@@ -5177,19 +5405,7 @@ const AssignEkyc = () => {
5177
5405
  if (!tenantId || tenantId === "dl") {
5178
5406
  tenantId = "dl.djb";
5179
5407
  }
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
5408
  const [formState, dispatch] = useReducer(formReducer, formInitValue);
5192
- const userDetails = Digit.SessionStorage.get("User");
5193
5409
  let paginationParms = {
5194
5410
  limit: (formState === null || formState === void 0 ? void 0 : (_formState$tableForm = formState.tableForm) === null || _formState$tableForm === void 0 ? void 0 : _formState$tableForm.limit) || 10,
5195
5411
  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 +5463,6 @@ const AssignEkyc = () => {
5247
5463
  });
5248
5464
  }, [sourceData]);
5249
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;
5250
- const checkPathName = location.pathname.includes("ekyc/inbox");
5251
- const PropsForInboxLinks = {
5252
- headerText: checkPathName ? "EKYC_MODULE" : "MODULE_SW"
5253
- };
5254
5466
  const SearchFormFields = useCallback(({
5255
5467
  registerRef,
5256
5468
  searchFormState,
@@ -5274,13 +5486,11 @@ const AssignEkyc = () => {
5274
5486
  action: "mutateTableForm",
5275
5487
  data: {
5276
5488
  ...tableOrderFormDefaultValues
5277
- },
5278
- checkPathName
5489
+ }
5279
5490
  });
5280
5491
  dispatch({
5281
5492
  action: "mutateSearchForm",
5282
- data,
5283
- checkPathName
5493
+ data
5284
5494
  });
5285
5495
  };
5286
5496
  const searchFormDefaultValues = {
@@ -5311,47 +5521,6 @@ const AssignEkyc = () => {
5311
5521
  setFilterFormValue,
5312
5522
  getFilterFormValue
5313
5523
  }) => /*#__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
5524
  const onPageSizeChange = e => {
5356
5525
  const newLimit = Number(e.target.value);
5357
5526
  dispatch({
@@ -5360,8 +5529,7 @@ const AssignEkyc = () => {
5360
5529
  ...formState.tableForm,
5361
5530
  limit: newLimit,
5362
5531
  offset: 0
5363
- },
5364
- checkPathName
5532
+ }
5365
5533
  });
5366
5534
  };
5367
5535
  const onSortingByData = e => {
@@ -5379,8 +5547,7 @@ const AssignEkyc = () => {
5379
5547
  ...formState.tableForm,
5380
5548
  sortBy: id,
5381
5549
  sortOrder: desc ? "DESC" : "ASC"
5382
- },
5383
- checkPathName
5550
+ }
5384
5551
  });
5385
5552
  }
5386
5553
  }
@@ -5394,7 +5561,6 @@ const AssignEkyc = () => {
5394
5561
  dispatch,
5395
5562
  onSortingByData,
5396
5563
  tenantId,
5397
- checkPathName,
5398
5564
  inboxStyles: {
5399
5565
  overflowX: "scroll",
5400
5566
  overflowY: "hidden"
@@ -5435,9 +5601,8 @@ const AssignEkyc = () => {
5435
5601
  return /*#__PURE__*/React.createElement("div", {
5436
5602
  className: "app-container"
5437
5603
  }, /*#__PURE__*/React.createElement(InboxComposer, _extends({
5438
- isInboxLoading,
5439
- PropsForInboxLinks
5440
- }, propsForSearchForm, propsForFilterForm, {
5604
+ isInboxLoading
5605
+ }, propsForSearchForm, {
5441
5606
  propsForInboxTable,
5442
5607
  formState,
5443
5608
  countData: dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.dashboardInfo,
@@ -5454,24 +5619,78 @@ const EmployeeApp = ({
5454
5619
  } = useTranslation();
5455
5620
  const location = useLocation();
5456
5621
  sessionStorage.removeItem("revalidateddone");
5457
- const getBreadcrumbLabel = () => {
5622
+ const getDynamicBreadcrumbs = () => {
5458
5623
  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";
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;
5468
5693
  };
5469
- const breadcrumbs = [{
5470
- icon: HomeIcon,
5471
- path: "/digit-ui/employee"
5472
- }, {
5473
- label: t(getBreadcrumbLabel())
5474
- }];
5475
5694
  const formStepRoutes = ["consumer-details", "address-details", "property-info", "meter-details"];
5476
5695
  return /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement("div", {
5477
5696
  className: "ground-container employee-app-container form-container"
@@ -5480,7 +5699,7 @@ const EmployeeApp = ({
5480
5699
  className: "icon"
5481
5700
  }), "Back"),
5482
5701
  onLeftClick: () => window.history.back(),
5483
- breadcrumbs: breadcrumbs
5702
+ breadcrumbs: getDynamicBreadcrumbs()
5484
5703
  }), /*#__PURE__*/React.createElement("div", {
5485
5704
  className: "employee-form"
5486
5705
  }, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(PrivateRoute, {
@@ -6240,9 +6459,6 @@ const Inbox$1 = ({
6240
6459
  }, [sourceData]);
6241
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;
6242
6461
  const checkPathName = location.pathname.includes("ekyc/inbox");
6243
- const PropsForInboxLinks = {
6244
- headerText: checkPathName ? "MODULE_WATER" : "MODULE_SW"
6245
- };
6246
6462
  const SearchFormFields = useCallback(({
6247
6463
  registerRef,
6248
6464
  searchFormState,
@@ -6303,13 +6519,6 @@ const Inbox$1 = ({
6303
6519
  setFilterFormValue,
6304
6520
  getFilterFormValue
6305
6521
  }) => /*#__PURE__*/React.createElement(React.Fragment, null), []);
6306
- const propsForFilterForm = {
6307
- FilterFormFields,
6308
- onFilterFormSubmit: () => {},
6309
- filterFormDefaultValues: "",
6310
- resetFilterFormDefaultValues: "",
6311
- onFilterFormReset: () => {}
6312
- };
6313
6522
  function formReducer(state, payload) {
6314
6523
  const storageKey = payload.checkPathName ? "EKYC.INBOX" : "EKYC.SW.INBOX";
6315
6524
  switch (payload.action) {
@@ -6401,220 +6610,14 @@ const Inbox$1 = ({
6401
6610
  return /*#__PURE__*/React.createElement("div", {
6402
6611
  className: "app-container"
6403
6612
  }, /*#__PURE__*/React.createElement(InboxComposer, _extends({
6404
- isInboxLoading,
6405
- PropsForInboxLinks
6406
- }, propsForSearchForm, propsForFilterForm, {
6613
+ isInboxLoading
6614
+ }, propsForSearchForm, {
6407
6615
  propsForInboxTable,
6408
6616
  formState
6409
6617
  })));
6410
6618
  };
6411
6619
 
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
6620
  const CitizenApp = () => {
6617
- var _Digit$SessionStorage, _Digit$SessionStorage2;
6618
6621
  const {
6619
6622
  t
6620
6623
  } = useTranslation();
@@ -6623,24 +6626,74 @@ const CitizenApp = () => {
6623
6626
  path
6624
6627
  } = useRouteMatch();
6625
6628
  sessionStorage.removeItem("revalidateddone");
6626
- const getBreadcrumbLabel = () => {
6629
+ const getDynamicBreadcrumbs = () => {
6627
6630
  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";
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;
6635
6696
  };
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
6697
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
6645
6698
  className: "ground-container form-container"
6646
6699
  }, /*#__PURE__*/React.createElement(ModuleHeader, {
@@ -6648,7 +6701,7 @@ const CitizenApp = () => {
6648
6701
  className: "icon"
6649
6702
  }), t("CS_COMMON_BACK")),
6650
6703
  onLeftClick: () => window.history.back(),
6651
- breadcrumbs: breadcrumbs
6704
+ breadcrumbs: getDynamicBreadcrumbs()
6652
6705
  }), /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(PrivateRoute, {
6653
6706
  exact: true,
6654
6707
  path: `${path}`,
@@ -6670,11 +6723,6 @@ const CitizenApp = () => {
6670
6723
  component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
6671
6724
  layoutClass: "normal"
6672
6725
  }, /*#__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
6726
  }), /*#__PURE__*/React.createElement(PrivateRoute, {
6679
6727
  path: `${path}/property-info`,
6680
6728
  component: () => /*#__PURE__*/React.createElement(LayoutWrapper, {
@@ -6789,7 +6837,6 @@ const componentsToRegister = {
6789
6837
  EKYC_INBOX_FILTER: props => /*#__PURE__*/React.createElement(Filter, props),
6790
6838
  EkycLinks,
6791
6839
  AadhaarVerification,
6792
- AddressDetails,
6793
6840
  PropertyInfo,
6794
6841
  MeterDetails
6795
6842
  };