From 936bf5b8365c1bd940b6afb927eddccb7af6143e Mon Sep 17 00:00:00 2001 From: sriranjan-s Date: Thu, 19 Sep 2024 09:25:07 +0530 Subject: [PATCH] published OBPAS changes --- frontend/micro-ui/web/docker/Dockerfile | 2 +- .../example/devpackage.json | 2 +- .../micro-ui-internals/example/package.json | 2 +- .../packages/modules/obps/package.json | 2 +- .../citizen/NewBuildingPermit/CheckPage.js | 1484 +++++++++-------- frontend/micro-ui/web/package.json | 2 +- 6 files changed, 759 insertions(+), 735 deletions(-) diff --git a/frontend/micro-ui/web/docker/Dockerfile b/frontend/micro-ui/web/docker/Dockerfile index a9b7e589b32..77d7bbfb5b2 100644 --- a/frontend/micro-ui/web/docker/Dockerfile +++ b/frontend/micro-ui/web/docker/Dockerfile @@ -12,7 +12,7 @@ RUN yarn add @upyog/digit-ui-module-noc@1.7.0-beta.3 RUN yarn add @upyog/digit-ui-module-engagement@1.7.0-beta.4 RUN yarn add @upyog/digit-ui-module-hrms@1.7.0-beta.3 RUN yarn add @upyog/digit-ui-module-core@1.7.0-beta.3 -RUN yarn add @upyog/digit-ui-module-obps@1.7.0-beta.15 +RUN yarn add @upyog/digit-ui-module-obps@1.7.0-beta.16 RUN yarn add @upyog/digit-ui-module-common@1.7.0-beta.5 RUN yarn add @upyog/digit-ui-module-ws@1.7.0-beta.12 RUN yarn add @upyog/digit-ui-module-commonpt@1.7.0-beta.4 diff --git a/frontend/micro-ui/web/micro-ui-internals/example/devpackage.json b/frontend/micro-ui/web/micro-ui-internals/example/devpackage.json index 07f9563816a..80169c9faaa 100644 --- a/frontend/micro-ui/web/micro-ui-internals/example/devpackage.json +++ b/frontend/micro-ui/web/micro-ui-internals/example/devpackage.json @@ -16,7 +16,7 @@ "@upyog/digit-ui-module-fsm":"1.7.0-beta.18", "@upyog/digit-ui-module-mcollect":"1.7.0-beta.4", "@upyog/digit-ui-module-noc":"1.7.0-beta.3", - "@upyog/digit-ui-module-obps":"1.7.0-beta.15", + "@upyog/digit-ui-module-obps":"1.7.0-beta.16", "@upyog/digit-ui-module-pgr":"1.7.0-beta.6", "@upyog/digit-ui-module-pt":"1.7.0-beta.4", "@upyog/digit-ui-module-receipts":"1.7.0-beta.3", diff --git a/frontend/micro-ui/web/micro-ui-internals/example/package.json b/frontend/micro-ui/web/micro-ui-internals/example/package.json index ae4ac739486..6d5be3a5e9b 100644 --- a/frontend/micro-ui/web/micro-ui-internals/example/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/example/package.json @@ -16,7 +16,7 @@ "@upyog/digit-ui-module-fsm": "1.7.0-beta.18", "@upyog/digit-ui-module-mcollect": "1.7.0-beta.4", "@upyog/digit-ui-module-noc": "1.7.0-beta.3", - "@upyog/digit-ui-module-obps": "1.7.0-beta.15", + "@upyog/digit-ui-module-obps": "1.7.0-beta.16", "@upyog/digit-ui-module-pgr": "1.7.0-beta.6", "@upyog/digit-ui-module-pt": "1.7.0-beta.4", "@upyog/digit-ui-module-receipts": "1.7.0-beta.3", 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 41d806de1df..fa0dcc24b98 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 @@ -1,6 +1,6 @@ { "name": "@upyog/digit-ui-module-obps", - "version": "1.7.0-beta.15", + "version": "1.7.0-beta.16", "description": "", "main": "dist/index.js", "module": "dist/index.modern.js", diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/NewBuildingPermit/CheckPage.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/NewBuildingPermit/CheckPage.js index 6921a056437..d146fa2b106 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/NewBuildingPermit/CheckPage.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/NewBuildingPermit/CheckPage.js @@ -1,810 +1,834 @@ import { - Card, CardHeader, CardSubHeader, CardText,TextInput,CardLabel,CheckBox, LabelFieldPair, UploadFile, - CitizenInfoLabel, Header, LinkButton, Row, StatusTable, SubmitBar, Table, CardSectionHeader, EditIcon, PDFSvg, Loader,TextArea - } from "@upyog/digit-ui-react-components"; - import React,{ useEffect, useMemo, useState } from "react"; - import { useTranslation } from "react-i18next"; - import { useHistory, useRouteMatch } from "react-router-dom"; - import Timeline from "../../../components/Timeline"; - import { convertEpochToDateDMY, stringReplaceAll, getOrderDocuments } from "../../../utils"; - import DocumentsPreview from "../../../../../templates/ApplicationDetails/components/DocumentsPreview"; - import Architectconcent from "./Architectconcent"; - - const CheckPage = ({ onSubmit, value }) => { - const [development, setDevelopment] = useState() - const [otherCharges, setOtherCharges] = useState() - const [lessAdjusment, setLessAdjusment] = useState() - const [labourCess , setLabourCess] =useState() - const [gaushalaFees , setGaushalaFees] =useState() - const [malbafees , setMalbafees] =useState() - const [waterCharges , setWaterCharges] =useState() - const { t } = useTranslation(); - const history = useHistory(); - const match = useRouteMatch(); - const user = Digit.UserService.getUser(); - - const state = Digit.ULBService.getStateId(); - - const tenantId = user?.info?.permanentCity || value?.tenantId ||Digit.ULBService.getCurrentTenantId() ; - const { isMdmsLoading, data: mdmsData } = Digit.Hooks.obps.useMDMS(state, "BPA", ["GaushalaFees","MalbaCharges","LabourCess"]); - const [otherChargesDisc, setOtherChargesDisc] = useState() - const [uploadedFile, setUploadedFile] = useState(); - const [uploadedFileLess, setUploadedFileLess] = useState([]); - const [file, setFile] = useState(); - const [uploadMessage, setUploadMessage] = useState(""); - const [errorFile, setError] = useState(null); - const [docLessAdjustment, setDocuments] = useState({}); - let acceptFormat = ".pdf" - let BusinessService; - if(value.businessService === "BPA_LOW") - BusinessService="BPA.LOW_RISK_PERMIT_FEE"; - else if(value.businessService === "BPA") - BusinessService="BPA.NC_APP_FEE"; + Card, CardHeader, CardSubHeader, CardText,TextInput,CardLabel,CheckBox, LabelFieldPair, UploadFile, + CitizenInfoLabel, Header, LinkButton, Row, StatusTable, SubmitBar, Table, CardSectionHeader, EditIcon, PDFSvg, Loader,TextArea +} from "@upyog/digit-ui-react-components"; +import React,{ useEffect, useMemo, useState } from "react"; +import { useTranslation } from "react-i18next"; +import { useHistory, useRouteMatch } from "react-router-dom"; +import Timeline from "../../../components/Timeline"; +import { convertEpochToDateDMY, stringReplaceAll, getOrderDocuments } from "../../../utils"; +import DocumentsPreview from "../../../../../templates/ApplicationDetails/components/DocumentsPreview"; +import Architectconcent from "./Architectconcent"; + +const CheckPage = ({ onSubmit, value }) => { + const [development, setDevelopment] = useState() + const [otherCharges, setOtherCharges] = useState() + const [lessAdjusment, setLessAdjusment] = useState() + const [labourCess , setLabourCess] =useState() + const [gaushalaFees , setGaushalaFees] =useState() + const [malbafees , setMalbafees] =useState() + const [waterCharges , setWaterCharges] =useState() + const { t } = useTranslation(); + const history = useHistory(); + const match = useRouteMatch(); + const user = Digit.UserService.getUser(); + + const state = Digit.ULBService.getStateId(); + + const tenantId = user?.info?.permanentCity || value?.tenantId ||Digit.ULBService.getCurrentTenantId() ; + const { isMdmsLoading, data: mdmsData } = Digit.Hooks.obps.useMDMS(state, "BPA", ["GaushalaFees","MalbaCharges","LabourCess"]); + const [otherChargesDisc, setOtherChargesDisc] = useState() + const [uploadedFile, setUploadedFile] = useState(); + const [uploadedFileLess, setUploadedFileLess] = useState([]); + const [file, setFile] = useState(); + const [uploadMessage, setUploadMessage] = useState(""); + const [errorFile, setError] = useState(null); + const [docLessAdjustment, setDocuments] = useState({}); + let acceptFormat = ".pdf" + let BusinessService; + if(value.businessService === "BPA_LOW") + BusinessService="BPA.LOW_RISK_PERMIT_FEE"; + else if(value.businessService === "BPA") + BusinessService="BPA.NC_APP_FEE"; - + - - const { data, address, owners, nocDocuments, documents, additionalDetails, subOccupancy,PrevStateDocuments,PrevStateNocDocuments,applicationNo } = value; - const isEditApplication = window.location.href.includes("editApplication"); - - const [agree, setAgree] = useState(false); - const setdeclarationhandler = () => { - setAgree(!agree); - }; - - const Architectvalidations = sessionStorage.getItem("ArchitectConsentdocFilestoreid") ? true : false ; - const architectmobilenumber = user?.info?.mobileNumber - const [showTermsPopup, setShowTermsPopup] = useState(false); - const [showMobileInput, setShowMobileInput] = useState(false); - const [mobileNumber, setMobileNumber] = useState(architectmobilenumber || ''); - const [showOTPInput, setShowOTPInput] = useState(false); - const [otp, setOTP] = useState(''); - const [isOTPVerified, setIsOTPVerified] = useState(false); - const [otpError, setOTPError] = useState(""); - const [otpVerifiedTimestamp, setOTPVerifiedTimestamp] = useState(null); - + + const { data, address, owners, nocDocuments, documents, additionalDetails, subOccupancy,PrevStateDocuments,PrevStateNocDocuments,applicationNo } = value; + const isEditApplication = window.location.href.includes("editApplication"); - const handleTermsLinkClick = () => { - if (isOTPVerified){ - setShowTermsPopup(true); - } - else{ - alert("Please verify yourself") - } - - } + const [agree, setAgree] = useState(false); + const setdeclarationhandler = () => { + setAgree(!agree); + }; - const checkLabels = () => { - return ( -
- {t("I_AGREE_TO_BELOW_UNDERTAKING")} - -
- ); - }; + const Architectvalidations = sessionStorage.getItem("ArchitectConsentdocFilestoreid") ? true : false ; + const architectmobilenumber = user?.info?.mobileNumber + const [showTermsPopup, setShowTermsPopup] = useState(false); + const [showMobileInput, setShowMobileInput] = useState(false); + const [mobileNumber, setMobileNumber] = useState(architectmobilenumber || ''); + const [showOTPInput, setShowOTPInput] = useState(false); + const [otp, setOTP] = useState(''); + const [isOTPVerified, setIsOTPVerified] = useState(false); + const [otpError, setOTPError] = useState(""); + const [otpVerifiedTimestamp, setOTPVerifiedTimestamp] = useState(null); + + const handleTermsLinkClick = () => { + if (isOTPVerified){ + setShowTermsPopup(true); + } + else{ + alert("Please verify yourself") + } + } + const checkLabels = () => { + return ( +
+ {t("I_AGREE_TO_BELOW_UNDERTAKING")} + +
+ ); + }; - - - + - const handleVerifyClick = () => { - setShowMobileInput(true); - }; - const handleMobileNumberChange = (e) => { - setMobileNumber(e.target.value); - }; + + + - const handleGetOTPClick = async () => { - // Call the Digit.UserService.sendOtp API to send the OTP - try { - const response = await Digit.UserService.sendOtp({otp:{mobileNumber:mobileNumber, tenantId: user?.info?.tenantId, userType: user?.info?.type, type: "login"}}); - if (response.isSuccessful) { - setShowOTPInput(true); - } else { - // Handle error case if OTP sending fails - console.error("Error sending OTP Response is false:", response.error); - alert("Something Went Wrong") - } - } catch (error) { - console.error("Error sending OTP:", error); - alert("Something went wrong") + const handleVerifyClick = () => { + setShowMobileInput(true); + }; + + const handleMobileNumberChange = (e) => { + setMobileNumber(e.target.value); + }; + + const handleGetOTPClick = async () => { + // Call the Digit.UserService.sendOtp API to send the OTP + try { + const response = await Digit.UserService.sendOtp({otp:{mobileNumber:mobileNumber, tenantId: user?.info?.tenantId, userType: user?.info?.type, type: "login"}}); + if (response.isSuccessful) { + setShowOTPInput(true); + } else { + // Handle error case if OTP sending fails + console.error("Error sending OTP Response is false:", response.error); + alert("Something Went Wrong") } - }; - - - - const handleOTPChange = (e) => { - setOTP(e.target.value); - }; - - const requestData = { - username:mobileNumber, - password:otp, - tenantId: user?.info?.tenantId, - userType: user?.info?.type - - }; - - const handleVerifyOTPClick = async () => { - // Call the API to verify the OTP - try { - const response = await Digit.UserService.authenticate(requestData); - if (response.ResponseInfo.status==="Access Token generated successfully") { - setIsOTPVerified(true); - setOTPError(t("VERIFIED")); - const currentTimestamp = new Date(); - setOTPVerifiedTimestamp(currentTimestamp); - sessionStorage.setItem('otpVerifiedTimestamp', currentTimestamp.toString().replace(/GMT.*\((.*)\)/, '').trim()); - } else { - setIsOTPVerified(false); - setOTPError(t("WRONG OTP")); - } - } catch (error) { - console.error("Error verifying OTP:", error); - alert("OTP Verification Error ") + } catch (error) { + console.error("Error sending OTP:", error); + alert("Something went wrong") + } + }; + + + + const handleOTPChange = (e) => { + setOTP(e.target.value); + }; + + const requestData = { + username:mobileNumber, + password:otp, + tenantId: user?.info?.tenantId, + userType: user?.info?.type + + }; + + const handleVerifyOTPClick = async () => { + // Call the API to verify the OTP + try { + const response = await Digit.UserService.authenticate(requestData); + if (response.ResponseInfo.status==="Access Token generated successfully") { + setIsOTPVerified(true); + setOTPError(t("VERIFIED")); + const currentTimestamp = new Date(); + setOTPVerifiedTimestamp(currentTimestamp); + sessionStorage.setItem('otpVerifiedTimestamp', currentTimestamp.toString().replace(/GMT.*\((.*)\)/, '').trim()); + } else { setIsOTPVerified(false); - setOTPError(t("OTP Verification Error")); + setOTPError(t("WRONG OTP")); } - }; + } catch (error) { + console.error("Error verifying OTP:", error); + alert("OTP Verification Error ") + setIsOTPVerified(false); + setOTPError(t("OTP Verification Error")); + } + }; - const isValidMobileNumber = mobileNumber.length === 10 && /^[0-9]+$/.test(mobileNumber); + const isValidMobileNumber = mobileNumber.length === 10 && /^[0-9]+$/.test(mobileNumber); - useEffect(() => { - (async () => { - setError(null); - if (file&& file?.type) { - if(!(acceptFormat?.split(",")?.includes(`.${file?.type?.split("/")?.pop()}`))) - { - setError(t("PT_UPLOAD_FORMAT_NOT_SUPPORTED")); - } - else if (file.size >= 2000000) { - setError(t("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED")); - } else { - try { - const response = await Digit.UploadServices.Filestorage("property-upload", file, Digit.ULBService.getStateId()); - if (response?.data?.files?.length > 0) { - setUploadedFileLess([...uploadedFileLess,{fileStoreId:response?.data?.files[0]?.fileStoreId, time:new Date()}]); - } else { - setError(t("PT_FILE_UPLOAD_ERROR")); - } - } catch (err) { + useEffect(() => { + (async () => { + setError(null); + if (file&& file?.type) { + if(!(acceptFormat?.split(",")?.includes(`.${file?.type?.split("/")?.pop()}`))) + { + setError(t("PT_UPLOAD_FORMAT_NOT_SUPPORTED")); + } + else if (file.size >= 2000000) { + setError(t("PT_MAXIMUM_UPLOAD_SIZE_EXCEEDED")); + } else { + try { + const response = await Digit.UploadServices.Filestorage("property-upload", file, Digit.ULBService.getStateId()); + if (response?.data?.files?.length > 0) { + setUploadedFileLess([...uploadedFileLess,{fileStoreId:response?.data?.files[0]?.fileStoreId, time:new Date()}]); + } else { + setError(t("PT_FILE_UPLOAD_ERROR")); } + } catch (err) { } } - })(); - }, [file]); - useEffect(()=>{ - sessionStorage.setItem("uploadedFileLess",JSON.stringify(uploadedFileLess)); - },[uploadedFileLess]) - - const sitePhotographOne = value?.documents?.documents.find(doc => doc?.documentType==="SITEPHOTOGRAPH.ONE.ONE") - - - useEffect(()=>{ - if (value?.additionalDetails?.lessAdjustmentFeeFiles?.length) { - const fileStoresIds = value?.additionalDetails?.lessAdjustmentFeeFiles.map((document,index) =>(index===value?.additionalDetails?.lessAdjustmentFeeFiles?.length-1 ? value?.additionalDetails?.lessAdjustmentFeeFiles[value?.additionalDetails?.lessAdjustmentFeeFiles?.length-1]?.fileStoreId : null)); - Digit.UploadServices.Filefetch(fileStoresIds, state).then((res) => setDocuments(res?.data)); - } - if(isEditApplication){ - setDevelopment(value?.additionalDetails?.selfCertificationCharges?.BPA_DEVELOPMENT_CHARGES); - sessionStorage.setItem("development",value?.additionalDetails?.selfCertificationCharges?.BPA_DEVELOPMENT_CHARGES); - setOtherCharges(value?.additionalDetails?.selfCertificationCharges?.BPA_OTHER_CHARGES); - sessionStorage.setItem("otherCharges",value?.additionalDetails?.selfCertificationCharges?.BPA_OTHER_CHARGES); - setLessAdjusment(value?.additionalDetails?.selfCertificationCharges?.BPA_LESS_ADJUSMENT_PLOT); - sessionStorage.setItem("lessAdjusment",value?.additionalDetails?.selfCertificationCharges?.BPA_LESS_ADJUSMENT_PLOT); - setOtherChargesDisc(value?.additionalDetails?.otherFeesDiscription); - sessionStorage.setItem("otherChargesDisc",value?.additionalDetails?.otherFeesDiscription); - setUploadedFileLess(value?.additionalDetails?.lessAdjustmentFeeFiles); } + })(); + }, [file]); + useEffect(()=>{ + sessionStorage.setItem("uploadedFileLess",JSON.stringify(uploadedFileLess)); +},[uploadedFileLess]) + +const sitePhotographOne = value?.documents?.documents.find(doc => doc?.documentType==="SITEPHOTOGRAPH.ONE.ONE") + + useEffect(()=>{ + if (value?.additionalDetails?.lessAdjustmentFeeFiles?.length) { + const fileStoresIds = value?.additionalDetails?.lessAdjustmentFeeFiles.map((document,index) =>(index===value?.additionalDetails?.lessAdjustmentFeeFiles?.length-1 ? value?.additionalDetails?.lessAdjustmentFeeFiles[value?.additionalDetails?.lessAdjustmentFeeFiles?.length-1]?.fileStoreId : null)); + Digit.UploadServices.Filefetch(fileStoresIds, state).then((res) => setDocuments(res?.data)); + } + if(isEditApplication){ + setDevelopment(value?.additionalDetails?.selfCertificationCharges?.BPA_DEVELOPMENT_CHARGES); + sessionStorage.setItem("development",value?.additionalDetails?.selfCertificationCharges?.BPA_DEVELOPMENT_CHARGES); + setOtherCharges(value?.additionalDetails?.selfCertificationCharges?.BPA_OTHER_CHARGES); + sessionStorage.setItem("otherCharges",value?.additionalDetails?.selfCertificationCharges?.BPA_OTHER_CHARGES); + setLessAdjusment(value?.additionalDetails?.selfCertificationCharges?.BPA_LESS_ADJUSMENT_PLOT); + sessionStorage.setItem("lessAdjusment",value?.additionalDetails?.selfCertificationCharges?.BPA_LESS_ADJUSMENT_PLOT); + setOtherChargesDisc(value?.additionalDetails?.otherFeesDiscription); + sessionStorage.setItem("otherChargesDisc",value?.additionalDetails?.otherFeesDiscription); + setUploadedFileLess(value?.additionalDetails?.lessAdjustmentFeeFiles); + } let plotArea = parseInt(sessionStorage.getItem("plotArea")) || datafromAPI?.planDetail?.planInformation?.plotArea || value?.additionalDetails?.area; -//plotArea*10.7639 conversion from sq mtrs to sq ft; -const LabourCess =Math.round( (plotArea*10.7639) > 909 ?mdmsData?.BPA?.LabourCess[1].rate * (plotArea*10.7639) : 0) - const GaushalaFees = Math.round( mdmsData?.BPA?.GaushalaFees[0].rate ) - const Malbafees =Math.round( ((plotArea*10.7639) <=500 ?mdmsData?.BPA?.MalbaCharges[0].rate :(plotArea*10.7639) >500 && (plotArea*10.7639) <=1000 ?mdmsData?.BPA?.MalbaCharges?.[1].rate :mdmsData?.BPA?.MalbaCharges[2].rate || 500)) -sessionStorage.setItem("Malbafees",Malbafees) -sessionStorage.setItem("WaterCharges",Malbafees/2) -sessionStorage.setItem("GaushalaFees",GaushalaFees) -sessionStorage.setItem("LabourCess",LabourCess) -setGaushalaFees(GaushalaFees) -setLabourCess(LabourCess) -setMalbafees(Malbafees) -setWaterCharges(Malbafees/2) -},[mdmsData,value?.additionalDetails]) - // for application documents - let improvedDoc = []; - PrevStateDocuments?.map(preDoc => { improvedDoc.push({...preDoc, module: "OBPS"}) }); - documents?.documents?.map(appDoc => { improvedDoc.push({...appDoc, module: "OBPS"}) }); - - //for NOC documents - PrevStateNocDocuments?.map(preNocDoc => { improvedDoc.push({...preNocDoc, module: "NOC"}) }); - nocDocuments?.nocDocuments?.map(nocDoc => { improvedDoc.push({...nocDoc, module: "NOC"}) }); - - const { data: pdfDetails, isLoading:pdfLoading, error } = Digit.Hooks.useDocumentSearch( improvedDoc, { enabled: improvedDoc?.length > 0 ? true : false}); - - let applicationDocs = [], nocAppDocs = []; - if (pdfDetails?.pdfFiles?.length > 0) { - pdfDetails?.pdfFiles?.map(pdfAppDoc => { - if (pdfAppDoc?.module == "OBPS") applicationDocs.push(pdfAppDoc); - if (pdfAppDoc?.module == "NOC") nocAppDocs.push(pdfAppDoc); - }); - } - - const { data:datafromAPI, isLoading, refetch } = Digit.Hooks.obps.useScrutinyDetails(tenantId,value?.data?.scrutinyNumber, { - enabled: value?.data?.scrutinyNumber?true:false, - }) + //plotArea*10.7639 conversion from sq mtrs to sq ft; + const LabourCess = Math.round((plotArea * 10.7639) > 909 ? mdmsData?.BPA?.LabourCess[1].rate * (plotArea * 10.7639) : 0) + const GaushalaFees = Math.round(mdmsData?.BPA?.GaushalaFees[0].rate) + const Malbafees = Math.round(((plotArea * 10.7639) <= 500 ? mdmsData?.BPA?.MalbaCharges[0].rate : (plotArea * 10.7639) > 500 && (plotArea * 10.7639) <= 1000 ? mdmsData?.BPA?.MalbaCharges?.[1].rate : mdmsData?.BPA?.MalbaCharges[2].rate || 500)) + sessionStorage.setItem("Malbafees", Malbafees) + sessionStorage.setItem("WaterCharges", Malbafees / 2) + sessionStorage.setItem("GaushalaFees", GaushalaFees) + sessionStorage.setItem("LabourCess", LabourCess) + setGaushalaFees(GaushalaFees) + setLabourCess(LabourCess) + setMalbafees(Malbafees) + setWaterCharges(Malbafees / 2) + }, [mdmsData, value?.additionalDetails]) + // for application documents + let improvedDoc = []; + PrevStateDocuments?.map(preDoc => { improvedDoc.push({...preDoc, module: "OBPS"}) }); + documents?.documents?.map(appDoc => { improvedDoc.push({...appDoc, module: "OBPS"}) }); + + //for NOC documents + PrevStateNocDocuments?.map(preNocDoc => { improvedDoc.push({...preNocDoc, module: "NOC"}) }); + nocDocuments?.nocDocuments?.map(nocDoc => { improvedDoc.push({...nocDoc, module: "NOC"}) }); + + const { data: pdfDetails, isLoading:pdfLoading, error } = Digit.Hooks.useDocumentSearch( improvedDoc, { enabled: improvedDoc?.length > 0 ? true : false}); + + let applicationDocs = [], nocAppDocs = []; + if (pdfDetails?.pdfFiles?.length > 0) { + pdfDetails?.pdfFiles?.map(pdfAppDoc => { + if (pdfAppDoc?.module == "OBPS") applicationDocs.push(pdfAppDoc); + if (pdfAppDoc?.module == "NOC") nocAppDocs.push(pdfAppDoc); + }); + } + const { data:datafromAPI, isLoading, refetch } = Digit.Hooks.obps.useScrutinyDetails(tenantId,value?.data?.scrutinyNumber, { + enabled: value?.data?.scrutinyNumber?true:false, + }) - let consumerCode=value?.applicationNo; - const fetchBillParams = { consumerCode }; - function getdate(date) { - let newdate = Date.parse(date); - return `${new Date(newdate).getDate().toString() + "/" + (new Date(newdate).getMonth() + 1).toString() + "/" + new Date(newdate).getFullYear().toString() - }`; - } + let consumerCode=value?.applicationNo; + const fetchBillParams = { consumerCode }; + function getdate(date) { + let newdate = Date.parse(date); + return `${new Date(newdate).getDate().toString() + "/" + (new Date(newdate).getMonth() + 1).toString() + "/" + new Date(newdate).getFullYear().toString() + }`; + } - const {data:paymentDetails} = Digit.Hooks.useFetchBillsForBuissnessService( - { businessService: BusinessService, ...fetchBillParams, tenantId: tenantId }, - { - enabled: consumerCode ? true : false, - retry: false, - } - ); - if(!isEditApplication){ - value.additionalDetails.P1charges=paymentDetails?.Bill[0]?.billDetails[0]?.amount; - } - const sendbacktocitizenApp = window.location.href.includes("sendbacktocitizen"); - let routeLink = `/digit-ui/citizen/obps/bpa/${additionalDetails?.applicationType.toLowerCase()}/${additionalDetails?.serviceType.toLowerCase()}`; - if (isEditApplication) routeLink = `/digit-ui/citizen/obps/editApplication/bpa/${value?.tenantId}/${value?.applicationNo}`; - if( sendbacktocitizenApp ) routeLink = `/digit-ui/citizen/obps/sendbacktocitizen/bpa/${value?.tenantId}/${value?.applicationNo}`; - const tableHeader = [ - { - name:"BPA_TABLE_COL_FLOOR", - id:"Floor", - }, - { - name:"BPA_TABLE_COL_LEVEL", - id:"Level", - }, - { - name:"BPA_TABLE_COL_OCCUPANCY", - id:"Occupancy", - }, - { - name:"BPA_TABLE_COL_BUILDUPAREA", - id:"BuildupArea", - }, - { - name:"BPA_TABLE_COL_FLOORAREA", - id:"FloorArea", - }, - // { - // name:"BPA_TABLE_COL_CARPETAREA", - // id:"CarpetArea", - // } - ] - - const accessData = (plot) => { - const name = plot; - return (originalRow, rowIndex, columns) => { - return originalRow[name]; - } + const {data:paymentDetails} = Digit.Hooks.useFetchBillsForBuissnessService( + { businessService: BusinessService, ...fetchBillParams, tenantId: tenantId }, + { + enabled: consumerCode ? true : false, + retry: false, } - - - const tableColumns = useMemo( - () => { - - return tableHeader.map((ob)=> ({ - Header:t(`${ob.name}`), - accessor: accessData(ob.id), - id: ob.id, - //symbol: plot?.symbol, - //sortType: sortRows, - })); - - - }); - - - function getFloorData(block){ - let floors = []; - block?.building?.floors.map((ob) => { - floors.push({ - Floor:t(`BPA_FLOOR_NAME_${ob.number}`), - Level:ob.number, - Occupancy:t(`${ob.occupancies?.[0]?.type}`), - BuildupArea:ob.occupancies?.[0]?.builtUpArea, - FloorArea:ob.occupancies?.[0]?.floorArea || 0, - CarpetArea:ob.occupancies?.[0]?.CarpetArea || 0, - key:t(`BPA_FLOOR_NAME_${ob.number}`), - }); - }); - return floors; + ); + if(!isEditApplication){ + value.additionalDetails.P1charges=paymentDetails?.Bill[0]?.billDetails[0]?.amount; + } + const sendbacktocitizenApp = window.location.href.includes("sendbacktocitizen"); + let routeLink = `/digit-ui/citizen/obps/bpa/${additionalDetails?.applicationType.toLowerCase()}/${additionalDetails?.serviceType.toLowerCase()}`; + if (isEditApplication) routeLink = `/digit-ui/citizen/obps/editApplication/bpa/${value?.tenantId}/${value?.applicationNo}`; + if( sendbacktocitizenApp ) routeLink = `/digit-ui/citizen/obps/sendbacktocitizen/bpa/${value?.tenantId}/${value?.applicationNo}`; + + const tableHeader = [ + { + name:"BPA_TABLE_COL_FLOOR", + id:"Floor", + }, + { + name:"BPA_TABLE_COL_LEVEL", + id:"Level", + }, + { + name:"BPA_TABLE_COL_OCCUPANCY", + id:"Occupancy", + }, + { + name:"BPA_TABLE_COL_BUILDUPAREA", + id:"BuildupArea", + }, + { + name:"BPA_TABLE_COL_FLOORAREA", + id:"FloorArea", + }, + // { + // name:"BPA_TABLE_COL_CARPETAREA", + // id:"CarpetArea", + // } + ] + + const accessData = (plot) => { + const name = plot; + return (originalRow, rowIndex, columns) => { + return originalRow[name]; } - - function routeTo(jumpTo) { - location.href=jumpTo; } - - function getBlockSubOccupancy(index){ - let subOccupancyString = ""; - let returnValueArray = []; - subOccupancy && subOccupancy[`Block_${index+1}`] && subOccupancy[`Block_${index+1}`].map((ob) => { - // subOccupancyString += `${t(ob.i18nKey)}, `; - returnValueArray.push(`${t(stringReplaceAll(ob?.i18nKey?.toUpperCase(), "-", "_"))}`); - }) - return returnValueArray?.length ? returnValueArray.join(', ') : "NA" - // return subOccupancyString; + const tableColumns = useMemo( + () => { + + return tableHeader.map((ob)=> ({ + Header:t(`${ob.name}`), + accessor: accessData(ob.id), + id: ob.id, + //symbol: plot?.symbol, + //sortType: sortRows, + })); + + + }); + + + function getFloorData(block){ + let floors = []; + block?.building?.floors.map((ob) => { + floors.push({ + Floor:t(`BPA_FLOOR_NAME_${ob.number}`), + Level:ob.number, + Occupancy:t(`${ob.occupancies?.[0]?.type}`), + BuildupArea:ob.occupancies?.[0]?.builtUpArea, + FloorArea:ob.occupancies?.[0]?.floorArea || 0, + CarpetArea:ob.occupancies?.[0]?.CarpetArea || 0, + key:t(`BPA_FLOOR_NAME_${ob.number}`), + }); + }); + return floors; } - if (pdfLoading || isLoading) { - return - } + function routeTo(jumpTo) { + location.href=jumpTo; + } - function onSubmitCheck(){ - if(!development){ - sessionStorage.setItem("development",0) - } - if(!lessAdjusment){ - sessionStorage.setItem("lessAdjusment",0) - } - if(!otherCharges){ - sessionStorage.setItem("otherCharges",0) - } - if(parseInt(lessAdjusment)>(parseInt(development)+parseInt(otherCharges)+parseInt(malbafees)+parseInt(labourCess)+parseInt(waterCharges)+parseInt(gaushalaFees))){ - alert(t("Enterd Less Adjustment amount is invalid")); - } - else{ - onSubmit(); - } + + + function getBlockSubOccupancy(index){ + let subOccupancyString = ""; + let returnValueArray = []; + subOccupancy && subOccupancy[`Block_${index+1}`] && subOccupancy[`Block_${index+1}`].map((ob) => { + // subOccupancyString += `${t(ob.i18nKey)}, `; + returnValueArray.push(`${t(stringReplaceAll(ob?.i18nKey?.toUpperCase(), "-", "_"))}`); + }) + return returnValueArray?.length ? returnValueArray.join(', ') : "NA" + // return subOccupancyString; } - function setOtherChargesVal(value) { - if(/^[0-9]*$/.test(value)){ - setOtherCharges(value); - sessionStorage.setItem("otherCharges",value) - } - else{ - alert(t("Please enter numbers")) - } + if (pdfLoading || isLoading) { + return } - function setDevelopmentVal(value) { - if(/^\d{0,9}$/.test(value)){ - setDevelopment(value); - sessionStorage.setItem("development",value) - } - else{ - alert(t("Please enter only upto 9 numbers")) - } + + function onSubmitCheck(){ + if(!development){ + sessionStorage.setItem("development",0) + } + if(!waterCharges){ + sessionStorage.setItem("WaterCharges",0) + } + if(!lessAdjusment){ + sessionStorage.setItem("lessAdjusment",0) + } + if(!otherCharges){ + sessionStorage.setItem("otherCharges",0) + } + if(parseInt(lessAdjusment)>(parseInt(development)+parseInt(otherCharges)+parseInt(malbafees)+parseInt(labourCess)+parseInt(waterCharges)+parseInt(gaushalaFees))){ + alert(t("Enterd Less Adjustment amount is invalid")); } - function setLessAdjusmentVal(value) { + else{ + onSubmit(); + } +} + + function setOtherChargesVal(value) { if(/^[0-9]*$/.test(value)){ - if(parseInt(value)>((parseInt(development)?parseInt(development):0)+(parseInt(otherCharges)?parseInt(otherCharges):0)+parseInt(malbafees)+parseInt(labourCess)+parseInt(waterCharges)+parseInt(gaushalaFees))){ - alert(t("Less adjustment fees cannot be grater than Total of other P2 fees")) - } - else{ - setLessAdjusment(value); - sessionStorage.setItem("lessAdjusment",value) - } + setOtherCharges(value); + sessionStorage.setItem("otherCharges",value) + } + else{ + alert(t("Please enter numbers")) + } +} + function setDevelopmentVal(value) { + if(/^\d{0,9}$/.test(value)){ + setDevelopment(value); + sessionStorage.setItem("development",value) + } + else{ + alert(t("Please enter only upto 9 numbers")) + } + } + function setWaterChargesVal(value) { + if(/^\d{0,9}$/.test(value)){ + setWaterCharges(value); + sessionStorage.setItem("WaterCharges",value) } else{ - alert(t("Please enter numbers")) + alert(t("Please enter only upto 9 numbers")) } + } + function setLessAdjusmentVal(value) { + if(/^[0-9]*$/.test(value)){ + if(parseInt(value)>((parseInt(development)?parseInt(development):0)+(parseInt(otherCharges)?parseInt(otherCharges):0)+parseInt(malbafees)+parseInt(labourCess)+parseInt(waterCharges)+parseInt(gaushalaFees))){ + alert(t("Less adjustment fees cannot be grater than Total of other P2 fees")) } - function setOtherChargesDis(value) { - setOtherChargesDisc(value); - sessionStorage.setItem("otherChargesDisc",value) ; + else{ + setLessAdjusment(value); + sessionStorage.setItem("lessAdjusment",value) + } + } + else{ + alert(t("Please enter numbers")) + } + } + function setOtherChargesDis(value) { + setOtherChargesDisc(value); + sessionStorage.setItem("otherChargesDisc",value) ; } function selectfile(e) { - setUploadedFile(e.target.files[0]); - setFile(e.target.files[0]); - } - - return ( - - -
{t("BPA_STEPPER_SUMMARY_HEADER")}
- - - - - - - {t(`BPA_BASIC_DETAILS_TITLE`)} - - - - - - - {/* */} - + setUploadedFile(e.target.files[0]); + setFile(e.target.files[0]); + } + + return ( + + +
{t("BPA_STEPPER_SUMMARY_HEADER")}
+ + + + + + + {t(`BPA_BASIC_DETAILS_TITLE`)} + + + + + + + {/* */} + + + + + {t("BPA_PLOT_DETAILS_TITLE")} + } + style={{ width: "100px", display:"inline" }} + onClick={() => routeTo(`${routeLink}/plot-details`)} + /> + + + + + + + + + + + + + + {t("BPA_STEPPER_SCRUTINY_DETAILS_HEADER")} + {t("BPA_EDCR_DETAILS")} + + + {t("BPA_UPLOADED_PLAN_DIAGRAM")} + } + onClick={() => routeTo(datafromAPI?.updatedDxfFile)} + /> +

{t(`Uploaded Plan.pdf`)}

+ {t("BPA_SCRUNTINY_REPORT_OUTPUT")} + } + onClick={() => routeTo(datafromAPI?.planReport)} + /> +

