From 145aeb3f6c8455fa461829367698ab9f28625f3b Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Tue, 28 Aug 2018 10:58:13 +0200
Subject: [PATCH] FIX #7970 add nb contacts to contact grp list

---
 .../Views/contacts-groups-administration.component.html    | 5 ++++-
 apps/maarch_entreprise/Views/profile.component.html        | 7 +++++++
 apps/maarch_entreprise/js/angular/app/profile.component.ts | 3 ++-
 apps/maarch_entreprise/js/angular/lang/lang-fr.ts          | 2 +-
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/apps/maarch_entreprise/Views/contacts-groups-administration.component.html b/apps/maarch_entreprise/Views/contacts-groups-administration.component.html
index 61df689652d..ecfabb2399e 100755
--- a/apps/maarch_entreprise/Views/contacts-groups-administration.component.html
+++ b/apps/maarch_entreprise/Views/contacts-groups-administration.component.html
@@ -42,7 +42,10 @@
                     </ng-container>
                     <ng-container matColumnDef="nbContacts">
                         <mat-header-cell *matHeaderCellDef mat-sort-header style="flex:1;">{{lang.relatedContactNumber}}</mat-header-cell>
-                        <mat-cell *matCellDef="let element" style="flex:1;justify-content:center;"> {{element.nbContacts}} </mat-cell>
+                        <mat-cell *matCellDef="let element" style="flex:1;">
+                            <span *ngIf="element.nbContacts == 0">{{element.nbContacts}}</span> 
+                            <span *ngIf="element.nbContacts > 0" color="primary" style="font-weight:bold;">{{element.nbContacts}}</span> 
+                        </mat-cell>
                     </ng-container>
                     <ng-container matColumnDef="public">
                         <mat-header-cell *matHeaderCellDef mat-sort-header [class.hide-for-mobile]="mobileQuery.matches" style="flex:1;">{{lang.public}}</mat-header-cell>
diff --git a/apps/maarch_entreprise/Views/profile.component.html b/apps/maarch_entreprise/Views/profile.component.html
index ae1453fc4b4..75077df0169 100755
--- a/apps/maarch_entreprise/Views/profile.component.html
+++ b/apps/maarch_entreprise/Views/profile.component.html
@@ -498,6 +498,13 @@
                                                     <mat-header-cell *matHeaderCellDef mat-sort-header style="flex:2;">{{lang.description}}</mat-header-cell>
                                                     <mat-cell *matCellDef="let element" style="flex:2;"> {{element.description}} </mat-cell>
                                                 </ng-container>
+                                                <ng-container matColumnDef="nbContacts">
+                                                    <mat-header-cell *matHeaderCellDef mat-sort-header style="flex:1;">{{lang.relatedContactNumber}}</mat-header-cell>
+                                                    <mat-cell *matCellDef="let element" style="flex:1;">
+                                                        <span *ngIf="element.nbContacts == 0">{{element.nbContacts}}</span> 
+                                                        <span *ngIf="element.nbContacts > 0" color="primary" style="font-weight:bold;">{{element.nbContacts}}</span> 
+                                                    </mat-cell>
+                                                </ng-container>
                                                 <ng-container matColumnDef="public">
                                                     <mat-header-cell *matHeaderCellDef mat-sort-header [class.hide-for-mobile]="mobileQuery.matches" style="flex:1;">{{lang.public}}</mat-header-cell>
                                                     <mat-cell *matCellDef="let element" [class.hide-for-mobile]="mobileQuery.matches" style="flex:1;">
diff --git a/apps/maarch_entreprise/js/angular/app/profile.component.ts b/apps/maarch_entreprise/js/angular/app/profile.component.ts
index 66c6d459157..91d0531111c 100755
--- a/apps/maarch_entreprise/js/angular/app/profile.component.ts
+++ b/apps/maarch_entreprise/js/angular/app/profile.component.ts
@@ -96,7 +96,7 @@ export class ProfileComponent extends AutoCompletePlugin implements OnInit {
 
     //Groups contacts
     contactsGroups: any[] = [];
-    displayedColumnsGroupsList: string[] = ['label', 'description', 'actions'];
+    displayedColumnsGroupsList: string[] = ['label', 'description','nbContacts','public', 'actions'];
     dataSourceGroupsList: any;
     @ViewChild('paginatorGroupsList') paginatorGroupsList: MatPaginator;
     @ViewChild('tableGroupsListSort') sortGroupsList: MatSort;
@@ -281,6 +281,7 @@ export class ProfileComponent extends AutoCompletePlugin implements OnInit {
         this.http.put(this.coreUrl + 'rest/contactsGroups/' + this.contactsGroup.id, this.contactsGroup)
             .subscribe(() => {
                 this.notify.success(this.lang.contactsGroupUpdated);
+                this.initGroupsContact();    
             }, (err) => {
                 this.notify.error(err.error.errors);
             });
diff --git a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts
index a8bf008ecb6..aca27936c7b 100755
--- a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts
+++ b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts
@@ -404,7 +404,7 @@ export const LANG_FR = {
     "redirects"                         : "Redirections",
     "redirectWhenAbscence"              : "Rediriger la bannette à une personne",
     "reinitPassword"                    : "Réinitialiser le mot de passe",
-    "relatedContactNumber"              : "Nombre de contacts associé",
+    "relatedContactNumber"              : "Contact(s) associé(s)",
     "relatedUsers"                      : "Utilisateur(s) associé(s)",
     "relatedBaskets"                    : "Bannette(s) associée(s)",
     "removeUserRedirect"                : "Supprimer la personne (liste de diffusion + modèle de l'entité)",
-- 
GitLab