acq providers: allow search form and details view to share a tab
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 3 Mar 2020 23:33:18 +0000 (18:33 -0500)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 3 Mar 2020 23:33:18 +0000 (18:33 -0500)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.html
Open-ILS/src/eg2/src/app/staff/acq/provider/acq-provider.component.ts

index e5f5842..f826482 100644 (file)
@@ -4,11 +4,15 @@
 <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>
+        <ng-template ngbTabContent>
+            <div class="col-lg-12" [hidden]="showSearchForm">
+                PROVIDER DETAILS TAB
+            </div>
+            <div class="col-lg-12" [hidden]="!showSearchForm">
+                PROVIDER SEARCH FORM
+            </div>
+        </ng-template>
       </ngb-tab>
       <ngb-tab title="Addresses" i18n-title id="addresses" [disabled]="!id">
         <ng-template ngbTabContent>PROVIDER ADDRESSES TAB</ng-template>
index 9e5ba38..961c3aa 100644 (file)
@@ -12,8 +12,9 @@ import {PcrudService} from '@eg/core/pcrud.service';
 export class AcqProviderComponent implements OnInit, AfterViewInit {
 
     activeTab = '';
+    showSearchForm = false;
     id = null;
-    validTabTypes = ['search', 'details', 'addresses', 'contacts', 'attributes', 'holdings', 'edi_accounts', 'purchase_orders', 'invoices'];
+    validTabTypes = ['details', 'addresses', 'contacts', 'attributes', 'holdings', 'edi_accounts', 'purchase_orders', 'invoices'];
     defaultTabType = 'details';
 
     onTabChange: ($event: NgbTabChangeEvent) => void;
@@ -33,6 +34,7 @@ export class AcqProviderComponent implements OnInit, AfterViewInit {
         const idParam = this.route.snapshot.paramMap.get('id');
 
         if (idParam) {
+            this.showSearchForm = false;
             this.id = idParam;
             if (!tabTypeParam) {
                 this.activeTab = this.defaultTabType;
@@ -41,6 +43,7 @@ export class AcqProviderComponent implements OnInit, AfterViewInit {
         }
 
         if (tabTypeParam) {
+            this.showSearchForm = false;
             if (this.validTabTypes.includes(tabTypeParam)) {
                 this.activeTab = tabTypeParam;
             } else {
@@ -48,7 +51,7 @@ export class AcqProviderComponent implements OnInit, AfterViewInit {
                 this.router.navigate(['/staff', 'acq', 'provider', this.id, this.activeTab]);
             }
         } else {
-            this.activeTab = 'search';
+            this.showSearchForm = true;
         }
 
         this.onTabChange = ($event) => {