diff --git a/apps/maarch_entreprise/Views/contacts-group-administration.component.html b/apps/maarch_entreprise/Views/contacts-group-administration.component.html index 5c2b2390445f7180598c188fe71ed5a6bd558a28..70669af30fc0ed6f92f95fb55b66bd20acab46c2 100755 --- a/apps/maarch_entreprise/Views/contacts-group-administration.component.html +++ b/apps/maarch_entreprise/Views/contacts-group-administration.component.html @@ -123,7 +123,7 @@ <mat-sidenav *ngIf="!creationMode" #snav2 [mode]="mobileQuery.matches ? 'over' : 'side'" [fixedInViewport]="mobileQuery.matches" fixedTopGap="56" position='end' [opened]="mobileQuery.matches ? false : true" style="overflow-x:hidden;width:40%;"> <mat-list> - <h3 mat-subheader>{{lang.relatedContacts}}</h3> + <h3 mat-subheader>{{lang.relatedContacts}} : {{contactsGroup.nbContacts}} </h3> </mat-list> <div class="row" style="margin:0px;"> <div class="col-md-6 col-xs-6"> diff --git a/apps/maarch_entreprise/Views/contacts-groups-administration.component.html b/apps/maarch_entreprise/Views/contacts-groups-administration.component.html index 2ad5966f0af0b7829f704f510bdd8840426ab47b..6b4ca301f137dedbe0e1920216711991b1b5cca2 100755 --- a/apps/maarch_entreprise/Views/contacts-groups-administration.component.html +++ b/apps/maarch_entreprise/Views/contacts-groups-administration.component.html @@ -44,7 +44,7 @@ <mat-table #table [dataSource]="dataSource" matSort matSortActive="label" matSortDirection="asc"> <ng-container matColumnDef="label"> <mat-header-cell *matHeaderCellDef mat-sort-header [class.hide-for-mobile]="mobileQuery.matches" style="flex:2;">{{lang.label}}</mat-header-cell> - <mat-cell *matCellDef="let element" [class.hide-for-mobile]="mobileQuery.matches" style="flex:2;"> {{element.label}} </mat-cell> + <mat-cell *matCellDef="let element" [class.hide-for-mobile]="mobileQuery.matches" style="flex:2;"> <span matBadge="{{element.nbContacts}}" matBadgeOverlap="false"> {{element.label}} </span> </mat-cell> </ng-container> <ng-container matColumnDef="description"> <mat-header-cell *matHeaderCellDef mat-sort-header style="flex:2;">{{lang.description}}</mat-header-cell> diff --git a/apps/maarch_entreprise/js/angular/app/administration/contacts-group-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/contacts-group-administration.component.ts index 03a43e5d8f9bbe585bdf2249bdcb1c453f41568e..76dcd37e934cdb9f050b94f9e74db7735ac20026 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/contacts-group-administration.component.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/contacts-group-administration.component.ts @@ -27,6 +27,7 @@ export class ContactsGroupAdministrationComponent implements OnInit { creationMode: boolean; contactsGroup: any = {}; contactTypes: any = {}; + nbContact : number; contactTypeSearch: string; @@ -112,7 +113,7 @@ export class ContactsGroupAdministrationComponent implements OnInit { this.http.get(this.coreUrl + 'rest/contactsGroups/' + params['id']) .subscribe((data: any) => { this.contactsGroup = data.contactsGroup; - + this.nbContact = this.contactsGroup.nbContacts; setTimeout(() => { this.dataSourceAdded = new MatTableDataSource(this.contactsGroup.contacts); this.dataSourceAdded.paginator = this.paginatorAdded; diff --git a/src/app/contact/controllers/ContactGroupController.php b/src/app/contact/controllers/ContactGroupController.php index d0d460c83fd5ade68aec5015fde03f0ce4e990a0..5b03230041f67f430e59ce49236300331c6ffb95 100644 --- a/src/app/contact/controllers/ContactGroupController.php +++ b/src/app/contact/controllers/ContactGroupController.php @@ -40,8 +40,9 @@ class ContactGroupController } $contactsGroups[$key]['position'] = $key; $contactsGroups[$key]['labelledOwner'] = UserModel::getLabelledUserById(['id' => $contactsGroup['owner']]); + $contactsGroups[$key]['nbContacts'] = ContactGroupController::getFormattedListById(['id' => $contactsGroup['id']])['nbContacts']; } - + return $response->withJson(['contactsGroups' => array_values($contactsGroups)]); } @@ -58,7 +59,9 @@ class ContactGroupController } $contactsGroup['labelledOwner'] = UserModel::getLabelledUserById(['id' => $contactsGroup['owner']]); - $contactsGroup['contacts'] = ContactGroupController::getFormattedListById(['id' => $aArgs['id']])['list']; + $contactList = ContactGroupController::getFormattedListById(['id' => $aArgs['id']]); + $contactsGroup['contacts'] = $contactList['list']; + $contactsGroup['nbContacts'] = $contactList['nbContacts']; return $response->withJson(['contactsGroup' => $contactsGroup]); } @@ -264,7 +267,7 @@ class ContactGroupController } } - return ['list' => $contacts]; + return ['list' => $contacts, 'nbContacts' => count($contacts)]; } public static function getFormattedContact(array $aArgs)