<li ngbNavItem>
<a ngbNavLink i18n>Course list</a>
<ng-template ngbNavContent>
+ <div class="row">
+ <div class="col-lg-6">
+ <eg-org-family-select
+ [limitPerms]="['MANAGE_RESERVES']"
+ [selectedOrgId]="defaultOuId"
+ [(ngModel)]="searchOrgs"
+ (ngModelChange)="grid.reload()">
+ </eg-org-family-select>
+ </div>
+ </div>
+ <hr/>
+
<div class="w-100 mt-2 mb-2">
<eg-grid #grid idlClass={{idlClass}}
[dataSource]="grid_source"
import {ToastService} from '@eg/share/toast/toast.service';
import {LocaleService} from '@eg/core/locale.service';
import {AuthService} from '@eg/core/auth.service';
+import {OrgService} from '@eg/core/org.service';
+import {OrgFamily} from '@eg/share/org-family-select/org-family-select.component';
import {CourseAssociateMaterialComponent
} from './course-associate-material.component';
grid_source: GridDataSource = new GridDataSource();
currentMaterials: any[] = [];
search_value = '';
+ defaultOuId = 1;
+ searchOrgs: OrgFamily;
defaultTerm: IdlObject;
private locale: LocaleService,
private auth: AuthService,
private idl: IdlService,
+ private org: OrgService,
private pcrud: PcrudService,
private router: Router,
private toast: ToastService
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() || this.org.root().id();
+ this.defaultTerm.owning_lib(this.defaultOuId);
+ this.searchOrgs = {primaryOrgId: this.defaultOuId};
}
ngAfterViewInit() {
// 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});
};
}