From: Galen Charlton Date: Tue, 22 Oct 2019 19:29:40 +0000 (-0400) Subject: start laying out the Angular acq search app X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=95fb9310dba5256d0bc756bd4953e507bee6915c;p=working%2FEvergreen.git start laying out the Angular acq search app Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/staff/acq/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/acq/routing.module.ts new file mode 100644 index 0000000000..1305bd0ea2 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/acq/routing.module.ts @@ -0,0 +1,15 @@ +import {NgModule} from '@angular/core'; +import {RouterModule, Routes} from '@angular/router'; + +const routes: Routes = [ + { path: 'search', + loadChildren: './search/acq-search.module#AcqSearchModule' + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) + +export class AcqRoutingModule {} diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.component.html b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.component.html new file mode 100644 index 0000000000..d41f6ed066 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.component.html @@ -0,0 +1,20 @@ + + + + +
+
+ + + + + + + + + + +
+
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 new file mode 100644 index 0000000000..dfc12708cb --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.component.ts @@ -0,0 +1,45 @@ +import {Component, OnInit, AfterViewInit, ViewChild} from '@angular/core'; +import {NgbTabset, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap'; +import {Router, ActivatedRoute} from '@angular/router'; +import {StaffCommonModule} from '@eg/staff/common.module'; + +@Component({ + templateUrl: './acq-search.component.html' +}) + +export class AcqSearchComponent implements OnInit, AfterViewInit { + + searchType = ''; + validSearchTypes = ['lineitems', 'purchaseorders', 'invoices', 'selectionlists']; + defaultSearchType = 'lineitems'; + + onTabChange: ($event: NgbTabChangeEvent) => void; + @ViewChild('acqSearchTabs', { static: true }) tabs: NgbTabset; + + constructor( + private router: Router, + private route: ActivatedRoute, + ) {} + + ngOnInit() { + let searchTypeParam = this.route.snapshot.paramMap.get('searchtype'); + + if (searchTypeParam) { + if (this.validSearchTypes.includes(searchTypeParam)) { + this.searchType = searchTypeParam; + } else { + this.searchType = this.defaultSearchType; + this.router.navigate(['/staff', 'acq', 'search', this.searchType]); + } + } + + this.onTabChange = ($event) => { + if (this.validSearchTypes.includes($event.nextId)) { + this.router.navigate(['/staff', 'acq', 'search', $event.nextId]); + } + }; + } + + ngAfterViewInit() {} + +} diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.module.ts b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.module.ts new file mode 100644 index 0000000000..418402c787 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.module.ts @@ -0,0 +1,17 @@ +import {NgModule} from '@angular/core'; +import {StaffCommonModule} from '@eg/staff/common.module'; +import {AcqSearchRoutingModule} from './routing.module' +import {AcqSearchComponent} from './acq-search.component'; + +@NgModule({ + declarations: [ + AcqSearchComponent + ], + imports: [ + StaffCommonModule, + AcqSearchRoutingModule + ], +}) + +export class AcqSearchModule { +} diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/acq/search/routing.module.ts new file mode 100644 index 0000000000..c4a4f68e50 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/routing.module.ts @@ -0,0 +1,20 @@ +import {NgModule} from '@angular/core'; +import {RouterModule, Routes} from '@angular/router'; +import {AcqSearchComponent} from './acq-search.component'; + +const routes: Routes = [ + { path: '', + component: AcqSearchComponent + }, + { path: ':searchtype', + component: AcqSearchComponent + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], + providers: [] +}) + +export class AcqSearchRoutingModule {} diff --git a/Open-ILS/src/eg2/src/app/staff/nav.component.html b/Open-ILS/src/eg2/src/app/staff/nav.component.html index 265368a62a..34d850304d 100644 --- a/Open-ILS/src/eg2/src/app/staff/nav.component.html +++ b/Open-ILS/src/eg2/src/app/staff/nav.component.html @@ -239,7 +239,7 @@