Skip to content

Commit

Permalink
circulation: display pickup location name when transit for pickup
Browse files Browse the repository at this point in the history
* Displays pickup location name when the item is in transit for pickup.
* Highlights items with action needed in checkin form.
* Adds flash message when the item has fees.
* Closes rero/rero-ils#770.
* Closes rero/rero-ils#783.

Co-Authored-by: Alicia Zangger <alicia.zangger@rero.ch>
  • Loading branch information
Alicia Zangger authored and AoNoOokami committed Feb 25, 2020
1 parent 528ea19 commit bd85eb5
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 19 deletions.
20 changes: 10 additions & 10 deletions projects/admin/src/app/circulation/checkout/checkout.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@
<div class="row">
<div class="col col-md-6 mb-4">
<ng-core-search-input
[placeholder]="placeholder | translate"
[searchText]="searchText"
(search)="searchValueUpdated($event)"
[focus]="searchInputFocus"
></ng-core-search-input>
[placeholder]="placeholder | translate"
[searchText]="searchText"
(search)="searchValueUpdated($event)"
[focus]="searchInputFocus"></ng-core-search-input>
</div>
<div class="col col-md-6 mb-4">
<admin-circulation-patron-detailed
[patron]="patronInfo"
></admin-circulation-patron-detailed>
<admin-circulation-patron-detailed
[patron]="patronInfo">
</admin-circulation-patron-detailed>
</div>
</div>
<div class="row">
<div class="col-md-12">
<admin-circulation-items-list
[checkedInItems]="items"
></admin-circulation-items-list>
[checkedInItems]="items"
(hasFeesEmitter)="hasFees($event)">
</admin-circulation-items-list>
</div>
</div>
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,12 @@ export class CheckoutComponent implements OnInit {
);
}
}
hasFees(event: boolean) {
if (event) {
this.toastService.error(
this.translate.instant('The item has fees'),
this.translate.instant('Checkin')
);
}
}
}
5 changes: 3 additions & 2 deletions projects/admin/src/app/circulation/item/item.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
 along with this program. If not, see <http://www.gnu.org/licenses/>.
-->

