diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/index.js
index 8d93f065cd6..1af85e17d34 100644
--- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/index.js
+++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/index.js
@@ -179,6 +179,9 @@ import useServiceTypeFromApplicationType from "./obps/useServiceTypeFromApplicat
import useBusinessServiceBasedOnServiceType from "./obps/useBusinessServiceBasedOnServiceType";
import useBusinessServiceData from "./obps/useBusinessServiceData";
import useBPATaxDocuments from "./obps/useBPATaxDocuments";
+import useDistricts from "./obps/useDistricts";
+import useULBList from "./obps/useULBList";
+
import useEventInbox from "./events/useEventInbox";
import useEventDetails from "./events/useEventDetails";
@@ -447,6 +450,8 @@ const obps = {
useBusinessServiceBasedOnServiceType,
useBusinessServiceData,
useBPATaxDocuments,
+ useDistricts,
+ useULBList
};
const events = {
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/obps/useDistricts.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/obps/useDistricts.js
new file mode 100644
index 00000000000..925f8d9f73a
--- /dev/null
+++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/obps/useDistricts.js
@@ -0,0 +1,20 @@
+import { useQuery } from "react-query";
+import { MdmsService } from "../../services/elements/MDMS";
+
+const useDistricts = (tenantId, moduleCode, type, config = {}) => {
+ const usedistricttype = () => {
+ return useQuery("BPA_DISTRICTS", () => MdmsService.BPADistrict(tenantId, moduleCode ,type), config);
+ };
+
+
+ switch (type) {
+ case "Districts":
+ return usedistricttype();
+ default:
+ return null;
+ }
+};
+
+
+
+export default useDistricts;
\ No newline at end of file
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/obps/useULBList.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/obps/useULBList.js
new file mode 100644
index 00000000000..d92022d4c0a
--- /dev/null
+++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/obps/useULBList.js
@@ -0,0 +1,20 @@
+import { useQuery } from "react-query";
+import { MdmsService } from "../../services/elements/MDMS";
+
+const useULBList = (tenantId, moduleCode, type, config = {}) => {
+ const useULBType = () => {
+ return useQuery("BPA_ULB_TYPE", () => MdmsService.BPAUlb(tenantId, moduleCode ,type), config);
+ };
+
+
+ switch (type) {
+ case "Ulb":
+ return useULBType();
+ default:
+ return null;
+ }
+};
+
+
+
+export default useULBList;
\ No newline at end of file
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js
index 29bc790e857..cbd94ace22b 100644
--- a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js
+++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js
@@ -287,6 +287,38 @@ const getApplicationChannelCriteria = (tenantId, moduleCode) => ({
],
},
});
+const getdistricttype = (tenantId, moduleCode, type) => ({
+ type,
+ details: {
+ tenantId,
+ moduleDetails: [
+ {
+ moduleName: moduleCode,
+ masterDetails: [
+ {
+ name: "Districts",
+ },
+ ],
+ },
+ ],
+ },
+});
+const getulbtype = (tenantId, moduleCode, type) => ({
+ type,
+ details: {
+ tenantId,
+ moduleDetails: [
+ {
+ moduleName: moduleCode,
+ masterDetails: [
+ {
+ name: "Ulb",
+ },
+ ],
+ },
+ ],
+ },
+});
const getPropertyTypeCriteria = (tenantId, moduleCode, type) => ({
type,
@@ -375,6 +407,45 @@ const PTRBreedType = (MdmsRes) => {
};
///////////
+const getdistrict = (MdmsRes) => {
+ return MdmsRes["BPA"].Districts.filter((Districts) => Districts.active).map((districtDetails) => {
+ return {
+ ...districtDetails,
+ i18nKey: `BPA_DISTRICT_${districtDetails.code}`,
+ };
+ });
+ //return MdmsRes;
+};
+
+const getulb = (MdmsRes) => {
+ return MdmsRes["BPA"].Ulb.filter((Ulb) => Ulb.active).map((ulbDetails) => {
+ return {
+ ...ulbDetails,
+ i18nKey: `BPA_DISTRICT_${ulbDetails.code}`,
+ };
+ });
+ //return MdmsRes;
+};
+/////////////
+
+const BPADistrict = (MdmsRes) => {
+ MdmsRes["BPA"].Districts.filter((Districts) => Districts.active).map((districts) => {
+ return {
+ ...districts,
+ i18nKey: `BPA_DISTRICTS_${districts.code}`,
+ };
+ });
+};
+const BPAUlb = (MdmsRes) => {
+ MdmsRes["BPA"].Ulb.filter((Ulb) => Ulb.active).map((ulblist) => {
+ return {
+ ...ulblist,
+ i18nKey: `BPA_ULB_${ulblist.code}`,
+ };
+ });
+};
+/////////////
+
const getCommonFieldsCriteria = (tenantId, moduleCode, type) => ({
type,
details: {
@@ -1122,7 +1193,7 @@ const GetPropertyType = (MdmsRes) =>
i18nKey: `PROPERTYTYPE_MASTERS_${item.code}`,
code: item.code,
}));
-
+
const GetPropertySubtype = (MdmsRes) =>
MdmsRes["FSM"].PropertyType.filter((property) => property.active && property.propertyType).map((item) => ({
...item,
@@ -1534,6 +1605,20 @@ const transformResponse = (type, MdmsRes, moduleCode, tenantId) => {
case "PTRBreedType":
return PTRBreedType(MdmsRes);
+
+ case "Districts":
+ return getdistrict(MdmsRes);
+
+ case "Ulb":
+ return getulb(MdmsRes);
+
+ case "BPADistrict":
+ return BPADistrict(MdmsRes);
+ case "BPAUlb":
+ return BPAUlb(MdmsRes);
+
+
+
@@ -1679,6 +1764,14 @@ export const MdmsService = {
return MdmsService.getDataByCriteria(tenantId, getPetDocumentsRequiredScreenCategory(tenantId, moduleCode), moduleCode);
},
+ getdistrict: (tenantId, moduleCode, type) => {
+ return MdmsService.getDataByCriteria(tenantId, getdistricttype(tenantId, moduleCode, type), moduleCode);
+ },
+ getulb: (tenantId, moduleCode, type) => {
+ return MdmsService.getDataByCriteria(tenantId, getulbtype(tenantId, moduleCode, type), moduleCode);
+ },
+
+
getPetType: (tenantId, moduleCode, type) => {
return MdmsService.getDataByCriteria(tenantId, getPetTypeList(tenantId, moduleCode, type), moduleCode);
},
@@ -1686,6 +1779,12 @@ export const MdmsService = {
getBreedType: (tenantId, moduleCode, type) => {
return MdmsService.getDataByCriteria(tenantId, getBreedTypeList(tenantId, moduleCode, type), moduleCode);
},
+ BPADistrict: (tenantId, moduleCode, type) => {
+ return MdmsService.getDataByCriteria(tenantId, getdistricttype(tenantId, moduleCode, type), moduleCode);
+ },
+ BPAUlb: (tenantId, moduleCode, type) => {
+ return MdmsService.getDataByCriteria(tenantId, getulbtype(tenantId, moduleCode, type), moduleCode);
+ },
PTRGenderType: (tenantId, moduleCode, type) => {
return MdmsService.getDataByCriteria(tenantId, getGenderTypeList(tenantId, moduleCode, type), moduleCode);
},
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/package.json b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/package.json
index 473189014ad..d77c540f493 100644
--- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/package.json
+++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/package.json
@@ -20,6 +20,7 @@
"dependencies": {
"@upyog/digit-ui-react-components": "1.7.0-beta.4",
"microbundle-crl": "^0.13.11",
+ "exif-js": "^2.3.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hook-form": "6.15.8",
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/Module.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/Module.js
index 392f282e9af..e57933af82f 100644
--- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/Module.js
+++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/Module.js
@@ -12,6 +12,7 @@ import BasicDetails from "./pageComponents/BasicDetails";
import DocsRequired from "./pageComponents/DocsRequired";
import PlotDetails from "./pageComponents/PlotDetails";
import ScrutinyDetails from "./pageComponents/ScrutinyDetails";
+import BPANewBuildingdetails from "./pageComponents/BPANewBuildingdetails"
import OwnerDetails from "./pageComponents/OwnerDetails";
import DocumentDetails from "./pageComponents/DocumentDetails";
import NOCDetails from "./pageComponents/NOCDetails";
@@ -19,6 +20,7 @@ import NOCNumber from "./pageComponents/NOCNumber";
import LocationDetails from "./pageComponents/LocationDetails";
import StakeholderDocsRequired from "./pageComponents/StakeholderDocsRequired";
import GIS from "./pageComponents/GIS";
+
import OCEDCRDocsRequired from "./pageComponents/OCEDCRDocsRequired";
import OCeDCRScrutiny from "./pageComponents/OCeDCRScrutiny";
import OCUploadPlanDiagram from "./pageComponents/OCUploadPlanDiagram";
@@ -57,6 +59,12 @@ import BPAAcknowledgement from "./pages/citizen/NewBuildingPermit/OBPSAcknowledg
import OCBPAAcknowledgement from "./pages/citizen/OCBuildingPermit/OBPSAcknowledgement";
import OCSendBackAcknowledgement from "./pages/citizen/OCSendBackToCitizen/Acknowledgement";
import StakeholderAcknowledgement from "./pages/citizen/StakeholderRegistration/StakeholderAcknowledgement";
+
+
+
+
+
+
const OBPSModule = ({ stateCode, userType, tenants }) => {
@@ -113,6 +121,7 @@ const componentsToRegister = {
DocsRequired,
PlotDetails,
ScrutinyDetails,
+ BPANewBuildingdetails,
OwnerDetails,
DocumentDetails,
NOCDetails,
@@ -155,7 +164,10 @@ const componentsToRegister = {
ObpsOCSendBackToCitizen : OCSendBackToCitizen,
ObpsEdcrInbox : EdcrInbox,
ObpsEmpApplicationDetail : EmpApplicationDetail,
- ObpsEmployeeBpaApplicationDetail : EmployeeBpaApplicationDetail
+ ObpsEmployeeBpaApplicationDetail : EmployeeBpaApplicationDetail,
+
+
+
}
export const initOBPSComponents = () => {
diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pageComponents/BPANewBuildingdetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pageComponents/BPANewBuildingdetails.js
new file mode 100644
index 00000000000..83a930bc2ef
--- /dev/null
+++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pageComponents/BPANewBuildingdetails.js
@@ -0,0 +1,436 @@
+ import React, { useEffect, useState, Fragment } from "react";
+ import { FormStep, TextInput, CardLabel, Dropdown } from "@upyog/digit-ui-react-components";
+ import { useLocation, useRouteMatch } from "react-router-dom";
+ import { Controller, useForm } from "react-hook-form";
+
+
+ const BPANewBuildingdetails = ({ t, config, onSelect, formData }) => {
+ const { pathname: url } = useLocation();
+ let index = window.location.href.charAt(window.location.href.length - 1);
+ let validation = {};
+ const [approvedColony, setapprovedColony] = useState(formData?.owners?.approvedColony || "");
+ const [masterPlan, setmasterPlan] = useState(formData?.owners?.masterPlan || "");
+ const [district, setDistrict] = useState(formData?.owners?.district || "");
+ const [buildingStatus, setbuildingStatus] = useState(formData?.owners?.buildingStatus || "");
+ const [schemes, setschemes] = useState(formData?.owners?.schemes || "");
+ const [purchasedFAR, setpurchasedFAR] = useState(formData?.owners?.purchasedFAR || "");
+ const [greenbuilding, setgreenbuilding] = useState(formData?.owners?.greenbuilding || "");
+ const [restrictedArea, setrestrictedArea] = useState(formData?.owners?.restrictedArea || "");
+ const [ulbType, setulbType] = useState(formData?.owners?.ulbType || "");
+ const [proposedSite, setproposedSite] = useState(formData?.owners?.proposedSite || "");
+ const [nameofApprovedcolony, setnameofApprovedcolony] = useState(formData?.owners?.nameofApprovedcolony || "");
+ const [NocNumber, setNocNumber] = useState(formData?.owners?.NocNumber || "");
+
+
+ const approvedcolonyStatus = [
+ {
+ code: "YES",
+ i18nKey: "YES"
+ },
+ {
+ code: "NO",
+ i18nKey: "NO"
+ },
+ {
+ code: "LAL_LAKEER",
+ i18nKey: "LAL LAKEER"
+ }
+ ]
+
+ const common = [
+ {
+ code: "YES",
+ i18nKey: "YES"
+ },
+ {
+ code: "NO",
+ i18nKey: "NO"
+ }
+ ]
+
+
+ const Typeofproposedsite = [
+ {
+ code: "PROPOSED",
+ i18nKey: "Proposed"
+ }
+ ]
+
+ const forschemes = [
+ {
+ code: "TP_SCHEMES",
+ i18nKey: "TP SCHEMES"
+ },
+ {
+ code: "DEVELOPMENT_SCHEMES",
+ i18nKey: "DEVELOPMENT SCHEMES"
+ },
+ {
+ code: "AFFORDABLE",
+ i18nKey: "AFFORDABLE"
+ }
+ ]
+
+ const status = [
+ {
+ code: "AUTHORIZED",
+ i18nKey: "Authorized"
+ },
+ {
+ code: "REGULARIZED",
+ i18nKey: "Regularized"
+ }
+ ]
+
+ const tenantId = Digit.ULBService.getCurrentTenantId();
+ const stateId = Digit.ULBService.getStateId();
+
+ const { data: Menu } = Digit.Hooks.obps.useDistricts(stateId, "BPA", "Districts");
+ const { data: ULB } = Digit.Hooks.obps.useULBList(stateId, "BPA", "Ulb");
+
+ let menu = [];
+ let ulb = [];
+
+ Menu &&
+ Menu.map((districts) => {
+ menu.push({ i18nKey: `BPA_DISTRICTS_${districts.code}`, code: `${districts.code}`, value: `${districts.name}` });
+ });
+
+ ULB &&
+ ULB.map((ulblist) => {
+ if (ulblist.Districts == district?.code) {
+ ulb.push({
+ i18nKey: `BPA_ULB_${ulblist.code}`,
+ code: `${ulblist.code}`,
+ value: `${ulblist.name}`
+ });
+ }
+
+ });
+
+
+ const { control } = useForm();
+
+ function setApprovedColony(e) {
+ setapprovedColony(e.target.value);
+ }
+
+ function setMasterPlan(e) {
+ setmasterPlan(e.target.value);
+ }
+
+ function setdistrict(e) {
+ setDistrict(e.target.value);
+ }
+
+ function setBuildingStatus(e) {
+ setbuildingStatus(e.target.value);
+ }
+ function setSchemes(e) {
+ setschemes(e.target.value);
+ }
+ function setPurchasedFAR(e) {
+ setpurchasedFAR(e.target.value);
+ }
+ function setGreenbuilding(e) {
+ setgreenbuilding(e.target.value);
+ }
+ function setRestrictedArea(e) {
+ setrestrictedArea(e.target.value);
+ }
+ function setUlbType(e) {
+ setulbType(e.target.value);
+ }
+ function setProposedSite(e) {
+ setproposedSite(e.target.value);
+ }
+
+ function setNameapprovedcolony(e) {
+ setnameofApprovedcolony(e.target.value);
+ }
+
+ function setnocNumber(e) {
+ setNocNumber(e.target.value);
+ }
+
+
+
+ const goNext = () => {
+ let owners = formData.owners && formData.owners[index];
+ let ownerStep = { ...owners, approvedColony, district, ulbType, masterPlan, buildingStatus, schemes, purchasedFAR, greenbuilding, restrictedArea, proposedSite, nameofApprovedcolony, NocNumber };
+ let updatedFormData = { ...formData };
+
+ // Check if owners array exists in formData if not , then it will add it
+ if (!updatedFormData.owners) {
+ updatedFormData.owners = [];
+ }
+
+ onSelect(config.key, { ...formData[config.key], ...ownerStep }, updatedFormData, false, index);
+
+
+ };
+
+
+
+
+ const onSkip = () => onSelect();
+
+ const renderFields = () => {
+ switch (approvedColony?.code) {
+ case "YES":
+ return (
+ <>
+
Latitude: {latitude}
+Longitude: {longitude}
+Please upload a Photo with Location details.
+ ) + )} + ); }); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pageComponents/OwnerDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pageComponents/OwnerDetails.js index 719abee217d..71049e2c124 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pageComponents/OwnerDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pageComponents/OwnerDetails.js @@ -16,10 +16,11 @@ const OwnerDetails = ({ t, config, onSelect, userType, formData }) => { const [genderList, setGenderList] = useState([]); const [ownershipCategory, setOwnershipCategory] = useState(formData?.owners?.ownershipCategory); const [name, setName] = useState(formData?.owners?.name || ""); + const [emailId, setEmail] = useState(formData?.owners?.emailId || ""); + const [aadharNumber, setaadharNumber] = useState(formData?.owners?.aadharNumber || ""); const [isPrimaryOwner, setisPrimaryOwner] = useState(false); const [gender, setGender] = useState(formData?.owners?.gender); const [mobileNumber, setMobileNumber] = useState(formData?.owners?.mobileNumber || ""); - const [emailId, setEmail] = useState(formData?.owners?.emailId || ""); const [showToast, setShowToast] = useState(null); const [isDisable, setIsDisable] = useState(false); let Webview = !Digit.Utils.browser.isMobile(); @@ -142,6 +143,15 @@ const OwnerDetails = ({ t, config, onSelect, userType, formData }) => { setCanmovenext(false); } } + function setAadharNumber(i, e) { + let units = [...fields]; + units[i].aadharNumber = e.target.value; + setaadharNumber(e.target.value); + setFeilds(units); + if (units[i].gender && units[i].mobileNumber && units[i].name) { + setCanmovenext(false); + } + } function setMobileNo(i, e) { let units = [...fields]; units[i].mobileNumber = e.target.value; @@ -294,7 +304,172 @@ const OwnerDetails = ({ t, config, onSelect, userType, formData }) => { let owner = formData.owners; let ownerStep; ownerStep = { ...owner, owners: fields, ownershipCategory: ownershipCategory }; - onSelect(config.key, ownerStep); + + if (!formData?.id) { + setIsDisable(true); + //for owners conversion + let conversionOwners = []; + ownerStep?.owners?.map(owner => { + conversionOwners.push({ + ...owner, + active:true, + name: owner.name, + emailId:owner.emailId, + aadharNumber:owner.aadharNumber, + mobileNumber: owner.mobileNumber, + isPrimaryOwner: owner.isPrimaryOwner, + gender: owner.gender.code, + fatherOrHusbandName: "NAME" + }) + }); + let payload = {}; + payload.edcrNumber = formData?.edcrNumber?.edcrNumber ? formData?.edcrNumber?.edcrNumber :formData?.data?.scrutinyNumber?.edcrNumber; + payload.riskType = formData?.data?.riskType; + payload.applicationType = formData?.data?.applicationType; + payload.serviceType = formData?.data?.serviceType; + + const userInfo = Digit.UserService.getUser(); + const accountId = userInfo?.info?.uuid; + payload.tenantId = formData?.address?.city?.code; + payload.workflow = { action: "INITIATE", assignes : [userInfo?.info?.uuid] }; + payload.accountId = accountId; + payload.documents = null; + + // Additonal details + payload.additionalDetails = {GISPlaceName:formData?.address?.placeName}; + payload.additionalDetails.boundaryWallLength = formData?.data?.boundaryWallLength || "NA"; + payload.additionalDetails.area = (formData?.data.edcrDetails.planDetail.planInformation.plotArea).toString()|| "NA"; + payload.additionalDetails.height = (formData?.data.edcrDetails.planDetail.blocks[0].building.buildingHeight).toString() || "NA"; + payload.additionalDetails.usage = formData?.data.occupancyType || "NA"; + payload.additionalDetails.builtUpArea =(formData?.data.edcrDetails.planDetail.blocks[0].building.totalBuitUpArea).toString(); + + + if (formData?.data?.registrationDetails) payload.additionalDetails.registrationDetails = formData?.data?.registrationDetails; + if (formData?.data?.applicationType) payload.additionalDetails.applicationType = formData?.data?.applicationType; + if (formData?.data?.serviceType) payload.additionalDetails.serviceType = formData?.data?.serviceType; + if (formData?.data?.wardnumber) payload.additionalDetails.wardnumber = formData?.data?.wardnumber; + if (formData?.data?.zonenumber) payload.additionalDetails.zonenumber = formData?.data?.zonenumber; + if (formData?.data?.khasraNumber) payload.additionalDetails.khasraNumber = formData?.data?.khasraNumber; + if (formData?.data?.applicationType) payload.additionalDetails.applicationType = formData?.data?.applicationType; + if (formData?.data?.serviceType) payload.additionalDetails.serviceType = formData?.data?.serviceType; + if (formData?.data?.architectid) payload.additionalDetails.architectid = formData?.data?.architectid; + if (formData?.data?.propertyuid) payload.additionalDetails.propertyuid = formData?.data?.propertyuid; + if (formData?.data?.bathnumber) payload.additionalDetails.bathnumber = formData?.data?.bathnumber; + if (formData?.data?.kitchenNumber) payload.additionalDetails.kitchenNumber = formData?.data?.kitchenNumber; + if (formData?.data?.approxinhabitants) payload.additionalDetails.approxinhabitants = formData?.data?.approxinhabitants; + if (formData?.data?.materialusedinfloor) payload.additionalDetails.materialusedinfloor = formData?.data?.materialusedinfloor; + if (formData?.data?.distancefromsewer) payload.additionalDetails.distancefromsewer = formData?.data?.distancefromsewer; + if (formData?.data?.sourceofwater) payload.additionalDetails.sourceofwater = formData?.data?.sourceofwater; + if (formData?.data?.watercloset) payload.additionalDetails.watercloset = formData?.data?.watercloset; + if (formData?.data?.materialused) payload.additionalDetails.materialused = formData?.data?.materialused; + if (formData?.data?.materialusedinroofs) payload.additionalDetails.materialusedinroofs = formData?.data?.materialusedinroofs; + if (formData?.owners?.approvedColony?.code) payload.additionalDetails.approvedColony = formData?.owners?.approvedColony?.code; + if (formData?.owners?.buildingStatus?.code) payload.additionalDetails.buildingStatus = formData?.owners?.buildingStatus?.code; + if (formData?.owners?.greenbuilding?.code) payload.additionalDetails.greenbuilding = formData?.owners?.greenbuilding?.code; + if (formData?.owners?.masterPlan?.code) payload.additionalDetails.masterPlan = formData?.owners?.masterPlan?.code; + if (formData?.owners?.proposedSite?.code) payload.additionalDetails.proposedSite = formData?.owners?.proposedSite?.code; + if (formData?.owners?.purchasedFAR?.code) payload.additionalDetails.purchasedFAR = formData?.owners?.purchasedFAR?.code; + if (formData?.owners?.restrictedArea?.code) payload.additionalDetails.restrictedArea = formData?.owners?.restrictedArea?.code; + if (formData?.owners?.schemes?.i18nKey) payload.additionalDetails.schemes = formData?.owners?.schemes?.i18nKey; + if (formData?.owners?.district?.code) payload.additionalDetails.district = formData?.owners?.district?.code; + if (formData?.owners?.ulbType?.code) payload.additionalDetails.ulbType = formData?.owners?.ulbType?.code; + if (formData?.owners?.nameofApprovedcolony) payload.additionalDetails.nameofApprovedcolony = formData?.owners?.nameofApprovedcolony; + if (formData?.owners?.NocNumber) payload.additionalDetails.NocNumber = formData?.owners?.NocNumber; + + + //For LandInfo + payload.landInfo = {}; + //For Address + payload.landInfo.address = {}; + if (formData?.address?.city?.code) payload.landInfo.address.city = formData?.address?.city?.code; + if (formData?.address?.locality?.code) payload.landInfo.address.locality = { code: formData?.address?.locality?.code }; + if (formData?.address?.pincode) payload.landInfo.address.pincode = formData?.address?.pincode; + if (formData?.address?.landmark) payload.landInfo.address.landmark = formData?.address?.landmark; + if (formData?.address?.street) payload.landInfo.address.street = formData?.address?.street; + if (formData?.address?.geoLocation) payload.landInfo.address.geoLocation = formData?.address?.geoLocation; + + payload.landInfo.owners = conversionOwners; + payload.landInfo.ownershipCategory = ownershipCategory.code; + payload.landInfo.tenantId = formData?.address?.city?.code; + + //for units + const blockOccupancyDetails = formData; + payload.landInfo.unit = getUnitsForAPI(blockOccupancyDetails); + + let nameOfAchitect = sessionStorage.getItem("BPA_ARCHITECT_NAME"); + let parsedArchitectName = nameOfAchitect ? JSON.parse(nameOfAchitect) : "ARCHITECT"; + payload.additionalDetails.typeOfArchitect = parsedArchitectName; + let isSelfCertificationRequired=sessionStorage.getItem("isSelfCertificationRequired"); + if(isSelfCertificationRequired==="undefined"){ + isSelfCertificationRequired="false"; + } + payload.additionalDetails.isSelfCertificationRequired = isSelfCertificationRequired.toString(); + // create BPA call + if(isSelfCertificationRequired===true && formData?.data.occupancyType==="Residential" && (parsedArchitectName=="ARCHITECT" || parsedArchitectName=="ENGINEER"|| parsedArchitectName=="DESIGNER" || parsedArchitectName=="SUPERVISOR")){ + if(formData?.data.edcrDetails.planDetail.blocks[0].building.buildingHeight > 15){ + alert("Height should not be more than 15 metres"); + } + else if((parsedArchitectName=="ARCHITECT" || parsedArchitectName=="ENGINEER") && formData?.data.edcrDetails.planDetail.planInformation.plotArea>500){ + alert("Architect/Engineer can apply for area less then 500 sq. yards. in self declaration") + } + else if((parsedArchitectName=="DESIGNER" || parsedArchitectName=="SUPERVISOR") && formData?.data.edcrDetails.planDetail.planInformation.plotArea>250){ + alert("Designer/Supervisor can apply for area less then 500 sq. yards. in self declaration") + } + else{ + Digit.OBPSService.create({ BPA: payload }, tenantId) + .then((result, err) => { + if (result?.BPA?.length > 0) { + result?.BPA?.[0]?.landInfo?.owners?.forEach(owner => { + owner.gender = { code: owner.gender, active: true, i18nKey: `COMMON_GENDER_${owner.gender}` } + }); + result.BPA[0].owners = { ...owner, owners: result?.BPA?.[0]?.landInfo?.owners, ownershipCategory: ownershipCategory }; + result.BPA[0].address = result?.BPA?.[0]?.landInfo?.address; + result.BPA[0].address.city = formData.address.city; + result.BPA[0].address.locality = formData.address.locality; + result.BPA[0].placeName = formData?.address?.placeName; + result.BPA[0].data = formData.data; + result.BPA[0].BlockIds = getBlockIds(result.BPA[0].landInfo.unit); + result.BPA[0].subOccupancy= formData?.subOccupancy; + result.BPA[0].uiFlow = formData?.uiFlow; + setIsDisable(false); + onSelect("", result.BPA[0], "", true); + } + }) + .catch((e) => { + setIsDisable(false); + setShowToast({ key: "true", error: true, message: e?.response?.data?.Errors[0]?.message }); + }); + } + + } + else{ + Digit.OBPSService.create({ BPA: payload }, tenantId) + .then((result, err) => { + if (result?.BPA?.length > 0) { + result?.BPA?.[0]?.landInfo?.owners?.forEach(owner => { + owner.gender = { code: owner.gender, active: true, i18nKey: `COMMON_GENDER_${owner.gender}` } + }); + result.BPA[0].owners = { ...owner, owners: result?.BPA?.[0]?.landInfo?.owners, ownershipCategory: ownershipCategory }; + result.BPA[0].address = result?.BPA?.[0]?.landInfo?.address; + result.BPA[0].address.city = formData.address.city; + result.BPA[0].address.locality = formData.address.locality; + result.BPA[0].placeName = formData?.address?.placeName; + result.BPA[0].data = formData.data; + result.BPA[0].BlockIds = getBlockIds(result.BPA[0].landInfo.unit); + result.BPA[0].subOccupancy= formData?.subOccupancy; + result.BPA[0].uiFlow = formData?.uiFlow; + setIsDisable(false); + onSelect("", result.BPA[0], "", true); + } + }) + .catch((e) => { + setIsDisable(false); + setShowToast({ key: "true", error: true, message: e?.response?.data?.Errors[0]?.message }); + }); + } + } else { + onSelect(config.key, ownerStep); + } } } @@ -398,6 +573,22 @@ const OwnerDetails = ({ t, config, onSelect, userType, formData }) => { onSelect={(e) => setGenderName(index, e)} t={t} /> +