diff --git a/src/frontend/app/signature-book.component.html b/src/frontend/app/signature-book.component.html index 7b3eb26ea79b737b2788667d78778b2aca734c31..25f2cc44646096d5d697432ae4a7f5b7b790611e 100755 --- a/src/frontend/app/signature-book.component.html +++ b/src/frontend/app/signature-book.component.html @@ -256,8 +256,7 @@ [ngClass]="[signatureBook.attachments[rightSelectedThumbnail].status == 'SIGN' ? 'signed' : '']" [ngStyle]="{'box-shadow': signatureBook.listinstance.requested_signature ? 'inset 0px 0px 5px 0px red' : 'inset 0px 0px 5px 0px #656565;'}"> <span - *ngIf="signatureBook.attachments[rightSelectedThumbnail].status != 'SIGN' && signatureBook.signatures[0]" - style="cursor: pointer"> + *ngIf="signatureBook.attachments[rightSelectedThumbnail].status != 'SIGN' && signatureBook.signatures[0]"> <span *ngIf="!loadingSign"> <img *ngFor="let signature of signatureBook.signatures; let i = index" src="../../rest/users/{{signature.user_serial_id}}/signatures/{{signature.id}}/content" @@ -274,6 +273,7 @@ </span> </div> </div> + <app-attachments-list *ngIf="showAttachmentPanel" #appAttachmentsList [resId]="resId" [target]="'process'" (reloadBadgeAttachments)="refreshAttachments()" (afterActionAttachment)="refreshAttachments()"> diff --git a/src/frontend/app/signature-book.component.scss b/src/frontend/app/signature-book.component.scss index 0c9e83a96528d28474b00b170a848fda3586b96d..165a38055c547ef663597575171b33ae38007029 100755 --- a/src/frontend/app/signature-book.component.scss +++ b/src/frontend/app/signature-book.component.scss @@ -364,10 +364,6 @@ height: 100px; } -.pjSign { - cursor: pointer; -} - .pjDetails label { font-weight: bold; cursor: inherit; @@ -935,20 +931,22 @@ img:hover.panelSelectedThumbnail { } .pjSign img { + cursor: pointer; border: solid 2px white; height: 30px; - width: 50px; - -webkit-transition: height 0.5s; + width: auto; + min-width: 60px; + -webkit-transition: all 0.5s; /* Safari */ - transition: height 0.5s; + transition: all 0.5s; } .pjSign:hover img { height: 60px; width: auto; - -webkit-transition: height 0.5s; + -webkit-transition: all 0.5s; /* Safari */ - transition: height 0.5s; + transition: all 0.5s; } .pjSign:hover img:hover { @@ -956,6 +954,9 @@ img:hover.panelSelectedThumbnail { } .pjSign:hover { + display: flex; + white-space: pre; + overflow: hidden !important; width: 95%; -webkit-transition: width 0.5s; /* Safari */ @@ -1110,4 +1111,4 @@ img:hover.panelSelectedThumbnail { margin-top: 2px; color: black; font-weight: normal; -} \ No newline at end of file +} diff --git a/src/frontend/app/signature-book.component.ts b/src/frontend/app/signature-book.component.ts index 42a16905e430585977718f163eea9e3f99dd73bc..f28bee12f3a0f2b186bbacbf20804f63bd0719a2 100755 --- a/src/frontend/app/signature-book.component.ts +++ b/src/frontend/app/signature-book.component.ts @@ -422,46 +422,71 @@ export class SignatureBookComponent implements OnInit, OnDestroy { unsignFile(attachment: any) { if (attachment.isResource) { - this.http.put('../../rest/resources/' + attachment.res_id + '/unsign', {}) - .subscribe(() => { - this.appDocumentViewer.loadRessource(attachment.res_id, 'maintDocument'); - this.rightViewerLink += '?tsp=' + Math.floor(Math.random() * 100); - this.signatureBook.attachments[this.rightSelectedThumbnail].status = 'A_TRA'; - - if (this.signatureBook.resList.length > 0) { - this.signatureBook.resList[this.signatureBook.resListIndex].allSigned = false; - } - if (this.headerTab === 'visaCircuit') { - this.changeSignatureBookLeftContent('document'); - setTimeout(() => { - this.changeSignatureBookLeftContent('visaCircuit'); - }, 0); - } - }); + this.unSignMainDocument(attachment); } else { - this.http.put('../../rest/attachments/' + attachment.res_id + '/unsign', {}) - .subscribe(() => { - this.appDocumentViewer.loadRessource(attachment.res_id, 'attachment'); - this.rightViewerLink = '../../rest/attachments/' + attachment.res_id + '/content'; - this.signatureBook.attachments[this.rightSelectedThumbnail].viewerLink = this.rightViewerLink; - this.signatureBook.attachments[this.rightSelectedThumbnail].status = 'A_TRA'; - this.signatureBook.attachments[this.rightSelectedThumbnail].idToDl = attachment.res_id; - this.signatureBook.attachments[this.rightSelectedThumbnail].signed = false; - this.signatureBook.attachments[this.rightSelectedThumbnail].viewerId = attachment.res_id; - if (this.signatureBook.resList.length > 0) { - this.signatureBook.resList[this.signatureBook.resListIndex].allSigned = false; - } - if (this.headerTab === 'visaCircuit') { - this.changeSignatureBookLeftContent('document'); - setTimeout(() => { - this.changeSignatureBookLeftContent('visaCircuit'); - }, 0); - } - - }); + this.unSignAttachment(attachment); } } + unSignMainDocument(attachment: any) { + this.http.put(`../../rest/resources/${attachment.res_id}/unsign`, {}).pipe( + tap(() => { + this.appDocumentViewer.loadRessource(attachment.res_id, 'maintDocument'); + this.rightViewerLink += '?tsp=' + Math.floor(Math.random() * 100); + this.signatureBook.attachments[this.rightSelectedThumbnail].status = 'A_TRA'; + + if (this.signatureBook.resList.length > 0) { + this.signatureBook.resList[this.signatureBook.resListIndex].allSigned = false; + } + if (this.headerTab === 'visaCircuit') { + this.changeSignatureBookLeftContent('document'); + setTimeout(() => { + this.changeSignatureBookLeftContent('visaCircuit'); + }, 0); + } + }), + catchError((err: any) => { + if (err.status === 403) { + this.notify.error(this.lang.youCannotUnsign); + } else { + this.notify.handleSoftErrors(err); + } + return of(false); + }) + ).subscribe(); + } + + unSignAttachment(attachment: any) { + this.http.put('../../rest/attachments/' + attachment.res_id + '/unsign', {}).pipe( + tap(() => { + this.appDocumentViewer.loadRessource(attachment.res_id, 'attachment'); + this.rightViewerLink = '../rest/attachments/' + attachment.res_id + '/content'; + this.signatureBook.attachments[this.rightSelectedThumbnail].viewerLink = this.rightViewerLink; + this.signatureBook.attachments[this.rightSelectedThumbnail].status = 'A_TRA'; + this.signatureBook.attachments[this.rightSelectedThumbnail].idToDl = attachment.res_id; + this.signatureBook.attachments[this.rightSelectedThumbnail].signed = false; + this.signatureBook.attachments[this.rightSelectedThumbnail].viewerId = attachment.res_id; + if (this.signatureBook.resList.length > 0) { + this.signatureBook.resList[this.signatureBook.resListIndex].allSigned = false; + } + if (this.headerTab === 'visaCircuit') { + this.changeSignatureBookLeftContent('document'); + setTimeout(() => { + this.changeSignatureBookLeftContent('visaCircuit'); + }, 0); + } + }), + catchError((err: any) => { + if (err.status === 403) { + this.notify.error(this.lang.youCannotUnsign); + } else { + this.notify.handleSoftErrors(err); + } + return of(false); + }) + ).subscribe(); + } + backToBasket() { const path = '/basketList/users/' + this.userId + '/groups/' + this.groupId + '/baskets/' + this.basketId; this.router.navigate([path]); diff --git a/src/frontend/lang/lang-en.ts b/src/frontend/lang/lang-en.ts index 6d2fb1e9e1067ac33e9043127a3a43bb505625b7..e528d54effc58fc3cafa2cd63038201f79107a43 100755 --- a/src/frontend/lang/lang-en.ts +++ b/src/frontend/lang/lang-en.ts @@ -1740,4 +1740,5 @@ export const LANG_EN = { "indexingModelReplaceToDelete": "To delete this model you have to replace it by another.", "indexingModelFieldsReset": "The following fields are not in the selected model and will be reset for all mails : ", "indexingModelReassign": "Reassign indexing model", + "youCannotUnsign": "You do not have the right to <b>unsign</b> this document. You must be the person who signed this document." }; diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts index a50a244300eef2f33cee59df5360d8a54af3ce0c..052a29d68550364a35a702666f32fcb4d84d4e5b 100755 --- a/src/frontend/lang/lang-fr.ts +++ b/src/frontend/lang/lang-fr.ts @@ -1742,4 +1742,5 @@ export const LANG_FR = { "indexingModelReplaceToDelete": "Pour le supprimer vous devez le remplacer par un autre modèle.", "indexingModelFieldsReset": "Les champs suivants ne sont pas dans le modèle sélectionné et seront réinitialisés pour tous les courriers : ", "indexingModelReassign": "Réaffectation du modèle d'enregistrement", + "youCannotUnsign" : "Vous n'avez pas le droit de <b>dé-signer</b> ce document. Vous devez ếtre la personne qui a signé ce document." }; diff --git a/src/frontend/lang/lang-nl.ts b/src/frontend/lang/lang-nl.ts index 41268ad38f563f3ba52e2c1310a627a22f604e55..47a31b91b226580a4393b38f2d68a76ba8fb44b5 100755 --- a/src/frontend/lang/lang-nl.ts +++ b/src/frontend/lang/lang-nl.ts @@ -1723,4 +1723,5 @@ export const LANG_NL = { "indexingModelReplaceToDelete": "Pour le supprimer vous devez le remplacer par un autre modèle.__TO_TRANSLATE", "indexingModelFieldsReset": "Les champs suivants ne sont pas dans le modèle sélectionné et seront réinitialisés pour tous les courriers : __TO_TRANSLATE", "indexingModelReassign": "Réaffectation du modèle d'enregistrement__TO_TRANSLATE", + "youCannotUnsign": "Vous n'avez pas le droit de <b>dé-signer</b> ce document. Vous devez ếtre la personne qui a signé ce document.__TO_TRANSLATE" };