@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,264 +0,0 @@
|
|
|
1
|
-
import React, { useState, Fragment, useEffect } from "react";
|
|
2
|
-
import { useLocation } from "react-router-dom";
|
|
3
|
-
import { Toast, Loader, FormComposer } from "@djb25/digit-ui-react-components";
|
|
4
|
-
import { useTranslation } from "react-i18next";
|
|
5
|
-
import PropertyInfoConfig from "../config/PropertyInfoConfig";
|
|
6
|
-
|
|
7
|
-
const PropertyInfo = ({ config, onSelect, formData }) => {
|
|
8
|
-
const { t } = useTranslation();
|
|
9
|
-
const location = useLocation();
|
|
10
|
-
const flowState = location.state || {};
|
|
11
|
-
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
12
|
-
|
|
13
|
-
const queryParams = new URLSearchParams(location.search);
|
|
14
|
-
const urlKno = queryParams.get("kno");
|
|
15
|
-
const searchKno =
|
|
16
|
-
urlKno ||
|
|
17
|
-
flowState?.kNumber ||
|
|
18
|
-
flowState?.kno ||
|
|
19
|
-
formData?.kNumber ||
|
|
20
|
-
formData?.kno ||
|
|
21
|
-
sessionStorage.getItem("EKYC_K_NUMBER");
|
|
22
|
-
|
|
23
|
-
const { isLoading, data: searchData } = Digit.Hooks.ekyc.useSearchConnection(
|
|
24
|
-
{ tenantId, details: { kno: searchKno, fetchType: "PROPERTY" } },
|
|
25
|
-
{ enabled: !!searchKno, cacheTime: 0 }
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
const updateMutation = Digit.Hooks.ekyc.useEkycUpdate(tenantId);
|
|
29
|
-
|
|
30
|
-
const savedData = formData?.propertyDetails || {};
|
|
31
|
-
|
|
32
|
-
// 🔹 STATES
|
|
33
|
-
const [buildingImage, setBuildingImage] = useState(null);
|
|
34
|
-
const [buildingImageId, setBuildingImageId] = useState(savedData.buildingImageId || null);
|
|
35
|
-
const [toast, setToast] = useState(null);
|
|
36
|
-
const [isDataLoaded, setIsDataLoaded] = useState(false);
|
|
37
|
-
const [canSubmit, setCanSubmit] = useState(false);
|
|
38
|
-
|
|
39
|
-
const [defaultValues, setDefaultValues] = useState(() => ({
|
|
40
|
-
pidNumber: savedData.pidNumber || "",
|
|
41
|
-
propertyType: savedData.propertyType ? { name: savedData.propertyType } : null,
|
|
42
|
-
subPropertyCategory: savedData.subPropertyCategory ? { name: savedData.subPropertyCategory } : null,
|
|
43
|
-
noOfFloors: savedData.noOfFloors || "",
|
|
44
|
-
floorNo: savedData.floorNo || "",
|
|
45
|
-
noOfRooms: savedData.noOfRooms || "",
|
|
46
|
-
noOfBeds: savedData.noOfBeds || "",
|
|
47
|
-
dwellingUnits: savedData.dwellingUnits || "",
|
|
48
|
-
buildingImage: savedData.buildingImageId ? "Uploaded" : null,
|
|
49
|
-
}));
|
|
50
|
-
|
|
51
|
-
const [localFormData, setLocalFormData] = useState(defaultValues);
|
|
52
|
-
|
|
53
|
-
const extractApplicationData = (searchData) => {
|
|
54
|
-
if (!searchData) return null;
|
|
55
|
-
const reviewWrapper =
|
|
56
|
-
searchData?.applicationReviewInfo || searchData?.applicationReview || searchData;
|
|
57
|
-
const applicationData = (Array.isArray(reviewWrapper) ? reviewWrapper[0] : reviewWrapper) || {};
|
|
58
|
-
return applicationData?.newData || applicationData;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
const appData = extractApplicationData(searchData);
|
|
63
|
-
const rawData = appData || formData?.connectionDetails;
|
|
64
|
-
const propertyInfo = rawData?.propertyInfo || rawData?.propertyDetails || rawData || {};
|
|
65
|
-
|
|
66
|
-
if (propertyInfo && Object.keys(propertyInfo).length > 0 && !isDataLoaded) {
|
|
67
|
-
let propType = null;
|
|
68
|
-
let subPropCat = null;
|
|
69
|
-
|
|
70
|
-
if (propertyInfo.subPropertyCategory) {
|
|
71
|
-
const matchingType = [
|
|
72
|
-
{ name: "Residential" },
|
|
73
|
-
{ name: "Commercial" },
|
|
74
|
-
{ name: "Hotel" },
|
|
75
|
-
{ name: "Hospital" },
|
|
76
|
-
{ name: "Nursing Home" },
|
|
77
|
-
].find((type) => type.name.toLowerCase() === propertyInfo.subPropertyCategory.toLowerCase());
|
|
78
|
-
if (matchingType) propType = matchingType;
|
|
79
|
-
else propType = { name: propertyInfo.subPropertyCategory };
|
|
80
|
-
subPropCat = { name: propertyInfo.subPropertyCategory };
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (propertyInfo.propertyType) {
|
|
84
|
-
subPropCat = { name: propertyInfo.propertyType };
|
|
85
|
-
if (!propertyInfo.subPropertyCategory) propType = { name: propertyInfo.propertyType };
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const updatedDefaults = {
|
|
89
|
-
pidNumber: savedData.pidNumber || propertyInfo.pidNumber || "",
|
|
90
|
-
propertyType: savedData.propertyType ? { name: savedData.propertyType } : propType,
|
|
91
|
-
subPropertyCategory: savedData.subPropertyCategory
|
|
92
|
-
? { name: savedData.subPropertyCategory }
|
|
93
|
-
: subPropCat,
|
|
94
|
-
noOfFloors:
|
|
95
|
-
savedData.noOfFloors ||
|
|
96
|
-
(propertyInfo.numberOfFloors || propertyInfo.noOfFloor
|
|
97
|
-
? String(propertyInfo.numberOfFloors || propertyInfo.noOfFloor)
|
|
98
|
-
: ""),
|
|
99
|
-
floorNo: savedData.floorNo || propertyInfo.floorNo || "",
|
|
100
|
-
noOfRooms:
|
|
101
|
-
savedData.noOfRooms ||
|
|
102
|
-
(propertyInfo.numberOfRooms !== null && propertyInfo.numberOfRooms !== undefined
|
|
103
|
-
? String(propertyInfo.numberOfRooms)
|
|
104
|
-
: ""),
|
|
105
|
-
noOfBeds:
|
|
106
|
-
savedData.noOfBeds ||
|
|
107
|
-
(propertyInfo.numberOfBeds !== null && propertyInfo.numberOfBeds !== undefined
|
|
108
|
-
? String(propertyInfo.numberOfBeds)
|
|
109
|
-
: ""),
|
|
110
|
-
dwellingUnits:
|
|
111
|
-
savedData.dwellingUnits ||
|
|
112
|
-
(propertyInfo.numberOfDwellingUnits !== null && propertyInfo.numberOfDwellingUnits !== undefined
|
|
113
|
-
? String(propertyInfo.numberOfDwellingUnits)
|
|
114
|
-
: ""),
|
|
115
|
-
buildingImage: savedData.buildingImageId || propertyInfo.buildingImageFileStoreId || null,
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
setDefaultValues(updatedDefaults);
|
|
119
|
-
setLocalFormData(updatedDefaults);
|
|
120
|
-
if (updatedDefaults.buildingImage) {
|
|
121
|
-
setBuildingImageId(updatedDefaults.buildingImage);
|
|
122
|
-
}
|
|
123
|
-
setIsDataLoaded(true);
|
|
124
|
-
}
|
|
125
|
-
}, [searchData, formData?.connectionDetails, isDataLoaded]);
|
|
126
|
-
|
|
127
|
-
// 🔹 FILE UPLOAD
|
|
128
|
-
const handleUpload = async (e, onChange) => {
|
|
129
|
-
const file = e.target.files[0];
|
|
130
|
-
if (!file) return;
|
|
131
|
-
|
|
132
|
-
if (file.size > 2000000) {
|
|
133
|
-
setToast({ type: "error", message: t("Max size 2MB exceeded") });
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
try {
|
|
138
|
-
const res = await Digit.UploadServices.Filestorage("EKYC", file, tenantId);
|
|
139
|
-
const fileStoreId = res?.data?.files?.[0]?.fileStoreId;
|
|
140
|
-
|
|
141
|
-
if (fileStoreId) {
|
|
142
|
-
onChange(file.name);
|
|
143
|
-
setBuildingImageId(fileStoreId);
|
|
144
|
-
|
|
145
|
-
const reader = new FileReader();
|
|
146
|
-
reader.onloadend = () => setBuildingImage(reader.result);
|
|
147
|
-
reader.readAsDataURL(file);
|
|
148
|
-
|
|
149
|
-
setToast({ type: "success", message: t("Upload successful") });
|
|
150
|
-
}
|
|
151
|
-
} catch {
|
|
152
|
-
setToast({ type: "error", message: t("Upload failed") });
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const onFormValueChange = (setValue, data) => {
|
|
157
|
-
// Check if propertyType changed to re-evaluate mandatory validation or conditional visibility
|
|
158
|
-
const propertyTypeChanged =
|
|
159
|
-
(data?.propertyType?.name || data?.propertyType) !==
|
|
160
|
-
(localFormData?.propertyType?.name || localFormData?.propertyType);
|
|
161
|
-
|
|
162
|
-
if (propertyTypeChanged) {
|
|
163
|
-
setLocalFormData((prev) => ({
|
|
164
|
-
...prev,
|
|
165
|
-
...data,
|
|
166
|
-
}));
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// Determine validation
|
|
170
|
-
const propTypeVal = data?.propertyType;
|
|
171
|
-
const subPropCatVal = data?.subPropertyCategory;
|
|
172
|
-
const noOfFloorsVal = data?.noOfFloors;
|
|
173
|
-
const buildingImgId = buildingImageId || data?.buildingImage;
|
|
174
|
-
const noOfRoomsVal = data?.noOfRooms;
|
|
175
|
-
const noOfBedsVal = data?.noOfBeds;
|
|
176
|
-
|
|
177
|
-
let valid = true;
|
|
178
|
-
if (!propTypeVal) valid = false;
|
|
179
|
-
if (!subPropCatVal) valid = false;
|
|
180
|
-
if (!noOfFloorsVal || Number(noOfFloorsVal) < 1) valid = false;
|
|
181
|
-
if (!buildingImgId) valid = false;
|
|
182
|
-
|
|
183
|
-
if (propTypeVal?.name === "Hotel" && !noOfRoomsVal) valid = false;
|
|
184
|
-
if (
|
|
185
|
-
(propTypeVal?.name === "Hospital" || propTypeVal?.name === "Nursing Home") &&
|
|
186
|
-
!noOfBedsVal
|
|
187
|
-
)
|
|
188
|
-
valid = false;
|
|
189
|
-
|
|
190
|
-
if (valid !== canSubmit) {
|
|
191
|
-
setCanSubmit(valid);
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
const onSubmit = async (data) => {
|
|
196
|
-
const submitData = {
|
|
197
|
-
pidNumber: data.pidNumber,
|
|
198
|
-
propertyType: data.propertyType?.name || data.propertyType,
|
|
199
|
-
subPropertyCategory: data.subPropertyCategory?.name || data.subPropertyCategory,
|
|
200
|
-
noOfFloors: data.noOfFloors,
|
|
201
|
-
floorNo: data.floorNo,
|
|
202
|
-
noOfRooms: data.noOfRooms,
|
|
203
|
-
noOfBeds: data.noOfBeds,
|
|
204
|
-
dwellingUnits: data.dwellingUnits,
|
|
205
|
-
buildingImageId: buildingImageId,
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
try {
|
|
209
|
-
await updateMutation.mutateAsync({
|
|
210
|
-
RequestInfo: {},
|
|
211
|
-
updateType: "PROPERTY",
|
|
212
|
-
kno: searchKno,
|
|
213
|
-
...submitData,
|
|
214
|
-
});
|
|
215
|
-
setToast({ type: "success", message: t("Property details updated successfully!") });
|
|
216
|
-
onSelect(config.key, submitData);
|
|
217
|
-
} catch (error) {
|
|
218
|
-
setToast({ type: "error", message: t("Failed to update property details") });
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
if (isLoading) {
|
|
223
|
-
return <Loader />;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
const Config = PropertyInfoConfig(
|
|
227
|
-
t,
|
|
228
|
-
localFormData,
|
|
229
|
-
handleUpload,
|
|
230
|
-
buildingImage,
|
|
231
|
-
buildingImageId,
|
|
232
|
-
setBuildingImage,
|
|
233
|
-
setBuildingImageId
|
|
234
|
-
);
|
|
235
|
-
|
|
236
|
-
return (
|
|
237
|
-
<Fragment>
|
|
238
|
-
<FormComposer
|
|
239
|
-
key={isDataLoaded ? "loaded" : "loading"}
|
|
240
|
-
isDisabled={!canSubmit}
|
|
241
|
-
label={t("ES_COMMON_CONTINUE")}
|
|
242
|
-
config={Config.map((item) => ({
|
|
243
|
-
...item,
|
|
244
|
-
isCollapsible: true,
|
|
245
|
-
isDefaultOpen: true,
|
|
246
|
-
}))}
|
|
247
|
-
onSubmit={onSubmit}
|
|
248
|
-
defaultValues={defaultValues}
|
|
249
|
-
onFormValueChange={onFormValueChange}
|
|
250
|
-
noCard={false}
|
|
251
|
-
submitInForm={true}
|
|
252
|
-
/>
|
|
253
|
-
{toast && (
|
|
254
|
-
<Toast
|
|
255
|
-
error={toast.type === "error"}
|
|
256
|
-
label={toast.message}
|
|
257
|
-
onClose={() => setToast(null)}
|
|
258
|
-
/>
|
|
259
|
-
)}
|
|
260
|
-
</Fragment>
|
|
261
|
-
);
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
export default PropertyInfo;
|