diff --git a/apps/maarch_entreprise/index.php b/apps/maarch_entreprise/index.php index 45e63145a752da22ffdb610cc8039638bbb845d4..821fb2d41784799dda49d783a06b6ab4e1f62659 100755 --- a/apps/maarch_entreprise/index.php +++ b/apps/maarch_entreprise/index.php @@ -375,6 +375,8 @@ if (!empty($_REQUEST['page']) && empty($_REQUEST['triggerAngular'])) { ?><script>triggerAngular('#/activate-user')</script><?php } elseif ($cookie['userId'] == 'superadmin' && !empty($_REQUEST['administration'])) { ?><script>triggerAngular('#/administration')</script><?php + } elseif (!empty($_REQUEST['scanToMaarch']) && !empty($_REQUEST['tmpfilename'])) { + ?><script>triggerAngular('#/indexing/<?php echo $_REQUEST['scanToMaarch']?>?tmpfilename=<?php echo $_REQUEST['tmpfilename']?>')</script><?php } elseif (empty($_REQUEST['page'])) { ?> <script> diff --git a/src/frontend/app/indexation/indexation.component.html b/src/frontend/app/indexation/indexation.component.html index 1d5915985fee5a55fe530d7a6d67a09bac7d7b35..f2c8e2326ecc54dc1268816b6d216930bdb32369 100644 --- a/src/frontend/app/indexation/indexation.component.html +++ b/src/frontend/app/indexation/indexation.component.html @@ -86,7 +86,7 @@ style="align-items: center;justify-content: center;text-align: center;display: flex;">Choisissez votre fichier</button> </div>--> - <app-document-viewer #appDocumentViewer style="height:100%;width:100%;"></app-document-viewer> + <app-document-viewer #appDocumentViewer [tmpFilename]="tmpFilename" style="height:100%;width:100%;"></app-document-viewer> </div> </div> </mat-sidenav-content> diff --git a/src/frontend/app/indexation/indexation.component.ts b/src/frontend/app/indexation/indexation.component.ts index d47c9b8646ef6cb49d9aba4476ea39da0863eea4..d80f2c9e7662c0bafbddd9f0c253897a60a2ad0a 100644 --- a/src/frontend/app/indexation/indexation.component.ts +++ b/src/frontend/app/indexation/indexation.component.ts @@ -43,9 +43,11 @@ export class IndexationComponent implements OnInit { actionsList: any[] = []; selectedAction: any = {}; + tmpFilename: string = ''; constructor( private route: ActivatedRoute, + private _activatedRoute: ActivatedRoute, public http: HttpClient, public dialog: MatDialog, private headerService: HeaderService, @@ -53,7 +55,12 @@ export class IndexationComponent implements OnInit { private notify: NotificationService, public overlay: Overlay, public viewContainerRef: ViewContainerRef, - public appService: AppService) { } + public appService: AppService) { + + _activatedRoute.queryParams.subscribe( + params => this.tmpFilename = params.tmpfilename + ); + } ngOnInit(): void { this.loading = false; diff --git a/src/frontend/app/viewer/document-viewer.component.ts b/src/frontend/app/viewer/document-viewer.component.ts index a037af128176ac0d43351c71c4e77069e3c4975c..04b53a4e67de768f4d7b134d59e24011787f00cc 100644 --- a/src/frontend/app/viewer/document-viewer.component.ts +++ b/src/frontend/app/viewer/document-viewer.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Input } from '@angular/core'; import { HttpClient, HttpEventType } from '@angular/common/http'; import { LANG } from '../translate.component'; import { NotificationService } from '../notification.service'; @@ -25,6 +25,8 @@ import { PDFProgressData } from 'ng2-pdf-viewer'; export class DocumentViewerComponent implements OnInit { + @Input('tmpFilename') tmpFilename: string; + lang: any = LANG; loading: boolean = false; @@ -82,6 +84,25 @@ export class DocumentViewerComponent implements OnInit { return of(false); }) ).subscribe(); + + if (this.tmpFilename != '') { + this.http.get('../../rest/convertedFile/'+this.tmpFilename).pipe( + tap((data: any) => { + this.file = { + name: this.tmpFilename, + type: 'application/pdf', + content: this.getBase64Document(this.base64ToArrayBuffer(data.encodedResource)), + src: this.base64ToArrayBuffer(data.encodedResource) + }; + this.noConvertedFound = false; + this.loading = false; + }), + catchError((err: any) => { + this.notify.handleErrors(err); + return of(false); + }) + ).subscribe(); + } } uploadTrigger(fileInput: any) {