From: Bill Erickson Date: Mon, 4 Jan 2021 22:30:42 +0000 (-0500) Subject: LP1910145 Hold notes and notifications WIP X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2bf8c402bd6722387e3ec3f025023d2f395c778b;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 46bc114f08..e80d1ff524 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,7 +1,5 @@ -
@@ -133,7 +131,26 @@
  • Staff Notifications - NOTIFY + +
    +
    +
    {{notify.method()}}
    +
    +
    + {{notify.notify_time() | date:'short'}} + + Created by {{notify.notify_staff().usrname()}} +
    +
    +
    +
    +
    +
    +
    {{notify.note()}}
    +
    +
    +
  • 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 d7ddf16c83..2f28c24bd9 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 @@ -7,6 +7,7 @@ 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'; +import {HoldNotifyDialogComponent} from './notify-dialog.component'; /** Hold details read-only view */ @@ -46,6 +47,7 @@ export class HoldDetailComponent implements OnInit { @Output() onShowList: EventEmitter; @ViewChild('noteDialog') noteDialog: HoldNoteDialogComponent; + @ViewChild('notifyDialog') notifyDialog: HoldNotifyDialogComponent; constructor( private net: NetService, @@ -83,16 +85,17 @@ export class HoldDetailComponent implements OnInit { getNotes(): Promise { this.notes = []; return this.pcrud.search('ahrn', {hold: this.holdId}) - .pipe(tap(note => this.notes.push(note))).toPromise() + .pipe(tap(note => this.notes.push(note))).toPromise(); } getNotifies(): Promise { this.notifies = []; - return this.pcrud.search('ahn', - {hold: this.holdId}, - {order_by: {ahn: 'notify_time DESC'}} - ).pipe(tap(notify => this.notifies.push(notify))).toPromise(); + return this.pcrud.search('ahn', {hold: this.holdId}, { + flesh: 1, + flesh_fields: {ahn: ['notify_staff']}, + order_by: {ahn: 'notify_time DESC'} + }).pipe(tap(notify => this.notifies.push(notify))).toPromise(); } getOrgName(id: number) { @@ -113,6 +116,10 @@ export class HoldDetailComponent implements OnInit { newNote() { this.noteDialog.open().subscribe(note => this.notes.unshift(note)); } + + newNotify() { + this.notifyDialog.open().subscribe(notify => this.getNotifies()); // fleshing + } } 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 3d01139aee..b5b4bb25b7 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 @@ -10,6 +10,7 @@ import {HoldTransferDialogComponent} from './transfer-dialog.component'; import {HoldCancelDialogComponent} from './cancel-dialog.component'; import {HoldManageDialogComponent} from './manage-dialog.component'; import {HoldNoteDialogComponent} from './note-dialog.component'; +import {HoldNotifyDialogComponent} from './notify-dialog.component'; @NgModule({ declarations: [ @@ -20,7 +21,8 @@ import {HoldNoteDialogComponent} from './note-dialog.component'; HoldTransferDialogComponent, HoldCancelDialogComponent, HoldManageDialogComponent, - HoldNoteDialogComponent + HoldNoteDialogComponent, + HoldNotifyDialogComponent ], imports: [ StaffCommonModule, 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 index b703ed527a..935dd5dc51 100644 --- 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 @@ -15,7 +15,7 @@ import {DialogComponent} from '@eg/share/dialog/dialog.component'; selector: 'eg-hold-note-dialog', templateUrl: 'note-dialog.component.html' }) -export class HoldNoteDialogComponent extends DialogComponent implements OnInit { +export class HoldNoteDialogComponent extends DialogComponent { pub = false; slip = false; title: string; @@ -27,11 +27,7 @@ export class HoldNoteDialogComponent extends DialogComponent implements OnInit { private modal: NgbModal, private idl: IdlService, private pcrud: PcrudService - ) { - super(modal); - } - - ngOnInit() {} + ) { super(modal); } createNote() { const note = this.idl.create('ahrn'); diff --git a/Open-ILS/src/eg2/src/app/staff/share/holds/notify-dialog.component.html b/Open-ILS/src/eg2/src/app/staff/share/holds/notify-dialog.component.html new file mode 100644 index 0000000000..e44a075a59 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/share/holds/notify-dialog.component.html @@ -0,0 +1,25 @@ + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/share/holds/notify-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/share/holds/notify-dialog.component.ts new file mode 100644 index 0000000000..06baa34756 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/share/holds/notify-dialog.component.ts @@ -0,0 +1,45 @@ +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 notify dialog */ + +@Component({ + selector: 'eg-hold-notify-dialog', + templateUrl: 'notify-dialog.component.html' +}) +export class HoldNotifyDialogComponent extends DialogComponent { + method: string; + note: string; + + @Input() holdId: number; + + constructor( + private modal: NgbModal, + private idl: IdlService, + private auth: AuthService, + private pcrud: PcrudService + ) { super(modal); } + + createNotify() { + const notify = this.idl.create('ahn'); + notify.hold(this.holdId); + notify.notify_staff(this.auth.user().id()); + notify.method(this.method); + notify.note(this.note); + + this.pcrud.create(notify).toPromise().then( + resp => this.close(resp), // new notify object + err => console.error('Could not create notify', err) + ); + } +} + +