+<eg-hold-note-dialog #noteDialog [holdId]="holdId"></eg-hold-note-dialog>
+<!--
+<eg-hold-notify-dialog #notifyDialog [holdId]="holdId"></eg-hold-notify-dialog>
+-->
+
<div class="row">
<div class="col-lg-2">
<button (click)="showListView()" class="btn btn-info" i18n>List View</button>
<div class="flex-1"></div>
<div>
<span *ngIf="note.slip() == 't'"
- class="ml-2 badge badge-info">Print on Slip</span>
+ class="ml-2 badge badge-info p-1">Print on Slip</span>
<span *ngIf="note.pub() == 't'"
- class="ml-2 badge badge-warning">Patron Visible</span>
+ class="ml-2 badge badge-warning p-1">Patron Visible</span>
<span *ngIf="note.staff() == 't'"
- class="ml-2 badge badge-info">Staff Create</span>
+ class="ml-2 badge badge-info p-1">Staff Create</span>
</div>
</div>
<div class="well-table">
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 */
initDone: boolean;
@Output() onShowList: EventEmitter<any>;
+ @ViewChild('noteDialog') noteDialog: HoldNoteDialogComponent;
+
constructor(
private net: NetService,
private pcrud: PcrudService,
this.pcrud.remove(note).toPromise()
.then(ok => { if (ok) { this.getNotes(); } });
}
+
+ newNote() {
+ this.noteDialog.open().subscribe(note => this.notes.unshift(note));
+ }
}
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: [
HoldRetargetDialogComponent,
HoldTransferDialogComponent,
HoldCancelDialogComponent,
- HoldManageDialogComponent
+ HoldManageDialogComponent,
+ HoldNoteDialogComponent
],
imports: [
StaffCommonModule,
--- /dev/null
+<ng-template #dialogContent>
+ <div class="modal-header bg-info">
+ <h4 class="modal-title">Add Hold Note for Hold #{{holdId}}</h4>
+ <button type="button" class="close"
+ i18n-aria-label aria-label="Close" (click)="close()">
+ <span aria-hidden="true">×</span>
+ </button>
+ </div>
+ <div class="modal-body form-validated">
+ <div class="form-group form-check">
+ <input type="checkbox" class="form-check-input"
+ id="patron-visible-cbox" [(ngModel)]="pub">
+ <label class="form-check-label"
+ for="patron-visible-cbox" i18n>Patron Visible?</label>
+ </div>
+ <div class="form-group form-check">
+ <input type="checkbox" class="form-check-input"
+ id="hold-slip-cbox" [(ngModel)]="slip">
+ <label class="form-check-label"
+ for="hold-slip-cbox" i18n>Print on Slip?</label>
+ </div>
+ <div class="form-group">
+ <label for="title-input" i18n>Note Title</label>
+ <input type="text" class="form-control" id="title-input" required [(ngModel)]="title"/>
+ </div>
+ <div class="form-group">
+ <label for="body-input" i18n>Note Body</label>
+ <textarea class="form-control" id="body-input" required [(ngModel)]="body">
+ </textarea>
+ </div>
+ <div class="w-100">
+ <button class="btn btn-success ml-auto" (click)="createNote()"
+ [disabled]="!title || !body" i18n>Create Note</button>
+ <button class="btn btn-warning ml-2" (click)="close()" i18n>Cancel</button>
+ </div>
+ </div>
+</ng-template>
--- /dev/null
+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)
+ );
+ }
+}
+
+