lp1739277 OrgSelect Class Callback Holdings Implementation
authorKyle Huckins <khuckins@catalyte.io>
Tue, 30 Jul 2019 19:00:14 +0000 (19:00 +0000)
committerJane Sandberg <sandbej@linnbenton.edu>
Wed, 17 Nov 2021 22:52:11 +0000 (14:52 -0800)
- Implement OrgSelectClassCallback in Angular Catalog Holdings UI

Signed-off-by: Kyle Huckins <khuckins@catalyte.io>
 Changes to be committed:
modified:   Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html
modified:   Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts

Signed-off-by: Jennifer Bruch <jbruch@sparkpa.org>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html
Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts

index 075163a..59e07e5 100644 (file)
@@ -7,8 +7,10 @@
       <div class="input-group-prepend">
         <div class="input-group-text" i18n>Holdings Maintenance</div>
       </div>
-      <eg-org-select [initialOrg]="contextOrg" 
-        persistKey="catalog.holdings" (onChange)="contextOrgChanged($event)">
+      <eg-org-select [initialOrg]="contextOrg"
+        persistKey="catalog.holdings"
+        (onChange)="contextOrgChanged($event)"
+        [orgClassCallback]="orgClassCallback">
       </eg-org-select>
     </div>
   </div>
index 07fb393..8ba8583 100644 (file)
@@ -7,6 +7,7 @@ import {Pager} from '@eg/share/util/pager';
 import {IdlObject, IdlService} from '@eg/core/idl.service';
 import {StaffCatalogService} from '../catalog.service';
 import {OrgService} from '@eg/core/org.service';
+import {NetService} from '@eg/core/net.service';
 import {PcrudService} from '@eg/core/pcrud.service';
 import {AuthService} from '@eg/core/auth.service';
 import {GridDataSource, GridColumn, GridCellTextGenerator} from '@eg/share/grid/grid';
@@ -152,7 +153,10 @@ export class HoldingsMaintenanceComponent implements OnInit {
     renderFromPrefs: boolean;
 
     rowClassCallback: (row: any) => string;
+
     cellTextGenerator: GridCellTextGenerator;
+    orgClassCallback: (orgId: number) => string;
+    marked_orgs: number[] = [];
 
     private _recId: number;
     @Input() set recordId(id: number) {
@@ -179,6 +183,7 @@ export class HoldingsMaintenanceComponent implements OnInit {
         private org: OrgService,
         private idl: IdlService,
         private pcrud: PcrudService,
+        private net: NetService,
         private auth: AuthService,
         private staffCat: StaffCatalogService,
         private store: ServerStoreService,
@@ -210,6 +215,7 @@ export class HoldingsMaintenanceComponent implements OnInit {
             }
         };
 
+
         // Text-ify function for cells that use display templates.
         this.cellTextGenerator = {
             owner_label: row => row.locationLabel,
@@ -217,6 +223,11 @@ export class HoldingsMaintenanceComponent implements OnInit {
                 this.gridTemplateContext.copyIsHoldable(row.copy) : ''
         };
 
+        this.orgClassCallback = (orgId: number): string => {
+            if (this.marked_orgs.includes(orgId)) { return 'font-weight-bold'; }
+            return '';
+        };
+
         this.gridTemplateContext = {
             toggleExpandRow: (row: HoldingsEntry) => {
                 row.treeNode.expanded = !row.treeNode.expanded;
@@ -279,6 +290,16 @@ export class HoldingsMaintenanceComponent implements OnInit {
             if (!this.contextOrgLoaded) { return empty(); }
             return this.fetchHoldings(pager);
         };
+
+        this.net.request(
+            'open-ils.search',
+            'open-ils.search.biblio.copy_counts.retrieve.staff',
+            this.recordId
+        ).toPromise().then(result => {
+            result.forEach(copy_count => {
+                this.marked_orgs.push(copy_count[0]);
+            });
+        });
     }
 
     // No data is loaded until the first occurrence of the org change handler