diff --git a/src/frontend/app/administration/contact/list/import/contact-import.component.ts b/src/frontend/app/administration/contact/list/import/contact-import.component.ts index 074fcaeae58e777b97db881ba41e141194264cec..608cc9a335df20abccfd81b630e8550ecb813962 100644 --- a/src/frontend/app/administration/contact/list/import/contact-import.component.ts +++ b/src/frontend/app/administration/contact/list/import/contact-import.component.ts @@ -286,13 +286,14 @@ export class ContactImportComponent implements OnInit { } onSubmit() { + let dialogRef: any = null; const dataToSend: any[] = []; let confirmText = ''; this.translate.get('lang.confirmImportContacts', { 0: this.countAll }).subscribe((res: string) => { confirmText = `${res} ?<br/><br/>`; confirmText += `<ul><li><b>${this.countAdd}</b> ${this.translate.instant('lang.additions')}</li><li><b>${this.countUp}</b> ${this.translate.instant('lang.modifications')}</li></ul>`; }); - let dialogRef = this.dialog.open(ConfirmComponent, { panelClass: 'maarch-modal', autoFocus: false, disableClose: true, data: { title: this.translate.instant('lang.import'), msg: confirmText } }); + dialogRef = this.dialog.open(ConfirmComponent, { panelClass: 'maarch-modal', autoFocus: false, disableClose: true, data: { title: this.translate.instant('lang.import'), msg: confirmText } }); dialogRef.afterClosed().pipe( filter((data: string) => data === 'ok'), tap(() => { diff --git a/src/frontend/app/administration/user/import/users-import.component.ts b/src/frontend/app/administration/user/import/users-import.component.ts index 61cfeb49cb30b524af11422e1dbac9bfe3b3741a..4f9c53287c20c1e0e22c2bf67d4210b36f90938d 100644 --- a/src/frontend/app/administration/user/import/users-import.component.ts +++ b/src/frontend/app/administration/user/import/users-import.component.ts @@ -186,13 +186,14 @@ export class UsersImportComponent implements OnInit { } onSubmit() { + let dialogRef: any = null; const dataToSend: any[] = []; let confirmText = ''; this.translate.get('lang.confirmImportUsers', { 0: this.countAll }).subscribe((res: string) => { confirmText = `${res} ?<br/><br/>`; confirmText += `<ul><li><b>${this.countAdd}</b> ${this.translate.instant('lang.additions')}</li><li><b>${this.countUp}</b> ${this.translate.instant('lang.modifications')}</li></ul>`; }); - let dialogRef = this.dialog.open(ConfirmComponent, { panelClass: 'maarch-modal', autoFocus: false, disableClose: true, data: { title: this.translate.instant('lang.import'), msg: confirmText } }); + dialogRef = this.dialog.open(ConfirmComponent, { panelClass: 'maarch-modal', autoFocus: false, disableClose: true, data: { title: this.translate.instant('lang.import'), msg: confirmText } }); dialogRef.afterClosed().pipe( filter((data: string) => data === 'ok'), tap(() => { diff --git a/src/frontend/app/registeredMail/import/registered-mail-import.component.ts b/src/frontend/app/registeredMail/import/registered-mail-import.component.ts index 2483113993a4e32ca8c5930ea1653abc7abdcc39..e4d3be86dd4af716364750e5238bfd7c0f8c21d4 100644 --- a/src/frontend/app/registeredMail/import/registered-mail-import.component.ts +++ b/src/frontend/app/registeredMail/import/registered-mail-import.component.ts @@ -404,12 +404,13 @@ export class RegisteredMailImportComponent implements OnInit { } onSubmit() { + let dialogRef: any = null; const dataToSend: any[] = []; let confirmText = ''; this.translate.get('lang.confirmImportRegisteredMails', { 0: this.countAll }).subscribe((res: string) => { confirmText = `${res} ?<br/><br/>`; }); - let dialogRef = this.dialog.open(ConfirmComponent, { panelClass: 'maarch-modal', autoFocus: false, disableClose: true, data: { title: this.translate.instant('lang.import'), msg: confirmText } }); + dialogRef = this.dialog.open(ConfirmComponent, { panelClass: 'maarch-modal', autoFocus: false, disableClose: true, data: { title: this.translate.instant('lang.import'), msg: confirmText } }); dialogRef.afterClosed().pipe( filter((data: string) => data === 'ok'), tap(() => { diff --git a/src/frontend/app/viewer/document-viewer.component.ts b/src/frontend/app/viewer/document-viewer.component.ts index 17d254ab886b5965f0cff8087f7049a4cd8bd1bb..a2a213dac5f43aa132c06beeab2418e08e16336e 100755 --- a/src/frontend/app/viewer/document-viewer.component.ts +++ b/src/frontend/app/viewer/document-viewer.component.ts @@ -19,6 +19,7 @@ import { VisaWorkflowModalComponent } from '../visa/modal/visa-workflow-modal.co import { of } from 'rxjs'; import { CollaboraOnlineViewerComponent } from '../../plugins/collabora-online/collabora-online-viewer.component'; import { AuthService } from '@service/auth.service'; +import { LocalStorageService } from '@service/local-storage.service'; @Component({ selector: 'app-document-viewer', @@ -151,7 +152,8 @@ export class DocumentViewerComponent implements OnInit, OnDestroy { private sortPipe: SortPipe, public functions: FunctionsService, public privilegeService: PrivilegeService, - private authService: AuthService + private authService: AuthService, + private localStorage: LocalStorageService ) { (<any>window).pdfWorkerSrc = '../node_modules/pdfjs-dist/build/pdf.worker.min.js'; } @@ -709,13 +711,21 @@ export class DocumentViewerComponent implements OnInit, OnDestroy { } editTemplate(templateId: number) { + if (this.localStorage.get(`modal_confirmEditTemplate_${this.headerService.user.id}`) !== null) { + this.launchEditTemplate(templateId); + } else { + this.confirmEditTemplate(templateId); + } + } + + confirmEditTemplate(templateId: number) { let confirmMsg = ''; if (this.mode === 'attachment') { confirmMsg = this.translate.instant('lang.editionAttachmentConfirmFirst') + '<br><br>' + this.translate.instant('lang.editionAttachmentConfirmThird'); } else { confirmMsg = this.translate.instant('lang.editionAttachmentConfirmFirst') + '<br><br>' + this.translate.instant('lang.editionAttachmentConfirmSecond'); } - this.dialogRef = this.dialog.open(ConfirmComponent, { panelClass: 'maarch-modal', autoFocus: false, disableClose: true, data: { title: this.translate.instant('lang.templateEdition'), msg: confirmMsg } }); + this.dialogRef = this.dialog.open(ConfirmComponent, { panelClass: 'maarch-modal', autoFocus: false, disableClose: true, data: { idModal: 'confirmEditTemplate', title: this.translate.instant('lang.templateEdition'), msg: confirmMsg } }); this.dialogRef.afterClosed().pipe( tap((data: string) => { @@ -725,50 +735,7 @@ export class DocumentViewerComponent implements OnInit, OnDestroy { }), filter((data: string) => data === 'ok'), tap(() => { - - this.triggerEvent.emit(); - const template = this.listTemplates.filter(templateItem => templateItem.id === templateId)[0]; - - this.file.format = template.extension; - - if (this.editor.mode === 'onlyoffice') { - - this.editor.async = false; - this.editor.options = { - objectType: 'attachmentCreation', - objectId: template.id, - docUrl: `rest/onlyOffice/mergedFile`, - dataToMerge: this.resourceDatas - }; - this.editInProgress = true; - - } else if (this.editor.mode === 'collaboraOnline') { - this.editor.async = false; - this.editInProgress = true; - this.editor.options = { - objectType: this.mode === 'attachment' ? 'attachmentCreation' : 'resourceCreation', - objectId: template.id, - dataToMerge: this.resourceDatas - }; - } else { - this.editor.async = true; - this.editor.options = { - objectType: 'attachmentCreation', - objectId: template.id, - cookie: document.cookie, - authToken : this.authService.getToken(), - data: this.resourceDatas, - }; - this.editInProgress = true; - - this.http.post('../rest/jnlp', this.editor.options).pipe( - tap((data: any) => { - window.location.href = '../rest/jnlp/' + data.generatedJnlp; - this.checkLockFile(data.jnlpUniqueId, template.extension); - }) - ).subscribe(); - } - + this.launchEditTemplate(templateId); }), catchError((err: any) => { this.notify.handleErrors(err); @@ -777,6 +744,51 @@ export class DocumentViewerComponent implements OnInit, OnDestroy { ).subscribe(); } + launchEditTemplate(templateId: number) { + this.triggerEvent.emit(); + const template = this.listTemplates.filter(templateItem => templateItem.id === templateId)[0]; + + this.file.format = template.extension; + + if (this.editor.mode === 'onlyoffice') { + + this.editor.async = false; + this.editor.options = { + objectType: 'attachmentCreation', + objectId: template.id, + docUrl: `rest/onlyOffice/mergedFile`, + dataToMerge: this.resourceDatas + }; + this.editInProgress = true; + + } else if (this.editor.mode === 'collaboraOnline') { + this.editor.async = false; + this.editInProgress = true; + this.editor.options = { + objectType: this.mode === 'attachment' ? 'attachmentCreation' : 'resourceCreation', + objectId: template.id, + dataToMerge: this.resourceDatas + }; + } else { + this.editor.async = true; + this.editor.options = { + objectType: 'attachmentCreation', + objectId: template.id, + cookie: document.cookie, + authToken : this.authService.getToken(), + data: this.resourceDatas, + }; + this.editInProgress = true; + + this.http.post('../rest/jnlp', this.editor.options).pipe( + tap((data: any) => { + window.location.href = '../rest/jnlp/' + data.generatedJnlp; + this.checkLockFile(data.jnlpUniqueId, template.extension); + }) + ).subscribe(); + } + } + editResource() { if (this.mode === 'attachment') { this.editAttachment(); diff --git a/src/frontend/plugins/modal/confirm.component.html b/src/frontend/plugins/modal/confirm.component.html index 0be2d5ae2110fabaa792ca75f3cdca0efbdb9695..b0fb9d585e687a9ee636efc776dd3e783f497659 100644 --- a/src/frontend/plugins/modal/confirm.component.html +++ b/src/frontend/plugins/modal/confirm.component.html @@ -2,6 +2,7 @@ <h1 mat-dialog-title>{{data.title}}</h1> <div *ngIf="data.msg !== ''" mat-dialog-content> <div class="alert-message alert-message-info" [innerHTML]="data.msg"></div> + <mat-checkbox color="primary" *ngIf="idModal !== null" (change)="hideModal()">{{'lang.hideModal' | translate}}</mat-checkbox> </div> <span class="divider-modal"></span> <div mat-dialog-actions> diff --git a/src/frontend/plugins/modal/confirm.component.ts b/src/frontend/plugins/modal/confirm.component.ts index c811582ba7a8d6c3670e2ea3bbee798f4b811af6..bd7c4d301e5d987debc39fc6fc4d91ee83c068d4 100755 --- a/src/frontend/plugins/modal/confirm.component.ts +++ b/src/frontend/plugins/modal/confirm.component.ts @@ -1,6 +1,8 @@ import { Component, Inject } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { TranslateService } from '@ngx-translate/core'; +import { HeaderService } from '@service/header.service'; +import { LocalStorageService } from '@service/local-storage.service'; @Component({ templateUrl: 'confirm.component.html', @@ -8,7 +10,19 @@ import { TranslateService } from '@ngx-translate/core'; }) export class ConfirmComponent { - constructor(public translate: TranslateService, @Inject(MAT_DIALOG_DATA) public data: any, public dialogRef: MatDialogRef<ConfirmComponent>) { + idModal: string = null; + + constructor( + public translate: TranslateService, + @Inject(MAT_DIALOG_DATA) public data: any, + public dialogRef: MatDialogRef<ConfirmComponent>, + public headerService: HeaderService, + private localStorage: LocalStorageService + ) { + if (this.data.idModal !== undefined) { + this.idModal = this.data.idModal; + } + if (this.data.msg === null) { this.data.msg = ''; } @@ -21,4 +35,12 @@ export class ConfirmComponent { this.data.buttonValidate = this.translate.instant('lang.ok'); } } + + hideModal() { + if (this.idModal !== '') { + this.localStorage.save(`modal_${this.idModal}_${this.headerService.user.id}`, true); + } else { + alert('No idModal provided!'); + } + } } diff --git a/src/lang/lang-en.json b/src/lang/lang-en.json index 07deaddd1a4c5869a93dd67cb931fc4b2743ddf3..25d24a220c716a56392318c20d733c64bc557448 100644 --- a/src/lang/lang-en.json +++ b/src/lang/lang-en.json @@ -2165,5 +2165,6 @@ "noBindingMailDesc": "A non-binding document involves a specific final action defined in the settings administration and is no longer linked to the document type.", "registeredMailMsgActivate": "Activating this range will close the current range used for that type of recommended.", "redirectUserVisaWorkflow": "Change of approver / signatory for mails in the process of visa / signature", - "chooseNewVisaUser": "is in <b>visa / signature</b> of some mails, please choose a <b>user replacement</b>" + "chooseNewVisaUser": "is in <b>visa / signature</b> of some mails, please choose a <b>user replacement</b>", + "hideModal": "Hide this modal" } \ No newline at end of file diff --git a/src/lang/lang-fr.json b/src/lang/lang-fr.json index 63a3551b428b3d377c86541d18db37134efff4b7..ddb2e3ca93a94f32f96a1094fc35fe51dc115bf9 100644 --- a/src/lang/lang-fr.json +++ b/src/lang/lang-fr.json @@ -2157,5 +2157,6 @@ "infoImportNoIdToCreate": "La colonne <b>id</b> doit être vide pour la création", "almostThere": "Vous y êtes presque !", "redirectUserVisaWorkflow": "Changement de viseur / signataire pour les courriers en cours de visa / signature", - "chooseNewVisaUser": "est en <b>visa / signature</b> de certains courriers, veuillez choisir un utilisateur de <b>remplacement</b>" + "chooseNewVisaUser": "est en <b>visa / signature</b> de certains courriers, veuillez choisir un utilisateur de <b>remplacement</b>", + "hideModal": "Ne plus afficher cette fenêtre" } diff --git a/src/lang/lang-nl.json b/src/lang/lang-nl.json index 3a7bce4b45c8fd36941b151ede79e59bd03f1a7e..dd9ed11f085fd32c488525247cec6bc2f3e133a9 100644 --- a/src/lang/lang-nl.json +++ b/src/lang/lang-nl.json @@ -2176,5 +2176,6 @@ "bindingMailAlt": "Document <b>engageant</b>__TO_TRANSLATE", "noBindingMailAlt": "Document <b>non engageant</b>__TO_TRANSLATE", "redirectUserVisaWorkflow": "Changement de viseur / signataire pour les courriers en cours de visa / signature__TO_TRANSLATE", - "chooseNewVisaUser": "est en <b>visa / signature</b> de certains courriers, veuillez choisir un utilisateur de <b>remplacement</b>__TO_TRANSLATE" + "chooseNewVisaUser": "est en <b>visa / signature</b> de certains courriers, veuillez choisir un utilisateur de <b>remplacement</b>__TO_TRANSLATE", + "hideModal": "Ne plus afficher cette fenêtre__TO_TRANSLATE" } \ No newline at end of file