]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/eg2/src/app/staff/share/holds/notify-dialog.component.ts
LP1910145 Angular Hold Detail Notes & Notifications
[Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / share / holds / notify-dialog.component.ts
1 import {Component, OnInit, Input, Output, ViewChild, EventEmitter} from '@angular/core';
2 import {Observable, Observer, of} from 'rxjs';
3 import {tap} from 'rxjs/operators';
4 import {IdlObject, IdlService} from '@eg/core/idl.service';
5 import {NetService} from '@eg/core/net.service';
6 import {PcrudService} from '@eg/core/pcrud.service';
7 import {OrgService} from '@eg/core/org.service';
8 import {AuthService} from '@eg/core/auth.service';
9 import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap';
10 import {DialogComponent} from '@eg/share/dialog/dialog.component';
11
12 /** New hold notify dialog */
13
14 @Component({
15   selector: 'eg-hold-notify-dialog',
16   templateUrl: 'notify-dialog.component.html'
17 })
18 export class HoldNotifyDialogComponent extends DialogComponent {
19     method: string;
20     note: string;
21
22     @Input() holdId: number;
23
24     constructor(
25         private modal: NgbModal,
26         private idl: IdlService,
27         private auth: AuthService,
28         private pcrud: PcrudService
29     ) { super(modal); }
30
31     createNotify() {
32         const notify = this.idl.create('ahn');
33         notify.hold(this.holdId);
34         notify.notify_staff(this.auth.user().id());
35         notify.method(this.method);
36         notify.note(this.note);
37
38         this.pcrud.create(notify).toPromise().then(
39             resp => this.close(resp), // new notify object
40             err => console.error('Could not create notify', err)
41         );
42     }
43 }
44
45