<div [ngClass]="{'border-danger': patronLoan && (item.status === 'in_transit' || item.pending_loans || totalAmountOfFee > 0),
<div [ngClass]="{'border-danger': item.actionDone === 'checkin' && (item.status === 'in_transit' || item.pending_loans || totalAmountOfFee > 0),
'text-secondary': item.status !== 'on_loan'}"
class="row p-2 mb-1 border rounded align-middle"
*ngIf="item">
Expand All @@ -40,7 +40,8 @@
<li *ngSwitchCase="'in_transit'">{{ item.status | translate }}
<ng-container *ngIf="getTransitLocationPid(item) | getRecord: 'locations' | async as location">
({{ 'to' | translate }}
{{ location.metadata.library.pid | getRecord: 'libraries' : 'field' : 'name' | async }})
{{ location.metadata.library.pid | getRecord: 'libraries' : 'field' : 'name' | async }}
<ng-container *ngIf="item.loan && item.loan.state === 'ITEM_IN_TRANSIT_FOR_PICKUP'"> - {{ location.metadata.pickup_name }}</ng-container>)
</ng-container>
</li>
<li *ngSwitchCase="'on_shelf'">{{ item.status | translate }}</li>
Expand Down
13 changes: 7 additions & 6 deletions projects/admin/src/app/circulation/item/item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import { Component, Input, OnInit } from '@angular/core';
import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core';
import { RecordService } from '@rero/ng-core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
Expand All @@ -34,6 +34,9 @@ export class ItemComponent implements OnInit {
/** Current patron */
@Input() patron: any;

/** Item has fees */
@Output() hasFeesEmitter = new EventEmitter<boolean>();

/** Is collapsed */
isCollapsed = true;

Expand Down Expand Up @@ -81,14 +84,12 @@ export class ItemComponent implements OnInit {
for (const fee of fees) {
total += fee.metadata.amount;
}
if (total > 0) {
this.hasFeesEmitter.emit(true);
}
return total;
}

/** Check if current item is a patron loan */
get patronLoan(): boolean {
return this.item.status !== 'on_loan' && this.patron;
}

/** Get transit location pid
* @param item: current item
* @return: transit location pid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<!-- CHECKED IN ITEMS : RED BORDER FOR TRANSIT, REQUEST OR FEE | GREYED BY DEFAULT-->
<div class="row align-items-start" *ngFor="let item of checkedInItems">
<div class="col">
<admin-item [patron]="patron" [item]="item">
<admin-item [patron]="patron" [item]="item" (hasFeesEmitter)="hasFees($event)">
</admin-item>
</div>
<div *ngIf="patron" class="col-md-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export class ItemsListComponent {
/** Extend loan event emitter */
@Output() extendLoanClicked = new EventEmitter<any[]>();

/** Item has fees */
@Output() hasFeesEmitter = new EventEmitter<boolean>();

/** Extend loan item action */
extendLoan = ItemAction.extend_loan;

Expand Down Expand Up @@ -82,6 +85,7 @@ export class ItemsListComponent {
* @param event: value received from child component
*/
hasFees(event: boolean) {
this.hasFeesEmitter.emit(event);
return event;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
[patron]="patron"
(extendLoanClicked)="applyItems([$event])"
(extendAllLoansClicked)="applyItems($event)"
(hasFeesEmitter)="hasFees($event)"
></admin-circulation-items-list>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,13 @@ export class LoanComponent implements OnInit {
}
);
}

hasFees(event: boolean) {
if (event) {
this.toastService.error(
this.translate.instant('The item has fees'),
this.translate.instant('Checkin')
);
}
}
}
2 changes: 2 additions & 0 deletions projects/admin/src/app/translate/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
"The item contains requests": "Das Exemplar hat Bestellungen",
"The item has a request": "Das Exemplar hat eine Bestellung",
"The item has been returned from missing": "Das fehlende Exemplar ist jetzt wieder verfügbar",
"The item has fees": "The item has fees",
"The item is ": "Das Exemplar ist ",
"The item is already in the list.": "Das Exemplar ist bereits in der Liste.",
"The item is already on loan": "Das Exemplar ist bereits ausgeliehen.",
Expand Down Expand Up @@ -344,6 +345,7 @@
"sunday": "Sonntag",
"system_librarian": "Systembibliothekar",
"thursday": "Donnerstag",
"to": "to",
"tuesday": "Dienstag",
"unavailable": "nicht verfügbar",
"undefined": "Undefiniert",
Expand Down
2 changes: 2 additions & 0 deletions projects/admin/src/app/translate/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
"The item contains requests": "The item contains requests",
"The item has a request": "The item has a request",
"The item has been returned from missing": "The item has been returned from missing",
"The item has fees": "The item has fees",
"The item is ": "The item is ",
"The item is already in the list.": "The item is already in the list.",
"The item is already on loan": "The item is already on loan",
Expand Down Expand Up @@ -344,6 +345,7 @@
"sunday": "Sunday",
"system_librarian": "System librarian",
"thursday": "Thursday",
"to": "to",
"tuesday": "Tuesday",
"unavailable": "unavailable",
"undefined": "undefined",
Expand Down
2 changes: 2 additions & 0 deletions projects/admin/src/app/translate/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
"The item contains requests": "The item contains requests",
"The item has a request": "The item has a request",
"The item has been returned from missing": "The item has been returned from missing",
"The item has fees": "The item has fees",
"The item is ": "The item is ",
"The item is already in the list.": "The item is already in the list.",
"The item is already on loan": "The item is already on loan",
Expand Down Expand Up @@ -344,6 +345,7 @@
"sunday": "sunday",
"system_librarian": "system_librarian",
"thursday": "thursday",
"to": "to",
"tuesday": "tuesday",
"unavailable": "unavailable",
"undefined": "undefined",
Expand Down
2 changes: 2 additions & 0 deletions projects/admin/src/app/translate/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
"The item contains requests": "El ejemplar tiene reservaciones",
"The item has a request": "El ejemplar tiene una reservación",
"The item has been returned from missing": "El ejemplar faltante está de nuevo disponible",
"The item has fees": "The item has fees",
"The item is ": "El ejemplar es",
"The item is already in the list.": "El ejemplar ya está en la lista.",
"The item is already on loan": "El ejemplar ya está en préstamo",
Expand Down Expand Up @@ -344,6 +345,7 @@
"sunday": "Domingo",
"system_librarian": "bibliotecario de sistema",
"thursday": "Jueves",
"to": "to",
"tuesday": "Martes",
"unavailable": "indisponible",
"undefined": "indefinido",
Expand Down
2 changes: 2 additions & 0 deletions projects/admin/src/app/translate/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
"The item contains requests": "L'exemplaire contient des demandes",
"The item has a request": "L'exemplaire a une demande",
"The item has been returned from missing": "L'exemplaire manquant est à nouveau disponible",
"The item has fees": "The item has fees",
"The item is ": "L'exemplaire est ",
"The item is already in the list.": "L'exemplaire est déjà dans la liste.",
"The item is already on loan": "L'exemplaire est déjà en prêt",
Expand Down Expand Up @@ -344,6 +345,7 @@
"sunday": "dimanche",
"system_librarian": "bibliothécaire système",
"thursday": "jeudi",
"to": "to",
"tuesday": "mardi",
"unavailable": "non disponible",
"undefined": "indéfini",
Expand Down
2 changes: 2 additions & 0 deletions projects/admin/src/app/translate/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
"The item contains requests": "L'esemplare ha delle richieste",
"The item has a request": "The item has a request",
"The item has been returned from missing": "L'esemplare mancante è di nuovo disponibile",
"The item has fees": "The item has fees",
"The item is ": "L'esemplare è ",
"The item is already in the list.": "L'esemplare è già nella lista.",
"The item is already on loan": "The item is already on loan",
Expand Down Expand Up @@ -344,6 +345,7 @@
"sunday": "domenica",
"system_librarian": "bibliotecario del sistema",
"thursday": "giovedì",
"to": "to",
"tuesday": "martedì",
"unavailable": "non è disponibile",
"undefined": "Indefinito",
Expand Down

0 comments on commit bd85eb5

Please sign in to comment.