@djb25/digit-ui-module-ekyc 1.0.30 → 1.0.32
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 +8911 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +3295 -2039
- package/dist/index.modern.js.map +1 -1
- package/package.json +4 -1
- package/dist/index.css +0 -54
- package/src/Module.js +0 -78
- package/src/components/AadhaarVerification.js +0 -315
- package/src/components/AssignEkyc.js +0 -236
- package/src/components/AssignEkycModal.js +0 -446
- package/src/components/CeoDashboard.js +0 -264
- package/src/components/CeoDashboard.jsx +0 -334
- package/src/components/ConnectionDetailsView.js +0 -241
- package/src/components/Dashboard.js +0 -43
- package/src/components/DesktopInbox.js +0 -176
- package/src/components/EKYCCard.js +0 -53
- package/src/components/Filter.js +0 -55
- package/src/components/MeterDetails.js +0 -336
- package/src/components/MobileInbox.js +0 -73
- package/src/components/PropertyInfo.js +0 -264
- package/src/components/Review.js +0 -696
- package/src/components/SearchConsumer.js +0 -142
- package/src/components/SearchFormFieldsComponent.js +0 -67
- package/src/components/SelectEkycZones.js +0 -71
- package/src/components/StatusCards.js +0 -148
- package/src/components/SurveyorDetailsCard.js +0 -512
- package/src/components/VendorDetails.jsx +0 -230
- package/src/components/analytics/charts/ClusterHeatmap.js +0 -88
- package/src/components/analytics/charts/ExecutiveBarChart.jsx +0 -30
- package/src/components/analytics/charts/ExecutiveLineChart.jsx +0 -159
- package/src/components/analytics/charts/ExecutivePieChart.jsx +0 -24
- package/src/components/analytics/charts/TaskStatusChart.js +0 -90
- package/src/components/analytics/components/AnalyticsTable.js +0 -106
- package/src/components/analytics/components/DashboardLayout.js +0 -52
- package/src/components/analytics/components/EmptyState.js +0 -27
- package/src/components/analytics/components/ErrorBoundary.js +0 -27
- package/src/components/analytics/components/FilterBar.js +0 -73
- package/src/components/analytics/components/NotificationPanel.js +0 -77
- package/src/components/analytics/components/SLAWidget.js +0 -56
- package/src/components/analytics/components/SkeletonLoader.js +0 -53
- package/src/components/analytics/components/SummaryCard.js +0 -74
- package/src/components/analytics/components/WorkflowTimeline.js +0 -55
- package/src/components/analytics/utils/exportUtils.js +0 -64
- package/src/components/analytics/utils/filterSerializer.js +0 -50
- package/src/components/mockData.js +0 -772
- package/src/config/AadhaarVerificationConfig.js +0 -367
- package/src/config/MeterDetailsConfig.js +0 -297
- package/src/config/PropertyInfoConfig.js +0 -145
- package/src/config/config.js +0 -70
- package/src/hook/SupervisorInboxTableConfig.js +0 -80
- package/src/hook/useInboxTableConfig.js +0 -131
- package/src/pages/citizen/Home.js +0 -54
- package/src/pages/citizen/Inbox.js +0 -265
- package/src/pages/citizen/index.js +0 -199
- package/src/pages/employee/ConsumerDetails.js +0 -299
- package/src/pages/employee/Create.js +0 -94
- package/src/pages/employee/EKYCForm.js +0 -118
- package/src/pages/employee/Inbox.js +0 -266
- package/src/pages/employee/Mapping.js +0 -358
- package/src/pages/employee/Update.js +0 -9
- package/src/pages/employee/index.js +0 -184
- package/src/utils/index.js +0 -46
- package/src/utils/reportDownloader.js +0 -90
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
import React, { useState, Fragment, useEffect } from "react";
|
|
2
|
-
import { CardLabel, TextInput, Dropdown, UploadFile, Toast, FormStep, Loader } from "@djb25/digit-ui-react-components";
|
|
3
|
-
import { useLocation } from "react-router-dom";
|
|
4
|
-
|
|
5
|
-
const ConsumerDetails = ({ config, onSelect, formData }) => {
|
|
6
|
-
const location = useLocation();
|
|
7
|
-
const flowState = location.state || {};
|
|
8
|
-
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
9
|
-
|
|
10
|
-
const queryParams = new URLSearchParams(location.search);
|
|
11
|
-
const urlKno = queryParams.get("kno");
|
|
12
|
-
|
|
13
|
-
const searchKno = urlKno || flowState?.kNumber || flowState?.kno || formData?.kNumber || formData?.kno || sessionStorage.getItem("EKYC_K_NUMBER") || "";
|
|
14
|
-
|
|
15
|
-
const { isLoading, data: searchData } = Digit.Hooks.ekyc.useSearchConnection(
|
|
16
|
-
{ tenantId, details: { kno: searchKno } },
|
|
17
|
-
{ enabled: !!searchKno, cacheTime: 0 }
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
const savedData = formData?.consumerDetails || {};
|
|
21
|
-
|
|
22
|
-
// 🔹 STATES
|
|
23
|
-
const [kno, setKno] = useState(savedData.kno || "");
|
|
24
|
-
const [consumerType, setConsumerType] = useState(
|
|
25
|
-
savedData.consumerType ? { name: savedData.consumerType } : null
|
|
26
|
-
);
|
|
27
|
-
const [occupantType, setOccupantType] = useState(
|
|
28
|
-
savedData.occupantType ? { name: savedData.occupantType } : null
|
|
29
|
-
);
|
|
30
|
-
const [categoryType, setCategoryType] = useState(
|
|
31
|
-
savedData.categoryType ? { name: savedData.categoryType } : null
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const [firstName, setFirstName] = useState(savedData.firstName || "");
|
|
35
|
-
const [middleName, setMiddleName] = useState(savedData.middleName || "");
|
|
36
|
-
const [lastName, setLastName] = useState(savedData.lastName || "");
|
|
37
|
-
|
|
38
|
-
const [gender, setGender] = useState(
|
|
39
|
-
savedData.gender ? { name: savedData.gender } : null
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
const [mobile, setMobile] = useState(savedData.mobile || "");
|
|
43
|
-
const [whatsapp, setWhatsapp] = useState(savedData.whatsapp || "");
|
|
44
|
-
const [email, setEmail] = useState(savedData.email || "");
|
|
45
|
-
const [residents, setResidents] = useState(savedData.residents || "");
|
|
46
|
-
|
|
47
|
-
// Tenant
|
|
48
|
-
const [, setDocumentProof] = useState(null);
|
|
49
|
-
const [documentId, setDocumentId] = useState(savedData.documentId || null);
|
|
50
|
-
const [ownerMobile, setOwnerMobile] = useState(savedData.ownerMobile || "");
|
|
51
|
-
const [tenantVerification, setTenantVerification] = useState(savedData.tenantVerification || "");
|
|
52
|
-
|
|
53
|
-
// Govt
|
|
54
|
-
const [designation, setDesignation] = useState(savedData.designation || "");
|
|
55
|
-
const [department, setDepartment] = useState(savedData.department || "");
|
|
56
|
-
const [employeeId, setEmployeeId] = useState(savedData.employeeId || "");
|
|
57
|
-
|
|
58
|
-
// Other Entity
|
|
59
|
-
const [contactPerson, setContactPerson] = useState(savedData.contactPerson || "");
|
|
60
|
-
const [entityName, setEntityName] = useState(savedData.entityName || "");
|
|
61
|
-
|
|
62
|
-
// Identity
|
|
63
|
-
|
|
64
|
-
const [toast, setToast] = useState(null);
|
|
65
|
-
|
|
66
|
-
// 🔹 OPTIONS
|
|
67
|
-
const consumerTypeOptions = [{ name: "Individual" }, { name: "Govt" }, { name: "Company_Society_Org" }];
|
|
68
|
-
|
|
69
|
-
const occupantOptions = [{ name: "Self" }, { name: "Tenanted" }];
|
|
70
|
-
|
|
71
|
-
const genderOptions = [{ name: "Male" }, { name: "Female" }, { name: "Others" }, { name: "Not prefer to say" }];
|
|
72
|
-
|
|
73
|
-
// 🔹 PREFILL FROM SEARCH DATA
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
const rawData = searchData || formData?.connectionDetails;
|
|
76
|
-
const details = rawData?.connectionDetails || rawData || {};
|
|
77
|
-
|
|
78
|
-
if (searchKno && !kno) {
|
|
79
|
-
setKno(searchKno);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (details && Object.keys(details).length > 0 && !savedData.firstName) {
|
|
83
|
-
if (details.consumerName) {
|
|
84
|
-
const nameParts = details.consumerName.trim().split(/\s+/);
|
|
85
|
-
if (nameParts.length > 0) setFirstName(nameParts[0]);
|
|
86
|
-
if (nameParts.length > 2) {
|
|
87
|
-
setMiddleName(nameParts.slice(1, -1).join(" "));
|
|
88
|
-
setLastName(nameParts[nameParts.length - 1]);
|
|
89
|
-
} else if (nameParts.length === 2) {
|
|
90
|
-
setLastName(nameParts[1]);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (details.phoneNumber) {
|
|
94
|
-
setMobile(details.phoneNumber);
|
|
95
|
-
}
|
|
96
|
-
if (details.email) {
|
|
97
|
-
setEmail(details.email);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}, [searchData, formData?.connectionDetails, searchKno]);
|
|
101
|
-
|
|
102
|
-
// 🔹 FILE UPLOAD
|
|
103
|
-
const uploadFile = async (e, setter, idSetter) => {
|
|
104
|
-
const file = e.target.files[0];
|
|
105
|
-
if (!file) return;
|
|
106
|
-
|
|
107
|
-
try {
|
|
108
|
-
const res = await Digit.UploadServices.Filestorage("EKYC", file);
|
|
109
|
-
const id = res?.data?.files?.[0]?.fileStoreId;
|
|
110
|
-
if (id) {
|
|
111
|
-
setter(file.name);
|
|
112
|
-
idSetter(id);
|
|
113
|
-
}
|
|
114
|
-
} catch {
|
|
115
|
-
setToast({ type: "error", message: "Upload failed" });
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
// 🔹 VALIDATION
|
|
120
|
-
const isValid = () => {
|
|
121
|
-
if (!kno) return false;
|
|
122
|
-
if (!consumerType) return false;
|
|
123
|
-
if (!occupantType) return false;
|
|
124
|
-
if (!categoryType) return false;
|
|
125
|
-
if (!firstName) return false;
|
|
126
|
-
if (!mobile) return false;
|
|
127
|
-
if (!residents || Number(residents) <= 0) return false;
|
|
128
|
-
|
|
129
|
-
if (occupantType?.name === "Tenanted" && !documentId && !ownerMobile) return false;
|
|
130
|
-
|
|
131
|
-
return true;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
// 🔹 SUBMIT
|
|
135
|
-
const onStepSelect = () => {
|
|
136
|
-
if (!isValid()) {
|
|
137
|
-
setToast({ type: "error", message: "Fill required fields" });
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const data = {
|
|
142
|
-
kno,
|
|
143
|
-
consumerType: consumerType?.name,
|
|
144
|
-
occupantType: occupantType?.name,
|
|
145
|
-
categoryType: categoryType?.name,
|
|
146
|
-
firstName,
|
|
147
|
-
middleName,
|
|
148
|
-
lastName,
|
|
149
|
-
gender: gender?.name,
|
|
150
|
-
mobile,
|
|
151
|
-
whatsapp,
|
|
152
|
-
email,
|
|
153
|
-
residents,
|
|
154
|
-
documentId,
|
|
155
|
-
ownerMobile,
|
|
156
|
-
tenantVerification,
|
|
157
|
-
designation,
|
|
158
|
-
department,
|
|
159
|
-
employeeId,
|
|
160
|
-
contactPerson,
|
|
161
|
-
entityName,
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
onSelect(config.key, data);
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
if (isLoading) {
|
|
168
|
-
return <Loader />;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return (
|
|
172
|
-
<Fragment>
|
|
173
|
-
<FormStep onSelect={onStepSelect} config={config}>
|
|
174
|
-
<div>
|
|
175
|
-
<CardLabel>K Number *</CardLabel>
|
|
176
|
-
<TextInput value={kno} onChange={(e) => setKno(e.target.value)} />
|
|
177
|
-
</div>
|
|
178
|
-
|
|
179
|
-
<div>
|
|
180
|
-
<CardLabel>Consumer Type *</CardLabel>
|
|
181
|
-
<Dropdown option={consumerTypeOptions} selected={consumerType} select={setConsumerType} />
|
|
182
|
-
</div>
|
|
183
|
-
|
|
184
|
-
<div>
|
|
185
|
-
<CardLabel>Occupant Type *</CardLabel>
|
|
186
|
-
<Dropdown option={occupantOptions} selected={occupantType} select={setOccupantType} />
|
|
187
|
-
</div>
|
|
188
|
-
|
|
189
|
-
<div>
|
|
190
|
-
<CardLabel>Category Type *</CardLabel>
|
|
191
|
-
<Dropdown option={[]} selected={categoryType} select={setCategoryType} />
|
|
192
|
-
</div>
|
|
193
|
-
|
|
194
|
-
<div>
|
|
195
|
-
<CardLabel>First Name *</CardLabel>
|
|
196
|
-
<TextInput value={firstName} onChange={(e) => setFirstName(e.target.value)} />
|
|
197
|
-
</div>
|
|
198
|
-
|
|
199
|
-
<div>
|
|
200
|
-
<CardLabel>Middle Name</CardLabel>
|
|
201
|
-
<TextInput value={middleName} onChange={(e) => setMiddleName(e.target.value)} />
|
|
202
|
-
</div>
|
|
203
|
-
|
|
204
|
-
<div>
|
|
205
|
-
<CardLabel>Last Name</CardLabel>
|
|
206
|
-
<TextInput value={lastName} onChange={(e) => setLastName(e.target.value)} />
|
|
207
|
-
</div>
|
|
208
|
-
|
|
209
|
-
<div>
|
|
210
|
-
<CardLabel>Gender</CardLabel>
|
|
211
|
-
<Dropdown option={genderOptions} selected={gender} select={setGender} />
|
|
212
|
-
</div>
|
|
213
|
-
|
|
214
|
-
<div>
|
|
215
|
-
<CardLabel>Mobile *</CardLabel>
|
|
216
|
-
<TextInput value={mobile} onChange={(e) => setMobile(e.target.value)} />
|
|
217
|
-
</div>
|
|
218
|
-
|
|
219
|
-
<div>
|
|
220
|
-
<CardLabel>WhatsApp</CardLabel>
|
|
221
|
-
<TextInput value={whatsapp} onChange={(e) => setWhatsapp(e.target.value)} />
|
|
222
|
-
</div>
|
|
223
|
-
|
|
224
|
-
<div>
|
|
225
|
-
<CardLabel>Email</CardLabel>
|
|
226
|
-
<TextInput value={email} onChange={(e) => setEmail(e.target.value)} />
|
|
227
|
-
</div>
|
|
228
|
-
|
|
229
|
-
<div>
|
|
230
|
-
<CardLabel>No. of Residents *</CardLabel>
|
|
231
|
-
<TextInput value={residents} onChange={(e) => setResidents(e.target.value)} />
|
|
232
|
-
</div>
|
|
233
|
-
|
|
234
|
-
{/* TENANT LOGIC */}
|
|
235
|
-
{occupantType?.name === "Tenanted" && (
|
|
236
|
-
<Fragment>
|
|
237
|
-
<div>
|
|
238
|
-
<CardLabel>Document Proof</CardLabel>
|
|
239
|
-
<UploadFile onUpload={(e) => uploadFile(e, setDocumentProof, setDocumentId)} />
|
|
240
|
-
</div>
|
|
241
|
-
|
|
242
|
-
{!documentId && (
|
|
243
|
-
<Fragment>
|
|
244
|
-
<div>
|
|
245
|
-
<CardLabel>Owner Mobile *</CardLabel>
|
|
246
|
-
<TextInput value={ownerMobile} onChange={(e) => setOwnerMobile(e.target.value)} />
|
|
247
|
-
</div>
|
|
248
|
-
|
|
249
|
-
<div>
|
|
250
|
-
<CardLabel>Tenant Verification</CardLabel>
|
|
251
|
-
<TextInput value={tenantVerification} onChange={(e) => setTenantVerification(e.target.value)} />
|
|
252
|
-
</div>
|
|
253
|
-
</Fragment>
|
|
254
|
-
)}
|
|
255
|
-
</Fragment>
|
|
256
|
-
)}
|
|
257
|
-
|
|
258
|
-
{/* GOVT */}
|
|
259
|
-
{consumerType?.name === "Govt" && (
|
|
260
|
-
<Fragment>
|
|
261
|
-
<div>
|
|
262
|
-
<CardLabel>Designation</CardLabel>
|
|
263
|
-
<TextInput value={designation} onChange={(e) => setDesignation(e.target.value)} />
|
|
264
|
-
</div>
|
|
265
|
-
|
|
266
|
-
<div>
|
|
267
|
-
<CardLabel>Department</CardLabel>
|
|
268
|
-
<TextInput value={department} onChange={(e) => setDepartment(e.target.value)} />
|
|
269
|
-
</div>
|
|
270
|
-
|
|
271
|
-
<div>
|
|
272
|
-
<CardLabel>Employee ID</CardLabel>
|
|
273
|
-
<TextInput value={employeeId} onChange={(e) => setEmployeeId(e.target.value)} />
|
|
274
|
-
</div>
|
|
275
|
-
</Fragment>
|
|
276
|
-
)}
|
|
277
|
-
|
|
278
|
-
{/* OTHER ENTITY */}
|
|
279
|
-
{consumerType?.name === "Company_Society_Org" && (
|
|
280
|
-
<Fragment>
|
|
281
|
-
<div>
|
|
282
|
-
<CardLabel>Entity Name</CardLabel>
|
|
283
|
-
<TextInput value={entityName} onChange={(e) => setEntityName(e.target.value)} />
|
|
284
|
-
</div>
|
|
285
|
-
|
|
286
|
-
<div>
|
|
287
|
-
<CardLabel>Contact Person</CardLabel>
|
|
288
|
-
<TextInput value={contactPerson} onChange={(e) => setContactPerson(e.target.value)} />
|
|
289
|
-
</div>
|
|
290
|
-
</Fragment>
|
|
291
|
-
)}
|
|
292
|
-
|
|
293
|
-
{toast && <Toast label={toast.message} error={toast.type === "error"} onClose={() => setToast(null)} />}
|
|
294
|
-
</FormStep>
|
|
295
|
-
</Fragment>
|
|
296
|
-
);
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
export default ConsumerDetails;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from "react";
|
|
2
|
-
import { Card, HomeIcon, Toast } from "@djb25/digit-ui-react-components";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
import SearchConsumer from "../../components/SearchConsumer";
|
|
5
|
-
import ConnectionDetailsView from "../../components/ConnectionDetailsView";
|
|
6
|
-
|
|
7
|
-
const Create = () => {
|
|
8
|
-
const { t } = useTranslation();
|
|
9
|
-
const [searchParams, setSearchParams] = useState(() => {
|
|
10
|
-
const saved = sessionStorage.getItem("EKYC_CREATE_SEARCH_PARAMS");
|
|
11
|
-
return saved ? JSON.parse(saved) : { kNumber: "", kName: "" };
|
|
12
|
-
});
|
|
13
|
-
const [searchPerformed, setSearchPerformed] = useState(() => {
|
|
14
|
-
return sessionStorage.getItem("EKYC_CREATE_SEARCH_PERFORMED") === "true";
|
|
15
|
-
});
|
|
16
|
-
const [showToast, setShowToast] = useState(null);
|
|
17
|
-
const [formParams, setFormParams, clearParams] = Digit.Hooks.useSessionStorage("EKYC_CREATE", {});
|
|
18
|
-
|
|
19
|
-
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
20
|
-
|
|
21
|
-
const { isLoading: isSearching, data: connectionDetails, error, revalidate } = Digit.Hooks.ekyc.useSearchConnection({
|
|
22
|
-
tenantId,
|
|
23
|
-
details: { kno: searchParams.kNumber, name: searchParams.kName }
|
|
24
|
-
}, {
|
|
25
|
-
enabled: searchPerformed && !!searchParams.kNumber && !!searchParams.kName,
|
|
26
|
-
onError: (error) => {
|
|
27
|
-
setShowToast({ error: true, label: error?.response?.data?.Errors?.[0]?.message || t("EKYC_SEARCH_ERROR_PLEASE_ENTER_THE_CORRECT_CREDENTIALS") });
|
|
28
|
-
setSearchPerformed(false);
|
|
29
|
-
sessionStorage.removeItem("EKYC_CREATE_SEARCH_PERFORMED");
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const handleSearch = (params) => {
|
|
34
|
-
if (!params.kNumber && !params.kName) {
|
|
35
|
-
// This is the "Clear" case
|
|
36
|
-
setSearchParams({ kNumber: "", kName: "" });
|
|
37
|
-
setSearchPerformed(false);
|
|
38
|
-
sessionStorage.removeItem("EKYC_CREATE_SEARCH_PARAMS");
|
|
39
|
-
sessionStorage.removeItem("EKYC_CREATE_SEARCH_PERFORMED");
|
|
40
|
-
clearParams(); // Clear consolidated EKYC data
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (!params.kNumber || !params.kName) {
|
|
45
|
-
setShowToast({ error: true, label: t("EKYC_FILL_ALL_FIELDS") });
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
setSearchParams(params);
|
|
49
|
-
setSearchPerformed(true);
|
|
50
|
-
|
|
51
|
-
// Clear previous EKYC session data if K-number changes
|
|
52
|
-
const currentKno = sessionStorage.getItem("EKYC_K_NUMBER");
|
|
53
|
-
if (currentKno !== params.kNumber) {
|
|
54
|
-
clearParams();
|
|
55
|
-
// Clear any other EKYC keys if they exist
|
|
56
|
-
Object.keys(sessionStorage).forEach(key => {
|
|
57
|
-
if (key.startsWith("EKYC_") && key !== "EKYC_CREATE") sessionStorage.removeItem(key);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
sessionStorage.setItem("EKYC_CREATE_SEARCH_PARAMS", JSON.stringify(params));
|
|
62
|
-
sessionStorage.setItem("EKYC_CREATE_SEARCH_PERFORMED", "true");
|
|
63
|
-
sessionStorage.setItem("EKYC_K_NUMBER", params.kNumber);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const closeToast = () => {
|
|
67
|
-
setShowToast(null);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<SearchConsumer
|
|
72
|
-
onSearch={handleSearch}
|
|
73
|
-
searchParams={searchParams}
|
|
74
|
-
>
|
|
75
|
-
{searchPerformed && (
|
|
76
|
-
<ConnectionDetailsView
|
|
77
|
-
kNumber={searchParams.kNumber}
|
|
78
|
-
kName={searchParams.kName}
|
|
79
|
-
connectionDetails={connectionDetails}
|
|
80
|
-
isLoading={isSearching}
|
|
81
|
-
/>
|
|
82
|
-
)}
|
|
83
|
-
|
|
84
|
-
{!searchPerformed && !isSearching && (
|
|
85
|
-
<Card style={{ textAlign: "center", padding: "40px" }}>
|
|
86
|
-
<div style={{ color: "#667085" }}>{t("EKYC_SEARCH_TO_VIEW_DETAILS")}</div>
|
|
87
|
-
</Card>
|
|
88
|
-
)}
|
|
89
|
-
{showToast && <Toast error={showToast.error} label={showToast.label} onClose={closeToast} isDsc={true} />}
|
|
90
|
-
</SearchConsumer>
|
|
91
|
-
);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export default Create;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from "react";
|
|
2
|
-
import { useTranslation } from "react-i18next";
|
|
3
|
-
// import { useQueryClient } from "react-query";
|
|
4
|
-
import { Redirect, Route, Switch, useHistory, useLocation, useRouteMatch } from "react-router-dom";
|
|
5
|
-
import { VerticalTimeline } from "@djb25/digit-ui-react-components";
|
|
6
|
-
import { ekycConfig } from "../../config/config";
|
|
7
|
-
|
|
8
|
-
const EKYCForm = ({ path: passedPath }) => {
|
|
9
|
-
// const queryClient = useQueryClient();
|
|
10
|
-
const match = useRouteMatch();
|
|
11
|
-
const { t } = useTranslation();
|
|
12
|
-
const location = useLocation();
|
|
13
|
-
const { pathname } = location;
|
|
14
|
-
const history = useHistory();
|
|
15
|
-
|
|
16
|
-
let config = [];
|
|
17
|
-
const [params, setParams] = Digit.Hooks.useSessionStorage("EKYC_CREATE", {});
|
|
18
|
-
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
if (location.state && Object.keys(location.state).length > 0) {
|
|
21
|
-
const { edits, ...rest } = location.state;
|
|
22
|
-
setParams({ ...params, ...rest, ...edits });
|
|
23
|
-
}
|
|
24
|
-
}, [location.state]);
|
|
25
|
-
|
|
26
|
-
const goNext = (skipStep, index, isAddMultiple, key) => {
|
|
27
|
-
let currentPath = pathname.split("/").pop();
|
|
28
|
-
let routeObj = config.find((routeObj) => (key ? routeObj.key === key : routeObj.route === currentPath));
|
|
29
|
-
if (!routeObj) routeObj = config.find((routeObj) => routeObj.route === currentPath);
|
|
30
|
-
|
|
31
|
-
let nextStep = null;
|
|
32
|
-
const currentIndex = config.findIndex((c) => c.route === routeObj.route);
|
|
33
|
-
if (currentIndex > -1 && currentIndex < config.length - 1) {
|
|
34
|
-
nextStep = config[currentIndex + 1].route;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
let redirectWithHistory = history.push;
|
|
38
|
-
if (skipStep) {
|
|
39
|
-
redirectWithHistory = history.replace;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const base = passedPath || match.path.split("/").slice(0, -1).join("/");
|
|
43
|
-
if (nextStep === null) {
|
|
44
|
-
return redirectWithHistory(`${base}/review`, { ...params, edits: params });
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
redirectWithHistory(`${base}/${nextStep}`, { ...params });
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
function handleSelect(key, data, skipStep, index, isAddMultiple = false, silent = false) {
|
|
51
|
-
setParams((prev) => ({ ...prev, [key]: { ...params[key], ...data } }));
|
|
52
|
-
if (!silent) {
|
|
53
|
-
goNext(skipStep, index, isAddMultiple, key);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// const onSuccess = () => {
|
|
58
|
-
// clearParams();
|
|
59
|
-
// queryClient.invalidateQueries("EKYC_CREATE");
|
|
60
|
-
// };
|
|
61
|
-
|
|
62
|
-
ekycConfig.forEach((obj) => {
|
|
63
|
-
config = config.concat(obj.body);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
config.indexRoute = "consumer-details";
|
|
67
|
-
|
|
68
|
-
const formStepRoutes = config.map((c) => c.route);
|
|
69
|
-
const isFormStep = formStepRoutes.some((route) => pathname.includes(route));
|
|
70
|
-
|
|
71
|
-
const sectionRefs = useRef({});
|
|
72
|
-
|
|
73
|
-
useEffect(() => {
|
|
74
|
-
if (isFormStep) {
|
|
75
|
-
const currentRoute = pathname.split("/").pop();
|
|
76
|
-
if (sectionRefs.current[currentRoute]) {
|
|
77
|
-
sectionRefs.current[currentRoute].scrollIntoView({ behavior: "smooth", block: "start" });
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}, [pathname, isFormStep]);
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<React.Fragment>
|
|
84
|
-
<div className="employee-form-section-wrapper">
|
|
85
|
-
<VerticalTimeline config={config} showFinalStep={true} />
|
|
86
|
-
<div className="employee-form-section">
|
|
87
|
-
<Switch>
|
|
88
|
-
<Route path={formStepRoutes.map((route) => `${passedPath || match.path.split("/").slice(0, -1).join("/")}/${route}`)}>
|
|
89
|
-
<div className="single-page-form-container">
|
|
90
|
-
{config.map((routeObj, index) => {
|
|
91
|
-
const { component } = routeObj;
|
|
92
|
-
const Component = typeof component === "string" ? Digit.ComponentRegistryService.getComponent(component) : component;
|
|
93
|
-
|
|
94
|
-
return (
|
|
95
|
-
<div key={index} ref={(el) => (sectionRefs.current[routeObj.route] = el)} className="form-section-unit">
|
|
96
|
-
<Component
|
|
97
|
-
config={{ ...routeObj, isCollapsible: true, defaultOpen: true }}
|
|
98
|
-
onSelect={handleSelect}
|
|
99
|
-
t={t}
|
|
100
|
-
formData={params}
|
|
101
|
-
// formData={{ ...params, address: params.addressDetails }}
|
|
102
|
-
/>
|
|
103
|
-
</div>
|
|
104
|
-
);
|
|
105
|
-
})}
|
|
106
|
-
</div>
|
|
107
|
-
</Route>
|
|
108
|
-
<Route>
|
|
109
|
-
<Redirect to={`${passedPath || match.path.split("/").slice(0, -1).join("/")}/${config.indexRoute}`} />
|
|
110
|
-
</Route>
|
|
111
|
-
</Switch>
|
|
112
|
-
</div>
|
|
113
|
-
</div>
|
|
114
|
-
</React.Fragment>
|
|
115
|
-
);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export default EKYCForm;
|