LP1821382 Make items bookable (part 1)
[working/Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / share / booking / make-bookable-dialog.component.ts
1 import {Component, OnInit, OnDestroy, Input, ViewChild,
2         Renderer2} from '@angular/core';
3 import {Subscription} from 'rxjs';
4 import {IdlObject} from '@eg/core/idl.service';
5 import {NetService} from '@eg/core/net.service';
6 import {EventService} from '@eg/core/event.service';
7 import {PcrudService} from '@eg/core/pcrud.service';
8 import {ToastService} from '@eg/share/toast/toast.service';
9 import {AuthService} from '@eg/core/auth.service';
10 import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap';
11 import {DialogComponent} from '@eg/share/dialog/dialog.component';
12 import {StringComponent} from '@eg/share/string/string.component';
13
14 /**
15  * Dialog for making items bookable
16  */
17
18 @Component({
19   selector: 'eg-make-bookable-dialog',
20   templateUrl: 'make-bookable-dialog.component.html'
21 })
22 export class MakeBookableDialogComponent
23     extends DialogComponent implements OnInit, OnDestroy {
24
25     // Note copyIds must refer to copies that belong to a single
26     // bib record.
27     @Input() copyIds: number[];
28     copies: IdlObject[];
29
30     numSucceeded: number;
31     numFailed: number;
32     updateComplete: boolean;
33
34     onOpenSub: Subscription;
35
36     @ViewChild('successMsg') private successMsg: StringComponent;
37     @ViewChild('errorMsg') private errorMsg: StringComponent;
38
39     constructor(
40         private modal: NgbModal, // required for passing to parent
41         private toast: ToastService,
42         private net: NetService,
43         private pcrud: PcrudService,
44         private evt: EventService,
45         private renderer: Renderer2,
46         private auth: AuthService) {
47         super(modal); // required for subclassing
48     }
49
50     ngOnInit() {
51         this.onOpenSub = this.onOpen$.subscribe(async () => {
52             this.numSucceeded = 0;
53             this.numFailed = 0;
54             this.updateComplete = false;
55         });
56     }
57
58     ngOnDestroy() {
59         this.onOpenSub.unsubscribe();
60     }
61 }
62
63
64