@mseva/digit-ui-module-core 1.0.54 → 1.0.56
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 +66 -70
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -13837,7 +13837,7 @@ const UserProfile = ({
|
|
|
13837
13837
|
userType,
|
|
13838
13838
|
cityDetails
|
|
13839
13839
|
}) => {
|
|
13840
|
-
var _Digit$UserService$ge, _errors$userName, _errors$mobileNumber, _errors$emailAddress, _errors$currentPasswo, _errors$newPassword, _errors$confirmPasswo;
|
|
13840
|
+
var _Digit$UserService$ge, _userInfo$roles, _errors$userName, _errors$mobileNumber, _errors$emailAddress, _errors$currentPasswo, _errors$newPassword, _errors$confirmPasswo;
|
|
13841
13841
|
const history = useHistory();
|
|
13842
13842
|
const {
|
|
13843
13843
|
t
|
|
@@ -13877,6 +13877,7 @@ const UserProfile = ({
|
|
|
13877
13877
|
const [selectedCorrespondentState, setSelectedCorrespondentState] = useState();
|
|
13878
13878
|
const [selectedCorrespondentDistrict, setSelectedCorrespondentDistrict] = useState();
|
|
13879
13879
|
const [pinCodeCorrespondent, setPinCodeCorrespondent] = useState();
|
|
13880
|
+
const isUserArchitect = window.location.href.includes("citizen") && (userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$roles = userInfo.roles) === null || _userInfo$roles === void 0 ? void 0 : _userInfo$roles.some(role => role.code.includes("BPA_ARCHITECT")));
|
|
13880
13881
|
const getUserInfo = async () => {
|
|
13881
13882
|
const uuid = userInfo === null || userInfo === void 0 ? void 0 : userInfo.uuid;
|
|
13882
13883
|
if (uuid) {
|
|
@@ -13901,37 +13902,59 @@ const UserProfile = ({
|
|
|
13901
13902
|
const {
|
|
13902
13903
|
data: districtList,
|
|
13903
13904
|
isLoading
|
|
13904
|
-
} = Digit.Hooks.useCustomMDMS(
|
|
13905
|
-
name: "
|
|
13905
|
+
} = Digit.Hooks.useCustomMDMS(stateId, "common-masters", [{
|
|
13906
|
+
name: "DistrictMaster"
|
|
13906
13907
|
}]);
|
|
13907
13908
|
const uniqueDistricts = useMemo(() => {
|
|
13908
|
-
var _districtList$
|
|
13909
|
-
if (isLoading || !(districtList !== null && districtList !== void 0 && (_districtList$
|
|
13910
|
-
return [
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
13914
|
-
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
}, [isLoading, districtList]);
|
|
13909
|
+
var _districtList$common, _districtList$common$, _districtList$common2, _districtList$common3;
|
|
13910
|
+
if (isLoading || !(districtList !== null && districtList !== void 0 && (_districtList$common = districtList["common-masters"]) !== null && _districtList$common !== void 0 && (_districtList$common$ = _districtList$common.DistrictMaster) !== null && _districtList$common$ !== void 0 && _districtList$common$.length)) return [];
|
|
13911
|
+
return districtList === null || districtList === void 0 ? void 0 : (_districtList$common2 = districtList["common-masters"]) === null || _districtList$common2 === void 0 ? void 0 : (_districtList$common3 = _districtList$common2.DistrictMaster) === null || _districtList$common3 === void 0 ? void 0 : _districtList$common3.filter(district => district.state_code === (selectedState === null || selectedState === void 0 ? void 0 : selectedState.state_code));
|
|
13912
|
+
}, [isLoading, districtList, selectedState]);
|
|
13913
|
+
const uniqueDistrictsCorrespondent = useMemo(() => {
|
|
13914
|
+
var _districtList$common4, _districtList$common5, _districtList$common6, _districtList$common7;
|
|
13915
|
+
if (isLoading || !(districtList !== null && districtList !== void 0 && (_districtList$common4 = districtList["common-masters"]) !== null && _districtList$common4 !== void 0 && (_districtList$common5 = _districtList$common4.DistrictMaster) !== null && _districtList$common5 !== void 0 && _districtList$common5.length)) return [];
|
|
13916
|
+
return districtList === null || districtList === void 0 ? void 0 : (_districtList$common6 = districtList["common-masters"]) === null || _districtList$common6 === void 0 ? void 0 : (_districtList$common7 = _districtList$common6.DistrictMaster) === null || _districtList$common7 === void 0 ? void 0 : _districtList$common7.filter(district => district.state_code === (selectedCorrespondentState === null || selectedCorrespondentState === void 0 ? void 0 : selectedCorrespondentState.state_code));
|
|
13917
|
+
}, [isLoading, districtList, selectedCorrespondentState]);
|
|
13918
13918
|
const {
|
|
13919
|
-
data:
|
|
13920
|
-
isLoading:
|
|
13921
|
-
} = Digit.Hooks.useCustomMDMS(
|
|
13922
|
-
name: "
|
|
13919
|
+
data: StateData,
|
|
13920
|
+
isLoading: isStateLoading
|
|
13921
|
+
} = Digit.Hooks.useCustomMDMS(stateId, "common-masters", [{
|
|
13922
|
+
name: "StateMaster"
|
|
13923
13923
|
}]);
|
|
13924
|
-
const
|
|
13925
|
-
var
|
|
13926
|
-
if (
|
|
13927
|
-
|
|
13928
|
-
|
|
13929
|
-
return
|
|
13930
|
-
}
|
|
13931
|
-
|
|
13932
|
-
|
|
13933
|
-
|
|
13934
|
-
|
|
13924
|
+
const stateOptions = useMemo(() => {
|
|
13925
|
+
var _StateData$commonMas, _StateData$commonMas$;
|
|
13926
|
+
if ((StateData === null || StateData === void 0 ? void 0 : (_StateData$commonMas = StateData["common-masters"]) === null || _StateData$commonMas === void 0 ? void 0 : (_StateData$commonMas$ = _StateData$commonMas.StateMaster) === null || _StateData$commonMas$ === void 0 ? void 0 : _StateData$commonMas$.length) > 0) {
|
|
13927
|
+
return StateData === null || StateData === void 0 ? void 0 : StateData["common-masters"].StateMaster;
|
|
13928
|
+
} else {
|
|
13929
|
+
return [];
|
|
13930
|
+
}
|
|
13931
|
+
}, [StateData, isStateLoading]);
|
|
13932
|
+
console.log("uniqueDistricts", uniqueDistrictsCorrespondent, selectedCorrespondentState);
|
|
13933
|
+
useEffect(() => {
|
|
13934
|
+
if (typeof selectedState === "string" && (stateOptions === null || stateOptions === void 0 ? void 0 : stateOptions.length) > 0) {
|
|
13935
|
+
const state = stateOptions.find(state => state.state_name === selectedState);
|
|
13936
|
+
console.log("stateData", stateOptions, state, selectedState);
|
|
13937
|
+
setSelectedState(state);
|
|
13938
|
+
}
|
|
13939
|
+
}, [selectedState, stateOptions]);
|
|
13940
|
+
useEffect(() => {
|
|
13941
|
+
if (typeof selectedCorrespondentState === "string" && (stateOptions === null || stateOptions === void 0 ? void 0 : stateOptions.length) > 0) {
|
|
13942
|
+
const state = stateOptions.find(state => state.state_name === selectedCorrespondentState);
|
|
13943
|
+
setSelectedCorrespondentState(state);
|
|
13944
|
+
}
|
|
13945
|
+
}, [selectedCorrespondentState, stateOptions]);
|
|
13946
|
+
useEffect(() => {
|
|
13947
|
+
if (typeof selectedCorrespondentDistrict === "string" && (uniqueDistrictsCorrespondent === null || uniqueDistrictsCorrespondent === void 0 ? void 0 : uniqueDistrictsCorrespondent.length) > 0) {
|
|
13948
|
+
const state = uniqueDistrictsCorrespondent.find(state => state.district_name_english === selectedCorrespondentDistrict);
|
|
13949
|
+
setSelectedCorrespondentDistrict(state);
|
|
13950
|
+
}
|
|
13951
|
+
}, [selectedCorrespondentDistrict, uniqueDistrictsCorrespondent]);
|
|
13952
|
+
useEffect(() => {
|
|
13953
|
+
if (typeof selectedDistrict === "string" && (uniqueDistricts === null || uniqueDistricts === void 0 ? void 0 : uniqueDistricts.length) > 0) {
|
|
13954
|
+
const state = uniqueDistricts.find(state => state.district_name_english === selectedDistrict);
|
|
13955
|
+
setSelectedDistrict(state);
|
|
13956
|
+
}
|
|
13957
|
+
}, [selectedDistrict, uniqueDistricts]);
|
|
13935
13958
|
useEffect(() => {
|
|
13936
13959
|
var _userDetails$photo;
|
|
13937
13960
|
setLoading(true);
|
|
@@ -13943,23 +13966,13 @@ const UserProfile = ({
|
|
|
13943
13966
|
});
|
|
13944
13967
|
setDob(userDetails === null || userDetails === void 0 ? void 0 : userDetails.dob);
|
|
13945
13968
|
setPermanentAddress(userDetails === null || userDetails === void 0 ? void 0 : userDetails.permanentAddress);
|
|
13946
|
-
setSelectedDistrict(
|
|
13947
|
-
name: userDetails === null || userDetails === void 0 ? void 0 : userDetails.permanentCity,
|
|
13948
|
-
code: userDetails === null || userDetails === void 0 ? void 0 : userDetails.permanentCity
|
|
13949
|
-
});
|
|
13969
|
+
setSelectedDistrict(userDetails === null || userDetails === void 0 ? void 0 : userDetails.permanentDistrict);
|
|
13950
13970
|
setPinCode(userDetails === null || userDetails === void 0 ? void 0 : userDetails.permanentPinCode);
|
|
13951
13971
|
setPinCodeCorrespondent(userDetails === null || userDetails === void 0 ? void 0 : userDetails.correspondencePinCode);
|
|
13952
|
-
setSelectedCorrespondentDistrict(
|
|
13953
|
-
name: userDetails === null || userDetails === void 0 ? void 0 : userDetails.correspondenceCity,
|
|
13954
|
-
code: userDetails === null || userDetails === void 0 ? void 0 : userDetails.correspondenceCity
|
|
13955
|
-
});
|
|
13972
|
+
setSelectedCorrespondentDistrict(userDetails === null || userDetails === void 0 ? void 0 : userDetails.correspondenceDistrict);
|
|
13956
13973
|
setCorrespondenceAddress(userDetails === null || userDetails === void 0 ? void 0 : userDetails.correspondenceAddress);
|
|
13957
|
-
|
|
13958
|
-
|
|
13959
|
-
}
|
|
13960
|
-
if (userDetails !== null && userDetails !== void 0 && userDetails.permanentState) {
|
|
13961
|
-
setSelectedState(userDetails === null || userDetails === void 0 ? void 0 : userDetails.permanentState);
|
|
13962
|
-
}
|
|
13974
|
+
setSelectedCorrespondentState(userDetails === null || userDetails === void 0 ? void 0 : userDetails.correspondenceState);
|
|
13975
|
+
setSelectedState(userDetails === null || userDetails === void 0 ? void 0 : userDetails.permanentState);
|
|
13963
13976
|
if (userDetails !== null && userDetails !== void 0 && userDetails.isAddressSame) {
|
|
13964
13977
|
setIsAddressSame(userDetails === null || userDetails === void 0 ? void 0 : userDetails.isAddressSame);
|
|
13965
13978
|
}
|
|
@@ -14102,13 +14115,13 @@ const UserProfile = ({
|
|
|
14102
14115
|
emailId: email,
|
|
14103
14116
|
photo: profilePic,
|
|
14104
14117
|
permanentAddress: PermanentAddress,
|
|
14105
|
-
|
|
14118
|
+
permanentDistrict: selectedDistrict === null || selectedDistrict === void 0 ? void 0 : selectedDistrict.district_name_english,
|
|
14106
14119
|
permanentPinCode: pinCode,
|
|
14107
14120
|
correspondencePinCode: isAddressSame ? pinCode : pinCodeCorrespondent,
|
|
14108
|
-
|
|
14121
|
+
correspondenceDistrict: isAddressSame ? selectedDistrict === null || selectedDistrict === void 0 ? void 0 : selectedDistrict.district_name_english : selectedCorrespondentDistrict === null || selectedCorrespondentDistrict === void 0 ? void 0 : selectedCorrespondentDistrict.district_name_english,
|
|
14109
14122
|
correspondenceAddress: isAddressSame ? PermanentAddress : correspondenceAddress,
|
|
14110
|
-
correspondenceState: isAddressSame ? selectedState === null || selectedState === void 0 ? void 0 : selectedState.
|
|
14111
|
-
permanentState: selectedState === null || selectedState === void 0 ? void 0 : selectedState.
|
|
14123
|
+
correspondenceState: isAddressSame ? selectedState === null || selectedState === void 0 ? void 0 : selectedState.state_name : selectedCorrespondentState === null || selectedCorrespondentState === void 0 ? void 0 : selectedCorrespondentState.state_name,
|
|
14124
|
+
permanentState: selectedState === null || selectedState === void 0 ? void 0 : selectedState.state_name,
|
|
14112
14125
|
isAddressSame: isAddressSame
|
|
14113
14126
|
};
|
|
14114
14127
|
if (!new RegExp(/^([a-zA-Z ])*$/).test(name) || name === "" || name.length > 50 || name.length < 1) {
|
|
@@ -14173,7 +14186,7 @@ const UserProfile = ({
|
|
|
14173
14186
|
message: t("CORE_COMMON_PERMANENT_ADDRESS_REQUIRED")
|
|
14174
14187
|
});
|
|
14175
14188
|
}
|
|
14176
|
-
if (!requestData.
|
|
14189
|
+
if (!requestData.permanentDistrict || typeof requestData.permanentDistrict !== "string") {
|
|
14177
14190
|
throw JSON.stringify({
|
|
14178
14191
|
type: "error",
|
|
14179
14192
|
message: t("CORE_COMMON_PERMANENT_CITY_REQUIRED")
|
|
@@ -14203,7 +14216,7 @@ const UserProfile = ({
|
|
|
14203
14216
|
message: t("CORE_COMMON_CORRESPONDENCE_PINCODE_INVALID")
|
|
14204
14217
|
});
|
|
14205
14218
|
}
|
|
14206
|
-
if (!requestData.isAddressSame && (!requestData.
|
|
14219
|
+
if (!requestData.isAddressSame && (!requestData.correspondenceDistrict || typeof requestData.correspondenceDistrict !== "string")) {
|
|
14207
14220
|
throw JSON.stringify({
|
|
14208
14221
|
type: "error",
|
|
14209
14222
|
message: t("CORE_COMMON_CORRESPONDENCE_CITY_REQUIRED")
|
|
@@ -14359,23 +14372,6 @@ const UserProfile = ({
|
|
|
14359
14372
|
setPinCodeCorrespondent(value);
|
|
14360
14373
|
}
|
|
14361
14374
|
}
|
|
14362
|
-
const stateOptions = useMemo(() => {
|
|
14363
|
-
return [{
|
|
14364
|
-
code: "pb",
|
|
14365
|
-
name: "Punjab",
|
|
14366
|
-
i18Code: "Punjab"
|
|
14367
|
-
}];
|
|
14368
|
-
}, []);
|
|
14369
|
-
useEffect(() => {
|
|
14370
|
-
if ((stateOptions === null || stateOptions === void 0 ? void 0 : stateOptions.length) > 0) {
|
|
14371
|
-
setSelectedState(stateOptions === null || stateOptions === void 0 ? void 0 : stateOptions[0]);
|
|
14372
|
-
}
|
|
14373
|
-
}, [stateOptions]);
|
|
14374
|
-
useEffect(() => {
|
|
14375
|
-
if ((stateOptions === null || stateOptions === void 0 ? void 0 : stateOptions.length) > 0) {
|
|
14376
|
-
setSelectedCorrespondentState(stateOptions === null || stateOptions === void 0 ? void 0 : stateOptions[0]);
|
|
14377
|
-
}
|
|
14378
|
-
}, [stateOptions]);
|
|
14379
14375
|
const getThumbnails = async (ids, tenantId) => {
|
|
14380
14376
|
const res = await Digit.UploadServices.Filefetch(ids, tenantId);
|
|
14381
14377
|
if (res.data.fileStoreIds && res.data.fileStoreIds.length !== 0) {
|
|
@@ -14492,7 +14488,7 @@ const UserProfile = ({
|
|
|
14492
14488
|
type: "tel",
|
|
14493
14489
|
title: t("CORE_COMMON_PROFILE_NAME_ERROR_MESSAGE")
|
|
14494
14490
|
}, {
|
|
14495
|
-
disable:
|
|
14491
|
+
disable: isUserArchitect
|
|
14496
14492
|
})))), /*#__PURE__*/React.createElement(LabelFieldPair$1, null, /*#__PURE__*/React.createElement(CardLabel$1, {
|
|
14497
14493
|
style: {}
|
|
14498
14494
|
}, `${t("CORE_COMMON_PROFILE_GENDER")}`), /*#__PURE__*/React.createElement(Dropdown, {
|
|
@@ -14550,14 +14546,14 @@ const UserProfile = ({
|
|
|
14550
14546
|
disable: editScreen
|
|
14551
14547
|
})), /*#__PURE__*/React.createElement(LabelFieldPair$1, null, /*#__PURE__*/React.createElement(CardLabel$1, null, t("BPA_STATE_TYPE"), "*"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
14552
14548
|
t: t,
|
|
14553
|
-
optionKey: "
|
|
14549
|
+
optionKey: "state_name",
|
|
14554
14550
|
option: stateOptions,
|
|
14555
14551
|
selected: selectedState,
|
|
14556
14552
|
select: SelectState,
|
|
14557
14553
|
disable: editScreen
|
|
14558
14554
|
}))), /*#__PURE__*/React.createElement("div", null, " ", /*#__PURE__*/React.createElement(CardLabel$1, null, t("BPA_DISTRICT_TYPE"), "*"), /*#__PURE__*/React.createElement(Dropdown, {
|
|
14559
14555
|
t: t,
|
|
14560
|
-
optionKey: "
|
|
14556
|
+
optionKey: "district_name_english",
|
|
14561
14557
|
option: uniqueDistricts,
|
|
14562
14558
|
selected: selectedDistrict,
|
|
14563
14559
|
select: SelectDistrict,
|
|
@@ -14596,14 +14592,14 @@ const UserProfile = ({
|
|
|
14596
14592
|
disable: isAddressSame
|
|
14597
14593
|
}), /*#__PURE__*/React.createElement(CardLabel$1, null, t("BPA_STATE_TYPE"), "*"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
14598
14594
|
t: t,
|
|
14599
|
-
optionKey: "
|
|
14595
|
+
optionKey: "state_name",
|
|
14600
14596
|
option: stateOptions,
|
|
14601
14597
|
selected: isAddressSame ? selectedState : selectedCorrespondentState,
|
|
14602
14598
|
select: SelectCorrespondentState,
|
|
14603
14599
|
disable: isAddressSame
|
|
14604
14600
|
})), /*#__PURE__*/React.createElement("div", null, " ", /*#__PURE__*/React.createElement(CardLabel$1, null, t("BPA_DISTRICT_TYPE"), "*"), /*#__PURE__*/React.createElement(Dropdown, {
|
|
14605
14601
|
t: t,
|
|
14606
|
-
optionKey: "
|
|
14602
|
+
optionKey: "district_name_english",
|
|
14607
14603
|
option: uniqueDistrictsCorrespondent,
|
|
14608
14604
|
selected: isAddressSame ? selectedDistrict : selectedCorrespondentDistrict,
|
|
14609
14605
|
select: SelectCorrespondentDistrict,
|