diff --git a/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.ts b/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.ts index 9c741cdcf9a3f1fc33137f300b9b0ef0975b7e7c..619eff6e1a117cc481616b4660c4d1fb988768f1 100644 --- a/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.ts +++ b/ui/ui-frontend-common/src/app/modules/components/customer-select-content/customer-select-content.component.ts @@ -34,7 +34,7 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { MenuOption } from '../navbar'; import { CustomerMenuService } from '../navbar/customer-menu/customer-menu.service'; @@ -44,7 +44,7 @@ import { CustomerMenuService } from '../navbar/customer-menu/customer-menu.servi templateUrl: './customer-select-content.component.html', styleUrls: ['./customer-select-content.component.scss'] }) -export class CustomerSelectContentComponent { +export class CustomerSelectContentComponent implements OnInit { @Input() customers: MenuOption[]; @Input() isModalMenu: boolean; @@ -56,6 +56,12 @@ export class CustomerSelectContentComponent { private route: ActivatedRoute, private customerMenuService: CustomerMenuService) { } + ngOnInit(): void { + if (this.customers) { + this.customers.sort((c1, c2) => c1.label.localeCompare(c2.label)); + } + } + selectCustomerId(customerId: string) { if (this.isModalMenu) { this.customerMenuService.sendSelectedCustomerId(customerId);