LP1904036 Patron stat cats
authorBill Erickson <berickxx@gmail.com>
Tue, 16 Mar 2021 14:36:40 +0000 (10:36 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:13:26 +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/patron.component.html
Open-ILS/src/eg2/src/app/staff/circ/patron/patron.module.ts
Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts
Open-ILS/src/eg2/src/app/staff/circ/patron/statcats.component.html [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/circ/patron/statcats.component.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/circ/patron/surveys.component.html
Open-ILS/src/eg2/src/styles.css

index d5f2faf..d13a72f 100644 (file)
           <div ngbDropdownMenu>
             <a routerLink="/staff/circ/patron/{{patronId}}/alerts" 
               ngbDropdownItem i18n>Alerts and Messages</a>
-            <a routerLink="/staff/circ/patron/{{patronId}}/notes" 
+            <a routerLink="/staff/circ/patron/{{patronId}}/notes" [disabled]="true"
               ngbDropdownItem i18n>Notes</a>
-            <a routerLink="/staff/circ/patron/{{patronId}}/triggered_events" 
+            <a routerLink="/staff/circ/patron/{{patronId}}/triggered_events" [disabled]="true"
               ngbDropdownItem i18n>Triggered Events / Notifications</a>
-            <a routerLink="/staff/circ/patron/{{patronId}}/message_center" 
+            <a routerLink="/staff/circ/patron/{{patronId}}/message_center" [disabled]="true"
               ngbDropdownItem i18n>Message Center</a>
             <a routerLink="/staff/circ/patron/{{patronId}}/stat_cats"
               ngbDropdownItem i18n>Statistical Categories</a>
               ngbDropdownItem i18n>Surveys</a>
             <a routerLink="/staff/circ/patron/{{patronId}}/group"
               ngbDropdownItem i18n>Group Member Details</a>
-            <a routerLink="/staff/circ/patron/{{patronId}}/edit_perms"
+            <a routerLink="/staff/circ/patron/{{patronId}}/edit_perms"[disabled]="true"
               ngbDropdownItem i18n>User Permission Editor</a>
             <a routerLink="/staff/circ/patron/{{patronId}}/credentials"
               ngbDropdownItem i18n>Test Password</a>
               target="_top"
               ngbDropdownItem i18n>Booking: Pick Up Reservations</a>
             <a routerLink="/staff/booking/return/by_patron/{{patronId}}"
-              target="_top"
-              ngbDropdownItem i18n></a>
+              target="_top" ngbDropdownItem i18n></a>
             <a href (click)="purgeAccount(); false"
               [disabled]="disablePurge()"
               ngbDropdownItem i18n>Completely Purge Account</a>
                 <eg-patron-survey-responses [patronId]="patronId">
                 </eg-patron-survey-responses>
               </div>
+              <div *ngSwitchCase="'stat_cats'">
+                <eg-patron-statcats [patronId]="patronId">
+                </eg-patron-statcats>
+              </div>
             </ng-container>
           </ng-template>
         </li>
index bc4292a..fe5f556 100644 (file)
@@ -24,6 +24,7 @@ import {BillsComponent} from './bills.component';
 import {BillStatementComponent} from './bill-statement.component';
 import {TestPatronPasswordComponent} from './test-password.component';
 import {PatronSurveyResponsesComponent} from './surveys.component';
+import {PatronStatCatsComponent} from './statcats.component';
 
 @NgModule({
   declarations: [
@@ -39,7 +40,8 @@ import {PatronSurveyResponsesComponent} from './surveys.component';
     BillsComponent,
     BillStatementComponent,
     TestPatronPasswordComponent,
-    PatronSurveyResponsesComponent
+    PatronSurveyResponsesComponent,
+    PatronStatCatsComponent
   ],
   imports: [
     StaffCommonModule,
index c9665be..847b1e6 100644 (file)
@@ -33,7 +33,6 @@ const PATRON_FLESH_FIELDS = [
     'addresses',
     'billing_address',
     'mailing_address',
-    'stat_cat_entries',
     'waiver_entries',
     'usr_activity',
     'notes',
diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/statcats.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/statcats.component.html
new file mode 100644 (file)
index 0000000..d359718
--- /dev/null
@@ -0,0 +1,16 @@
+
+
+<div class="mt-2 alert well-like d-flex ml-3 mr-3" *ngFor="let map of catMaps">
+  <div class="font-weight-bold p-1">{{map.stat_cat().name()}}</div>
+  <div class="flex-1 ml-2 p-1">{{map.stat_cat_entry()}}</div>
+  <div class="ml-2 p-1">
+    <ng-container *ngIf="map.stat_cat().opac_visible() === 'f'">
+      <div class="badge badge-primary p-1" i18n>Staff Only</div>
+    </ng-container>
+    <ng-container *ngIf="map.stat_cat().opac_visible() === 't'">
+      <div class="badge badge-warning p-1" i18n>Patron Visible</div>
+    </ng-container>
+  </div>
+  <div class="p-1" i18n> @ {{map.stat_cat().owner().shortname()}}</div>
+</div>
+
diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/statcats.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/statcats.component.ts
new file mode 100644 (file)
index 0000000..d6e777d
--- /dev/null
@@ -0,0 +1,53 @@
+import {Component, Input, OnInit, AfterViewInit, ViewChild} from '@angular/core';
+import {Router, ActivatedRoute, ParamMap} from '@angular/router';
+import {from, empty, range} from 'rxjs';
+import {concatMap, tap, takeLast} from 'rxjs/operators';
+import {NgbNav, NgbNavChangeEvent} from '@ng-bootstrap/ng-bootstrap';
+import {IdlObject} from '@eg/core/idl.service';
+import {EventService} from '@eg/core/event.service';
+import {OrgService} from '@eg/core/org.service';
+import {NetService} from '@eg/core/net.service';
+import {PcrudService, PcrudContext} from '@eg/core/pcrud.service';
+import {AuthService} from '@eg/core/auth.service';
+import {PatronService} from '@eg/staff/share/patron/patron.service';
+import {PatronContextService} from './patron.service';
+
+@Component({
+  templateUrl: 'statcats.component.html',
+  selector: 'eg-patron-statcats'
+})
+export class PatronStatCatsComponent implements OnInit {
+
+    @Input() patronId: number;
+    catMaps: IdlObject[] = [];
+
+    constructor(
+        private router: Router,
+        private evt: EventService,
+        private net: NetService,
+        private auth: AuthService,
+        private org: OrgService,
+        private pcrud: PcrudService,
+        private patronService: PatronService,
+        private context: PatronContextService
+    ) {}
+
+    ngOnInit() {
+
+        this.net.request(
+            'open-ils.actor',
+            'open-ils.actor.user.fleshed.retrieve',
+            this.auth.token(), this.patronId, ['stat_cat_entries']).toPromise()
+        .then(user => {
+            const catIds = user.stat_cat_entries().map(e => e.stat_cat());
+            this.pcrud.search('actsc', {id: catIds})
+            .subscribe(cat => {
+                const map = user.stat_cat_entries()
+                    .filter(e => e.stat_cat() === cat.id())[0];
+                map.stat_cat(cat);
+                cat.owner(this.org.get(cat.owner()));
+                this.catMaps.push(map);
+            });
+        });
+    }
+}
index 3515bdb..a139879 100644 (file)
@@ -1,5 +1,5 @@
 
-<div class="card" *ngFor="let survey of surveys">
+<div class="card mt-2" *ngFor="let survey of surveys">
   <div class="card-header">{{survey.survey.name()}}</div>
   <ul class="list-group list-group-flush">
     <li class="list-group-item">
index 71e7382..8d2ad65 100644 (file)
@@ -94,6 +94,13 @@ a {
   cursor: not-allowed;
 }
 
+/* copies color/border/elements from above sans position elements */
+.well-like {
+  background-color: #f5f5f5;
+  border-radius: 5px;
+  box-shadow: inset 0 1px 1px rgba(0,0,0,.05);
+}
+
 /* usefuf for mat-icon buttons without any background or borders */
 .material-icon-button {
   /* Transparent background */
@@ -223,7 +230,6 @@ a {
   border-bottom: 1px solid rgba(0,0,0,.125);
 }
 
-
 /**
  * Only display the print container when printing
  */