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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- import React, { useMemo, useCallback, useReducer, useState } from "react";
2
- import { useLocation } from "react-router-dom";
1
+ import React, { useMemo, useCallback, useReducer } from "react";
3
2
  import { InboxComposer } from "@djb25/digit-ui-react-components";
4
3
  import SupervisorInboxTableConfig from "../hook/SupervisorInboxTableConfig";
5
4
  import SearchFormFieldsComponents from "./SearchFormFieldsComponent";
5
+ import { formInitValue, formReducer } from "../../../vendor/src/config/tableConfig";
6
6
 
7
7
  // Mock data removed in favor of API integration
8
8
 
@@ -11,20 +11,8 @@ const AssignEkyc = () => {
11
11
  if (!tenantId || tenantId === "dl") {
12
12
  tenantId = "dl.djb"; // Force tenantId to dl.djb for EKYC APIs in citizen portal
13
13
  }
14
- const location = useLocation();
15
- const formInitValue = {
16
- filterForm: {},
17
- searchForm: {},
18
- tableForm: {
19
- limit: 10,
20
- offset: 0,
21
- sortBy: "createdTime",
22
- sortOrder: "DESC",
23
- },
24
- };
25
14
 
26
15
  const [formState, dispatch] = useReducer(formReducer, formInitValue);
27
- const userDetails = Digit.SessionStorage.get("User");
28
16
 
29
17
  let paginationParms = {
30
18
  limit: formState?.tableForm?.limit || 10,
@@ -45,11 +33,7 @@ const AssignEkyc = () => {
45
33
  filters.mobileNumber = mobileNumber;
46
34
  }
47
35
 
48
- const { data: dashboardData, isLoading } = Digit.Hooks.fsm.useSurveyorSearch(
49
- tenantId,
50
- filters,
51
- { enabled: !!tenantId, keepPreviousData: true }
52
- );
36
+ const { data: dashboardData, isLoading } = Digit.Hooks.fsm.useSurveyorSearch(tenantId, filters, { enabled: !!tenantId, keepPreviousData: true });
53
37
 
54
38
  const { isLoading: isDataSearchLoading, data } = Digit.Hooks.ekyc.useEkycAssignmentProgress({
55
39
  enabled: !!tenantId,
@@ -63,38 +47,23 @@ const AssignEkyc = () => {
63
47
  const filteredData = useMemo(() => {
64
48
  return (sourceData || []).map((item) => {
65
49
  const owner = item?.owner || {};
66
-
67
50
  const roleCodes = owner?.roles?.map((role) => role.code)?.join(", ") || "";
68
51
 
69
52
  return {
70
53
  ...item,
71
-
72
54
  id: item?.id || "",
73
-
74
55
  surveyorName: item?.name || owner?.name || "",
75
-
76
56
  mobileNo: item?.mobileNo || owner?.mobileNumber || "",
77
-
78
57
  email: owner?.emailId || "",
79
-
80
58
  vendorId: item?.vendorId || "",
81
-
82
59
  tenantId: item?.tenantId || "",
83
-
84
60
  supervisorId: item?.supervisorId || "",
85
-
86
61
  status: item?.status || "",
87
-
88
62
  roleCodes,
89
-
90
63
  userName: owner?.userName || "",
91
-
92
64
  gender: owner?.gender || "",
93
-
94
65
  serviceType: item?.additionalDetails?.serviceType || "",
95
-
96
66
  createdTime: item?.auditDetails?.createdTime || 0,
97
-
98
67
  lastModifiedTime: item?.auditDetails?.lastModifiedTime || 0,
99
68
  };
100
69
  });
@@ -102,9 +71,8 @@ const AssignEkyc = () => {
102
71
 
103
72
  const totalRecords = dashboardData?.dashboardInfo?.totalRecords || dashboardData?.totalCount || 0;
104
73
 
105
- const checkPathName = location.pathname.includes("ekyc/inbox");
106
74
  const PropsForInboxLinks = {
107
- headerText: checkPathName ? "EKYC_MODULE" : "MODULE_SW",
75
+ headerText: "EKYC_MODULE",
108
76
  };
109
77
 
110
78
  const SearchFormFields = useCallback(
@@ -123,8 +91,8 @@ const AssignEkyc = () => {
123
91
 
124
92
  const onSearchFormSubmit = (data) => {
125
93
  data.hasOwnProperty("") && delete data?.[""];
126
- dispatch({ action: "mutateTableForm", data: { ...tableOrderFormDefaultValues }, checkPathName });
127
- dispatch({ action: "mutateSearchForm", data, checkPathName });
94
+ dispatch({ action: "mutateTableForm", data: { ...tableOrderFormDefaultValues } });
95
+ dispatch({ action: "mutateSearchForm", data });
128
96
  };
129
97
 
130
98
  const searchFormDefaultValues = {
@@ -156,34 +124,12 @@ const AssignEkyc = () => {
156
124
 
157
125
  const propsForFilterForm = {
158
126
  FilterFormFields,
159
- onFilterFormSubmit: () => {},
127
+ onFilterFormSubmit: () => { },
160
128
  filterFormDefaultValues: "",
161
129
  resetFilterFormDefaultValues: "",
162
- onFilterFormReset: () => {},
130
+ onFilterFormReset: () => { },
163
131
  };
164
132
 
165
- function formReducer(state, payload) {
166
- const storageKey = payload.checkPathName ? "EKYC.INBOX" : "EKYC.SW.INBOX";
167
-
168
- // ✅ safety for SLA
169
- switch (payload.action) {
170
- case "mutateSearchForm":
171
- Digit.SessionStorage.set(storageKey, { ...state, searchForm: payload.data });
172
- return { ...state, searchForm: payload.data };
173
-
174
- case "mutateFilterForm":
175
- Digit.SessionStorage.set(storageKey, { ...state, filterForm: payload.data });
176
- return { ...state, filterForm: payload.data };
177
-
178
- case "mutateTableForm":
179
- Digit.SessionStorage.set(storageKey, { ...state, tableForm: payload.data });
180
- return { ...state, tableForm: payload.data };
181
-
182
- default:
183
- return state; // ✅ IMPORTANT
184
- }
185
- }
186
-
187
133
  const onPageSizeChange = (e) => {
188
134
  const newLimit = Number(e.target.value);
189
135
 
@@ -194,7 +140,6 @@ const AssignEkyc = () => {
194
140
  limit: newLimit,
195
141
  offset: 0, // reset page
196
142
  },
197
- checkPathName,
198
143
  });
199
144
  };
200
145
 
@@ -212,7 +157,6 @@ const AssignEkyc = () => {
212
157
  sortBy: id,
213
158
  sortOrder: desc ? "DESC" : "ASC",
214
159
  },
215
- checkPathName,
216
160
  });
217
161
  }
218
162
  }
@@ -227,7 +171,6 @@ const AssignEkyc = () => {
227
171
  dispatch,
228
172
  onSortingByData,
229
173
  tenantId,
230
- checkPathName,
231
174
  inboxStyles: { overflowX: "scroll", overflowY: "hidden" },
232
175
  tableStyle: { width: "70%" },
233
176
  },
@@ -274,9 +217,9 @@ const AssignEkyc = () => {
274
217
  <InboxComposer
275
218
  {...{
276
219
  isInboxLoading,
277
- PropsForInboxLinks,
220
+ // PropsForInboxLinks,
278
221
  ...propsForSearchForm,
279
- ...propsForFilterForm,
222
+ // ...propsForFilterForm,
280
223
  // ...propsForMobileSortForm,
281
224
  propsForInboxTable,
282
225
  // propsForInboxMobileCards,
@@ -1,7 +1,7 @@
1
1
  import React, { useMemo, useState, useEffect } from "react";
2
2
  import { Modal, Close, Table, Toast } from "@djb25/digit-ui-react-components";
3
3
 
4
- const AssignEkycModal = ({ surveyor, closeModal }) => {
4
+ const AssignEkycModal = ({ surveyor, closeModal, refetchDashboard }) => {
5
5
  const [selectedKnos, setSelectedKnos] = useState([]);
6
6
  const [isBulkSelection, setIsBulkSelection] = useState(false);
7
7
  const [currentPage, setCurrentPage] = useState(0);
@@ -95,7 +95,8 @@ const AssignEkycModal = ({ surveyor, closeModal }) => {
95
95
  setShowToast(true);
96
96
 
97
97
  // optional delay so user can see the success toast
98
- setTimeout(() => {
98
+ setTimeout(async () => {
99
+ await refetchDashboard();
99
100
  closeModal();
100
101
  }, 1000);
101
102
  },
@@ -255,7 +256,23 @@ const AssignEkycModal = ({ surveyor, closeModal }) => {
255
256
  onChange={(e) => handleFilterChange("zoneName", e.target.value)}
256
257
  />
257
258
 
258
- <input className="form-control" placeholder="Ward" value={filters.ward} onChange={(e) => handleFilterChange("ward", e.target.value)} />
259
+ {/* <SelectEkycZones
260
+ t={t}
261
+ isMultiSelect={false}
262
+ config={{
263
+ key: "zoneCode",
264
+ }}
265
+ formData={{
266
+ zoneIds: filters.zoneCode ? [{ code: filters.zoneCode, name: filters.zoneName }] : [],
267
+ }}
268
+ onSelect={(key, value) => {
269
+ console.log(value);
270
+ handleFilterChange("zoneName", value);
271
+ }}
272
+ placeHolder="Zones"
273
+ /> */}
274
+
275
+ {/* <input className="form-control" placeholder="Ward" value={filters.ward} onChange={(e) => handleFilterChange("ward", e.target.value)} />
259
276
 
260
277
  <input
261
278
  className="form-control"
@@ -271,7 +288,7 @@ const AssignEkycModal = ({ surveyor, closeModal }) => {
271
288
  <option value="PENDING">Pending</option>
272
289
  <option value="APPROVED">Approved</option>
273
290
  <option value="REJECTED">Rejected</option>
274
- </select>
291
+ </select> */}
275
292
  </div>
276
293
 
277
294
  {/* Table */}
@@ -80,7 +80,7 @@ const DesktopInbox = ({ tableConfig, filterComponent, ...props }) => {
80
80
  Header: t("EKYC_EKYC_STATUS"),
81
81
  accessor: "ekycStatus",
82
82
  Cell: ({ row }) => {
83
- const ekycStatus = row.original?.ekycstatus || "NA";
83
+ const ekycStatus = row.original?.ekycStatus || row.original?.ekycstatus || "NA";
84
84
  return <span className={`ekyc-status-tag ${ekycStatus}`}>{t(`${ekycStatus}`)}</span>
85
85
  }
86
86
  },
@@ -17,9 +17,13 @@ const EKYCCard = () => {
17
17
  ],
18
18
  links: [
19
19
  {
20
- label: t("EKYC_DASHBOARD"),
21
- link: `/digit-ui/employee/ekyc/dashboard`,
20
+ label: t("CEO_M.F_DOR_FINANCE_VIEW"),
21
+ link: `/digit-ui/employee/ekyc/ceo-dashboard`,
22
22
  },
23
+ // {
24
+ // label: t("EKYC_DASHBOARD"),
25
+ // link: `/digit-ui/employee/ekyc/dashboard`,
26
+ // },
23
27
  {
24
28
  label: t("EKYC_INBOX"),
25
29
  link: `/digit-ui/employee/ekyc/inbox`,
@@ -32,16 +36,10 @@ const EKYCCard = () => {
32
36
  // label: t("EKYC_UPDATE_KYC"),
33
37
  // link: `/digit-ui/employee/ekyc/update-kyc`
34
38
  // },
35
- {
36
- label: t("CEO_M.F_DOR_FINANCE_VIEW"),
37
- link: `/digit-ui/employee/ekyc/ceo-dashboard`,
38
- },
39
-
40
39
  // {
41
40
  // label: t("EKYC_MAPPING"),
42
41
  // link: `/digit-ui/employee/ekyc/mapping`,
43
42
  // },
44
-
45
43
  {
46
44
  label: t("EKYC_ASSIGN"),
47
45
  link: `/digit-ui/employee/ekyc/assign`,