From 8e9a6a4f60a8f4c6f0c9503ae89a254a4186facb Mon Sep 17 00:00:00 2001 From: Alex ORLUC <alex.orluc@maarch.org> Date: Mon, 19 Aug 2019 11:13:42 +0200 Subject: [PATCH] FEAT #11325 TIME 0:20 add modal for signature duplication --- lang/en.json | 2 +- lang/fr.json | 2 +- .../document-sign-list.component.ts | 33 +++++++++++-------- .../app/plugins/confirm.component.html | 2 +- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/lang/en.json b/lang/en.json index c31257f10a..f7e9876050 100755 --- a/lang/en.json +++ b/lang/en.json @@ -178,7 +178,7 @@ "manage_email_configuration": "Email server", "manage_email_configurationDesc": "Configure email server for users notifications.", "administration": "Administration", - "confirmMsg": "Are you sure", + "confirmMsg": "Are you sure ?", "yes": "Yes", "no": "No", "ldapEnabled": "LDAP enabled", diff --git a/lang/fr.json b/lang/fr.json index fe83bff78d..1286c6c44f 100755 --- a/lang/fr.json +++ b/lang/fr.json @@ -178,7 +178,7 @@ "manage_email_configuration": "Serveur courriel", "manage_email_configurationDesc": "Paramétrer le serveur de courriels pour les envois de notifications aux utilisateurs.", "administration": "Administration", - "confirmMsg": "Voulez-vous effectuer cette action", + "confirmMsg": "Voulez-vous effectuer cette action ?", "yes": "Oui", "no": "Non", "ldapEnabled": "LDAP activé", diff --git a/src/frontend/app/documentSignList/document-sign-list.component.ts b/src/frontend/app/documentSignList/document-sign-list.component.ts index e34a00e4b0..0c31d6d680 100644 --- a/src/frontend/app/documentSignList/document-sign-list.component.ts +++ b/src/frontend/app/documentSignList/document-sign-list.component.ts @@ -1,12 +1,13 @@ import { Component, OnInit, ViewChild, Input, ElementRef } from '@angular/core'; import { SignaturesContentService } from '../service/signatures.service'; import { - MatMenuTrigger, + MatMenuTrigger, MatDialog, } from '@angular/material'; import { NotificationService } from '../service/notification.service'; import { DomSanitizer } from '@angular/platform-browser'; import { TranslateService } from '@ngx-translate/core'; import { LocalStorageService } from '../service/local-storage.service'; +import { ConfirmComponent } from '../plugins/confirm.component'; @Component({ @@ -21,7 +22,8 @@ export class DocumentSignListComponent implements OnInit { private sanitization: DomSanitizer, public signaturesService: SignaturesContentService, public notificationService: NotificationService, - private localStorage: LocalStorageService + private localStorage: LocalStorageService, + public dialog: MatDialog ) { } ngOnInit(): void { } @@ -40,22 +42,25 @@ export class DocumentSignListComponent implements OnInit { } cloneSign(i: number) { - const r = confirm(this.translate.instant('lang.wantSignOtherPage')); + const dialogRef = this.dialog.open(ConfirmComponent, { autoFocus: false, width: '450px', data: { title: 'lang.wantSignOtherPage', msg: '' } }); - if (r) { - this.signaturesService.signaturesContent[this.signaturesService.currentPage][i].inAllPage = true; - this.signaturesService.signaturesContent[this.signaturesService.currentPage][i].token = Math.random().toString(36).substr(2, 9); + dialogRef.afterClosed().subscribe(result => { + if (result === 'yes') { + this.signaturesService.signaturesContent[this.signaturesService.currentPage][i].inAllPage = true; + this.signaturesService.signaturesContent[this.signaturesService.currentPage][i].token = Math.random().toString(36).substr(2, 9); - for (let index = 1; index <= this.signaturesService.totalPage; index++) { - if (!this.signaturesService.signaturesContent[index]) { - this.signaturesService.signaturesContent[index] = []; - } - if (index !== this.signaturesService.currentPage) { - this.signaturesService.signaturesContent[index].push(JSON.parse(JSON.stringify(this.signaturesService.signaturesContent[this.signaturesService.currentPage][i]))); + for (let index = 1; index <= this.signaturesService.totalPage; index++) { + if (!this.signaturesService.signaturesContent[index]) { + this.signaturesService.signaturesContent[index] = []; + } + if (index !== this.signaturesService.currentPage) { + this.signaturesService.signaturesContent[index].push(JSON.parse(JSON.stringify(this.signaturesService.signaturesContent[this.signaturesService.currentPage][i]))); + } } + this.localStorage.save(this.signaturesService.mainDocumentId.toString(), JSON.stringify({'sign' : this.signaturesService.signaturesContent, 'note' : this.signaturesService.notesContent})); } - this.localStorage.save(this.signaturesService.mainDocumentId.toString(), JSON.stringify({'sign' : this.signaturesService.signaturesContent, 'note' : this.signaturesService.notesContent})); - } + }); + this.menuSign.closeMenu(); } diff --git a/src/frontend/app/plugins/confirm.component.html b/src/frontend/app/plugins/confirm.component.html index 609172e2fe..c4678f7c25 100644 --- a/src/frontend/app/plugins/confirm.component.html +++ b/src/frontend/app/plugins/confirm.component.html @@ -1,5 +1,5 @@ <div class="modalContent {{data.mode}}"> - <h1 mat-dialog-title>{{data.title | translate}} ?</h1> + <h1 mat-dialog-title>{{data.title | translate}}</h1> <div mat-dialog-content *ngIf="data.msg !== null" [innerHTML]="data.msg | translate"></div> <div mat-dialog-actions> <button class="actions btn blue" mat-button (click)="this.dialogRef.close('yes');">{{'lang.yes' | translate}}</button> -- GitLab