import {Component, Input} from '@angular/core'; import {PAIAFee} from '../../../types'; import {SCArticle, SCBook, SCPeriodical} from '@openstapps/core'; import {LibraryAccountService} from '../../library-account.service'; @Component({ selector: 'stapps-fee-item', templateUrl: './fee-item.html', styleUrls: ['./fee-item.scss'], }) export class FeeItemComponent { _fee: PAIAFee; book?: SCBook | SCPeriodical | SCArticle; hasEdition = false; @Input() set fee(fee: PAIAFee) { this.hasEdition = !fee.edition?.includes('null'); this._fee = fee; if (this.hasEdition) { this.libraryAccountService .getDocumentFromHDS(fee.edition as string) .then(book => { this.book = book; }); } } get fee() { return this._fee; } propertiesToShow: (keyof PAIAFee)[] = ['about', 'date', 'amount']; constructor(private readonly libraryAccountService: LibraryAccountService) {} }