ang providers: create base modules and components
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 3 Mar 2020 23:18:55 +0000 (18:18 -0500)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 3 Mar 2020 23:18:55 +0000 (18:18 -0500)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.html [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.module.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/acq/provider/routing.module.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/acq/routing.module.ts

diff --git a/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.html b/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.html
new file mode 100644 (file)
index 0000000..e5f5842
--- /dev/null
@@ -0,0 +1,36 @@
+<eg-staff-banner bannerText="Providers" i18n-bannerText>
+</eg-staff-banner>
+
+<div class="row" id="acq-provider-page">
+  <div class="col-lg-12">
+    <ngb-tabset #acqProviderTabs [activeId]="activeTab" (tabChange)="onTabChange($event)">
+      <ngb-tab title="Search" i18n-title id="search">
+        <ng-template ngbTabContent>PROVIDER SEARCH FORM</ng-template>
+      </ngb-tab>
+      <ngb-tab title="Provider" i18n-title id="details" [disabled]="!id">
+        <ng-template ngbTabContent>PROVIDER DETAILS TAB</ng-template>
+      </ngb-tab>
+      <ngb-tab title="Addresses" i18n-title id="addresses" [disabled]="!id">
+        <ng-template ngbTabContent>PROVIDER ADDRESSES TAB</ng-template>
+      </ngb-tab>
+      <ngb-tab title="Contacts" i18n-title id="contacts" [disabled]="!id">
+        <ng-template ngbTabContent>PROVIDER CONTACTS TAB</ng-template>
+      </ngb-tab>
+      <ngb-tab title="Attribute Definitions" i18n-title id="attributes" [disabled]="!id">
+        <ng-template ngbTabContent>PROVIDER ATTRIBUTES TAB</ng-template>
+      </ngb-tab>
+      <ngb-tab title="Holdings Definitions" i18n-title id="holdings" [disabled]="!id">
+        <ng-template ngbTabContent>PROVIDER HOLDINGS TAB</ng-template>
+      </ngb-tab>
+      <ngb-tab title="EDI" i18n-title id="edi_accounts" [disabled]="!id">
+        <ng-template ngbTabContent>PROVIDER EDI TAB</ng-template>
+      </ngb-tab>
+      <ngb-tab title="Invoices" i18n-title id="invoices" [disabled]="!id">
+        <ng-template ngbTabContent>PROVIDER INVOICES TAB</ng-template>
+      </ngb-tab>
+      <ngb-tab title="POs" i18n-title id="purchase_orders" [disabled]="!id">
+        <ng-template ngbTabContent>PROVIDER PURCHASE ORDERS TAB</ng-template>
+      </ngb-tab>
+    </ngb-tabset>
+  </div>
+</div>
diff --git a/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.ts
new file mode 100644 (file)
index 0000000..9e5ba38
--- /dev/null
@@ -0,0 +1,65 @@
+import {Component, OnInit, AfterViewInit} from '@angular/core';
+import {NgbTabset, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap';
+import {Router, ActivatedRoute, ParamMap, RouterEvent, NavigationEnd} from '@angular/router';
+import {StaffCommonModule} from '@eg/staff/common.module';
+import {IdlService, IdlObject} from '@eg/core/idl.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+
+@Component({
+  templateUrl: './acq-provider.component.html'
+})
+
+export class AcqProviderComponent implements OnInit, AfterViewInit {
+
+    activeTab = '';
+    id = null;
+    validTabTypes = ['search', 'details', 'addresses', 'contacts', 'attributes', 'holdings', 'edi_accounts', 'purchase_orders', 'invoices'];
+    defaultTabType = 'details';
+
+    onTabChange: ($event: NgbTabChangeEvent) => void;
+
+    constructor(
+        private router: Router,
+        private route: ActivatedRoute,
+        private pcrud: PcrudService,
+        private idl: IdlService,
+    ) {
+    }
+
+    ngOnInit() {
+        const self = this;
+
+        const tabTypeParam = this.route.snapshot.paramMap.get('tab');
+        const idParam = this.route.snapshot.paramMap.get('id');
+
+        if (idParam) {
+            this.id = idParam;
+            if (!tabTypeParam) {
+                this.activeTab = this.defaultTabType;
+                this.router.navigate(['/staff', 'acq', 'provider', this.id, this.activeTab]);
+            }
+        }
+
+        if (tabTypeParam) {
+            if (this.validTabTypes.includes(tabTypeParam)) {
+                this.activeTab = tabTypeParam;
+            } else {
+                this.activeTab = this.defaultTabType;
+                this.router.navigate(['/staff', 'acq', 'provider', this.id, this.activeTab]);
+            }
+        } else {
+            this.activeTab = 'search';
+        }
+
+        this.onTabChange = ($event) => {
+            if (this.validTabTypes.includes($event.nextId)) {
+                this.activeTab = $event.nextId;
+                const id = this.route.snapshot.paramMap.get('id');
+                this.router.navigate(['/staff', 'acq', 'provider', this.id, $event.nextId]);
+            }
+        };
+    }
+
+    ngAfterViewInit() {}
+
+}
diff --git a/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.module.ts b/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.module.ts
new file mode 100644 (file)
index 0000000..85b08ba
--- /dev/null
@@ -0,0 +1,17 @@
+import {NgModule} from '@angular/core';
+import {StaffCommonModule} from '@eg/staff/common.module';
+import {AcqProviderRoutingModule} from './routing.module';
+import {AcqProviderComponent} from './acq-provider.component';
+
+@NgModule({
+  declarations: [
+    AcqProviderComponent,
+  ],
+  imports: [
+    StaffCommonModule,
+    AcqProviderRoutingModule
+  ]
+})
+
+export class AcqProviderModule {
+}
diff --git a/Open-ILS/src/eg2/src/app/staff/acq/provider/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/acq/provider/routing.module.ts
new file mode 100644 (file)
index 0000000..2e505c4
--- /dev/null
@@ -0,0 +1,26 @@
+import {NgModule} from '@angular/core';
+import {RouterModule, Routes} from '@angular/router';
+import {AcqProviderComponent} from './acq-provider.component';
+
+const routes: Routes = [
+  { path: '',
+    component: AcqProviderComponent,
+    runGuardsAndResolvers: 'always'
+  },
+  { path: ':id',
+    component: AcqProviderComponent,
+    runGuardsAndResolvers: 'always'
+  },
+  { path: ':id/:tab',
+    component: AcqProviderComponent,
+    runGuardsAndResolvers: 'always'
+  }
+];
+
+@NgModule({
+  imports: [RouterModule.forChild(routes)],
+  exports: [RouterModule],
+  providers: []
+})
+
+export class AcqProviderRoutingModule {}
index 1305bd0..0f2b228 100644 (file)
@@ -4,7 +4,10 @@ import {RouterModule, Routes} from '@angular/router';
 const routes: Routes = [
   { path: 'search',
     loadChildren: './search/acq-search.module#AcqSearchModule'
-  }
+  },
+  { path: 'provider',
+    loadChildren: './provider/acq-provider.module#AcqProviderModule'
+  },
 ];
 
 @NgModule({