start laying out the Angular acq search app
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 22 Oct 2019 19:29:40 +0000 (15:29 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 16 Jan 2020 21:38:28 +0000 (16:38 -0500)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/acq/routing.module.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.component.html [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.component.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.module.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/acq/search/routing.module.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/nav.component.html
Open-ILS/src/eg2/src/app/staff/routing.module.ts
Open-ILS/src/templates/staff/navbar.tt2

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 (file)
index 0000000..1305bd0
--- /dev/null
@@ -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 (file)
index 0000000..d41f6ed
--- /dev/null
@@ -0,0 +1,20 @@
+<eg-staff-banner bannerText="Acquisitions Search" i18n-bannerText>
+</eg-staff-banner>
+
+<div class="row">
+  <div class="ml-auto mr-3"><a i18n href="/eg/staff/acq/legacy/search/unified">Legacy Search Interface</a></div>
+</div>
+<div class="row">
+  <div class="col-lg-12">
+    <ngb-tabset #acqSearchTabs [activeId]="searchType" (tabChange)="onTabChange($event)">
+      <ngb-tab title="Line Items Search" i18n-title id="lineitems">
+      </ngb-tab>
+      <ngb-tab title="Purchase Orders Search" i18n-title id="purchaseorders">
+      </ngb-tab>
+      <ngb-tab title="Invoices Search" i18n-title id="invoices">
+      </ngb-tab>
+      <ngb-tab title="Selection Lists Search" i18n-title id="selectionlists">
+      </ngb-tab>
+    </ngb-tabset>
+  </div>
+</div>
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 (file)
index 0000000..dfc1270
--- /dev/null
@@ -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 (file)
index 0000000..418402c
--- /dev/null
@@ -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 (file)
index 0000000..c4a4f68
--- /dev/null
@@ -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 {}
index 265368a..34d8503 100644 (file)
         </a>
         <div class="dropdown-menu" ngbDropdownMenu>
           <a class="dropdown-item" 
-            href="/eg/staff/acq/legacy/search/unified">
+            routerLink="/staff/acq/search">
             <span class="material-icons">search</span>
             <span i18n>General Search</span>
           </a>
index e390a3d..59aab99 100644 (file)
@@ -19,6 +19,9 @@ const routes: Routes = [{
     redirectTo: 'splash',
     pathMatch: 'full',
   }, {
+    path: 'acq',
+    loadChildren : '@eg/staff/acq/routing.module#AcqRoutingModule'
+  }, {
     path: 'booking',
     loadChildren : '@eg/staff/booking/booking.module#BookingModule'
   }, {
index 1028f42..818cde4 100644 (file)
         </a>
         <ul uib-dropdown-menu>
           <li>
-            <a href="./acq/legacy/search/unified" target="_self">
+            <a href="/eg2/staff/acq/search" target="_self">
               <span class="glyphicon glyphicon-search"></span>
               [% l('General Search') %]
             </a>