-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(item): add fees on item detail view
* Adds fees on item detail view. * Changes patron link on fees brief view to redirect to the patron circulation fees tab. * Closes rero/rero-ils#3578. Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
- Loading branch information
1 parent
c4e3726
commit eef0e07
Showing
8 changed files
with
144 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...ects/admin/src/app/record/detail-view/item-detail-view/item-fees/item-fees.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!-- | ||
RERO ILS UI | ||
Copyright (C) 2019-2024 RERO | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, version 3 of the License. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
@if (fees.length > 0) { | ||
<div class="card" id="item-fees"> | ||
<div class="card-header"> | ||
<b translate>Fees</b> | ||
<div class="float-right"> | ||
<span class="font-weight-bold mr-2" translate>Total</span> | ||
<span class="badge badge-danger ml-1">{{ total | currency: organisation.default_currency }}</span> | ||
</div> | ||
</div> | ||
<div class="card-body"> | ||
<div class="row mb-2"> | ||
<div class="col-10 font-weight-bold" translate>Patron</div> | ||
<div class="col-2 font-weight-bold text-right" translate>Amount</div> | ||
</div> | ||
@for (fee of fees; track fee) { | ||
@if (fee.metadata.patron.pid | getRecord:'patrons' | async; as patron) { | ||
<div class="row mb-2"> | ||
<div class="col-10"> | ||
<a [routerLink]="['/circulation', 'patron', $any(patron).metadata.patron.barcode[0], 'fees']" [queryParams]="{event: fee.metadata.pid}"> | ||
{{ $any(patron).metadata.last_name }} {{ $any(patron).metadata.first_name }} ({{ $any(patron).metadata.patron.barcode[0] }}) | ||
</a> | ||
</div> | ||
<div class="col-2 text-right">{{ fee.metadata.total_amount | currency: organisation.default_currency }}</div> | ||
</div> | ||
} | ||
} | ||
</div> | ||
</div> | ||
} |
61 changes: 61 additions & 0 deletions
61
projects/admin/src/app/record/detail-view/item-detail-view/item-fees/item-fees.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* RERO ILS UI | ||
* Copyright (C) 2019-2024 RERO | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, version 3 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { PatronTransactionApiService } from '@app/admin/api/patron-transaction-api.service'; | ||
import { OrganisationService } from '@app/admin/service/organisation.service'; | ||
import { tap } from 'rxjs'; | ||
|
||
@Component({ | ||
selector: 'admin-item-fees', | ||
templateUrl: './item-fees.component.html' | ||
}) | ||
export class ItemFeesComponent implements OnInit { | ||
|
||
/** Item pid */ | ||
@Input() itemPid: string; | ||
|
||
/** Fees */ | ||
fees: any[] = []; | ||
|
||
/** Total fees */ | ||
total: number = 0; | ||
|
||
/** | ||
* Get the current organisation | ||
* @return Organisation | ||
*/ | ||
get organisation() { | ||
return this.organisationService.organisation; | ||
} | ||
|
||
/** | ||
* Constructor | ||
* @param patronTransactionApiService - PatronTransactionApiService | ||
* @param organisationService - OrganisationService | ||
*/ | ||
public constructor( | ||
private patronTransactionApiService: PatronTransactionApiService, | ||
private organisationService: OrganisationService | ||
) {} | ||
|
||
/** OnInit hook */ | ||
ngOnInit(): void { | ||
this.patronTransactionApiService.getActiveFeesByItemPid(this.itemPid) | ||
.pipe(tap((fees: any) => fees.map((fee: any) => this.total += fee.metadata.total_amount))) | ||
.subscribe((fees: any) => this.fees = fees); | ||
} | ||
} |