From d95a51c93342461948b2baa62e22542e3fcab7fb Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Fri, 8 Mar 2019 17:37:38 +0100
Subject: [PATCH] FIX #9514 css disabled mat-nav_list_item

---
 .../template-administration.component.html    |  2 +-
 .../template-administration.component.ts      | 21 +++++++++++--------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/frontend/app/administration/template/template-administration.component.html b/src/frontend/app/administration/template/template-administration.component.html
index 1a52310f806..d8b7077a471 100755
--- a/src/frontend/app/administration/template/template-administration.component.html
+++ b/src/frontend/app/administration/template/template-administration.component.html
@@ -6,7 +6,7 @@
             <menu-nav></menu-nav>
             <mat-nav-list *ngIf="!creationMode && !loading">
                 <h3 mat-subheader>{{lang.actions}}</h3>
-                <a mat-list-item *ngIf="!lockFound && template.template_target != 'acknowledgementReceipt'" (click)="duplicateTemplate()">
+                <a mat-list-item [disableRipple]="lockFound || template.template_target == 'acknowledgementReceipt'" [class.disabled]="lockFound || template.template_target == 'acknowledgementReceipt'" (click)="duplicateTemplate()">
                     <mat-icon color="primary" mat-list-icon class="fa fa-copy"></mat-icon>
                     <p mat-line>
                         {{lang.duplicate}}
diff --git a/src/frontend/app/administration/template/template-administration.component.ts b/src/frontend/app/administration/template/template-administration.component.ts
index 1b96936c5f7..b4b8c737587 100755
--- a/src/frontend/app/administration/template/template-administration.component.ts
+++ b/src/frontend/app/administration/template/template-administration.component.ts
@@ -14,6 +14,7 @@ declare var angularGlobals: any;
 
 @Component({
     templateUrl: "template-administration.component.html",
+    styleUrls: ['template-administration.component.scss'],
     providers: [NotificationService]
 })
 export class TemplateAdministrationComponent implements OnInit {
@@ -264,16 +265,18 @@ export class TemplateAdministrationComponent implements OnInit {
     }
 
     duplicateTemplate() {
-        let r = confirm(this.lang.confirmDuplicate);
+        if (!this.lockFound && this.template.template_target != 'acknowledgementReceipt') {
+            let r = confirm(this.lang.confirmDuplicate);
 
-        if (r) {
-            this.http.post(this.coreUrl + 'rest/templates/' + this.template.template_id + '/duplicate', { 'id': this.template.template_id })
-                .subscribe((data: any) => {
-                    this.notify.success(this.lang.templateDuplicated);
-                    this.router.navigate(['/administration/templates/' + data.id]);
-                }, (err) => {
-                    this.notify.error(err.error.errors);
-                });
+            if (r) {
+                this.http.post(this.coreUrl + 'rest/templates/' + this.template.template_id + '/duplicate', { 'id': this.template.template_id })
+                    .subscribe((data: any) => {
+                        this.notify.success(this.lang.templateDuplicated);
+                        this.router.navigate(['/administration/templates/' + data.id]);
+                    }, (err) => {
+                        this.notify.error(err.error.errors);
+                    });
+            }
         }
     }
 
-- 
GitLab