Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(circulation): display check-in note #1130

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand Down
11 changes: 8 additions & 3 deletions projects/admin/src/app/circulation/item/item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions projects/admin/src/app/classes/items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading