import { Component, Input, OnChanges } from '@angular/core'; import { ApplicantTopLevelStats } from '@core/typings/applicant.typing'; import { ApplicantManagerResources } from '@features/applicant/applicant-manager.resources'; import { I18nService } from '@yourcause/common/i18n'; @Component({ selector: 'gc-applicant-top-level-block', templateUrl: './applicant-top-level-block.component.html', styleUrls: ['./applicant-top-level-block.component.scss'] }) export class ApplicantTopLevelBlockComponent implements OnChanges { @Input() cycleIds: number[] = []; applicantTopLevelStats: ApplicantTopLevelStats; totalApplicationsString: string; totalAwardsString: string; totalPaymentsString: string; constructor ( private i18n: I18nService, private applicantManagerResources: ApplicantManagerResources ) { } async ngOnChanges () { this.applicantTopLevelStats = await this.applicantManagerResources.getApplicantStats( this.cycleIds ); this.totalApplicationsString = this.i18n.translate( 'common:textNumberOfApplications', { number: this.applicantTopLevelStats.numberOfApplications }, '__number__ applications' ); this.totalAwardsString = this.i18n.translate( 'common:textNumberOfAwards', { number: this.applicantTopLevelStats.numberOfAwards }, '__number__ awards' ); this.totalPaymentsString = this.i18n.translate( 'common:textNumberOfPayments', { number: this.applicantTopLevelStats.numberOfPayments }, '__number__ payments' ); } }