César Calvo
2017-03-14 9594a7964afd06d1cde4bff1e015293de90a7694
securis/src/main/webapp/src/app/resources/packs.ts
....@@ -2,6 +2,7 @@
22 import { Injectable } from '@angular/core';
33 import { Http, RequestOptions } from '@angular/http';
44 import { SeCurisResourceServices } from './base';
5
+import { LocaleService } from '../common/i18n';
56
67 var pack_example = {
78 id: 7,
....@@ -40,14 +41,6 @@
4041 CANCELLED: 'CA'
4142 }
4243
43
-export const PACK_STATUSES = {
44
- 'CR': 'Created',
45
- 'AC': 'Active',
46
- 'OH': 'On Hold',
47
- 'EX': 'Expired',
48
- 'CA': 'Cancelled'
49
- };
50
-
5144 export const COLORS_BY_STATUS = {
5245 'CR': '#808080',
5346 'AC': '#329e5a',
....@@ -67,7 +60,7 @@
6760
6861 @Injectable()
6962 export class PacksService extends SeCurisResourceServices {
70
- constructor(http: Http) {
63
+ constructor(http: Http, private $L: LocaleService) {
7164 super(http, 'pack');
7265 }
7366
....@@ -88,5 +81,9 @@
8881 return pack && validStatuses && validStatuses.indexOf(pack.status) !== -1;
8982 }
9083
84
+ getStatusName(statusCode: string): string {
85
+ return this.$L.get(`pack.status.${statusCode}`, this.$L.get('Unknown'));
86
+ }
87
+
9188 }
9289