From 89d8b22ec0239dc18680471bfea58daaec467dd1 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 17 Jan 2020 10:27:06 -0500 Subject: [PATCH] hook up search action to LI, invoice, and picklist grids Signed-off-by: Galen Charlton --- .../app/staff/acq/search/acq-search.component.ts | 23 ++++++++++++++++++++-- .../staff/acq/search/invoice-results.component.ts | 7 ++++++- .../staff/acq/search/lineitem-results.component.ts | 6 +++++- .../staff/acq/search/picklist-results.component.ts | 6 +++++- 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.component.ts index 6a23ce50c5..4337a1dc18 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.component.ts @@ -27,7 +27,10 @@ export class AcqSearchComponent implements OnInit, AfterViewInit { onTabChange: ($event: NgbTabChangeEvent) => void; @ViewChild('acqSearchTabs', { static: true }) tabs: NgbTabset; + @ViewChildren(LineitemResultsComponent) liResults: QueryList; @ViewChildren(PurchaseOrderResultsComponent) poResults: QueryList; + @ViewChildren(InvoiceResultsComponent) invResults: QueryList; + @ViewChildren(PicklistResultsComponent) plResults: QueryList; constructor( private router: Router, @@ -52,6 +55,7 @@ export class AcqSearchComponent implements OnInit, AfterViewInit { this.onTabChange = ($event) => { if (this.validSearchTypes.includes($event.nextId)) { + this.searchType = $event.nextId; this.router.navigate(['/staff', 'acq', 'search', $event.nextId]); } }; @@ -107,8 +111,23 @@ export class AcqSearchComponent implements OnInit, AfterViewInit { } submitSearch() { - if (this.searchType === 'purchaseorders') { - this.poResults.forEach(poResult => poResult.doSearch(this.searchTerms)); + switch (this.searchType) { + case 'lineitems': { + this.liResults.forEach(results => results.doSearch(this.searchTerms)); + break; + } + case 'purchaseorders': { + this.poResults.forEach(results => results.doSearch(this.searchTerms)); + break; + } + case 'invoices': { + this.invResults.forEach(results => results.doSearch(this.searchTerms)); + break; + } + case 'selectionlists': { + this.plResults.forEach(results => results.doSearch(this.searchTerms)); + break; + } } } diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.ts index 19e157be45..195f89976c 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.ts @@ -11,7 +11,7 @@ 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 {AcqSearchService} from './acq-search.service'; +import {AcqSearchService, AcqSearchTerm} from './acq-search.service'; @Component({ selector: 'eg-invoice-results', @@ -69,4 +69,9 @@ export class InvoiceResultsComponent implements OnInit { }) ); } + + doSearch(terms: AcqSearchTerm[]) { + this.acqSearch.setSearchTerms(terms); + this.invoiceResultsGrid.reload(); + } } 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 2e3104f930..9f2e55d978 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 @@ -8,7 +8,7 @@ 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 {AcqSearchService} from './acq-search.service'; +import {AcqSearchService, AcqSearchTerm} from './acq-search.service'; @Component({ selector: 'eg-lineitem-results', @@ -32,4 +32,8 @@ export class LineitemResultsComponent implements OnInit { this.gridSource = this.acqSearch.getAcqSearchDataSource('lineitem'); } + doSearch(terms: AcqSearchTerm[]) { + this.acqSearch.setSearchTerms(terms); + this.lineitemResultsGrid.reload(); + } } diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.ts index 2dba18c333..c13d8381ef 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.ts @@ -11,7 +11,7 @@ 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 {AcqSearchService} from './acq-search.service'; +import {AcqSearchService, AcqSearchTerm} from './acq-search.service'; import {PicklistCreateDialogComponent} from './picklist-create-dialog.component'; import {PicklistCloneDialogComponent} from './picklist-clone-dialog.component'; import {PicklistDeleteDialogComponent} from './picklist-delete-dialog.component'; @@ -109,4 +109,8 @@ export class PicklistResultsComponent implements OnInit { this.picklistMergeDialog.update(); // update the dialog UI with selections } + doSearch(terms: AcqSearchTerm[]) { + this.acqSearch.setSearchTerms(terms); + this.picklistResultsGrid.reload(); + } } -- 2.11.0