add cellTextGenerators where needed
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 25 Feb 2020 21:46:23 +0000 (16:46 -0500)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 25 Feb 2020 21:46:23 +0000 (16:46 -0500)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.html
Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.ts
Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.html
Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.ts
Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.html
Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.ts
Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.html
Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.ts

index 128642a..9c39fc5 100644 (file)
@@ -26,6 +26,7 @@
   [stickyHeader]="true"
   [filterable]="true"
   [sortable]="true"
+  [cellTextGenerator]="cellTextGenerator"
   idlClass="acqinv" [dataSource]="gridSource">
 
   <eg-grid-toolbar-action label="Print Selected Invoices" i18n-label
index 04f2d6a..4df4c3b 100644 (file)
@@ -10,7 +10,7 @@ import {PrintService} from '@eg/share/print/print.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';
 
@@ -29,6 +29,8 @@ export class InvoiceResultsComponent implements OnInit {
 
     noSelectedRows: (rows: IdlObject[]) => 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[]) {
index 607a316..4d16efc 100644 (file)
@@ -73,6 +73,7 @@
   [stickyHeader]="true"
   [filterable]="true"
   [sortable]="true"
+  [cellTextGenerator]="cellTextGenerator"
   [showDeclaredFieldsOnly]="true">
 
   <eg-grid-column path="id" [cellTemplate]="idTmpl" [disableTooltip]="true"></eg-grid-column>
index 061eddb..d2e6757 100644 (file)
@@ -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) {
index f63d691..6fd569e 100644 (file)
@@ -35,6 +35,7 @@
   [stickyHeader]="true"
   [filterable]="true"
   [sortable]="true"
+  [cellTextGenerator]="cellTextGenerator"
   idlClass="acqpl" [dataSource]="gridSource">
 
   <eg-grid-toolbar-action label="New Selection List" i18n-label
index d0c5bbe..33f2356 100644 (file)
@@ -10,7 +10,7 @@ import {NetService} from '@eg/core/net.service';
 import {AuthService} from '@eg/core/auth.service';
 import {PermService} from '@eg/core/perm.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 {PicklistCreateDialogComponent} from './picklist-create-dialog.component';
 import {PicklistCloneDialogComponent} from './picklist-clone-dialog.component';
@@ -46,6 +46,8 @@ export class PicklistResultsComponent implements OnInit {
     mergeNotAppropriate: (rows: IdlObject[]) => 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() {
index 54365de..93a0a7e 100644 (file)
@@ -21,6 +21,7 @@
   [stickyHeader]="true"
   [filterable]="true"
   [sortable]="true"
+  [cellTextGenerator]="cellTextGenerator"
   idlClass="acqpo" [dataSource]="gridSource">
 
   <eg-grid-column path="name" [cellTemplate]="nameTmpl"></eg-grid-column>
index 75888b9..3d46150 100644 (file)
@@ -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) {