Skip to content

Commit

Permalink
circulation: fix some 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.
* Closes rero/rero-ils#790.
* Closes rero/rero-ils#789.
* Closes rero/rero-ils#791.
* Closes rero/rero-ils#792.

Co-Authored-by: Alicia Zangger <alicia.zangger@rero.ch>
  • Loading branch information
Alicia Zangger committed Feb 24, 2020
1 parent fe7948a commit ec8ad07
Show file tree
Hide file tree
Showing 13 changed files with 71 additions and 61 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
33 changes: 26 additions & 7 deletions projects/admin/src/app/circulation/item/item.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,22 @@
-->

<div [ngClass]="{'border-danger': patronLoan && (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">
'text-secondary': item.status !== 'on_loan'}" 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>
Expand Down Expand Up @@ -63,6 +62,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 @@ -43,6 +43,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 @@ -23,9 +23,10 @@
<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 Down
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 All @@ -44,12 +43,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,7 +25,7 @@
<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.last_name">{{ patron.last_name }}, </span>
<span *ngIf="patron.first_name">{{ patron.first_name }} </span>
</a>
</h3>
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
7 changes: 4 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 is ": "Das Exemplar ist ",
"The item is already in the list.": "Das Exemplar ist bereits in der Liste.",
Expand Down Expand Up @@ -264,7 +265,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 @@ -344,6 +344,7 @@
"sunday": "Sonntag",
"system_librarian": "Systembibliothekar",
"thursday": "Donnerstag",
"to": "to",
"tuesday": "Dienstag",
"unavailable": "nicht verfügbar",
"undefined": "Undefiniert",
Expand All @@ -353,4 +354,4 @@
"wednesday": "Mittwoch",
"week": "Woche",
"year": "Jahr"
}
}
5 changes: 3 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 is ": "The item is ",
"The item is already in the list.": "The item is already in the list.",
Expand Down Expand Up @@ -264,7 +265,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 Expand Up @@ -344,6 +344,7 @@
"sunday": "Sunday",
"system_librarian": "System librarian",
"thursday": "Thursday",
"to": "to",
"tuesday": "Tuesday",
"unavailable": "unavailable",
"undefined": "undefined",
Expand Down
5 changes: 3 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 is ": "The item is ",
"The item is already in the list.": "The item is already in the list.",
Expand Down Expand Up @@ -264,7 +265,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 Expand Up @@ -344,6 +344,7 @@
"sunday": "sunday",
"system_librarian": "system_librarian",
"thursday": "thursday",
"to": "to",
"tuesday": "tuesday",
"unavailable": "unavailable",
"undefined": "undefined",
Expand Down
7 changes: 4 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 is ": "El ejemplar es",
"The item is already in the list.": "El ejemplar ya está en la lista.",
Expand Down Expand Up @@ -264,7 +265,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 @@ -344,6 +344,7 @@
"sunday": "Domingo",
"system_librarian": "bibliotecario de sistema",
"thursday": "Jueves",
"to": "to",
"tuesday": "Martes",
"unavailable": "indisponible",
"undefined": "indefinido",
Expand All @@ -353,4 +354,4 @@
"wednesday": "Miercóles",
"week": "semana",
"year": "año"
}
}
Loading

0 comments on commit ec8ad07

Please sign in to comment.