@propmix/profet-common-header 3.0.13-unstable → 3.0.14-unstable

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -519,19 +519,21 @@ class HeaderComponent {
519
519
  getCompanyList() {
520
520
  this._headerSer.getCompanyList().subscribe({
521
521
  next: (v) => {
522
- this._headerSer.setCompanyList(v);
523
- this.companyList = v;
524
- this.selectCurrentCompany();
525
- this.patchCurrentCompanyInfo();
526
- this.filteredOptions = [...this.companyList];
527
- this.searchControl.valueChanges.subscribe((searchTerm) => {
528
- if (searchTerm) {
529
- this.filteredOptions = this.companyList.filter((opt) => opt.name?.toLowerCase().includes(searchTerm.toLowerCase()));
530
- }
531
- else {
532
- this.filteredOptions = [...this.companyList];
533
- }
534
- });
522
+ if (v?.length > 0) {
523
+ this.companyList = v.filter((c) => !!c.name).sort((a, b) => a.name?.localeCompare(b.name));
524
+ this._headerSer.setCompanyList(this.companyList);
525
+ this.selectCurrentCompany();
526
+ this.patchCurrentCompanyInfo();
527
+ this.filteredOptions = [...this.companyList];
528
+ this.searchControl.valueChanges.subscribe((searchTerm) => {
529
+ if (searchTerm) {
530
+ this.filteredOptions = this.companyList.filter((opt) => opt.name?.toLowerCase().includes(searchTerm.toLowerCase()));
531
+ }
532
+ else {
533
+ this.filteredOptions = [...this.companyList];
534
+ }
535
+ });
536
+ }
535
537
  }
536
538
  });
537
539
  }