@djb25/digit-ui-module-ekyc 1.0.19 → 1.0.21
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 +213 -118
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
- package/src/components/AssignEkyc.js +25 -21
- package/src/components/AssignEkycModal.js +79 -37
- package/src/components/SearchFormFieldsComponent.js +2 -2
- package/src/components/SurveyorDetailsCard.js +82 -55
- package/src/components/VendorDetails.jsx +0 -1
package/package.json
CHANGED
|
@@ -26,10 +26,11 @@ const AssignEkyc = () => {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const [formState, dispatch] = useReducer(formReducer, formInitValue);
|
|
29
|
+
const userDetails = Digit.SessionStorage.get("User");
|
|
29
30
|
|
|
30
31
|
const { data: dashboardData, isLoading } = Digit.Hooks.fsm.useSurveyorSearch(
|
|
31
32
|
tenantId,
|
|
32
|
-
{ ...paginationParms, status: "ACTIVE,DISABLED" },
|
|
33
|
+
{ ...paginationParms, status: "ACTIVE,DISABLED", vendorId: userDetails?.info?.uuid },
|
|
33
34
|
{ enabled: !!tenantId, keepPreviousData: true }
|
|
34
35
|
);
|
|
35
36
|
|
|
@@ -53,6 +54,13 @@ const AssignEkyc = () => {
|
|
|
53
54
|
keepPreviousData: true,
|
|
54
55
|
}
|
|
55
56
|
);
|
|
57
|
+
const { isLoading: isDataSearchLoading, data } = Digit.Hooks.ekyc.useEkycAssignmentProgress(
|
|
58
|
+
{},
|
|
59
|
+
{
|
|
60
|
+
enabled: !!tenantId && !!searchDetails.kno, // 🔥 important
|
|
61
|
+
keepPreviousData: true,
|
|
62
|
+
}
|
|
63
|
+
);
|
|
56
64
|
|
|
57
65
|
const sourceData = useMemo(() => {
|
|
58
66
|
if (isSearchActive) {
|
|
@@ -241,42 +249,37 @@ const AssignEkyc = () => {
|
|
|
241
249
|
const cards = [
|
|
242
250
|
{
|
|
243
251
|
label: "TOTAL_EKYC_APPLICATIONS",
|
|
244
|
-
count:
|
|
252
|
+
count: data?.totalKnos || 0,
|
|
245
253
|
color: "#0B2559",
|
|
246
254
|
filter: null,
|
|
247
255
|
active: true,
|
|
248
256
|
},
|
|
249
257
|
{
|
|
250
|
-
label: "
|
|
251
|
-
count:
|
|
252
|
-
color: "#F59E0B",
|
|
253
|
-
filter: ["UNASSIGNED"],
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
label: "ASSIGNED_TO_SURVEYOR",
|
|
257
|
-
count: 120,
|
|
258
|
+
label: "TOTAL_ASSIGNMENTS",
|
|
259
|
+
count: data?.totalAssignments || 0,
|
|
258
260
|
color: "#3B82F6",
|
|
259
261
|
filter: ["ASSIGNED"],
|
|
260
262
|
},
|
|
261
|
-
{
|
|
262
|
-
label: "IN_PROGRESS",
|
|
263
|
-
count: 54,
|
|
264
|
-
color: "#A855F7",
|
|
265
|
-
filter: ["IN_PROGRESS"],
|
|
266
|
-
},
|
|
267
263
|
{
|
|
268
264
|
label: "EKYC_COMPLETED",
|
|
269
|
-
count:
|
|
265
|
+
count: data?.completedKnos || 0,
|
|
270
266
|
color: "#10B981",
|
|
271
267
|
filter: ["COMPLETED"],
|
|
272
268
|
},
|
|
273
269
|
{
|
|
274
|
-
label: "
|
|
275
|
-
count:
|
|
276
|
-
color: "#
|
|
277
|
-
filter: ["
|
|
270
|
+
label: "PENDING_APPLICATIONS",
|
|
271
|
+
count: (data?.totalKnos || 0) - (data?.completedKnos || 0),
|
|
272
|
+
color: "#F59E0B",
|
|
273
|
+
filter: ["PENDING"],
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
label: "OVERALL_PROGRESS",
|
|
277
|
+
count: `${data?.overallProgressPercent || 0}%`,
|
|
278
|
+
color: "#A855F7",
|
|
279
|
+
filter: ["IN_PROGRESS"],
|
|
278
280
|
},
|
|
279
281
|
];
|
|
282
|
+
|
|
280
283
|
return (
|
|
281
284
|
<div className="app-container">
|
|
282
285
|
<InboxComposer
|
|
@@ -291,6 +294,7 @@ const AssignEkyc = () => {
|
|
|
291
294
|
formState,
|
|
292
295
|
countData: dashboardData?.dashboardInfo,
|
|
293
296
|
cards,
|
|
297
|
+
isCardLoading: isDataSearchLoading,
|
|
294
298
|
}}
|
|
295
299
|
/>
|
|
296
300
|
</div>
|
|
@@ -1,38 +1,26 @@
|
|
|
1
1
|
import React, { useMemo, useState, useEffect } from "react";
|
|
2
|
-
import { Modal, Close, Table } from "@djb25/digit-ui-react-components";
|
|
2
|
+
import { Modal, Close, Table, Toast } from "@djb25/digit-ui-react-components";
|
|
3
3
|
|
|
4
4
|
const AssignEkycModal = ({ surveyor, closeModal }) => {
|
|
5
5
|
const [selectedKnos, setSelectedKnos] = useState([]);
|
|
6
|
-
const [
|
|
6
|
+
const [isBulkSelection, setIsBulkSelection] = useState(false);
|
|
7
7
|
const [currentPage, setCurrentPage] = useState(0);
|
|
8
8
|
const [pageSize, setPageSize] = useState(10);
|
|
9
|
+
const [showToast, setShowToast] = useState(false);
|
|
10
|
+
const [toastData, setToastData] = useState({
|
|
11
|
+
error: false,
|
|
12
|
+
label: "",
|
|
13
|
+
});
|
|
9
14
|
const [filters, setFilters] = useState({
|
|
10
15
|
kno: "", // search value
|
|
11
|
-
|
|
16
|
+
pincode: "",
|
|
12
17
|
zoneName: "",
|
|
13
|
-
assembly: "",
|
|
14
18
|
ward: "",
|
|
19
|
+
assembly: "",
|
|
15
20
|
mrkey: "",
|
|
16
|
-
|
|
21
|
+
ekycStatus: "",
|
|
17
22
|
});
|
|
18
23
|
|
|
19
|
-
const getAssignmentValue = () => {
|
|
20
|
-
switch (assignmentType) {
|
|
21
|
-
case "MRKEY":
|
|
22
|
-
return filters.mrkey;
|
|
23
|
-
|
|
24
|
-
case "ASSEMBLY":
|
|
25
|
-
return filters.assembly;
|
|
26
|
-
|
|
27
|
-
case "WARD":
|
|
28
|
-
return filters.ward;
|
|
29
|
-
|
|
30
|
-
case "KNO":
|
|
31
|
-
default:
|
|
32
|
-
return selectedKnos.join(",");
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
24
|
const [debouncedFilters, setDebouncedFilters] = useState(filters);
|
|
37
25
|
|
|
38
26
|
useEffect(() => {
|
|
@@ -47,7 +35,7 @@ const AssignEkycModal = ({ surveyor, closeModal }) => {
|
|
|
47
35
|
setCurrentPage(0);
|
|
48
36
|
}, [debouncedFilters]);
|
|
49
37
|
|
|
50
|
-
const { data: applicationData, isLoading } = Digit.Hooks.ekyc.useEkycApplicationList(
|
|
38
|
+
const { data: applicationData, isFetching: isLoading } = Digit.Hooks.ekyc.useEkycApplicationList(
|
|
51
39
|
{
|
|
52
40
|
...(debouncedFilters.kno && {
|
|
53
41
|
kno: debouncedFilters.kno,
|
|
@@ -89,27 +77,87 @@ const AssignEkycModal = ({ surveyor, closeModal }) => {
|
|
|
89
77
|
|
|
90
78
|
const assignmentMutation = Digit.Hooks.ekyc.useEkycAssignmentCreate({
|
|
91
79
|
onSuccess: (response) => {
|
|
92
|
-
|
|
93
|
-
|
|
80
|
+
if (response?.error) {
|
|
81
|
+
setToastData({
|
|
82
|
+
error: true,
|
|
83
|
+
label: response?.data?.message || "Something went wrong",
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
setShowToast(true);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
setToastData({
|
|
91
|
+
error: false,
|
|
92
|
+
label: "Assignment successful",
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
setShowToast(true);
|
|
96
|
+
|
|
97
|
+
// optional delay so user can see the success toast
|
|
98
|
+
setTimeout(() => {
|
|
99
|
+
closeModal();
|
|
100
|
+
}, 1000);
|
|
94
101
|
},
|
|
102
|
+
|
|
95
103
|
onError: (error) => {
|
|
96
|
-
|
|
97
|
-
|
|
104
|
+
setToastData({
|
|
105
|
+
error: true,
|
|
106
|
+
label: error?.data?.message || error?.response?.data?.message || "Something went wrong",
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
setShowToast(true);
|
|
98
110
|
},
|
|
99
111
|
});
|
|
100
112
|
|
|
101
113
|
const tableData = applicationData?.consumerList || [];
|
|
102
114
|
|
|
115
|
+
const getAssignmentPayload = () => {
|
|
116
|
+
if (isBulkSelection) {
|
|
117
|
+
const filterMappings = [
|
|
118
|
+
{ key: "ekycStatus", type: "EKYCSTATUS" },
|
|
119
|
+
{ key: "zoneName", type: "ZONENAME" },
|
|
120
|
+
{ key: "assembly", type: "ASSEMBLY" },
|
|
121
|
+
{ key: "ward", type: "WARD" },
|
|
122
|
+
{ key: "mrkey", type: "MRKEY" },
|
|
123
|
+
{ key: "pincode", type: "PINCODE" },
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
const appliedFilter = filterMappings.find(({ key }) => debouncedFilters[key]);
|
|
127
|
+
|
|
128
|
+
if (appliedFilter) {
|
|
129
|
+
return {
|
|
130
|
+
assignmentType: appliedFilter.type,
|
|
131
|
+
assignmentValue: debouncedFilters[appliedFilter.key],
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
console.log("=-=-==-=-=-=-", {
|
|
137
|
+
assignmentType: "KNO",
|
|
138
|
+
assignmentValues: selectedKnos,
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
return {
|
|
142
|
+
assignmentType: "KNO",
|
|
143
|
+
assignmentValues: selectedKnos,
|
|
144
|
+
};
|
|
145
|
+
};
|
|
103
146
|
const handleAssign = () => {
|
|
147
|
+
const { assignmentType, assignmentValue, assignmentValues } = getAssignmentPayload();
|
|
148
|
+
|
|
104
149
|
assignmentMutation.mutate({
|
|
105
150
|
tenantId: "dl.djb",
|
|
106
|
-
surveyorId: surveyor?.uuid,
|
|
107
|
-
assignmentType
|
|
108
|
-
assignmentValue
|
|
151
|
+
surveyorId: surveyor?.owner?.uuid,
|
|
152
|
+
assignmentType,
|
|
153
|
+
assignmentValue,
|
|
154
|
+
assignmentValues,
|
|
109
155
|
});
|
|
110
156
|
};
|
|
111
157
|
|
|
112
158
|
const handleSelectAll = () => {
|
|
159
|
+
setIsBulkSelection(true);
|
|
160
|
+
|
|
113
161
|
const pageKnos = tableData.map((item) => item.kno);
|
|
114
162
|
|
|
115
163
|
const allSelected = pageKnos.length > 0 && pageKnos.every((kno) => selectedKnos.includes(kno));
|
|
@@ -224,13 +272,6 @@ const AssignEkycModal = ({ surveyor, closeModal }) => {
|
|
|
224
272
|
<option value="APPROVED">Approved</option>
|
|
225
273
|
<option value="REJECTED">Rejected</option>
|
|
226
274
|
</select>
|
|
227
|
-
|
|
228
|
-
<select className="form-control" value={assignmentType} onChange={(e) => setAssignmentType(e.target.value)}>
|
|
229
|
-
<option value="KNO">KNO</option>
|
|
230
|
-
<option value="MRKEY">MR Key</option>
|
|
231
|
-
<option value="WARD">Ward</option>
|
|
232
|
-
<option value="ASSEMBLY">Assembly</option>
|
|
233
|
-
</select>
|
|
234
275
|
</div>
|
|
235
276
|
|
|
236
277
|
{/* Table */}
|
|
@@ -267,6 +308,7 @@ const AssignEkycModal = ({ surveyor, closeModal }) => {
|
|
|
267
308
|
}}
|
|
268
309
|
/>
|
|
269
310
|
</div>
|
|
311
|
+
{showToast && <Toast error={toastData.error} label={toastData.label} onClose={() => setShowToast(false)} />}
|
|
270
312
|
</Modal>
|
|
271
313
|
);
|
|
272
314
|
};
|
|
@@ -12,8 +12,8 @@ const SearchFormFieldsComponents = ({ searchFormState, controlSearchForm }) => {
|
|
|
12
12
|
{/* K NUMBER */}
|
|
13
13
|
<span className="mobile-input">
|
|
14
14
|
<Label className="flex-roww flex-gap-2">
|
|
15
|
-
{t("
|
|
16
|
-
<CustomTooltip message={t("
|
|
15
|
+
{t("EKYC_MOBILE_NUMBER") || "Mobile Number"}
|
|
16
|
+
<CustomTooltip message={t("EKYC_MOBILE_NUMBER_MESSAGE")} />
|
|
17
17
|
</Label>
|
|
18
18
|
|
|
19
19
|
<Controller
|
|
@@ -29,35 +29,53 @@ const SurveyorDetailsDashboard = () => {
|
|
|
29
29
|
return surveyorSearchResponse?.surveyors?.[0] || null;
|
|
30
30
|
}, [surveyorSearchResponse]);
|
|
31
31
|
|
|
32
|
-
const
|
|
32
|
+
const [currentPage, setCurrentPage] = useState(0);
|
|
33
|
+
const [pageSize, setPageSize] = useState(20);
|
|
34
|
+
const queryParams = {
|
|
35
|
+
tenantId: "dl.djb",
|
|
36
|
+
offset: currentPage * pageSize,
|
|
37
|
+
limit: pageSize,
|
|
38
|
+
surveyorId: surveyor?.owner?.uuid,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const { isFetching: isDashboardLoading, data: dashboardData = {} } = Digit.Hooks.ekyc.useEkycSurveyorDashboard({}, queryParams, {
|
|
42
|
+
enabled: !!queryParams.tenantId && !!queryParams.surveyorId,
|
|
43
|
+
keepPreviousData: true,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const knoColumns = useMemo(
|
|
33
47
|
() => [
|
|
34
48
|
{
|
|
35
|
-
Header:
|
|
49
|
+
Header: "KNO",
|
|
36
50
|
accessor: "kno",
|
|
37
51
|
},
|
|
38
52
|
{
|
|
39
|
-
Header:
|
|
40
|
-
accessor: "
|
|
53
|
+
Header: "Consumer Name",
|
|
54
|
+
accessor: (row) => `${row.firstName || ""} ${row.middleName || ""} ${row.lastName || ""}`.trim(),
|
|
55
|
+
id: "consumerName",
|
|
41
56
|
},
|
|
42
57
|
{
|
|
43
|
-
Header:
|
|
44
|
-
accessor: "
|
|
58
|
+
Header: "Zone",
|
|
59
|
+
accessor: "zoneName",
|
|
45
60
|
},
|
|
46
61
|
{
|
|
47
|
-
Header:
|
|
48
|
-
accessor: "
|
|
49
|
-
Cell: ({ value }) => <span className={`status-badge ${value?.toLowerCase() || ""}`}>{value}</span>,
|
|
62
|
+
Header: "Pincode",
|
|
63
|
+
accessor: "pincode",
|
|
50
64
|
},
|
|
51
65
|
{
|
|
52
|
-
Header:
|
|
53
|
-
accessor: "
|
|
66
|
+
Header: "Status",
|
|
67
|
+
accessor: "status",
|
|
68
|
+
Cell: ({ value }) => (
|
|
69
|
+
<span className={`status-badge ${value === "ACTIVE" ? "verified" : value === "PENDING" ? "pending" : "assigned"}`}>{value}</span>
|
|
70
|
+
),
|
|
54
71
|
},
|
|
55
72
|
{
|
|
56
|
-
Header:
|
|
57
|
-
accessor: "
|
|
73
|
+
Header: "eKYC Status",
|
|
74
|
+
accessor: "ekycStatus",
|
|
75
|
+
Cell: ({ value }) => value || "-",
|
|
58
76
|
},
|
|
59
77
|
],
|
|
60
|
-
[
|
|
78
|
+
[]
|
|
61
79
|
);
|
|
62
80
|
|
|
63
81
|
if (isLoading) {
|
|
@@ -71,24 +89,6 @@ const SurveyorDetailsDashboard = () => {
|
|
|
71
89
|
</Card>
|
|
72
90
|
);
|
|
73
91
|
}
|
|
74
|
-
const assignedKnos = [
|
|
75
|
-
{
|
|
76
|
-
kno: "123456789",
|
|
77
|
-
consumerName: "Rahul Sharma",
|
|
78
|
-
mobileNumber: "9876543210",
|
|
79
|
-
status: "Completed",
|
|
80
|
-
assignedDate: "01-06-2026",
|
|
81
|
-
completedDate: "02-06-2026",
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
kno: "123456790",
|
|
85
|
-
consumerName: "Amit Kumar",
|
|
86
|
-
mobileNumber: "9876543211",
|
|
87
|
-
status: "Pending",
|
|
88
|
-
assignedDate: "03-06-2026",
|
|
89
|
-
completedDate: "-",
|
|
90
|
-
},
|
|
91
|
-
];
|
|
92
92
|
|
|
93
93
|
const weeklyData = [
|
|
94
94
|
{ day: "Mon", completed: 4 },
|
|
@@ -118,11 +118,19 @@ const SurveyorDetailsDashboard = () => {
|
|
|
118
118
|
},
|
|
119
119
|
];
|
|
120
120
|
|
|
121
|
-
const StatCard = ({ title, value, type }) => (
|
|
121
|
+
const StatCard = ({ title, value, type, isLoading }) => (
|
|
122
122
|
<div className={`stat-card ${type}`}>
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
{isLoading ? (
|
|
124
|
+
<React.Fragment>
|
|
125
|
+
<div className="stat-title skeleton skeleton-text"></div>
|
|
126
|
+
<div className="stat-value skeleton skeleton-number"></div>
|
|
127
|
+
</React.Fragment>
|
|
128
|
+
) : (
|
|
129
|
+
<React.Fragment>
|
|
130
|
+
<div className="stat-title">{title}</div>
|
|
131
|
+
<div className="stat-value">{value}</div>
|
|
132
|
+
</React.Fragment>
|
|
133
|
+
)}
|
|
126
134
|
</div>
|
|
127
135
|
);
|
|
128
136
|
|
|
@@ -158,13 +166,10 @@ const SurveyorDetailsDashboard = () => {
|
|
|
158
166
|
|
|
159
167
|
{/* Stats */}
|
|
160
168
|
<div className="stats-wrapper">
|
|
161
|
-
<StatCard title={t("
|
|
162
|
-
|
|
163
|
-
<StatCard title={t("
|
|
164
|
-
|
|
165
|
-
<StatCard title={t("THIS_MONTH")} value={surveyor?.monthCompleted || 0} type="month" />
|
|
166
|
-
|
|
167
|
-
<StatCard title={t("PENDING_CASES")} value={surveyor?.pendingCases || 0} type="pending" />
|
|
169
|
+
<StatCard title={t("TOTAL_ASSIGNED")} value={dashboardData?.dashboardInfo?.total || 0} type="today" isLoading={isDashboardLoading} />
|
|
170
|
+
<StatCard title={t("COMPLETED")} value={dashboardData?.dashboardInfo?.completed || 0} type="week" isLoading={isDashboardLoading} />
|
|
171
|
+
<StatCard title={t("PENDING")} value={dashboardData?.dashboardInfo?.pending || 0} type="pending" isLoading={isDashboardLoading} />
|
|
172
|
+
<StatCard title={t("SUBMITTED")} value={dashboardData?.dashboardInfo?.submittedCount || 0} type="month" isLoading={isDashboardLoading} />
|
|
168
173
|
</div>
|
|
169
174
|
|
|
170
175
|
{/* Charts */}
|
|
@@ -242,18 +247,40 @@ const SurveyorDetailsDashboard = () => {
|
|
|
242
247
|
</div>
|
|
243
248
|
</div>
|
|
244
249
|
</div>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
250
|
+
<Card className="dashboard-card">
|
|
251
|
+
<Table
|
|
252
|
+
t={t}
|
|
253
|
+
tableTitle={t("ASSIGNED_KNOS")}
|
|
254
|
+
tableClass="ekycTable"
|
|
255
|
+
data={dashboardData?.dashboardInfo?.consumerList || []}
|
|
256
|
+
columns={knoColumns}
|
|
257
|
+
isLoading={isDashboardLoading}
|
|
258
|
+
totalRecords={dashboardData?.dashboardInfo?.total}
|
|
259
|
+
currentPage={currentPage}
|
|
260
|
+
pageSizeLimit={pageSize}
|
|
261
|
+
isPaginationRequired={true}
|
|
262
|
+
onNextPage={() => {
|
|
263
|
+
if (currentPage < (dashboardData?.dashboardInfo?.totalPages || 1) - 1) {
|
|
264
|
+
setCurrentPage((prev) => prev + 1);
|
|
265
|
+
}
|
|
266
|
+
}}
|
|
267
|
+
onPrevPage={() => {
|
|
268
|
+
if (currentPage > 0) {
|
|
269
|
+
setCurrentPage((prev) => prev - 1);
|
|
270
|
+
}
|
|
271
|
+
}}
|
|
272
|
+
onFirstPage={() => {
|
|
273
|
+
setCurrentPage(0);
|
|
274
|
+
}}
|
|
275
|
+
onLastPage={() => {
|
|
276
|
+
setCurrentPage(Math.max((dashboardData?.dashboardInfo?.totalPages || 1) - 1, 0));
|
|
277
|
+
}}
|
|
278
|
+
onPageSizeChange={(e) => {
|
|
279
|
+
setPageSize(Number(e.target.value));
|
|
280
|
+
setCurrentPage(0);
|
|
281
|
+
}}
|
|
282
|
+
/>
|
|
283
|
+
</Card>
|
|
257
284
|
{/* Actions */}
|
|
258
285
|
{(!roles.includes("EKYC_SURVEYOR") || roles.includes("EMPLOYEE")) && (
|
|
259
286
|
<ActionBar>
|