]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/eg2/src/app/staff/booking/reservation-actions.service.ts
LP1816475: Booking module refresh
[Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / booking / reservation-actions.service.ts
1 import {Injectable} from '@angular/core';
2 import {Router} from '@angular/router';
3 import {PcrudService} from '@eg/core/pcrud.service';
4
5 // Some grid actions that are shared across booking grids
6
7 @Injectable({providedIn: 'root'})
8 export class ReservationActionsService {
9
10     constructor(
11         private pcrud: PcrudService,
12         private router: Router,
13     ) {
14     }
15
16     manageReservationsByResource = (barcode: string) => {
17         this.router.navigate(['/staff', 'booking', 'manage_reservations', 'by_resource', barcode]);
18     }
19
20     viewItemStatus = (barcode: string) => {
21         this.pcrud.search('acp', { 'barcode': barcode }, { limit: 1 })
22         .subscribe((acp) => {
23             window.open('/eg/staff/cat/item/' + acp.id());
24         });
25     }
26
27     notOneUniqueSelected = (ids: number[]) => {
28         return (new Set(ids).size !== 1);
29     }
30
31 }
32