From 15febfda39d95e5f110577153085359e27c2d88e Mon Sep 17 00:00:00 2001
From: Bill Erickson <berickxx@gmail.com>
Date: Wed, 12 Jan 2022 11:47:03 -0500
Subject: [PATCH] LP1904036 Support circ.obscure_dob in patron summary

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
---
 .../src/app/staff/circ/patron/resolver.service.ts    |  1 +
 .../app/staff/share/patron/summary.component.html    |  9 +++++++--
 .../src/app/staff/share/patron/summary.component.ts  | 20 +++++++++++++++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/resolver.service.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/resolver.service.ts
index 47e6f79fb5..ec6f987f73 100644
--- a/Open-ILS/src/eg2/src/app/staff/circ/patron/resolver.service.ts
+++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/resolver.service.ts
@@ -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',
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 ae88969bf9..4fed3473e4 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
@@ -46,8 +46,13 @@
     <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>
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 48cad1c1b8..87888e2e9a 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
@@ -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
-- 
2.11.0