From 821479dbc32422bcae2b1eb6b5ec030ef2beefae Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 6 Apr 2021 11:26:48 -0400 Subject: [PATCH] LP1904036 structural stuff; message actions Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../app/staff/circ/patron/alerts.component.html | 26 +++---- .../src/app/staff/circ/patron/alerts.component.ts | 6 +- .../src/app/staff/circ/patron/bills.component.ts | 4 +- .../app/staff/circ/patron/checkout.component.ts | 2 +- .../src/app/staff/circ/patron/edit.component.ts | 19 ++++- .../src/app/staff/circ/patron/group.component.ts | 6 +- .../src/app/staff/circ/patron/holds.component.html | 6 +- .../src/app/staff/circ/patron/holds.component.ts | 2 +- .../src/app/staff/circ/patron/items.component.html | 4 +- .../app/staff/circ/patron/messages.component.html | 6 ++ .../app/staff/circ/patron/messages.component.ts | 40 +++++++++- .../app/staff/circ/patron/patron.component.html | 32 ++++---- .../src/app/staff/circ/patron/patron.component.ts | 14 ++-- .../src/app/staff/circ/patron/patron.service.ts | 42 +++++----- .../staff/share/patron/merge-dialog.component.html | 12 +-- .../staff/share/patron/merge-dialog.component.ts | 33 ++++---- .../src/app/staff/share/patron/patron.service.ts | 48 ++++++++---- .../staff/share/patron/penalty-dialog.component.ts | 45 ++++++++++- .../app/staff/share/patron/summary.component.html | 90 +++++++++++----------- .../app/staff/share/patron/summary.component.ts | 20 ++--- 20 files changed, 282 insertions(+), 175 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/alerts.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/alerts.component.html index 6b869cbb03..6c88fbaac9 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/alerts.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/alerts.component.html @@ -1,55 +1,55 @@ -
+
-
- Holds available: {{context.alerts.holdsReady}} +
+ Holds available: {{alerts().holdsReady}}
-
+
Patron account is EXPIRED.
-
+
Patron account will expire soon. Please renew.
-
+
Patron account is BARRED
-
+
Patron account is INACTIVE
-
+
Patron account retrieved with an INACTIVE card.
-
+
Patron account has invalid addresses.
-
+
Alert Message
-
{{context.alerts.alertMessage}}
+
{{alerts().alertMessage}}
-
+
Penalties
  • + *ngFor="let penalty of alerts().alertPenalties">
    {{context.orgSn(penalty.org_unit())}} diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/alerts.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/alerts.component.ts index 814bdca3ad..ec52008603 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/alerts.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/alerts.component.ts @@ -3,7 +3,7 @@ import {Router, ActivatedRoute, ParamMap} from '@angular/router'; import {NgbNav, NgbNavChangeEvent} from '@ng-bootstrap/ng-bootstrap'; import {OrgService} from '@eg/core/org.service'; import {NetService} from '@eg/core/net.service'; -import {PatronService} from '@eg/staff/share/patron/patron.service'; +import {PatronService, PatronAlerts} from '@eg/staff/share/patron/patron.service'; import {PatronContextService} from './patron.service'; @Component({ @@ -21,5 +21,9 @@ export class PatronAlertsComponent implements OnInit { ngOnInit() { } + + alerts(): PatronAlerts { + return this.context.summary ? this.context.summary.alerts : null; + } } diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.ts index 23223c076c..0705c0a4c0 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.ts @@ -234,7 +234,7 @@ export class BillsComponent implements OnInit, AfterViewInit { } patron(): IdlObject { - return this.context.patron; + return this.context.summary ? this.context.summary.patron : null; } selectedPaymentInfo(): {owed: number, billed: number, paid: number} { @@ -464,7 +464,7 @@ export class BillsComponent implements OnInit, AfterViewInit { } const pending = this.pendingPayment(); - const prevBalance = this.context.patronStats.fines.balance_owed; + const prevBalance = this.context.summary.stats.fines.balance_owed; const newBalance = (prevBalance * 100 - pending * 100) / 100; const context = { diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.ts index ce696e52e2..0e262f339c 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.ts @@ -89,7 +89,7 @@ export class CheckoutComponent implements OnInit, AfterViewInit { collectParams(): Promise { const params: CheckoutParams = { - patron_id: this.context.patron.id() + patron_id: this.context.summary.id }; if (this.checkoutNoncat) { 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 805f3ab06e..887efa41ca 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 @@ -25,6 +25,21 @@ import {AlertDialogComponent} from '@eg/share/dialog/alert.component'; import {HoldNotifyUpdateDialogComponent} from './hold-notify-update.component'; import {BroadcastService} from '@eg/share/util/broadcast.service'; +const PATRON_FLESH_FIELDS = [ + 'cards', + 'card', + 'groups', + 'standing_penalties', + 'settings', + 'addresses', + 'billing_address', + 'mailing_address', + 'stat_cat_entries', + 'waiver_entries', + 'usr_activity', + 'notes' +]; + const COMMON_USER_SETTING_TYPES = [ 'circ.holds_behind_desk', 'circ.collections.exempt', @@ -618,7 +633,7 @@ export class EditComponent implements OnInit, AfterViewInit { loadPatron(): Promise { if (this.patronId) { - return this.patronService.getFleshedById(this.patronId) + return this.patronService.getFleshedById(this.patronId, PATRON_FLESH_FIELDS) .then(patron => { this.patron = patron; this.origUsername = patron.usrname(); @@ -1334,7 +1349,7 @@ export class EditComponent implements OnInit, AfterViewInit { } if (clone) { - this.context.patron = null; + this.context.summary = null; this.router.navigate( ['/staff/circ/patron/register/clone', this.modifiedPatron.id()]); diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/group.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/group.component.ts index a4459c7e69..33435ed4b2 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/group.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/group.component.ts @@ -59,8 +59,8 @@ export class PatronGroupComponent implements OnInit { this.dataSource.getRows = (pager: Pager, sort: any[]) => from(this.patrons.slice(pager.offset, pager.offset + pager.limit)); - if (this.context.patron) { - this.getGroupUsers(this.context.patron.usrgroup()); + if (this.context.summary) { + this.getGroupUsers(this.context.summary.patron.usrgroup()); } else { this.patronService.getById(this.patronId) @@ -137,7 +137,7 @@ export class PatronGroupComponent implements OnInit { refresh() { this.context.refreshPatron() - .then(_ => this.usergroup = this.context.patron.usrgroup()) + .then(_ => this.usergroup = this.context.summary.patron.usrgroup()) .then(_ => this.getGroupUsers(this.usergroup)) .then(_ => this.groupGrid.reload()); } diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/holds.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/holds.component.html index df068e2b49..ecccbacf0d 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/holds.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/holds.component.html @@ -13,7 +13,7 @@ [showPlaceHoldButton]="true" [hidePickupLibFilter]="true" [defaultSort]="[{name:'request_time',dir:'asc'}]" - [patronId]="context.patron.id()"> + [patronId]="context.summary.patron.id()">
  • @@ -27,11 +27,11 @@ [hidePickupLibFilter]="true" [showRecentlyCanceled]="true" [defaultSort]="[{name:'cancel_time',dir:'desc'}]" - [patronId]="context.patron.id()"> + [patronId]="context.summary.patron.id()">
- +
diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/holds.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/holds.component.ts index 86dc486370..0843880450 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/holds.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/holds.component.ts @@ -25,7 +25,7 @@ export class HoldsComponent implements OnInit { newHold() { this.router.navigate(['/staff/catalog/search'], - {queryParams: {holdForBarcode: this.context.patron.card().barcode()}}); + {queryParams: {holdForBarcode: this.context.summary.patron.card().barcode()}}); } } diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/items.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/items.component.html index fe1542d4c9..2206f06e39 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/items.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/items.component.html @@ -35,8 +35,8 @@
  • - - Non-Cataloged Circulations ({{context.patronStats.checkouts.noncat}}) + + Non-Cataloged Circulations ({{context.summary.stats.checkouts.noncat}}) diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/messages.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/messages.component.html index 88b567531f..4ba910d087 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/messages.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/messages.component.html @@ -12,6 +12,12 @@ hideFields="id,usr,stop_date"> + + + diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/messages.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/messages.component.ts index 352ff39834..8680f64191 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/messages.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/messages.component.ts @@ -1,5 +1,7 @@ import {Component, ViewChild, OnInit, Input, AfterViewInit} from '@angular/core'; -import {empty} from 'rxjs'; +import {empty, from} from 'rxjs'; +import {concatMap, tap} from 'rxjs/operators'; +import {IdlObject} from '@eg/core/idl.service'; import {NetService} from '@eg/core/net.service'; import {OrgService} from '@eg/core/org.service'; import {PcrudService} from '@eg/core/pcrud.service'; @@ -77,7 +79,7 @@ export class PatronMessagesComponent implements OnInit { }; flesh.order_by = orderBy; - return this.pcrud.search('ausp', query, flesh); + return this.pcrud.search('ausp', query, flesh, {authoritative: true}); } this.archiveDataSource.getRows = (pager: Pager, sort: any[]) => { @@ -95,7 +97,7 @@ export class PatronMessagesComponent implements OnInit { flesh.order_by = orderBy; - return this.pcrud.search('ausp', query, flesh); + return this.pcrud.search('ausp', query, flesh, {authoritative: true}); } } @@ -123,6 +125,38 @@ export class PatronMessagesComponent implements OnInit { if (changes) { this.mainGrid.reload(); } }); } + + archive(penalties: IdlObject[]) { + penalties.forEach(p => p.stop_date('now')); + this.pcrud.update(penalties).toPromise() + .then(_ => { + this.mainGrid.reload(); + this.archiveGrid.reload(); + }); + } + + remove(penalties: IdlObject[]) { + this.pcrud.remove(penalties).toPromise() + .then(_ => { + this.mainGrid.reload(); + this.archiveGrid.reload(); + }); + } + + modify(penalties: IdlObject[]) { + let modified = false; + from(penalties).pipe(concatMap(penalty => { + this.penaltyDialog.penalty = penalty; + return this.penaltyDialog.open().pipe(tap(changed => { + if (changed) { modified = true; } + })); + })).toPromise().then(_ => { + if (modified) { + this.mainGrid.reload(); + this.archiveGrid.reload(); + } + }); + } } 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 bab79c3b2b..71a2e78e5f 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 @@ -1,14 +1,14 @@ - + - + + {{context.summary.patron.family_name()}}, + {{context.summary.patron.first_given_name()}} + {{context.summary.patron.second_given_name()}}"> @@ -19,10 +19,8 @@
    - - - + +
    @@ -48,7 +46,7 @@
  • -
  • +
  • Check Out
    @@ -57,7 +55,7 @@
  • -
  • +
  • Items Out ({{counts('checkouts', 'total_out')}}) @@ -68,7 +66,7 @@
  • -
  • +
  • Holds ({{counts('holds', 'ready')}} / {{counts('holds', 'total')}}) @@ -77,7 +75,7 @@
  • -
  • +
  • Bills @@ -95,7 +93,7 @@
  • -
  • +
  • Messages
    @@ -104,7 +102,7 @@
  • -
  • +
  • Edit @@ -112,8 +110,8 @@
  • -
  • - + Other
    { - if (!id) { id = this.patron.id(); } - this.alerts = new PatronAlerts(); + if (!id) { + if (!this.summary) { + return Promise.reject('no can do'); + } else { + id = this.summary.id; + } + } return this.patrons.getFleshedById(id, PATRON_FLESH_FIELDS) - .then(p => this.patron = p) + .then(p => this.summary = new PatronSummary(p)) .then(_ => this.getPatronStats(id)) .then(_ => this.compileAlerts()); } @@ -91,33 +92,34 @@ export class PatronContextService { // When quickly navigating patron search results it's possible // for this.patron to be cleared right before this function // is called. Exit early instead of making an unneeded call. - if (!this.patron) { return Promise.resolve(); } + if (!this.summary) { return Promise.resolve(); } - return this.patrons.getVitalStats(this.patron) - .then(stats => this.patronStats = stats); + return this.patrons.getVitalStats(this.summary.patron) + .then(stats => this.summary.stats = stats); } patronAlertsShown(): boolean { - if (!this.patron) { return false; } + if (!this.summary) { return false; } const shown = this.store.getSessionItem('eg.circ.last_alerted_patron'); - if (shown === this.patron.id()) { return true; } - this.store.setSessionItem('eg.circ.last_alerted_patron', this.patron.id()); + if (shown === this.summary.patron.id()) { return true; } + this.store.setSessionItem('eg.circ.last_alerted_patron', this.summary.patron.id()); return false; } compileAlerts(): Promise { // User navigated to a different patron mid-data load. - if (!this.patron) { return Promise.resolve(); } + if (!this.summary) { return Promise.resolve(); } - return this.patrons.compileAlerts(this.patron, this.patronStats) + return this.patrons.compileAlerts(this.summary) .then(alerts => { - this.alerts = alerts; + this.summary.alerts = alerts; if (this.searchBarcode) { - const card = this.patron.cards() + const card = this.summary.patron.cards() .filter(c => c.barcode() === this.searchBarcode)[0]; - this.alerts.retrievedWithInactive = card && card.active() === 'f'; + this.summary.alerts.retrievedWithInactive = + card && card.active() === 'f'; this.searchBarcode = null; } }); diff --git a/Open-ILS/src/eg2/src/app/staff/share/patron/merge-dialog.component.html b/Open-ILS/src/eg2/src/app/staff/share/patron/merge-dialog.component.html index 51b11e83c7..a5695639d7 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/patron/merge-dialog.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/patron/merge-dialog.component.html @@ -17,25 +17,21 @@
    + [value]="summary1.patron.id()" [(ngModel)]="leadAccount">
    - - +
    + [value]="summary2.patron.id()" [(ngModel)]="leadAccount">
    - - +
  • diff --git a/Open-ILS/src/eg2/src/app/staff/share/patron/merge-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/share/patron/merge-dialog.component.ts index c818f371e5..e5dfee1b94 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/patron/merge-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/patron/merge-dialog.component.ts @@ -7,9 +7,10 @@ import {NetService} from '@eg/core/net.service'; import {EventService} from '@eg/core/event.service'; import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap'; import {DialogComponent} from '@eg/share/dialog/dialog.component'; -import {PatronService, PatronStats, PatronAlerts} from './patron.service'; +import {PatronService, PatronSummary} from './patron.service'; /** + * Dialog for merging 2 patron accounts. */ const PATRON_FLESH_FIELDS = [ @@ -30,12 +31,6 @@ const PATRON_FLESH_FIELDS = [ 'groups' ]; -class MergeContext { - patron: IdlObject; - stats: PatronStats; - alerts: PatronAlerts; -} - @Component({ selector: 'eg-patron-merge-dialog', templateUrl: 'merge-dialog.component.html' @@ -46,8 +41,8 @@ export class PatronMergeDialogComponent @Input() patronIds: [number, number]; - context1: MergeContext; - context2: MergeContext; + summary1: PatronSummary; + summary2: PatronSummary; leadAccount: number = null; loading = true; @@ -65,22 +60,22 @@ export class PatronMergeDialogComponent this.loading = true; this.leadAccount = null; this.loadPatron(this.patronIds[0]) - .then(ctx => this.context1 = ctx) + .then(ctx => this.summary1 = ctx) .then(_ => this.loadPatron(this.patronIds[1])) - .then(ctx => this.context2 = ctx) + .then(ctx => this.summary2 = ctx) .then(_ => this.loading = false); }); } - loadPatron(id: number): Promise { - const ctx = new MergeContext(); + loadPatron(id: number): Promise { + const sum = new PatronSummary(); return this.patrons.getFleshedById(id, PATRON_FLESH_FIELDS) - .then(patron => ctx.patron = patron) - .then(_ => this.patrons.getVitalStats(ctx.patron)) - .then(stats => ctx.stats = stats) - .then(_ => this.patrons.compileAlerts(ctx.patron, ctx.stats)) - .then(alerts => ctx.alerts = alerts) - .then(_ => ctx); + .then(patron => sum.patron = patron) + .then(_ => this.patrons.getVitalStats(sum.patron)) + .then(stats => sum.stats = stats) + .then(_ => this.patrons.compileAlerts(sum)) + .then(alerts => sum.alerts = alerts) + .then(_ => sum); } merge() { diff --git a/Open-ILS/src/eg2/src/app/staff/share/patron/patron.service.ts b/Open-ILS/src/eg2/src/app/staff/share/patron/patron.service.ts index 3333ee0605..3e6f635da8 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/patron/patron.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/patron/patron.service.ts @@ -10,23 +10,25 @@ import {Observable} from 'rxjs'; import {BarcodeSelectComponent} from '@eg/staff/share/barcodes/barcode-select.component'; import {ServerStoreService} from '@eg/core/server-store.service'; -export interface PatronStats { - fines: { - balance_owed: number, - group_balance_owed: number +export class PatronStats { + fines = { + balance_owed: 0, + group_balance_owed: 0 }; - checkouts: { - overdue: number, - claims_returned: number, - lost: number, - out: number, - total_out: number, - long_overdue: number, - noncat: number + + checkouts = { + overdue: 0, + claims_returned: 0, + lost: 0, + out: 0, + total_out: 0, + long_overdue: 0, + noncat: 0 }; - holds: { - ready: number; - total: number; + + holds = { + ready: 0, + total: 0 }; } @@ -56,7 +58,19 @@ export class PatronAlerts { } } +export class PatronSummary { + id: number; + patron: IdlObject; + stats: PatronStats = new PatronStats(); + alerts: PatronAlerts = new PatronAlerts(); + constructor(patron?: IdlObject) { + if (patron) { + this.id = patron.id(); + this.patron = patron; + } + } +} @Injectable() export class PatronService { @@ -314,8 +328,10 @@ export class PatronService { }); } - compileAlerts(patron: IdlObject, stats: PatronStats): Promise { + compileAlerts(summary: PatronSummary): Promise { + const patron = summary.patron; + const stats = summary.stats; const alerts = new PatronAlerts(); alerts.holdsReady = stats.holds.ready; 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 4112f3ba4f..7a2435cad8 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 @@ -35,10 +35,10 @@ export class PatronPenaltyDialogComponent SILENT_NOTE = 21; STAFF_CHR = 25; - staffInitials: string; + penalty: IdlObject; // modifying an existing penalty penaltyTypes: IdlObject[]; penaltyTypeFromSelect = ''; - penaltyTypeFromButton; + penaltyTypeFromButton: number; patron: IdlObject; dataLoaded = false; requireInitials = false; @@ -69,7 +69,21 @@ export class PatronPenaltyDialogComponent init(): Observable { this.dataLoaded = false; - this.penaltyTypeFromButton = this.SILENT_NOTE; + if (this.penalty) { // Modifying an existing penalty + const pen = this.penalty; + const sp = pen.standing_penalty().id(); + if (sp === this.ALERT_NOTE || + sp === this.SILENT_NOTE || sp === this.STAFF_CHR) { + this.penaltyTypeFromButton = sp; + } else { + this.penaltyTypeFromSelect = sp; + } + + this.noteText = pen.note(); + + } else { + this.penaltyTypeFromButton = this.SILENT_NOTE; + } this.org.settings(['ui.staff.require_initials.patron_standing_penalty']) .then(sets => this.requireInitials = @@ -90,8 +104,33 @@ export class PatronPenaltyDialogComponent })); } + modifyPenalty() { + this.penalty.note(this.initials ? + `${this.noteText} [${this.initials}]` : this.noteText); + + this.penalty.standing_penalty( + this.penaltyTypeFromSelect || this.penaltyTypeFromButton); + + this.pcrud.update(this.penalty).toPromise() + .then(ok => { + if (!ok) { + this.errorMsg.current().then(msg => this.toast.danger(msg)); + this.error('Update failed', true); + } else { + this.successMsg.current().then(msg => this.toast.success(msg)); + this.penalty = null; + this.close(ok); + } + }); + } + apply() { + if (this.penalty) { + this.modifyPenalty(); + return; + } + const pen = this.idl.create('ausp'); const msg = { title: this.title, diff --git a/Open-ILS/src/eg2/src/app/staff/share/patron/summary.component.html b/Open-ILS/src/eg2/src/app/staff/share/patron/summary.component.html index c41f46ae89..931662f744 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/patron/summary.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/patron/summary.component.html @@ -4,9 +4,9 @@

    - {{patron.family_name()}}, - {{patron.first_given_name()}} - {{patron.second_given_name()}} + {{p().family_name()}}, + {{p().first_given_name()}} + {{p().second_given_name()}}

    @@ -17,23 +17,23 @@

    - {{patronService.namePart(patron, 'family_name')}}, - {{patronService.namePart(patron, 'first_given_name')}} - {{patronService.namePart(patron, 'second_given_name')}} + {{patronService.namePart(p(), 'family_name')}}, + {{patronService.namePart(p(), 'first_given_name')}} + {{patronService.namePart(p(), 'second_given_name')}}

    preferred
    + *ngIf="summary.alerts.accountExpiresSoon">
    Patron account will expire soon. Please renew.
    + *ngFor="let pen of summary.alerts.alertPenalties">
    {{pen.note() || pen.standing_penalty().label()}} @@ -43,95 +43,95 @@
    Profile
    -
    {{patron.profile().name()}}
    +
    {{p().profile().name()}}
    Home Library
    -
    {{orgSn(patron.home_ou())}}
    +
    {{orgSn(p().home_ou())}}
    Net Access
    -
    {{patron.net_access_level().name()}}
    +
    {{p().net_access_level().name()}}
    Date of Birth
    -
    {{patron.dob() | date:'shortDate'}}
    +
    {{p().dob() | date:'shortDate'}}
    Parent/Guardian
    -
    {{patron.guardian()}}
    +
    {{p().guardian()}}
    Last Activity
    - - {{patron.usr_activity()[0].event_time() | date:'shortDate'}} + + {{p().usr_activity()[0].event_time() | date:'shortDate'}}
    Last Updated
    -
    {{patron.last_update_time() | date:'shortDate'}}
    +
    {{p().last_update_time() | date:'shortDate'}}
    Create Date
    -
    {{patron.create_date() | date:'shortDate'}}
    +
    {{p().create_date() | date:'shortDate'}}
    -
    +
    Expire Date
    -
    {{patron.expire_date() | date:'shortDate'}}
    +
    {{p().expire_date() | date:'shortDate'}}

    - +
    + [ngClass]="{'alert alert-danger p-0': summary.stats.fines.balance_owed > 0}">
    Fines Owed
    -
    {{stats.fines.balance_owed | currency}}
    +
    {{summary.stats.fines.balance_owed | currency}}
    + *ngIf="summary.stats.fines.group_balance_owed > summary.stats.fines.balance_owed">
    Group Fines
    -
    {{stats.fines.group_balance_owed | currency}}
    +
    {{summary.stats.fines.group_balance_owed | currency}}
    Items Out
    -
    {{stats.checkouts.total_out}}
    +
    {{summary.stats.checkouts.total_out}}
    + [ngClass]="{'alert alert-danger p-0': summary.stats.checkouts.overdue > 0}">
    Overdue
    -
    {{stats.checkouts.overdue}}
    +
    {{summary.stats.checkouts.overdue}}
    + [ngClass]="{'alert alert-danger p-0': summary.stats.checkouts.long_overdue > 0}">
    Long Overdue
    -
    {{stats.checkouts.long_overdue}}
    +
    {{summary.stats.checkouts.long_overdue}}
    + [ngClass]="{'alert alert-danger p-0': summary.stats.checkouts.claims_returned > 0}">
    Claimed Returned
    -
    {{stats.checkouts.claims_returned}}
    +
    {{summary.stats.checkouts.claims_returned}}
    + [ngClass]="{'alert alert-danger p-0': summary.stats.checkouts.lost > 0}">
    Lost
    -
    {{stats.checkouts.lost}}
    +
    {{summary.stats.checkouts.lost}}
    Non-Cataloged
    -
    {{stats.checkouts.noncat}}
    +
    {{summary.stats.checkouts.noncat}}
    Holds
    - {{stats.holds.ready}} / {{stats.holds.total}} + {{summary.stats.holds.ready}} / {{summary.stats.holds.total}}
    @@ -141,44 +141,44 @@
    Card
    - {{patron.card() ? patron.card().barcode() : ''}} + {{p().card() ? p().card().barcode() : ''}}
    Username
    -
    {{patron.usrname()}}
    +
    {{p().usrname()}}
    Day Phone
    -
    {{patron.day_phone()}}
    +
    {{p().day_phone()}}
    Evening Phone
    -
    {{patron.evening_phone()}}
    +
    {{p().evening_phone()}}
    Other Phone
    -
    {{patron.other_phone()}}
    +
    {{p().other_phone()}}
    ID1
    -
    {{patron.ident_value()}}
    +
    {{p().ident_value()}}
    ID2
    -
    {{patron.ident_value2()}}
    +
    {{p().ident_value2()}}
    Email
    - {{patron.email()}} + {{p().email()}}

    -
    +
    @@ -197,7 +197,7 @@
    diff --git a/Open-ILS/src/eg2/src/app/staff/share/patron/summary.component.ts b/Open-ILS/src/eg2/src/app/staff/share/patron/summary.component.ts index a80835e60f..11dfe0008d 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/patron/summary.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/patron/summary.component.ts @@ -5,7 +5,7 @@ import {OrgService} from '@eg/core/org.service'; import {IdlObject} from '@eg/core/idl.service'; import {NetService} from '@eg/core/net.service'; import {PrintService} from '@eg/share/print/print.service'; -import {PatronService, PatronStats, PatronAlerts} from './patron.service'; +import {PatronService, PatronSummary} from './patron.service'; @Component({ templateUrl: 'summary.component.html', @@ -14,9 +14,7 @@ import {PatronService, PatronStats, PatronAlerts} from './patron.service'; }) export class PatronSummaryComponent implements OnInit { - @Input() patron: IdlObject; - @Input() stats: PatronStats; - @Input() alerts: PatronAlerts; + @Input() summary: PatronSummary; constructor( private org: OrgService, @@ -28,12 +26,16 @@ export class PatronSummaryComponent implements OnInit { ngOnInit() { } + p(): IdlObject { // patron shorthand + return this.summary ? this.summary.patron : null; + } + hasPrefName(): boolean { - if (this.patron) { + if (this.p()) { return ( - this.patron.pref_first_given_name() || - this.patron.pref_second_given_name() || - this.patron.pref_family_name() + this.p().pref_first_given_name() || + this.p().pref_second_given_name() || + this.p().pref_family_name() ); } } @@ -42,7 +44,7 @@ export class PatronSummaryComponent implements OnInit { this.printer.print({ templateName: 'patron_address', contextData: { - patron: this.patron, + patron: this.p(), address: addr }, printContext: 'default' -- 2.11.0