From: Bill Erickson Date: Mon, 4 Jan 2021 22:06:51 +0000 (-0500) Subject: LP1910145 Hold notes and notifications WIP X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=95fc98f23d7d017138710dd5c965318467f1bf36;p=working%2FEvergreen.git LP1910145 Hold notes and notifications WIP Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/share/holds/detail.component.html b/Open-ILS/src/eg2/src/app/staff/share/holds/detail.component.html index 616acc67aa..46bc114f08 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holds/detail.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/holds/detail.component.html @@ -1,3 +1,8 @@ + + +
@@ -106,11 +111,11 @@
Print on Slip + class="ml-2 badge badge-info p-1">Print on Slip Patron Visible + class="ml-2 badge badge-warning p-1">Patron Visible Staff Create + class="ml-2 badge badge-info p-1">Staff Create
diff --git a/Open-ILS/src/eg2/src/app/staff/share/holds/detail.component.ts b/Open-ILS/src/eg2/src/app/staff/share/holds/detail.component.ts index 5a1ebbf7e2..d7ddf16c83 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holds/detail.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/holds/detail.component.ts @@ -6,6 +6,7 @@ import {NetService} from '@eg/core/net.service'; import {PcrudService} from '@eg/core/pcrud.service'; import {OrgService} from '@eg/core/org.service'; import {AuthService} from '@eg/core/auth.service'; +import {HoldNoteDialogComponent} from './note-dialog.component'; /** Hold details read-only view */ @@ -44,6 +45,8 @@ export class HoldDetailComponent implements OnInit { initDone: boolean; @Output() onShowList: EventEmitter; + @ViewChild('noteDialog') noteDialog: HoldNoteDialogComponent; + constructor( private net: NetService, private pcrud: PcrudService, @@ -106,6 +109,10 @@ export class HoldDetailComponent implements OnInit { this.pcrud.remove(note).toPromise() .then(ok => { if (ok) { this.getNotes(); } }); } + + newNote() { + this.noteDialog.open().subscribe(note => this.notes.unshift(note)); + } } diff --git a/Open-ILS/src/eg2/src/app/staff/share/holds/holds.module.ts b/Open-ILS/src/eg2/src/app/staff/share/holds/holds.module.ts index 5bcb68aeaf..3d01139aee 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holds/holds.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/holds/holds.module.ts @@ -9,6 +9,7 @@ import {HoldRetargetDialogComponent} from './retarget-dialog.component'; import {HoldTransferDialogComponent} from './transfer-dialog.component'; import {HoldCancelDialogComponent} from './cancel-dialog.component'; import {HoldManageDialogComponent} from './manage-dialog.component'; +import {HoldNoteDialogComponent} from './note-dialog.component'; @NgModule({ declarations: [ @@ -18,7 +19,8 @@ import {HoldManageDialogComponent} from './manage-dialog.component'; HoldRetargetDialogComponent, HoldTransferDialogComponent, HoldCancelDialogComponent, - HoldManageDialogComponent + HoldManageDialogComponent, + HoldNoteDialogComponent ], imports: [ StaffCommonModule, diff --git a/Open-ILS/src/eg2/src/app/staff/share/holds/note-dialog.component.html b/Open-ILS/src/eg2/src/app/staff/share/holds/note-dialog.component.html new file mode 100644 index 0000000000..983e5d26dc --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/share/holds/note-dialog.component.html @@ -0,0 +1,37 @@ + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/share/holds/note-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/share/holds/note-dialog.component.ts new file mode 100644 index 0000000000..b703ed527a --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/share/holds/note-dialog.component.ts @@ -0,0 +1,52 @@ +import {Component, OnInit, Input, Output, ViewChild, EventEmitter} from '@angular/core'; +import {Observable, Observer, of} from 'rxjs'; +import {tap} from 'rxjs/operators'; +import {IdlObject, IdlService} from '@eg/core/idl.service'; +import {NetService} from '@eg/core/net.service'; +import {PcrudService} from '@eg/core/pcrud.service'; +import {OrgService} from '@eg/core/org.service'; +import {AuthService} from '@eg/core/auth.service'; +import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap'; +import {DialogComponent} from '@eg/share/dialog/dialog.component'; + +/** New hold note dialog */ + +@Component({ + selector: 'eg-hold-note-dialog', + templateUrl: 'note-dialog.component.html' +}) +export class HoldNoteDialogComponent extends DialogComponent implements OnInit { + pub = false; + slip = false; + title: string; + body: string; + + @Input() holdId: number; + + constructor( + private modal: NgbModal, + private idl: IdlService, + private pcrud: PcrudService + ) { + super(modal); + } + + ngOnInit() {} + + createNote() { + const note = this.idl.create('ahrn'); + note.staff('t'); + note.hold(this.holdId); + note.title(this.title); + note.body(this.body); + note.slip(this.slip ? 't' : 'f'); + note.pub(this.pub ? 't' : 'f'); + + this.pcrud.create(note).toPromise().then( + resp => this.close(resp), // new note object + err => console.error('Could not create note', err) + ); + } +} + +