fix: library fines should load item title only if needed

Closes #342
This commit is contained in:
Jovan Krunić
2022-11-18 11:21:44 +01:00
committed by Rainer Killinger
parent f60a228392
commit cbb949e397
2 changed files with 23 additions and 13 deletions

View File

@@ -13,14 +13,19 @@ export class FeeItemComponent {
book?: SCBook | SCPeriodical | SCArticle; book?: SCBook | SCPeriodical | SCArticle;
hasEdition = false;
@Input() @Input()
set fee(fee: PAIAFee) { set fee(fee: PAIAFee) {
this.hasEdition = !fee.edition?.includes('null');
this._fee = fee; this._fee = fee;
this.libraryAccountService if (this.hasEdition) {
.getDocumentFromHDS(fee.edition as string) this.libraryAccountService
.then(book => { .getDocumentFromHDS(fee.edition as string)
this.book = book; .then(book => {
}); this.book = book;
});
}
} }
get fee() { get fee() {

View File

@@ -1,13 +1,18 @@
<ion-item> <ion-item>
<ion-label class="ion-text-wrap"> <ion-label class="ion-text-wrap">
<h2 *ngIf="book; else loading" class="name"> <ng-container *ngIf="hasEdition">
{{ 'library.account.pages.fines.labels.edition' | translate }}: <h2 *ngIf="book; else loading" class="name">
{{ book.name }} {{ 'library.account.pages.fines.labels.edition' | translate }}:
</h2> {{ book.name }}
<ng-template #loading </h2>
><h2> <ng-template #loading
<ion-skeleton-text animated style="width: 80%"></ion-skeleton-text></h2 ><h2>
></ng-template> <ion-skeleton-text
animated
style="width: 80%"
></ion-skeleton-text></h2
></ng-template>
</ng-container>
<ng-container *ngFor="let property of propertiesToShow"> <ng-container *ngFor="let property of propertiesToShow">
<p *ngIf="fee[property]"> <p *ngIf="fee[property]">
{{ 'library.account.pages.fines.labels' + '.' + property | translate }}: {{ 'library.account.pages.fines.labels' + '.' + property | translate }}: