import { Component, OnInit } from '@angular/core'; import { PolicyService } from '@core/services/policy.service'; import { ApplicantsPageRow, AppliedNominee } from '@core/typings/applicant.typing'; import { Address, DebounceFactory, PaginationOptions, TableDataFactory, TopLevelFilter } from '@yourcause/common'; import { I18nService } from '@yourcause/common/i18n'; import { ApplicationManagerResources } from '../resources/application-manager.resources'; @Component({ selector: 'gc-nominees-page', templateUrl: './nominees-page.component.html', styleUrls: ['./nominees-page.component.scss'] }) export class NomineesPageComponent implements OnInit { topLevelFilters = [ new TopLevelFilter( 'text', 'fullName', '', this.i18n.translate( 'GLOBAL:textSearchByNomineeNameOrEmail', {}, 'Search by nominee name or email' ), undefined, undefined, [{ column: 'fullName', filterType: 'cn' }, { column: 'email', filterType: 'cn' }] ) ]; tableDataFactory: TableDataFactory = DebounceFactory .createSimple(async (options: PaginationOptions) => { const nominees = await this.applicationManagerResources.getNominees(options); return { success: true, data: { records: nominees.records, recordCount: nominees.recordCount } }; }); hasMaskedPermission = false; constructor ( private applicationManagerResources: ApplicationManagerResources, private i18n: I18nService, private policyService: PolicyService ) { } ngOnInit () { this.hasMaskedPermission = this.policyService.grantApplication .canSeeMaskedApplicants(); } addressObj (row: ApplicantsPageRow): Address { return { address1: row.address, address2: row.address2, city: row.city, postalCode: row.postalCode, countryCode: row.country, stateProvRegCode: row.state }; } }