Skip to content

Commit

Permalink
Merge pull request #1305 from ShivankShuklaa/Dev-2.0
Browse files Browse the repository at this point in the history
Architect and Citizen Undertaking OTP Verified Time issue Resolved as well as latitude and Longitude Null Issue Resolved
  • Loading branch information
sriranjan-s authored Aug 30, 2024
2 parents 5f8bc7a + 40f00dc commit 74e567c
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,47 +205,6 @@ const SelectDocument = React.memo(function MyComponent({
e && setfileArray([...fileArray,e.file]);
}

// function getData(e) {
// let key = selectedDocument.code;
// let data,newArr;
// if (e?.length > 0) {
// data = Object.fromEntries(e);
// newArr = Object.values(data);
// newArr = formData?.documents?.documents?.filter((ob) => ob.documentType === selectedDocument.code);
// setnewArray(newArr);
// // const filteredDocumentsByFileStoreId = documents?.filter((item) => item?.fileStoreId !== uploadedFile.fileStoreId) || []
// let newfiles = [];
// e?.map((doc, index) => {
// newfiles.push({
// documentType: selectedDocument?.code,
// additionalDetails:{category:selectedDocument?.code/*.split(".").slice(0,2).join('_')*/},
// fileStoreId: doc?.[1]?.fileStoreId?.fileStoreId,
// documentUid: doc?.[1].fileStoreId?.fileStoreId,
// fileName: doc?.[0] || "",
// id:documents? documents.find(x => x.documentType === selectedDocument?.code)?.id:undefined,
// })
// })
// const __documents = [
// ...documents.filter(e => e.documentType !== key ),
// ...newfiles,
// ]
// setDocuments(__documents)
// }else if(e?.length==0){
// const __documents = [
// ...documents.filter(e => e.documentType !== key ),
// ]
// setDocuments(__documents);
// }

// newArr?.map((ob) => {
// if(!ob?.file){
// ob.file = {}
// }
// ob.file.documentType = key;
// selectfile(ob,key);
// })
// }

function getData(e) {
let key = selectedDocument.code;
let data, newArr;
Expand All @@ -258,8 +217,14 @@ const SelectDocument = React.memo(function MyComponent({
setLatitude(location.latitude);
setLongitude(location.longitude);
{if (doc?.code === "SITEPHOTOGRAPH.ONE"){
if(location.latitude !==null && location.longitude !==null){
sessionStorage.setItem("Latitude",location.latitude)
sessionStorage.setItem("Longitude",location.longitude)
}
else{
sessionStorage.removeItem("Latitude");
sessionStorage.removeItem("Longitude");
}
}}


Expand Down Expand Up @@ -423,20 +388,19 @@ const SelectDocument = React.memo(function MyComponent({
{doc?.uploadedDocuments?.length && <DocumentsPreview isSendBackFlow={true} documents={doc?.uploadedDocuments} />}

{doc?.code === "SITEPHOTOGRAPH.ONE" && (
(sessionStorage.getItem("Latitude") ? true : false ) ? (
<div>
<p>Latitude: {sessionStorage.getItem("Latitude")}</p>
<p>Longitude: {sessionStorage.getItem("Longitude")}</p>
{setIsNextButtonDisabled(false)} {/* Enable the "Next" button */}
</div>
):
(
<div>
<p style={{ color: 'red' }}>Please upload a Photo with Location details.</p>
{setIsNextButtonDisabled(true)} {/* Disable the "Next" button */}
</div>
)
)}
sessionStorage.getItem("Latitude") && sessionStorage.getItem("Longitude") ? (
<div>
<p>Latitude: {sessionStorage.getItem("Latitude")}</p>
<p>Longitude: {sessionStorage.getItem("Longitude")}</p>
{setIsNextButtonDisabled(false)} {/* Enable the "Next" button */}
</div>
) : (
<div>
<p style={{ color: 'red' }}>Please upload a Photo with Location details.</p>
{setIsNextButtonDisabled(true)} {/* Disable the "Next" button */}
</div>
)
)}

</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@

import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import Modal from 'react-modal';
import jsPDF from 'jspdf';
import { SubmitBar } 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';




Expand Down Expand Up @@ -44,9 +42,24 @@
const architectid = data?.applicationData?.additionalDetails?.architectid
const architecttype = data?.applicationData?.additionalDetails?.typeOfArchitect
const TimeStamp = otpVerifiedTimestamp;

const ulbselection = data?. applicationData?.additionalDetails?.Ulblisttype === "Municipal Corporation" ? "Commissioner" : "Executive Officer"

const updatedAdditionalDetails = {
...data?.applicationData?.additionalDetails,
TimeStamp: otpVerifiedTimestamp,
};

// Update the entire data object with the new additionalDetails
const updatedData = {
...data,
applicationData: {
...data?.applicationData,
additionalDetails: updatedAdditionalDetails,
},
};




const selfdeclarationform =
`
Expand Down Expand Up @@ -120,7 +133,7 @@
try {
setIsUploading(true); // Set isUploading to true before starting the upload

let result = await Digit.PaymentService.generatePdf(Digit.ULBService.getStateId(), { Bpa: [data] }, "ownerconsent");
let result = await Digit.PaymentService.generatePdf(Digit.ULBService.getStateId(), { Bpa: [updatedData] }, "ownerconsent");

if (result?.filestoreIds[0]?.length > 0) {
alert("File Uploaded Successfully");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
2. jsPDF for downloading the PDF
*/
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import Modal from 'react-modal';
import { useLocation } from "react-router-dom";
import { SubmitBar } from '@upyog/digit-ui-react-components';
Expand All @@ -32,7 +32,7 @@
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 [params, setParams] = Digit.Hooks.useSessionStorage("BUILDING_PERMIT", state?.edcrNumber ? { data: { scrutinyNumber: { edcrNumber: state?.edcrNumber } } } : {});
const [isUploading, setIsUploading] = useState(false); // it will check whether the file upload is in process or not
const [isFileUploaded, setIsFileUploaded] = useState(false);
const architectid = params?.additionalDetails?.architectid;
Expand All @@ -49,7 +49,18 @@
const TimeStamp = otpVerifiedTimestamp;



useEffect(() => {
if (params?.additionalDetails && !params.additionalDetails.TimeStamp) {
setParams(prevParams => ({
...prevParams,
additionalDetails: {
...prevParams.additionalDetails,
TimeStamp: otpVerifiedTimestamp
}
}));
}
}, [params, otpVerifiedTimestamp, setParams]);


const selfdeclarationform =
`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,9 +570,13 @@ function selectfile(e) {
<Row className="border-none" label={t(`BPA_BUILDING_STATUS_LABEL`)} text={owners?.buildingStatus?.code || value?.additionalDetails?.buildingStatus || t("CS_NA")} />
<Row className="border-none" label={t(`BPA_CORE_AREA_LABEL`)} text={datafromAPI?.planDetail?.coreArea || value?.additionalDetails?.coreArea || t("CS_NA")} />
<Row className="border-none" label={t(`BPA_PROPOSED_SITE_LABEL`)} text={owners?.proposedSite?.code || value?.additionalDetails?.proposedSite || t("CS_NA")} />
{owners?.schemes?.code === "SCHEME" && (
<React.Fragment>
<Row className="border-none" label={t(`BPA_SCHEME_TYPE_LABEL`)} text={owners?.schemesselection?.value || value?.additionalDetails?.schemesselection || t("CS_NA")} />
<Row className="border-none" label={t(`BPA_SCHEME_NAME_LABEL`)} text={owners?.schemeName || value?.additionalDetails?.schemeName || t("CS_NA")} />
<Row className="border-none" label={t(`BPA_TRANFERRED_SCHEME_LABEL`)} text={owners?.transferredscheme || value?.additionalDetails?.transferredscheme || t("CS_NA")} />
</React.Fragment>
)}
<Row className="border-none" label={t(`BPA_PURCHASED_FAR_LABEL`)} text={owners?.purchasedFAR?.code || value?.additionalDetails?.purchasedFAR || t("CS_NA")} />
<Row className="border-none" label={t(`BPA_MASTER_PLAN_LABEL`)} text={owners?.masterPlan?.code || value?.additionalDetails?.masterPlan || t("CS_NA")} />
<Row className="border-none" label={t(`BPA_GREEN_BUILDING_LABEL`)} text={owners?.greenbuilding?.code || value?.additionalDetails?.greenbuilding || t("CS_NA")} />
Expand Down

0 comments on commit 74e567c

Please sign in to comment.