From ab8bcd287a9c5a27109d3cf0fa7292c7944e9ed3 Mon Sep 17 00:00:00 2001 From: Bertrand Zuchuat Date: Wed, 28 Feb 2024 09:24:24 +0100 Subject: [PATCH] feat(circulation): display check-in note The check-in note is displayed when an item arrives from transit. * Closes rero/rero-ils#3610. Co-Authored-by: Bertrand Zuchuat --- .../src/app/circulation/checkin/checkin.component.ts | 7 ++++++- .../admin/src/app/circulation/item/item.component.ts | 11 ++++++++--- projects/admin/src/app/classes/items.ts | 2 ++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/projects/admin/src/app/circulation/checkin/checkin.component.ts b/projects/admin/src/app/circulation/checkin/checkin.component.ts index 037f4fbcc..4fc77870c 100644 --- a/projects/admin/src/app/circulation/checkin/checkin.component.ts +++ b/projects/admin/src/app/circulation/checkin/checkin.component.ts @@ -96,7 +96,7 @@ export class CheckinComponent implements OnInit { this.getPatronOrItem(this.searchText); } - /** Apply checkin and checkout automatically + /** Apply check-in and checkout automatically * @param itemBarcode: item barcode */ checkin(itemBarcode: string) { @@ -138,6 +138,11 @@ export class CheckinComponent implements OnInit { ); } break; + case ItemAction.receive: + if (item.library.pid === this.userService.user.currentLibrary) { + this._displayCirculationNote(item, ItemNoteType.CHECKIN); + } + break; } this.items.unshift(item); this._resetSearchInput(); diff --git a/projects/admin/src/app/circulation/item/item.component.ts b/projects/admin/src/app/circulation/item/item.component.ts index 7b1160b99..1ce16d6b2 100644 --- a/projects/admin/src/app/circulation/item/item.component.ts +++ b/projects/admin/src/app/circulation/item/item.component.ts @@ -24,7 +24,7 @@ import { Loan, LoanState } from '@app/admin/classes/loans'; import { ItemsService } from '@app/admin/service/items.service'; import { OrganisationService } from '@app/admin/service/organisation.service'; import { RecordService } from '@rero/ng-core'; -import { ItemStatus, PermissionsService } from '@rero/shared'; +import { ItemStatus, PermissionsService, UserService } from '@rero/shared'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; @@ -90,13 +90,15 @@ export class ItemComponent implements OnInit { * @param patronTransactionService - Patron transaction Service * @param itemService - Item Service * @param permissionsService - PermissionsService + * @param userService - UserService */ constructor( private recordService: RecordService, private organisationService: OrganisationService, private patronTransactionService: PatronTransactionService, private itemService: ItemsService, - private permissionsService: PermissionsService + private permissionsService: PermissionsService, + private userService: UserService ) { } /** OnInit hook */ @@ -158,7 +160,10 @@ export class ItemComponent implements OnInit { */ getCirculationNoteForAction(): ItemNote[] { if (this.item.actionDone) { - if (this.item.actionDone === this.itemAction.checkin) { + if ( + (this.item.actionDone === this.itemAction.checkin) + || (((this.item.actionDone === this.itemAction.receive) && this.item.library.pid === this.userService.user.currentLibrary)) + ) { return [this.item.getNote(ItemNoteType.CHECKIN)]; } if (this.item.actionDone === this.itemAction.checkout) { diff --git a/projects/admin/src/app/classes/items.ts b/projects/admin/src/app/classes/items.ts index 49d16567f..6a61f65f6 100644 --- a/projects/admin/src/app/classes/items.ts +++ b/projects/admin/src/app/classes/items.ts @@ -94,6 +94,8 @@ export class Item { pending_loans: Loan[]; number_of_extensions: number; location: any; + library: any; + library_location_name: any; notes: ItemNote[]; acquisition_date: Moment; enumerationAndChronology: string;