This commit is contained in:
EmanuelCR03 2026-02-03 09:43:19 +00:00 committed by GitHub
commit 259c1e1c9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 83 additions and 3 deletions

View File

@ -895,12 +895,33 @@
</table>
<!-- PDF Viewer Modal -->
<div *ngIf="showPdf" class="pdf-modal-overlay">
<div class="pdf-modal-content">
<div *ngIf="showPdf" class="pdf-modal-overlay" (click)="closePdf()">
<div
class="pdf-modal-content"
role="dialog"
aria-modal="true"
aria-label="PDF preview"
(click)="$event.stopPropagation()"
>
<button mat-icon-button class="pdf-modal-close" (click)="closePdf()" aria-label="Close PDF">
<span aria-hidden="true">&times;</span>
</button>
<embed [src]="pdfUrl" type="application/pdf" width="100%" height="600px" />
<div class="pdf-modal-header">
<a
class="pdf-download"
*ngIf="rawPdfUrl"
[href]="rawPdfUrl"
download="report.pdf"
target="_blank"
rel="noopener"
>
{{ 'labels.buttons.Download' | translate }}
</a>
</div>
<!-- Use iframe (better cross-browser support) -->
<iframe *ngIf="pdfUrl" [src]="pdfUrl" class="pdf-iframe" frameborder="0" title="PDF preview"></iframe>
</div>
</div>
</div>

View File

@ -56,3 +56,62 @@
align-items: center; /* Ensure buttons are vertically aligned */
gap: 0.5rem; /* Add spacing between buttons if needed */
}
/* PDF modal styles */
.pdf-modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.6);
display: flex;
align-items: center;
justify-content: center;
z-index: 2000; /* make sure this is above other UI */
padding: 1rem;
}
.pdf-modal-content {
position: relative;
width: 100%;
max-width: 1100px;
height: 90vh;
background: #fff;
border-radius: 6px;
overflow: hidden;
display: flex;
flex-direction: column;
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
.pdf-modal-header {
display: flex;
justify-content: flex-end;
padding: 0.5rem 0.75rem;
background: #f7f7f7;
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
z-index: 2;
}
.pdf-download {
color: #333;
text-decoration: none;
font-weight: 500;
}
.pdf-modal-close {
position: absolute;
top: 8px;
right: 8px;
z-index: 3;
background: rgba(255, 255, 255, 0.9);
border-radius: 50%;
}
.pdf-iframe {
width: 100%;
height: calc(100% - 44px); /* leave room for header */
border: none;
background: #fff;
}