@@ -40,7 +40,7 @@ function Header({
40
40
signerPos && signerPos ?. filter ( ( data ) => data . Role !== "prefill" ) ;
41
41
const isMobile = window . innerWidth < 767 ;
42
42
const navigate = useNavigate ( ) ;
43
- const [ isCertificate , setIsCertificate ] = useState ( false ) ;
43
+ const [ isDownloading , setIsDownloading ] = useState ( "" ) ;
44
44
const isGuestSigner = localStorage . getItem ( "isGuestSigner" ) ;
45
45
//for go to previous page
46
46
function previousPage ( ) {
@@ -131,7 +131,9 @@ function Header({
131
131
>
132
132
< DropdownMenu . Item
133
133
className = "DropdownMenuItem"
134
- onClick = { ( ) => handleDownloadPdf ( pdfDetails , pdfUrl ) }
134
+ onClick = { ( ) =>
135
+ handleDownloadPdf ( pdfDetails , pdfUrl , setIsDownloading )
136
+ }
135
137
>
136
138
< div
137
139
style = { {
@@ -153,7 +155,7 @@ function Header({
153
155
onClick = { ( ) =>
154
156
handleDownloadCertificate (
155
157
pdfDetails ,
156
- setIsCertificate
158
+ setIsDownloading
157
159
)
158
160
}
159
161
>
@@ -194,7 +196,9 @@ function Header({
194
196
) }
195
197
< DropdownMenu . Item
196
198
className = "DropdownMenuItem"
197
- onClick = { ( e ) => handleToPrint ( e , pdfUrl ) }
199
+ onClick = { ( e ) =>
200
+ handleToPrint ( e , pdfUrl , setIsDownloading )
201
+ }
198
202
>
199
203
< div
200
204
style = { {
@@ -277,7 +281,11 @@ function Header({
277
281
< DropdownMenu . Item
278
282
className = "flex flex-row justify-center items-center text-[13px] focus:outline-none cursor-pointer"
279
283
onClick = { ( ) =>
280
- handleDownloadPdf ( pdfDetails , pdfUrl )
284
+ handleDownloadPdf (
285
+ pdfDetails ,
286
+ pdfUrl ,
287
+ setIsDownloading
288
+ )
281
289
}
282
290
>
283
291
< i
@@ -366,7 +374,7 @@ function Header({
366
374
< button
367
375
type = "button"
368
376
onClick = { ( ) =>
369
- handleDownloadCertificate ( pdfDetails , setIsCertificate )
377
+ handleDownloadCertificate ( pdfDetails , setIsDownloading )
370
378
}
371
379
className = "flex flex-row items-center shadow rounded-[3px] py-[3px] px-[11px] text-white font-[500] text-[13px] mr-[5px] bg-[#08bc66]"
372
380
>
@@ -379,7 +387,7 @@ function Header({
379
387
) }
380
388
381
389
< button
382
- onClick = { ( e ) => handleToPrint ( e , pdfUrl ) }
390
+ onClick = { ( e ) => handleToPrint ( e , pdfUrl , setIsDownloading ) }
383
391
type = "button"
384
392
className = "flex flex-row items-center shadow rounded-[3px] py-[3px] px-[11px] text-white font-[500] text-[13px] mr-[5px] bg-[#188ae2]"
385
393
>
@@ -390,7 +398,9 @@ function Header({
390
398
< button
391
399
type = "button"
392
400
className = "flex flex-row items-center shadow rounded-[3px] py-[3px] px-[11px] text-white font-[500] text-[13px] mr-[5px] bg-[#f14343]"
393
- onClick = { ( ) => handleDownloadPdf ( pdfDetails , pdfUrl ) }
401
+ onClick = { ( ) =>
402
+ handleDownloadPdf ( pdfDetails , pdfUrl , setIsDownloading )
403
+ }
394
404
>
395
405
< i className = "fa fa-download py-[3px]" aria-hidden = "true" > </ i >
396
406
< span className = "hidden lg:block ml-1" > Download</ span >
@@ -440,7 +450,11 @@ function Header({
440
450
< DropdownMenu . Item
441
451
className = "flex flex-row justify-center items-center text-[13px] focus:outline-none cursor-pointer"
442
452
onClick = { ( ) =>
443
- handleDownloadPdf ( pdfDetails , pdfUrl )
453
+ handleDownloadPdf (
454
+ pdfDetails ,
455
+ pdfUrl ,
456
+ setIsDownloading
457
+ )
444
458
}
445
459
>
446
460
< i
@@ -462,7 +476,7 @@ function Header({
462
476
< button
463
477
type = "button"
464
478
onClick = { ( ) =>
465
- handleDownloadCertificate ( pdfDetails , setIsCertificate )
479
+ handleDownloadCertificate ( pdfDetails , setIsDownloading )
466
480
}
467
481
className = "flex flex-row items-center shadow rounded-[3px] py-[3px] px-[11px] text-white font-[500] text-[13px] mr-[5px] bg-[#08bc66]"
468
482
>
@@ -474,7 +488,7 @@ function Header({
474
488
</ button >
475
489
) }
476
490
< button
477
- onClick = { ( e ) => handleToPrint ( e , pdfUrl ) }
491
+ onClick = { ( e ) => handleToPrint ( e , pdfUrl , setIsDownloading ) }
478
492
type = "button"
479
493
className = "flex flex-row items-center shadow rounded-[3px] py-[3px] px-[11px] text-white font-[500] text-[13px] mr-[5px] bg-[#188ae2]"
480
494
>
@@ -484,7 +498,9 @@ function Header({
484
498
< button
485
499
type = "button"
486
500
className = "flex flex-row items-center shadow rounded-[3px] py-[3px] px-[11px] text-white font-[500] text-[13px] mr-[5px] bg-[#f14343]"
487
- onClick = { ( ) => handleDownloadPdf ( pdfDetails , pdfUrl ) }
501
+ onClick = { ( ) =>
502
+ handleDownloadPdf ( pdfDetails , pdfUrl , setIsDownloading )
503
+ }
488
504
>
489
505
< i className = "fa fa-download py-[3px]" aria-hidden = "true" > </ i >
490
506
< span className = "hidden lg:block ml-1" > Download</ span >
@@ -524,12 +540,25 @@ function Header({
524
540
) }
525
541
</ div >
526
542
) }
543
+ { isDownloading === "pdf" && (
544
+ < div className = "fixed z-[200] inset-0 flex justify-center items-center bg-black bg-opacity-30" >
545
+ < div
546
+ style = { { fontSize : "45px" , color : "#3dd3e0" } }
547
+ className = "loader-37"
548
+ > </ div >
549
+ </ div >
550
+ ) }
527
551
< ModalUi
528
- isOpen = { isCertificate }
529
- title = { "Generating certificate" }
530
- handleClose = { ( ) => setIsCertificate ( false ) }
552
+ isOpen = { isDownloading === "certificate" }
553
+ title = {
554
+ isDownloading === "certificate"
555
+ ? "Generating certificate"
556
+ : "PDF Download"
557
+ }
558
+ handleClose = { ( ) => setIsDownloading ( "" ) }
531
559
>
532
560
< div className = "p-3 md:p-5 text-[13px] md:text-base text-center" >
561
+ { isDownloading === "certificate" } { " " }
533
562
< p >
534
563
Your completion certificate is being generated. Please wait
535
564
momentarily.
0 commit comments