lpxxx Angular holdings maintenance wip
authorBill Erickson <berickxx@gmail.com>
Tue, 19 Mar 2019 16:19:35 +0000 (12:19 -0400)
committerBill Erickson <berickxx@gmail.com>
Tue, 19 Mar 2019 16:19:35 +0000 (12:19 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html
Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts
Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html

index bf52735..263704c 100644 (file)
@@ -1,5 +1,18 @@
 
 
+<div class="row mt-3">
+  <div class="col-lg-4">
+    <div class="input-group">
+      <div class="input-group-prepend">
+        <div class="input-group-text" i18n>Holdings Maintenance</div>
+      </div>
+      <eg-org-select [initialOrg]="contextOrg" 
+        (onChange)="contextOrgChanged($event)">
+      </eg-org-select>
+    </div>
+  </div>
+</div>
+
 <!-- Location / Barcode cell template -->
 <ng-template #locationTemplate let-row="row" let-userContext="userContext">
   <!-- pl-* is doubled for added impact -->
index 2ced83b..ac67500 100644 (file)
@@ -13,9 +13,9 @@ import {GridComponent} from '@eg/share/grid/grid.component';
 import {GridToolbarCheckboxComponent} from '@eg/share/grid/grid-toolbar-checkbox.component';
 import {ServerStoreService} from '@eg/core/server-store.service';
 import {MarkDamagedDialogComponent
-} from '@eg/staff/share/holdings/mark-damaged-dialog.component';
+    } from '@eg/staff/share/holdings/mark-damaged-dialog.component';
 import {MarkMissingDialogComponent
-} from '@eg/staff/share/holdings/mark-missing-dialog.component';
+    } from '@eg/staff/share/holdings/mark-missing-dialog.component';
 
 
 // The holdings grid models a single HoldingsTree, composed of HoldingsTreeNodes
@@ -80,7 +80,6 @@ export class HoldingsMaintenanceComponent implements OnInit {
     @ViewChild('markMissingDialog')
         private markMissingDialog: MarkMissingDialogComponent;
 
-
     holdingsTree: HoldingsTree;
 
     // nodeType => id => tree node cache
@@ -116,17 +115,7 @@ export class HoldingsMaintenanceComponent implements OnInit {
         return this._recId;
     }
 
-    // Allows the caller to update the context org unit
-    private _co: IdlObject;
-    @Input() set contextOrg(org: IdlObject) {
-        this._co = org;
-        if (this.initDone) {
-            this.hardRefresh();
-        }
-    }
-    get contextOrg(): IdlObject {
-        return this._co;
-    }
+    contextOrg: IdlObject;
 
     constructor(
         private net: NetService,
@@ -141,6 +130,9 @@ export class HoldingsMaintenanceComponent implements OnInit {
         this.refreshHoldings = true;
         this.renderFromPrefs = true;
 
+        // TODO: need a separate setting for this?
+        this.contextOrg = this.staffCat.searchContext.searchOrg;
+
         this.rowClassCallback = (row: any): string => {
              if (row.volume && !row.copy) {
                 return 'bg-info';
@@ -175,11 +167,7 @@ export class HoldingsMaintenanceComponent implements OnInit {
     ngOnInit() {
         this.initDone = true;
 
-        if (!this.contextOrg) {
-            this.contextOrg = this.org.get(this.auth.user().ws_ou());
-        }
-
-        // These are pre-cached via the resolver.
+        // These are pre-cached via the catalog resolver.
         const settings = this.store.getItemBatchCached([
             'cat.holdings_show_empty_org',
             'cat.holdings_show_empty',
@@ -198,6 +186,11 @@ export class HoldingsMaintenanceComponent implements OnInit {
         };
     }
 
+    contextOrgChanged(org: IdlObject) {
+        this.contextOrg = org;
+        this.hardRefresh();
+    }
+
     hardRefresh() {
         this.renderFromPrefs = true;
         this.refreshHoldings = true;
index d43a8bb..b583cf7 100644 (file)
@@ -66,8 +66,7 @@
       </ngb-tab>
       <ngb-tab title="Holdings View" i18n-title id="holdings">
         <ng-template ngbTabContent>
-          <eg-holdings-maintenance [recordId]="recordId" 
-            [contextOrg]="currentSearchOrg()">
+          <eg-holdings-maintenance [recordId]="recordId">
           </eg-holdings-maintenance>
         </ng-template>
       </ngb-tab>