From b5de2385a83544a6948832568f88bc71d77a6d68 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 30 Jul 2019 12:02:26 -0400 Subject: [PATCH] LP#1835982: add cell value print handlers to holdings grid This patch adds cell value print handlers for the barcode and holdable columns of the Angular staff catalog holdings view. To test ------- [1] After applying the patches for this bug, perform a "Download Full CSV" or "Print Full Grid" action on the Holdings View grid in the Angular staff catalog. [2] Verify that the Location/Barcode and Holdable? columns in the output contain appropriate values. Signed-off-by: Galen Charlton Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg --- .../staff/catalog/record/holdings.component.html | 4 +++- .../staff/catalog/record/holdings.component.ts | 15 ++++++++++++++- 2 files changed, 17 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 bcd980e45f..ac5bcc97a3 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 @@ -228,6 +228,7 @@ @@ -279,7 +280,8 @@ + [cellTemplate]="holdableTemplate" [cellContext]="gridTemplateContext" + [cellPrintValue]="cellPrintValues"> 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 1c78e5906f..973f31a378 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 @@ -9,7 +9,7 @@ import {StaffCatalogService} from '../catalog.service'; import {OrgService} from '@eg/core/org.service'; import {PcrudService} from '@eg/core/pcrud.service'; import {AuthService} from '@eg/core/auth.service'; -import {GridDataSource} from '@eg/share/grid/grid'; +import {GridDataSource, GridColumn} from '@eg/share/grid/grid'; import {GridComponent} from '@eg/share/grid/grid.component'; import {GridToolbarCheckboxComponent } from '@eg/share/grid/grid-toolbar-checkbox.component'; @@ -131,6 +131,7 @@ export class HoldingsMaintenanceComponent implements OnInit { renderFromPrefs: boolean; rowClassCallback: (row: any) => string; + cellPrintValues: (row: any, cell: GridColumn) => string; private _recId: number; @Input() set recordId(id: number) { @@ -182,6 +183,18 @@ export class HoldingsMaintenanceComponent implements OnInit { } }; + // Text-ify function for cells that use display templates. + this.cellPrintValues = (row: any, cell: GridColumn): string => { + switch (cell.name) { + case 'owner_label': + return row.locationLabel; + case 'holdable': + return row.copy ? + this.gridTemplateContext.copyIsHoldable(row.copy) : + ''; + } + }; + this.gridTemplateContext = { toggleExpandRow: (row: HoldingsEntry) => { row.treeNode.expanded = !row.treeNode.expanded; -- 2.43.2