From: Galen Charlton Date: Tue, 3 Mar 2020 23:18:55 +0000 (-0500) Subject: ang providers: create base modules and components X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b314687b0861d185de74963c86c070b295cf942f;p=working%2FEvergreen.git ang providers: create base modules and components Signed-off-by: Galen Charlton --- 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 index 0000000000..e5f5842ce6 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.html @@ -0,0 +1,36 @@ + + + +
+
+ + + PROVIDER SEARCH FORM + + + PROVIDER DETAILS TAB + + + PROVIDER ADDRESSES TAB + + + PROVIDER CONTACTS TAB + + + PROVIDER ATTRIBUTES TAB + + + PROVIDER HOLDINGS TAB + + + PROVIDER EDI TAB + + + PROVIDER INVOICES TAB + + + PROVIDER PURCHASE ORDERS TAB + + +
+
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 index 0000000000..9e5ba3832f --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.ts @@ -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 index 0000000000..85b08bafc3 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.module.ts @@ -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 index 0000000000..2e505c4fc1 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/acq/provider/routing.module.ts @@ -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 {} 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 index 1305bd0ea2..0f2b22871a 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/routing.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/routing.module.ts @@ -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({