LP1806087 More browse/search form work
authorBill Erickson <berickxx@gmail.com>
Mon, 10 Dec 2018 17:36:39 +0000 (12:36 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 10 Jan 2019 17:23:40 +0000 (12:23 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/catalog/browse.component.html
Open-ILS/src/eg2/src/app/staff/catalog/browse.component.ts
Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html
Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts

index 97742f7..b50a415 100644 (file)
@@ -1,5 +1,5 @@
 
-<eg-catalog-search-form></eg-catalog-search-form>
+<eg-catalog-search-form #searchForm></eg-catalog-search-form>
 
 <eg-catalog-browse-results><eg-catalog-browse-results>
 
index 996f965..41bf67a 100644 (file)
@@ -1,18 +1,30 @@
-import {Component, OnInit} from '@angular/core';
+import {Component, OnInit, ViewChild} from '@angular/core';
 import {StaffCatalogService} from './catalog.service';
+import {BasketService} from '@eg/share/catalog/basket.service';
+import {SearchFormComponent} from './search-form.component';
 
 @Component({
   templateUrl: 'browse.component.html'
 })
 export class BrowseComponent implements OnInit {
 
+    @ViewChild('searchForm') searchForm: SearchFormComponent;
+
     constructor(
-        private staffCat: StaffCatalogService
+        private staffCat: StaffCatalogService,
+        private basket: BasketService
     ) {}
 
     ngOnInit() {
         // A SearchContext provides all the data needed for browse.
         this.staffCat.createContext();
+
+        // Cache the basket on page load.
+        this.basket.getRecordIds();
+
+        this.searchForm.searchTab = 'browse';
     }
+
+    ngAfterViewInit() {
 }
 
index 374df5b..34e11f7 100644 (file)
@@ -299,7 +299,7 @@ TODO focus search input
               <button class="btn btn-warning mr-1" type="button"
                 [disabled]="searchIsActive()"
                 (click)="context.reset()" i18n>
-                Reset Form
+                Reset
               </button>
             </div>
           </div>
index 1944a3c..dc4c976 100644 (file)
@@ -29,7 +29,7 @@ export class SearchFormComponent implements OnInit, AfterViewInit {
         private staffCat: StaffCatalogService
     ) {
         this.copyLocations = [];
-        this.searchTab = 'term';
+        //this.searchTab = 'term';
     }
 
     ngOnInit() {
@@ -49,6 +49,10 @@ export class SearchFormComponent implements OnInit, AfterViewInit {
 
         // Avoid changing the tab in the lifecycle hook thread.
         setTimeout(() => {
+
+            // Apply a tab if none was already specified
+            if (this.searchTab) { return; }
+
             // Assumes that only one type of search will be searchable
             // at any given time.
             if (this.context.marcSearch.isSearchable()) {