lp1925092: first stab user/sandbergja/lp1925092
authorJane Sandberg <sandbej@linnbenton.edu>
Wed, 23 Jun 2021 23:59:51 +0000 (16:59 -0700)
committerJane Sandberg <sandbej@linnbenton.edu>
Wed, 23 Jun 2021 23:59:51 +0000 (16:59 -0700)
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.html
Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-list.component.ts

index 2031ee9..299bf74 100644 (file)
@@ -9,6 +9,19 @@
 <eg-string #archiveSuccessString i18n-text text="Archival of {{tableName}} succeeded"></eg-string>
 <eg-string #flairTooltip i18n-text text="Limited Editing"></eg-string>
 
+<div class="row">
+  <div class="col-lg-6">
+    <eg-org-family-select
+      limitPerms="MANAGE_RESERVES" 
+      [selectedOrgId]="auth.user().ws_ou()"
+      [(ngModel)]="searchOrgs"
+      (ngModelChange)="grid.reload()">
+    </eg-org-family-select>
+    </div>
+</div>
+<hr/>
+
+
 <ul ngbNav #courseListNav="ngbNav" class="nav-tabs">
   <li ngbNavItem>
     <a ngbNavLink i18n>Course list</a>
index a2e7328..f0d1539 100644 (file)
@@ -11,6 +11,7 @@ import {StringComponent} from '@eg/share/string/string.component';
 import {ToastService} from '@eg/share/toast/toast.service';
 import {LocaleService} from '@eg/core/locale.service';
 import {AuthService} from '@eg/core/auth.service';
+import {OrgFamily} from '@eg/share/org-family-select/org-family-select.component';
 
 import {CourseAssociateMaterialComponent
     } from './course-associate-material.component';
@@ -46,6 +47,8 @@ export class CourseListComponent implements OnInit, AfterViewInit {
     grid_source: GridDataSource = new GridDataSource();
     currentMaterials: any[] = [];
     search_value = '';
+    defaultOuId = 1;
+    searchOrgs: OrgFamily;
     defaultTerm: IdlObject;
 
 
@@ -62,7 +65,9 @@ export class CourseListComponent implements OnInit, AfterViewInit {
     ngOnInit() {
         this.getSource();
         this.defaultTerm = this.idl.create('acmt');
-        this.defaultTerm.owning_lib(this.auth.user().ws_ou());
+        this.defaultOuId = this.auth.user().ws_ou() || 1;
+        this.defaultTerm.owning_lib(this.defaultOuId);
+        this.searchOrgs = {primaryOrgId: this.defaultOuId};
     }
 
     ngAfterViewInit() {
@@ -91,12 +96,17 @@ export class CourseListComponent implements OnInit, AfterViewInit {
                 // Default sort field
                 orderBy[this.idlClass] = this.sortField;
             }
+            const search: any = new Array();
+            const orgFilter: any = {};
+            orgFilter['owning_lib'] =
+                this.searchOrgs.orgIds || [this.defaultOuId];
+            search.push(orgFilter);
             const searchOps = {
                 offset: pager.offset,
                 limit: pager.limit,
                 order_by: orderBy
             };
-            return this.pcrud.retrieveAll(this.idlClass, searchOps, {fleshSelectors: true});
+            return this.pcrud.search(this.idlClass, search, searchOps, {fleshSelectors: true});
         };
     }