@@ -14,6 +14,7 @@ import {
14
14
checkIsSubscribed ,
15
15
copytoData ,
16
16
fetchUrl ,
17
+ getSignedUrl ,
17
18
replaceMailVaribles
18
19
} from "../constant/Utils" ;
19
20
import Confetti from "react-confetti" ;
@@ -30,6 +31,7 @@ import SubscribeCard from "./SubscribeCard";
30
31
import { validplan } from "../json/plansArr" ;
31
32
import { serverUrl_fn } from "../constant/appinfo" ;
32
33
import { useTranslation } from "react-i18next" ;
34
+ import DownloadPdfZip from "./DownloadPdfZip" ;
33
35
34
36
const ReportTable = ( props ) => {
35
37
const { t } = useTranslation ( ) ;
@@ -71,6 +73,7 @@ const ReportTable = (props) => {
71
73
const [ isSubscribe , setIsSubscribe ] = useState ( true ) ;
72
74
const [ isModal , setIsModal ] = useState ( { } ) ;
73
75
const [ reason , setReason ] = useState ( "" ) ;
76
+ const [ isDownloadModal , setIsDownloadModal ] = useState ( false ) ;
74
77
const Extand_Class = localStorage . getItem ( "Extand_Class" ) ;
75
78
const extClass = Extand_Class && JSON . parse ( Extand_Class ) ;
76
79
const startIndex = ( currentPage - 1 ) * props . docPerPage ;
@@ -649,10 +652,15 @@ const ReportTable = (props) => {
649
652
setActLoader ( { [ `${ item . objectId } ` ] : true } ) ;
650
653
const url = item ?. SignedUrl || item ?. URL || "" ;
651
654
const pdfName = item ?. Name || "exported_file" ;
655
+ const isCompleted = item ?. IsCompleted || false ;
652
656
if ( url ) {
653
657
try {
654
- const signedUrl = await Parse . Cloud . run ( "getsignedurl" , { url : url } ) ;
655
- await fetchUrl ( signedUrl , pdfName ) ;
658
+ if ( isCompleted ) {
659
+ setIsDownloadModal ( { [ item . objectId ] : true } ) ;
660
+ } else {
661
+ const signedUrl = await getSignedUrl ( url ) ;
662
+ await fetchUrl ( signedUrl , pdfName ) ;
663
+ }
656
664
setActLoader ( { } ) ;
657
665
} catch ( err ) {
658
666
console . log ( "err in getsignedurl" , err ) ;
@@ -2107,6 +2115,14 @@ const ReportTable = (props) => {
2107
2115
</ div >
2108
2116
</ ModalUi >
2109
2117
) }
2118
+ { isDownloadModal [ item . objectId ] && (
2119
+ < DownloadPdfZip
2120
+ setIsDownloadModal = { setIsDownloadModal }
2121
+ isDownloadModal = { isDownloadModal [ item . objectId ] }
2122
+ pdfDetails = { [ item ] }
2123
+ isDocId = { false }
2124
+ />
2125
+ ) }
2110
2126
</ td >
2111
2127
</ tr >
2112
2128
)
0 commit comments