diff --git a/lang/en.json b/lang/en.json index 9017eb34b078ca0689e2de072219b5d8bba39fee..50de7b2c59f5aad77613e38089245ae1fc2da8f0 100755 --- a/lang/en.json +++ b/lang/en.json @@ -161,7 +161,8 @@ "deleteSubstitution": "Delete subtitution", "substitutionDeleted": "Substitution deleted", "substitutionInfo": "You are in substitution mode, you can't make any action", - "substitutedDoc": "Document subtituted", + "substitutedDoc": "Substituted document", + "substitutedSignature": "Substituted signature", "substitutionWarn": "You choose a substitution, délégation, you will not be able to make any action." } } diff --git a/lang/fr.json b/lang/fr.json index 63d5dee3a8cc48a6e54ae3800b663268c3bed3e9..37c28e8a28fccdcc4df9fd3a4473255c89649a39 100755 --- a/lang/fr.json +++ b/lang/fr.json @@ -162,6 +162,7 @@ "substitutionDeleted": "Délégation supprimée", "substitutionInfo": "Vous avez délégué vos documents, vous ne pouvez pas faire d'action", "substitutedDoc": "Document délégué", + "substitutedSignature": "Signature déléguée", "substitutionWarn": "Vous avez choisi une délégation, vous ne pourrez plus faire d'action." } } diff --git a/src/frontend/app/app.component.ts b/src/frontend/app/app.component.ts index 96f369c5de387796ddab62749c8747958c87453f..e98a4906ff7863b994045f68331d30da0f143212 100755 --- a/src/frontend/app/app.component.ts +++ b/src/frontend/app/app.component.ts @@ -32,7 +32,6 @@ export class AppComponent { .subscribe((data: any) => { this.signaturesService.userLogged = data.user; if (this.signaturesService.signaturesList.length === 0) { - console.log(this.signaturesService); this.http.get('../rest/users/' + this.signaturesService.userLogged.id + '/signatures') .subscribe((dataSign: any) => { this.signaturesService.signaturesList = dataSign.signatures; diff --git a/src/frontend/app/document/document.component.ts b/src/frontend/app/document/document.component.ts index 7283d9c25db9b63de31bdf5dba9a20b8c1bc5e53..9a7a7877044d2085eb5444b7a883f25fd7a4f231 100755 --- a/src/frontend/app/document/document.component.ts +++ b/src/frontend/app/document/document.component.ts @@ -165,12 +165,16 @@ export class DocumentComponent implements OnInit { this.signaturesService.mainDocumentId = this.mainDocument.id; this.initDoc(); - if (this.signaturesService.signaturesList.length === 0) { - this.http.get('../rest/users/' + this.signaturesService.userLogged.id + '/signatures') + const realUserWorkflow = this.mainDocument.workflow.filter((line: { current: boolean; }) => line.current === true)[0]; + + if (realUserWorkflow.userId !== this.signaturesService.userLogged.id) { + this.http.get('../rest/users/' + realUserWorkflow.userId + '/signatures') .subscribe((dataSign: any) => { - this.signaturesService.signaturesList = dataSign.signatures; + this.signaturesService.signaturesListSubstituted = dataSign.signatures; this.signaturesService.loadingSign = false; }); + } else { + this.signaturesService.signaturesListSubstituted = []; } this.docList.push({ 'id': this.mainDocument.id, 'title': this.mainDocument.title, 'pages': this.mainDocument.pages, 'imgContent': [], 'imgUrl': '../rest/documents/' + this.mainDocument.id + '/thumbnails' }); this.mainDocument.attachments.forEach((attach: any) => { diff --git a/src/frontend/app/login/login.component.ts b/src/frontend/app/login/login.component.ts index 4e372827ebbc2fd3f07187e0b6c76375e3c2653b..b226ba176dfef20b50ec287c202f435785f56a0e 100644 --- a/src/frontend/app/login/login.component.ts +++ b/src/frontend/app/login/login.component.ts @@ -78,7 +78,10 @@ export class LoginComponent implements OnInit, AfterViewInit { this.http.post('../rest/log', { 'login': this.newLogin.login, 'password': this.newLogin.password }) .subscribe((data: any) => { this.signaturesService.userLogged = data.user; - + this.http.get('../rest/users/' + this.signaturesService.userLogged.id + '/signatures') + .subscribe((dataSign: any) => { + this.signaturesService.signaturesList = dataSign.signatures; + }); this.translate.use(this.signaturesService.userLogged.preferences.lang); this.cookieService.set( 'maarchParapheurLang', this.signaturesService.userLogged.preferences.lang ); diff --git a/src/frontend/app/service/signatures.service.ts b/src/frontend/app/service/signatures.service.ts index 26221896eb2cf611e8dd425ea1b08a8c89d7796a..90763032963f95bcdca25e3a791f382f7cd6bb71 100755 --- a/src/frontend/app/service/signatures.service.ts +++ b/src/frontend/app/service/signatures.service.ts @@ -8,6 +8,7 @@ export class SignaturesContentService { signaturesContent: any[] = []; notesContent: any[] = []; signaturesList: any[] = []; + signaturesListSubstituted: any[] = []; currentPage = 1; totalPage = 1; isTaggable = true; @@ -55,6 +56,7 @@ export class SignaturesContentService { this.signaturesContent = []; this.notesContent = []; this.signaturesList = []; + this.signaturesListSubstituted = []; this.currentPage = 1; this.totalPage = 1; this.isTaggable = true; diff --git a/src/frontend/app/signatures/signatures.component.html b/src/frontend/app/signatures/signatures.component.html index 8ada63ecab74b47c5bccfd6d9177259d6bf51c04..6f8275331be8fbf400aff1c6933c4b8b3c406ca6 100755 --- a/src/frontend/app/signatures/signatures.component.html +++ b/src/frontend/app/signatures/signatures.component.html @@ -7,8 +7,15 @@ <i class="fas fa-pen-nib fa-2x"></i> {{'lang.createNewSignature' | translate}} </div> + <div [@listAnimation]="signaturesService.signaturesListSubstituted.length" style="display: contents;"> + <div *ngFor="let signature of signaturesService.signaturesListSubstituted;let i=index" class="list-item" style="position: relative;overflow: hidden" (tap)="tapEvent(signature,i,'substitute')"> + <img [src]="sanitization.bypassSecurityTrustUrl('data:image/png;base64,' + signature.encodedSignature)" + style="width: 190px;"> + <div class="substituteInfo">{{'lang.substitutedSignature' | translate}}</div> + </div> + </div> <div [@listAnimation]="signaturesService.signaturesList.length" style="display: contents;"> - <div *ngFor="let signature of signaturesService.signaturesList;let i=index" class="list-item" style="position: relative;overflow: hidden" (tap)="tapEvent(signature,i)"> + <div *ngFor="let signature of signaturesService.signaturesList;let i=index" class="list-item" style="position: relative;overflow: hidden" (tap)="tapEvent(signature,i,'')"> <span class="remove_icon_{{i}}" style="display:none;position: absolute;top: 5px;left: 5px;" (tap)="removeSignature(signature,i);"><i style="border-radius: 25px;background: white;left:0px;top:0px;color:red;font-size: 50px;" class="fa fa-times-circle fa-2x"></i></span> <img [src]="sanitization.bypassSecurityTrustUrl('data:image/png;base64,' + signature.encodedSignature)" style="width: 190px;"> diff --git a/src/frontend/app/signatures/signatures.component.scss b/src/frontend/app/signatures/signatures.component.scss index 4e4d194cfebbb10f971b5e1a3eb02a15316dc1b4..e6ff4efe14a050d97f5ecc5c93b97a88c66c51c9 100644 --- a/src/frontend/app/signatures/signatures.component.scss +++ b/src/frontend/app/signatures/signatures.component.scss @@ -33,6 +33,13 @@ display: flex; justify-content: center; align-items: center; + .substituteInfo { + color: #F99830; + font-size: 10px; + position: absolute; + top: 0px; + right: 10px; + } &.create { background-color: #F1F4F4; flex-direction: column; diff --git a/src/frontend/app/signatures/signatures.component.ts b/src/frontend/app/signatures/signatures.component.ts index 15d9a6d66e188ea3344563034ac039874f27baa2..e9f90351703f982137ee5a997b5bf2ef0e67f6e1 100755 --- a/src/frontend/app/signatures/signatures.component.ts +++ b/src/frontend/app/signatures/signatures.component.ts @@ -102,10 +102,15 @@ export class SignaturesComponent implements OnInit { this.inAllPage = !this.inAllPage; } - tapEvent(signature: any, i: any) { + tapEvent(signature: any, i: any, mode: string) { this.count++; - $('[class*=remove_icon_]').hide(); - $('.remove_icon_' + i).show(); + if (mode === '') { + $('[class*=remove_icon_]').hide(); + $('.remove_icon_' + i).show(); + } else { + $('[class*=remove_icon_]').hide(); + } + setTimeout(() => { if (this.count === 1) { this.count = 0;