import { Component, OnInit } from '@angular/core'; import { PriceService } from 'src/app/shared/services/price.service'; import { common, TournamentPriceBand } from 'tournee.businesslogic'; @Component({ selector: 'app-pricing', templateUrl: './pricing.component.html', styleUrls: ['./pricing.component.css'], providers: [PriceService] }) export class PricingComponent implements OnInit { isWorking: boolean = false; Prices: Array = []; attendance: number; calculated_fee: number = null; constructor(private prices: PriceService) { } ngOnInit() { this.prices.get() .then((result) => { this.Prices = result.result.map((p) => { return new TournamentPriceBand(p); }); this.isWorking = false; }) .catch((err) => { console.log(err); this.isWorking = false; }); } calculate_fee() { this.calculated_fee = common.calculate_fee(this.attendance, this.Prices); }; }