From 21f06a252048880760054071bc89ec0d0a4b7f9b Mon Sep 17 00:00:00 2001
From: Makhtar DIAGNE <makhtar.diagne@teamdlab.com>
Date: Tue, 5 May 2020 11:48:51 +0200
Subject: [PATCH] [FIX DLAB-3306] Sort subrogations

---
 .../customer-select-content.component.ts               | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

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 9c741cdc..619eff6e 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);
-- 
GitLab