]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/eg2/src/app/staff/splash.component.ts
LP1839670 Angular catalog more result page info
[working/Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / splash.component.ts
1 import {Component, OnInit, Renderer2} from '@angular/core';
2 import {Router} from '@angular/router';
3
4 @Component({
5     templateUrl: 'splash.component.html'
6 })
7
8 export class StaffSplashComponent implements OnInit {
9
10     catSearchQuery: string;
11
12     constructor(
13         private renderer: Renderer2,
14         private router: Router
15     ) {}
16
17     ngOnInit() {
18
19         // Focus catalog search form
20         this.renderer.selectRootElement('#catalog-search-input').focus();
21     }
22
23     searchCatalog(): void {
24         if (!this.catSearchQuery) { return; }
25
26         /* Route to angular6 catalog
27         this.router.navigate(
28             ['/staff/catalog/search'],
29             {queryParams: {query : this.catSearchQuery}}
30         );
31         */
32
33         // Route to AngularJS / TPAC catalog
34         window.location.href =
35             '/eg/staff/cat/catalog/results?query=' +
36             encodeURIComponent(this.catSearchQuery);
37     }
38 }
39
40