import {Injectable, EventEmitter} from '@angular/core';
import {Observable} from 'rxjs';
-import {mergeMap, map, tap} from 'rxjs/operators';
+import {map, tap} from 'rxjs/operators';
import {OrgService} from '@eg/core/org.service';
import {UnapiService} from '@eg/share/catalog/unapi.service';
import {IdlService, IdlObject} from '@eg/core/idl.service';
private basket: BasketService
) {
this.onSearchComplete = new EventEmitter<CatalogSearchContext>();
-
+
}
search(ctx: CatalogSearchContext): Promise<void> {
return this.basketSearch(ctx);
} else if (ctx.marcSearch.isSearchable()) {
return this.marcSearch(ctx);
- } else if (ctx.identSearch.isSearchable() &&
+ } else if (ctx.identSearch.isSearchable() &&
ctx.identSearch.queryType === 'item_barcode') {
return this.barcodeSearch(ctx);
} else {
} else {
fullQuery = ctx.compileTermSearchQuery();
- if (ctx.termSearch.groupByMetarecord
+ if (ctx.termSearch.groupByMetarecord
&& !ctx.termSearch.fromMetarecord) {
method = 'open-ils.search.metabib.multiclass.query';
}
if (ctx.isStaff) {
method += '.staff';
}
-
+
return new Promise((resolve, reject) => {
this.net.request(
'open-ils.search', method, {
}
- // When showing titles linked to a browse entry, fetch
+ // When showing titles linked to a browse entry, fetch
// the entry data as well so the UI can display it.
fetchBrowseEntry(ctx: CatalogSearchContext) {
const ts = ctx.termSearch;
const isMeta = ctx.termSearch.isMetarecordSearch();
let observable: Observable<BibRecordSummary>;
-
+
if (isMeta) {
observable = this.bibService.getMetabibSummary(
ctx.currentResultIds(), ctx.searchOrg.id(), depth);
format => format.code() === code)[0];
if (ccvm) {
return ccvm.search_label();
- }
- }
- }
+ }
+ }
+ }
fetchCmfs(): Promise<void> {
// At the moment, we only need facet CMFs.
const orgIds = this.org.fullPath(contextOrg, true);
this.copyLocations = [];
- return this.pcrud.search('acpl',
+ return this.pcrud.search('acpl',
{deleted: 'f', opac_visible: 't', owning_lib: orgIds},
{order_by: {acpl: 'name'}},
{anonymous: true}
- ).pipe(tap(loc => this.copyLocations.push(loc))).toPromise()
+ ).pipe(tap(loc => this.copyLocations.push(loc))).toPromise();
}
browse(ctx: CatalogSearchContext): Observable<any> {
ctx.searchState = CatalogSearchState.COMPLETE;
}));
}
+
+ cnBrowse(ctx: CatalogSearchContext): Observable<any> {
+ ctx.searchState = CatalogSearchState.SEARCHING;
+ const cbs = ctx.cnBrowseSearch;
+
+ return this.net.request(
+ 'open-ils.supercat',
+ 'open-ils.supercat.call_number.browse',
+ cbs.value, ctx.searchOrg.shortname(), ctx.pager.limit, cbs.offset
+ ).pipe(tap(result => ctx.searchState = CatalogSearchState.COMPLETE));
+ }
}