taurus-tv/src/app/tsp-info/pra-goals/pra-goals.component.ts

44 lines
945 B
TypeScript
Raw Normal View History

2017-09-06 18:53:31 +02:00
import {Component, Input, OnInit} from '@angular/core';
import {InfoBoxComponent} from "../info-box/info-box.component";
import {PrioValues} from "../shared/prio-values.model";
@Component({
selector: 'app-pra-goals',
templateUrl: './pra-goals.component.html',
styleUrls: [
'../info-box/info-box.component.css',
'./pra-goals.component.css'
]
})
export class PraGoalsComponent extends InfoBoxComponent implements OnInit {
@Input() data: {
core: PrioValues,
sig: PrioValues,
tade: PrioValues
};
constructor() {
super();
}
ngOnInit() {
}
get sumA(): number {
return this.sum('A');
}
get sumB(): number {
return this.sum('B');
}
get sumC(): number {
return this.sum('C');
}
public sum(prio: string) {
return ['core', 'sig', 'tade'].reduce((sum,unit) => sum + this.data[unit][prio], 0);
}
}