* Bib record via UNAPI as mods (for now) with holdings summary
* and record attributes.
*/
- getBibSummary(bibId: number, orgId: number, depth: number): Promise<any> {
+ getBibSummary(bibId: number, orgId?: number, depth?: number): Promise<any> {
return new Promise((resolve, reject) => {
this.unapi.getAsXmlDocument({
target: 'bre',
import {SearchFormComponent} from './search-form.component';
import {ResultsComponent} from './result/results.component';
import {RecordComponent} from './record/record.component';
+import {EgBibSummaryComponent} from '../share/bib-summary.component';
import {ResultPaginationComponent} from './result/pagination.component';
import {ResultFacetsComponent} from './result/facets.component';
import {ResultRecordComponent} from './result/record.component';
EgCatalogComponent,
ResultsComponent,
RecordComponent,
+ EgBibSummaryComponent,
SearchFormComponent,
ResultRecordComponent,
ResultFacetsComponent,
<div id="staff-catalog-record-container">
-
- <!-- TODO MOVE RECORD SUMMARY TO SHARE MODULE -->
- <style>
- .eg-bib-record-summary {
- }
- .eg-bib-record-summary .card-body {
- padding: .25rem;
- }
- .eg-bib-record-summary .list-group-item {
- padding: .25rem;
- }
- </style>
- <div class='eg-bib-record-summary card w-100' *ngIf="staffRecord.bibSummary">
- <div class="card-header font-weight-bold" i18n>
- Record Summary
- <!-- TODO expandy at right-->
- </div>
- <div class="card-body">
- <ul class="list-group list-group-flush">
- <li class="list-group-item">
- <div class="d-flex">
- <div class="flex-1 font-weight-bold" i18n>Title</div>
- <div class="flex-3">{{staffRecord.bibSummary.title}}</div>
- <div class="flex-1 font-weight-bold pl-1" i18n>Edition</div>
- <div class="flex-2">{{staffRecord.bibSummary.edition}}</div>
- <div class="flex-1 font-weight-bold" i18n>TCN</div>
- <div class="flex-1">{{staffRecord.bibSummary.tcn_value}}</div>
- <div class="flex-1 font-weight-bold pl-1" i18n>Created By</div>
- <div class="flex-2" *ngIf="staffRecord.bibSummary.creator.usrname">
- {{staffRecord.bibSummary.creator.usrname()}}
- </div>
- </div>
- </li>
- <li class="list-group-item">
- <div class="d-flex">
- <div class="flex-1 font-weight-bold" i18n>Author</div>
- <div class="flex-3">{{staffRecord.bibSummary.author}}</div>
- <div class="flex-1 font-weight-bold pl-1" i18n>Pubdate</div>
- <div class="flex-2">{{staffRecord.bibSummary.pubdate}}</div>
- <div class="flex-1 font-weight-bold" i18n>Database ID</div>
- <div class="flex-1">{{staffRecord.bibSummary.id}}</div>
- <div class="flex-1 font-weight-bold pl-1" i18n>Last Edited By</div>
- <div class="flex-2" *ngIf="staffRecord.bibSummary.editor.usrname">
- {{staffRecord.bibSummary.editor.usrname()}}
- </div>
- </div>
- </li>
- </ul>
- </div>
- </div>
-
+ <eg-bib-summary [bibSummary]="staffRecord.bibSummary">
+ </eg-bib-summary>
</div>
from '@eg/share/catalog/search-context';
import {StaffCatalogService} from '../staff-catalog.service';
import {StaffRecordService} from './record.service';
+import {EgBibSummaryComponent} from '../../share/bib-summary.component';
@Component({
selector: 'eg-catalog-record',
) {}
ngOnInit() {
+ this.recordId = +this.route.snapshot.paramMap.get('id');
this.searchContext = this.staffCat.searchContext;
- this.staffRecord.setRecord(+this.route.snapshot.paramMap.get('id'));
+ this.staffRecord.setRecord(this.recordId);
}
}
--- /dev/null
+import {Injectable} from '@angular/core';
+import {Router, ActivatedRoute} from '@angular/router';
+import {EgOrgService} from '@eg/core/org';
+import {EgCatalogService} from '@eg/share/catalog/catalog.service';
+import {EgCatalogUrlService} from '@eg/share/catalog/catalog-url.service';
+import {CatalogSearchContext} from '@eg/share/catalog/search-context';
+import {StaffCatalogService} from '../staff-catalog.service';
+import {EgPcrudService} from '@eg/core/pcrud';
+
+/**
+ * Shared bits needed by the staff version of the catalog.
+ */
+
+@Injectable()
+export class StaffRecordService {
+
+ recordId: number;
+ bibSummary: any; // TODO: bib summary class
+ searchContext: CatalogSearchContext;
+
+ constructor(
+ private router: Router,
+ private route: ActivatedRoute,
+ private org: EgOrgService,
+ private pcrud: EgPcrudService,
+ private cat: EgCatalogService,
+ private staffCat: StaffCatalogService,
+ private catUrl: EgCatalogUrlService
+ ) { }
+
+ setRecord(id: number): void {
+ this.recordId = id;
+ this.searchContext = this.staffCat.searchContext;
+
+ this.cat.getBibSummary(
+ this.recordId,
+ this.searchContext.searchOrg.id(),
+ this.searchContext.searchOrg.ou_type().depth()
+ ).then(summary => {
+ this.bibSummary = summary;
+ this.pcrud.search('au', {id: [summary.creator, summary.editor]})
+ .subscribe(user => {
+ if (user.id() == summary.creator)
+ summary.creator = user;
+ if (user.id() == summary.editor)
+ summary.editor = user;
+ })
+
+ // probably other stuff
+ });
+ }
+}
+
+
<div class="col-3">
<div *ngIf="idx == 0" class="float-right">
<button class="btn btn-success" type="button"
+ [disabled]="searchIsActive()"
(click)="searchContext.pager.offset=0;searchByForm()">
Search
</button>
<button class="btn btn-warning" type="button"
+ [disabled]="searchIsActive()"
(click)="searchContext.reset()">
Clear Form
</button>
<button class="btn btn-outline-secondary" type="button"
*ngIf="!showAdvanced()"
+ [disabled]="searchIsActive()"
(click)="showAdvancedSearch=true">
More Filters
</button>
</div>
</div>
<div class="flex-2 pl-1">
- <div *ngIf="searchIsActive()">
- <div class="progress">
- <div class="progress-bar progress-bar-striped active w-100"
- role="progressbar" aria-valuenow="100"
- aria-valuemin="0" aria-valuemax="100">
- <span class="sr-only" i18n>Searching..</span>
- </div>
+ <!-- alignment -->
+ </div>
+ </div>
+ <div class="col-3">
+ <div *ngIf="searchIsActive()">
+ <div class="progress">
+ <div class="progress-bar progress-bar-striped active w-100"
+ role="progressbar" aria-valuenow="100"
+ aria-valuemin="0" aria-valuemax="100">
+ <span class="sr-only" i18n>Searching..</span>
</div>
</div>
</div>
--- /dev/null
+.eg-bib-summary {
+}
+.eg-bib-summary .card-body {
+ padding: .25rem;
+}
+.eg-bib-summary .list-group-item {
+ padding: .25rem;
+}
--- /dev/null
+
+<div class='eg-bib-summary card w-100' *ngIf="summary">
+ <div class="card-header font-weight-bold" i18n>
+ Record Summary
+ <!-- TODO expandy at right-->
+ </div>
+ <div class="card-body">
+ <ul class="list-group list-group-flush">
+ <li class="list-group-item">
+ <div class="d-flex">
+ <div class="flex-1 font-weight-bold" i18n>Title:</div>
+ <div class="flex-3">{{summary.title}}</div>
+ <div class="flex-1 font-weight-bold pl-1" i18n>Edition:</div>
+ <div class="flex-1">{{summary.edition}}</div>
+ <div class="flex-1 font-weight-bold" i18n>TCN:</div>
+ <div class="flex-1">{{summary.tcn_value}}</div>
+ <div class="flex-1 font-weight-bold pl-1" i18n>Created By:</div>
+ <div class="flex-1" *ngIf="summary.creator.usrname">
+ {{summary.creator.usrname()}}
+ </div>
+ </div>
+ </li>
+ <li class="list-group-item">
+ <div class="d-flex">
+ <div class="flex-1 font-weight-bold" i18n>Author:</div>
+ <div class="flex-3">{{summary.author}}</div>
+ <div class="flex-1 font-weight-bold pl-1" i18n>Pubdate:</div>
+ <div class="flex-1">{{summary.pubdate}}</div>
+ <div class="flex-1 font-weight-bold" i18n>Database ID:</div>
+ <div class="flex-1">{{summary.id}}</div>
+ <div class="flex-1 font-weight-bold pl-1" i18n>Last Edited By:</div>
+ <div class="flex-1" *ngIf="summary.editor.usrname">
+ {{summary.editor.usrname()}}
+ </div>
+ </div>
+ </li>
+ <li class="list-group-item">
+ <div class="d-flex">
+ <div class="flex-1 font-weight-bold" i18n>Bib Call #:</div>
+ <div class="flex-3">{{summary.callNumber}}</div>
+ <div class="flex-1 font-weight-bold" i18n>Record Owner:</div>
+ <div class="flex-1">TODO</div>
+ <div class="flex-1 font-weight-bold pl-1" i18n>Created On:</div>
+ <div class="flex-1">{{summary.create_date | date:'shortDate'}}</div>
+ <div class="flex-1 font-weight-bold pl-1" i18n>Last Edited On:</div>
+ <div class="flex-1">{{summary.edit_date | date:'shortDate'}}</div>
+ </div>
+ </li>
+ </ul>
+ </div>
+</div>
+
--- /dev/null
+import {Component, OnInit, Input} from '@angular/core';
+import {EgNetService} from '@eg/core/net';
+import {EgPcrudService} from '@eg/core/pcrud';
+import {EgCatalogService} from '@eg/share/catalog/catalog.service';
+
+@Component({
+ selector: 'eg-bib-summary',
+ styleUrls: ['bib-summary.component.css'],
+ templateUrl: 'bib-summary.component.html'
+})
+export class EgBibSummaryComponent implements OnInit {
+
+ // If provided, the record will be fetched by the component.
+ @Input() recordId: number;
+
+ // Otherwise, we'll use the provided bib summary object.
+ summary: any;
+ @Input() set bibSummary(s: any) {
+ if (s) {
+ this.summary = s;
+ this.fetchBibCallNumber();
+ }
+ }
+
+ constructor(
+ private cat: EgCatalogService,
+ private net: EgNetService,
+ private pcrud: EgPcrudService
+ ) {}
+
+ ngOnInit() {
+ if (this.recordId) this.loadSummary();
+ }
+
+ loadSummary(): void {
+ this.cat.getBibSummary(this.recordId).then(summary => {
+ this.summary = summary;
+ this.fetchBibCallNumber();
+
+ // Flesh the user data
+ this.pcrud.search('au', {id: [summary.creator, summary.editor]})
+ .subscribe(user => {
+ if (user.id() == summary.creator)
+ summary.creator = user;
+ if (user.id() == summary.editor)
+ summary.editor = user;
+ })
+ });
+ }
+
+ fetchBibCallNumber(): void {
+ if (!this.summary || this.summary.callNumber) return;
+
+ // TODO labelClass = cat.default_classification_scheme YAOUS
+ let labelClass = 1;
+
+ this.net.request(
+ 'open-ils.cat',
+ 'open-ils.cat.biblio.record.marc_cn.retrieve',
+ this.summary.id, labelClass
+ ).subscribe(cnArray => {
+ if (cnArray && cnArray.length > 0) {
+ let key1 = Object.keys(cnArray[0])[0];
+ this.summary.callNumber = cnArray[0][key1];
+ }
+ });
+ }
+}
+
+