onTabChange: ($event: NgbTabChangeEvent) => void;
@ViewChild('acqSearchTabs', { static: true }) tabs: NgbTabset;
+ @ViewChildren(LineitemResultsComponent) liResults: QueryList<PurchaseOrderResultsComponent>;
@ViewChildren(PurchaseOrderResultsComponent) poResults: QueryList<PurchaseOrderResultsComponent>;
+ @ViewChildren(InvoiceResultsComponent) invResults: QueryList<PurchaseOrderResultsComponent>;
+ @ViewChildren(PicklistResultsComponent) plResults: QueryList<PurchaseOrderResultsComponent>;
constructor(
private router: Router,
this.onTabChange = ($event) => {
if (this.validSearchTypes.includes($event.nextId)) {
+ this.searchType = $event.nextId;
this.router.navigate(['/staff', 'acq', 'search', $event.nextId]);
}
};
}
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;
+ }
}
}
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',
})
);
}
+
+ doSearch(terms: AcqSearchTerm[]) {
+ this.acqSearch.setSearchTerms(terms);
+ this.invoiceResultsGrid.reload();
+ }
}
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',
this.gridSource = this.acqSearch.getAcqSearchDataSource('lineitem');
}
+ doSearch(terms: AcqSearchTerm[]) {
+ this.acqSearch.setSearchTerms(terms);
+ this.lineitemResultsGrid.reload();
+ }
}
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';
this.picklistMergeDialog.update(); // update the dialog UI with selections
}
+ doSearch(terms: AcqSearchTerm[]) {
+ this.acqSearch.setSearchTerms(terms);
+ this.picklistResultsGrid.reload();
+ }
}