From 625c862c27777451517a256e78aa8c304a0ec283 Mon Sep 17 00:00:00 2001 From: Kyle Huckins Date: Tue, 30 Jul 2019 19:00:14 +0000 Subject: [PATCH] lp1739277 OrgSelect Class Callback Holdings Implementation - Implement OrgSelectClassCallback in Angular Catalog Holdings UI Signed-off-by: Kyle Huckins 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 Signed-off-by: Jane Sandberg --- .../catalog/record/holdings.component.html | 6 ++++-- .../catalog/record/holdings.component.ts | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html index 075163ae18..59e07e5f10 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html @@ -7,8 +7,10 @@
Holdings Maintenance
- + diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts index 07fb393c45..8ba8583b09 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts @@ -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 -- 2.43.2