LP1904036 Support circ.obscure_dob in patron summary
authorBill Erickson <berickxx@gmail.com>
Wed, 12 Jan 2022 16:47:03 +0000 (11:47 -0500)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:13:40 +0000 (20:13 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>

Open-ILS/src/eg2/src/app/staff/circ/patron/resolver.service.ts
Open-ILS/src/eg2/src/app/staff/share/patron/summary.component.html
Open-ILS/src/eg2/src/app/staff/share/patron/summary.component.ts

index 47e6f79..ec6f987 100644 (file)
@@ -125,6 +125,7 @@ export class PatronResolver implements Resolve<Promise<any[]>> {
           'opac.barcode_regex',
           'opac.username_regex',
           'sms.enable',
+          'circ.obscure_dob',
           'ui.patron.edit.aua.state.require',
           'ui.patron.edit.aua.state.suggest',
           'ui.patron.edit.aua.state.show',
index ae88969..4fed347 100644 (file)
     <div class="col-lg-7">{{p().net_access_level().name()}}</div>
   </div>
   <div class="row mb-1">
-    <div class="col-lg-5" i18n>Date of Birth</div>
-    <div class="col-lg-7">{{p().dob() | date}}</div>
+    <div class="col-lg-5" i18n>
+      <a href="javascript:;" (click)="showDob = !showDob">Date of Birth</a>
+    </div>
+    <div class="col-lg-7">
+      <ng-container *ngIf="showDob">{{p().dob() | date}}</ng-container>
+      <ng-container *ngIf="!showDob" i18n>&lt;Hidden&gt;</ng-container>
+    </div>
   </div>
   <div class="row mb-1">
     <div class="col-lg-5" i18n>Parent/Guardian</div>
index 48cad1c..87888e2 100644 (file)
@@ -6,6 +6,7 @@ import {IdlObject} from '@eg/core/idl.service';
 import {NetService} from '@eg/core/net.service';
 import {PrintService} from '@eg/share/print/print.service';
 import {PatronService, PatronSummary} from './patron.service';
+import {ServerStoreService} from '@eg/core/server-store.service';
 
 @Component({
   templateUrl: 'summary.component.html',
@@ -14,16 +15,33 @@ import {PatronService, PatronSummary} from './patron.service';
 })
 export class PatronSummaryComponent implements OnInit {
 
-    @Input() summary: PatronSummary;
+    private _summary: PatronSummary;
+    @Input() set summary(s: PatronSummary) {
+        if (s && this._summary && s.id !== this._summary.id) {
+            this.showDob = this.showDobDefault;
+        }
+        this._summary = s;
+    }
+
+    get summary(): PatronSummary {
+        return this._summary;
+    }
+
+    showDobDefault = false;
+    showDob = false;
 
     constructor(
         private org: OrgService,
         private net: NetService,
         private printer: PrintService,
+        private serverStore: ServerStoreService,
         public patronService: PatronService
     ) {}
 
     ngOnInit() {
+        this.serverStore.getItem('circ.obscure_dob').then(hide => {
+            this.showDobDefault = this.showDob = !hide;
+        });
     }
 
     p(): IdlObject { // patron shorthand