From abb9cc75e166c32cfa97244c497e6a69d14ea114 Mon Sep 17 00:00:00 2001
From: César Calvo <ccalvo@curisit.net>
Date: Wed, 15 Mar 2017 15:32:23 +0000
Subject: [PATCH] Merge branch 'angular2' of https://git.curisit.net/gitblit/git/common/securis into angular2

---
 securis/src/main/webapp/src/app/pack.list.component.ts |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/securis/src/main/webapp/src/app/pack.list.component.ts b/securis/src/main/webapp/src/app/pack.list.component.ts
index 0af18bb..7df79ab 100644
--- a/securis/src/main/webapp/src/app/pack.list.component.ts
+++ b/securis/src/main/webapp/src/app/pack.list.component.ts
@@ -1,11 +1,13 @@
 import { Router } from '@angular/router';
-import { MdDialog } from '@angular/material';
+import { MdDialog, MdDialogConfig } from '@angular/material';
 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 { PacksService } from './resources/packs';
 import { PackFormComponent } from './forms/pack.form.component';
+import { LocaleService } from './common/i18n';
+
 
 var pack_example = { 
   id: 7,
@@ -36,6 +38,11 @@
   renew_valid_period: 0,
 }
 
+const DIALOG_OPTIONS : MdDialogConfig = {
+  height: '80%', // can be px or %
+  width: '45%', // can be px or %
+}
+
 @Component({
   selector: 'pack-list',
   templateUrl: 'src/app/pack.list.component.html'
@@ -58,7 +65,7 @@
   fromRow: number = 1;
   currentPage: number = 1;
   pageSize: number = 10;
-  sortBy: string = 'application_name';
+  sortBy: string = 'code';
   sortOrder: TdDataTableSortingOrder = TdDataTableSortingOrder.Descending;
   filteredItems = this.data.length;
   pack_menu_options : any[] = [{
@@ -81,6 +88,7 @@
     private media: TdMediaService,
     private router: Router,
     private dialog: MdDialog,
+    private $L: LocaleService,
     private packForm: PackFormComponent,
     private packs: PacksService) {
       this.packs.get().subscribe(
@@ -97,10 +105,7 @@
   }
 
   createPack() : void {
-    var ref = this.dialog.open(PackFormComponent, {
-      height: '50%', // can be px or %
-      width: '40%', // can be px or %
-    });
+    var ref = this.dialog.open(PackFormComponent, DIALOG_OPTIONS);
     ref.componentInstance.isNew = true;
     ref.afterClosed().subscribe(result => {
       console.log(result);
@@ -113,10 +118,7 @@
   }
 
   editPack(pack: any) : void {
-    var ref = this.dialog.open(PackFormComponent, {
-      height: '70%', // can be px or %
-      width: '40%', // can be px or %
-    });
+    var ref = this.dialog.open(PackFormComponent, DIALOG_OPTIONS);
     ref.componentInstance.isNew = false;
     ref.componentInstance.data = pack;
     ref.afterClosed().subscribe(result => {
@@ -127,7 +129,7 @@
 
 
   sort(sortEvent: ITdDataTableSortChangeEvent): void {
-    this.sortBy = sortEvent.name;
+    this.sortBy = sortEvent.name === 'used_licenses' ? 'num_available' : sortEvent.name;
     this.sortOrder = sortEvent.order;
     this.filter();
   }

--
Gitblit v1.3.2