{t(`BPA_SCRUTINY_REPORT_PDF`)}

+
+
+ {t("BPA_BUILDING_EXTRACT_HEADER")} + + + + + + +
+ {t("BPA_OCC_SUBOCC_HEADER")} + {datafromAPI?.planDetail?.blocks.map((block,index)=>( +
1 ?{ marginTop: "19px", background: "#FAFAFA", border: "1px solid #D6D5D4", borderRadius: "4px", padding: "8px", lineHeight: "19px", maxWidth: "960px", minWidth: "280px" } : {}}> + {t("BPA_BLOCK_SUBHEADER")} {index+1} + + + +
+ { + return { + style: {}, + }; + }} + /> + + ))} +
+ {t("BPA_APP_DETAILS_DEMOLITION_DETAILS_LABEL")} + + + - {t("BPA_PLOT_DETAILS_TITLE")} - {t("BPA_NEW_TRADE_DETAILS_HEADER_DETAILS")} + } - style={{ width: "100px", display:"inline" }} - onClick={() => routeTo(`${routeLink}/plot-details`)} + style={{ width: "100px", display: "inline" }} + onClick={() => routeTo(`${routeLink}/location`)} /> - - - - - - - - + + + + + + + - - {t("BPA_STEPPER_SCRUTINY_DETAILS_HEADER")} - {t("BPA_EDCR_DETAILS")} - - - {t("BPA_UPLOADED_PLAN_DIAGRAM")} - } - onClick={() => routeTo(datafromAPI?.updatedDxfFile)} - /> -

