Skip to content
Snippets Groups Projects
Commit 63225f4b authored by Quentin Ribac's avatar Quentin Ribac
Browse files

Merge branch 'fix/16636/develop' into 'develop'

[16636] Lorsqu'un document annexe est affiché, le fait de cliquer sur le document de la bannette devrait m'afficher le document principal

See merge request maarch/MaarchParapheur!133
parents 243ae547 3a63c929
No related branches found
No related tags found
No related merge requests found
import { Component, Input, OnInit, Output, EventEmitter, ViewChild, AfterViewInit } from '@angular/core'; import { Component, Input, OnInit, Output, EventEmitter, ViewChild, AfterViewInit, OnDestroy } from '@angular/core';
import { SignaturesContentService } from '../../service/signatures.service'; import { SignaturesContentService } from '../../service/signatures.service';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from '@angular/platform-browser';
import { IonSlides, MenuController } from '@ionic/angular'; import { IonSlides, MenuController } from '@ionic/angular';
import { Subscription } from 'rxjs';
import { ActionsService } from '../../service/actions.service';
@Component({ @Component({
selector: 'app-document-list', selector: 'app-document-list',
templateUrl: 'document-list.component.html', templateUrl: 'document-list.component.html',
styleUrls: ['document-list.component.scss'], styleUrls: ['document-list.component.scss'],
}) })
export class DocumentListComponent implements OnInit, AfterViewInit { export class DocumentListComponent implements OnInit, AfterViewInit, OnDestroy {
@Input() docList: any; @Input() docList: any;
@Input() currentDocId: any; @Input() currentDocId: any;
...@@ -18,6 +20,8 @@ export class DocumentListComponent implements OnInit, AfterViewInit { ...@@ -18,6 +20,8 @@ export class DocumentListComponent implements OnInit, AfterViewInit {
@ViewChild('slides', { static: false }) slides: IonSlides; @ViewChild('slides', { static: false }) slides: IonSlides;
subscription: Subscription;
loading: boolean = true; loading: boolean = true;
scrolling: boolean = false; scrolling: boolean = false;
...@@ -30,9 +34,16 @@ export class DocumentListComponent implements OnInit, AfterViewInit { ...@@ -30,9 +34,16 @@ export class DocumentListComponent implements OnInit, AfterViewInit {
constructor( constructor(
public http: HttpClient, public http: HttpClient,
public signaturesService: SignaturesContentService, public signaturesService: SignaturesContentService,
private menu: MenuController,
private actionsService: ActionsService,
private sanitizer: DomSanitizer, private sanitizer: DomSanitizer,
private menu: MenuController ) {
) { } this.subscription = this.actionsService.catchEvent().subscribe((event: any) => {
if (event === 'scrollToTop') {
this.slides.slideTo(0, 0);
}
});
}
ngOnInit(): void { ngOnInit(): void {
this.docList.forEach((element: any, index: number) => { this.docList.forEach((element: any, index: number) => {
...@@ -49,6 +60,10 @@ export class DocumentListComponent implements OnInit, AfterViewInit { ...@@ -49,6 +60,10 @@ export class DocumentListComponent implements OnInit, AfterViewInit {
this.loading = false; this.loading = false;
} }
ngOnDestroy(): void {
this.subscription.unsubscribe();
}
loadDoc(id: string) { loadDoc(id: string) {
this.triggerEvent.emit(id); this.triggerEvent.emit(id);
this.menu.close('right-menu'); this.menu.close('right-menu');
......
import { Component, OnInit, ViewChild, TemplateRef, ViewContainerRef, Injectable } from '@angular/core'; import { Component, OnInit, ViewChild, TemplateRef, ViewContainerRef, Injectable, OnDestroy } from '@angular/core';
import { SignaturesContentService } from '../service/signatures.service'; import { SignaturesContentService } from '../service/signatures.service';
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from '@angular/platform-browser';
import { MatBottomSheet, MatBottomSheetConfig } from '@angular/material/bottom-sheet'; import { MatBottomSheet, MatBottomSheetConfig } from '@angular/material/bottom-sheet';
...@@ -18,7 +18,7 @@ import { LocalStorageService } from '../service/local-storage.service'; ...@@ -18,7 +18,7 @@ import { LocalStorageService } from '../service/local-storage.service';
import { ActionSheetController, AlertController, LoadingController, MenuController, ModalController, NavController } from '@ionic/angular'; import { ActionSheetController, AlertController, LoadingController, MenuController, ModalController, NavController } from '@ionic/angular';
import { NgxExtendedPdfViewerService } from 'ngx-extended-pdf-viewer'; import { NgxExtendedPdfViewerService } from 'ngx-extended-pdf-viewer';
import { catchError, exhaustMap, tap } from 'rxjs/operators'; import { catchError, exhaustMap, tap } from 'rxjs/operators';
import { of } from 'rxjs'; import { of, Subscription } from 'rxjs';
import { SignatureMethodService } from '../service/signature-method/signature-method.service'; import { SignatureMethodService } from '../service/signature-method/signature-method.service';
import { FunctionsService } from '../service/functions.service'; import { FunctionsService } from '../service/functions.service';
import { ActionsService } from '../service/actions.service'; import { ActionsService } from '../service/actions.service';
...@@ -31,7 +31,7 @@ import { SuccessInfoValidBottomSheetComponent } from '../modal/success-info-vali ...@@ -31,7 +31,7 @@ import { SuccessInfoValidBottomSheetComponent } from '../modal/success-info-vali
}) })
export class DocumentComponent implements OnInit { export class DocumentComponent implements OnInit, OnDestroy {
@ViewChild('mainContent') mainContent: any; @ViewChild('mainContent') mainContent: any;
@ViewChild('img') img: any; @ViewChild('img') img: any;
...@@ -73,6 +73,8 @@ export class DocumentComponent implements OnInit { ...@@ -73,6 +73,8 @@ export class DocumentComponent implements OnInit {
workflow: [], workflow: [],
}; };
subscription: Subscription;
signaturesContent: any = []; signaturesContent: any = [];
docList: any = []; docList: any = [];
...@@ -125,6 +127,16 @@ export class DocumentComponent implements OnInit { ...@@ -125,6 +127,16 @@ export class DocumentComponent implements OnInit {
private cookieService: CookieService, private cookieService: CookieService,
) { ) {
this.draggable = false; this.draggable = false;
this.subscription = this.actionsService.catchEvent().subscribe((event: any) => {
if (event.id === 'gotoDocument' && event.documentIndex === 0) {
this.loadDoc(event.documentIndex);
this.actionsService.setEvent('scrollToTop');
}
});
}
ngOnDestroy(): void {
this.subscription.unsubscribe();
} }
imageLoaded(ev: any) { imageLoaded(ev: any) {
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
</ion-label> </ion-label>
</ion-item> </ion-item>
<ion-menu-toggle auto-hide="false" *ngFor="let document of signaturesService.documentsList;let i=index"> <ion-menu-toggle auto-hide="false" *ngFor="let document of signaturesService.documentsList;let i=index">
<ion-item class="doc-item" (click)="filterService.currentIndex = i" routerDirection="root" <ion-item class="doc-item" (click)="filterService.currentIndex = i; goTo(document.id);" routerDirection="root"
[routerLink]="['/documents/'+document.id]" detail="false" [routerLink]="['/documents/'+document.id]" detail="false"
[class.selected]="router.url === '/documents/'+document.id"> [class.selected]="router.url === '/documents/'+document.id">
<ion-icon *ngIf="document.mode == 'sign'" color="primary" slot="start" name="pencil-outline"></ion-icon> <ion-icon *ngIf="document.mode == 'sign'" color="primary" slot="start" name="pencil-outline"></ion-icon>
......
...@@ -165,4 +165,8 @@ export class SidebarComponent implements OnInit, AfterViewInit { ...@@ -165,4 +165,8 @@ export class SidebarComponent implements OnInit, AfterViewInit {
canIndex() { canIndex() {
return this.authService.user.appPrivileges.map((item: any) => item.id).indexOf('indexation') > -1; return this.authService.user.appPrivileges.map((item: any) => item.id).indexOf('indexation') > -1;
} }
goTo() {
this.actionsService.setEvent({id: 'gotoDocument', documentIndex: 0});
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment