Skip to content

Commit

Permalink
circulation: fix several issues
Browse files Browse the repository at this point in the history
* Adds space between patron lastname and firstname.
* Trims barcode entererd in search input.
* Changes message when a checkout is done on an item that is already on loan.
* Displays action performed in checkin view.
* Adds space between 'no loan' message an table.
* Corrects destination display for in transit items.
* Closes rero/rero-ils#790.
* Closes rero/rero-ils#789.
* Closes rero/rero-ils#791.
* Closes rero/rero-ils#792.
* Closes rero/rero-ils#799.
* Closes rero/rero-ils#769.

Co-Authored-by: Alicia Zangger <alicia.zangger@rero.ch>
  • Loading branch information
Alicia Zangger committed Feb 26, 2020
1 parent bd85eb5 commit 9303e49
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class CheckoutComponent implements OnInit {
if (!searchText) {
return null;
}
this.searchText = searchText;
this.searchText = searchText.trim();
this.getPatronOrItem(searchText);
}

Expand All @@ -102,7 +102,7 @@ export class CheckoutComponent implements OnInit {
item.location.organisation.pid !==
this.loggedUser.library.organisation.pid
) {
this.toastService.warning(
this.toastService.error(
this.translate.instant('Item or patron not found!'),
this.translate.instant('Checkin')
);
Expand Down
34 changes: 28 additions & 6 deletions projects/admin/src/app/circulation/item/item.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,30 @@
class="row p-2 mb-1 border rounded align-middle"
*ngIf="item">
<!-- BARCODE -->
<div class="col-lg-3">
<button *ngIf="item.loan || totalAmountOfFee || item.pending_loans || notifications$" type="button" class="pl-0 pt-0 btn" (click)="isCollapsed = !isCollapsed" [attr.aria-expanded]="!isCollapsed"
<div class="col-lg-2">
<button *ngIf="item.loan || totalAmountOfFee || item.pending_loans || notifications$" type="button"
class="pl-0 pt-0 btn" (click)="isCollapsed = !isCollapsed" [attr.aria-expanded]="!isCollapsed"
aria-controls="collapse">
<i [ngClass]="{ 'fa-caret-down': !isCollapsed, 'fa-caret-right': isCollapsed }" class="fa" aria-hidden="true"></i>
</button>
<a [routerLink]="['/records','items','detail', item.pid]">{{ item.barcode }}</a>
</div>
<!-- TITLE -->
<div class="col-lg-6"><a
<div class="col-lg-4"><a
[routerLink]="['/records','documents','detail', item.document.pid]">{{ item.document.title | truncateText: 12 }}</a>
</div>
<!-- CIRCULATION INFO -->
<div class="col-lg-3">
<div class="col-lg-4">
<ul class="list-unstyled mb-0">
<ng-container [ngSwitch]="item.status">
<li *ngSwitchCase="'on_loan'">{{ item.status | translate }} <i class="fa fa-arrow-right" aria-hidden="true"></i>
{{ item.loan.dueDate | dateTranslate :'shortDate' }}</li>
<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 }}
<ng-container *ngIf="item.loan && item.loan.state === 'ITEM_IN_TRANSIT_FOR_PICKUP'"> - {{ location.metadata.pickup_name }}</ng-container>)
<ng-container *ngIf="item.loan && item.loan.state === 'ITEM_IN_TRANSIT_FOR_PICKUP'; else toHouse"> {{ location.metadata.pickup_name }}</ng-container>
<ng-template #toHouse> {{ location.metadata.library.pid | getRecord: 'libraries' : 'field' : 'name' | async }}</ng-template>
)
</ng-container>
</li>
<li *ngSwitchCase="'on_shelf'">{{ item.status | translate }}</li>
Expand All @@ -63,6 +65,26 @@
</li>
</ul>
</div>
<!-- ACTION DONE -->
<div class="col-lg-2">
<ng-container *ngIf="item.actionDone" [ngSwitch]="item.actionDone">
<ng-container *ngSwitchCase="checkin">
<i class="fa fa-arrow-circle-o-down text-success align-baseline" aria-hidden="true"></i>
<span class="align-baseline ml-1">{{ item.actionDone | translate }}</span>
</ng-container>
<ng-container *ngSwitchCase="checkout">
<i class="fa fa-arrow-circle-o-right text-success align-baseline" aria-hidden="true"></i>
<span class="align-baseline ml-1">{{ item.actionDone | translate }}</span>
</ng-container>
<ng-container *ngSwitchCase="extendLoan">
<i class="fa fa-refresh text-success align-baseline" aria-hidden="true"></i>
<span class="align-baseline ml-1" translate>renew</span>
</ng-container>
<ng-container *ngSwitchDefault>
<span class="align-baseline">{{ item.actionDone | translate }}</span>
</ng-container>
</ng-container>
</div>
<!-- COLLAPSED DETAILS -->
<div class="col-sm-6 mt-2">
<ul class="list-unstyled mb-0" id="collapse" [collapse]="isCollapsed" [isAnimated]="true">
Expand Down
11 changes: 10 additions & 1 deletion projects/admin/src/app/circulation/item/item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { RecordService } from '@rero/ng-core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { OrganisationService } from '../../service/organisation.service';
import { Item, LoanState } from '../items';
import { Item, ItemAction, LoanState } from '../items';