{t(`Uploaded Plan.pdf`)}

- {t("BPA_SCRUNTINY_REPORT_OUTPUT")} - } - onClick={() => routeTo(datafromAPI?.planReport)} - /> -

{t(`BPA_SCRUTINY_REPORT_PDF`)}

-
-
- {t("BPA_BUILDING_EXTRACT_HEADER")} + + {t("BPA_APPLICANT_DETAILS_HEADER")} + } + style={{ width: "100px", display: "inline" }} + onClick={() => routeTo(`${routeLink}/owner-details`)} + /> + {owners?.owners && owners?.owners.map((ob,index) =>( +
1 ?{ marginTop: "19px", background: "#FAFAFA", border: "1px solid #D6D5D4", borderRadius: "4px", padding: "8px", lineHeight: "19px", maxWidth: "960px", minWidth: "280px" } : {}}> + {owners.owners.length > 1 && {t("COMMON_OWNER")} {index+1}} - - - - - -
- {t("BPA_OCC_SUBOCC_HEADER")} - {datafromAPI?.planDetail?.blocks.map((block,index)=>( -
1 ?{ marginTop: "19px", background: "#FAFAFA", border: "1px solid #D6D5D4", borderRadius: "4px", padding: "8px", lineHeight: "19px", maxWidth: "960px", minWidth: "280px" } : {}}> - {t("BPA_BLOCK_SUBHEADER")} {index+1} - - + + + + + -
-
{ - return { - style: {}, - }; - }} - /> - ))} -
- {t("BPA_APP_DETAILS_DEMOLITION_DETAILS_LABEL")} - - - - - - {t("BPA_NEW_TRADE_DETAILS_HEADER_DETAILS")} - } - style={{ width: "100px", display: "inline" }} - onClick={() => routeTo(`${routeLink}/location`)} - /> - - - - - - - + - - - + - {t("BPA_APPLICANT_DETAILS_HEADER")} - } - style={{ width: "100px", display: "inline" }} - onClick={() => routeTo(`${routeLink}/owner-details`)} - /> - {owners?.owners && owners?.owners.map((ob,index) =>( -
1 ?{ marginTop: "19px", background: "#FAFAFA", border: "1px solid #D6D5D4", borderRadius: "4px", padding: "8px", lineHeight: "19px", maxWidth: "960px", minWidth: "280px" } : {}}> - {owners.owners.length > 1 && {t("COMMON_OWNER")} {index+1}} - - - - - - - -
))} -
-
- - - - {t("BPA_ADDITIONAL_BUILDING_DETAILS")} - - {owners?.approvedColony?.i18nKey==="YES" && ( - - - - )} - {owners?.approvedColony?.i18nKey==="NO" && ( - - - - )} - - - - - - - {owners?.schemes?.code === "SCHEME" && ( - - - - - - )} - - - - + {t("BPA_ADDITIONAL_BUILDING_DETAILS")} + + {owners?.approvedColony?.i18nKey==="YES" && ( + + + + )} + {owners?.approvedColony?.i18nKey==="NO" && ( + + + + )} + + + + + + + {owners?.schemes?.code === "SCHEME" && ( + + + + + + )} + + + + - - +
+ - + + + {t("BPA_DOCUMENT_DETAILS_LABEL")} + } + style={{ width: "100px", display: "inline" }} + onClick={() => routeTo(`${routeLink}/document-details`)} + /> + {} + + + {/* + + {t("BPA_NOC_DETAILS_SUMMARY")} + } + style={{ width: "100px", display: "inline" }} + onClick={() => routeTo(`${routeLink}/noc-number`)} + /> + */} + {/* {nocDocuments && nocDocuments?.NocDetails.map((noc, index) => ( +
1 ?{ marginTop: "19px", background: "#FAFAFA", border: "1px solid #D6D5D4", borderRadius: "4px", padding: "8px", lineHeight: "19px", maxWidth: "960px", minWidth: "280px" } : {}}> + {`${t(`BPA_${noc?.nocType}_HEADER`)}`} - {t("BPA_DOCUMENT_DETAILS_LABEL")} - } - style={{ width: "100px", display: "inline" }} - onClick={() => routeTo(`${routeLink}/document-details`)} + + + {noc?.additionalDetails?.SubmittedOn ? : null } + {noc?.nocNo ? : null } + {(noc?.applicationStatus === "APPROVED" || noc?.applicationStatus === "REJECTED" || noc?.applicationStatus === "AUTO_APPROVED" || noc?.applicationStatus === "AUTO_REJECTED") ? : null } + + { data?.documentType?.includes(noc?.nocType?.split("_")?.[0])), true)} svgStyles = {{}} isSendBackFlow = {false} isHrLine = {true} titleStyles ={{fontSize: "18px", lineHeight: "24px", "fontWeight": 700, marginBottom: "10px"}}/>} + +
+ ))} */} + {/*
+
*/} + + {t("BPA_SUMMARY_FEE_EST")} + + {/* {paymentDetails?.Bill[0]?.billDetails[0]?.billAccountDetails.map((bill,index)=>( +
+ +
+ ))} */} + {/* */} + {t("BPA_P1_SUMMARY_FEE_EST")} + + + + + {t("BPA_P2_SUMMARY_FEE_EST")} + + + {/* */} + + {t("BPA_P2_SUMMARY_FEE_EST_MANUAL")} + {t("BPA_COMMON_WATER_AMT")} + {setWaterChargesVal(e.target.value)}} + //disable={userInfo?.info?.emailId && !isOpenLinkFlow ? true : false} + //disable={editScreen} + {...{ required: true, pattern: "^[0-9]*$" }} /> - {} -
-
- {/* - - {t("BPA_NOC_DETAILS_SUMMARY")} - } - style={{ width: "100px", display: "inline" }} - onClick={() => routeTo(`${routeLink}/noc-number`)} + {t("BPA_COMMON_DEVELOPMENT_AMT")} + {setDevelopmentVal(e.target.value)}} + //disable={userInfo?.info?.emailId && !isOpenLinkFlow ? true : false} + //disable={editScreen} + {...{ required: true, pattern: "^[0-9]*$" }} /> - */} - {/* {nocDocuments && nocDocuments?.NocDetails.map((noc, index) => ( -
1 ?{ marginTop: "19px", background: "#FAFAFA", border: "1px solid #D6D5D4", borderRadius: "4px", padding: "8px", lineHeight: "19px", maxWidth: "960px", minWidth: "280px" } : {}}> - {`${t(`BPA_${noc?.nocType}_HEADER`)}`} - - - - {noc?.additionalDetails?.SubmittedOn ? : null } - {noc?.nocNo ? : null } - {(noc?.applicationStatus === "APPROVED" || noc?.applicationStatus === "REJECTED" || noc?.applicationStatus === "AUTO_APPROVED" || noc?.applicationStatus === "AUTO_REJECTED") ? : null } - - { data?.documentType?.includes(noc?.nocType?.split("_")?.[0])), true)} svgStyles = {{}} isSendBackFlow = {false} isHrLine = {true} titleStyles ={{fontSize: "18px", lineHeight: "24px", "fontWeight": 700, marginBottom: "10px"}}/>} - -
- ))} */} - {/*
-
*/} - - {t("BPA_SUMMARY_FEE_EST")} - - {/* {paymentDetails?.Bill[0]?.billDetails[0]?.billAccountDetails.map((bill,index)=>( -
- -
- ))} */} - {/* */} - {t("BPA_P1_SUMMARY_FEE_EST")} - - - - - {t("BPA_P2_SUMMARY_FEE_EST")} - - - - - {t("BPA_P2_SUMMARY_FEE_EST_MANUAL")} - {t("BPA_COMMON_DEVELOPMENT_AMT")} - {setDevelopmentVal(e.target.value)}} - //disable={userInfo?.info?.emailId && !isOpenLinkFlow ? true : false} - //disable={editScreen} - {...{ required: true, pattern: "^[0-9]*$" }} - /> - {t("BPA_COMMON_OTHER_AMT")} - {setOtherChargesVal(e.target.value)}} - //disable={userInfo?.info?.emailId && !isOpenLinkFlow ? true : false} - //disable={editScreen} - {...{ required: true, pattern: /^[0-9]*$/ }} - /> - {parseInt(otherCharges)>0? - ( -
- {t("BPA_COMMON_OTHER_AMT_DISCRIPTION")} -