From 3e517945d675e46c5c9080d526e07e5b48e1487a Mon Sep 17 00:00:00 2001 From: Shivankshuklaa Date: Mon, 13 May 2024 23:07:00 +0530 Subject: [PATCH] Verify Architect and citizen feature added, All the details are added in check page and Acknowledgement form, Automatic fileupload feature is added to upload consent form Automatically --- .../packages/libraries/src/hooks/index.js | 4 +- .../libraries/src/hooks/obps/useUlbType.js | 20 ++ .../libraries/src/services/elements/MDMS.js | 49 ++++ .../core/src/pages/citizen/Home/index.js | 10 +- .../modules/obps/getBPAAcknowledgement.js | 91 +++++- .../packages/modules/obps/package.json | 4 +- .../packages/modules/obps/src/Module.js | 5 +- .../pageComponents/BPANewBuildingdetails.js | 230 ++++++++++++--- .../src/pageComponents/DocumentDetails.js | 3 +- .../obps/src/pageComponents/OwnerDetails.js | 9 +- .../BpaApplicationDetail/CitizenConsent.js | 228 +++++++++++++++ .../citizen/BpaApplicationDetail/index.js | 257 ++++++++++++++++- .../NewBuildingPermit/Architectconcent.js | 261 ++++++++++++++++++ .../citizen/NewBuildingPermit/CheckPage.js | 226 ++++++++++++++- .../citizen/NewBuildingPermit/NewConfig.js | 5 +- .../packages/modules/obps/src/utils/index.js | 136 ++++++--- 16 files changed, 1443 insertions(+), 95 deletions(-) create mode 100644 frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/obps/useUlbType.js create mode 100644 frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/BpaApplicationDetail/CitizenConsent.js create mode 100644 frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/NewBuildingPermit/Architectconcent.js 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 1af85e17d34..e46de900710 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 @@ -181,6 +181,7 @@ import useBusinessServiceData from "./obps/useBusinessServiceData"; import useBPATaxDocuments from "./obps/useBPATaxDocuments"; import useDistricts from "./obps/useDistricts"; import useULBList from "./obps/useULBList"; +import useUlbType from "./obps/useUlbType"; import useEventInbox from "./events/useEventInbox"; @@ -451,7 +452,8 @@ const obps = { useBusinessServiceData, useBPATaxDocuments, useDistricts, - useULBList + useULBList, + useUlbType }; const events = { diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/obps/useUlbType.js b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/obps/useUlbType.js new file mode 100644 index 00000000000..7bc1dc8570e --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/obps/useUlbType.js @@ -0,0 +1,20 @@ +import { useQuery } from "react-query"; +import { MdmsService } from "../../services/elements/MDMS"; + +const useUlbType = (tenantId, moduleCode, type, config = {}) => { + const useULB = () => { + return useQuery("BPA_ULB", () => MdmsService.BPAUlbType(tenantId, moduleCode ,type), config); + }; + + + switch (type) { + case "UlbType": + return useULB(); + default: + return null; + } +}; + + + +export default useUlbType; \ 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 cbd94ace22b..9d232199605 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 @@ -320,6 +320,23 @@ const getulbtype = (tenantId, moduleCode, type) => ({ }, }); +const getulblist = (tenantId, moduleCode, type) => ({ + type, + details: { + tenantId, + moduleDetails: [ + { + moduleName: moduleCode, + masterDetails: [ + { + name: "UlbType", + }, + ], + }, + ], + }, +}); + const getPropertyTypeCriteria = (tenantId, moduleCode, type) => ({ type, details: { @@ -426,6 +443,16 @@ const getulb = (MdmsRes) => { }); //return MdmsRes; }; + +const getulbls = (MdmsRes) => { + return MdmsRes["BPA"].UlbType.filter((UlbType) => UlbType.active).map((ulbtypeDetails) => { + return { + ...ulbtypeDetails, + i18nKey: `BPA_ULB_LIST_${ulbtypeDetails.code}`, + }; + }); + //return MdmsRes; +}; ///////////// const BPADistrict = (MdmsRes) => { @@ -444,6 +471,15 @@ const BPAUlb = (MdmsRes) => { }; }); }; + +const BPAUlbType = (MdmsRes) => { + MdmsRes["BPA"].UlbType.filter((UlbType) => UlbType.active).map((ulbtypelist) => { + return { + ...ulbtypelist, + i18nKey: `BPA_ULB_${ulbtypelist.code}`, + }; + }); +}; ///////////// const getCommonFieldsCriteria = (tenantId, moduleCode, type) => ({ @@ -1611,12 +1647,17 @@ const transformResponse = (type, MdmsRes, moduleCode, tenantId) => { case "Ulb": return getulb(MdmsRes); + case "UlbType": + return getulbls(MdmsRes); case "BPADistrict": return BPADistrict(MdmsRes); case "BPAUlb": return BPAUlb(MdmsRes); + case "BPAUlbType": + return BPAUlbType(MdmsRes); + @@ -1770,6 +1811,9 @@ export const MdmsService = { getulb: (tenantId, moduleCode, type) => { return MdmsService.getDataByCriteria(tenantId, getulbtype(tenantId, moduleCode, type), moduleCode); }, + getulbls: (tenantId, moduleCode, type) => { + return MdmsService.getDataByCriteria(tenantId, getulblist(tenantId, moduleCode, type), moduleCode); + }, getPetType: (tenantId, moduleCode, type) => { @@ -1785,6 +1829,11 @@ export const MdmsService = { BPAUlb: (tenantId, moduleCode, type) => { return MdmsService.getDataByCriteria(tenantId, getulbtype(tenantId, moduleCode, type), moduleCode); }, + /////bpa + BPAUlbType: (tenantId, moduleCode, type) => { + return MdmsService.getDataByCriteria(tenantId, getulblist(tenantId, moduleCode, type), moduleCode); + }, + ////bpa 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/core/src/pages/citizen/Home/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/index.js index 7d4889030a7..8ae3b69908c 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/index.js @@ -83,11 +83,11 @@ const Home = () => { Icon: , onClick: () => history.push(citizenServicesObj?.props?.[2]?.navigationUrl), }, - { - name: t(citizenServicesObj?.props?.[1]?.label), - Icon: , - onClick: () => history.push(citizenServicesObj?.props?.[1]?.navigationUrl), - }, + // { + // name: t(citizenServicesObj?.props?.[1]?.label), + // Icon: , + // onClick: () => history.push(citizenServicesObj?.props?.[1]?.navigationUrl), + // }, // { // name: t("ACTION_TEST_WATER_AND_SEWERAGE"), // Icon: , diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/getBPAAcknowledgement.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/getBPAAcknowledgement.js index 4cd70cf9970..c773bd90af7 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/getBPAAcknowledgement.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/getBPAAcknowledgement.js @@ -41,7 +41,11 @@ const getMohallaLocale = (value = "", tenantId = "") => { }; const capitalize = (text) => text.substr(0, 1).toUpperCase() + text.substr(1); const ulbCamel = (ulb) => ulb.toLowerCase().split(" ").map(capitalize).join(" "); + + const getBPAAcknowledgement=async(application,tenantInfo,t)=>{ + const user = Digit.UserService.getUser(); + const owner=application?.landInfo?.owners return{ @@ -114,7 +118,15 @@ const getMohallaLocale = (value = "", tenantId = "") => { { title: t("BPA_APPLICATION_DEMOLITION_AREA_LABEL"), value: t(`${application?.data?.edcrDetails?.planDetail?.planInformation?.demolitionArea} sq mtrs`) || "NA" - } + }, + { + title: t("BPA_WARD_NUMBER_LABEL"), + value: application?.additionalDetails?.wardnumber || "NA" + }, + { + title: t("BPA_KHASRA_NUMBER_LABEL"), + value: application?.additionalDetails?.khasraNumber || "NA" + } ] }, { @@ -153,6 +165,29 @@ const getMohallaLocale = (value = "", tenantId = "") => { ] }, + { + title: t("BPA_ARCHITECT_DETAILS"), + values: [ + { + title: t("BPA_ARCHITECT_NAME"), + value: user?.info?.name || "NA" + }, + { + title: t("BPA_ARCHITECT_MOBILE_NUMBER"), + value: user?.info?.mobileNumber || "NA" + }, + { + title: t("BPA_ARCHITECT_ID"), + value: application?.additionalDetails?.architectid || "NA" + }, + { + title: t("BPA_ARCHITECT_EMAIL"), + value: user?.info?.emailId || "NA" + }, + + ] + + }, { title : t("BPA_NEW_TRADE_DETAILS_HEADER_DETAILS"), values:[ @@ -178,6 +213,60 @@ const getMohallaLocale = (value = "", tenantId = "") => { } ] }, + { + title: t("BPA_COLONY_DETAILS"), + values: [ + { + title: t("BPA_APPROVED_COLONY"), + value: application?.additionalDetails?.approvedColony || "NA" + }, + { + title: t("BPA_MASTER_PLAN"), + value: application?.additionalDetails?.masterPlan || "NA" + }, + { + title: t("BPA_DISTRICT"), + value: application?.additionalDetails?.District || "NA" + }, + { + title: t("BPA_ULB_NAME"), + value: application?.additionalDetails?.UlbName || "NA" + }, + { + title: t("BPA_BUILDING_STATUS"), + value: application?.additionalDetails?.buildingStatus || "NA" + }, + { + title: t("BPA_SCHEMES"), + value: application?.additionalDetails?.schemes || "NA" + }, + { + title: t("BPA_SCHEMES_TYPE"), + value: application?.additionalDetails?.schemesselection || "NA" + }, + { + title: t("BPA_PURCHASED_FAR"), + value: application?.additionalDetails?.purchasedFAR || "NA" + }, + { + title: t("BPA_GREEN_BUIDINGS"), + value: application?.additionalDetails?.greenbuilding || "NA" + }, + { + title: t("BPA_RESTRICTED_AREA"), + value: application?.additionalDetails?.restrictedArea || "NA" + }, + { + title: t("BPA_PROPOSED_SITE_TYPE"), + value: application?.additionalDetails?.proposedSite || "NA" + }, + { + title: t("BPA_CORE_AREA"), + value: application?.additionalDetails?.coreArea || "NA" + }, + ] + }, + ] 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 d77c540f493..080d345f897 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 @@ -19,12 +19,14 @@ }, "dependencies": { "@upyog/digit-ui-react-components": "1.7.0-beta.4", - "microbundle-crl": "^0.13.11", "exif-js": "^2.3.0", + "jspdf": "^2.5.1", + "microbundle-crl": "^0.13.11", "react": "17.0.2", "react-dom": "17.0.2", "react-hook-form": "6.15.8", "react-i18next": "11.16.2", + "react-modal": "^3.16.1", "react-query": "3.6.1", "react-router-dom": "5.3.0" }, 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 e57933af82f..25ec3233c75 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 @@ -59,6 +59,8 @@ 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"; +import Architectconcent from "./pages/citizen/NewBuildingPermit/Architectconcent"; +import CitizenConsent from "./pages/citizen/BpaApplicationDetail/CitizenConsent"; @@ -165,7 +167,8 @@ const componentsToRegister = { ObpsEdcrInbox : EdcrInbox, ObpsEmpApplicationDetail : EmpApplicationDetail, ObpsEmployeeBpaApplicationDetail : EmployeeBpaApplicationDetail, - + Architectconcent, + CitizenConsent } 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 index 83a930bc2ef..82cabc21265 100644 --- 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 @@ -10,16 +10,24 @@ let validation = {}; const [approvedColony, setapprovedColony] = useState(formData?.owners?.approvedColony || ""); const [masterPlan, setmasterPlan] = useState(formData?.owners?.masterPlan || ""); - const [district, setDistrict] = useState(formData?.owners?.district || ""); + const [UlbName, setUlbName] = useState(formData?.owners?.UlbName || ""); 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 [District, setDistrict] = useState(formData?.owners?.District || ""); const [proposedSite, setproposedSite] = useState(formData?.owners?.proposedSite || ""); const [nameofApprovedcolony, setnameofApprovedcolony] = useState(formData?.owners?.nameofApprovedcolony || ""); const [NocNumber, setNocNumber] = useState(formData?.owners?.NocNumber || ""); + const [coreArea, setcoreArea] = useState(formData?.owners?.coreArea || ""); + const [schemesselection, setschemesselection] = useState(formData?.owners?.schemesselection || ""); + const [schemeName, setschemeName] = useState(formData?.owners?.schemeName || ""); + const [transferredscheme, settransferredscheme] = useState("Pre-Approved Standard Designs" || ""); + const [Ulblisttype, setUlblisttype] = useState(formData?.owners?.Ulblisttype || ""); + + + const approvedcolonyStatus = [ @@ -56,6 +64,17 @@ } ] + const schemesselectiontype = [ + { + code: "SCHEME", + i18nKey: "SCHEME" + }, + { + code: "NON_SCHEME", + i18nKey: "NON SCHEME" + }, + ] + const forschemes = [ { code: "TP_SCHEMES", @@ -85,22 +104,32 @@ const tenantId = Digit.ULBService.getCurrentTenantId(); const stateId = Digit.ULBService.getStateId(); + const { data: ULBLIST } = Digit.Hooks.obps.useUlbType(stateId, "BPA", "UlbType"); + const { data: Menu } = Digit.Hooks.obps.useDistricts(stateId, "BPA", "Districts"); const { data: ULB } = Digit.Hooks.obps.useULBList(stateId, "BPA", "Ulb"); + let ulblists = []; + let menu = []; let ulb = []; + ULBLIST && + ULBLIST.map((ulbtypelist) => { + ulblists.push({ i18nKey: `${ulbtypelist.code}`, code: `${ulbtypelist.code}`, value: `${ulbtypelist.name}` }); + }); + Menu && Menu.map((districts) => { - menu.push({ i18nKey: `BPA_DISTRICTS_${districts.code}`, code: `${districts.code}`, value: `${districts.name}` }); + if(districts.UlbType == Ulblisttype?.code) + menu.push({ i18nKey: `${districts.code}`, code: `${districts.code}`, value: `${districts.name}` }); }); ULB && ULB.map((ulblist) => { - if (ulblist.Districts == district?.code) { + if (ulblist.Districts == UlbName?.code) { ulb.push({ - i18nKey: `BPA_ULB_${ulblist.code}`, + i18nKey: `${ulblist.code}`, code: `${ulblist.code}`, value: `${ulblist.name}` }); @@ -119,8 +148,17 @@ setmasterPlan(e.target.value); } - function setdistrict(e) { - setDistrict(e.target.value); + function setcorearea(e) { + setcoreArea(e.target.value); + } + + + function setulbname(e) { + setUlbName(e.target.value); + } + + function setulblisttype(e) { + setUlblisttype(e.target.value); } function setBuildingStatus(e) { @@ -129,6 +167,10 @@ function setSchemes(e) { setschemes(e.target.value); } + + function setSchemeselection(e) { + setschemesselection(e.target.value); + } function setPurchasedFAR(e) { setpurchasedFAR(e.target.value); } @@ -138,8 +180,8 @@ function setRestrictedArea(e) { setrestrictedArea(e.target.value); } - function setUlbType(e) { - setulbType(e.target.value); + function setdistrict(e) { + setDistrict(e.target.value); } function setProposedSite(e) { setproposedSite(e.target.value); @@ -153,11 +195,19 @@ setNocNumber(e.target.value); } + function setSchemename(e) { + setschemeName(e.target.value); + } + + function TransferredScheme(e){ + settransferredscheme(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 ownerStep = { ...owners, approvedColony, UlbName, Ulblisttype, District, masterPlan, coreArea, buildingStatus, schemes, schemesselection, purchasedFAR, greenbuilding, restrictedArea, proposedSite, nameofApprovedcolony, schemeName, transferredscheme, NocNumber }; let updatedFormData = { ...formData }; // Check if owners array exists in formData if not , then it will add it @@ -189,6 +239,7 @@ name="nameofApprovedcolony" value={nameofApprovedcolony} onChange={setNameapprovedcolony} + style={{ width: "86%" }} ValidationRequired={false} {...(validation = { isRequired: true, @@ -211,6 +262,7 @@ name="NocNumber" value={NocNumber} onChange={setnocNumber} + style={{ width: "86%" }} ValidationRequired={false} {...(validation = { isRequired: true, @@ -225,6 +277,78 @@ default: return null; } + } + + const renderschemedropdown = () => { + switch (schemes?.code) { + case "SCHEME": + return ( + <> + {`${t("BPA_SCHEMES_TYPE")}`} + ( + + )} + /> + + {`${t("BPA_SCHEME_NAME")}`} + + + {`${t("BPA_TRANSFERRED_SCHEME")}`} + + + + ); + case "NON_SCHEME": + return null; + + default: + return null; + } + }; @@ -233,7 +357,7 @@
{`${t("BPA_APPROVED_COLONY")}`} @@ -241,7 +365,7 @@ control={control} name={"approvedColony"} defaultValue={approvedColony} - rules={{ required: t("CORE_COMMON_REQUIRED_ERRMSG") }} + rules={{ required: t("CORE_COMMON_REQUIRED_ERRMSG")}} render={(props) => ( ( - {`${t("BPA_DISTRICT")}`} + {`${t("BPA_CORE_AREA")}`} ( + + )} + + /> + + {`${t("BPA_ULB_TYPE")}`} + ( + + )} + /> + + {`${t("BPA_ULB_NAME")}`} + ( + - {`${t("BPA_ULB_TYPE")}`} + {`${t("BPA_DISTRICT")}`} ( ( ( )} /> + {renderschemedropdown()} + {`${t("BPA_PURCHASED_FAR")}`} ( ( ( ( - {bpaTaxDocuments?.map((document, index) => { + {/* {bpaTaxDocuments?.map((document, index) => { */} + {bpaTaxDocuments?.filter(document => document.code !== "ARCHITECT.UNDERTAKING" && document.code !== "CITIZEN.UNDERTAKING").map((document, index) => { return (
{ 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?.UlbName?.code) payload.additionalDetails.UlbName = formData?.owners?.UlbName?.code; + if (formData?.owners?.District?.code) payload.additionalDetails.District = formData?.owners?.District?.code; if (formData?.owners?.nameofApprovedcolony) payload.additionalDetails.nameofApprovedcolony = formData?.owners?.nameofApprovedcolony; if (formData?.owners?.NocNumber) payload.additionalDetails.NocNumber = formData?.owners?.NocNumber; + if (formData?.owners?.coreArea?.code) payload.additionalDetails.coreArea = formData?.owners?.coreArea?.code; + if (formData?.owners?.schemesselection?.i18nKey) payload.additionalDetails.schemesselection = formData?.owners?.schemesselection?.i18nKey; + if (formData?.owners?.schemeName) payload.additionalDetails.schemeName = formData?.owners?.schemeName; + if (formData?.owners?.transferredscheme) payload.additionalDetails.transferredscheme = formData?.owners?.transferredscheme; + if (formData?.owners?.Ulblisttype?.code) payload.additionalDetails.Ulblisttype = formData?.owners?.Ulblisttype?.code; //For LandInfo diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/BpaApplicationDetail/CitizenConsent.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/BpaApplicationDetail/CitizenConsent.js new file mode 100644 index 00000000000..0c3bfbb6612 --- /dev/null +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/BpaApplicationDetail/CitizenConsent.js @@ -0,0 +1,228 @@ + + import React, { useState } from 'react'; + import Modal from 'react-modal'; + import jsPDF from 'jspdf'; + import { useLocation } from "react-router-dom"; + import { SubmitBar, CitizenConsentForm } from '@upyog/digit-ui-react-components'; + import { useTranslation } from "react-i18next"; + import { useParams } from "react-router-dom"; + import Axios from "axios"; + import Urls from '../../../../../../libraries/src/services/atoms/urls'; + + + + const CitizenConsent = ({ showTermsPopup, setShowTermsPopup, otpVerifiedTimestamp }) => { + + const [isModalOpen, setIsModalOpen] = useState(false); + + const { t } = useTranslation(); + const user = Digit.UserService.getUser(); + const ownername = user?.info?.name; + const ownermobileNumber = user?.info.mobileNumber + const ownerEmail = user?.info?.emailId + const { id } = useParams(); + const tenantId = Digit.ULBService.getCurrentTenantId(); + const { data } = Digit.Hooks.obps.useBPADetailsPage(tenantId, { applicationNo: id }); + let workflowDetails = Digit.Hooks.useWorkflowDetails({ + tenantId: data?.applicationData?.tenantId, + id: id, + moduleCode: "OBPS", + config: { + enabled: !!data + } + }); + const architectname = workflowDetails?.data?.timeline?.[0]?.assigner?.name + const mobileNumber = workflowDetails?.data?.timeline?.[0]?.assigner?.mobileNumber + const khasranumber = data?.applicationData?.additionalDetails?.khasraNumber; + const ulbname = data?.applicationData?.additionalDetails?.UlbName; + const district = data?.applicationData?.additionalDetails?.District; + const ward = data?.applicationData?.additionalDetails?.wardnumber; + const area = data?.applicationData?.additionalDetails?.area; + const applicationnumber = data?.applicationNo + const architectid = data?.applicationData?.additionalDetails?.architectid + const architecttype = data?.applicationData?.additionalDetails?.typeOfArchitect + const TimeStamp = otpVerifiedTimestamp; + const selfdeclarationform = + ` + To: + + Executive Officer, + ${ulbname} + ${district} + + Dear Sir or Madam, + + I/We, Shri/Smt/Kum. ${ownername} under signed owner of land bearing Kh. No. ${khasranumber} of ULB ${ulbname} + Area ${area} (Sq.mts.), ward number ${ward}, City ${district} + + I/We hereby declare that the Architect name ${architectname} (${architecttype}) Architect ID - ${architectid} is + appointed by me/us and is authorized to make representation/application with regard to aforesaid + construction to any of the authorities. + + I/We further declare that I am/We are aware of all the action taken or representation made by the + ${architecttype} authorized by me/us. + + i) That I am/We are sole owner of the site. + + ii) There is no dispute regarding the site and if any dispute arises then I shall be solely + responsible for the same. + + iii) That construction of the building will be undertaken as per the approved building plans + and structural design given by the Structural Engineer. + + That above stated facts are true and the requisite documents have been uploaded with this + E-Naksha plan and nothing has been concealed thereof. + + + Name of Owner - ${ownername} + Mobile Number - ${ownermobileNumber} + Application Number - ${applicationnumber} + Email Id - ${ownerEmail} + Signature - Verified By OTP at ${TimeStamp} + `; + + const openModal = () => { + setIsModalOpen(true); + }; + + const closeModal = () => { + setShowTermsPopup(false); + }; + + + const uploadSelfDeclaration = async () => { + try { + const doc = new jsPDF(); + const leftMargin = 15; + const topMargin = 10; + const lineSpacing = 5; + const pageWidth = doc.internal.pageSize.getWidth(); + const maxLineWidth = pageWidth - 2 * leftMargin; + + let currentY = topMargin; + + doc.setFont("Times-Roman"); + doc.setFontSize(12); + + // Split and write text into the PDF + const lines = selfdeclarationform.split("\n"); + lines.forEach((line) => { + const wrappedLines = doc.splitTextToSize(line, maxLineWidth); + wrappedLines.forEach((wrappedLine) => { + if (currentY + lineSpacing > doc.internal.pageSize.getHeight() - topMargin) { + doc.addPage(); + currentY = topMargin; + } + doc.text(leftMargin, currentY, wrappedLine); + currentY += lineSpacing; + }); + }); + + // Convert the PDF to a Blob + const pdfBlob = doc.output("blob", "declaration.pdf"); + + // Prepare FormData for the upload + const formData = new FormData(); + formData.append("file", pdfBlob, "declaration.pdf"); + formData.append("tenantId", "pg"); + formData.append("module", "BPA"); + + + const response = await Axios({ + method: "post", + url: `${Urls.FileStore}`, + data: formData, + headers: { "auth-token": Digit.UserService.getUser()?.access_token }, + }); + + if (response?.data?.files?.length > 0) { + alert("File Uploaded Successfully"); + sessionStorage.setItem("CitizenConsentdocFilestoreid",response?.data?.files[0]?.fileStoreId); + } else { + alert("File Upload Failed"); + } + } catch (error) { + alert("Error Uploading PDF:", error); // Error handling + } +}; + + + + const modalStyles = { + modal: { + width: "100%", + height: "100%", + top: "0", + position: "relative", + backgroundColor: 'rgba(0, 0, 0, 0.7)', + display: 'flex', + justifyContent: 'center', + alignItems: 'center', + + }, + modalOverlay: { + position: 'fixed', + top: '0', + left: '0', + width: '100%', + height: '100%', + backgroundColor: 'rgba(0, 0, 0, 0.7)' + }, + modalContent: { + backgroundColor: '#FFFFFF', + padding: '2rem', + borderRadius: '0.5rem', + maxWidth: '800px', + margin: 'auto', + fontFamily: 'Roboto, serif', + overflowX: 'hidden', + textAlign: 'justify', + boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)', + maxHeight: '80vh', + overflowY: 'auto', + }, + heading: { + textAlign: 'center', + fontWeight: 'bold', + marginBottom: '10px', + + }, + subheading: { + textAlign: 'center', + fontWeight: 'bold', + marginBottom: '20px', + + }, + }; + + return ( +
+ +
+

DECLARATION UNDER SELF-CERTIFICATION SCHEME

+

(By OWNER)

+
{selfdeclarationform}
+ + +
+ +

+

+ +
+
+
+
+ ); + }; + + export default CitizenConsent; \ No newline at end of file diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/BpaApplicationDetail/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/BpaApplicationDetail/index.js index 631ebd213e4..edb1e8a016a 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/BpaApplicationDetail/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/BpaApplicationDetail/index.js @@ -1,4 +1,4 @@ -import { CardHeader, Header, Toast, Card, StatusTable, Row, Loader, Menu, PDFSvg, SubmitBar, LinkButton, ActionBar, CheckBox, MultiLink, CardText, CardSubHeader } from "@upyog/digit-ui-react-components"; +import { CardHeader, TextInput, Header, Toast, Card, StatusTable, Row, Loader, Menu, PDFSvg, SubmitBar, LinkButton, ActionBar, CheckBox, MultiLink, CardText, CardSubHeader, CardLabel } from "@upyog/digit-ui-react-components"; import React, { Fragment, useEffect, useState } from "react"; import { useParams, useHistory } from "react-router-dom"; import { useQueryClient } from "react-query"; @@ -14,6 +14,7 @@ import cloneDeep from "lodash/cloneDeep"; import DocumentsPreview from "../../../../../templates/ApplicationDetails/components/DocumentsPreview"; import ScruntinyDetails from "../../../../../templates/ApplicationDetails/components/ScruntinyDetails"; import { Link } from "react-router-dom"; +import CitizenConsent from "./CitizenConsent"; const BpaApplicationDetail = () => { const { id } = useParams(); @@ -36,12 +37,18 @@ const BpaApplicationDetail = () => { sessionStorage.setItem("isEDCRDisable", JSON.stringify(true)); sessionStorage.setItem("BPA_IS_ALREADY_WENT_OFF_DETAILS", JSON.stringify(false)); + const user = Digit.UserService.getUser(); + + const citizenmobilenumber = user?.info?.mobileNumber + + const history = useHistory(); sessionStorage.setItem("bpaApplicationDetails", false); let isFromSendBack = false; const { data: stakeHolderDetails, isLoading: stakeHolderDetailsLoading } = Digit.Hooks.obps.useMDMS(stateCode, "StakeholderRegistraition", "TradeTypetoRoleMapping"); const { isLoading: bpaDocsLoading, data: bpaDocs } = Digit.Hooks.obps.useMDMS(stateCode, "BPA", ["DocTypeMapping"]); const { data, isLoading } = Digit.Hooks.obps.useBPADetailsPage(tenantId, { applicationNo: id }); + console.log("datata",data); const { isMdmsLoading, data: mdmsData } = Digit.Hooks.obps.useMDMS(tenantId.split(".")[0], "BPA", ["RiskTypeComputation"]); const mutation = Digit.Hooks.obps.useObpsAPI(data?.applicationData?.tenantId, false); let workflowDetails = Digit.Hooks.useWorkflowDetails({ @@ -53,6 +60,101 @@ const BpaApplicationDetail = () => { } }); + const [agree, setAgree] = useState(false); + const setdeclarationhandler = () => { + setAgree(!agree); + }; + + const [showTermsPopup, setShowTermsPopup] = useState(false); + const [showMobileInput, setShowMobileInput] = useState(false); + const [mobileNumber, setMobileNumber] = useState(citizenmobilenumber || ""); + 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); + } + } catch (error) { + console.error("Error sending OTP:", error); + } + }; + + + + 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("BPA_OTP_VERIFIED")); + setOTPVerifiedTimestamp(new Date()); + } else { + setIsOTPVerified(false); + setOTPError(t("BPA_WRONG_OTP")); + } + } catch (error) { + console.error("Error verifying OTP:", error); + setIsOTPVerified(false); + setOTPError(t("BPA_OTP_VERIFICATION_ERROR")); + } + }; + + const isValidMobileNumber = mobileNumber.length === 10 && /^[0-9]+$/.test(mobileNumber); + + let businessService = []; if(data && data?.applicationData?.businessService === "BPA_LOW") @@ -87,6 +189,7 @@ const BpaApplicationDetail = () => { } return obj; }) + data.applicationDetails = [...newApplicationDetails]; } } @@ -201,15 +304,64 @@ const BpaApplicationDetail = () => { else return false; } + const Citizenconsentform = sessionStorage.getItem("CitizenConsentdocFilestoreid"); + console.log("Citizenconsentform",Citizenconsentform); + + // const submitAction = (workflow) => { + // setIsEnableLoader(true); + // mutation.mutate( + // { BPA: { ...data?.applicationData, workflow } }, + // { + // onError: (error, variables) => { + // setIsEnableLoader(false); + // setShowModal(false); + // setShowToast({ key: "error", action: error?.response?.data?.Errors[0]?.message ? error?.response?.data?.Errors[0]?.message : error }); + // setTimeout(closeToast, 5000); + // }, + // onSuccess: (data, variables) => { + // setIsEnableLoader(false); + // history.replace(`/digit-ui/citizen/obps/response`, { data: data }); + // setShowModal(false); + // setShowToast({ key: "success", action: selectedAction }); + // setTimeout(closeToast, 5000); + // queryClient.invalidateQueries("BPA_DETAILS_PAGE"); + // queryClient.invalidateQueries("workFlowDetails"); + // }, + // } + // ); + // } + const submitAction = (workflow) => { setIsEnableLoader(true); + + // Create a new array with the existing documents and the new Citizenconsentform + const updatedDocuments = [ + ...data?.applicationData?.documents, + { + documentType: "CITIZEN.UNDERTAKING", + fileStoreId: sessionStorage.getItem("CitizenConsentdocFilestoreid"), + fileStore: sessionStorage.getItem("CitizenConsentdocFilestoreid"), + }, + ]; + + // Update the applicationData object with the new documents array + const updatedApplicationData = { + ...data?.applicationData, + documents: updatedDocuments, + }; + mutation.mutate( - { BPA: { ...data?.applicationData, workflow } }, + { BPA: { ...updatedApplicationData, workflow } }, { onError: (error, variables) => { setIsEnableLoader(false); setShowModal(false); - setShowToast({ key: "error", action: error?.response?.data?.Errors[0]?.message ? error?.response?.data?.Errors[0]?.message : error }); + setShowToast({ + key: "error", + action: error?.response?.data?.Errors[0]?.message + ? error?.response?.data?.Errors[0]?.message + : error, + }); setTimeout(closeToast, 5000); }, onSuccess: (data, variables) => { @@ -223,7 +375,7 @@ const BpaApplicationDetail = () => { }, } ); - } + }; if (workflowDetails?.data?.nextActions?.length > 0 && data?.applicationData?.status == "CITIZEN_APPROVAL_INPROCESS") { const userInfo = Digit.UserService.getUser(); @@ -406,7 +558,8 @@ const BpaApplicationDetail = () => { if (results?.length > 0) { data.applicationDetails = results; } - + + return ( @@ -423,7 +576,12 @@ const BpaApplicationDetail = () => { />}
+ + + + {data?.applicationDetails?.filter((ob) => Object.keys(ob).length > 0).map((detail, index, arr) => { + return (
@@ -482,6 +640,11 @@ const BpaApplicationDetail = () => {
)} + + + + + {/* to get FieldInspection values */} {(detail?.isFieldInspection && data?.applicationData?.additionalDetails?.fieldinspection_pending?.length > 0) ? : null} @@ -521,6 +684,8 @@ const BpaApplicationDetail = () => {
: null } + + {/* to get Timeline values */} {index === arr.length - 1 && ( @@ -550,7 +715,7 @@ const BpaApplicationDetail = () => { onSelect={onActionSelect} /> ) : null} - setDisplayMenu(!displayMenu)} /> + setDisplayMenu(!displayMenu)} /> )} @@ -576,6 +741,86 @@ const BpaApplicationDetail = () => { ) })} + + + + + + + {user?.info?.type==="CITIZEN" && ( + +
+ + +
+ {t("CITIZEN_SHOULD_VERIFY_HIMSELF_BY_CLICKING_BELOW_BUTTON")} + +

+ {showMobileInput && ( + +

+ {t("BPA_MOBILE_NUMBER")} + + + +
+ )} + {showOTPInput && ( + +

+ {t('BPA_OTP')} + + + + {otpError && {otpError}} +
+ )} +
+

+ + +
+ + + {showTermsPopup && ( + + )} +
+ +
+
+
+ + + )} + {showTermsModal ? ( { + + const [isModalOpen, setIsModalOpen] = useState(false); + const { state } = useLocation(); + const { t } = useTranslation(); + const user = Digit.UserService.getUser(); + const architecname = user?.info?.name; + const architectmobileNumber = user?.info.mobileNumber + const [params] = Digit.Hooks.useSessionStorage("BUILDING_PERMIT", state?.edcrNumber ? { data: { scrutinyNumber: { edcrNumber: state?.edcrNumber } } } : {}); + + + const architectid = params?.additionalDetails?.architectid; + const ownername = params?.owners?.owners?.[0]?.name; + const architecttype = params?.additionalDetails?.typeOfArchitect; + const khasranumber = params?.additionalDetails?.khasraNumber; + const ulbname = params?.additionalDetails?.District; + const district = params?.additionalDetails?.UlbName; + const ward = params?.additionalDetails?.wardnumber; + const area = params?.additionalDetails?.area; + const zone = params?.additionalDetails?.zonenumber; + const ulbgrade = params?.address?.city?.city?.ulbGrade + const TimeStamp = otpVerifiedTimestamp; + + + + + const selfdeclarationform = + ` + To: + + ${ulbgrade} + ULB ${ulbname} + District ${district} + + Dear Sir or Madam, + + I, under signed Shri/Smt/Kum ${architecname} (${architecttype}) having Registration No. ${architectid} is + appointed by the ${ownername} for the development on land bearing Kh. No ${khasranumber} of ${ulbname}, + Area ${area} (Sq.mts). + + This site falls in ward number ${ward} zone number ${zone} in the Master plan of ${district} and + the proposed Residential/Commercial/Industrial construction is permissible in this area. + + I am currently registered as ${architecttype} with the Competent Authority and empanelled + under Self-Certification Scheme. + + I hereby certify that I/we have appointed by the owner to prepare the plans, sections and details, + structural details as required under the Punjab Municipal Building Byelaws for the above mentioned + project. + + That the drawings prepared and uploaded along with other necessary documents on this + UPYOG Platform are as per the provisions of Punjab Municipal Building Byelaws and this building + plan has been applied under Self-Certification Scheme. + + I certify that: + + That I am fully conversant with the provisions of the Punjab Municipal Building Byelaws and other + applicable instructions/ regulations, which are in force and I undertake to fulfill the same. + + That plans have been prepared within the framework of provisions of the Master Plan and + applicable Building Bye Laws / Regulations. + + That site does not falls in any prohibited area/ government land/ encroachment or any other land + restricted for building construction or in any unauthorized colony. + + That plan is in conformity to structural safety norms. + + That I have seen the originals of all the documents uploaded and Nothing is concealed thereof. + + That all the requisite documents/NOC required to be uploaded have been uploaded on E-Naksha + portal along with plan. + + That above stated facts are true and all the requisite documents uploaded with this E-Naksha plan + have been signed by the owner/owners in my presence. + + Architect Name - ${architecname} (${architecttype}) + Architect Id - ${architectid} + Mobile Number - ${architectmobileNumber} + Signature - Verified By OTP at ${TimeStamp} + `; + + const openModal = () => { + setIsModalOpen(true); + }; + + const closeModal = () => { + setShowTermsPopup(false); + }; + + + + + const uploadSelfDeclaration = async () => { + try { + const doc = new jsPDF(); + const leftMargin = 15; + const topMargin = 10; + const lineSpacing = 5; + const pageWidth = doc.internal.pageSize.getWidth(); + const maxLineWidth = pageWidth - 2 * leftMargin; + + let currentY = topMargin; + + doc.setFont("Times-Roman"); + doc.setFontSize(12); + + // Split and write text into the PDF + const lines = selfdeclarationform.split("\n"); + lines.forEach((line) => { + const wrappedLines = doc.splitTextToSize(line, maxLineWidth); + wrappedLines.forEach((wrappedLine) => { + if (currentY + lineSpacing > doc.internal.pageSize.getHeight() - topMargin) { + doc.addPage(); + currentY = topMargin; + } + doc.text(leftMargin, currentY, wrappedLine); + currentY += lineSpacing; + }); + }); + + // Convert the PDF to a Blob + const pdfBlob = doc.output("blob", "declaration.pdf"); + + // Prepare FormData for the upload + const formData = new FormData(); + formData.append("file", pdfBlob, "declaration.pdf"); + formData.append("tenantId", "pg"); + formData.append("module", "BPA"); + + + const response = await Axios({ + method: "post", + url: `${Urls.FileStore}`, + data: formData, + headers: { "auth-token": Digit.UserService.getUser()?.access_token }, + }); + + if (response?.data?.files?.length > 0) { + alert("File Uploaded Successfully"); + sessionStorage.setItem("ArchitectConsentdocFilestoreid",response?.data?.files[0]?.fileStoreId); + } else { + alert("File Upload Failed"); + } + } catch (error) { + alert("Error Uploading PDF:", error); // Error handling + } +}; + + + + + + + + const modalStyles = { + modal: { + width: "100%", + height: "100%", + top: "0", + position: "relative", + backgroundColor: 'rgba(0, 0, 0, 0.7)', + display: 'flex', + justifyContent: 'center', + alignItems: 'center', + + }, + modalOverlay: { + position: 'fixed', + top: '0', + left: '0', + width: '100%', + height: '100%', + backgroundColor: 'rgba(0, 0, 0, 0.7)' + }, + modalContent: { + backgroundColor: '#FFFFFF', + padding: '2rem', + borderRadius: '0.5rem', + maxWidth: '800px', + margin: 'auto', + fontFamily: 'Roboto, serif', + overflowX: 'hidden', + textAlign: 'justify', + boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)', + maxHeight: '80vh', + overflowY: 'auto', + }, + heading: { + textAlign: 'center', + fontWeight: 'bold', + marginBottom: '10px', + + }, + subheading: { + textAlign: 'center', + fontWeight: 'bold', + marginBottom: '20px', + + }, + }; + + return ( +
+ +
+

DECLARATION UNDER SELF-CERTIFICATION SCHEME

+

(For proposed Construction)

+

(By Architect/ Civil Engineer/ Building Designer and Supervisor)

+
{selfdeclarationform}
+ + +
+ +

+

+ +
+
+
+
+ ); + }; + + export default Architectconcent; \ No newline at end of file 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 c329504f9cc..04cb6b8f190 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,5 +1,5 @@ import { - Card, CardHeader, CardSubHeader, CardText,TextInput,CardLabel, + Card, CardHeader, CardSubHeader, CardText,TextInput,CardLabel,CheckBox, LabelFieldPair, UploadFile, CitizenInfoLabel, Header, LinkButton, Row, StatusTable, SubmitBar, Table, CardSectionHeader, EditIcon, PDFSvg, Loader } from "@upyog/digit-ui-react-components"; import React,{ useEffect, useMemo, useState } from "react"; @@ -8,6 +8,7 @@ import { 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() @@ -20,8 +21,10 @@ import { const { t } = useTranslation(); const history = useHistory(); const match = useRouteMatch(); - let user = Digit.UserService.getUser(); + 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"]); let BusinessService; @@ -30,8 +33,128 @@ import { 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 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 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("BPA_OTP_VERIFIED")); + setOTPVerifiedTimestamp(new Date()); + } else { + setIsOTPVerified(false); + setOTPError(t("BPA_WRONG_OTP")); + } + } catch (error) { + console.error("Error verifying OTP:", error); + alert("OTP Verification Error ") + setIsOTPVerified(false); + setOTPError(t("BPA_OTP_VERIFICATION_ERROR")); + } + }; + + const isValidMobileNumber = mobileNumber.length === 10 && /^[0-9]+$/.test(mobileNumber); + + + + + useEffect(()=>{ if(isEditApplication){ setDevelopment(value?.additionalDetails?.selfCertificationCharges?.BPA_DEVELOPMENT_CHARGES); @@ -172,6 +295,8 @@ setWaterCharges(Malbafees/2) location.href=jumpTo; } + + function getBlockSubOccupancy(index){ let subOccupancyString = ""; let returnValueArray = []; @@ -259,6 +384,10 @@ setWaterCharges(Malbafees/2) + + + +
@@ -355,6 +484,31 @@ setWaterCharges(Malbafees/2) ))} + + + + + {t("BPA_ADDITIONAL_BUILDING_DETAILS")} + + + + + + + + + + + + + + + + + + + + {t("BPA_DOCUMENT_DETAILS_LABEL")} @@ -423,7 +577,7 @@ setWaterCharges(Malbafees/2) //disable={editScreen} {...{ required: true, pattern: "^[0-9]*$" }} /> - {t("BPA_COMMON_OTHER_AMT")} + {t("BPA_COMMON_OTHER_AMT")} - {t("BPA_COMMON_LESS_AMT")} + {t("BPA_COMMON_LESS_AMT")} +

+ + {value?.status==="INITIATED" && ( +
+ {t("ARCHITECT_SHOULD_VERIFY_HIMSELF_BY_CLICKING_BELOW_BUTTON")} + +

+ {showMobileInput && ( + +

+ {t("BPA_MOBILE_NUMBER")} + + + +
+ )} + {showOTPInput && ( + +

+ {t('BPA_OTP')} + + + + {otpError && {otpError}} +
+ )} +
)} +

+
+ + + {showTermsPopup && ( + + )} +

{/* {t("BPA_COMMON_TOTAL_AMT")} ₹ {paymentDetails?.Bill?.[0]?.billDetails[0]?.amount || "0"} */} - +
); diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/NewBuildingPermit/NewConfig.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/NewBuildingPermit/NewConfig.js index e6e43438348..0f06fd69df6 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/NewBuildingPermit/NewConfig.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pages/citizen/NewBuildingPermit/NewConfig.js @@ -76,7 +76,7 @@ export const newConfig1=[ { "label": "BPA_ARCHITECT_ID", "type": "text", - "validation": {}, + "validation": {"required": true}, "name": "architectid" }, { @@ -216,8 +216,7 @@ export const newConfig1=[ "nextStep": "owner-details", "key": "owners", "texts": { - "headerCaption": "BPA_ADDITIONAL_BUILDING_DETAILS", - "header": "BPA_APPLICANT_DETAILS_HEADER", + "header": "BPA_ADDITIONAL_BUILDING_DETAILS", "submitBarLabel": "CS_COMMON_NEXT" } }, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/utils/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/utils/index.js index a9f352e63ce..820858f38e7 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/utils/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/utils/index.js @@ -166,50 +166,107 @@ export const getBPAFormData = async (data, mdmsData, history, t) => { } }; +// export const getDocumentforBPA = (docs, PrevStateDocs) => { +// let document = []; +// docs && +// docs.map((ob) => { +// console.log("ob",ob); +// if (ob.id) { +// let docObject = { +// documentType: ob.documentType, +// fileStoreId: ob.fileStoreId, +// fileStore: ob.fileStoreId, +// fileName: "", +// fileUrl: "", +// additionalDetails: {}, +// id: ob.id, +// }; + +// if (ob.documentType === "SITEPHOTOGRAPH.ONE") { +// docObject.additionalDetails = { +// latitude: ob?.additionalDetails?.latitude, +// longitude: ob?.additionalDetails?.longitude, +// }; +// } + +// document.push(docObject); +// } else { +// let docObject = { +// documentType: ob.documentType, +// fileStoreId: ob.fileStoreId, +// fileStore: ob.fileStoreId, +// fileName: "", +// fileUrl: "", +// additionalDetails: {}, +// }; + +// if (ob.documentType === "SITEPHOTOGRAPH.ONE") { +// docObject.additionalDetails = { +// latitude: ob?.additionalDetails?.latitude, +// longitude: ob?.additionalDetails?.longitude, +// }; +// } + +// document.push(docObject); +// } +// }); +// document = [...document, ...(PrevStateDocs ? PrevStateDocs : [])]; +// return document; +// }; export const getDocumentforBPA = (docs, PrevStateDocs) => { let document = []; + + const architectConsentForm = { + documentType: "ARCHITECT.UNDERTAKING", + fileStoreId: sessionStorage.getItem("ArchitectConsentdocFilestoreid"), + fileStore: sessionStorage.getItem("ArchitectConsentdocFilestoreid"), + }; + docs && - docs.map((ob) => { - console.log("ob",ob); - if (ob.id) { - let docObject = { - documentType: ob.documentType, - fileStoreId: ob.fileStoreId, - fileStore: ob.fileStoreId, - fileName: "", - fileUrl: "", - additionalDetails: {}, - id: ob.id, - }; - - if (ob.documentType === "SITEPHOTOGRAPH.ONE") { - docObject.additionalDetails = { - latitude: ob?.additionalDetails?.latitude, - longitude: ob?.additionalDetails?.longitude, + docs.map((ob) => { + console.log("ob", ob); + let docObject; + + if (ob.id) { + docObject = { + documentType: ob.documentType, + fileStoreId: ob.fileStoreId, + fileStore: ob.fileStoreId, + fileName: "", + fileUrl: "", + additionalDetails: {}, + id: ob.id, }; - } - - document.push(docObject); - } else { - let docObject = { - documentType: ob.documentType, - fileStoreId: ob.fileStoreId, - fileStore: ob.fileStoreId, - fileName: "", - fileUrl: "", - additionalDetails: {}, - }; - - if (ob.documentType === "SITEPHOTOGRAPH.ONE") { - docObject.additionalDetails = { - latitude: ob?.additionalDetails?.latitude, - longitude: ob?.additionalDetails?.longitude, + + if (ob.documentType === "SITEPHOTOGRAPH.ONE") { + docObject.additionalDetails = { + latitude: ob?.additionalDetails?.latitude, + longitude: ob?.additionalDetails?.longitude, + }; + } + } else { + docObject = { + documentType: ob.documentType, + fileStoreId: ob.fileStoreId, + fileStore: ob.fileStoreId, + fileName: "", + fileUrl: "", + additionalDetails: {}, }; + + if (ob.documentType === "SITEPHOTOGRAPH.ONE") { + docObject.additionalDetails = { + latitude: ob?.additionalDetails?.latitude, + longitude: ob?.additionalDetails?.longitude, + }; + } } - + document.push(docObject); - } - }); + }); + + document.push(architectConsentForm); + document = [...document, ...(PrevStateDocs ? PrevStateDocs : [])]; return document; }; @@ -440,6 +497,11 @@ export const convertToBPAObject = (data, isOCBPA = false, isSendBackTOCitizen = holdingNo: data?.data?.holdingNumber ? data?.data?.holdingNumber : data?.additionalDetails?.holdingNo, boundaryWallLength:data?.data?.boundaryWallLength ? data?.data?.boundaryWallLength : data?.additionalDetails?.boundaryWallLength , registrationDetails: data?.data?.registrationDetails ? data?.data?.registrationDetails : data?.additionalDetails?.registrationDetails, + architectconsentdocument: { + "documentType": "Architect Consent Form", + "fileStoreId": sessionStorage.getItem("ArchitectConsentform"), + "fileStore": sessionStorage.getItem("ArchitectConsentform"), + } }, applicationType: "BUILDING_PLAN_SCRUTINY", serviceType: "NEW_CONSTRUCTION",