From 569ca4294520471ec5679994629a4105d471d23b Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 6 Apr 2021 12:04:09 -0400 Subject: [PATCH] LP1904036 address alerts; misc Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../app/staff/circ/patron/edit-toolbar.component.html | 11 +++++++++++ .../src/app/staff/circ/patron/edit-toolbar.component.ts | 17 +++++++++++++++-- .../eg2/src/app/staff/circ/patron/edit.component.html | 6 ++++++ .../src/eg2/src/app/staff/circ/patron/edit.component.ts | 13 +++++++++---- .../eg2/src/app/staff/circ/patron/patron.component.html | 4 ++-- .../app/staff/share/patron/penalty-dialog.component.ts | 7 ++++--- 6 files changed, 47 insertions(+), 11 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit-toolbar.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit-toolbar.component.html index 580a745b92..3afbadab58 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit-toolbar.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit-toolbar.component.html @@ -25,6 +25,17 @@ +
+
+
+
+ Address Alert: {{alert.alert_message()}} +
+
+
+
+
diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit-toolbar.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit-toolbar.component.ts index d715cbc639..fc1093bcc5 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit-toolbar.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit-toolbar.component.ts @@ -2,6 +2,7 @@ import {Component, OnInit, Input, Output, EventEmitter} from '@angular/core'; import {Router, ActivatedRoute, ParamMap} from '@angular/router'; import {NgbNav, NgbNavChangeEvent} from '@ng-bootstrap/ng-bootstrap'; import {OrgService} from '@eg/core/org.service'; +import {IdlService, IdlObject} from '@eg/core/idl.service'; import {NetService} from '@eg/core/net.service'; import {AuthService} from '@eg/core/auth.service'; import {PatronService} from '@eg/staff/share/patron/patron.service'; @@ -41,9 +42,11 @@ export class EditToolbarComponent implements OnInit { printClicked: EventEmitter = new EventEmitter(); searches: {[category: string]: DupeSearch} = {}; + addressAlerts: IdlObject[] = []; constructor( private org: OrgService, + private idl: IdlService, private net: NetService, private auth: AuthService, private patronService: PatronService, @@ -63,8 +66,6 @@ export class EditToolbarComponent implements OnInit { return Object.values(this.searches).filter(dupe => dupe.count > 0); } - - checkDupes(category: string, search: PatronSearchFieldSet) { this.net.request( @@ -85,5 +86,17 @@ export class EditToolbarComponent implements OnInit { }; }); } + + checkAddressAlerts(addr: IdlObject) { + const addrHash = this.idl.toHash(addr); + const patron = this.context.summary.patron; + addrHash.mailing_address = addr.id() === patron.mailing_address().id(); + addrHash.billing_address = addr.id() === patron.billing_address().id(); + this.net.request( + 'open-ils.actor', + 'open-ils.actor.address_alert.test', + this.auth.token(), this.auth.user().ws_ou(), addrHash + ).subscribe(alerts => this.addressAlerts = alerts); + } } diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html index b37b5460c5..a6d45bb20c 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html @@ -26,6 +26,12 @@ i18n-dialogBody dialogBody="An address is required during registration"> + + + diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts index 887efa41ca..5df2571156 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts @@ -145,6 +145,8 @@ export class EditComponent implements OnInit, AfterViewInit { @ViewChild('addrAlert') private addrAlert: AlertDialogComponent; @ViewChild('addrRequiredAlert') private addrRequiredAlert: AlertDialogComponent; + @ViewChild('xactCollisionAlert') + private xactCollisionAlert: AlertDialogComponent; autoId = -1; @@ -900,7 +902,7 @@ export class EditComponent implements OnInit, AfterViewInit { case 'city': // dupe search on address wants the address object as the value. this.dupeValueChange('address', obj); - // TODO address_alert(obj); + this.toolbar.checkAddressAlerts(obj); break; case 'post_code': @@ -1379,11 +1381,14 @@ export class EditComponent implements OnInit, AfterViewInit { if (evt) { console.error('Patron update failed with', evt); if (evt.textcode === 'XACT_COLLISION') { - // TODO alert + this.xactCollisionAlert.open().toPromise().then(_ => + window.location.href = window.location.href + ); } - } + } else { - alert('Patron update failed:' + result); + alert('Patron update failed:' + result); + } return Promise.reject('Save Failed'); }); diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.html index 71a2e78e5f..510fb3f83c 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.html @@ -37,10 +37,10 @@ - navigate_before + fullscreen - navigate_next + fullscreen_exit diff --git a/Open-ILS/src/eg2/src/app/staff/share/patron/penalty-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/share/patron/penalty-dialog.component.ts index 7a2435cad8..8380a0e756 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/patron/penalty-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/patron/penalty-dialog.component.ts @@ -3,6 +3,7 @@ import {merge, from, Observable} from 'rxjs'; import {tap, take, switchMap} from 'rxjs/operators'; import {IdlService, IdlObject} from '@eg/core/idl.service'; import {OrgService} from '@eg/core/org.service'; +import {ServerStoreService} from '@eg/core/server-store.service'; import {AuthService} from '@eg/core/auth.service'; import {NetService} from '@eg/core/net.service'; import {EventService} from '@eg/core/event.service'; @@ -54,6 +55,7 @@ export class PatronPenaltyDialogComponent private idl: IdlService, private org: OrgService, private net: NetService, + private store: ServerStoreService, private evt: EventService, private toast: ToastService, private auth: AuthService, @@ -85,9 +87,8 @@ export class PatronPenaltyDialogComponent this.penaltyTypeFromButton = this.SILENT_NOTE; } - this.org.settings(['ui.staff.require_initials.patron_standing_penalty']) - .then(sets => this.requireInitials = - sets['ui.staff.require_initials.patron_standing_penalty']); + this.store.getItem('ui.staff.require_initials.patron_standing_penalty') + .then(require => this.requireInitials = require); const obs1 = this.pcrud.retrieve('au', this.patronId) .pipe(tap(usr => this.patron = usr)); -- 2.11.0