@djb25/digit-ui-module-ekyc 1.0.25 → 1.0.26
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 +1443 -643
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
- package/src/components/AadhaarVerification.js +245 -308
- package/src/components/DesktopInbox.js +1 -1
- package/src/components/MeterDetails.js +227 -263
- package/src/components/PropertyInfo.js +176 -215
- package/src/components/Review.js +70 -13
- package/src/config/AadhaarVerificationConfig.js +367 -0
- package/src/config/MeterDetailsConfig.js +297 -0
- package/src/config/PropertyInfoConfig.js +145 -0
- package/src/config/config.js +1 -0
- package/src/hook/useInboxTableConfig.js +1 -1
- package/src/pages/citizen/Inbox.js +14 -4
- package/src/pages/employee/ConsumerDetails.js +82 -24
- package/src/pages/employee/EKYCForm.js +1 -1
- package/src/pages/employee/Inbox.js +2 -0
package/dist/index.modern.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useRef, useEffect, useMemo, useState, createContext, isValidElement, cloneElement, createElement, useContext, useCallback, useReducer, Fragment } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { useHistory, Link, useLocation, useParams, useRouteMatch, Switch, Route, Redirect } from 'react-router-dom';
|
|
4
|
-
import { PersonIcon, EmployeeModuleCard, Loader, Card, InboxLinks, Table, HomeIcon, TextInput, Header, SubmitBar, DetailsCard, FilterForm, FilterFormField, Dropdown, Label, CustomTooltip, CardLabelError, InboxComposer, EditIcon, DeleteIcon, CardHeader, CardText, LabelFieldPair, CardLabel, ActionBar, Modal, Toast, RadioButtons, CardSubHeader, StatusTable, Row, GenericFileIcon, CheckBox,
|
|
4
|
+
import { PersonIcon, EmployeeModuleCard, Loader, Card, InboxLinks, Table, HomeIcon, TextInput, Header, SubmitBar, DetailsCard, FilterForm, FilterFormField, Dropdown, Label, CustomTooltip, CardLabelError, InboxComposer, EditIcon, DeleteIcon, CardHeader, CardText, LabelFieldPair, CardLabel, ActionBar, Modal, Toast, RadioButtons, CardSubHeader, StatusTable, Row, GenericFileIcon, CheckBox, Menu, LinkButton, UploadFile, FormComposer, VerticalTimeline, Close, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, LayoutWrapper, ModuleLinksView, CitizenHomeCard, DocumentIcon } from '@djb25/digit-ui-react-components';
|
|
5
5
|
import * as Chartjs from 'chart.js/auto';
|
|
6
6
|
import Chartjs__default, { Chart } from 'chart.js/auto';
|
|
7
7
|
import { FaUsers, FaCheckCircle, FaClock, FaExclamationTriangle, FaUserTie, FaChartLine, FaSearch, FaArrowRight, FaMapMarkedAlt, FaArrowLeft } from 'react-icons/fa';
|
|
@@ -319,8 +319,8 @@ const DesktopInbox = ({
|
|
|
319
319
|
Cell: ({
|
|
320
320
|
row
|
|
321
321
|
}) => {
|
|
322
|
-
var _row$original5;
|
|
323
|
-
const ekycStatus = ((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : _row$original5.ekycstatus) || "NA";
|
|
322
|
+
var _row$original5, _row$original6;
|
|
323
|
+
const ekycStatus = ((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : _row$original5.ekycStatus) || ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.ekycstatus) || "NA";
|
|
324
324
|
return /*#__PURE__*/React.createElement("span", {
|
|
325
325
|
className: `ekyc-status-tag ${ekycStatus}`
|
|
326
326
|
}, t(`${ekycStatus}`));
|
|
@@ -331,8 +331,8 @@ const DesktopInbox = ({
|
|
|
331
331
|
Cell: ({
|
|
332
332
|
row
|
|
333
333
|
}) => {
|
|
334
|
-
var _row$
|
|
335
|
-
const kno = ((_row$
|
|
334
|
+
var _row$original7, _row$original8;
|
|
335
|
+
const kno = ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.kno) || ((_row$original8 = row.original) === null || _row$original8 === void 0 ? void 0 : _row$original8.applicationNumber) || "NA";
|
|
336
336
|
return /*#__PURE__*/React.createElement("span", {
|
|
337
337
|
className: "ekyc-application-link",
|
|
338
338
|
style: {
|
|
@@ -1845,8 +1845,8 @@ const useInboxTableConfig = ({
|
|
|
1845
1845
|
Cell: ({
|
|
1846
1846
|
row
|
|
1847
1847
|
}) => {
|
|
1848
|
-
var _row$original5;
|
|
1849
|
-
const ekycStatus = ((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : _row$original5.ekycstatus) || "NA";
|
|
1848
|
+
var _row$original5, _row$original6;
|
|
1849
|
+
const ekycStatus = ((_row$original5 = row.original) === null || _row$original5 === void 0 ? void 0 : _row$original5.ekycStatus) || ((_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.ekycstatus) || "NA";
|
|
1850
1850
|
return /*#__PURE__*/React.createElement("span", {
|
|
1851
1851
|
className: `ekyc-status-tag ${ekycStatus}`
|
|
1852
1852
|
}, t(`${ekycStatus}`));
|
|
@@ -1857,8 +1857,8 @@ const useInboxTableConfig = ({
|
|
|
1857
1857
|
Cell: ({
|
|
1858
1858
|
row
|
|
1859
1859
|
}) => {
|
|
1860
|
-
var _row$
|
|
1861
|
-
const kno = ((_row$
|
|
1860
|
+
var _row$original7, _row$original8;
|
|
1861
|
+
const kno = ((_row$original7 = row.original) === null || _row$original7 === void 0 ? void 0 : _row$original7.kno) || ((_row$original8 = row.original) === null || _row$original8 === void 0 ? void 0 : _row$original8.applicationNumber) || "NA";
|
|
1862
1862
|
return /*#__PURE__*/React.createElement("span", {
|
|
1863
1863
|
className: "ekyc-application-link",
|
|
1864
1864
|
style: {
|
|
@@ -2281,7 +2281,7 @@ const Inbox = ({
|
|
|
2281
2281
|
return (sourceData || []).map(item => {
|
|
2282
2282
|
const isSearchItem = !!item.connectionDetails;
|
|
2283
2283
|
if (isSearchItem) {
|
|
2284
|
-
var _item$propertyInfo, _item$propertyInfo2, _item$connectionDetai, _item$propertyInfo3, _item$connectionDetai2, _item$connectionDetai3;
|
|
2284
|
+
var _item$propertyInfo, _item$propertyInfo2, _item$connectionDetai, _item$propertyInfo3, _item$connectionDetai2, _item$connectionDetai3, _item$connectionDetai4, _item$connectionDetai5;
|
|
2285
2285
|
return {
|
|
2286
2286
|
applicationNo: ((_item$propertyInfo = item.propertyInfo) === null || _item$propertyInfo === void 0 ? void 0 : _item$propertyInfo.kno) || "",
|
|
2287
2287
|
connectionNo: ((_item$propertyInfo2 = item.propertyInfo) === null || _item$propertyInfo2 === void 0 ? void 0 : _item$propertyInfo2.kno) || "",
|
|
@@ -2289,6 +2289,7 @@ const Inbox = ({
|
|
|
2289
2289
|
applicationNumber: ((_item$propertyInfo3 = item.propertyInfo) === null || _item$propertyInfo3 === void 0 ? void 0 : _item$propertyInfo3.kno) || "",
|
|
2290
2290
|
citizenName: ((_item$connectionDetai2 = item.connectionDetails) === null || _item$connectionDetai2 === void 0 ? void 0 : _item$connectionDetai2.consumerName) || "",
|
|
2291
2291
|
status: ((_item$connectionDetai3 = item.connectionDetails) === null || _item$connectionDetai3 === void 0 ? void 0 : _item$connectionDetai3.statusflag) || "",
|
|
2292
|
+
ekycStatus: ((_item$connectionDetai4 = item.connectionDetails) === null || _item$connectionDetai4 === void 0 ? void 0 : _item$connectionDetai4.ekycStatus) || ((_item$connectionDetai5 = item.connectionDetails) === null || _item$connectionDetai5 === void 0 ? void 0 : _item$connectionDetai5.ekycstatus) || item.ekycStatus || item.ekycstatus || "NA",
|
|
2292
2293
|
sla: 0
|
|
2293
2294
|
};
|
|
2294
2295
|
}
|
|
@@ -2301,6 +2302,7 @@ const Inbox = ({
|
|
|
2301
2302
|
applicationNumber: item.kno || item.applicationNumber || "",
|
|
2302
2303
|
citizenName: fullName || item.consumerName || item.citizenName || "",
|
|
2303
2304
|
status: item.status || "",
|
|
2305
|
+
ekycStatus: item.ekycStatus || item.ekycstatus || "NA",
|
|
2304
2306
|
sla: item.sla ?? 0
|
|
2305
2307
|
};
|
|
2306
2308
|
});
|
|
@@ -3216,7 +3218,6 @@ const boolToYesNo = (value, t) => {
|
|
|
3216
3218
|
if (value === false || value === "false" || String(value).toLowerCase() === "no") return t("CORE_COMMON_NO");
|
|
3217
3219
|
if (value === "true") return t("CORE_COMMON_YES");
|
|
3218
3220
|
if (value === "false") return t("CORE_COMMON_NO");
|
|
3219
|
-
return "N/A";
|
|
3220
3221
|
};
|
|
3221
3222
|
const extractReviewData = (searchData, flowState) => {
|
|
3222
3223
|
const rawData = searchData && Object.keys(searchData).length > 0 ? searchData : (flowState === null || flowState === void 0 ? void 0 : flowState.reviewData) || {};
|
|
@@ -3365,6 +3366,17 @@ const Review = () => {
|
|
|
3365
3366
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
3366
3367
|
const [showPreview, setShowPreview] = useState(false);
|
|
3367
3368
|
const [previewUrl, setPreviewUrl] = useState("");
|
|
3369
|
+
const [showOptions, setShowOptions] = useState(false);
|
|
3370
|
+
const [showToast, setShowToast] = useState(false);
|
|
3371
|
+
const [toastData, setToastData] = useState({
|
|
3372
|
+
error: false,
|
|
3373
|
+
label: ""
|
|
3374
|
+
});
|
|
3375
|
+
const options = [{
|
|
3376
|
+
action: t("Approve")
|
|
3377
|
+
}, {
|
|
3378
|
+
action: t("Reject")
|
|
3379
|
+
}];
|
|
3368
3380
|
const flowState = location.state || {};
|
|
3369
3381
|
const {
|
|
3370
3382
|
edits = {}
|
|
@@ -3643,6 +3655,7 @@ const Review = () => {
|
|
|
3643
3655
|
apiId: "Rainmaker",
|
|
3644
3656
|
ver: "1.0",
|
|
3645
3657
|
msgId: "message-id",
|
|
3658
|
+
tenantId: tenantId,
|
|
3646
3659
|
authToken: (_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.access_token
|
|
3647
3660
|
},
|
|
3648
3661
|
kno: activeKno,
|
|
@@ -3670,6 +3683,7 @@ const Review = () => {
|
|
|
3670
3683
|
apiId: "Rainmaker",
|
|
3671
3684
|
ver: "1.0",
|
|
3672
3685
|
msgId: "message-id",
|
|
3686
|
+
tenantId: tenantId,
|
|
3673
3687
|
authToken: (_Digit$UserService$ge4 = Digit.UserService.getUser()) === null || _Digit$UserService$ge4 === void 0 ? void 0 : _Digit$UserService$ge4.access_token
|
|
3674
3688
|
},
|
|
3675
3689
|
kno: activeKno,
|
|
@@ -3681,13 +3695,23 @@ const Review = () => {
|
|
|
3681
3695
|
try {
|
|
3682
3696
|
const result = await workflowMutation.mutateAsync(payload);
|
|
3683
3697
|
if (result) {
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3698
|
+
setToastData({
|
|
3699
|
+
error: false,
|
|
3700
|
+
label: t("EKYC_APPLICATION_APPROVE_SUCCESSFUL") || "Application Approved Successfully"
|
|
3687
3701
|
});
|
|
3702
|
+
setShowToast(true);
|
|
3703
|
+
setTimeout(() => {
|
|
3704
|
+
history.push("/digit-ui/employee/ekyc/inbox");
|
|
3705
|
+
}, 2000);
|
|
3688
3706
|
}
|
|
3689
3707
|
} catch (err) {
|
|
3708
|
+
var _err$response, _err$response$data;
|
|
3690
3709
|
console.error("Approve Error:", err);
|
|
3710
|
+
setToastData({
|
|
3711
|
+
error: true,
|
|
3712
|
+
label: (err === null || err === void 0 ? void 0 : err.message) || (err === null || err === void 0 ? void 0 : (_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : _err$response$data.message) || "Approve Error"
|
|
3713
|
+
});
|
|
3714
|
+
setShowToast(true);
|
|
3691
3715
|
}
|
|
3692
3716
|
};
|
|
3693
3717
|
const handleViewDocument = fileStoreId => {
|
|
@@ -3696,6 +3720,14 @@ const Review = () => {
|
|
|
3696
3720
|
setPreviewUrl(documentUrl);
|
|
3697
3721
|
setShowPreview(true);
|
|
3698
3722
|
};
|
|
3723
|
+
const handleMenuSelect = option => {
|
|
3724
|
+
setShowOptions(false);
|
|
3725
|
+
if (option.action === t("Approve")) {
|
|
3726
|
+
handleApprove();
|
|
3727
|
+
} else if (option.action === t("Reject")) {
|
|
3728
|
+
handleReject();
|
|
3729
|
+
}
|
|
3730
|
+
};
|
|
3699
3731
|
if (isSearchLoading || isSubmitting) return /*#__PURE__*/React.createElement(Loader, null);
|
|
3700
3732
|
const baseUrl = "/digit-ui/employee/ekyc";
|
|
3701
3733
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Card, {
|
|
@@ -3706,9 +3738,11 @@ const Review = () => {
|
|
|
3706
3738
|
newData: connectionData,
|
|
3707
3739
|
oldData: oldDataRaw === null || oldDataRaw === void 0 ? void 0 : oldDataRaw.connection,
|
|
3708
3740
|
t: t,
|
|
3709
|
-
jumpTo: `${baseUrl}/consumer-details`,
|
|
3741
|
+
jumpTo: `${baseUrl}/consumer-details?kno=${kno}`,
|
|
3710
3742
|
state: {
|
|
3711
3743
|
...flowState,
|
|
3744
|
+
kNumber: kno,
|
|
3745
|
+
kno,
|
|
3712
3746
|
reviewData: searchData,
|
|
3713
3747
|
edits
|
|
3714
3748
|
}
|
|
@@ -3718,9 +3752,11 @@ const Review = () => {
|
|
|
3718
3752
|
newData: addressData,
|
|
3719
3753
|
oldData: oldDataRaw === null || oldDataRaw === void 0 ? void 0 : oldDataRaw.address,
|
|
3720
3754
|
t: t,
|
|
3721
|
-
jumpTo: `${baseUrl}/address-details`,
|
|
3755
|
+
jumpTo: `${baseUrl}/address-details?kno=${kno}`,
|
|
3722
3756
|
state: {
|
|
3723
3757
|
...flowState,
|
|
3758
|
+
kNumber: kno,
|
|
3759
|
+
kno,
|
|
3724
3760
|
reviewData: searchData,
|
|
3725
3761
|
edits
|
|
3726
3762
|
}
|
|
@@ -3730,9 +3766,11 @@ const Review = () => {
|
|
|
3730
3766
|
newData: propertyData,
|
|
3731
3767
|
oldData: oldDataRaw === null || oldDataRaw === void 0 ? void 0 : oldDataRaw.property,
|
|
3732
3768
|
t: t,
|
|
3733
|
-
jumpTo: `${baseUrl}/property-info`,
|
|
3769
|
+
jumpTo: `${baseUrl}/property-info?kno=${kno}`,
|
|
3734
3770
|
state: {
|
|
3735
3771
|
...flowState,
|
|
3772
|
+
kNumber: kno,
|
|
3773
|
+
kno,
|
|
3736
3774
|
reviewData: searchData,
|
|
3737
3775
|
edits
|
|
3738
3776
|
}
|
|
@@ -3742,9 +3780,11 @@ const Review = () => {
|
|
|
3742
3780
|
newData: meterData,
|
|
3743
3781
|
oldData: oldDataRaw === null || oldDataRaw === void 0 ? void 0 : oldDataRaw.meter,
|
|
3744
3782
|
t: t,
|
|
3745
|
-
jumpTo: `${baseUrl}/meter-details`,
|
|
3783
|
+
jumpTo: `${baseUrl}/meter-details?kno=${kno}`,
|
|
3746
3784
|
state: {
|
|
3747
3785
|
...flowState,
|
|
3786
|
+
kNumber: kno,
|
|
3787
|
+
kno,
|
|
3748
3788
|
reviewData: searchData,
|
|
3749
3789
|
edits
|
|
3750
3790
|
}
|
|
@@ -3822,13 +3862,18 @@ const Review = () => {
|
|
|
3822
3862
|
onChange: handleDeclaration,
|
|
3823
3863
|
checked: agree
|
|
3824
3864
|
})), /*#__PURE__*/React.createElement(ActionBar, null, /*#__PURE__*/React.createElement(SubmitBar, {
|
|
3825
|
-
label: t("
|
|
3826
|
-
onSubmit:
|
|
3827
|
-
disabled: !agree
|
|
3828
|
-
}), /*#__PURE__*/React.createElement(SubmitBar, {
|
|
3829
|
-
label: t("EKYC_APPROVE"),
|
|
3830
|
-
onSubmit: handleApprove,
|
|
3865
|
+
label: t("TAKE_ACTION_FOR_APPROVE_REJECT"),
|
|
3866
|
+
onSubmit: () => setShowOptions(prev => !prev),
|
|
3831
3867
|
disabled: !agree
|
|
3868
|
+
}), showOptions && /*#__PURE__*/React.createElement(Menu, {
|
|
3869
|
+
options: options,
|
|
3870
|
+
optionKey: "action",
|
|
3871
|
+
t: t,
|
|
3872
|
+
onSelect: handleMenuSelect,
|
|
3873
|
+
style: {
|
|
3874
|
+
color: "#FFFFFF",
|
|
3875
|
+
fontSize: "18px"
|
|
3876
|
+
}
|
|
3832
3877
|
}))), showPreview && /*#__PURE__*/React.createElement("div", {
|
|
3833
3878
|
style: {
|
|
3834
3879
|
position: "fixed",
|
|
@@ -3893,7 +3938,346 @@ const Review = () => {
|
|
|
3893
3938
|
}, /*#__PURE__*/React.createElement("p", null, t("EKYC_DOCUMENT_PREVIEW_NOT_AVAILABLE")), /*#__PURE__*/React.createElement(LinkButton, {
|
|
3894
3939
|
label: t("EKYC_OPEN_IN_NEW_TAB"),
|
|
3895
3940
|
onClick: () => window.open(previewUrl, "_blank")
|
|
3896
|
-
}))))
|
|
3941
|
+
})))), showToast && /*#__PURE__*/React.createElement(Toast, {
|
|
3942
|
+
error: toastData.error,
|
|
3943
|
+
label: toastData.label,
|
|
3944
|
+
onClose: () => setShowToast(false)
|
|
3945
|
+
}));
|
|
3946
|
+
};
|
|
3947
|
+
|
|
3948
|
+
const AadhaarVerificationConfig = (t, formData = {}, uploadFile, setDocumentId, documentId) => {
|
|
3949
|
+
var _formData$consumerTyp, _formData$occupantTyp;
|
|
3950
|
+
const consumerType = (formData === null || formData === void 0 ? void 0 : (_formData$consumerTyp = formData.consumerType) === null || _formData$consumerTyp === void 0 ? void 0 : _formData$consumerTyp.name) || (formData === null || formData === void 0 ? void 0 : formData.consumerType);
|
|
3951
|
+
const occupantType = (formData === null || formData === void 0 ? void 0 : (_formData$occupantTyp = formData.occupantType) === null || _formData$occupantTyp === void 0 ? void 0 : _formData$occupantTyp.name) || (formData === null || formData === void 0 ? void 0 : formData.occupantType);
|
|
3952
|
+
const informantIsConsumer = (formData === null || formData === void 0 ? void 0 : formData.informantIsConsumer) ?? true;
|
|
3953
|
+
const fields = [{
|
|
3954
|
+
label: t("Consumer Type"),
|
|
3955
|
+
isMandatory: true,
|
|
3956
|
+
type: "custom",
|
|
3957
|
+
key: "consumerType",
|
|
3958
|
+
populators: {
|
|
3959
|
+
name: "consumerType",
|
|
3960
|
+
component: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
3961
|
+
option: [{
|
|
3962
|
+
name: "Individual"
|
|
3963
|
+
}, {
|
|
3964
|
+
name: "Govt"
|
|
3965
|
+
}, {
|
|
3966
|
+
name: "Company_Society_Org"
|
|
3967
|
+
}],
|
|
3968
|
+
optionKey: "name",
|
|
3969
|
+
selected: props.value,
|
|
3970
|
+
select: props.onChange
|
|
3971
|
+
})
|
|
3972
|
+
}
|
|
3973
|
+
}, {
|
|
3974
|
+
label: t("Occupant Type"),
|
|
3975
|
+
isMandatory: true,
|
|
3976
|
+
type: "custom",
|
|
3977
|
+
key: "occupantType",
|
|
3978
|
+
populators: {
|
|
3979
|
+
name: "occupantType",
|
|
3980
|
+
component: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
3981
|
+
option: [{
|
|
3982
|
+
name: "Self"
|
|
3983
|
+
}, {
|
|
3984
|
+
name: "Tenanted"
|
|
3985
|
+
}],
|
|
3986
|
+
optionKey: "name",
|
|
3987
|
+
selected: props.value,
|
|
3988
|
+
select: props.onChange
|
|
3989
|
+
})
|
|
3990
|
+
}
|
|
3991
|
+
}, {
|
|
3992
|
+
label: t("Category Type"),
|
|
3993
|
+
isMandatory: true,
|
|
3994
|
+
type: "custom",
|
|
3995
|
+
key: "categoryType",
|
|
3996
|
+
populators: {
|
|
3997
|
+
name: "categoryType",
|
|
3998
|
+
component: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
3999
|
+
option: [{
|
|
4000
|
+
name: "Bulk"
|
|
4001
|
+
}, {
|
|
4002
|
+
name: "Non-Bulk"
|
|
4003
|
+
}],
|
|
4004
|
+
optionKey: "name",
|
|
4005
|
+
selected: props.value,
|
|
4006
|
+
select: props.onChange
|
|
4007
|
+
})
|
|
4008
|
+
}
|
|
4009
|
+
}, {
|
|
4010
|
+
label: t("First Name"),
|
|
4011
|
+
isMandatory: true,
|
|
4012
|
+
type: "text",
|
|
4013
|
+
populators: {
|
|
4014
|
+
name: "firstName",
|
|
4015
|
+
validation: {
|
|
4016
|
+
required: true
|
|
4017
|
+
}
|
|
4018
|
+
}
|
|
4019
|
+
}, {
|
|
4020
|
+
label: t("Middle Name"),
|
|
4021
|
+
isMandatory: false,
|
|
4022
|
+
type: "text",
|
|
4023
|
+
populators: {
|
|
4024
|
+
name: "middleName"
|
|
4025
|
+
}
|
|
4026
|
+
}, {
|
|
4027
|
+
label: t("Last Name"),
|
|
4028
|
+
isMandatory: false,
|
|
4029
|
+
type: "text",
|
|
4030
|
+
populators: {
|
|
4031
|
+
name: "lastName"
|
|
4032
|
+
}
|
|
4033
|
+
}, {
|
|
4034
|
+
label: t("Gender"),
|
|
4035
|
+
isMandatory: false,
|
|
4036
|
+
type: "custom",
|
|
4037
|
+
key: "gender",
|
|
4038
|
+
populators: {
|
|
4039
|
+
name: "gender",
|
|
4040
|
+
component: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
4041
|
+
option: [{
|
|
4042
|
+
name: "Male"
|
|
4043
|
+
}, {
|
|
4044
|
+
name: "Female"
|
|
4045
|
+
}, {
|
|
4046
|
+
name: "Others"
|
|
4047
|
+
}, {
|
|
4048
|
+
name: "Not prefer to say"
|
|
4049
|
+
}],
|
|
4050
|
+
optionKey: "name",
|
|
4051
|
+
selected: props.value,
|
|
4052
|
+
select: props.onChange
|
|
4053
|
+
})
|
|
4054
|
+
}
|
|
4055
|
+
}, {
|
|
4056
|
+
label: t("Parent/Spouse Name"),
|
|
4057
|
+
isMandatory: false,
|
|
4058
|
+
type: "text",
|
|
4059
|
+
populators: {
|
|
4060
|
+
name: "parentSpouseName"
|
|
4061
|
+
}
|
|
4062
|
+
}, {
|
|
4063
|
+
label: t("Mobile"),
|
|
4064
|
+
isMandatory: true,
|
|
4065
|
+
type: "text",
|
|
4066
|
+
populators: {
|
|
4067
|
+
name: "mobile",
|
|
4068
|
+
validation: {
|
|
4069
|
+
required: true,
|
|
4070
|
+
pattern: /^[6-9]\d{9}$/
|
|
4071
|
+
},
|
|
4072
|
+
error: t("Invalid mobile number")
|
|
4073
|
+
}
|
|
4074
|
+
}, {
|
|
4075
|
+
label: t("WhatsApp"),
|
|
4076
|
+
isMandatory: false,
|
|
4077
|
+
type: "text",
|
|
4078
|
+
populators: {
|
|
4079
|
+
name: "whatsapp"
|
|
4080
|
+
}
|
|
4081
|
+
}, {
|
|
4082
|
+
label: t("Email"),
|
|
4083
|
+
isMandatory: false,
|
|
4084
|
+
type: "text",
|
|
4085
|
+
populators: {
|
|
4086
|
+
name: "email",
|
|
4087
|
+
validation: {
|
|
4088
|
+
pattern: /^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+$/
|
|
4089
|
+
},
|
|
4090
|
+
error: t("Invalid email address")
|
|
4091
|
+
}
|
|
4092
|
+
}, {
|
|
4093
|
+
label: t("No. of Residents"),
|
|
4094
|
+
isMandatory: true,
|
|
4095
|
+
type: "text",
|
|
4096
|
+
populators: {
|
|
4097
|
+
name: "residents",
|
|
4098
|
+
validation: {
|
|
4099
|
+
required: true,
|
|
4100
|
+
min: 1
|
|
4101
|
+
}
|
|
4102
|
+
}
|
|
4103
|
+
}, {
|
|
4104
|
+
label: t("Type of Identity"),
|
|
4105
|
+
isMandatory: true,
|
|
4106
|
+
type: "custom",
|
|
4107
|
+
key: "identityType",
|
|
4108
|
+
populators: {
|
|
4109
|
+
name: "identityType",
|
|
4110
|
+
component: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
4111
|
+
option: [{
|
|
4112
|
+
name: "Aadhaar Card"
|
|
4113
|
+
}, {
|
|
4114
|
+
name: "Driving License"
|
|
4115
|
+
}, {
|
|
4116
|
+
name: "Passport"
|
|
4117
|
+
}, {
|
|
4118
|
+
name: "Voter ID"
|
|
4119
|
+
}],
|
|
4120
|
+
optionKey: "name",
|
|
4121
|
+
selected: props.value,
|
|
4122
|
+
select: props.onChange
|
|
4123
|
+
})
|
|
4124
|
+
}
|
|
4125
|
+
}, {
|
|
4126
|
+
label: t("Proof of Identity"),
|
|
4127
|
+
isMandatory: false,
|
|
4128
|
+
type: "custom",
|
|
4129
|
+
key: "idFile",
|
|
4130
|
+
populators: {
|
|
4131
|
+
name: "idFile",
|
|
4132
|
+
component: props => /*#__PURE__*/React.createElement(UploadFile, {
|
|
4133
|
+
onUpload: e => uploadFile(e, props.onChange),
|
|
4134
|
+
onDelete: () => {
|
|
4135
|
+
props.onChange(null);
|
|
4136
|
+
setDocumentId(null);
|
|
4137
|
+
},
|
|
4138
|
+
message: props.value ? t("Uploaded") : t("No file selected")
|
|
4139
|
+
})
|
|
4140
|
+
}
|
|
4141
|
+
}, {
|
|
4142
|
+
label: t("Document Number"),
|
|
4143
|
+
isMandatory: false,
|
|
4144
|
+
type: "text",
|
|
4145
|
+
populators: {
|
|
4146
|
+
name: "documentNumber"
|
|
4147
|
+
}
|
|
4148
|
+
}, {
|
|
4149
|
+
label: t("Informant Is Consumer"),
|
|
4150
|
+
isMandatory: false,
|
|
4151
|
+
type: "custom",
|
|
4152
|
+
key: "informantIsConsumer",
|
|
4153
|
+
populators: {
|
|
4154
|
+
name: "informantIsConsumer",
|
|
4155
|
+
component: props => /*#__PURE__*/React.createElement(CheckBox, {
|
|
4156
|
+
label: t("Yes, the informant is the consumer"),
|
|
4157
|
+
checked: props.value ?? true,
|
|
4158
|
+
onChange: e => props.onChange(e.target.checked)
|
|
4159
|
+
})
|
|
4160
|
+
}
|
|
4161
|
+
}];
|
|
4162
|
+
if (!informantIsConsumer) {
|
|
4163
|
+
fields.push({
|
|
4164
|
+
label: t("Informant Name"),
|
|
4165
|
+
isMandatory: false,
|
|
4166
|
+
type: "text",
|
|
4167
|
+
populators: {
|
|
4168
|
+
name: "informantName"
|
|
4169
|
+
}
|
|
4170
|
+
}, {
|
|
4171
|
+
label: t("Informant Relation"),
|
|
4172
|
+
isMandatory: false,
|
|
4173
|
+
type: "text",
|
|
4174
|
+
populators: {
|
|
4175
|
+
name: "informantRelation"
|
|
4176
|
+
}
|
|
4177
|
+
});
|
|
4178
|
+
}
|
|
4179
|
+
if (occupantType === "Tenanted") {
|
|
4180
|
+
fields.push({
|
|
4181
|
+
label: t("Document Proof"),
|
|
4182
|
+
isMandatory: false,
|
|
4183
|
+
type: "custom",
|
|
4184
|
+
key: "documentProof",
|
|
4185
|
+
populators: {
|
|
4186
|
+
name: "documentProof",
|
|
4187
|
+
component: props => /*#__PURE__*/React.createElement(UploadFile, {
|
|
4188
|
+
onUpload: e => uploadFile(e, props.onChange),
|
|
4189
|
+
onDelete: () => {
|
|
4190
|
+
props.onChange(null);
|
|
4191
|
+
setDocumentId(null);
|
|
4192
|
+
},
|
|
4193
|
+
message: props.value ? t("Uploaded") : t("No file selected")
|
|
4194
|
+
})
|
|
4195
|
+
}
|
|
4196
|
+
});
|
|
4197
|
+
if (!documentId) {
|
|
4198
|
+
fields.push({
|
|
4199
|
+
label: t("Owner Mobile"),
|
|
4200
|
+
isMandatory: true,
|
|
4201
|
+
type: "text",
|
|
4202
|
+
populators: {
|
|
4203
|
+
name: "ownerMobile",
|
|
4204
|
+
validation: {
|
|
4205
|
+
required: true,
|
|
4206
|
+
pattern: /^[6-9]\d{9}$/
|
|
4207
|
+
}
|
|
4208
|
+
}
|
|
4209
|
+
}, {
|
|
4210
|
+
label: t("Tenant Verification"),
|
|
4211
|
+
isMandatory: false,
|
|
4212
|
+
type: "text",
|
|
4213
|
+
populators: {
|
|
4214
|
+
name: "tenantVerification"
|
|
4215
|
+
}
|
|
4216
|
+
});
|
|
4217
|
+
}
|
|
4218
|
+
}
|
|
4219
|
+
if (consumerType === "Govt") {
|
|
4220
|
+
fields.push({
|
|
4221
|
+
label: t("Designation"),
|
|
4222
|
+
isMandatory: false,
|
|
4223
|
+
type: "text",
|
|
4224
|
+
populators: {
|
|
4225
|
+
name: "designation"
|
|
4226
|
+
}
|
|
4227
|
+
}, {
|
|
4228
|
+
label: t("Department"),
|
|
4229
|
+
isMandatory: false,
|
|
4230
|
+
type: "text",
|
|
4231
|
+
populators: {
|
|
4232
|
+
name: "department"
|
|
4233
|
+
}
|
|
4234
|
+
}, {
|
|
4235
|
+
label: t("Employee ID"),
|
|
4236
|
+
isMandatory: false,
|
|
4237
|
+
type: "text",
|
|
4238
|
+
populators: {
|
|
4239
|
+
name: "employeeId"
|
|
4240
|
+
}
|
|
4241
|
+
});
|
|
4242
|
+
}
|
|
4243
|
+
if (consumerType === "Company_Society_Org") {
|
|
4244
|
+
fields.push({
|
|
4245
|
+
label: t("Entity Name"),
|
|
4246
|
+
isMandatory: false,
|
|
4247
|
+
type: "text",
|
|
4248
|
+
populators: {
|
|
4249
|
+
name: "entityName"
|
|
4250
|
+
}
|
|
4251
|
+
}, {
|
|
4252
|
+
label: t("Contact Person"),
|
|
4253
|
+
isMandatory: false,
|
|
4254
|
+
type: "text",
|
|
4255
|
+
populators: {
|
|
4256
|
+
name: "contactPerson"
|
|
4257
|
+
}
|
|
4258
|
+
});
|
|
4259
|
+
}
|
|
4260
|
+
fields.push({
|
|
4261
|
+
label: t("Consent"),
|
|
4262
|
+
isMandatory: true,
|
|
4263
|
+
type: "custom",
|
|
4264
|
+
key: "consent",
|
|
4265
|
+
populators: {
|
|
4266
|
+
name: "consent",
|
|
4267
|
+
validation: {
|
|
4268
|
+
required: true
|
|
4269
|
+
},
|
|
4270
|
+
component: props => /*#__PURE__*/React.createElement(CheckBox, {
|
|
4271
|
+
label: t("I hereby consent to verify my Aadhaar details."),
|
|
4272
|
+
checked: props.value ?? false,
|
|
4273
|
+
onChange: e => props.onChange(e.target.checked)
|
|
4274
|
+
})
|
|
4275
|
+
}
|
|
4276
|
+
});
|
|
4277
|
+
return [{
|
|
4278
|
+
head: t("EKYC_CONSUMER_CONNECTION"),
|
|
4279
|
+
body: fields
|
|
4280
|
+
}];
|
|
3897
4281
|
};
|
|
3898
4282
|
|
|
3899
4283
|
const AadhaarVerification = ({
|
|
@@ -3901,17 +4285,23 @@ const AadhaarVerification = ({
|
|
|
3901
4285
|
onSelect,
|
|
3902
4286
|
formData
|
|
3903
4287
|
}) => {
|
|
4288
|
+
const {
|
|
4289
|
+
t
|
|
4290
|
+
} = useTranslation();
|
|
3904
4291
|
const location = useLocation();
|
|
3905
4292
|
const flowState = location.state || {};
|
|
3906
4293
|
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
3907
|
-
const
|
|
4294
|
+
const queryParams = new URLSearchParams(location.search);
|
|
4295
|
+
const urlKno = queryParams.get("kno");
|
|
4296
|
+
const searchKno = urlKno || (flowState === null || flowState === void 0 ? void 0 : flowState.kNumber) || (flowState === null || flowState === void 0 ? void 0 : flowState.kno) || (formData === null || formData === void 0 ? void 0 : formData.kNumber) || (formData === null || formData === void 0 ? void 0 : formData.kno) || sessionStorage.getItem("EKYC_K_NUMBER") || "";
|
|
3908
4297
|
const {
|
|
3909
4298
|
isLoading,
|
|
3910
4299
|
data: searchData
|
|
3911
4300
|
} = Digit.Hooks.ekyc.useSearchConnection({
|
|
3912
4301
|
tenantId,
|
|
3913
4302
|
details: {
|
|
3914
|
-
kno: searchKno
|
|
4303
|
+
kno: searchKno,
|
|
4304
|
+
fetchType: "CONNECTION"
|
|
3915
4305
|
}
|
|
3916
4306
|
}, {
|
|
3917
4307
|
enabled: !!searchKno,
|
|
@@ -3919,297 +4309,277 @@ const AadhaarVerification = ({
|
|
|
3919
4309
|
});
|
|
3920
4310
|
const updateMutation = Digit.Hooks.ekyc.useEkycUpdate(tenantId);
|
|
3921
4311
|
const savedData = (formData === null || formData === void 0 ? void 0 : formData.aadhaarVerification) || {};
|
|
3922
|
-
const [kno, setKno] = useState(savedData.kno || searchKno || "");
|
|
3923
|
-
const [consumerType, setConsumerType] = useState(savedData.consumerType ? {
|
|
3924
|
-
name: savedData.consumerType
|
|
3925
|
-
} : null);
|
|
3926
|
-
const [occupantType, setOccupantType] = useState(savedData.occupantType ? {
|
|
3927
|
-
name: savedData.occupantType
|
|
3928
|
-
} : null);
|
|
3929
|
-
const [categoryType, setCategoryType] = useState(savedData.categoryType ? {
|
|
3930
|
-
name: savedData.categoryType
|
|
3931
|
-
} : null);
|
|
3932
|
-
const [consumerName, setConsumerName] = useState(savedData.consumerName || "");
|
|
3933
|
-
const [firstName, setFirstName] = useState(savedData.firstName || "");
|
|
3934
|
-
const [middleName, setMiddleName] = useState(savedData.middleName || "");
|
|
3935
|
-
const [lastName, setLastName] = useState(savedData.lastName || "");
|
|
3936
|
-
const [gender, setGender] = useState(savedData.gender ? {
|
|
3937
|
-
name: savedData.gender
|
|
3938
|
-
} : null);
|
|
3939
|
-
const [parentSpouseName, setParentSpouseName] = useState(savedData.parentSpouseName || "");
|
|
3940
|
-
const [relation, setRelation] = useState(savedData.relation || "");
|
|
3941
|
-
const [mobile, setMobile] = useState(savedData.mobile || "");
|
|
3942
|
-
const [whatsapp, setWhatsapp] = useState(savedData.whatsapp || "");
|
|
3943
|
-
const [email, setEmail] = useState(savedData.email || "");
|
|
3944
|
-
const [residents, setResidents] = useState(savedData.residents || "");
|
|
3945
|
-
const [documentProof, setDocumentProof] = useState(savedData.documentProof || null);
|
|
3946
4312
|
const [documentId, setDocumentId] = useState(savedData.documentId || null);
|
|
3947
|
-
const [
|
|
3948
|
-
const [tenantVerification, setTenantVerification] = useState(savedData.tenantVerification || "");
|
|
3949
|
-
const [designation, setDesignation] = useState(savedData.designation || "");
|
|
3950
|
-
const [department, setDepartment] = useState(savedData.department || "");
|
|
3951
|
-
const [employeeId, setEmployeeId] = useState(savedData.employeeId || "");
|
|
3952
|
-
const [landline, setLandline] = useState(savedData.landline || "");
|
|
3953
|
-
const [entityRelation, setEntityRelation] = useState(savedData.entityRelation || "");
|
|
3954
|
-
const [contactPerson, setContactPerson] = useState(savedData.contactPerson || "");
|
|
3955
|
-
const [entityName, setEntityName] = useState(savedData.entityName || "");
|
|
3956
|
-
const [idProof, setIdProof] = useState(savedData.idProof ? {
|
|
3957
|
-
name: savedData.idProof
|
|
3958
|
-
} : null);
|
|
3959
|
-
const [idNumber, setIdNumber] = useState(savedData.idNumber || "");
|
|
3960
|
-
const [documentNumber, setDocumentNumber] = useState(savedData.documentNumber || "");
|
|
3961
|
-
const [identityType, setIdentityType] = useState(savedData.identityType ? {
|
|
3962
|
-
name: savedData.identityType
|
|
3963
|
-
} : null);
|
|
3964
|
-
const [idFile, setIdFile] = useState(savedData.idFile || null);
|
|
3965
|
-
const [consent, setConsent] = useState(savedData.consent || false);
|
|
3966
|
-
const [informantIsConsumer, setInformantIsConsumer] = useState(savedData.informantIsConsumer ?? true);
|
|
3967
|
-
const [informantName, setInformantName] = useState(savedData.informantName || "");
|
|
3968
|
-
const [informantRelation, setInformantRelation] = useState(savedData.informantRelation || "");
|
|
4313
|
+
const [documentProof, setDocumentProof] = useState(savedData.documentProof || null);
|
|
3969
4314
|
const [toast, setToast] = useState(null);
|
|
4315
|
+
const [isDataLoaded, setIsDataLoaded] = useState(false);
|
|
4316
|
+
const [canSubmit, setCanSubmit] = useState(false);
|
|
4317
|
+
const [defaultValues, setDefaultValues] = useState(() => ({
|
|
4318
|
+
kno: savedData.kno || searchKno || "",
|
|
4319
|
+
consumerType: savedData.consumerType ? {
|
|
4320
|
+
name: savedData.consumerType
|
|
4321
|
+
} : null,
|
|
4322
|
+
occupantType: savedData.occupantType ? {
|
|
4323
|
+
name: savedData.occupantType
|
|
4324
|
+
} : null,
|
|
4325
|
+
categoryType: savedData.categoryType ? {
|
|
4326
|
+
name: savedData.categoryType
|
|
4327
|
+
} : null,
|
|
4328
|
+
firstName: savedData.firstName || "",
|
|
4329
|
+
middleName: savedData.middleName || "",
|
|
4330
|
+
lastName: savedData.lastName || "",
|
|
4331
|
+
gender: savedData.gender ? {
|
|
4332
|
+
name: savedData.gender
|
|
4333
|
+
} : null,
|
|
4334
|
+
parentSpouseName: savedData.parentSpouseName || "",
|
|
4335
|
+
mobile: savedData.mobile || "",
|
|
4336
|
+
whatsapp: savedData.whatsapp || "",
|
|
4337
|
+
email: savedData.email || "",
|
|
4338
|
+
residents: savedData.residents || "",
|
|
4339
|
+
identityType: savedData.identityType ? {
|
|
4340
|
+
name: savedData.identityType
|
|
4341
|
+
} : null,
|
|
4342
|
+
documentNumber: savedData.documentNumber || "",
|
|
4343
|
+
informantIsConsumer: savedData.informantIsConsumer ?? true,
|
|
4344
|
+
informantName: savedData.informantName || "",
|
|
4345
|
+
informantRelation: savedData.informantRelation || "",
|
|
4346
|
+
documentId: savedData.documentId || null,
|
|
4347
|
+
documentProof: savedData.documentProof || null,
|
|
4348
|
+
idFile: savedData.idFile || null,
|
|
4349
|
+
ownerMobile: savedData.ownerMobile || "",
|
|
4350
|
+
tenantVerification: savedData.tenantVerification || "",
|
|
4351
|
+
designation: savedData.designation || "",
|
|
4352
|
+
department: savedData.department || "",
|
|
4353
|
+
employeeId: savedData.employeeId || "",
|
|
4354
|
+
entityName: savedData.entityName || "",
|
|
4355
|
+
contactPerson: savedData.contactPerson || "",
|
|
4356
|
+
consent: savedData.consent || false
|
|
4357
|
+
}));
|
|
4358
|
+
const [localFormData, setLocalFormData] = useState(defaultValues);
|
|
4359
|
+
const extractApplicationData = searchData => {
|
|
4360
|
+
if (!searchData) return null;
|
|
4361
|
+
const reviewWrapper = (searchData === null || searchData === void 0 ? void 0 : searchData.applicationReviewInfo) || (searchData === null || searchData === void 0 ? void 0 : searchData.applicationReview) || searchData;
|
|
4362
|
+
const applicationData = (Array.isArray(reviewWrapper) ? reviewWrapper[0] : reviewWrapper) || {};
|
|
4363
|
+
return (applicationData === null || applicationData === void 0 ? void 0 : applicationData.newData) || applicationData;
|
|
4364
|
+
};
|
|
3970
4365
|
useEffect(() => {
|
|
3971
|
-
const
|
|
4366
|
+
const appData = extractApplicationData(searchData);
|
|
4367
|
+
const rawData = appData || (formData === null || formData === void 0 ? void 0 : formData.connectionDetails);
|
|
3972
4368
|
const details = (rawData === null || rawData === void 0 ? void 0 : rawData.connectionDetails) || rawData || {};
|
|
3973
4369
|
const addrDetails = (rawData === null || rawData === void 0 ? void 0 : rawData.addressDetails) || {};
|
|
3974
|
-
if (details && Object.keys(details).length > 0 && !
|
|
3975
|
-
|
|
4370
|
+
if (details && Object.keys(details).length > 0 && !isDataLoaded) {
|
|
4371
|
+
let fName = "";
|
|
4372
|
+
let mName = "";
|
|
4373
|
+
let lName = "";
|
|
3976
4374
|
if (details.firstName) {
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
4375
|
+
fName = details.firstName;
|
|
4376
|
+
mName = details.middleName || "";
|
|
4377
|
+
lName = details.lastName || "";
|
|
3980
4378
|
} else if (details.consumerName) {
|
|
3981
|
-
setConsumerName(details.consumerName);
|
|
3982
4379
|
const parts = details.consumerName.trim().split(/\s+/);
|
|
3983
|
-
|
|
3984
|
-
if (parts.length === 2)
|
|
4380
|
+
fName = parts[0] || "";
|
|
4381
|
+
if (parts.length === 2) lName = parts[1];
|
|
3985
4382
|
if (parts.length > 2) {
|
|
3986
|
-
|
|
3987
|
-
|
|
4383
|
+
mName = parts.slice(1, -1).join(" ");
|
|
4384
|
+
lName = parts[parts.length - 1];
|
|
3988
4385
|
}
|
|
3989
4386
|
}
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4387
|
+
const updatedDefaults = {
|
|
4388
|
+
kno: savedData.kno || searchKno || "",
|
|
4389
|
+
consumerType: savedData.consumerType ? {
|
|
4390
|
+
name: savedData.consumerType
|
|
4391
|
+
} : details.consumerType ? {
|
|
4392
|
+
name: details.consumerType
|
|
4393
|
+
} : null,
|
|
4394
|
+
occupantType: savedData.occupantType ? {
|
|
4395
|
+
name: savedData.occupantType
|
|
4396
|
+
} : details.occupantType ? {
|
|
4397
|
+
name: details.occupantType
|
|
4398
|
+
} : null,
|
|
4399
|
+
categoryType: savedData.categoryType ? {
|
|
4400
|
+
name: savedData.categoryType
|
|
4401
|
+
} : null,
|
|
4402
|
+
firstName: savedData.firstName || fName,
|
|
4403
|
+
middleName: savedData.middleName || mName,
|
|
4404
|
+
lastName: savedData.lastName || lName,
|
|
4405
|
+
gender: savedData.gender ? {
|
|
4406
|
+
name: savedData.gender
|
|
4407
|
+
} : details.gender ? {
|
|
4408
|
+
name: details.gender
|
|
4409
|
+
} : null,
|
|
4410
|
+
parentSpouseName: savedData.parentSpouseName || details.parentSpouse || "",
|
|
4411
|
+
mobile: savedData.mobile || details.phoneNumber || addrDetails.mobileNo || "",
|
|
4412
|
+
whatsapp: savedData.whatsapp || addrDetails.whatsappNo || "",
|
|
4413
|
+
email: savedData.email || details.email || addrDetails.email || "",
|
|
4414
|
+
residents: savedData.residents || (addrDetails.noOfPerson ? String(addrDetails.noOfPerson) : ""),
|
|
4415
|
+
identityType: savedData.identityType ? {
|
|
4416
|
+
name: savedData.identityType
|
|
4417
|
+
} : null,
|
|
4418
|
+
documentNumber: savedData.documentNumber || "",
|
|
4419
|
+
informantIsConsumer: savedData.informantIsConsumer ?? true,
|
|
4420
|
+
informantName: savedData.informantName || details.informantName || "",
|
|
4421
|
+
informantRelation: savedData.informantRelation || details.informantRelation || "",
|
|
4422
|
+
documentId: savedData.documentId || details.documentNumber || null,
|
|
4423
|
+
documentProof: savedData.documentProof || null,
|
|
4424
|
+
idFile: savedData.idFile || null,
|
|
4425
|
+
ownerMobile: savedData.ownerMobile || "",
|
|
4426
|
+
tenantVerification: savedData.tenantVerification || "",
|
|
4427
|
+
designation: savedData.designation || "",
|
|
4428
|
+
department: savedData.department || "",
|
|
4429
|
+
employeeId: savedData.employeeId || "",
|
|
4430
|
+
entityName: savedData.entityName || "",
|
|
4431
|
+
contactPerson: savedData.contactPerson || "",
|
|
4432
|
+
consent: savedData.consent || false
|
|
4433
|
+
};
|
|
4434
|
+
setDefaultValues(updatedDefaults);
|
|
4435
|
+
setLocalFormData(updatedDefaults);
|
|
4436
|
+
if (updatedDefaults.documentId) {
|
|
4437
|
+
setDocumentId(updatedDefaults.documentId);
|
|
4438
|
+
}
|
|
4439
|
+
if (updatedDefaults.documentProof) {
|
|
4440
|
+
setDocumentProof(updatedDefaults.documentProof);
|
|
4007
4441
|
}
|
|
4008
|
-
|
|
4009
|
-
if (details.informantRelation) setInformantRelation(details.informantRelation);
|
|
4442
|
+
setIsDataLoaded(true);
|
|
4010
4443
|
}
|
|
4011
|
-
}, [searchData, formData === null || formData === void 0 ? void 0 : formData.connectionDetails,
|
|
4012
|
-
const
|
|
4013
|
-
name: "Individual"
|
|
4014
|
-
}, {
|
|
4015
|
-
name: "Govt"
|
|
4016
|
-
}, {
|
|
4017
|
-
name: "Company_Society_Org"
|
|
4018
|
-
}];
|
|
4019
|
-
const occupantOptions = [{
|
|
4020
|
-
name: "Self"
|
|
4021
|
-
}, {
|
|
4022
|
-
name: "Tenanted"
|
|
4023
|
-
}];
|
|
4024
|
-
const genderOptions = [{
|
|
4025
|
-
name: "Male"
|
|
4026
|
-
}, {
|
|
4027
|
-
name: "Female"
|
|
4028
|
-
}, {
|
|
4029
|
-
name: "Others"
|
|
4030
|
-
}, {
|
|
4031
|
-
name: "Not prefer to say"
|
|
4032
|
-
}];
|
|
4033
|
-
const identityTypeOptions = [{
|
|
4034
|
-
name: "Aadhaar Card"
|
|
4035
|
-
}, {
|
|
4036
|
-
name: "Driving License"
|
|
4037
|
-
}, {
|
|
4038
|
-
name: "Passport"
|
|
4039
|
-
}, {
|
|
4040
|
-
name: "Voter ID"
|
|
4041
|
-
}];
|
|
4042
|
-
const uploadFile = async (e, setter, idSetter) => {
|
|
4444
|
+
}, [searchData, formData === null || formData === void 0 ? void 0 : formData.connectionDetails, isDataLoaded]);
|
|
4445
|
+
const handleUploadProof = async (e, onChange) => {
|
|
4043
4446
|
const file = e.target.files[0];
|
|
4044
4447
|
if (!file) return;
|
|
4448
|
+
if (file.size > 2000000) {
|
|
4449
|
+
setToast({
|
|
4450
|
+
type: "error",
|
|
4451
|
+
message: t("Max size 2MB exceeded")
|
|
4452
|
+
});
|
|
4453
|
+
return;
|
|
4454
|
+
}
|
|
4045
4455
|
try {
|
|
4046
4456
|
var _res$data, _res$data$files, _res$data$files$;
|
|
4047
|
-
const res = await Digit.UploadServices.Filestorage("EKYC", file);
|
|
4048
|
-
const
|
|
4049
|
-
if (
|
|
4050
|
-
|
|
4051
|
-
|
|
4457
|
+
const res = await Digit.UploadServices.Filestorage("EKYC", file, tenantId);
|
|
4458
|
+
const fileStoreId = res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$files = _res$data.files) === null || _res$data$files === void 0 ? void 0 : (_res$data$files$ = _res$data$files[0]) === null || _res$data$files$ === void 0 ? void 0 : _res$data$files$.fileStoreId;
|
|
4459
|
+
if (fileStoreId) {
|
|
4460
|
+
onChange(file.name);
|
|
4461
|
+
setDocumentProof(file.name);
|
|
4462
|
+
setDocumentId(fileStoreId);
|
|
4463
|
+
setToast({
|
|
4464
|
+
type: "success",
|
|
4465
|
+
message: t("Upload successful")
|
|
4466
|
+
});
|
|
4052
4467
|
}
|
|
4053
4468
|
} catch {
|
|
4054
4469
|
setToast({
|
|
4055
4470
|
type: "error",
|
|
4056
|
-
message: "Upload failed"
|
|
4471
|
+
message: t("Upload failed")
|
|
4057
4472
|
});
|
|
4058
4473
|
}
|
|
4059
4474
|
};
|
|
4060
|
-
const
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
if (
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4475
|
+
const onFormValueChange = (setValue, data) => {
|
|
4476
|
+
var _data$consumerType, _localFormData$consum, _data$occupantType, _localFormData$occupa;
|
|
4477
|
+
const consumerTypeChanged = ((data === null || data === void 0 ? void 0 : (_data$consumerType = data.consumerType) === null || _data$consumerType === void 0 ? void 0 : _data$consumerType.name) || (data === null || data === void 0 ? void 0 : data.consumerType)) !== ((localFormData === null || localFormData === void 0 ? void 0 : (_localFormData$consum = localFormData.consumerType) === null || _localFormData$consum === void 0 ? void 0 : _localFormData$consum.name) || (localFormData === null || localFormData === void 0 ? void 0 : localFormData.consumerType));
|
|
4478
|
+
const occupantTypeChanged = ((data === null || data === void 0 ? void 0 : (_data$occupantType = data.occupantType) === null || _data$occupantType === void 0 ? void 0 : _data$occupantType.name) || (data === null || data === void 0 ? void 0 : data.occupantType)) !== ((localFormData === null || localFormData === void 0 ? void 0 : (_localFormData$occupa = localFormData.occupantType) === null || _localFormData$occupa === void 0 ? void 0 : _localFormData$occupa.name) || (localFormData === null || localFormData === void 0 ? void 0 : localFormData.occupantType));
|
|
4479
|
+
const informantIsConsumerChanged = (data === null || data === void 0 ? void 0 : data.informantIsConsumer) !== (localFormData === null || localFormData === void 0 ? void 0 : localFormData.informantIsConsumer);
|
|
4480
|
+
if (consumerTypeChanged || occupantTypeChanged || informantIsConsumerChanged) {
|
|
4481
|
+
setLocalFormData(prev => ({
|
|
4482
|
+
...prev,
|
|
4483
|
+
...data
|
|
4484
|
+
}));
|
|
4485
|
+
}
|
|
4486
|
+
const knoVal = (data === null || data === void 0 ? void 0 : data.kno) || searchKno;
|
|
4487
|
+
const consumerTypeVal = data === null || data === void 0 ? void 0 : data.consumerType;
|
|
4488
|
+
const occupantTypeVal = data === null || data === void 0 ? void 0 : data.occupantType;
|
|
4489
|
+
const categoryTypeVal = data === null || data === void 0 ? void 0 : data.categoryType;
|
|
4490
|
+
const firstNameVal = data === null || data === void 0 ? void 0 : data.firstName;
|
|
4491
|
+
const mobileVal = data === null || data === void 0 ? void 0 : data.mobile;
|
|
4492
|
+
const residentsVal = data === null || data === void 0 ? void 0 : data.residents;
|
|
4493
|
+
const consentVal = data === null || data === void 0 ? void 0 : data.consent;
|
|
4494
|
+
const docId = (data === null || data === void 0 ? void 0 : data.documentId) || documentId;
|
|
4495
|
+
const ownerMobileVal = data === null || data === void 0 ? void 0 : data.ownerMobile;
|
|
4496
|
+
let valid = true;
|
|
4497
|
+
if (!knoVal) valid = false;
|
|
4498
|
+
if (!consumerTypeVal) valid = false;
|
|
4499
|
+
if (!occupantTypeVal) valid = false;
|
|
4500
|
+
if (!categoryTypeVal) valid = false;
|
|
4501
|
+
if (!firstNameVal) valid = false;
|
|
4502
|
+
if (!mobileVal || !/^[6-9]\d{9}$/.test(mobileVal)) valid = false;
|
|
4503
|
+
if (!residentsVal || Number(residentsVal) <= 0) valid = false;
|
|
4504
|
+
if ((occupantTypeVal === null || occupantTypeVal === void 0 ? void 0 : occupantTypeVal.name) === "Tenanted" && !docId && !ownerMobileVal) valid = false;
|
|
4505
|
+
if (!consentVal) valid = false;
|
|
4506
|
+
if (valid !== canSubmit) {
|
|
4507
|
+
setCanSubmit(valid);
|
|
4508
|
+
}
|
|
4070
4509
|
};
|
|
4071
|
-
const
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
firstName,
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4510
|
+
const onSubmit = async data => {
|
|
4511
|
+
var _data$consumerType2, _data$occupantType2, _data$categoryType, _data$gender, _data$identityType;
|
|
4512
|
+
const submitData = {
|
|
4513
|
+
kno: data.kno || searchKno,
|
|
4514
|
+
consumerType: ((_data$consumerType2 = data.consumerType) === null || _data$consumerType2 === void 0 ? void 0 : _data$consumerType2.name) || data.consumerType,
|
|
4515
|
+
occupantType: ((_data$occupantType2 = data.occupantType) === null || _data$occupantType2 === void 0 ? void 0 : _data$occupantType2.name) || data.occupantType,
|
|
4516
|
+
categoryType: ((_data$categoryType = data.categoryType) === null || _data$categoryType === void 0 ? void 0 : _data$categoryType.name) || data.categoryType,
|
|
4517
|
+
consumerName: data.consumerName || `${data.firstName || ""} ${data.middleName || ""} ${data.lastName || ""}`.trim(),
|
|
4518
|
+
firstName: data.firstName,
|
|
4519
|
+
middleName: data.middleName,
|
|
4520
|
+
lastName: data.lastName,
|
|
4521
|
+
gender: ((_data$gender = data.gender) === null || _data$gender === void 0 ? void 0 : _data$gender.name) || data.gender,
|
|
4522
|
+
parentSpouseName: data.parentSpouseName,
|
|
4523
|
+
relation: data.relation || savedData.relation || "",
|
|
4524
|
+
mobile: data.mobile,
|
|
4525
|
+
whatsapp: data.whatsapp,
|
|
4526
|
+
email: data.email,
|
|
4527
|
+
residents: data.residents,
|
|
4528
|
+
documentId: documentId,
|
|
4529
|
+
documentProof: documentProof,
|
|
4530
|
+
ownerMobile: data.ownerMobile,
|
|
4531
|
+
tenantVerification: data.tenantVerification,
|
|
4532
|
+
designation: data.designation,
|
|
4533
|
+
department: data.department,
|
|
4534
|
+
employeeId: data.employeeId,
|
|
4535
|
+
landline: data.landline || savedData.landline || "",
|
|
4536
|
+
entityRelation: data.entityRelation || savedData.entityRelation || "",
|
|
4537
|
+
contactPerson: data.contactPerson,
|
|
4538
|
+
entityName: data.entityName,
|
|
4539
|
+
idProof: ((_data$identityType = data.identityType) === null || _data$identityType === void 0 ? void 0 : _data$identityType.name) || data.identityType,
|
|
4540
|
+
idNumber: data.documentNumber,
|
|
4541
|
+
consent: data.consent,
|
|
4542
|
+
informantIsConsumer: data.informantIsConsumer ?? true,
|
|
4543
|
+
informantName: data.informantName,
|
|
4544
|
+
informantRelation: data.informantRelation
|
|
4104
4545
|
};
|
|
4105
4546
|
try {
|
|
4106
4547
|
await updateMutation.mutateAsync({
|
|
4107
4548
|
RequestInfo: {},
|
|
4108
4549
|
updateType: "CONSUMER",
|
|
4109
|
-
...
|
|
4550
|
+
...submitData
|
|
4110
4551
|
});
|
|
4111
4552
|
setToast({
|
|
4112
4553
|
type: "success",
|
|
4113
|
-
message: "Data updated successfully!"
|
|
4554
|
+
message: t("Data updated successfully!")
|
|
4114
4555
|
});
|
|
4115
|
-
onSelect(config.key,
|
|
4556
|
+
onSelect(config.key, submitData);
|
|
4116
4557
|
} catch (error) {
|
|
4117
4558
|
setToast({
|
|
4118
4559
|
type: "error",
|
|
4119
|
-
message: "Failed to update consumer details"
|
|
4560
|
+
message: t("Failed to update consumer details")
|
|
4120
4561
|
});
|
|
4121
4562
|
}
|
|
4122
4563
|
};
|
|
4123
4564
|
if (isLoading) {
|
|
4124
4565
|
return /*#__PURE__*/React.createElement(Loader, null);
|
|
4125
4566
|
}
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
isDisabled: !
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "First Name *"), /*#__PURE__*/React.createElement(TextInput, {
|
|
4143
|
-
value: firstName,
|
|
4144
|
-
onChange: e => setFirstName(e.target.value)
|
|
4145
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Middle Name"), /*#__PURE__*/React.createElement(TextInput, {
|
|
4146
|
-
value: middleName,
|
|
4147
|
-
onChange: e => setMiddleName(e.target.value)
|
|
4148
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Last Name"), /*#__PURE__*/React.createElement(TextInput, {
|
|
4149
|
-
value: lastName,
|
|
4150
|
-
onChange: e => setLastName(e.target.value)
|
|
4151
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Gender"), /*#__PURE__*/React.createElement(Dropdown, {
|
|
4152
|
-
option: genderOptions,
|
|
4153
|
-
selected: gender,
|
|
4154
|
-
select: setGender
|
|
4155
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Parent/Spouse Name "), /*#__PURE__*/React.createElement(TextInput, {
|
|
4156
|
-
value: parentSpouseName,
|
|
4157
|
-
onChange: e => setParentSpouseName(e.target.value)
|
|
4158
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Mobile *"), /*#__PURE__*/React.createElement(TextInput, {
|
|
4159
|
-
value: mobile,
|
|
4160
|
-
onChange: e => setMobile(e.target.value)
|
|
4161
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "WhatsApp"), /*#__PURE__*/React.createElement(TextInput, {
|
|
4162
|
-
value: whatsapp,
|
|
4163
|
-
onChange: e => setWhatsapp(e.target.value)
|
|
4164
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Email"), /*#__PURE__*/React.createElement(TextInput, {
|
|
4165
|
-
value: email,
|
|
4166
|
-
onChange: e => setEmail(e.target.value)
|
|
4167
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "No. of Residents *"), /*#__PURE__*/React.createElement(TextInput, {
|
|
4168
|
-
value: residents,
|
|
4169
|
-
onChange: e => setResidents(e.target.value)
|
|
4170
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Type of Identity *"), /*#__PURE__*/React.createElement(Dropdown, {
|
|
4171
|
-
option: identityTypeOptions,
|
|
4172
|
-
selected: identityType,
|
|
4173
|
-
select: setIdentityType
|
|
4174
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Proof of Identity"), /*#__PURE__*/React.createElement(UploadFile, {
|
|
4175
|
-
onUpload: e => uploadFile(e, setDocumentProof, setDocumentId)
|
|
4176
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Document Number"), /*#__PURE__*/React.createElement(TextInput, {
|
|
4177
|
-
value: documentNumber,
|
|
4178
|
-
onChange: e => setDocumentNumber(e.target.value)
|
|
4179
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Informant Is Consumer"), /*#__PURE__*/React.createElement(CheckBox, {
|
|
4180
|
-
label: "Yes, the informant is the consumer",
|
|
4181
|
-
checked: informantIsConsumer,
|
|
4182
|
-
onChange: e => setInformantIsConsumer(e.target.checked)
|
|
4183
|
-
})), !informantIsConsumer && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Informant Name"), /*#__PURE__*/React.createElement(TextInput, {
|
|
4184
|
-
value: informantName,
|
|
4185
|
-
onChange: e => setInformantName(e.target.value)
|
|
4186
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Informant Relation"), /*#__PURE__*/React.createElement(TextInput, {
|
|
4187
|
-
value: informantRelation,
|
|
4188
|
-
onChange: e => setInformantRelation(e.target.value)
|
|
4189
|
-
}))), (occupantType === null || occupantType === void 0 ? void 0 : occupantType.name) === "Tenanted" && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Document Proof"), /*#__PURE__*/React.createElement(UploadFile, {
|
|
4190
|
-
onUpload: e => uploadFile(e, setDocumentProof, setDocumentId)
|
|
4191
|
-
})), !documentId && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Owner Mobile *"), /*#__PURE__*/React.createElement(TextInput, {
|
|
4192
|
-
value: ownerMobile,
|
|
4193
|
-
onChange: e => setOwnerMobile(e.target.value)
|
|
4194
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Tenant Verification"), /*#__PURE__*/React.createElement(TextInput, {
|
|
4195
|
-
value: tenantVerification,
|
|
4196
|
-
onChange: e => setTenantVerification(e.target.value)
|
|
4197
|
-
})))), (consumerType === null || consumerType === void 0 ? void 0 : consumerType.name) === "Govt" && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Designation"), /*#__PURE__*/React.createElement(TextInput, {
|
|
4198
|
-
value: designation,
|
|
4199
|
-
onChange: e => setDesignation(e.target.value)
|
|
4200
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Department"), /*#__PURE__*/React.createElement(TextInput, {
|
|
4201
|
-
value: department,
|
|
4202
|
-
onChange: e => setDepartment(e.target.value)
|
|
4203
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Employee ID"), /*#__PURE__*/React.createElement(TextInput, {
|
|
4204
|
-
value: employeeId,
|
|
4205
|
-
onChange: e => setEmployeeId(e.target.value)
|
|
4206
|
-
}))), (consumerType === null || consumerType === void 0 ? void 0 : consumerType.name) === "Company_Society_Org" && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Entity Name"), /*#__PURE__*/React.createElement(TextInput, {
|
|
4207
|
-
value: entityName,
|
|
4208
|
-
onChange: e => setEntityName(e.target.value)
|
|
4209
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Contact Person"), /*#__PURE__*/React.createElement(TextInput, {
|
|
4210
|
-
value: contactPerson,
|
|
4211
|
-
onChange: e => setContactPerson(e.target.value)
|
|
4212
|
-
})))), toast && /*#__PURE__*/React.createElement(Toast, {
|
|
4567
|
+
const Config = AadhaarVerificationConfig(t, localFormData, handleUploadProof, setDocumentId, documentId);
|
|
4568
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(FormComposer, {
|
|
4569
|
+
key: isDataLoaded ? "loaded" : "loading",
|
|
4570
|
+
isDisabled: !canSubmit,
|
|
4571
|
+
label: t("ES_COMMON_CONTINUE"),
|
|
4572
|
+
config: Config.map(item => ({
|
|
4573
|
+
...item,
|
|
4574
|
+
isCollapsible: true,
|
|
4575
|
+
isDefaultOpen: true
|
|
4576
|
+
})),
|
|
4577
|
+
onSubmit: onSubmit,
|
|
4578
|
+
defaultValues: defaultValues,
|
|
4579
|
+
onFormValueChange: onFormValueChange,
|
|
4580
|
+
noCard: false,
|
|
4581
|
+
submitInForm: true
|
|
4582
|
+
}), toast && /*#__PURE__*/React.createElement(Toast, {
|
|
4213
4583
|
error: toast.type === "error",
|
|
4214
4584
|
label: toast.message,
|
|
4215
4585
|
onClose: () => setToast(null)
|
|
@@ -4234,6 +4604,7 @@ const ekycConfig = [{
|
|
|
4234
4604
|
component: "AddressDetails",
|
|
4235
4605
|
key: "addressDetails",
|
|
4236
4606
|
doorImage: true,
|
|
4607
|
+
showMapActualLocation: false,
|
|
4237
4608
|
texts: {
|
|
4238
4609
|
header: "EKYC_ADDRESS_DETAILS",
|
|
4239
4610
|
submitBarLabel: "COMMON_SAVE_NEXT"
|
|
@@ -5769,6 +6140,139 @@ const EmployeeApp = ({
|
|
|
5769
6140
|
})))));
|
|
5770
6141
|
};
|
|
5771
6142
|
|
|
6143
|
+
const PropertyInfoConfig = (t, formData = {}, uploadFile, buildingImage, buildingImageId, setBuildingImage, setBuildingImageId) => {
|
|
6144
|
+
var _formData$propertyTyp;
|
|
6145
|
+
const propertyType = (formData === null || formData === void 0 ? void 0 : (_formData$propertyTyp = formData.propertyType) === null || _formData$propertyTyp === void 0 ? void 0 : _formData$propertyTyp.name) || (formData === null || formData === void 0 ? void 0 : formData.propertyType);
|
|
6146
|
+
const isHotel = propertyType === "Hotel";
|
|
6147
|
+
const isHospitalOrNursing = propertyType === "Hospital" || propertyType === "Nursing Home";
|
|
6148
|
+
const fields = [{
|
|
6149
|
+
label: t("PID Number"),
|
|
6150
|
+
isMandatory: false,
|
|
6151
|
+
type: "text",
|
|
6152
|
+
populators: {
|
|
6153
|
+
name: "pidNumber"
|
|
6154
|
+
}
|
|
6155
|
+
}, {
|
|
6156
|
+
label: t("Property Type"),
|
|
6157
|
+
isMandatory: false,
|
|
6158
|
+
type: "custom",
|
|
6159
|
+
key: "propertyType",
|
|
6160
|
+
populators: {
|
|
6161
|
+
name: "propertyType",
|
|
6162
|
+
component: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
6163
|
+
option: [{
|
|
6164
|
+
name: "Residential"
|
|
6165
|
+
}, {
|
|
6166
|
+
name: "Commercial"
|
|
6167
|
+
}, {
|
|
6168
|
+
name: "Hotel"
|
|
6169
|
+
}, {
|
|
6170
|
+
name: "Hospital"
|
|
6171
|
+
}, {
|
|
6172
|
+
name: "Nursing Home"
|
|
6173
|
+
}],
|
|
6174
|
+
optionKey: "name",
|
|
6175
|
+
selected: props.value,
|
|
6176
|
+
select: props.onChange
|
|
6177
|
+
})
|
|
6178
|
+
}
|
|
6179
|
+
}, {
|
|
6180
|
+
label: t("Sub Property Category"),
|
|
6181
|
+
isMandatory: false,
|
|
6182
|
+
type: "custom",
|
|
6183
|
+
key: "subPropertyCategory",
|
|
6184
|
+
populators: {
|
|
6185
|
+
name: "subPropertyCategory",
|
|
6186
|
+
component: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
6187
|
+
option: [],
|
|
6188
|
+
optionKey: "name",
|
|
6189
|
+
selected: props.value,
|
|
6190
|
+
select: props.onChange
|
|
6191
|
+
})
|
|
6192
|
+
}
|
|
6193
|
+
}, {
|
|
6194
|
+
label: t("No. of Floors"),
|
|
6195
|
+
isMandatory: true,
|
|
6196
|
+
type: "number",
|
|
6197
|
+
populators: {
|
|
6198
|
+
name: "noOfFloors",
|
|
6199
|
+
validation: {
|
|
6200
|
+
required: true,
|
|
6201
|
+
min: 1
|
|
6202
|
+
}
|
|
6203
|
+
}
|
|
6204
|
+
}, {
|
|
6205
|
+
label: t("Floor No. of this KNO"),
|
|
6206
|
+
isMandatory: false,
|
|
6207
|
+
type: "text",
|
|
6208
|
+
populators: {
|
|
6209
|
+
name: "floorNo"
|
|
6210
|
+
}
|
|
6211
|
+
}, {
|
|
6212
|
+
label: isHospitalOrNursing ? t("No of Beds") : t("No of Beds"),
|
|
6213
|
+
isMandatory: isHospitalOrNursing,
|
|
6214
|
+
type: "number",
|
|
6215
|
+
populators: {
|
|
6216
|
+
name: "noOfBeds",
|
|
6217
|
+
validation: isHospitalOrNursing ? {
|
|
6218
|
+
required: true,
|
|
6219
|
+
min: 1
|
|
6220
|
+
} : {}
|
|
6221
|
+
}
|
|
6222
|
+
}, {
|
|
6223
|
+
label: isHotel ? t("No. of Rooms") : t("No. of Rooms"),
|
|
6224
|
+
isMandatory: isHotel,
|
|
6225
|
+
type: "number",
|
|
6226
|
+
populators: {
|
|
6227
|
+
name: "noOfRooms",
|
|
6228
|
+
validation: isHotel ? {
|
|
6229
|
+
required: true,
|
|
6230
|
+
min: 1
|
|
6231
|
+
} : {}
|
|
6232
|
+
}
|
|
6233
|
+
}, {
|
|
6234
|
+
label: t("Number of Dwelling Units"),
|
|
6235
|
+
isMandatory: false,
|
|
6236
|
+
type: "number",
|
|
6237
|
+
populators: {
|
|
6238
|
+
name: "dwellingUnits"
|
|
6239
|
+
}
|
|
6240
|
+
}, {
|
|
6241
|
+
label: t("Building Image"),
|
|
6242
|
+
isMandatory: true,
|
|
6243
|
+
type: "custom",
|
|
6244
|
+
key: "buildingImage",
|
|
6245
|
+
populators: {
|
|
6246
|
+
name: "buildingImage",
|
|
6247
|
+
component: props => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(UploadFile, {
|
|
6248
|
+
onUpload: e => uploadFile(e, props.onChange),
|
|
6249
|
+
onDelete: () => {
|
|
6250
|
+
props.onChange(null);
|
|
6251
|
+
setBuildingImage(null);
|
|
6252
|
+
setBuildingImageId(null);
|
|
6253
|
+
},
|
|
6254
|
+
message: buildingImageId ? t("Uploaded") : t("No file selected")
|
|
6255
|
+
}), buildingImage && /*#__PURE__*/React.createElement("div", {
|
|
6256
|
+
style: {
|
|
6257
|
+
marginTop: "10px"
|
|
6258
|
+
}
|
|
6259
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
6260
|
+
src: buildingImage,
|
|
6261
|
+
alt: "preview",
|
|
6262
|
+
style: {
|
|
6263
|
+
maxWidth: "100%",
|
|
6264
|
+
maxHeight: "200px",
|
|
6265
|
+
objectFit: "contain"
|
|
6266
|
+
}
|
|
6267
|
+
})))
|
|
6268
|
+
}
|
|
6269
|
+
}];
|
|
6270
|
+
return [{
|
|
6271
|
+
head: t("EKYC_PROPERTY_DETAILS"),
|
|
6272
|
+
body: fields
|
|
6273
|
+
}];
|
|
6274
|
+
};
|
|
6275
|
+
|
|
5772
6276
|
const PropertyInfo = ({
|
|
5773
6277
|
config,
|
|
5774
6278
|
onSelect,
|
|
@@ -5780,14 +6284,17 @@ const PropertyInfo = ({
|
|
|
5780
6284
|
const location = useLocation();
|
|
5781
6285
|
const flowState = location.state || {};
|
|
5782
6286
|
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
5783
|
-
const
|
|
6287
|
+
const queryParams = new URLSearchParams(location.search);
|
|
6288
|
+
const urlKno = queryParams.get("kno");
|
|
6289
|
+
const searchKno = urlKno || (flowState === null || flowState === void 0 ? void 0 : flowState.kNumber) || (flowState === null || flowState === void 0 ? void 0 : flowState.kno) || (formData === null || formData === void 0 ? void 0 : formData.kNumber) || (formData === null || formData === void 0 ? void 0 : formData.kno) || sessionStorage.getItem("EKYC_K_NUMBER");
|
|
5784
6290
|
const {
|
|
5785
6291
|
isLoading,
|
|
5786
6292
|
data: searchData
|
|
5787
6293
|
} = Digit.Hooks.ekyc.useSearchConnection({
|
|
5788
6294
|
tenantId,
|
|
5789
6295
|
details: {
|
|
5790
|
-
kno: searchKno
|
|
6296
|
+
kno: searchKno,
|
|
6297
|
+
fetchType: "PROPERTY"
|
|
5791
6298
|
}
|
|
5792
6299
|
}, {
|
|
5793
6300
|
enabled: !!searchKno,
|
|
@@ -5795,69 +6302,97 @@ const PropertyInfo = ({
|
|
|
5795
6302
|
});
|
|
5796
6303
|
const updateMutation = Digit.Hooks.ekyc.useEkycUpdate(tenantId);
|
|
5797
6304
|
const savedData = (formData === null || formData === void 0 ? void 0 : formData.propertyDetails) || {};
|
|
5798
|
-
const [pidNumber, setPidNumber] = useState(savedData.pidNumber || "");
|
|
5799
|
-
const [propertyType, setPropertyType] = useState(savedData.propertyType ? {
|
|
5800
|
-
name: savedData.propertyType
|
|
5801
|
-
} : null);
|
|
5802
|
-
const [subPropertyCategory, setSubPropertyCategory] = useState(savedData.subPropertyCategory ? {
|
|
5803
|
-
name: savedData.subPropertyCategory
|
|
5804
|
-
} : null);
|
|
5805
|
-
const [noOfFloors, setNoOfFloors] = useState(savedData.noOfFloors || "");
|
|
5806
|
-
const [floorNo, setFloorNo] = useState(savedData.floorNo || "");
|
|
5807
|
-
const [noOfRooms, setNoOfRooms] = useState(savedData.noOfRooms || "");
|
|
5808
|
-
const [noOfBeds, setNoOfBeds] = useState(savedData.noOfBeds || "");
|
|
5809
|
-
const [dwellingUnits, setDwellingUnits] = useState(savedData.dwellingUnits || "");
|
|
5810
6305
|
const [buildingImage, setBuildingImage] = useState(null);
|
|
5811
6306
|
const [buildingImageId, setBuildingImageId] = useState(savedData.buildingImageId || null);
|
|
5812
6307
|
const [toast, setToast] = useState(null);
|
|
5813
|
-
const
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
6308
|
+
const [isDataLoaded, setIsDataLoaded] = useState(false);
|
|
6309
|
+
const [canSubmit, setCanSubmit] = useState(false);
|
|
6310
|
+
const [defaultValues, setDefaultValues] = useState(() => ({
|
|
6311
|
+
pidNumber: savedData.pidNumber || "",
|
|
6312
|
+
propertyType: savedData.propertyType ? {
|
|
6313
|
+
name: savedData.propertyType
|
|
6314
|
+
} : null,
|
|
6315
|
+
subPropertyCategory: savedData.subPropertyCategory ? {
|
|
6316
|
+
name: savedData.subPropertyCategory
|
|
6317
|
+
} : null,
|
|
6318
|
+
noOfFloors: savedData.noOfFloors || "",
|
|
6319
|
+
floorNo: savedData.floorNo || "",
|
|
6320
|
+
noOfRooms: savedData.noOfRooms || "",
|
|
6321
|
+
noOfBeds: savedData.noOfBeds || "",
|
|
6322
|
+
dwellingUnits: savedData.dwellingUnits || "",
|
|
6323
|
+
buildingImage: savedData.buildingImageId ? "Uploaded" : null
|
|
6324
|
+
}));
|
|
6325
|
+
const [localFormData, setLocalFormData] = useState(defaultValues);
|
|
6326
|
+
const extractApplicationData = searchData => {
|
|
6327
|
+
if (!searchData) return null;
|
|
6328
|
+
const reviewWrapper = (searchData === null || searchData === void 0 ? void 0 : searchData.applicationReviewInfo) || (searchData === null || searchData === void 0 ? void 0 : searchData.applicationReview) || searchData;
|
|
6329
|
+
const applicationData = (Array.isArray(reviewWrapper) ? reviewWrapper[0] : reviewWrapper) || {};
|
|
6330
|
+
return (applicationData === null || applicationData === void 0 ? void 0 : applicationData.newData) || applicationData;
|
|
6331
|
+
};
|
|
5824
6332
|
useEffect(() => {
|
|
5825
|
-
const
|
|
5826
|
-
const
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
6333
|
+
const appData = extractApplicationData(searchData);
|
|
6334
|
+
const rawData = appData || (formData === null || formData === void 0 ? void 0 : formData.connectionDetails);
|
|
6335
|
+
const propertyInfo = (rawData === null || rawData === void 0 ? void 0 : rawData.propertyInfo) || (rawData === null || rawData === void 0 ? void 0 : rawData.propertyDetails) || rawData || {};
|
|
6336
|
+
if (propertyInfo && Object.keys(propertyInfo).length > 0 && !isDataLoaded) {
|
|
6337
|
+
let propType = null;
|
|
6338
|
+
let subPropCat = null;
|
|
5831
6339
|
if (propertyInfo.subPropertyCategory) {
|
|
5832
|
-
const matchingType =
|
|
5833
|
-
|
|
6340
|
+
const matchingType = [{
|
|
6341
|
+
name: "Residential"
|
|
6342
|
+
}, {
|
|
6343
|
+
name: "Commercial"
|
|
6344
|
+
}, {
|
|
6345
|
+
name: "Hotel"
|
|
6346
|
+
}, {
|
|
6347
|
+
name: "Hospital"
|
|
6348
|
+
}, {
|
|
6349
|
+
name: "Nursing Home"
|
|
6350
|
+
}].find(type => type.name.toLowerCase() === propertyInfo.subPropertyCategory.toLowerCase());
|
|
6351
|
+
if (matchingType) propType = matchingType;else propType = {
|
|
5834
6352
|
name: propertyInfo.subPropertyCategory
|
|
5835
|
-
}
|
|
5836
|
-
|
|
6353
|
+
};
|
|
6354
|
+
subPropCat = {
|
|
5837
6355
|
name: propertyInfo.subPropertyCategory
|
|
5838
|
-
}
|
|
6356
|
+
};
|
|
5839
6357
|
}
|
|
5840
6358
|
if (propertyInfo.propertyType) {
|
|
5841
|
-
|
|
6359
|
+
subPropCat = {
|
|
5842
6360
|
name: propertyInfo.propertyType
|
|
5843
|
-
}
|
|
5844
|
-
if (!propertyInfo.subPropertyCategory)
|
|
6361
|
+
};
|
|
6362
|
+
if (!propertyInfo.subPropertyCategory) propType = {
|
|
5845
6363
|
name: propertyInfo.propertyType
|
|
5846
|
-
}
|
|
6364
|
+
};
|
|
6365
|
+
}
|
|
6366
|
+
const updatedDefaults = {
|
|
6367
|
+
pidNumber: savedData.pidNumber || propertyInfo.pidNumber || "",
|
|
6368
|
+
propertyType: savedData.propertyType ? {
|
|
6369
|
+
name: savedData.propertyType
|
|
6370
|
+
} : propType,
|
|
6371
|
+
subPropertyCategory: savedData.subPropertyCategory ? {
|
|
6372
|
+
name: savedData.subPropertyCategory
|
|
6373
|
+
} : subPropCat,
|
|
6374
|
+
noOfFloors: savedData.noOfFloors || (propertyInfo.numberOfFloors || propertyInfo.noOfFloor ? String(propertyInfo.numberOfFloors || propertyInfo.noOfFloor) : ""),
|
|
6375
|
+
floorNo: savedData.floorNo || propertyInfo.floorNo || "",
|
|
6376
|
+
noOfRooms: savedData.noOfRooms || (propertyInfo.numberOfRooms !== null && propertyInfo.numberOfRooms !== undefined ? String(propertyInfo.numberOfRooms) : ""),
|
|
6377
|
+
noOfBeds: savedData.noOfBeds || (propertyInfo.numberOfBeds !== null && propertyInfo.numberOfBeds !== undefined ? String(propertyInfo.numberOfBeds) : ""),
|
|
6378
|
+
dwellingUnits: savedData.dwellingUnits || (propertyInfo.numberOfDwellingUnits !== null && propertyInfo.numberOfDwellingUnits !== undefined ? String(propertyInfo.numberOfDwellingUnits) : ""),
|
|
6379
|
+
buildingImage: savedData.buildingImageId || propertyInfo.buildingImageFileStoreId || null
|
|
6380
|
+
};
|
|
6381
|
+
setDefaultValues(updatedDefaults);
|
|
6382
|
+
setLocalFormData(updatedDefaults);
|
|
6383
|
+
if (updatedDefaults.buildingImage) {
|
|
6384
|
+
setBuildingImageId(updatedDefaults.buildingImage);
|
|
5847
6385
|
}
|
|
5848
|
-
|
|
5849
|
-
if (propertyInfo.numberOfRooms !== null && propertyInfo.numberOfRooms !== undefined) setNoOfRooms(String(propertyInfo.numberOfRooms));
|
|
5850
|
-
if (propertyInfo.numberOfBeds !== null && propertyInfo.numberOfBeds !== undefined) setNoOfBeds(String(propertyInfo.numberOfBeds));
|
|
5851
|
-
if (propertyInfo.numberOfDwellingUnits !== null && propertyInfo.numberOfDwellingUnits !== undefined) setDwellingUnits(String(propertyInfo.numberOfDwellingUnits));
|
|
6386
|
+
setIsDataLoaded(true);
|
|
5852
6387
|
}
|
|
5853
|
-
}, [searchData, formData === null || formData === void 0 ? void 0 : formData.connectionDetails]);
|
|
5854
|
-
const handleUpload = async e => {
|
|
6388
|
+
}, [searchData, formData === null || formData === void 0 ? void 0 : formData.connectionDetails, isDataLoaded]);
|
|
6389
|
+
const handleUpload = async (e, onChange) => {
|
|
5855
6390
|
const file = e.target.files[0];
|
|
5856
6391
|
if (!file) return;
|
|
5857
6392
|
if (file.size > 2000000) {
|
|
5858
6393
|
setToast({
|
|
5859
6394
|
type: "error",
|
|
5860
|
-
message: "Max size 2MB exceeded"
|
|
6395
|
+
message: t("Max size 2MB exceeded")
|
|
5861
6396
|
});
|
|
5862
6397
|
return;
|
|
5863
6398
|
}
|
|
@@ -5866,132 +6401,370 @@ const PropertyInfo = ({
|
|
|
5866
6401
|
const res = await Digit.UploadServices.Filestorage("EKYC", file, tenantId);
|
|
5867
6402
|
const fileStoreId = res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$files = _res$data.files) === null || _res$data$files === void 0 ? void 0 : (_res$data$files$ = _res$data$files[0]) === null || _res$data$files$ === void 0 ? void 0 : _res$data$files$.fileStoreId;
|
|
5868
6403
|
if (fileStoreId) {
|
|
6404
|
+
onChange(file.name);
|
|
5869
6405
|
setBuildingImageId(fileStoreId);
|
|
5870
6406
|
const reader = new FileReader();
|
|
5871
6407
|
reader.onloadend = () => setBuildingImage(reader.result);
|
|
5872
6408
|
reader.readAsDataURL(file);
|
|
5873
6409
|
setToast({
|
|
5874
6410
|
type: "success",
|
|
5875
|
-
message: "Upload successful"
|
|
6411
|
+
message: t("Upload successful")
|
|
5876
6412
|
});
|
|
5877
6413
|
}
|
|
5878
6414
|
} catch {
|
|
5879
6415
|
setToast({
|
|
5880
6416
|
type: "error",
|
|
5881
|
-
message: "Upload failed"
|
|
6417
|
+
message: t("Upload failed")
|
|
5882
6418
|
});
|
|
5883
6419
|
}
|
|
5884
6420
|
};
|
|
5885
|
-
const
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
if (
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
6421
|
+
const onFormValueChange = (setValue, data) => {
|
|
6422
|
+
var _data$propertyType, _localFormData$proper;
|
|
6423
|
+
const propertyTypeChanged = ((data === null || data === void 0 ? void 0 : (_data$propertyType = data.propertyType) === null || _data$propertyType === void 0 ? void 0 : _data$propertyType.name) || (data === null || data === void 0 ? void 0 : data.propertyType)) !== ((localFormData === null || localFormData === void 0 ? void 0 : (_localFormData$proper = localFormData.propertyType) === null || _localFormData$proper === void 0 ? void 0 : _localFormData$proper.name) || (localFormData === null || localFormData === void 0 ? void 0 : localFormData.propertyType));
|
|
6424
|
+
if (propertyTypeChanged) {
|
|
6425
|
+
setLocalFormData(prev => ({
|
|
6426
|
+
...prev,
|
|
6427
|
+
...data
|
|
6428
|
+
}));
|
|
6429
|
+
}
|
|
6430
|
+
const propTypeVal = data === null || data === void 0 ? void 0 : data.propertyType;
|
|
6431
|
+
const subPropCatVal = data === null || data === void 0 ? void 0 : data.subPropertyCategory;
|
|
6432
|
+
const noOfFloorsVal = data === null || data === void 0 ? void 0 : data.noOfFloors;
|
|
6433
|
+
const buildingImgId = buildingImageId || (data === null || data === void 0 ? void 0 : data.buildingImage);
|
|
6434
|
+
const noOfRoomsVal = data === null || data === void 0 ? void 0 : data.noOfRooms;
|
|
6435
|
+
const noOfBedsVal = data === null || data === void 0 ? void 0 : data.noOfBeds;
|
|
6436
|
+
let valid = true;
|
|
6437
|
+
if (!propTypeVal) valid = false;
|
|
6438
|
+
if (!subPropCatVal) valid = false;
|
|
6439
|
+
if (!noOfFloorsVal || Number(noOfFloorsVal) < 1) valid = false;
|
|
6440
|
+
if (!buildingImgId) valid = false;
|
|
6441
|
+
if ((propTypeVal === null || propTypeVal === void 0 ? void 0 : propTypeVal.name) === "Hotel" && !noOfRoomsVal) valid = false;
|
|
6442
|
+
if (((propTypeVal === null || propTypeVal === void 0 ? void 0 : propTypeVal.name) === "Hospital" || (propTypeVal === null || propTypeVal === void 0 ? void 0 : propTypeVal.name) === "Nursing Home") && !noOfBedsVal) valid = false;
|
|
6443
|
+
if (valid !== canSubmit) {
|
|
6444
|
+
setCanSubmit(valid);
|
|
6445
|
+
}
|
|
5893
6446
|
};
|
|
5894
|
-
const
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
6447
|
+
const onSubmit = async data => {
|
|
6448
|
+
var _data$propertyType2, _data$subPropertyCate;
|
|
6449
|
+
const submitData = {
|
|
6450
|
+
pidNumber: data.pidNumber,
|
|
6451
|
+
propertyType: ((_data$propertyType2 = data.propertyType) === null || _data$propertyType2 === void 0 ? void 0 : _data$propertyType2.name) || data.propertyType,
|
|
6452
|
+
subPropertyCategory: ((_data$subPropertyCate = data.subPropertyCategory) === null || _data$subPropertyCate === void 0 ? void 0 : _data$subPropertyCate.name) || data.subPropertyCategory,
|
|
6453
|
+
noOfFloors: data.noOfFloors,
|
|
6454
|
+
floorNo: data.floorNo,
|
|
6455
|
+
noOfRooms: data.noOfRooms,
|
|
6456
|
+
noOfBeds: data.noOfBeds,
|
|
6457
|
+
dwellingUnits: data.dwellingUnits,
|
|
6458
|
+
buildingImageId: buildingImageId
|
|
5905
6459
|
};
|
|
5906
6460
|
try {
|
|
5907
6461
|
await updateMutation.mutateAsync({
|
|
5908
6462
|
RequestInfo: {},
|
|
5909
6463
|
updateType: "PROPERTY",
|
|
5910
6464
|
kno: searchKno,
|
|
5911
|
-
...
|
|
6465
|
+
...submitData
|
|
5912
6466
|
});
|
|
5913
6467
|
setToast({
|
|
5914
6468
|
type: "success",
|
|
5915
|
-
message: "Property details updated successfully!"
|
|
6469
|
+
message: t("Property details updated successfully!")
|
|
5916
6470
|
});
|
|
5917
|
-
onSelect(config.key,
|
|
6471
|
+
onSelect(config.key, submitData);
|
|
5918
6472
|
} catch (error) {
|
|
5919
6473
|
setToast({
|
|
5920
6474
|
type: "error",
|
|
5921
|
-
message: "Failed to update property details"
|
|
6475
|
+
message: t("Failed to update property details")
|
|
5922
6476
|
});
|
|
5923
6477
|
}
|
|
5924
6478
|
};
|
|
5925
6479
|
if (isLoading) {
|
|
5926
6480
|
return /*#__PURE__*/React.createElement(Loader, null);
|
|
5927
6481
|
}
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
6482
|
+
const Config = PropertyInfoConfig(t, localFormData, handleUpload, buildingImage, buildingImageId, setBuildingImage, setBuildingImageId);
|
|
6483
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(FormComposer, {
|
|
6484
|
+
key: isDataLoaded ? "loaded" : "loading",
|
|
6485
|
+
isDisabled: !canSubmit,
|
|
5932
6486
|
label: t("ES_COMMON_CONTINUE"),
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
select: setSubPropertyCategory
|
|
5945
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "No. of Floors *"), /*#__PURE__*/React.createElement(TextInput, {
|
|
5946
|
-
type: "number",
|
|
5947
|
-
value: noOfFloors,
|
|
5948
|
-
onChange: e => setNoOfFloors(e.target.value)
|
|
5949
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Floor No. of this KNO"), /*#__PURE__*/React.createElement(TextInput, {
|
|
5950
|
-
value: floorNo,
|
|
5951
|
-
onChange: e => setFloorNo(e.target.value)
|
|
5952
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "No of Beds"), /*#__PURE__*/React.createElement(TextInput, {
|
|
5953
|
-
type: "number",
|
|
5954
|
-
value: noOfBeds,
|
|
5955
|
-
onChange: e => setNoOfBeds(e.target.value)
|
|
5956
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "No. of Rooms"), /*#__PURE__*/React.createElement(TextInput, {
|
|
5957
|
-
type: "number",
|
|
5958
|
-
value: noOfRooms,
|
|
5959
|
-
onChange: e => setNoOfRooms(e.target.value)
|
|
5960
|
-
})), (propertyType === null || propertyType === void 0 ? void 0 : propertyType.name) === "Hotel" && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "No. of Rooms *"), /*#__PURE__*/React.createElement(TextInput, {
|
|
5961
|
-
type: "number",
|
|
5962
|
-
value: noOfRooms,
|
|
5963
|
-
onChange: e => setNoOfRooms(e.target.value)
|
|
5964
|
-
})), ((propertyType === null || propertyType === void 0 ? void 0 : propertyType.name) === "Hospital" || (propertyType === null || propertyType === void 0 ? void 0 : propertyType.name) === "Nursing Home") && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "No. of Beds *"), /*#__PURE__*/React.createElement(TextInput, {
|
|
5965
|
-
type: "number",
|
|
5966
|
-
value: noOfBeds,
|
|
5967
|
-
onChange: e => setNoOfBeds(e.target.value)
|
|
5968
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Number of Dwelling Units"), /*#__PURE__*/React.createElement(TextInput, {
|
|
5969
|
-
type: "number",
|
|
5970
|
-
value: dwellingUnits,
|
|
5971
|
-
onChange: e => setDwellingUnits(e.target.value)
|
|
5972
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Building Image *"), /*#__PURE__*/React.createElement(UploadFile, {
|
|
5973
|
-
onUpload: handleUpload,
|
|
5974
|
-
onDelete: () => {
|
|
5975
|
-
setBuildingImage(null);
|
|
5976
|
-
setBuildingImageId(null);
|
|
5977
|
-
},
|
|
5978
|
-
message: buildingImageId ? "Uploaded" : "No file selected"
|
|
5979
|
-
})), buildingImage && /*#__PURE__*/React.createElement("div", {
|
|
5980
|
-
style: {
|
|
5981
|
-
gridColumn: "span 2"
|
|
5982
|
-
}
|
|
5983
|
-
}, /*#__PURE__*/React.createElement("img", {
|
|
5984
|
-
src: buildingImage,
|
|
5985
|
-
alt: "preview",
|
|
5986
|
-
style: {
|
|
5987
|
-
width: "100%",
|
|
5988
|
-
marginTop: "10px"
|
|
5989
|
-
}
|
|
5990
|
-
})), toast && /*#__PURE__*/React.createElement(Toast, {
|
|
5991
|
-
label: toast.message,
|
|
6487
|
+
config: Config.map(item => ({
|
|
6488
|
+
...item,
|
|
6489
|
+
isCollapsible: true,
|
|
6490
|
+
isDefaultOpen: true
|
|
6491
|
+
})),
|
|
6492
|
+
onSubmit: onSubmit,
|
|
6493
|
+
defaultValues: defaultValues,
|
|
6494
|
+
onFormValueChange: onFormValueChange,
|
|
6495
|
+
noCard: false,
|
|
6496
|
+
submitInForm: true
|
|
6497
|
+
}), toast && /*#__PURE__*/React.createElement(Toast, {
|
|
5992
6498
|
error: toast.type === "error",
|
|
6499
|
+
label: toast.message,
|
|
5993
6500
|
onClose: () => setToast(null)
|
|
5994
|
-
}))
|
|
6501
|
+
}));
|
|
6502
|
+
};
|
|
6503
|
+
|
|
6504
|
+
const MeterDetailsConfig = (t, formData = {}, uploadPhoto, meterPhoto, meterPhotoId, setMeterPhoto, setMeterPhotoId) => {
|
|
6505
|
+
var _formData$meterStatus, _formData$lastBillRec, _formData$sewerConnec;
|
|
6506
|
+
const meterStatus = (formData === null || formData === void 0 ? void 0 : (_formData$meterStatus = formData.meterStatus) === null || _formData$meterStatus === void 0 ? void 0 : _formData$meterStatus.name) || (formData === null || formData === void 0 ? void 0 : formData.meterStatus);
|
|
6507
|
+
const lastBillReceived = (formData === null || formData === void 0 ? void 0 : (_formData$lastBillRec = formData.lastBillReceived) === null || _formData$lastBillRec === void 0 ? void 0 : _formData$lastBillRec.name) || (formData === null || formData === void 0 ? void 0 : formData.lastBillReceived);
|
|
6508
|
+
const sewerConnection = (formData === null || formData === void 0 ? void 0 : (_formData$sewerConnec = formData.sewerConnection) === null || _formData$sewerConnec === void 0 ? void 0 : _formData$sewerConnec.name) || (formData === null || formData === void 0 ? void 0 : formData.sewerConnection);
|
|
6509
|
+
const isFrozen = meterStatus === "Can not be identified";
|
|
6510
|
+
const monthYearOptions = [];
|
|
6511
|
+
for (let y = 1998; y <= 2026; y++) {
|
|
6512
|
+
for (let m = 1; m <= 12; m++) {
|
|
6513
|
+
monthYearOptions.push({
|
|
6514
|
+
name: `${m}/${y}`
|
|
6515
|
+
});
|
|
6516
|
+
}
|
|
6517
|
+
}
|
|
6518
|
+
const yesNo = [{
|
|
6519
|
+
name: "Yes"
|
|
6520
|
+
}, {
|
|
6521
|
+
name: "No"
|
|
6522
|
+
}];
|
|
6523
|
+
const fields = [{
|
|
6524
|
+
label: t("Connection Category"),
|
|
6525
|
+
isMandatory: true,
|
|
6526
|
+
type: "text",
|
|
6527
|
+
populators: {
|
|
6528
|
+
name: "connectionCategory",
|
|
6529
|
+
validation: {
|
|
6530
|
+
required: true
|
|
6531
|
+
}
|
|
6532
|
+
}
|
|
6533
|
+
}, {
|
|
6534
|
+
label: t("SA Type"),
|
|
6535
|
+
isMandatory: false,
|
|
6536
|
+
type: "text",
|
|
6537
|
+
populators: {
|
|
6538
|
+
name: "saType"
|
|
6539
|
+
}
|
|
6540
|
+
}, {
|
|
6541
|
+
label: t("Status"),
|
|
6542
|
+
isMandatory: false,
|
|
6543
|
+
type: "text",
|
|
6544
|
+
populators: {
|
|
6545
|
+
name: "status"
|
|
6546
|
+
}
|
|
6547
|
+
}, {
|
|
6548
|
+
label: t("MR Code"),
|
|
6549
|
+
isMandatory: false,
|
|
6550
|
+
type: "text",
|
|
6551
|
+
populators: {
|
|
6552
|
+
name: "mrCode"
|
|
6553
|
+
}
|
|
6554
|
+
}, {
|
|
6555
|
+
label: t("Area Code"),
|
|
6556
|
+
isMandatory: false,
|
|
6557
|
+
type: "text",
|
|
6558
|
+
populators: {
|
|
6559
|
+
name: "areaCode"
|
|
6560
|
+
}
|
|
6561
|
+
}, {
|
|
6562
|
+
label: t("MR Key"),
|
|
6563
|
+
isMandatory: false,
|
|
6564
|
+
type: "text",
|
|
6565
|
+
populators: {
|
|
6566
|
+
name: "mrKey"
|
|
6567
|
+
}
|
|
6568
|
+
}];
|
|
6569
|
+
if (!isFrozen) {
|
|
6570
|
+
fields.push({
|
|
6571
|
+
label: t("Meter Number"),
|
|
6572
|
+
isMandatory: false,
|
|
6573
|
+
type: "text",
|
|
6574
|
+
populators: {
|
|
6575
|
+
name: "meterNumber"
|
|
6576
|
+
}
|
|
6577
|
+
}, {
|
|
6578
|
+
label: t("Meter Maker"),
|
|
6579
|
+
isMandatory: false,
|
|
6580
|
+
type: "text",
|
|
6581
|
+
populators: {
|
|
6582
|
+
name: "meterMaker"
|
|
6583
|
+
}
|
|
6584
|
+
}, {
|
|
6585
|
+
label: t("Meter Condition"),
|
|
6586
|
+
isMandatory: false,
|
|
6587
|
+
type: "custom",
|
|
6588
|
+
key: "meterCondition",
|
|
6589
|
+
populators: {
|
|
6590
|
+
name: "meterCondition",
|
|
6591
|
+
component: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
6592
|
+
option: [{
|
|
6593
|
+
name: "Damaged"
|
|
6594
|
+
}, {
|
|
6595
|
+
name: "Not-Damaged"
|
|
6596
|
+
}],
|
|
6597
|
+
optionKey: "name",
|
|
6598
|
+
selected: props.value,
|
|
6599
|
+
select: props.onChange
|
|
6600
|
+
})
|
|
6601
|
+
}
|
|
6602
|
+
});
|
|
6603
|
+
if (meterStatus === "Metered") {
|
|
6604
|
+
fields.push({
|
|
6605
|
+
label: t("Meter Photo *"),
|
|
6606
|
+
isMandatory: true,
|
|
6607
|
+
type: "custom",
|
|
6608
|
+
key: "meterPhoto",
|
|
6609
|
+
populators: {
|
|
6610
|
+
name: "meterPhoto",
|
|
6611
|
+
component: props => /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(UploadFile, {
|
|
6612
|
+
onUpload: e => uploadPhoto(e, props.onChange),
|
|
6613
|
+
onDelete: () => {
|
|
6614
|
+
props.onChange(null);
|
|
6615
|
+
setMeterPhoto(null);
|
|
6616
|
+
setMeterPhotoId(null);
|
|
6617
|
+
},
|
|
6618
|
+
message: meterPhotoId ? t("Uploaded") : t("No file selected")
|
|
6619
|
+
}), meterPhoto && /*#__PURE__*/React.createElement("div", {
|
|
6620
|
+
style: {
|
|
6621
|
+
marginTop: "10px"
|
|
6622
|
+
}
|
|
6623
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
6624
|
+
src: meterPhoto,
|
|
6625
|
+
alt: "preview",
|
|
6626
|
+
style: {
|
|
6627
|
+
maxWidth: "100%",
|
|
6628
|
+
maxHeight: "200px",
|
|
6629
|
+
objectFit: "contain"
|
|
6630
|
+
}
|
|
6631
|
+
})))
|
|
6632
|
+
}
|
|
6633
|
+
});
|
|
6634
|
+
}
|
|
6635
|
+
}
|
|
6636
|
+
fields.push({
|
|
6637
|
+
label: t("Meter Status"),
|
|
6638
|
+
isMandatory: true,
|
|
6639
|
+
type: "custom",
|
|
6640
|
+
key: "meterStatus",
|
|
6641
|
+
populators: {
|
|
6642
|
+
name: "meterStatus",
|
|
6643
|
+
component: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
6644
|
+
option: [{
|
|
6645
|
+
name: "Metered"
|
|
6646
|
+
}, {
|
|
6647
|
+
name: "Unmetered"
|
|
6648
|
+
}, {
|
|
6649
|
+
name: "Can not be identified"
|
|
6650
|
+
}],
|
|
6651
|
+
optionKey: "name",
|
|
6652
|
+
selected: props.value,
|
|
6653
|
+
select: props.onChange
|
|
6654
|
+
})
|
|
6655
|
+
}
|
|
6656
|
+
}, {
|
|
6657
|
+
label: t("Meter Location"),
|
|
6658
|
+
isMandatory: true,
|
|
6659
|
+
type: "custom",
|
|
6660
|
+
key: "meterLocation",
|
|
6661
|
+
populators: {
|
|
6662
|
+
name: "meterLocation",
|
|
6663
|
+
component: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
6664
|
+
option: [{
|
|
6665
|
+
name: "Inside"
|
|
6666
|
+
}, {
|
|
6667
|
+
name: "Outside"
|
|
6668
|
+
}],
|
|
6669
|
+
optionKey: "name",
|
|
6670
|
+
selected: props.value,
|
|
6671
|
+
select: props.onChange
|
|
6672
|
+
})
|
|
6673
|
+
}
|
|
6674
|
+
}, {
|
|
6675
|
+
label: t("Last Bill Received"),
|
|
6676
|
+
isMandatory: true,
|
|
6677
|
+
type: "custom",
|
|
6678
|
+
key: "lastBillReceived",
|
|
6679
|
+
populators: {
|
|
6680
|
+
name: "lastBillReceived",
|
|
6681
|
+
component: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
6682
|
+
option: yesNo,
|
|
6683
|
+
optionKey: "name",
|
|
6684
|
+
selected: props.value,
|
|
6685
|
+
select: props.onChange
|
|
6686
|
+
})
|
|
6687
|
+
}
|
|
6688
|
+
});
|
|
6689
|
+
if (lastBillReceived === "Yes") {
|
|
6690
|
+
fields.push({
|
|
6691
|
+
label: t("When was the last bill received *"),
|
|
6692
|
+
isMandatory: true,
|
|
6693
|
+
type: "custom",
|
|
6694
|
+
key: "billMonthYear",
|
|
6695
|
+
populators: {
|
|
6696
|
+
name: "billMonthYear",
|
|
6697
|
+
component: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
6698
|
+
option: monthYearOptions,
|
|
6699
|
+
optionKey: "name",
|
|
6700
|
+
selected: props.value,
|
|
6701
|
+
select: props.onChange
|
|
6702
|
+
})
|
|
6703
|
+
}
|
|
6704
|
+
});
|
|
6705
|
+
} else if (lastBillReceived === "No") {
|
|
6706
|
+
fields.push({
|
|
6707
|
+
label: t("Reason *"),
|
|
6708
|
+
isMandatory: true,
|
|
6709
|
+
type: "text",
|
|
6710
|
+
populators: {
|
|
6711
|
+
name: "reason",
|
|
6712
|
+
validation: {
|
|
6713
|
+
required: true
|
|
6714
|
+
}
|
|
6715
|
+
}
|
|
6716
|
+
});
|
|
6717
|
+
}
|
|
6718
|
+
fields.push({
|
|
6719
|
+
label: t("Access to Meter"),
|
|
6720
|
+
isMandatory: false,
|
|
6721
|
+
type: "custom",
|
|
6722
|
+
key: "accessToMeter",
|
|
6723
|
+
populators: {
|
|
6724
|
+
name: "accessToMeter",
|
|
6725
|
+
component: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
6726
|
+
option: yesNo,
|
|
6727
|
+
optionKey: "name",
|
|
6728
|
+
selected: props.value,
|
|
6729
|
+
select: props.onChange
|
|
6730
|
+
})
|
|
6731
|
+
}
|
|
6732
|
+
}, {
|
|
6733
|
+
label: t("Sewer Connection"),
|
|
6734
|
+
isMandatory: true,
|
|
6735
|
+
type: "custom",
|
|
6736
|
+
key: "sewerConnection",
|
|
6737
|
+
populators: {
|
|
6738
|
+
name: "sewerConnection",
|
|
6739
|
+
component: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
6740
|
+
option: yesNo,
|
|
6741
|
+
optionKey: "name",
|
|
6742
|
+
selected: props.value,
|
|
6743
|
+
select: props.onChange
|
|
6744
|
+
})
|
|
6745
|
+
}
|
|
6746
|
+
});
|
|
6747
|
+
if (sewerConnection === "No") {
|
|
6748
|
+
fields.push({
|
|
6749
|
+
label: t("Septic Tank"),
|
|
6750
|
+
isMandatory: true,
|
|
6751
|
+
type: "custom",
|
|
6752
|
+
key: "septicTank",
|
|
6753
|
+
populators: {
|
|
6754
|
+
name: "septicTank",
|
|
6755
|
+
component: props => /*#__PURE__*/React.createElement(Dropdown, {
|
|
6756
|
+
option: yesNo,
|
|
6757
|
+
optionKey: "name",
|
|
6758
|
+
selected: props.value,
|
|
6759
|
+
select: props.onChange
|
|
6760
|
+
})
|
|
6761
|
+
}
|
|
6762
|
+
});
|
|
6763
|
+
}
|
|
6764
|
+
return [{
|
|
6765
|
+
head: t("EKYC_METER_DETAILS"),
|
|
6766
|
+
body: fields
|
|
6767
|
+
}];
|
|
5995
6768
|
};
|
|
5996
6769
|
|
|
5997
6770
|
const MeterDetails = ({
|
|
@@ -5999,17 +6772,23 @@ const MeterDetails = ({
|
|
|
5999
6772
|
onSelect,
|
|
6000
6773
|
formData
|
|
6001
6774
|
}) => {
|
|
6775
|
+
const {
|
|
6776
|
+
t
|
|
6777
|
+
} = useTranslation();
|
|
6002
6778
|
const location = useLocation();
|
|
6003
6779
|
const flowState = location.state || {};
|
|
6004
6780
|
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
6005
|
-
const
|
|
6781
|
+
const queryParams = new URLSearchParams(location.search);
|
|
6782
|
+
const urlKno = queryParams.get("kno");
|
|
6783
|
+
const searchKno = urlKno || (flowState === null || flowState === void 0 ? void 0 : flowState.kNumber) || (flowState === null || flowState === void 0 ? void 0 : flowState.kno) || (formData === null || formData === void 0 ? void 0 : formData.kNumber) || (formData === null || formData === void 0 ? void 0 : formData.kno) || sessionStorage.getItem("EKYC_K_NUMBER");
|
|
6006
6784
|
const {
|
|
6007
6785
|
isLoading,
|
|
6008
6786
|
data: searchData
|
|
6009
6787
|
} = Digit.Hooks.ekyc.useSearchConnection({
|
|
6010
6788
|
tenantId,
|
|
6011
6789
|
details: {
|
|
6012
|
-
kno: searchKno
|
|
6790
|
+
kno: searchKno,
|
|
6791
|
+
fetchType: "METER"
|
|
6013
6792
|
}
|
|
6014
6793
|
}, {
|
|
6015
6794
|
enabled: !!searchKno,
|
|
@@ -6017,113 +6796,110 @@ const MeterDetails = ({
|
|
|
6017
6796
|
});
|
|
6018
6797
|
const updateMutation = Digit.Hooks.ekyc.useEkycUpdate(tenantId);
|
|
6019
6798
|
const savedData = (formData === null || formData === void 0 ? void 0 : formData.meterDetails) || {};
|
|
6020
|
-
const [connectionCategory, setConnectionCategory] = useState(savedData.connectionCategory || "");
|
|
6021
|
-
const [saType, setSaType] = useState(savedData.saType || "");
|
|
6022
|
-
const [status, setStatus] = useState(savedData.status || "");
|
|
6023
|
-
const [mrCode, setMrCode] = useState(savedData.mrCode || "");
|
|
6024
|
-
const [areaCode, setAreaCode] = useState(savedData.areaCode || "");
|
|
6025
|
-
const [mrKey, setMrKey] = useState(savedData.mrKey || "");
|
|
6026
|
-
const [meterNumber, setMeterNumber] = useState(savedData.meterNumber || "");
|
|
6027
|
-
const [meterMaker, setMeterMaker] = useState(savedData.meterMaker || "");
|
|
6028
|
-
const [meterStatus, setMeterStatus] = useState(savedData.meterStatus ? {
|
|
6029
|
-
name: savedData.meterStatus
|
|
6030
|
-
} : null);
|
|
6031
|
-
const [meterCondition, setMeterCondition] = useState(savedData.meterCondition ? {
|
|
6032
|
-
name: savedData.meterCondition
|
|
6033
|
-
} : null);
|
|
6034
|
-
const [meterLocation, setMeterLocation] = useState(savedData.meterLocation ? {
|
|
6035
|
-
name: savedData.meterLocation
|
|
6036
|
-
} : null);
|
|
6037
|
-
const [lastBillReceived, setLastBillReceived] = useState(savedData.lastBillReceived ? {
|
|
6038
|
-
name: savedData.lastBillReceived
|
|
6039
|
-
} : null);
|
|
6040
|
-
const [billMonthYear, setBillMonthYear] = useState(savedData.billMonthYear ? {
|
|
6041
|
-
name: savedData.billMonthYear
|
|
6042
|
-
} : null);
|
|
6043
|
-
const [reason, setReason] = useState(savedData.reason || "");
|
|
6044
|
-
const [accessToMeter, setAccessToMeter] = useState(savedData.accessToMeter ? {
|
|
6045
|
-
name: savedData.accessToMeter
|
|
6046
|
-
} : null);
|
|
6047
|
-
const [sewerConnection, setSewerConnection] = useState(savedData.sewerConnection ? {
|
|
6048
|
-
name: savedData.sewerConnection
|
|
6049
|
-
} : null);
|
|
6050
|
-
const [septicTank, setSepticTank] = useState(savedData.septicTank ? {
|
|
6051
|
-
name: savedData.septicTank
|
|
6052
|
-
} : null);
|
|
6053
6799
|
const [meterPhoto, setMeterPhoto] = useState(null);
|
|
6054
6800
|
const [meterPhotoId, setMeterPhotoId] = useState(savedData.meterPhotoId || null);
|
|
6055
6801
|
const [toast, setToast] = useState(null);
|
|
6056
|
-
const
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6802
|
+
const [isDataLoaded, setIsDataLoaded] = useState(false);
|
|
6803
|
+
const [canSubmit, setCanSubmit] = useState(false);
|
|
6804
|
+
const [defaultValues, setDefaultValues] = useState(() => ({
|
|
6805
|
+
connectionCategory: savedData.connectionCategory || "",
|
|
6806
|
+
saType: savedData.saType || "",
|
|
6807
|
+
status: savedData.status || "",
|
|
6808
|
+
mrCode: savedData.mrCode || "",
|
|
6809
|
+
areaCode: savedData.areaCode || "",
|
|
6810
|
+
mrKey: savedData.mrKey || "",
|
|
6811
|
+
meterNumber: savedData.meterNumber || "",
|
|
6812
|
+
meterMaker: savedData.meterMaker || "",
|
|
6813
|
+
meterStatus: savedData.meterStatus ? {
|
|
6814
|
+
name: savedData.meterStatus
|
|
6815
|
+
} : null,
|
|
6816
|
+
meterCondition: savedData.meterCondition ? {
|
|
6817
|
+
name: savedData.meterCondition
|
|
6818
|
+
} : null,
|
|
6819
|
+
meterLocation: savedData.meterLocation ? {
|
|
6820
|
+
name: savedData.meterLocation
|
|
6821
|
+
} : null,
|
|
6822
|
+
lastBillReceived: savedData.lastBillReceived ? {
|
|
6823
|
+
name: savedData.lastBillReceived
|
|
6824
|
+
} : null,
|
|
6825
|
+
billMonthYear: savedData.billMonthYear ? {
|
|
6826
|
+
name: savedData.billMonthYear
|
|
6827
|
+
} : null,
|
|
6828
|
+
reason: savedData.reason || "",
|
|
6829
|
+
accessToMeter: savedData.accessToMeter ? {
|
|
6830
|
+
name: savedData.accessToMeter
|
|
6831
|
+
} : null,
|
|
6832
|
+
sewerConnection: savedData.sewerConnection ? {
|
|
6833
|
+
name: savedData.sewerConnection
|
|
6834
|
+
} : null,
|
|
6835
|
+
septicTank: savedData.septicTank ? {
|
|
6836
|
+
name: savedData.septicTank
|
|
6837
|
+
} : null,
|
|
6838
|
+
meterPhoto: savedData.meterPhotoId ? "Uploaded" : null
|
|
6839
|
+
}));
|
|
6840
|
+
const [localFormData, setLocalFormData] = useState(defaultValues);
|
|
6841
|
+
const extractApplicationData = searchData => {
|
|
6842
|
+
if (!searchData) return null;
|
|
6843
|
+
const reviewWrapper = (searchData === null || searchData === void 0 ? void 0 : searchData.applicationReviewInfo) || (searchData === null || searchData === void 0 ? void 0 : searchData.applicationReview) || searchData;
|
|
6844
|
+
const applicationData = (Array.isArray(reviewWrapper) ? reviewWrapper[0] : reviewWrapper) || {};
|
|
6845
|
+
return (applicationData === null || applicationData === void 0 ? void 0 : applicationData.newData) || applicationData;
|
|
6846
|
+
};
|
|
6086
6847
|
useEffect(() => {
|
|
6087
|
-
const
|
|
6848
|
+
const appData = extractApplicationData(searchData);
|
|
6849
|
+
const rawData = appData || (formData === null || formData === void 0 ? void 0 : formData.connectionDetails);
|
|
6088
6850
|
const apiMeter = (rawData === null || rawData === void 0 ? void 0 : rawData.meterDetails) || rawData || {};
|
|
6089
|
-
if (apiMeter && Object.keys(apiMeter).length > 0 && !
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6851
|
+
if (apiMeter && Object.keys(apiMeter).length > 0 && !isDataLoaded) {
|
|
6852
|
+
let mStatus = null;
|
|
6853
|
+
let mCondition = null;
|
|
6854
|
+
let mLoc = null;
|
|
6855
|
+
let billRec = null;
|
|
6856
|
+
let billMonYr = null;
|
|
6857
|
+
let accToMeter = null;
|
|
6858
|
+
let sewerConn = null;
|
|
6859
|
+
let sepTank = null;
|
|
6098
6860
|
if (apiMeter.meterStatus) {
|
|
6099
|
-
const matchingStatus =
|
|
6100
|
-
|
|
6861
|
+
const matchingStatus = [{
|
|
6862
|
+
name: "Metered"
|
|
6863
|
+
}, {
|
|
6864
|
+
name: "Unmetered"
|
|
6865
|
+
}, {
|
|
6866
|
+
name: "Can not be identified"
|
|
6867
|
+
}].find(o => o.name.toLowerCase() === apiMeter.meterStatus.toLowerCase());
|
|
6868
|
+
if (matchingStatus) mStatus = matchingStatus;else mStatus = {
|
|
6101
6869
|
name: apiMeter.meterStatus
|
|
6102
|
-
}
|
|
6870
|
+
};
|
|
6103
6871
|
} else if (apiMeter.metered !== undefined) {
|
|
6104
|
-
|
|
6872
|
+
mStatus = {
|
|
6105
6873
|
name: apiMeter.metered ? "Metered" : "Unmetered"
|
|
6106
|
-
}
|
|
6874
|
+
};
|
|
6107
6875
|
}
|
|
6108
6876
|
if (apiMeter.meterCondition) {
|
|
6109
|
-
const matchingCond =
|
|
6110
|
-
|
|
6877
|
+
const matchingCond = [{
|
|
6878
|
+
name: "Damaged"
|
|
6879
|
+
}, {
|
|
6880
|
+
name: "Not-Damaged"
|
|
6881
|
+
}].find(o => o.name.toLowerCase() === apiMeter.meterCondition.toLowerCase());
|
|
6882
|
+
if (matchingCond) mCondition = matchingCond;else mCondition = {
|
|
6111
6883
|
name: apiMeter.meterCondition
|
|
6112
|
-
}
|
|
6884
|
+
};
|
|
6113
6885
|
}
|
|
6114
6886
|
if (apiMeter.meterLocation) {
|
|
6115
|
-
const matchingLoc =
|
|
6116
|
-
|
|
6887
|
+
const matchingLoc = [{
|
|
6888
|
+
name: "Inside"
|
|
6889
|
+
}, {
|
|
6890
|
+
name: "Outside"
|
|
6891
|
+
}].find(o => o.name.toLowerCase() === apiMeter.meterLocation.toLowerCase() || apiMeter.meterLocation.toLowerCase().includes(o.name.toLowerCase()));
|
|
6892
|
+
if (matchingLoc) mLoc = matchingLoc;else mLoc = {
|
|
6117
6893
|
name: apiMeter.meterLocation
|
|
6118
|
-
}
|
|
6894
|
+
};
|
|
6119
6895
|
}
|
|
6120
6896
|
if (apiMeter.lastBillRaised !== undefined && apiMeter.lastBillRaised !== null) {
|
|
6121
6897
|
const strVal = String(apiMeter.lastBillRaised).toLowerCase();
|
|
6122
|
-
if (strVal === "true" || strVal === "yes")
|
|
6898
|
+
if (strVal === "true" || strVal === "yes") billRec = {
|
|
6123
6899
|
name: "Yes"
|
|
6124
|
-
}
|
|
6900
|
+
};else billRec = {
|
|
6125
6901
|
name: "No"
|
|
6126
|
-
}
|
|
6902
|
+
};
|
|
6127
6903
|
}
|
|
6128
6904
|
if (apiMeter.lastBillReceivedDate) {
|
|
6129
6905
|
const formatted = apiMeter.lastBillReceivedDate.replace("-", "/");
|
|
@@ -6131,199 +6907,213 @@ const MeterDetails = ({
|
|
|
6131
6907
|
if (parsedParts.length === 2) {
|
|
6132
6908
|
const mon = parseInt(parsedParts[0], 10);
|
|
6133
6909
|
const yr = parseInt(parsedParts[1], 10);
|
|
6134
|
-
|
|
6910
|
+
billMonYr = {
|
|
6135
6911
|
name: `${mon}/${yr}`
|
|
6136
|
-
}
|
|
6912
|
+
};
|
|
6137
6913
|
} else {
|
|
6138
|
-
|
|
6914
|
+
billMonYr = {
|
|
6139
6915
|
name: apiMeter.lastBillReceivedDate
|
|
6140
|
-
}
|
|
6916
|
+
};
|
|
6141
6917
|
}
|
|
6142
6918
|
}
|
|
6143
|
-
if (apiMeter.lastBillNotRaisedReason) setReason(apiMeter.lastBillNotRaisedReason);
|
|
6144
6919
|
if (apiMeter.accessToMeter !== undefined && apiMeter.accessToMeter !== null) {
|
|
6145
6920
|
const strVal = String(apiMeter.accessToMeter).toLowerCase();
|
|
6146
|
-
if (strVal === "true" || strVal === "yes")
|
|
6921
|
+
if (strVal === "true" || strVal === "yes") accToMeter = {
|
|
6147
6922
|
name: "Yes"
|
|
6148
|
-
}
|
|
6923
|
+
};else accToMeter = {
|
|
6149
6924
|
name: "No"
|
|
6150
|
-
}
|
|
6925
|
+
};
|
|
6151
6926
|
}
|
|
6152
6927
|
if (apiMeter.sewerConnection !== undefined && apiMeter.sewerConnection !== null) {
|
|
6153
6928
|
const strVal = String(apiMeter.sewerConnection).toLowerCase();
|
|
6154
|
-
if (strVal === "true" || strVal === "yes")
|
|
6929
|
+
if (strVal === "true" || strVal === "yes") sewerConn = {
|
|
6155
6930
|
name: "Yes"
|
|
6156
|
-
}
|
|
6931
|
+
};else sewerConn = {
|
|
6157
6932
|
name: "No"
|
|
6158
|
-
}
|
|
6933
|
+
};
|
|
6159
6934
|
}
|
|
6160
6935
|
if (apiMeter.septicTank !== undefined && apiMeter.septicTank !== null) {
|
|
6161
6936
|
const strVal = String(apiMeter.septicTank).toLowerCase();
|
|
6162
|
-
if (strVal === "true" || strVal === "yes")
|
|
6937
|
+
if (strVal === "true" || strVal === "yes") sepTank = {
|
|
6163
6938
|
name: "Yes"
|
|
6164
|
-
}
|
|
6939
|
+
};else sepTank = {
|
|
6165
6940
|
name: "No"
|
|
6166
|
-
}
|
|
6941
|
+
};
|
|
6167
6942
|
}
|
|
6168
|
-
|
|
6943
|
+
const updatedDefaults = {
|
|
6944
|
+
connectionCategory: savedData.connectionCategory || apiMeter.connectionCategory || "",
|
|
6945
|
+
saType: savedData.saType || apiMeter.saType || "",
|
|
6946
|
+
status: savedData.status || apiMeter.statusFlag || "",
|
|
6947
|
+
mrCode: savedData.mrCode || (apiMeter.mrcode ? String(apiMeter.mrcode) : ""),
|
|
6948
|
+
areaCode: savedData.areaCode || (apiMeter.areacode ? String(apiMeter.areacode) : ""),
|
|
6949
|
+
mrKey: savedData.mrKey || (apiMeter.mrkey ? String(apiMeter.mrkey) : ""),
|
|
6950
|
+
meterNumber: savedData.meterNumber || apiMeter.meterNumber || "",
|
|
6951
|
+
meterMaker: savedData.meterMaker || apiMeter.meterMake || "",
|
|
6952
|
+
meterStatus: savedData.meterStatus ? {
|
|
6953
|
+
name: savedData.meterStatus
|
|
6954
|
+
} : mStatus,
|
|
6955
|
+
meterCondition: savedData.meterCondition ? {
|
|
6956
|
+
name: savedData.meterCondition
|
|
6957
|
+
} : mCondition,
|
|
6958
|
+
meterLocation: savedData.meterLocation ? {
|
|
6959
|
+
name: savedData.meterLocation
|
|
6960
|
+
} : mLoc,
|
|
6961
|
+
lastBillReceived: savedData.lastBillReceived ? {
|
|
6962
|
+
name: savedData.lastBillReceived
|
|
6963
|
+
} : billRec,
|
|
6964
|
+
billMonthYear: savedData.billMonthYear ? {
|
|
6965
|
+
name: savedData.billMonthYear
|
|
6966
|
+
} : billMonYr,
|
|
6967
|
+
reason: savedData.reason || apiMeter.lastBillNotRaisedReason || "",
|
|
6968
|
+
accessToMeter: savedData.accessToMeter ? {
|
|
6969
|
+
name: savedData.accessToMeter
|
|
6970
|
+
} : accToMeter,
|
|
6971
|
+
sewerConnection: savedData.sewerConnection ? {
|
|
6972
|
+
name: savedData.sewerConnection
|
|
6973
|
+
} : sewerConn,
|
|
6974
|
+
septicTank: savedData.septicTank ? {
|
|
6975
|
+
name: savedData.septicTank
|
|
6976
|
+
} : sepTank,
|
|
6977
|
+
meterPhoto: savedData.meterPhotoId || apiMeter.meterPhotoFileStoreId || null
|
|
6978
|
+
};
|
|
6979
|
+
setDefaultValues(updatedDefaults);
|
|
6980
|
+
setLocalFormData(updatedDefaults);
|
|
6981
|
+
if (updatedDefaults.meterPhoto) {
|
|
6982
|
+
setMeterPhotoId(updatedDefaults.meterPhoto);
|
|
6983
|
+
}
|
|
6984
|
+
setIsDataLoaded(true);
|
|
6169
6985
|
}
|
|
6170
|
-
}, [searchData, formData === null || formData === void 0 ? void 0 : formData.connectionDetails]);
|
|
6171
|
-
const
|
|
6172
|
-
const uploadPhoto = async e => {
|
|
6986
|
+
}, [searchData, formData === null || formData === void 0 ? void 0 : formData.connectionDetails, isDataLoaded]);
|
|
6987
|
+
const handleUpload = async (e, onChange) => {
|
|
6173
6988
|
const file = e.target.files[0];
|
|
6174
6989
|
if (!file) return;
|
|
6990
|
+
if (file.size > 2000000) {
|
|
6991
|
+
setToast({
|
|
6992
|
+
type: "error",
|
|
6993
|
+
message: t("Max size 2MB exceeded")
|
|
6994
|
+
});
|
|
6995
|
+
return;
|
|
6996
|
+
}
|
|
6175
6997
|
try {
|
|
6176
6998
|
var _res$data, _res$data$files, _res$data$files$;
|
|
6177
6999
|
const res = await Digit.UploadServices.Filestorage("EKYC", file, tenantId);
|
|
6178
|
-
const
|
|
6179
|
-
if (
|
|
6180
|
-
|
|
7000
|
+
const fileStoreId = res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$files = _res$data.files) === null || _res$data$files === void 0 ? void 0 : (_res$data$files$ = _res$data$files[0]) === null || _res$data$files$ === void 0 ? void 0 : _res$data$files$.fileStoreId;
|
|
7001
|
+
if (fileStoreId) {
|
|
7002
|
+
onChange(file.name);
|
|
7003
|
+
setMeterPhotoId(fileStoreId);
|
|
6181
7004
|
const reader = new FileReader();
|
|
6182
7005
|
reader.onloadend = () => setMeterPhoto(reader.result);
|
|
6183
7006
|
reader.readAsDataURL(file);
|
|
7007
|
+
setToast({
|
|
7008
|
+
type: "success",
|
|
7009
|
+
message: t("Upload successful")
|
|
7010
|
+
});
|
|
6184
7011
|
}
|
|
6185
7012
|
} catch {
|
|
6186
7013
|
setToast({
|
|
6187
7014
|
type: "error",
|
|
6188
|
-
message: "Upload failed"
|
|
7015
|
+
message: t("Upload failed")
|
|
6189
7016
|
});
|
|
6190
7017
|
}
|
|
6191
7018
|
};
|
|
6192
|
-
const
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
if (
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
7019
|
+
const onFormValueChange = (setValue, data) => {
|
|
7020
|
+
var _data$meterStatus, _localFormData$meterS, _data$lastBillReceive, _localFormData$lastBi, _data$sewerConnection, _localFormData$sewerC;
|
|
7021
|
+
const meterStatusChanged = ((data === null || data === void 0 ? void 0 : (_data$meterStatus = data.meterStatus) === null || _data$meterStatus === void 0 ? void 0 : _data$meterStatus.name) || (data === null || data === void 0 ? void 0 : data.meterStatus)) !== ((localFormData === null || localFormData === void 0 ? void 0 : (_localFormData$meterS = localFormData.meterStatus) === null || _localFormData$meterS === void 0 ? void 0 : _localFormData$meterS.name) || (localFormData === null || localFormData === void 0 ? void 0 : localFormData.meterStatus));
|
|
7022
|
+
const lastBillReceivedChanged = ((data === null || data === void 0 ? void 0 : (_data$lastBillReceive = data.lastBillReceived) === null || _data$lastBillReceive === void 0 ? void 0 : _data$lastBillReceive.name) || (data === null || data === void 0 ? void 0 : data.lastBillReceived)) !== ((localFormData === null || localFormData === void 0 ? void 0 : (_localFormData$lastBi = localFormData.lastBillReceived) === null || _localFormData$lastBi === void 0 ? void 0 : _localFormData$lastBi.name) || (localFormData === null || localFormData === void 0 ? void 0 : localFormData.lastBillReceived));
|
|
7023
|
+
const sewerConnectionChanged = ((data === null || data === void 0 ? void 0 : (_data$sewerConnection = data.sewerConnection) === null || _data$sewerConnection === void 0 ? void 0 : _data$sewerConnection.name) || (data === null || data === void 0 ? void 0 : data.sewerConnection)) !== ((localFormData === null || localFormData === void 0 ? void 0 : (_localFormData$sewerC = localFormData.sewerConnection) === null || _localFormData$sewerC === void 0 ? void 0 : _localFormData$sewerC.name) || (localFormData === null || localFormData === void 0 ? void 0 : localFormData.sewerConnection));
|
|
7024
|
+
if (meterStatusChanged || lastBillReceivedChanged || sewerConnectionChanged) {
|
|
7025
|
+
setLocalFormData(prev => ({
|
|
7026
|
+
...prev,
|
|
7027
|
+
...data
|
|
7028
|
+
}));
|
|
7029
|
+
}
|
|
7030
|
+
const connCatVal = data === null || data === void 0 ? void 0 : data.connectionCategory;
|
|
7031
|
+
const mStatusVal = data === null || data === void 0 ? void 0 : data.meterStatus;
|
|
7032
|
+
const mLocVal = data === null || data === void 0 ? void 0 : data.meterLocation;
|
|
7033
|
+
const billRecVal = data === null || data === void 0 ? void 0 : data.lastBillReceived;
|
|
7034
|
+
const sewerConnVal = data === null || data === void 0 ? void 0 : data.sewerConnection;
|
|
7035
|
+
const mPhotoId = meterPhotoId || (data === null || data === void 0 ? void 0 : data.meterPhoto);
|
|
7036
|
+
const reasonVal = data === null || data === void 0 ? void 0 : data.reason;
|
|
7037
|
+
const billMonYrVal = data === null || data === void 0 ? void 0 : data.billMonthYear;
|
|
7038
|
+
const sepTankVal = data === null || data === void 0 ? void 0 : data.septicTank;
|
|
7039
|
+
let valid = true;
|
|
7040
|
+
if (!connCatVal) valid = false;
|
|
7041
|
+
if (!mStatusVal) valid = false;
|
|
7042
|
+
if (!mLocVal) valid = false;
|
|
7043
|
+
if (!billRecVal) valid = false;
|
|
7044
|
+
if (!sewerConnVal) valid = false;
|
|
7045
|
+
if ((mStatusVal === null || mStatusVal === void 0 ? void 0 : mStatusVal.name) === "Metered" && !mPhotoId) valid = false;
|
|
7046
|
+
if ((billRecVal === null || billRecVal === void 0 ? void 0 : billRecVal.name) === "No" && !reasonVal) valid = false;
|
|
7047
|
+
if ((billRecVal === null || billRecVal === void 0 ? void 0 : billRecVal.name) === "Yes" && !billMonYrVal) valid = false;
|
|
7048
|
+
if ((sewerConnVal === null || sewerConnVal === void 0 ? void 0 : sewerConnVal.name) === "No" && !sepTankVal) valid = false;
|
|
7049
|
+
if (valid !== canSubmit) {
|
|
7050
|
+
setCanSubmit(valid);
|
|
7051
|
+
}
|
|
6203
7052
|
};
|
|
6204
|
-
const
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
7053
|
+
const onSubmit = async data => {
|
|
7054
|
+
var _data$meterStatus2, _data$meterCondition, _data$meterLocation, _data$lastBillReceive2, _data$billMonthYear, _data$accessToMeter, _data$sewerConnection2, _data$septicTank;
|
|
7055
|
+
const submitData = {
|
|
7056
|
+
connectionCategory: data.connectionCategory,
|
|
7057
|
+
saType: data.saType,
|
|
7058
|
+
status: data.status,
|
|
7059
|
+
mrCode: data.mrCode,
|
|
7060
|
+
areaCode: data.areaCode,
|
|
7061
|
+
mrKey: data.mrKey,
|
|
7062
|
+
meterNumber: data.meterNumber,
|
|
7063
|
+
meterMaker: data.meterMaker,
|
|
7064
|
+
meterStatus: ((_data$meterStatus2 = data.meterStatus) === null || _data$meterStatus2 === void 0 ? void 0 : _data$meterStatus2.name) || data.meterStatus,
|
|
7065
|
+
meterCondition: ((_data$meterCondition = data.meterCondition) === null || _data$meterCondition === void 0 ? void 0 : _data$meterCondition.name) || data.meterCondition,
|
|
7066
|
+
meterLocation: ((_data$meterLocation = data.meterLocation) === null || _data$meterLocation === void 0 ? void 0 : _data$meterLocation.name) || data.meterLocation,
|
|
7067
|
+
lastBillReceived: ((_data$lastBillReceive2 = data.lastBillReceived) === null || _data$lastBillReceive2 === void 0 ? void 0 : _data$lastBillReceive2.name) || data.lastBillReceived,
|
|
7068
|
+
billMonthYear: ((_data$billMonthYear = data.billMonthYear) === null || _data$billMonthYear === void 0 ? void 0 : _data$billMonthYear.name) || data.billMonthYear,
|
|
7069
|
+
reason: data.reason,
|
|
7070
|
+
accessToMeter: ((_data$accessToMeter = data.accessToMeter) === null || _data$accessToMeter === void 0 ? void 0 : _data$accessToMeter.name) || data.accessToMeter,
|
|
7071
|
+
sewerConnection: ((_data$sewerConnection2 = data.sewerConnection) === null || _data$sewerConnection2 === void 0 ? void 0 : _data$sewerConnection2.name) || data.sewerConnection,
|
|
7072
|
+
septicTank: ((_data$septicTank = data.septicTank) === null || _data$septicTank === void 0 ? void 0 : _data$septicTank.name) || data.septicTank,
|
|
7073
|
+
meterPhotoId: meterPhotoId
|
|
6224
7074
|
};
|
|
6225
7075
|
try {
|
|
6226
7076
|
await updateMutation.mutateAsync({
|
|
6227
7077
|
RequestInfo: {},
|
|
6228
7078
|
updateType: "METER",
|
|
6229
7079
|
kno: searchKno,
|
|
6230
|
-
...
|
|
7080
|
+
...submitData
|
|
6231
7081
|
});
|
|
6232
7082
|
setToast({
|
|
6233
7083
|
type: "success",
|
|
6234
|
-
message: "Meter details updated successfully!"
|
|
7084
|
+
message: t("Meter details updated successfully!")
|
|
6235
7085
|
});
|
|
6236
|
-
onSelect(config.key,
|
|
7086
|
+
onSelect(config.key, submitData);
|
|
6237
7087
|
} catch (error) {
|
|
6238
7088
|
setToast({
|
|
6239
7089
|
type: "error",
|
|
6240
|
-
message: "Failed to update meter details"
|
|
7090
|
+
message: t("Failed to update meter details")
|
|
6241
7091
|
});
|
|
6242
7092
|
}
|
|
6243
7093
|
};
|
|
6244
7094
|
if (isLoading) {
|
|
6245
7095
|
return /*#__PURE__*/React.createElement(Loader, null);
|
|
6246
7096
|
}
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
isDisabled: !
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Area Code"), /*#__PURE__*/React.createElement(TextInput, {
|
|
6264
|
-
value: areaCode,
|
|
6265
|
-
onChange: e => setAreaCode(e.target.value)
|
|
6266
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "MR Key"), /*#__PURE__*/React.createElement(TextInput, {
|
|
6267
|
-
value: mrKey,
|
|
6268
|
-
onChange: e => setMrKey(e.target.value)
|
|
6269
|
-
})), !isFrozen && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Meter Number"), /*#__PURE__*/React.createElement(TextInput, {
|
|
6270
|
-
value: meterNumber,
|
|
6271
|
-
onChange: e => setMeterNumber(e.target.value)
|
|
6272
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Meter Maker"), /*#__PURE__*/React.createElement(TextInput, {
|
|
6273
|
-
value: meterMaker,
|
|
6274
|
-
onChange: e => setMeterMaker(e.target.value)
|
|
6275
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Meter Condition"), /*#__PURE__*/React.createElement(Dropdown, {
|
|
6276
|
-
option: meterConditionOptions,
|
|
6277
|
-
selected: meterCondition,
|
|
6278
|
-
select: setMeterCondition
|
|
6279
|
-
})), (meterStatus === null || meterStatus === void 0 ? void 0 : meterStatus.name) === "Metered" && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Meter Photo *"), /*#__PURE__*/React.createElement(UploadFile, {
|
|
6280
|
-
onUpload: uploadPhoto,
|
|
6281
|
-
message: meterPhotoId ? "Uploaded" : "No file"
|
|
6282
|
-
})), meterPhoto && /*#__PURE__*/React.createElement("div", {
|
|
6283
|
-
style: {
|
|
6284
|
-
gridColumn: "span 2"
|
|
6285
|
-
}
|
|
6286
|
-
}, /*#__PURE__*/React.createElement("img", {
|
|
6287
|
-
src: meterPhoto,
|
|
6288
|
-
style: {
|
|
6289
|
-
width: "100%"
|
|
6290
|
-
}
|
|
6291
|
-
})))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Meter Status *"), /*#__PURE__*/React.createElement(Dropdown, {
|
|
6292
|
-
option: meterStatusOptions,
|
|
6293
|
-
selected: meterStatus,
|
|
6294
|
-
select: setMeterStatus
|
|
6295
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Meter Location *"), /*#__PURE__*/React.createElement(Dropdown, {
|
|
6296
|
-
option: meterLocationOptions,
|
|
6297
|
-
selected: meterLocation,
|
|
6298
|
-
select: setMeterLocation
|
|
6299
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Last Bill Received *"), /*#__PURE__*/React.createElement(Dropdown, {
|
|
6300
|
-
option: yesNo,
|
|
6301
|
-
selected: lastBillReceived,
|
|
6302
|
-
select: setLastBillReceived
|
|
6303
|
-
})), (lastBillReceived === null || lastBillReceived === void 0 ? void 0 : lastBillReceived.name) === "Yes" && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "When was the last bill received *"), /*#__PURE__*/React.createElement(Dropdown, {
|
|
6304
|
-
option: monthYearOptions,
|
|
6305
|
-
selected: billMonthYear,
|
|
6306
|
-
select: setBillMonthYear
|
|
6307
|
-
})), (lastBillReceived === null || lastBillReceived === void 0 ? void 0 : lastBillReceived.name) === "No" && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Reason *"), /*#__PURE__*/React.createElement(TextInput, {
|
|
6308
|
-
value: reason,
|
|
6309
|
-
onChange: e => setReason(e.target.value)
|
|
6310
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Access to Meter"), /*#__PURE__*/React.createElement(Dropdown, {
|
|
6311
|
-
option: yesNo,
|
|
6312
|
-
selected: accessToMeter,
|
|
6313
|
-
select: setAccessToMeter
|
|
6314
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Sewer Connection *"), /*#__PURE__*/React.createElement(Dropdown, {
|
|
6315
|
-
option: yesNo,
|
|
6316
|
-
selected: sewerConnection,
|
|
6317
|
-
select: setSewerConnection
|
|
6318
|
-
})), (sewerConnection === null || sewerConnection === void 0 ? void 0 : sewerConnection.name) === "No" && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CardLabel, null, "Septic Tank *"), /*#__PURE__*/React.createElement(Dropdown, {
|
|
6319
|
-
option: yesNo,
|
|
6320
|
-
selected: septicTank,
|
|
6321
|
-
select: setSepticTank
|
|
6322
|
-
})), toast && /*#__PURE__*/React.createElement(Toast, {
|
|
6323
|
-
label: toast.message,
|
|
7097
|
+
const Config = MeterDetailsConfig(t, localFormData, handleUpload, meterPhoto, meterPhotoId, setMeterPhoto, setMeterPhotoId);
|
|
7098
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(FormComposer, {
|
|
7099
|
+
key: isDataLoaded ? "loaded" : "loading",
|
|
7100
|
+
isDisabled: !canSubmit,
|
|
7101
|
+
label: t("ES_COMMON_CONTINUE"),
|
|
7102
|
+
config: Config.map(item => ({
|
|
7103
|
+
...item,
|
|
7104
|
+
isCollapsible: true,
|
|
7105
|
+
isDefaultOpen: true
|
|
7106
|
+
})),
|
|
7107
|
+
onSubmit: onSubmit,
|
|
7108
|
+
defaultValues: defaultValues,
|
|
7109
|
+
onFormValueChange: onFormValueChange,
|
|
7110
|
+
noCard: false,
|
|
7111
|
+
submitInForm: true
|
|
7112
|
+
}), toast && /*#__PURE__*/React.createElement(Toast, {
|
|
6324
7113
|
error: toast.type === "error",
|
|
7114
|
+
label: toast.message,
|
|
6325
7115
|
onClose: () => setToast(null)
|
|
6326
|
-
}))
|
|
7116
|
+
}));
|
|
6327
7117
|
};
|
|
6328
7118
|
|
|
6329
7119
|
const Home = () => {
|
|
@@ -6374,7 +7164,7 @@ const Home = () => {
|
|
|
6374
7164
|
const Inbox$1 = ({
|
|
6375
7165
|
parentRoute
|
|
6376
7166
|
}) => {
|
|
6377
|
-
var _formState$tableForm3, _formState$tableForm4, _formState$searchForm3, _formState$searchForm4, _dashboardData$
|
|
7167
|
+
var _formState$tableForm3, _formState$tableForm4, _formState$searchForm3, _formState$searchForm4, _dashboardData$dashbo;
|
|
6378
7168
|
const tenantId = Digit.ULBService.getCurrentTenantId();
|
|
6379
7169
|
const location = useLocation();
|
|
6380
7170
|
const formInitValue = {
|
|
@@ -6397,10 +7187,19 @@ const Inbox$1 = ({
|
|
|
6397
7187
|
search: (formState === null || formState === void 0 ? void 0 : formState.searchForm) || {}
|
|
6398
7188
|
};
|
|
6399
7189
|
}, [tenantId, formState === null || formState === void 0 ? void 0 : (_formState$tableForm3 = formState.tableForm) === null || _formState$tableForm3 === void 0 ? void 0 : _formState$tableForm3.offset, formState === null || formState === void 0 ? void 0 : (_formState$tableForm4 = formState.tableForm) === null || _formState$tableForm4 === void 0 ? void 0 : _formState$tableForm4.limit, formState === null || formState === void 0 ? void 0 : formState.searchForm]);
|
|
7190
|
+
const filters = useMemo(() => {
|
|
7191
|
+
const searchForm = (formState === null || formState === void 0 ? void 0 : formState.searchForm) || {};
|
|
7192
|
+
return {
|
|
7193
|
+
...searchForm,
|
|
7194
|
+
...(searchForm.kNumber && {
|
|
7195
|
+
kno: searchForm.kNumber
|
|
7196
|
+
})
|
|
7197
|
+
};
|
|
7198
|
+
}, [formState === null || formState === void 0 ? void 0 : formState.searchForm]);
|
|
6400
7199
|
const {
|
|
6401
7200
|
isLoading,
|
|
6402
7201
|
data: dashboardData = {}
|
|
6403
|
-
} = Digit.Hooks.ekyc.
|
|
7202
|
+
} = Digit.Hooks.ekyc.useEkycApplicationList(filters, queryParams, {
|
|
6404
7203
|
enabled: !!tenantId,
|
|
6405
7204
|
keepPreviousData: true
|
|
6406
7205
|
});
|
|
@@ -6423,18 +7222,17 @@ const Inbox$1 = ({
|
|
|
6423
7222
|
keepPreviousData: true
|
|
6424
7223
|
});
|
|
6425
7224
|
const sourceData = useMemo(() => {
|
|
6426
|
-
var _dashboardData$dashbo;
|
|
6427
7225
|
if (isSearchActive) {
|
|
6428
7226
|
if (!searchData) return [];
|
|
6429
7227
|
return [searchData];
|
|
6430
7228
|
}
|
|
6431
|
-
return (dashboardData === null || dashboardData === void 0 ? void 0 :
|
|
7229
|
+
return (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.consumerList) || [];
|
|
6432
7230
|
}, [isSearchActive, searchData, dashboardData]);
|
|
6433
7231
|
const filteredData = useMemo(() => {
|
|
6434
7232
|
return (sourceData || []).map(item => {
|
|
6435
7233
|
const isSearchItem = !!item.connectionDetails;
|
|
6436
7234
|
if (isSearchItem) {
|
|
6437
|
-
var _item$propertyInfo, _item$propertyInfo2, _item$connectionDetai, _item$propertyInfo3, _item$connectionDetai2, _item$connectionDetai3;
|
|
7235
|
+
var _item$propertyInfo, _item$propertyInfo2, _item$connectionDetai, _item$propertyInfo3, _item$connectionDetai2, _item$connectionDetai3, _item$connectionDetai4, _item$connectionDetai5;
|
|
6438
7236
|
return {
|
|
6439
7237
|
applicationNo: ((_item$propertyInfo = item.propertyInfo) === null || _item$propertyInfo === void 0 ? void 0 : _item$propertyInfo.kno) || "",
|
|
6440
7238
|
connectionNo: ((_item$propertyInfo2 = item.propertyInfo) === null || _item$propertyInfo2 === void 0 ? void 0 : _item$propertyInfo2.kno) || "",
|
|
@@ -6442,6 +7240,7 @@ const Inbox$1 = ({
|
|
|
6442
7240
|
applicationNumber: ((_item$propertyInfo3 = item.propertyInfo) === null || _item$propertyInfo3 === void 0 ? void 0 : _item$propertyInfo3.kno) || "",
|
|
6443
7241
|
citizenName: ((_item$connectionDetai2 = item.connectionDetails) === null || _item$connectionDetai2 === void 0 ? void 0 : _item$connectionDetai2.consumerName) || "",
|
|
6444
7242
|
status: ((_item$connectionDetai3 = item.connectionDetails) === null || _item$connectionDetai3 === void 0 ? void 0 : _item$connectionDetai3.statusflag) || "",
|
|
7243
|
+
ekycStatus: ((_item$connectionDetai4 = item.connectionDetails) === null || _item$connectionDetai4 === void 0 ? void 0 : _item$connectionDetai4.ekycStatus) || ((_item$connectionDetai5 = item.connectionDetails) === null || _item$connectionDetai5 === void 0 ? void 0 : _item$connectionDetai5.ekycstatus) || item.ekycStatus || item.ekycstatus || "NA",
|
|
6445
7244
|
sla: 0
|
|
6446
7245
|
};
|
|
6447
7246
|
}
|
|
@@ -6453,11 +7252,12 @@ const Inbox$1 = ({
|
|
|
6453
7252
|
applicationNumber: item.kno || item.applicationNumber || "",
|
|
6454
7253
|
citizenName: item.consumerName || item.citizenName || "",
|
|
6455
7254
|
status: item.status || "",
|
|
7255
|
+
ekycStatus: item.ekycStatus || item.ekycstatus || "NA",
|
|
6456
7256
|
sla: item.sla ?? 0
|
|
6457
7257
|
};
|
|
6458
7258
|
});
|
|
6459
7259
|
}, [sourceData]);
|
|
6460
|
-
const totalRecords = (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$
|
|
7260
|
+
const totalRecords = (dashboardData === null || dashboardData === void 0 ? void 0 : (_dashboardData$dashbo = dashboardData.dashboardInfo) === null || _dashboardData$dashbo === void 0 ? void 0 : _dashboardData$dashbo.totalRecords) || (dashboardData === null || dashboardData === void 0 ? void 0 : dashboardData.totalCount) || 0;
|
|
6461
7261
|
const checkPathName = location.pathname.includes("ekyc/inbox");
|
|
6462
7262
|
const SearchFormFields = useCallback(({
|
|
6463
7263
|
registerRef,
|
|
@@ -6492,12 +7292,12 @@ const Inbox$1 = ({
|
|
|
6492
7292
|
});
|
|
6493
7293
|
};
|
|
6494
7294
|
const searchFormDefaultValues = {
|
|
6495
|
-
|
|
7295
|
+
kNumber: "",
|
|
6496
7296
|
applicationNumber: "",
|
|
6497
7297
|
consumerNo: ""
|
|
6498
7298
|
};
|
|
6499
7299
|
const onSearchFormReset = setSearchFormValue => {
|
|
6500
|
-
setSearchFormValue("
|
|
7300
|
+
setSearchFormValue("kNumber", null);
|
|
6501
7301
|
setSearchFormValue("applicationNumber", null);
|
|
6502
7302
|
setSearchFormValue("consumerNo", null);
|
|
6503
7303
|
dispatch({
|