@djb25/digit-ui-module-ekyc 1.0.8 → 1.0.10
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.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +3594 -4315
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
- package/src/Module.js +37 -31
- package/src/components/ConnectionDetailsView.js +5 -3
- package/src/components/Dashboard.js +43 -0
- package/src/components/DesktopInbox.js +68 -184
- package/src/components/EKYCCard.js +35 -27
- package/src/components/Filter.js +48 -53
- package/src/components/SearchFormFieldsComponent.js +55 -0
- package/src/components/StatusCards.js +7 -3
- package/src/config/config.js +69 -0
- package/src/hook/useInboxTableConfig.js +134 -0
- package/src/pages/citizen/Home.js +41 -0
- package/src/pages/citizen/Inbox.js +255 -0
- package/src/pages/citizen/index.js +44 -65
- package/src/pages/employee/AadhaarVerification.js +473 -609
- package/src/pages/employee/AddressDetails.js +508 -733
- package/src/pages/employee/ConsumerDetails.js +512 -0
- package/src/pages/employee/Create.js +5 -1
- package/src/pages/employee/EKYCForm.js +117 -0
- package/src/pages/employee/Inbox.js +248 -140
- package/src/pages/employee/Mapping.js +640 -6
- package/src/pages/employee/MeterDetails.js +481 -471
- package/src/pages/employee/PropertyInfo.js +472 -562
- package/src/pages/employee/Review.js +268 -540
- package/src/pages/employee/Update.js +9 -0
- package/src/pages/employee/index.js +59 -94
|
@@ -1,147 +1,255 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import React, { useMemo, useCallback, useReducer } from "react";
|
|
2
|
+
import { useLocation } from "react-router-dom";
|
|
3
|
+
import { InboxComposer } from "@djb25/digit-ui-react-components";
|
|
4
|
+
import useInboxTableConfig from "../../hook/useInboxTableConfig";
|
|
5
|
+
import SearchFormFieldsComponents from "../../components/SearchFormFieldsComponent";
|
|
6
6
|
|
|
7
7
|
// Mock data removed in favor of API integration
|
|
8
8
|
|
|
9
|
-
const Inbox = ({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
9
|
+
const Inbox = ({ parentRoute, businessService = "EKYC", initialStates = {}, filterComponent, isInbox }) => {
|
|
10
|
+
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
11
|
+
const location = useLocation();
|
|
12
|
+
|
|
13
|
+
const formInitValue = {
|
|
14
|
+
filterForm: {},
|
|
15
|
+
searchForm: {},
|
|
16
|
+
tableForm: {
|
|
17
|
+
limit: 10,
|
|
18
|
+
offset: 0,
|
|
19
|
+
sortBy: "createdTime",
|
|
20
|
+
sortOrder: "DESC",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const [formState, dispatch] = useReducer(formReducer, formInitValue);
|
|
25
|
+
|
|
26
|
+
const queryParams = useMemo(() => {
|
|
27
|
+
return {
|
|
28
|
+
tenantId,
|
|
29
|
+
offset: formState?.tableForm?.offset || 0,
|
|
30
|
+
limit: formState?.tableForm?.limit || 10,
|
|
31
|
+
search: formState?.searchForm || {},
|
|
32
|
+
};
|
|
33
|
+
}, [tenantId, formState?.tableForm?.offset, formState?.tableForm?.limit, formState?.searchForm]);
|
|
34
|
+
|
|
35
|
+
const { isLoading, data: dashboardData = {} } = Digit.Hooks.ekyc.useEkycSurveyorDashboard({}, queryParams, {
|
|
36
|
+
enabled: !!tenantId,
|
|
37
|
+
keepPreviousData: true,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const searchDetails = useMemo(
|
|
41
|
+
() => ({
|
|
42
|
+
kno: formState?.searchForm?.kNumber || "",
|
|
43
|
+
name: formState?.searchForm?.kName || "",
|
|
44
|
+
}),
|
|
45
|
+
[formState?.searchForm?.kNumber, formState?.searchForm?.kName]
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const isSearchActive = !!(searchDetails.kno || searchDetails.name);
|
|
49
|
+
|
|
50
|
+
const { isLoading: isSearchLoading, data: searchData } = Digit.Hooks.ekyc.useSearchConnection(
|
|
51
|
+
{
|
|
52
|
+
tenantId,
|
|
53
|
+
details: searchDetails,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
enabled: !!tenantId && !!searchDetails.kno, // 🔥 important
|
|
57
|
+
keepPreviousData: true,
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const sourceData = useMemo(() => {
|
|
62
|
+
if (isSearchActive) {
|
|
63
|
+
if (!searchData) return [];
|
|
64
|
+
return [searchData];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return dashboardData?.dashboardInfo?.consumerList || [];
|
|
68
|
+
}, [isSearchActive, searchData, dashboardData]);
|
|
69
|
+
|
|
70
|
+
const filteredData = useMemo(() => {
|
|
71
|
+
return (sourceData || []).map((item) => {
|
|
72
|
+
// ✅ detect search response
|
|
73
|
+
const isSearchItem = !!item.connectionDetails;
|
|
74
|
+
|
|
75
|
+
if (isSearchItem) {
|
|
61
76
|
return {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
applicationNo: item.propertyInfo?.kno || "",
|
|
78
|
+
connectionNo: item.propertyInfo?.kno || "",
|
|
79
|
+
owner: item.connectionDetails?.consumerName || "",
|
|
80
|
+
applicationNumber: item.propertyInfo?.kno || "",
|
|
81
|
+
citizenName: item.connectionDetails?.consumerName || "",
|
|
82
|
+
status: item.connectionDetails?.statusflag || "",
|
|
83
|
+
sla: 0,
|
|
67
84
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ✅ dashboard mapping
|
|
88
|
+
return {
|
|
89
|
+
...item,
|
|
90
|
+
applicationNo: item.kno || item.applicationNumber || "",
|
|
91
|
+
connectionNo: item.connectionNo || "",
|
|
92
|
+
owner: item.consumerName || item.citizenName || "",
|
|
93
|
+
applicationNumber: item.kno || item.applicationNumber || "",
|
|
94
|
+
citizenName: item.consumerName || item.citizenName || "",
|
|
95
|
+
status: item.status || "",
|
|
96
|
+
sla: item.sla ?? 0,
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
}, [sourceData]);
|
|
100
|
+
|
|
101
|
+
const totalRecords = dashboardData?.dashboardInfo?.totalRecords || dashboardData?.totalCount || 0;
|
|
102
|
+
|
|
103
|
+
const checkPathName = location.pathname.includes("ekyc/inbox");
|
|
104
|
+
const PropsForInboxLinks = {
|
|
105
|
+
headerText: checkPathName ? "MODULE_WATER" : "MODULE_SW",
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const SearchFormFields = useCallback(
|
|
109
|
+
({ registerRef, searchFormState, controlSearchForm }) => (
|
|
110
|
+
<SearchFormFieldsComponents {...{ registerRef, searchFormState, controlSearchForm }} className="search" />
|
|
111
|
+
),
|
|
112
|
+
[]
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
const tableOrderFormDefaultValues = {
|
|
116
|
+
sortBy: "createdTime",
|
|
117
|
+
limit: window.Digit.Utils.browser.isMobile() ? 50 : 10,
|
|
118
|
+
offset: 0,
|
|
119
|
+
sortOrder: "DESC",
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const onSearchFormSubmit = (data) => {
|
|
123
|
+
data.hasOwnProperty("") && delete data?.[""];
|
|
124
|
+
dispatch({ action: "mutateTableForm", data: { ...tableOrderFormDefaultValues }, checkPathName });
|
|
125
|
+
dispatch({ action: "mutateSearchForm", data, checkPathName });
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const searchFormDefaultValues = {
|
|
129
|
+
mobileNumber: "",
|
|
130
|
+
applicationNumber: "",
|
|
131
|
+
consumerNo: "",
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const onSearchFormReset = (setSearchFormValue) => {
|
|
135
|
+
setSearchFormValue("mobileNumber", null);
|
|
136
|
+
setSearchFormValue("applicationNumber", null);
|
|
137
|
+
setSearchFormValue("consumerNo", null);
|
|
138
|
+
dispatch({ action: "mutateSearchForm", data: searchFormDefaultValues });
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const propsForSearchForm = {
|
|
142
|
+
SearchFormFields,
|
|
143
|
+
onSearchFormSubmit,
|
|
144
|
+
searchFormDefaultValues: formState?.searchForm,
|
|
145
|
+
resetSearchFormDefaultValues: searchFormDefaultValues,
|
|
146
|
+
onSearchFormReset,
|
|
147
|
+
className: "search-form-wns-inbox",
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const FilterFormFields = useCallback(
|
|
151
|
+
({ registerRef, controlFilterForm, setFilterFormValue, getFilterFormValue }) => <React.Fragment></React.Fragment>,
|
|
152
|
+
[]
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
const propsForFilterForm = {
|
|
156
|
+
FilterFormFields,
|
|
157
|
+
onFilterFormSubmit: () => {},
|
|
158
|
+
filterFormDefaultValues: "",
|
|
159
|
+
resetFilterFormDefaultValues: "",
|
|
160
|
+
onFilterFormReset: () => {},
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
function formReducer(state, payload) {
|
|
164
|
+
const storageKey = payload.checkPathName ? "EKYC.INBOX" : "EKYC.SW.INBOX";
|
|
165
|
+
|
|
166
|
+
// ✅ safety for SLA
|
|
167
|
+
switch (payload.action) {
|
|
168
|
+
case "mutateSearchForm":
|
|
169
|
+
Digit.SessionStorage.set(storageKey, { ...state, searchForm: payload.data });
|
|
170
|
+
return { ...state, searchForm: payload.data };
|
|
171
|
+
|
|
172
|
+
case "mutateFilterForm":
|
|
173
|
+
Digit.SessionStorage.set(storageKey, { ...state, filterForm: payload.data });
|
|
174
|
+
return { ...state, filterForm: payload.data };
|
|
175
|
+
|
|
176
|
+
case "mutateTableForm":
|
|
177
|
+
Digit.SessionStorage.set(storageKey, { ...state, tableForm: payload.data });
|
|
178
|
+
return { ...state, tableForm: payload.data };
|
|
179
|
+
|
|
180
|
+
default:
|
|
181
|
+
return state; // ✅ IMPORTANT
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const onPageSizeChange = (e) => {
|
|
186
|
+
const newLimit = Number(e.target.value);
|
|
187
|
+
|
|
188
|
+
dispatch({
|
|
189
|
+
action: "mutateTableForm",
|
|
190
|
+
data: {
|
|
191
|
+
...formState.tableForm,
|
|
192
|
+
limit: newLimit,
|
|
193
|
+
offset: 0, // reset page
|
|
194
|
+
},
|
|
195
|
+
checkPathName,
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const onSortingByData = (e) => {
|
|
200
|
+
if (e.length > 0) {
|
|
201
|
+
const [{ id, desc }] = e;
|
|
202
|
+
const sortOrder = desc ? "DESC" : "ASC";
|
|
203
|
+
const sortBy = id;
|
|
204
|
+
|
|
205
|
+
if (!(formState.tableForm.sortBy === sortBy && formState.tableForm.sortOrder === sortOrder)) {
|
|
206
|
+
dispatch({
|
|
207
|
+
action: "mutateTableForm",
|
|
208
|
+
data: {
|
|
209
|
+
...formState.tableForm,
|
|
210
|
+
sortBy: id,
|
|
211
|
+
sortOrder: desc ? "DESC" : "ASC",
|
|
212
|
+
},
|
|
213
|
+
checkPathName,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const propsForInboxTable = useInboxTableConfig({
|
|
220
|
+
...{
|
|
221
|
+
parentRoute,
|
|
222
|
+
onPageSizeChange,
|
|
223
|
+
formState,
|
|
224
|
+
totalCount: totalRecords,
|
|
225
|
+
table: filteredData,
|
|
226
|
+
dispatch,
|
|
227
|
+
onSortingByData,
|
|
228
|
+
tenantId,
|
|
229
|
+
checkPathName,
|
|
230
|
+
inboxStyles: { overflowX: "scroll", overflowY: "hidden" },
|
|
231
|
+
tableStyle: { width: "70%" },
|
|
232
|
+
},
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
const isInboxLoading = isLoading || isSearchLoading;
|
|
236
|
+
|
|
237
|
+
return (
|
|
238
|
+
<div className="app-container">
|
|
239
|
+
<InboxComposer
|
|
240
|
+
{...{
|
|
241
|
+
isInboxLoading,
|
|
242
|
+
PropsForInboxLinks,
|
|
243
|
+
...propsForSearchForm,
|
|
244
|
+
...propsForFilterForm,
|
|
245
|
+
// ...propsForMobileSortForm,
|
|
246
|
+
propsForInboxTable,
|
|
247
|
+
// propsForInboxMobileCards,
|
|
248
|
+
formState,
|
|
249
|
+
}}
|
|
250
|
+
/>
|
|
251
|
+
</div>
|
|
252
|
+
);
|
|
145
253
|
};
|
|
146
254
|
|
|
147
|
-
export default Inbox;
|
|
255
|
+
export default Inbox;
|