@Component({
selector: 'admin-item',
Expand All @@ -46,6 +46,15 @@ export class ItemComponent implements OnInit {
/** Notifications related to the current loan */
notifications$: Observable<any>;

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

/** Checkin item action */
checkin = ItemAction.checkin;

/** Checkout item action */
checkout = ItemAction.checkout;

/**
* Constructor
* @param recordService: Record Service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@
 along with this program. If not, see <http://www.gnu.org/licenses/>.
-->

<div *ngIf="checkedOutItems && checkedOutItems.length === 0 && patron">
<div class="mb-2" *ngIf="checkedOutItems && checkedOutItems.length === 0 && patron">
<span translate>No loan for the current patron.</span>
</div>
<div *ngIf="(checkedOutItems && checkedOutItems.length > 0) || (checkedInItems && checkedInItems.length > 0)">
<!-- HEADER -->
<div class="row mb-1 align-items-center">
<div class="col mr-1 d-none d-lg-block">
<div class="row p-2 bg-dark rounded text-light">
<div class="col-lg-3" translate>Item</div>
<div class="col-lg-6" translate>Document</div>
<div class="col-lg-3" translate>Circulation info</div>
<div class="col-lg-2" translate>Item</div>
<div class="col-lg-4" translate>Document</div>
<div class="col-lg-4" translate>Circulation info</div>
<div class="col-lg-2">&nbsp;</div>
</div>
</div>
<!-- RENEW ALL -->
Expand All @@ -47,28 +48,10 @@
</div>
<div *ngIf="patron" class="col-md-2 text-left pl-0 mb-2">
<!-- EXTEND LOAN -->
<button id="button-basic" class="btn btn-secondary btn-sm mr-1 d-md-block" type="button"
<button id="button-basic" class="btn btn-secondary mr-1 d-md-block" type="button"
[disabled]="!item.actions.includes(extendLoan)" (click)="extendLoanClick($event, item)" translate>
extend_loan
Renew
</button>
<!-- ACTION DONE -->
<ng-container *ngIf="item.actionDone" [ngSwitch]="item.actionDone">
<ng-container *ngSwitchCase="checkin">
<i class="fa fa-arrow-circle-o-down text-success align-baseline" aria-hidden="true"></i>
<span class="align-baseline ml-1">{{ item.actionDone | translate }}</span>
</ng-container>
<ng-container *ngSwitchCase="checkout">
<i class="fa fa-arrow-circle-o-right text-success align-baseline" aria-hidden="true"></i>
<span class="align-baseline ml-1">{{ item.actionDone | translate }}</span>
</ng-container>
<ng-container *ngSwitchCase="extendLoan">
<i class="fa fa-refresh text-success align-baseline" aria-hidden="true"></i>
<span class="align-baseline ml-1" translate>renew</span>
</ng-container>
<ng-container *ngSwitchDefault>
<span class="align-baseline">{{ item.actionDone | translate }}</span>
</ng-container>
</ng-container>
</div>
</div>
<!-- CHECKED IN ITEMS : RED BORDER FOR TRANSIT, REQUEST OR FEE | GREYED BY DEFAULT-->
Expand All @@ -77,21 +60,5 @@
<admin-item [patron]="patron" [item]="item" (hasFeesEmitter)="hasFees($event)">
</admin-item>
</div>
<div *ngIf="patron" class="col-md-2">
<!-- ACTION DONE -->
<div *ngIf="item.actionDone">
<div [ngSwitch]="item.actionDone">
<div *ngSwitchCase="'checkin'"><i class="fa fa-arrow-circle-o-down text-success align-middle"
aria-hidden="true"></i><span class="align-middle ml-1">{{ item.actionDone | translate }}</span>
</div>
<div *ngSwitchCase="'checkout'"><i class="fa fa-arrow-circle-o-righttext-success align-middle"
aria-hidden="true"></i><span class="align-middle ml-1">{{ item.actionDone | translate }}</span>
</div>
<div *ngSwitchCase="'extend_loan'"><i class="fa fa-refresh text-success align-middle"
aria-hidden="true"></i><span class="align-middle ml-1" translate>renew</span></div>
<div *ngSwitchDefault><span class="align-middle">{{ item.actionDone | translate }}</span></div>
</div>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
import { User } from '../../class/user';
import { ItemAction } from '../items';


@Component({
selector: 'admin-circulation-items-list',
templateUrl: './items-list.component.html'
Expand Down Expand Up @@ -47,12 +46,6 @@ export class ItemsListComponent {
/** Extend loan item action */
extendLoan = ItemAction.extend_loan;

/** Checkin item action */
checkin = ItemAction.checkin;

/** Checkout item action */
checkout = ItemAction.checkout;

/** Constructor */
constructor(
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
<div class="col-md-10">
<h3>
<a [routerLink]="['/records', 'patrons','detail', patron.pid]">
<span *ngIf="patron.last_name">{{ patron.last_name }},</span>
<span *ngIf="patron.first_name">{{ patron.first_name }} </span>
<span *ngIf="patron.last_name">{{ patron.last_name }}</span>
<span *ngIf="patron.first_name">, {{ patron.first_name }} </span>
</a>
</h3>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class LoanComponent implements OnInit {
if (!searchText) {
return null;
}
this.searchText = searchText;
this.searchText = searchText.trim();
this.getItem(searchText);
}

Expand All @@ -106,7 +106,7 @@ export class LoanComponent implements OnInit {
this.itemsService.getItem(barcode, this.patron.pid).subscribe(
newItem => {
if (newItem === null) {
this.toastService.warning(
this.toastService.error(
this.translate.instant('Item not found'),
this.translate.instant('Checkout')
);
Expand All @@ -122,8 +122,8 @@ export class LoanComponent implements OnInit {
this.searchInputFocus = true;
} else {
if (newItem.pending_loans && newItem.pending_loans[0].patron_pid !== this.patron.pid) {
this.toastService.warning(
this.translate.instant('The item has a request'),
this.toastService.error(
this.translate.instant('Checkout impossible: the item is requested by another patron'),
this.translate.instant('Checkout')
);
this.searchText = '';
Expand Down
6 changes: 3 additions & 3 deletions projects/admin/src/app/translate/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"Checkout duration must be great than 1.": "Ausleihdauer muss grösser als 1 sein.",
"Checkout duration must be greater than 0.": "Ausleihdauer muss grösser als 0 sein.",
"Checkout duration must be greater than 1.": "Ausleihdauer muss grösser als 1 sein.",
"Checkout impossible: the item is requested by another patron": "Checkout impossible: the item is requested by another patron",
"Checkout is not allowed by circulation policy": "Ausleihe ist von der Ausleihpolitik nicht erlaubt",
"Circulation": "Ausleihe",
"Circulation Policy": "Ausleihpolitik",
Expand Down Expand Up @@ -178,6 +179,7 @@
"Record Updated!": "Datensatz aktualisiert!",
"Record created!": "Datensatz erstellt!",
"Reminder fee amount": "Betrag der Erinnerungsgebühren",
"Renew": "Verlängern",
"Renew all": "Alle verlängern",
"Renewal": "Verlängerung",
"Renewal duration": "Verlängerungsdauer",
Expand Down Expand Up @@ -208,7 +210,6 @@
"TVA rate": "MwSt.",
"The default record cannot be deleted": "Der Standarddatensatz kann nicht gelöscht werden",
"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 ",
Expand Down Expand Up @@ -265,7 +266,6 @@
"due_soon": "Ablauf der Ausleihfrist",
"ebook": "E-Book",
"excluded": "ausgeschlossen",
"extend_loan": "verlängern",
"friday": "Freitag",
"has # acquisition accounts attached": "hat # Konten angehängt",
"has # acquisition order lines attached": "hat # Bestellzeilen angehängt",
Expand Down Expand Up @@ -355,4 +355,4 @@
"wednesday": "Mittwoch",
"week": "Woche",
"year": "Jahr"
}
}
4 changes: 2 additions & 2 deletions projects/admin/src/app/translate/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"Checkout duration must be great than 1.": "Checkout duration must be greater than 1.",
"Checkout duration must be greater than 0.": "Checkout duration must be greater than 0.",
"Checkout duration must be greater than 1.": "Checkout duration must be greater than 1.",
"Checkout impossible: the item is requested by another patron": "Checkout impossible: the item is requested by another patron",
"Checkout is not allowed by circulation policy": "Checkout is not allowed by circulation policy",
"Circulation": "Circulation",
"Circulation Policy": "Circulation Policy",
Expand Down Expand Up @@ -178,6 +179,7 @@
"Record Updated!": "Record Updated!",
"Record created!": "Record created!",
"Reminder fee amount": "Reminder fee amount",
"Renew": "Renew",
"Renew all": "Renew all",
"Renewal": "Renewal",
"Renewal duration": "Renewal duration",
Expand Down Expand Up @@ -208,7 +210,6 @@
"TVA rate": "VAT rate",
"The default record cannot be deleted": "The default record cannot be deleted",
"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 ",
Expand Down Expand Up @@ -265,7 +266,6 @@
"due_soon": "loan expiry notice",
"ebook": "ebook",
"excluded": "excluded",
"extend_loan": "renew",
"friday": "Friday",
"has # acquisition accounts attached": "has # accounts attached",
"has # acquisition order lines attached": "has # acquisition order lines attached",
Expand Down
4 changes: 2 additions & 2 deletions projects/admin/src/app/translate/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"Checkout duration must be great than 1.": "Checkout duration must be great than 1.",
"Checkout duration must be greater than 0.": "Checkout duration must be greater than 0.",
"Checkout duration must be greater than 1.": "Checkout duration must be greater than 1.",
"Checkout impossible: the item is requested by another patron": "Checkout impossible: the item is requested by another patron",
"Checkout is not allowed by circulation policy": "Checkout is not allowed by circulation policy",
"Circulation": "Circulation",
"Circulation Policy": "Circulation Policy",
Expand Down Expand Up @@ -178,6 +179,7 @@
"Record Updated!": "Record Updated!",
"Record created!": "Record created!",
"Reminder fee amount": "Reminder fee amount",
"Renew": "Renew",
"Renew all": "Renew all",
"Renewal": "Renewal",
"Renewal duration": "Renewal duration",
Expand Down Expand Up @@ -208,7 +210,6 @@
"TVA rate": "TVA rate",
"The default record cannot be deleted": "The default record cannot be deleted",
"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 ",
Expand Down Expand Up @@ -265,7 +266,6 @@
"due_soon": "due_soon",
"ebook": "ebook",
"excluded": "excluded",
"extend_loan": "extend_loan",
"friday": "friday",
"has # acquisition accounts attached": "has # acquisition accounts attached",
"has # acquisition order lines attached": "has # acquisition order lines attached",
Expand Down
6 changes: 3 additions & 3 deletions projects/admin/src/app/translate/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"Checkout duration must be great than 1.": "La duración de préstamo tiene que ser más de 1.",
"Checkout duration must be greater than 0.": "La duración de préstamo tiene que ser más de 0.",
"Checkout duration must be greater than 1.": "La duración de préstamo tiene que ser más de 1.",
"Checkout impossible: the item is requested by another patron": "Checkout impossible: the item is requested by another patron",
"Checkout is not allowed by circulation policy": "El préstamo no está permitido por la política de circulación",
"Circulation": "Circulación",
"Circulation Policy": "Política de circulación",
Expand Down Expand Up @@ -178,6 +179,7 @@
"Record Updated!": "¡El recurso ha sido actualizado!",
"Record created!": "¡El recurso ha sido creado!",
"Reminder fee amount": "El monto de la tasa del recordatorio",
"Renew": "Renovar préstamo",
"Renew all": "Renovar todo",
"Renewal": "Renovación",
"Renewal duration": "Duración de la renovación",
Expand Down Expand Up @@ -208,7 +210,6 @@
"TVA rate": "IVA",
"The default record cannot be deleted": "El registro predeterminado no se puede suprimir",
"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",
Expand Down Expand Up @@ -265,7 +266,6 @@
"due_soon": "aviso de vencimiento",
"ebook": "libro electrónico",
"excluded": "excluido",
"extend_loan": "renovar préstamo",
"friday": "Viernes",
"has # acquisition accounts attached": "tiene # cuentas adjuntas",
"has # acquisition order lines attached": "tiene # líneas de pedido adjuntas",
Expand Down Expand Up @@ -355,4 +355,4 @@
"wednesday": "Miercóles",
"week": "semana",
"year": "año"
}
}
Loading

0 comments on commit 9303e49

Please sign in to comment.