From: Galen Charlton Date: Tue, 25 Feb 2020 21:46:23 +0000 (-0500) Subject: add cellTextGenerators where needed X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=08e81761a75932d017fb61c89246531703177f1b;p=working%2FEvergreen.git add cellTextGenerators where needed Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.html b/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.html index 128642ac96..9c39fc5276 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.html @@ -26,6 +26,7 @@ [stickyHeader]="true" [filterable]="true" [sortable]="true" + [cellTextGenerator]="cellTextGenerator" idlClass="acqinv" [dataSource]="gridSource"> boolean; + cellTextGenerator: GridCellTextGenerator; + constructor( private router: Router, private route: ActivatedRoute, @@ -42,6 +44,11 @@ export class InvoiceResultsComponent implements OnInit { ngOnInit() { this.gridSource = this.acqSearch.getAcqSearchDataSource('invoice'); this.noSelectedRows = (rows: IdlObject[]) => (rows.length === 0); + this.cellTextGenerator = { + inv_ident: row => row.inv_ident(), + provider: row => row.provider().code(), + shipper: row => row.shipper().code(), + }; } printSelectedInvoices(rows: IdlObject[]) { diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.html b/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.html index 607a316fa9..4d16efcf40 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.html @@ -73,6 +73,7 @@ [stickyHeader]="true" [filterable]="true" [sortable]="true" + [cellTextGenerator]="cellTextGenerator" [showDeclaredFieldsOnly]="true"> diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.ts index 061eddb3ec..d2e6757aaa 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.ts @@ -7,7 +7,7 @@ import {IdlObject} from '@eg/core/idl.service'; import {NetService} from '@eg/core/net.service'; import {AuthService} from '@eg/core/auth.service'; import {GridComponent} from '@eg/share/grid/grid.component'; -import {GridDataSource} from '@eg/share/grid/grid'; +import {GridDataSource, GridCellTextGenerator} from '@eg/share/grid/grid'; import {AcqSearchService, AcqSearchTerm, AcqSearch} from './acq-search.service'; import {AcqSearchFormComponent} from './acq-search-form.component'; @@ -23,6 +23,8 @@ export class LineitemResultsComponent implements OnInit { gridSource: GridDataSource; @ViewChild('acqSearchLineitemsGrid', { static: true }) lineitemResultsGrid: GridComponent; + cellTextGenerator: GridCellTextGenerator; + constructor( private router: Router, private route: ActivatedRoute, @@ -33,6 +35,29 @@ export class LineitemResultsComponent implements OnInit { ngOnInit() { this.gridSource = this.acqSearch.getAcqSearchDataSource('lineitem'); + this.cellTextGenerator = { + id: row => row.id(), + title: row => { + const filtered = row.attributes().filter(lia => lia.attr_name() === 'title'); + if (filtered.length > 0) { + return filtered[0].attr_value(); + } else { + return ''; + } + }, + author: row => { + const filtered = row.attributes().filter(lia => lia.attr_name() === 'author'); + if (filtered.length > 0) { + return filtered[0].attr_value(); + } else { + return ''; + } + }, + provider: row => row.provider() ? row.provider().code() : '', + _links: row => '', + purchase_order: row => row.purchase_order() ? row.purchase_order().name() : '', + picklist: row => row.picklist() ? row.picklist().name() : '', + }; } doSearch(search: AcqSearch) { diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.html b/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.html index f63d691dc2..6fd569e94f 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.html @@ -35,6 +35,7 @@ [stickyHeader]="true" [filterable]="true" [sortable]="true" + [cellTextGenerator]="cellTextGenerator" idlClass="acqpl" [dataSource]="gridSource"> boolean; deleteNotAppropriate: (rows: IdlObject[]) => boolean; + cellTextGenerator: GridCellTextGenerator; + constructor( private router: Router, private route: ActivatedRoute, @@ -70,6 +72,10 @@ export class PicklistResultsComponent implements OnInit { this.cloneNotAppropriate = (rows: IdlObject[]) => (!this.permissions.CREATE_PICKLIST || !this.oneSelectedRows(rows)); this.mergeNotAppropriate = (rows: IdlObject[]) => (!this.permissions.UPDATE_PICKLIST || this.noSelectedRows(rows)); this.deleteNotAppropriate = (rows: IdlObject[]) => (!this.permissions.UPDATE_PICKLIST || this.noSelectedRows(rows)); + + this.cellTextGenerator = { + name: row => row.name(), + }; } openCreateDialog() { diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.html b/Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.html index 54365de27b..93a0a7e86f 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.html @@ -21,6 +21,7 @@ [stickyHeader]="true" [filterable]="true" [sortable]="true" + [cellTextGenerator]="cellTextGenerator" idlClass="acqpo" [dataSource]="gridSource"> diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.ts index 75888b931d..3d46150e8e 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.ts @@ -7,7 +7,7 @@ import {IdlObject} from '@eg/core/idl.service'; import {NetService} from '@eg/core/net.service'; import {AuthService} from '@eg/core/auth.service'; import {GridComponent} from '@eg/share/grid/grid.component'; -import {GridDataSource} from '@eg/share/grid/grid'; +import {GridDataSource, GridCellTextGenerator} from '@eg/share/grid/grid'; import {AcqSearchService, AcqSearchTerm, AcqSearch} from './acq-search.service'; import {AcqSearchFormComponent} from './acq-search-form.component'; @@ -23,6 +23,8 @@ export class PurchaseOrderResultsComponent implements OnInit { gridSource: GridDataSource; @ViewChild('acqSearchPurchaseOrdersGrid', { static: true }) purchaseOrderResultsGrid: GridComponent; + cellTextGenerator: GridCellTextGenerator; + constructor( private router: Router, private route: ActivatedRoute, @@ -33,6 +35,11 @@ export class PurchaseOrderResultsComponent implements OnInit { ngOnInit() { this.gridSource = this.acqSearch.getAcqSearchDataSource('purchase_order'); + + this.cellTextGenerator = { + provider: row => row.provider().code(), + name: row => row.name(), + }; } doSearch(search: AcqSearch) {