From d82427d10840f166ced02156e78f7085d09b92ca Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 25 Feb 2021 17:59:58 -0500 Subject: [PATCH] LP1904036 Patron alerts page continued Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../src/app/staff/circ/patron/patron.component.ts | 30 ++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.ts index b1b18cfe61..1105f497a6 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.ts @@ -70,8 +70,15 @@ export class PatronComponent implements OnInit, AfterViewInit { this.context.patron ? this.context.patron.id() : null; if (this.patronId) { + if (this.patronId !== prevId) { // different patron - this.changePatron(this.patronId); + this.changePatron(this.patronId) + .then(_ => this.routeToAlertsPane()); + + } else { + // Patron already loaded, most likely from the search tab. + // See if we still need to show alerts. + this.routeToAlertsPane(); } } else { // Use the ID of the previously loaded patron. @@ -130,16 +137,19 @@ export class PatronComponent implements OnInit, AfterViewInit { } } - changePatron(id: number) { + changePatron(id: number): Promise { this.patronId = id; - this.context.loadPatron(id) - .then(_ => { - if (this.context.patron && - this.context.alerts.hasAlerts() && - !this.context.patronAlertsShown()) { - this.router.navigate(['/staff/circ/patron', id, 'alerts']) - } - }); + return this.context.loadPatron(id); + } + + routeToAlertsPane() { + console.log('testing route change for alerts'); + if (this.patronTab !== 'search' && + this.context.patron && + this.context.alerts.hasAlerts() && + !this.context.patronAlertsShown()) { + this.router.navigate(['/staff/circ/patron', this.patronId, 'alerts']) + } } // Route to checkout tab for selected patron. -- 2.11.0