diff --git a/src/frontend/app/app.module.ts b/src/frontend/app/app.module.ts index a8880f806d348fd64d78c6c7f4198388e81a3890..7190c55fd15cfa13c87b6e4927e16c63ebe05f39 100755 --- a/src/frontend/app/app.module.ts +++ b/src/frontend/app/app.module.ts @@ -46,12 +46,13 @@ import { OverlayComponent } from './overlay/overlay.component'; import { VisaWorkflowComponent } from './document/visa-workflow/visa-workflow.component'; import { DocumentListComponent } from './document/document-list/document-list.component'; import { MainDocumentDetailComponent } from './document/main-document-detail/main-document-detail.component'; - +import { UpdatePasswordComponent } from './login/updatePassword/updatePassword.component'; // SERVICES import { NotificationService, CustomSnackbarComponent } from './service/notification.service'; import { SignaturesContentService } from './service/signatures.service'; -import { UpdatePasswordComponent } from './login/updatePassword/updatePassword.component'; +import { FiltersService } from './service/filters.service'; + @@ -118,6 +119,7 @@ import { UpdatePasswordComponent } from './login/updatePassword/updatePassword.c SignaturesComponent ], providers: [SignaturesContentService, + FiltersService, NotificationService, { provide: HAMMER_GESTURE_CONFIG, diff --git a/src/frontend/app/profile/profile.component.html b/src/frontend/app/profile/profile.component.html index e14ead7de1599a5e845abd3ac712b52d32cc5f47..0bc72e0d596f15814dc6bf8395b63b04307dfe11 100644 --- a/src/frontend/app/profile/profile.component.html +++ b/src/frontend/app/profile/profile.component.html @@ -243,7 +243,7 @@ <mat-select placeholder="{{'lang.chooseSubstitute' | translate}}" name="usersRest" [(ngModel)]="profileInfo.substitute"> <ng-container *ngFor="let userRest of usersRest"> - <mat-option *ngIf="userRest.id !== profileInfo.id" + <mat-option *ngIf="userRest.id !== profileInfo.id && !userRest.substitute" [value]="userRest.id"> {{userRest.firstname}} {{userRest.lastname}}</mat-option> diff --git a/src/frontend/app/profile/profile.component.ts b/src/frontend/app/profile/profile.component.ts index 288457887043f8dd472d049aea6b7d6c54dfb3d2..0b0a9c272854c249db47e4c69f68bfdae70732a8 100644 --- a/src/frontend/app/profile/profile.component.ts +++ b/src/frontend/app/profile/profile.component.ts @@ -7,6 +7,8 @@ import { NotificationService } from '../service/notification.service'; import { CookieService } from 'ngx-cookie-service'; import * as EXIF from 'exif-js'; import { TranslateService } from '@ngx-translate/core'; +import { FiltersService } from '../service/filters.service'; +import { Router } from '@angular/router'; @Component({ selector: 'app-my-profile', @@ -19,6 +21,7 @@ export class ProfileComponent implements OnInit { @Input('snavRightComponent') snavRightComponent: MatSidenav; @Input('snavLeftComponent') snavLeftComponent: MatSidenav; + @ViewChild('passwordContent') passwordContent: MatExpansionPanel; profileInfo: any = { @@ -61,9 +64,7 @@ export class ProfileComponent implements OnInit { msgButton = 'lang.validate'; loading: boolean = false; - constructor(private translate: TranslateService, public http: HttpClient, iconReg: MatIconRegistry, public sanitizer: DomSanitizer, public notificationService: NotificationService, public signaturesService: SignaturesContentService, private cookieService: CookieService) { - iconReg.addSvgIcon('maarchLogo', sanitizer.bypassSecurityTrustResourceUrl('../src/frontend/assets/logo_white.svg')); - } + constructor(private translate: TranslateService, public http: HttpClient, private router: Router, public sanitizer: DomSanitizer, public notificationService: NotificationService, public signaturesService: SignaturesContentService, private cookieService: CookieService, public filtersService: FiltersService) { } ngOnInit(): void { if (this.cookieService.check('maarchParapheurAuth')) { @@ -227,6 +228,13 @@ export class ProfileComponent implements OnInit { this.setLang(this.signaturesService.userLogged.preferences.lang); this.cookieService.set( 'maarchParapheurLang', this.signaturesService.userLogged.preferences.lang ); + if (this.profileInfo.substitute !== null) { + this.filtersService.resfreshDocuments(); + if (this.signaturesService.documentsList.length > 0 && this.signaturesService.documentsList[this.signaturesService.indexDocumentsList].owner === false) { + this.router.navigate(['/documents']); + } + } + $('.avatarProfile').css({ 'transform': 'rotate(0deg)' }); if (this.showPassword) { diff --git a/src/frontend/app/service/filters.service.ts b/src/frontend/app/service/filters.service.ts new file mode 100644 index 0000000000000000000000000000000000000000..1721a737468beb5db29c99c156871d70d9c65764 --- /dev/null +++ b/src/frontend/app/service/filters.service.ts @@ -0,0 +1,21 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +import { SignaturesContentService } from '../service/signatures.service'; + +@Injectable() +export class FiltersService { + + constructor(public http: HttpClient, public signaturesService: SignaturesContentService) { } + + resfreshDocuments() { + this.http.get('../rest/documents?limit=25&offset=0&mode=') + .subscribe((data: any) => { + this.signaturesService.mode = ''; + this.signaturesService.documentsList = data.documents; + this.signaturesService.documentsListCount = data.count; + }, (err: any) => { + console.log(err.error.errors); + }); + } +}