diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pageComponents/DocumentDetails.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pageComponents/DocumentDetails.js index 842624a2c89..507af4ef988 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pageComponents/DocumentDetails.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/obps/src/pageComponents/DocumentDetails.js @@ -51,10 +51,7 @@ const DocumentDetails = ({ t, config, onSelect, userType, formData, setError: se const {data: bpaTaxDocuments, isLoading} = Digit.Hooks.obps.useBPATaxDocuments(stateId, formData, beforeUploadDocuments || []); const handleSaveAsDraft = () => { - // Clone formData to avoid directly modifying the original object let updatedFormData = { ...formData }; - - // Nest the documentStep (i.e., documents array) inside formData.documents updatedFormData.documents = { ...formData.documents, documents }; // Construct the BPA object using only the required fields @@ -117,8 +114,6 @@ const DocumentDetails = ({ t, config, onSelect, userType, formData, setError: se }; - - const handleSubmit = () => { let document = formData.documents; let documentStep; @@ -304,10 +299,10 @@ const SelectDocument = React.memo(function MyComponent({ newfiles.push({ documentType: selectedDocument?.code, - fileName: doc?.[0] || "", additionalDetails:{category:selectedDocument?.code.split(".").slice(0,2).join('_'), latitude: location.latitude, longitude: location.longitude, + fileName: doc?.[0] || "", }, fileStoreId: doc?.[1]?.fileStoreId?.fileStoreId, documentUid: doc?.[1].fileStoreId?.fileStoreId, @@ -360,10 +355,10 @@ const SelectDocument = React.memo(function MyComponent({ newfiles.push({ documentType: selectedDocument?.code, fileStoreId: doc.fileStoreId, - fileName: fileArray[index]?.name || "", additionalDetails:{category:selectedDocument?.code.split(".").slice(0,2).join('_'), latitude: latitude, longitude: longitude, + fileName: fileArray[index]?.name || "", }, documentUid: doc.fileStoreId, fileName: fileArray[index]?.name || "", @@ -428,16 +423,16 @@ const SelectDocument = React.memo(function MyComponent({ const selectedUplDocs = docs .filter(ob => ob.documentType === selectedDocument.code) .map(e => [ - e.fileName, + e.additionalDetails.fileName, { - file: { name: e.fileName, type: e.documentType }, + file: { name: e.additionalDetails.fileName, type: e.documentType }, fileStoreId: { fileStoreId: e.fileStoreId, tenantId }, }, ]); return selectedUplDocs; }, [formData, selectedDocument.code, tenantId]); - + const sitePhotographDoc = documents.filter(doc => doc.documentType === "SITEPHOTOGRAPH.ONE.ONE"); return (
@@ -462,29 +457,29 @@ const SelectDocument = React.memo(function MyComponent({ acceptFiles= "image/*, .pdf, .png, .jpeg, .jpg" /> {doc?.uploadedDocuments?.length && } + {doc?.code === "SITEPHOTOGRAPH.ONE" && (() => { + const latitude = sessionStorage.getItem("Latitude") || sitePhotographDoc?.[0]?.additionalDetails?.latitude; + const longitude = sessionStorage.getItem("Longitude") || sitePhotographDoc?.[0]?.additionalDetails?.longitude; - {doc?.code === "SITEPHOTOGRAPH.ONE" && ( - sessionStorage.getItem("Latitude") && sessionStorage.getItem("Longitude") ? ( -
-

Latitude: {sessionStorage.getItem("Latitude")}

-

Longitude: {sessionStorage.getItem("Longitude")}

-
+

Latitude: {latitude}

+

Longitude: {longitude}

+
window.open(`http://maps.google.com/maps?q=${sessionStorage.getItem("Latitude")},${sessionStorage.getItem("Longitude")}`, '_blank')} + onClick={() => window.open(`http://maps.google.com/maps?q=${latitude},${longitude}`, '_blank')} >
- {setIsNextButtonDisabled(false)} {/* Enable the "Next" button */} -
- - ) : ( -
-

Please upload a Photo with Location details.

- {setIsNextButtonDisabled(true)} {/* Disable the "Next" button */} -
- ) - )} - + {setIsNextButtonDisabled(false)} {/* Enable the "Next" button */} +
+ ) : ( +
+

Please upload a Photo with Location details.

+ {setIsNextButtonDisabled(true)} {/* Disable the "Next" button */} +
+ ); + })()}
); });