Files
openstapps/src/app/modules/library/account/elements/fee-item/fee-item.component.ts
2022-11-21 11:52:33 +00:00

39 lines
948 B
TypeScript

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) {}
}