Skip to content
Snippets Groups Projects
Commit 574aa576 authored by Pegane Nestor's avatar Pegane Nestor
Browse files

FEAT #7970 Group contact number of related contacts

parent 496d6c78
No related branches found
No related tags found
No related merge requests found
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
<mat-sidenav *ngIf="!creationMode" #snav2 [mode]="mobileQuery.matches ? 'over' : 'side'" [fixedInViewport]="mobileQuery.matches" <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%;"> fixedTopGap="56" position='end' [opened]="mobileQuery.matches ? false : true" style="overflow-x:hidden;width:40%;">
<mat-list> <mat-list>
<h3 mat-subheader>{{lang.relatedContacts}}</h3> <h3 mat-subheader>{{lang.relatedContacts}} : {{contactsGroup.nbContacts}} </h3>
</mat-list> </mat-list>
<div class="row" style="margin:0px;"> <div class="row" style="margin:0px;">
<div class="col-md-6 col-xs-6"> <div class="col-md-6 col-xs-6">
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<mat-table #table [dataSource]="dataSource" matSort matSortActive="label" matSortDirection="asc"> <mat-table #table [dataSource]="dataSource" matSort matSortActive="label" matSortDirection="asc">
<ng-container matColumnDef="label"> <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-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>
<ng-container matColumnDef="description"> <ng-container matColumnDef="description">
<mat-header-cell *matHeaderCellDef mat-sort-header style="flex:2;">{{lang.description}}</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header style="flex:2;">{{lang.description}}</mat-header-cell>
......
...@@ -27,6 +27,7 @@ export class ContactsGroupAdministrationComponent implements OnInit { ...@@ -27,6 +27,7 @@ export class ContactsGroupAdministrationComponent implements OnInit {
creationMode: boolean; creationMode: boolean;
contactsGroup: any = {}; contactsGroup: any = {};
contactTypes: any = {}; contactTypes: any = {};
nbContact : number;
contactTypeSearch: string; contactTypeSearch: string;
...@@ -112,7 +113,7 @@ export class ContactsGroupAdministrationComponent implements OnInit { ...@@ -112,7 +113,7 @@ export class ContactsGroupAdministrationComponent implements OnInit {
this.http.get(this.coreUrl + 'rest/contactsGroups/' + params['id']) this.http.get(this.coreUrl + 'rest/contactsGroups/' + params['id'])
.subscribe((data: any) => { .subscribe((data: any) => {
this.contactsGroup = data.contactsGroup; this.contactsGroup = data.contactsGroup;
this.nbContact = this.contactsGroup.nbContacts;
setTimeout(() => { setTimeout(() => {
this.dataSourceAdded = new MatTableDataSource(this.contactsGroup.contacts); this.dataSourceAdded = new MatTableDataSource(this.contactsGroup.contacts);
this.dataSourceAdded.paginator = this.paginatorAdded; this.dataSourceAdded.paginator = this.paginatorAdded;
......
...@@ -40,8 +40,9 @@ class ContactGroupController ...@@ -40,8 +40,9 @@ class ContactGroupController
} }
$contactsGroups[$key]['position'] = $key; $contactsGroups[$key]['position'] = $key;
$contactsGroups[$key]['labelledOwner'] = UserModel::getLabelledUserById(['id' => $contactsGroup['owner']]); $contactsGroups[$key]['labelledOwner'] = UserModel::getLabelledUserById(['id' => $contactsGroup['owner']]);
$contactsGroups[$key]['nbContacts'] = ContactGroupController::getFormattedListById(['id' => $contactsGroup['id']])['nbContacts'];
} }
return $response->withJson(['contactsGroups' => array_values($contactsGroups)]); return $response->withJson(['contactsGroups' => array_values($contactsGroups)]);
} }
...@@ -58,7 +59,9 @@ class ContactGroupController ...@@ -58,7 +59,9 @@ class ContactGroupController
} }
$contactsGroup['labelledOwner'] = UserModel::getLabelledUserById(['id' => $contactsGroup['owner']]); $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]); return $response->withJson(['contactsGroup' => $contactsGroup]);
} }
...@@ -264,7 +267,7 @@ class ContactGroupController ...@@ -264,7 +267,7 @@ class ContactGroupController
} }
} }
return ['list' => $contacts]; return ['list' => $contacts, 'nbContacts' => count($contacts)];
} }
public static function getFormattedContact(array $aArgs) public static function getFormattedContact(array $aArgs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment