@djb25/digit-ui-module-ekyc 1.0.23 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +596 -558
- package/dist/index.modern.js.map +1 -1
- package/package.json +3 -1
- package/src/Module.js +0 -2
- package/src/components/AadhaarVerification.js +17 -54
- package/src/components/AssignEkyc.js +30 -100
- package/src/components/AssignEkycModal.js +21 -4
- package/src/components/EKYCCard.js +6 -8
- package/src/components/SearchFormFieldsComponent.js +4 -4
- package/src/components/SelectEkycZones.js +71 -0
- package/src/components/SurveyorDetailsCard.js +232 -30
- package/src/hook/SupervisorInboxTableConfig.js +2 -53
- package/src/hook/useInboxTableConfig.js +4 -4
- package/src/pages/citizen/Inbox.js +5 -5
- package/src/pages/citizen/index.js +44 -17
- package/src/pages/employee/EKYCForm.js +21 -20
- package/src/pages/employee/Inbox.js +11 -7
- package/src/pages/employee/index.js +42 -13
- package/src/utils/reportDownloader.js +75 -0
- package/src/components/AddressDetails.js +0 -207
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo, useState } from "react";
|
|
1
|
+
import React, { useMemo, useState, useRef, useEffect } from "react";
|
|
2
2
|
import { ResponsiveContainer, BarChart, Bar, XAxis, YAxis, Tooltip, CartesianGrid, PieChart, Pie, Cell, Legend } from "recharts";
|
|
3
3
|
|
|
4
4
|
import { Card, SubmitBar, ActionBar, Menu, Loader, Table } from "@djb25/digit-ui-react-components";
|
|
@@ -7,6 +7,7 @@ import { useTranslation } from "react-i18next";
|
|
|
7
7
|
import { useParams } from "react-router-dom";
|
|
8
8
|
|
|
9
9
|
import AssignEkycModal from "./AssignEkycModal";
|
|
10
|
+
import { downloadSurveyorPDF } from "../utils/reportDownloader";
|
|
10
11
|
|
|
11
12
|
const SurveyorDetailsDashboard = () => {
|
|
12
13
|
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
@@ -29,6 +30,25 @@ const SurveyorDetailsDashboard = () => {
|
|
|
29
30
|
return surveyorSearchResponse?.surveyors?.[0] || null;
|
|
30
31
|
}, [surveyorSearchResponse]);
|
|
31
32
|
|
|
33
|
+
const { data: vendorData } = Digit.Hooks.fsm.useDsoSearch(tenantId, { status: "ACTIVE" }, { enabled: !!tenantId });
|
|
34
|
+
const { data: supervisorSearchResponse } = Digit.Hooks.fsm.useSupervisorSearch(tenantId, { status: "ACTIVE" }, { enabled: !!tenantId });
|
|
35
|
+
|
|
36
|
+
const vendorName = useMemo(() => {
|
|
37
|
+
if (!vendorData || !surveyor?.vendorId) return "N/A";
|
|
38
|
+
const mappedVendor = vendorData.find((v) => v.dsoDetails?.id === surveyor.vendorId || v.dsoDetails?.vendorId === surveyor.vendorId);
|
|
39
|
+
return mappedVendor?.dsoDetails?.name || surveyor.vendorId || "N/A";
|
|
40
|
+
}, [vendorData, surveyor?.vendorId]);
|
|
41
|
+
|
|
42
|
+
const supervisorName = useMemo(() => {
|
|
43
|
+
if (!supervisorSearchResponse?.supervisors || !surveyor?.supervisorId) return "N/A";
|
|
44
|
+
const mappedSupervisor = supervisorSearchResponse.supervisors.find((s) => s.id === surveyor.supervisorId || s.owner?.uuid === surveyor.supervisorId);
|
|
45
|
+
return mappedSupervisor?.name || mappedSupervisor?.owner?.name || surveyor.supervisorId || "N/A";
|
|
46
|
+
}, [supervisorSearchResponse, surveyor?.supervisorId]);
|
|
47
|
+
|
|
48
|
+
const fullName = surveyor?.owner?.name || surveyor?.name || "N/A";
|
|
49
|
+
const employeeId = surveyor?.employeeId || surveyor?.owner?.uuid || surveyor?.id;
|
|
50
|
+
const mobileNumber = surveyor?.owner?.mobileNumber || surveyor?.mobileNo || "N/A";
|
|
51
|
+
|
|
32
52
|
const [currentPage, setCurrentPage] = useState(0);
|
|
33
53
|
const [pageSize, setPageSize] = useState(20);
|
|
34
54
|
const queryParams = {
|
|
@@ -38,10 +58,14 @@ const SurveyorDetailsDashboard = () => {
|
|
|
38
58
|
surveyorId: surveyor?.owner?.uuid,
|
|
39
59
|
};
|
|
40
60
|
|
|
41
|
-
const { isFetching: isDashboardLoading, data: dashboardData = {} } = Digit.Hooks.ekyc.useEkycSurveyorDashboard(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
61
|
+
const { isFetching: isDashboardLoading, data: dashboardData = {}, refetch: refetchDashboard } = Digit.Hooks.ekyc.useEkycSurveyorDashboard(
|
|
62
|
+
{},
|
|
63
|
+
queryParams,
|
|
64
|
+
{
|
|
65
|
+
enabled: !!queryParams.tenantId && !!queryParams.surveyorId,
|
|
66
|
+
keepPreviousData: true,
|
|
67
|
+
}
|
|
68
|
+
);
|
|
45
69
|
|
|
46
70
|
const knoColumns = useMemo(
|
|
47
71
|
() => [
|
|
@@ -78,6 +102,24 @@ const SurveyorDetailsDashboard = () => {
|
|
|
78
102
|
[]
|
|
79
103
|
);
|
|
80
104
|
|
|
105
|
+
// ─── Download Report hooks (must be before any early returns) ───────
|
|
106
|
+
|
|
107
|
+
const [showReportMenu, setShowReportMenu] = useState(false);
|
|
108
|
+
const [customDate, setCustomDate] = useState({ from: "", to: "" });
|
|
109
|
+
const [showCustomPicker, setShowCustomPicker] = useState(false);
|
|
110
|
+
const reportMenuRef = useRef(null);
|
|
111
|
+
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
const handler = (e) => {
|
|
114
|
+
if (reportMenuRef.current && !reportMenuRef.current.contains(e.target)) {
|
|
115
|
+
setShowReportMenu(false);
|
|
116
|
+
setShowCustomPicker(false);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
document.addEventListener("mousedown", handler);
|
|
120
|
+
return () => document.removeEventListener("mousedown", handler);
|
|
121
|
+
}, []);
|
|
122
|
+
|
|
81
123
|
if (isLoading) {
|
|
82
124
|
return <Loader />;
|
|
83
125
|
}
|
|
@@ -118,6 +160,85 @@ const SurveyorDetailsDashboard = () => {
|
|
|
118
160
|
},
|
|
119
161
|
];
|
|
120
162
|
|
|
163
|
+
const getDateRange = (filter) => {
|
|
164
|
+
const now = new Date();
|
|
165
|
+
const start = new Date(now);
|
|
166
|
+
if (filter === "today") {
|
|
167
|
+
start.setHours(0, 0, 0, 0);
|
|
168
|
+
return { from: start, to: now };
|
|
169
|
+
}
|
|
170
|
+
if (filter === "week") {
|
|
171
|
+
start.setDate(now.getDate() - now.getDay());
|
|
172
|
+
start.setHours(0, 0, 0, 0);
|
|
173
|
+
return { from: start, to: now };
|
|
174
|
+
}
|
|
175
|
+
if (filter === "month") {
|
|
176
|
+
start.setDate(1);
|
|
177
|
+
start.setHours(0, 0, 0, 0);
|
|
178
|
+
return { from: start, to: now };
|
|
179
|
+
}
|
|
180
|
+
return null;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const handlePresetDownload = (filter) => {
|
|
184
|
+
const allRows = dashboardData?.dashboardInfo?.consumerList || [];
|
|
185
|
+
|
|
186
|
+
const range = getDateRange(filter);
|
|
187
|
+
|
|
188
|
+
if (!range) return;
|
|
189
|
+
|
|
190
|
+
const filtered = allRows.filter((r) => {
|
|
191
|
+
const ts =
|
|
192
|
+
r.submittedAt ||
|
|
193
|
+
r.createdTime ||
|
|
194
|
+
r.lastModifiedTime ||
|
|
195
|
+
0;
|
|
196
|
+
|
|
197
|
+
return ts >= range.from.getTime() && ts <= range.to.getTime();
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
downloadSurveyorPDF({
|
|
201
|
+
rows: filtered.length ? filtered : allRows,
|
|
202
|
+
surveyorName: fullName,
|
|
203
|
+
vendorName,
|
|
204
|
+
supervisorName,
|
|
205
|
+
employeeId,
|
|
206
|
+
mobileNumber,
|
|
207
|
+
dashboardInfo: dashboardData?.dashboardInfo,
|
|
208
|
+
t,
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
setShowReportMenu(false);
|
|
212
|
+
setShowCustomPicker(false);
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const handleCustomDownload = () => {
|
|
216
|
+
if (!customDate.from || !customDate.to) {
|
|
217
|
+
alert(t("SELECT_DATE_RANGE") || "Please select both From and To dates.");
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const from = new Date(customDate.from);
|
|
221
|
+
const to = new Date(customDate.to);
|
|
222
|
+
to.setHours(23, 59, 59, 999);
|
|
223
|
+
const allRows = dashboardData?.dashboardInfo?.consumerList || [];
|
|
224
|
+
const filtered = allRows.filter((r) => {
|
|
225
|
+
const ts = r.createdTime || r.lastModifiedTime || 0;
|
|
226
|
+
return ts >= from.getTime() && ts <= to.getTime();
|
|
227
|
+
});
|
|
228
|
+
downloadSurveyorPDF({
|
|
229
|
+
rows: filtered.length ? filtered : allRows,
|
|
230
|
+
surveyorName: fullName,
|
|
231
|
+
vendorName,
|
|
232
|
+
supervisorName,
|
|
233
|
+
employeeId,
|
|
234
|
+
mobileNumber,
|
|
235
|
+
dashboardInfo: dashboardData?.dashboardInfo,
|
|
236
|
+
t,
|
|
237
|
+
});
|
|
238
|
+
setShowReportMenu(false);
|
|
239
|
+
setShowCustomPicker(false);
|
|
240
|
+
};
|
|
241
|
+
|
|
121
242
|
const StatCard = ({ title, value, type, isLoading }) => (
|
|
122
243
|
<div className={`stat-card ${type}`}>
|
|
123
244
|
{isLoading ? (
|
|
@@ -136,18 +257,18 @@ const SurveyorDetailsDashboard = () => {
|
|
|
136
257
|
|
|
137
258
|
const options = [{ action: "Assign" }];
|
|
138
259
|
|
|
139
|
-
const fullName = surveyor?.owner?.name || surveyor?.name || "N/A";
|
|
140
|
-
|
|
141
|
-
const employeeId = surveyor?.employeeId || surveyor?.owner?.uuid || surveyor?.id;
|
|
142
|
-
|
|
143
260
|
const handleMenuSelect = (option) => {
|
|
144
261
|
setShowOptions(false); // close menu
|
|
145
262
|
setShowModal(true);
|
|
146
263
|
};
|
|
147
264
|
|
|
265
|
+
const closeModal = async () => {
|
|
266
|
+
setShowModal(false);
|
|
267
|
+
};
|
|
268
|
+
|
|
148
269
|
return (
|
|
149
270
|
<Card className="surveyor-dashboard">
|
|
150
|
-
{/* Header */}
|
|
271
|
+
{/* Header + Download Report */}
|
|
151
272
|
<div className="ekyc-dashboard-section">
|
|
152
273
|
<div className="ekyc-dashboard-header">
|
|
153
274
|
<div className="avatar">{fullName?.charAt(0)?.toUpperCase()}</div>
|
|
@@ -162,6 +283,83 @@ const SurveyorDetailsDashboard = () => {
|
|
|
162
283
|
</div>
|
|
163
284
|
</div>
|
|
164
285
|
</div>
|
|
286
|
+
|
|
287
|
+
{/* Download Report — far right */}
|
|
288
|
+
<div className="report-download" ref={reportMenuRef}>
|
|
289
|
+
<button
|
|
290
|
+
className="download-btn"
|
|
291
|
+
onClick={() => {
|
|
292
|
+
setShowReportMenu((p) => !p);
|
|
293
|
+
setShowCustomPicker(false);
|
|
294
|
+
}}
|
|
295
|
+
>
|
|
296
|
+
{t("DOWNLOAD_REPORT") || "Download Report"}
|
|
297
|
+
</button>
|
|
298
|
+
|
|
299
|
+
{showReportMenu && (
|
|
300
|
+
<div className="report-menu">
|
|
301
|
+
{[
|
|
302
|
+
{ label: t("TODAY") || "Today", key: "today" },
|
|
303
|
+
{ label: t("THIS_WEEK") || "This Week", key: "week" },
|
|
304
|
+
{ label: t("THIS_MONTH") || "This Month", key: "month" },
|
|
305
|
+
].map(({ label, key }) => (
|
|
306
|
+
<div
|
|
307
|
+
key={key}
|
|
308
|
+
className="menu-item"
|
|
309
|
+
onClick={() => handlePresetDownload(key)}
|
|
310
|
+
>
|
|
311
|
+
{label}
|
|
312
|
+
</div>
|
|
313
|
+
))}
|
|
314
|
+
|
|
315
|
+
<div
|
|
316
|
+
className="custom-date-trigger"
|
|
317
|
+
onClick={() => setShowCustomPicker((p) => !p)}
|
|
318
|
+
>
|
|
319
|
+
{t("CUSTOM_DATE") || "Custom Date"}
|
|
320
|
+
</div>
|
|
321
|
+
|
|
322
|
+
{showCustomPicker && (
|
|
323
|
+
<div className="custom-picker">
|
|
324
|
+
<div className="date-field">
|
|
325
|
+
<label className="date-label">
|
|
326
|
+
{t("FROM_DATE") || "From"}
|
|
327
|
+
</label>
|
|
328
|
+
<input
|
|
329
|
+
type="date"
|
|
330
|
+
className="date-input"
|
|
331
|
+
value={customDate.from}
|
|
332
|
+
onChange={(e) =>
|
|
333
|
+
setCustomDate((d) => ({ ...d, from: e.target.value }))
|
|
334
|
+
}
|
|
335
|
+
/>
|
|
336
|
+
</div>
|
|
337
|
+
|
|
338
|
+
<div className="date-field">
|
|
339
|
+
<label className="date-label">
|
|
340
|
+
{t("TO_DATE") || "To"}
|
|
341
|
+
</label>
|
|
342
|
+
<input
|
|
343
|
+
type="date"
|
|
344
|
+
className="date-input"
|
|
345
|
+
value={customDate.to}
|
|
346
|
+
onChange={(e) =>
|
|
347
|
+
setCustomDate((d) => ({ ...d, to: e.target.value }))
|
|
348
|
+
}
|
|
349
|
+
/>
|
|
350
|
+
</div>
|
|
351
|
+
|
|
352
|
+
<button
|
|
353
|
+
className="download-action-btn"
|
|
354
|
+
onClick={handleCustomDownload}
|
|
355
|
+
>
|
|
356
|
+
{t("DOWNLOAD") || "Download"}
|
|
357
|
+
</button>
|
|
358
|
+
</div>
|
|
359
|
+
)}
|
|
360
|
+
</div>
|
|
361
|
+
)}
|
|
362
|
+
</div>
|
|
165
363
|
</div>
|
|
166
364
|
|
|
167
365
|
{/* Stats */}
|
|
@@ -282,27 +480,31 @@ const SurveyorDetailsDashboard = () => {
|
|
|
282
480
|
/>
|
|
283
481
|
</Card>
|
|
284
482
|
{/* Actions */}
|
|
285
|
-
{
|
|
286
|
-
|
|
287
|
-
<
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
483
|
+
{
|
|
484
|
+
(!roles.includes("EKYC_SURVEYOR") || roles.includes("EMPLOYEE")) && (
|
|
485
|
+
<ActionBar>
|
|
486
|
+
<SubmitBar label={t("EKYC_ASSIGN_KNOS")} onSubmit={() => setShowOptions((prev) => !prev)} />
|
|
487
|
+
|
|
488
|
+
{showOptions && (
|
|
489
|
+
<Menu
|
|
490
|
+
options={options}
|
|
491
|
+
optionKey={"action"}
|
|
492
|
+
t={t}
|
|
493
|
+
onSelect={handleMenuSelect}
|
|
494
|
+
style={{
|
|
495
|
+
color: "#FFFFFF",
|
|
496
|
+
fontSize: "18px",
|
|
497
|
+
}}
|
|
498
|
+
/>
|
|
499
|
+
)}
|
|
500
|
+
</ActionBar>
|
|
501
|
+
|
|
502
|
+
)
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
{showModal && <AssignEkycModal surveyor={surveyor} closeModal={closeModal} refetchDashboard={refetchDashboard} />}
|
|
305
506
|
</Card>
|
|
507
|
+
|
|
306
508
|
);
|
|
307
509
|
};
|
|
308
510
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { useHistory } from "react-router-dom";
|
|
3
2
|
import { useTranslation } from "react-i18next";
|
|
3
|
+
import { tableColumnConfig } from "../../../vendor/src/config/tableConfig";
|
|
4
4
|
|
|
5
5
|
const SupervisorInboxTableConfig = ({
|
|
6
6
|
onPageSizeChange,
|
|
@@ -8,7 +8,6 @@ const SupervisorInboxTableConfig = ({
|
|
|
8
8
|
totalCount,
|
|
9
9
|
table,
|
|
10
10
|
dispatch,
|
|
11
|
-
checkPathName,
|
|
12
11
|
onSortingByData,
|
|
13
12
|
inboxStyles = {},
|
|
14
13
|
tableStyle = {},
|
|
@@ -25,52 +24,6 @@ const SupervisorInboxTableConfig = ({
|
|
|
25
24
|
const limit = formState?.tableForm?.limit || 10;
|
|
26
25
|
const offset = formState?.tableForm?.offset || 0;
|
|
27
26
|
|
|
28
|
-
const tableColumnConfig = [
|
|
29
|
-
{
|
|
30
|
-
Header: t("SURVEYOR_ID"),
|
|
31
|
-
accessor: "id",
|
|
32
|
-
Cell: ({ row }) => {
|
|
33
|
-
const id = row.original?.id;
|
|
34
|
-
return (
|
|
35
|
-
<span
|
|
36
|
-
className="ekyc-application-link"
|
|
37
|
-
style={{ color: "#add8f7", cursor: "pointer", fontWeight: "bold" }}
|
|
38
|
-
onClick={() => handleReview(id)}
|
|
39
|
-
>
|
|
40
|
-
{id || "NA"}
|
|
41
|
-
</span>
|
|
42
|
-
);
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
Header: t("SURVEYOR_NAME"),
|
|
48
|
-
accessor: "surveyorName",
|
|
49
|
-
Cell: ({ row }) => <span>{row.original?.surveyorName || row.original?.name || "NA"}</span>,
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
{
|
|
53
|
-
Header: t("MOBILE_NUMBER"),
|
|
54
|
-
accessor: "mobileNo",
|
|
55
|
-
Cell: ({ row }) => <span>{row.original?.mobileNo || row.original?.owner?.mobileNumber || "NA"}</span>,
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
{
|
|
59
|
-
Header: t("STATUS"),
|
|
60
|
-
accessor: "status",
|
|
61
|
-
Cell: ({ row }) => {
|
|
62
|
-
const status = row.original?.status || "DEFAULT";
|
|
63
|
-
return <span className={`ekyc-status-tag ${status}`}>{t(status)}</span>;
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
{
|
|
68
|
-
Header: t("SERVICE_TYPE"),
|
|
69
|
-
accessor: "serviceType",
|
|
70
|
-
Cell: ({ row }) => <span>{row.original?.serviceType || "NA"}</span>,
|
|
71
|
-
},
|
|
72
|
-
];
|
|
73
|
-
|
|
74
27
|
return {
|
|
75
28
|
getCellProps: () => ({
|
|
76
29
|
style: {
|
|
@@ -94,7 +47,6 @@ const SupervisorInboxTableConfig = ({
|
|
|
94
47
|
...formState.tableForm,
|
|
95
48
|
offset: Number(offset) + Number(limit),
|
|
96
49
|
},
|
|
97
|
-
checkPathName,
|
|
98
50
|
}),
|
|
99
51
|
|
|
100
52
|
onPrevPage: () =>
|
|
@@ -104,7 +56,6 @@ const SupervisorInboxTableConfig = ({
|
|
|
104
56
|
...formState.tableForm,
|
|
105
57
|
offset: Number(offset) - Number(limit),
|
|
106
58
|
},
|
|
107
|
-
checkPathName,
|
|
108
59
|
}),
|
|
109
60
|
|
|
110
61
|
onLastPage: () =>
|
|
@@ -114,21 +65,19 @@ const SupervisorInboxTableConfig = ({
|
|
|
114
65
|
...formState.tableForm,
|
|
115
66
|
offset: Math.ceil(totalCount / limit) * limit - Number(limit),
|
|
116
67
|
},
|
|
117
|
-
checkPathName,
|
|
118
68
|
}),
|
|
119
69
|
|
|
120
70
|
onFirstPage: () =>
|
|
121
71
|
dispatch({
|
|
122
72
|
action: "mutateTableForm",
|
|
123
73
|
data: { ...formState.tableForm, offset: 0 },
|
|
124
|
-
checkPathName,
|
|
125
74
|
}),
|
|
126
75
|
|
|
127
76
|
totalRecords: totalCount,
|
|
128
77
|
onSort: onSortingByData,
|
|
129
78
|
|
|
130
79
|
data: table,
|
|
131
|
-
columns: tableColumnConfig,
|
|
80
|
+
columns: tableColumnConfig(t, handleReview),
|
|
132
81
|
|
|
133
82
|
inboxStyles: { ...inboxStyles },
|
|
134
83
|
tableStyle: { ...tableStyle },
|
|
@@ -106,17 +106,17 @@ const useInboxTableConfig = ({
|
|
|
106
106
|
manualPagination: true,
|
|
107
107
|
initSortId: "applicationDate",
|
|
108
108
|
onPageSizeChange: onPageSizeChange,
|
|
109
|
-
currentPage:
|
|
109
|
+
currentPage: offset,
|
|
110
110
|
onNextPage: () =>
|
|
111
111
|
dispatch({
|
|
112
112
|
action: "mutateTableForm",
|
|
113
|
-
data: { ...formState.tableForm, offset: parseInt(formState.tableForm?.offset) +
|
|
113
|
+
data: { ...formState.tableForm, offset: parseInt(formState.tableForm?.offset) + 10 },
|
|
114
114
|
checkPathName,
|
|
115
115
|
}),
|
|
116
116
|
onPrevPage: () =>
|
|
117
117
|
dispatch({
|
|
118
118
|
action: "mutateTableForm",
|
|
119
|
-
data: { ...formState.tableForm, offset: parseInt(formState.tableForm?.offset) -
|
|
119
|
+
data: { ...formState.tableForm, offset: parseInt(formState.tableForm?.offset) - 10 },
|
|
120
120
|
checkPathName,
|
|
121
121
|
}),
|
|
122
122
|
pageSizeLimit: limit,
|
|
@@ -127,7 +127,7 @@ const useInboxTableConfig = ({
|
|
|
127
127
|
onLastPage: () =>
|
|
128
128
|
dispatch({
|
|
129
129
|
action: "mutateTableForm",
|
|
130
|
-
data: { ...formState.tableForm, offset: Math.ceil(totalCount /
|
|
130
|
+
data: { ...formState.tableForm, offset: Math.max(0, Math.ceil(totalCount / limit) - 10) },
|
|
131
131
|
checkPathName,
|
|
132
132
|
}),
|
|
133
133
|
onFirstPage: () => dispatch({ action: "mutateTableForm", data: { ...formState.tableForm, offset: 0 }, checkPathName }),
|
|
@@ -102,7 +102,7 @@ const Inbox = ({ parentRoute }) => {
|
|
|
102
102
|
|
|
103
103
|
const checkPathName = location.pathname.includes("ekyc/inbox");
|
|
104
104
|
const PropsForInboxLinks = {
|
|
105
|
-
headerText:
|
|
105
|
+
headerText: "EKYC_MODULE",
|
|
106
106
|
};
|
|
107
107
|
|
|
108
108
|
const SearchFormFields = useCallback(
|
|
@@ -154,10 +154,10 @@ const Inbox = ({ parentRoute }) => {
|
|
|
154
154
|
|
|
155
155
|
const propsForFilterForm = {
|
|
156
156
|
FilterFormFields,
|
|
157
|
-
onFilterFormSubmit: () => {},
|
|
157
|
+
onFilterFormSubmit: () => { },
|
|
158
158
|
filterFormDefaultValues: "",
|
|
159
159
|
resetFilterFormDefaultValues: "",
|
|
160
|
-
onFilterFormReset: () => {},
|
|
160
|
+
onFilterFormReset: () => { },
|
|
161
161
|
};
|
|
162
162
|
|
|
163
163
|
function formReducer(state, payload) {
|
|
@@ -239,9 +239,9 @@ const Inbox = ({ parentRoute }) => {
|
|
|
239
239
|
<InboxComposer
|
|
240
240
|
{...{
|
|
241
241
|
isInboxLoading,
|
|
242
|
-
PropsForInboxLinks,
|
|
242
|
+
// PropsForInboxLinks,
|
|
243
243
|
...propsForSearchForm,
|
|
244
|
-
...propsForFilterForm,
|
|
244
|
+
// ...propsForFilterForm,
|
|
245
245
|
// ...propsForMobileSortForm,
|
|
246
246
|
propsForInboxTable,
|
|
247
247
|
// propsForInboxMobileCards,
|
|
@@ -7,9 +7,7 @@ import PropertyInfo from "../../components/PropertyInfo";
|
|
|
7
7
|
import MeterDetails from "../../components/MeterDetails";
|
|
8
8
|
import Review from "../../components/Review";
|
|
9
9
|
import Home from "./Home";
|
|
10
|
-
import Dashboard from "../../components/Dashboard";
|
|
11
10
|
import Inbox from "./Inbox";
|
|
12
|
-
import AddressDetails from "../../components/AddressDetails";
|
|
13
11
|
import AssignEkyc from "../../components/AssignEkyc";
|
|
14
12
|
import SurveyorDetailsCard from "../../components/SurveyorDetailsCard";
|
|
15
13
|
import VendorDetails from "../../components/VendorDetails";
|
|
@@ -21,21 +19,50 @@ const CitizenApp = () => {
|
|
|
21
19
|
|
|
22
20
|
sessionStorage.removeItem("revalidateddone");
|
|
23
21
|
|
|
24
|
-
const
|
|
22
|
+
const getDynamicBreadcrumbs = () => {
|
|
25
23
|
const pathname = location.pathname;
|
|
26
|
-
if (pathname.includes("/create-kyc")) return "EKYC_CREATE_KYC";
|
|
27
|
-
if (pathname.includes("/aadhaar-verification")) return "EKYC_AADHAAR_VERIFICATION";
|
|
28
|
-
if (pathname.includes("/address-details")) return "EKYC_ADDRESS_DETAILS";
|
|
29
|
-
if (pathname.includes("/property-info")) return "EKYC_PROPERTY_INFO";
|
|
30
|
-
if (pathname.includes("/meter-details")) return "EKYC_METER_DETAILS";
|
|
31
|
-
if (pathname.includes("/review")) return "EKYC_REVIEW";
|
|
32
|
-
return "EKYC_HOME";
|
|
33
|
-
};
|
|
34
24
|
|
|
35
|
-
|
|
25
|
+
// Parent crumb — always present and clickable → redirects to eKYC citizen home
|
|
26
|
+
const crumbs = [
|
|
27
|
+
{ icon: HomeIcon, path: "/digit-ui/citizen" },
|
|
28
|
+
{ label: t("EKYC_MODULE_NAME"), path: `/digit-ui/citizen/ekyc` },
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
// Child crumb — only appended when on a sub-page
|
|
32
|
+
if (pathname.includes("/create-kyc")) {
|
|
33
|
+
crumbs.push({ label: t("EKYC_CREATE_KYC") });
|
|
34
|
+
} else if (pathname.includes("/aadhaar-verification")) {
|
|
35
|
+
crumbs.push({ label: t("EKYC_AADHAAR_VERIFICATION") });
|
|
36
|
+
} else if (pathname.includes("/address-details")) {
|
|
37
|
+
crumbs.push({ label: t("EKYC_ADDRESS_DETAILS") });
|
|
38
|
+
} else if (pathname.includes("/property-info")) {
|
|
39
|
+
crumbs.push({ label: t("EKYC_PROPERTY_INFO") });
|
|
40
|
+
} else if (pathname.includes("/meter-details")) {
|
|
41
|
+
crumbs.push({ label: t("EKYC_METER_DETAILS") });
|
|
42
|
+
} else if (pathname.includes("/review")) {
|
|
43
|
+
crumbs.push({ label: t("EKYC_INBOX"), path: `/digit-ui/citizen/ekyc/inbox` });
|
|
44
|
+
crumbs.push({ label: t("EKYC_REVIEW") });
|
|
45
|
+
} else if (pathname.includes("/assign/surveyor-details")) {
|
|
46
|
+
crumbs.push({ label: t("EKYC_ASSIGN"), path: `/digit-ui/citizen/ekyc/assign` });
|
|
47
|
+
crumbs.push({ label: t("EKYC_SURVEYOR_DETAILS") });
|
|
48
|
+
} else if (pathname.includes("/assign")) {
|
|
49
|
+
crumbs.push({ label: t("EKYC_ASSIGN") });
|
|
50
|
+
} else if (pathname.includes("/surveyor-dashboard")) {
|
|
51
|
+
crumbs.push({ label: t("EKYC_SURVEYOR_DASHBOARD") });
|
|
52
|
+
} else if (pathname.includes("/dashboard")) {
|
|
53
|
+
crumbs.push({ label: t("EKYC_DASHBOARD") });
|
|
54
|
+
} else if (pathname.includes("/inbox")) {
|
|
55
|
+
crumbs.push({ label: t("EKYC_INBOX") });
|
|
56
|
+
} else if (pathname.includes("/status/")) {
|
|
57
|
+
crumbs.push({ label: t("EKYC_STATUS") });
|
|
58
|
+
}
|
|
59
|
+
// home (exact path) → no child crumb
|
|
60
|
+
|
|
61
|
+
return crumbs;
|
|
62
|
+
};
|
|
36
63
|
|
|
37
|
-
const roles = Digit.SessionStorage.get("User")?.info?.roles.map((ele) => ele.code);
|
|
38
|
-
const isEkyAction = (!roles?.includes("EKYC_SURVEYOR") || roles?.includes("EMPLOYEE"))
|
|
64
|
+
// const roles = Digit.SessionStorage.get("User")?.info?.roles.map((ele) => ele.code);
|
|
65
|
+
// const isEkyAction = (!roles?.includes("EKYC_SURVEYOR") || roles?.includes("EMPLOYEE"))
|
|
39
66
|
return (
|
|
40
67
|
<React.Fragment>
|
|
41
68
|
<div className="ground-container form-container">
|
|
@@ -47,7 +74,7 @@ const CitizenApp = () => {
|
|
|
47
74
|
</React.Fragment>
|
|
48
75
|
}
|
|
49
76
|
onLeftClick={() => window.history.back()}
|
|
50
|
-
breadcrumbs={
|
|
77
|
+
breadcrumbs={getDynamicBreadcrumbs()}
|
|
51
78
|
/>
|
|
52
79
|
|
|
53
80
|
<Switch>
|
|
@@ -86,14 +113,14 @@ const CitizenApp = () => {
|
|
|
86
113
|
)}
|
|
87
114
|
/>
|
|
88
115
|
|
|
89
|
-
<PrivateRoute
|
|
116
|
+
{/* <PrivateRoute
|
|
90
117
|
path={`${path}/address-details`}
|
|
91
118
|
component={() => (
|
|
92
119
|
<LayoutWrapper layoutClass="normal">
|
|
93
120
|
<AddressDetails />
|
|
94
121
|
</LayoutWrapper>
|
|
95
122
|
)}
|
|
96
|
-
/>
|
|
123
|
+
/> */}
|
|
97
124
|
|
|
98
125
|
<PrivateRoute
|
|
99
126
|
path={`${path}/property-info`}
|