Joaquín Reñé
4 hours ago c5b1e27a77081717f37942de8dacfa5c2e30b09d
securis/src/main/webapp/src/app/forms/pack.form.component.ts
....@@ -10,6 +10,7 @@
1010 import { TdMediaService } from '@covalent/core';
1111 import { IComboOption, FormBase } from './base';
1212 import { ActivatedRoute, Router } from '@angular/router';
13
+import { OrganizationsService } from '../resources/organizations';
1314
1415
1516
....@@ -25,6 +26,7 @@
2526 constructor(private http: Http,
2627 private licenseTypes: LicenseTypesService,
2728 private packs: PacksService,
29
+ private orgService: OrganizationsService,
2830 router: Router,
2931 toaster: ToastsManager,
3032 route: ActivatedRoute,
....@@ -34,18 +36,19 @@
3436 }
3537
3638 loadCombos(): void {
37
- this.http.get('api/organization')
38
- .map(response => response.json().map((org : any) => <IComboOption>{id: org.id, label: `(${org.code}) ${org.name}`}))
39
- .subscribe(
40
- data => super.setViewData(() => this.organizations = (<IComboOption[]>data).sort((e1, e2) => e1.label.localeCompare(e2.label))),
41
- err => console.error('Error loading orgs')
42
- );
39
+ this.orgService.get()
40
+ .map((orgs: any[]) => orgs.map((org: any) => <IComboOption>{id: org.id, label: `(${org.code}) ${org.name}`}))
41
+ .subscribe(
42
+ (data: IComboOption[]) => super.setViewData(() => this.organizations = data.sort((e1: IComboOption, e2: IComboOption) => e1.label.localeCompare(e2.label))),
43
+ (err: any) => console.error('Error loading orgs', err)
44
+ );
45
+
4346 this.licenseTypes.get()
44
- .map(list => list.map((lt : any) => <IComboOption>{id: lt.id, label: `(${lt.code}) ${lt.name}`}))
45
- .subscribe(
46
- data => super.setViewData(() => this.licensetypes = (<IComboOption[]>data).sort((e1, e2) => e1.label.localeCompare(e2.label))),
47
- err => console.error('Error loading license types')
48
- );
47
+ .map((list: any[]) => list.map((lt: any) => <IComboOption>{id: lt.id, label: `(${lt.code}) ${lt.name}`}))
48
+ .subscribe(
49
+ (data: IComboOption[]) => super.setViewData(() => this.licensetypes = data.sort((e1: IComboOption, e2: IComboOption) => e1.label.localeCompare(e2.label))),
50
+ (err: any) => console.error('Error loading license types', err)
51
+ );
4952 }
5053
5154 goLicenses(): void {