From: Bill Erickson Date: Wed, 24 Mar 2021 21:33:27 +0000 (-0400) Subject: LP1904036 More validation border repairs X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5f89942f8ca8f4e9b79305345f670fda1cf512b4;p=evergreen%2Fpines.git LP1904036 More validation border repairs Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/barcodes.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/barcodes.component.html new file mode 100644 index 0000000000..aa0cf1ed8f --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/barcodes.component.html @@ -0,0 +1,39 @@ + + + + + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/barcodes.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/barcodes.component.ts new file mode 100644 index 0000000000..b252284ee6 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/barcodes.component.ts @@ -0,0 +1,73 @@ +import {Component, OnInit, Input, ViewChild} from '@angular/core'; +import {Observable, empty} from 'rxjs'; +import {switchMap, tap} from 'rxjs/operators'; +import {IdlObject, IdlService} from '@eg/core/idl.service'; +import {NetService} from '@eg/core/net.service'; +import {EventService} from '@eg/core/event.service'; +import {ToastService} from '@eg/share/toast/toast.service'; +import {PcrudService} from '@eg/core/pcrud.service'; +import {AuthService} from '@eg/core/auth.service'; +import {OrgService} from '@eg/core/org.service'; +import {DialogComponent} from '@eg/share/dialog/dialog.component'; +import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap'; +import {StringComponent} from '@eg/share/string/string.component'; +import {PatronContextService} from './patron.service'; + +/* Add/Remove Secondary Groups */ + +@Component({ + selector: 'eg-patron-barcodes', + templateUrl: 'barcodes.component.html' +}) + +export class PatronBarcodesDialogComponent + extends DialogComponent implements OnInit { + + @Input() patron: IdlObject; + primaryCard: number; + + constructor( + private modal: NgbModal, + private toast: ToastService, + private net: NetService, + private idl: IdlService, + private evt: EventService, + private pcrud: PcrudService, + private org: OrgService, + private auth: AuthService, + private context: PatronContextService + ) { super(modal); } + + ngOnInit() { + } + + /* todo check perms + 'UPDATE_PATRON_ACTIVE_CARD', + 'UPDATE_PATRON_PRIMARY_CARD' + */ + + open(ops: NgbModalOptions): Observable { + this.patron.cards().some(card => { + if (card.id() === this.patron.card().id()) { + this.primaryCard = card.id(); + return true; + } + }); + return super.open(ops); + } + + applyChanges() { + if (this.primaryCard !== this.patron.card().id()) { + const card = this.patron.cards() + .filter(c => c.id() === this.primaryCard)[0]; + this.patron.card(card); + } + this.close(true); + } + + activeChange(card: IdlObject, active: boolean) { + card.ischanged(true); + card.active(active ? 't' : 'f'); + } +} +