From 8f36f2e85cd81555d44eed9b4fe4c39488d59de0 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 2 Mar 2021 10:43:59 -0500 Subject: [PATCH] LP1904036 print/copy patron address; summary styling Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../staff/circ/patron/summary.component.html | 79 ++++++++++++------- .../staff/circ/patron/summary.component.ts | 40 ++++++++++ .../app/staff/share/circ/grid.component.html | 13 ++- .../app/staff/share/circ/grid.component.ts | 14 ++++ .../Pg/upgrade/XXXX.data.angular-patron.sql | 2 + 5 files changed, 116 insertions(+), 32 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/summary.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/summary.component.html index 47081789ca..32f773b156 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/summary.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/summary.component.html @@ -1,13 +1,14 @@
-

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

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

-
+
Patron account will expire soon. Please renew.
@@ -15,43 +16,43 @@
Profile
-
{{context.patron.profile().name()}}
+
{{patron().profile().name()}}
Home Library
-
{{context.orgSn(context.patron.home_ou())}}
+
{{context.orgSn(patron().home_ou())}}
Net Access
-
{{context.patron.net_access_level().name()}}
+
{{patron().net_access_level().name()}}
Date of Birth
-
{{context.patron.dob() | date:'shortDate'}}
+
{{patron().dob() | date:'shortDate'}}
Parent/Guardian
-
{{context.patron.guardian()}}
+
{{patron().guardian()}}
Last Activity
- - {{context.patron.usr_activity()[0].event_time() | date:'shortDate'}} + + {{patron().usr_activity()[0].event_time() | date:'shortDate'}}
Last Updated
-
{{context.patron.last_update_time() | date:'shortDate'}}
+
{{patron().last_update_time() | date:'shortDate'}}
Create Date
-
{{context.patron.create_date() | date:'shortDate'}}
+
{{patron().create_date() | date:'shortDate'}}
Expire Date
-
{{context.patron.expire_date() | date:'shortDate'}}
+
{{patron().expire_date() | date:'shortDate'}}

@@ -70,19 +71,23 @@
Items Out
{{context.patronStats.checkouts.total_out}}
-
+
Overdue
{{context.patronStats.checkouts.overdue}}
-
+
Long Overdue
{{context.patronStats.checkouts.long_overdue}}
-
+
Claimed Returned
{{context.patronStats.checkouts.claims_returned}}
-
+
Lost
{{context.patronStats.checkouts.lost}}
@@ -103,51 +108,65 @@
Card
- {{context.patron.card() ? context.patron.card().barcode() : ''}} + {{patron().card() ? patron().card().barcode() : ''}}
Username
-
{{context.patron.usrname()}}
+
{{patron().usrname()}}
Day Phone
-
{{context.patron.day_phone()}}
+
{{patron().day_phone()}}
Evening Phone
-
{{context.patron.evening_phone()}}
+
{{patron().evening_phone()}}
Other Phone
-
{{context.patron.other_phone()}}
+
{{patron().other_phone()}}
ID1
-
{{context.patron.ident_value()}}
+
{{patron().ident_value()}}
ID2
-
{{context.patron.ident_value2()}}
+
{{patron().ident_value2()}}
Email
- {{context.patron.email()}} + {{patron().email()}}

-
+
- {{addr.address_type()}} + +
{{addr.address_type()}}
+
+ copy + print +
+
{{addr.street1()}} {{addr.street2()}}
{{addr.city()}}, {{addr.state()}} {{addr.post_code()}}
- + + +
diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/summary.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/summary.component.ts index aac3c49025..dd1a830a83 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/summary.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/summary.component.ts @@ -2,9 +2,11 @@ import {Component, OnInit, Input} 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 {IdlObject} from '@eg/core/idl.service'; import {NetService} from '@eg/core/net.service'; import {PatronService} from '@eg/staff/share/patron/patron.service'; import {PatronContextService} from './patron.service'; +import {PrintService} from '@eg/share/print/print.service'; @Component({ templateUrl: 'summary.component.html', @@ -16,11 +18,49 @@ export class SummaryComponent implements OnInit { constructor( private org: OrgService, private net: NetService, + private printer: PrintService, public patronService: PatronService, public context: PatronContextService ) {} ngOnInit() { } + + patron(): IdlObject { + return this.context.patron; + } + + printAddress(addr: IdlObject) { + this.printer.print({ + templateName: 'patron_address', + contextData: { + patron: this.context.patron, + address: addr + }, + printContext: 'default' + }); + } + + copyAddress(addr: IdlObject) { + // Note navigator.clipboard requires special permissions. + // This is hinky, but gets the job done without the perms. + + const node = document.getElementById( + `patron-address-copy-${addr.id()}`) as HTMLTextAreaElement; + + // Un-hide the textarea just long enough to copy its data. + // Using node.style instead of *ngIf in hopes it + // will be quicker, so the user never sees the textarea. + node.style.visibility = 'visible'; + node.focus(); + node.select(); + + if (!document.execCommand('copy')) { + console.error('Copy command failed'); + } + + node.style.visibility = 'hidden'; + } + } diff --git a/Open-ILS/src/eg2/src/app/staff/share/circ/grid.component.html b/Open-ILS/src/eg2/src/app/staff/share/circ/grid.component.html index 28353aecee..5a79e40319 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/circ/grid.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/circ/grid.component.html @@ -39,8 +39,7 @@ [useLocalSort]="true" [cellTextGenerator]="cellTextGenerator"> + i18n-label label="Print Item Receipt(s)" (onClick)="printReceipts($event)"> + + + + + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/share/circ/grid.component.ts b/Open-ILS/src/eg2/src/app/staff/share/circ/grid.component.ts index 59b57d9029..8b79cbae9b 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/circ/grid.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/circ/grid.component.ts @@ -604,5 +604,19 @@ export class CircGridComponent implements OnInit { } ); } + + showRecentCircs(rows: CircGridEntry[]) { + const copyId = this.getCopyIds(rows)[0]; + if (copyId) { + window.open('/eg/staff/cat/item/' + copyId + '/circ_list'); + } + } + + showTriggeredEvents(rows: CircGridEntry[]) { + const copyId = this.getCopyIds(rows)[0]; + if (copyId) { + window.open('/eg/staff/cat/item/' + copyId + '/triggered_events'); + } + } } diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql index 0a7457f0dd..4a713c3e45 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.angular-patron.sql @@ -57,6 +57,8 @@ UPDATE config.print_template SET template = $TEMPLATE$
$TEMPLATE$ WHERE name = 'items_out'; +UPDATE config.print_template SET active = TRUE WHERE name = 'patron_address'; + COMMIT; -- 2.43.2