import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { PaymentTableType } from '@core/typings/budget.typing'; import { PaymentTopLevelStats } from '@core/typings/payment.typing'; import { AwardResources } from '@features/awards/award.resources'; import { ProgramService } from '@features/programs/program.service'; import { I18nService } from '@yourcause/common/i18n'; @Component({ selector: 'gc-payments-tab', templateUrl: './payments-tab.component.html', styleUrls: ['./payments-tab.component.scss'] }) export class PaymentsTabComponent implements OnInit { id: number; paymentTopLevelStats: PaymentTopLevelStats; totalAwardsString: string; totalApplicationsString: string; PaymentTableType = PaymentTableType; constructor ( private activatedRoute: ActivatedRoute, private i18n: I18nService, private awardResources: AwardResources, private programService: ProgramService ) { } get cycleIds () { return this.programService.currentProgramDashCycleIds; } async ngOnInit () { this.id = this.activatedRoute.snapshot.parent.params.id; this.paymentTopLevelStats = await this.awardResources.getPaymentStats( +this.id, this.cycleIds ); this.totalAwardsString = this.i18n.translate( 'common:textNumberOfAwards', { number: this.paymentTopLevelStats.numberOfAwards }, '__number__ awards' ); this.totalApplicationsString = this.i18n.translate( 'common:textNumberOfApplications', { number: this.paymentTopLevelStats.numberOfApplications }, '__number__ applications' ); } }