From ac8d1f0e8ab4bab6eb546daa8062a6dad3ab8e23 Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Fri, 10 Mar 2017 11:28:36 +0000
Subject: [PATCH] #3527 fix - Fixed dialog data

---
 securis/src/main/webapp/src/app/forms/pack.form.component.ts |   34 +++++++++++++++++++++++++++++-----
 1 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/securis/src/main/webapp/src/app/forms/pack.form.component.ts b/securis/src/main/webapp/src/app/forms/pack.form.component.ts
index a10a8c6..90c51bd 100644
--- a/securis/src/main/webapp/src/app/forms/pack.form.component.ts
+++ b/securis/src/main/webapp/src/app/forms/pack.form.component.ts
@@ -1,9 +1,11 @@
+import { Http } from '@angular/http';
 import { PacksService } from '../resources/packs';
 import { LocaleService } from '../common/i18n';
 import { TdDataTableService, TdDataTableSortingOrder, ITdDataTableSortChangeEvent, ITdDataTableColumn } from '@covalent/core';
 import { IPageChangeEvent } from '@covalent/core';
 import { Component, AfterViewInit } from '@angular/core';
 import { TdMediaService } from '@covalent/core';
+import { IComboOption } from './base';
 
 @Component({
   selector: 'pack-form',
@@ -11,21 +13,43 @@
 })
 export class PackFormComponent implements AfterViewInit {
 
-  form_title: string = '';
+  form_title: string = 'Title';
   form_subtitle: string = '';
+  organizations : IComboOption[];
+  licensetypes : IComboOption[];
+  data: any = {};
+  isNew : boolean = true;
 
-  constructor(private packs: PacksService,
+  constructor(private http: Http,
+              private packs: PacksService,
               private $L: LocaleService) {
-      this.form_title = $L.get('Pack data');
-      this.form_subtitle = $L.get('Fullfill the pack data and save the changes');
+      
   }
 
+  private loadCombos(): void {
+      this.http.get('organization')
+        .map(response => response.json().map((org : any) => <IComboOption>{id: org.id, label: `(${org.code}) ${org.name}`}))
+        .subscribe(
+          data => this.organizations = data,
+          err => console.error('Error loading orgs')
+        );
+      this.http.get('licensetype')
+        .map(response => response.json().map((lt : any) => <IComboOption>{id: lt.id, label: `(${lt.code}) ${lt.name}`}))
+        .subscribe(
+          data => this.licensetypes = data,
+          err => console.error('Error loading orgs')
+        );
+  }
+
+
   ngOnInit(): void {
+    this.loadCombos();
+    this.data = {};
+    this.form_title = this.$L.get('Pack data');
   }
 
 
   ngAfterViewInit(): void {
-
   }
 }
 

--
Gitblit v1.3.2