viewer rotation

This commit is contained in:
Peter Maquiran
2024-02-22 11:40:06 +01:00
parent d0806455c9
commit 7583bf5306
39 changed files with 711 additions and 1312 deletions
@@ -1,11 +1,11 @@
<div class="height-100 d-flex flex-column overflow-hidden">
<div class="height-100 d-flex flex-column overflow-hidden width-100">
<div class="overflow-x-auto d-flex pa-10" style="background-color: #d9d9d9;" *ngIf="!DeviceService.isDesktop()">
<div class="overflow-x-auto d-flex pa-10 attachment-list" style="background-color: #d9d9d9;" *ngIf="!DeviceService.isDesktop()">
<div *ngFor="let attachment of taskViewerAttachment; let i = index"
class="ion-no-margin ion-no-padding cursor-pointer" class="pa-10 mx-10 card-text"
[ngClass]="{'selected-card': i === selectedIndex}" (click)="clickDocumentUPdateIndex(i)">
<div (click)="clickDocument(attachment)">
class="ion-no-margin ion-no-padding cursor-pointer attachment-list" class="pa-10 mx-10 card-text"
[ngClass]="{'selected-card': i === selectedIndex}">
<div (click)="clickDocument(attachment, i )">
<div *ngIf="attachment.Assunto" class="attach-title-item tex-left">
{{ attachment.Assunto }}<span class="document-type" *ngIf="attachment.content != ''">Rascunho</span>
@@ -20,9 +20,8 @@
</div>
<div #iframeContainer class="height-100" >
<div #iframeContainer class="height-100 flex-1" >
<iframe _ngcontent-lxc-c492="" height="100%" width="100%" title="Iframe Example" class="iframe" src="https://gdviewer-dev.dyndns.info/pdfjs/web/viewpdf.aspx?file=/arq/638429873997432492.pdf&amp;i=MjYxIzgjMTA2IzE3IzEyODA5MSNEb2N1bWVudENlbnRlcg==&amp;e=MA==&amp;p=MA==&amp;m=cGF1bG8ucGludG9AZ2FiaW5ldGVkaWdpdGFsLmxvY2Fs&amp;d=MA==&amp;n=UGF1bG8gUGludG8=&amp;mId=MA==&amp;al=MA==&amp;cn=T0E=&amp;wm=RmFsc2U=&amp;L=MA==&amp;attInstance=MA==&amp;OpenFromMail=MA=="></iframe>
</div>
</div>
@@ -31,3 +31,17 @@ iframe {
.selected-attachment {
border: 2px solid #3498db; /* You can customize the border style and color */
}
@media screen and (orientation:portrait) {
.attachment-list {
}
}
@media screen and (orientation:landscape) {
.attachment-list {
display: none !important;
}
}
@@ -22,40 +22,50 @@ export class ViewerAttachmentPage implements OnInit {
) { }
ngOnInit() {
this.validateParams()
const selectFirst = this.taskViewerAttachment[0]
}
clickDocumentUPdateIndex(index: number) {
// Update the selected index
this.selectedIndex = index;
}
async clickDocument(viewerAttachment: ViewerAttachment, i) {
async clickDocument(viewerAttachment: ViewerAttachment) {
const hasIframe = this.iframeContainer.nativeElement.querySelector("iframe")
if(hasIframe) {}
let count = 0
try {
setTimeout(async ()=> {
this.selectedIndex = i;
this.iframeContainer.nativeElement.innerHTML = ""
this.iframeContainer
this.iframeContainer.nativeElement.innerHTML = ""
this.iframeContainer
const linkRequest = await this.middlewareRepositoryService.getViewerLink({
ApplicationId: viewerAttachment.ApplicationId,
DocId: viewerAttachment.DocId
})
const linkRequest = await this.middlewareRepositoryService.getViewerLink({
ApplicationId: viewerAttachment.ApplicationId,
DocId: viewerAttachment.DocId
})
if(linkRequest.isOk()) {
// alert(`ApplicationId:${viewerAttachment.ApplicationId}, DocId: ${viewerAttachment.DocId}`)
// Optionally, you can add new content or recreate the iframe
var newIframe = document.createElement('iframe');
newIframe.src = linkRequest.value;
if(linkRequest.isOk()) {
newIframe.width = '100%'
newIframe.height = '100%'
// Optionally, you can add new content or recreate the iframe
var newIframe = document.createElement('iframe');
newIframe.src = linkRequest.value;
newIframe.width = '100%'
newIframe.height = '100%'
this.iframeContainer.nativeElement.appendChild(newIframe)
}
}, 1000)
} catch (error) {
this.clickDocument(viewerAttachment, i);
this.iframeContainer.nativeElement.appendChild(newIframe)
}
}
validateParams() {
@@ -73,9 +83,8 @@ export class ViewerAttachmentPage implements OnInit {
ngOnChanges() {
this.clickDocumentUPdateIndex(this.selectedIndex)
const task = this.taskViewerAttachment[this.selectedIndex]
this.clickDocument(task)
this.clickDocument(task, this.selectedIndex)
}
}